Main Page | Directories | File List | Globals | Examples

bsStepperDevice.h File Reference

interface to the motor control module BMxxxx. More...

#include <bluemelon/types.h>
#include <bluesense/external/bsDeviceInterface.h>

Typedefs

typedef _bsStepperDevice_specificsStruct * bsStepperDevice_specifics_t

Functions

DECLSPEC bsStepperDevice_specifics_t bsStepperDevice_getDeviceSpecifics (bsDeviceTable_deviceInfo_t deviceInstancePtr)
DECLSPEC uint8_t bsStepperDevice_requestSetConfig (bsStepperDevice_specifics_t stp, uint16_t current, uint8_t autostop, uint8_t halfStep, uint8_t waveDrive, uint8_t fastDecay)
DECLSPEC uint8_t bsStepperDevice_requestGetConfig (bsStepperDevice_specifics_t stp)
DECLSPEC void bsStepperDevice_getPendingConfig (bsStepperDevice_specifics_t stp, uint16_t *current, uint8_t *autostop, uint8_t *halfStep, uint8_t *waveDrive, uint8_t *fastDecay)
DECLSPEC uint8_t bsStepperDevice_getRequestSetConfigDone (bsStepperDevice_specifics_t stp)
DECLSPEC uint8_t bsStepperDevice_getRequestGetConfigDone (bsStepperDevice_specifics_t stp)
DECLSPEC void bsStepperDevice_getCurrentConfig (bsStepperDevice_specifics_t stp, uint16_t *current, uint8_t *autostop, uint8_t *halfStep, uint8_t *waveDrive, uint8_t *fastDecay)
DECLSPEC uint8_t bsStepperDevice_requestSetSpeed (bsStepperDevice_specifics_t stp, int8_t speed)
DECLSPEC uint8_t bsStepperDevice_requestSetStepCount (bsStepperDevice_specifics_t stp, int8_t speed, int16_t stepCount)
DECLSPEC uint8_t bsStepperDevice_requestGetState (bsStepperDevice_specifics_t stp)
DECLSPEC int16_t bsStepperDevice_getCurrentStepCount (bsStepperDevice_specifics_t stp)
DECLSPEC int8_t bsStepperDevice_getPendingSpeed (bsStepperDevice_specifics_t stp)
DECLSPEC uint8_t bsStepperDevice_getRequestSetSpeedDone (bsStepperDevice_specifics_t stp)
DECLSPEC int8_t bsStepperDevice_getCurrentSpeed (bsStepperDevice_specifics_t stp)
DECLSPEC void bsStepperDevice_reset (bsStepperDevice_specifics_t stp)
DECLSPEC void bsStepperDevice_setTimeOutUs (bsStepperDevice_specifics_t stp, uint32_t timeOutUs)
DECLSPEC uint32_t bsStepperDevice_getTimeOutUs (bsStepperDevice_specifics_t stp)


Detailed Description

interface to the motor control module BMxxxx.


Typedef Documentation

typedef struct _bsStepperDevice_specificsStruct* bsStepperDevice_specifics_t
 

This (opaque) structure represents the device specific data of a motor device.

Examples:
analogue_in.c, and stepper.c.


Function Documentation

DECLSPEC void bsStepperDevice_getCurrentConfig bsStepperDevice_specifics_t  stp,
uint16_t *  current,
uint8_t *  autostop,
uint8_t *  halfStep,
uint8_t *  waveDrive,
uint8_t *  fastDecay
 

Returns values associated with the current configuration

Parameters:
stp a pointer to the motorDevice's instance specific data See requestSetConfig for more details.

DECLSPEC int8_t bsStepperDevice_getCurrentSpeed bsStepperDevice_specifics_t  stp  ) 
 

Returns the current set speed of a specific motor.

Parameters:
stp a pointer to the motorDevice's instance specific data
Returns:
the speed off the motor.

DECLSPEC int16_t bsStepperDevice_getCurrentStepCount bsStepperDevice_specifics_t  stp  ) 
 

Returns the current step count (updated after a requestGetState) (v2 module firmware only)

Parameters:
stp a pointer to the stepperDevice's instance specific data
Returns:
the current step count (-1 if set to continuous speed)

DECLSPEC bsStepperDevice_specifics_t bsStepperDevice_getDeviceSpecifics bsDeviceTable_deviceInfo_t  deviceInstancePtr  ) 
 

Returns a Stepper device instance from a device info pointer (obtained from the device table).

Returns:
the instance of an Servo Interface. Or null if the device is inaccessible (eg. wrong type, not found).
Examples:
analogue_in.c, and stepper.c.

DECLSPEC void bsStepperDevice_getPendingConfig bsStepperDevice_specifics_t  stp,
uint16_t *  current,
uint8_t *  autostop,
uint8_t *  halfStep,
uint8_t *  waveDrive,
uint8_t *  fastDecay
 

Returns values associated with a configuration set request

Parameters:
stp a pointer to the motorDevice's instance specific data See requestSetConfig for more details.

DECLSPEC int8_t bsStepperDevice_getPendingSpeed bsStepperDevice_specifics_t  stp  ) 
 

Returns the speed of a specific motor, which is currently underway to the device

Parameters:
stp a pointer to the motorDevice's instance specific data
Returns:
the speed to be set on the motor. Note that each speed is a value between -128 and 127. -128 to -1 represent a speed left, 0 stand still and 1 to 127 a speed right, the actual physical speed depends on the specifications of the connected motor.

DECLSPEC uint8_t bsStepperDevice_getRequestGetConfigDone bsStepperDevice_specifics_t  stp  ) 
 

Parameters:
stp a pointer to the motorDevice's instance specific data
Returns:
true when the configuration get request has been completed

DECLSPEC uint8_t bsStepperDevice_getRequestSetConfigDone bsStepperDevice_specifics_t  stp  ) 
 

Parameters:
stp a pointer to the motorDevice's instance specific data
Returns:
true when the configuration has been changed
Examples:
stepper.c.

DECLSPEC uint8_t bsStepperDevice_getRequestSetSpeedDone bsStepperDevice_specifics_t  stp  ) 
 

Checks if the speed set request is finished

Parameters:
stp a pointer to the motorDevice's instance specific data
Returns:
1 if request finished, 0 if request still busy

DECLSPEC uint32_t bsStepperDevice_getTimeOutUs bsStepperDevice_specifics_t  stp  ) 
 

Returns the current set time out delay. The time out delay is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
stp a pointer to the motorDevice's instance specific data
Returns:
the time out value in microseconds.

DECLSPEC uint8_t bsStepperDevice_requestGetConfig bsStepperDevice_specifics_t  stp  ) 
 

Sends a request to retrieve configuration

Parameters:
stp a pointer to the motorDevice's instance specific data

DECLSPEC uint8_t bsStepperDevice_requestGetState bsStepperDevice_specifics_t  stp  ) 
 

Sends a request to retrieve the current speed and step count (v2 module firmware only)

Parameters:
stp a pointer to the stepperDevice's instance specific data

DECLSPEC uint8_t bsStepperDevice_requestSetConfig bsStepperDevice_specifics_t  stp,
uint16_t  current,
uint8_t  autostop,
uint8_t  halfStep,
uint8_t  waveDrive,
uint8_t  fastDecay
 

Sends a request to configure the device

Parameters:
stp a pointer to the motorDevice's instance specific data
current a value in mA which drivers the stepper motor. Warning: a wrong value can damage your motor.
autostop true --> motor is disabled when limit switch is activated
halfStep true --> use half steps in stead of full steps
waveDrive true --> enables wave drive (noise cancelation)
fastDecay true --> fast Decay mode, false --> normal decay mode
Examples:
analogue_in.c, and stepper.c.

DECLSPEC uint8_t bsStepperDevice_requestSetSpeed bsStepperDevice_specifics_t  stp,
int8_t  speed
 

Requests the motor device to set new speed

Parameters:
stp a pointer to the stepperDevice's instance specific data
speed an uint8_t representing the new speed of the motor. Note that each speed is a value between -128 and 127. -128 to -1 represent a speed left, 0 stand still and 1 to 127 a speed right, the actual physical speed depends on the specifications of the connected motor.
Examples:
analogue_in.c, and stepper.c.

DECLSPEC uint8_t bsStepperDevice_requestSetStepCount bsStepperDevice_specifics_t  stp,
int8_t  speed,
int16_t  stepCount
 

Request the stepper device to advance position (v2 module firmare only)

Parameters:
stp a pointer to the stepperDevice's instance speicific data
speed an uint8_t representing the new speed of the motor.
stepCount the number of steps to execute. -1 will cause the motor to advance steps continuously Note that each speed is a value between -128 and 127. -128 to -1 represent a speed left, 0 stand still and 1 to 127 a speed right, the actual physical speed depends on the specifications of the connected motor. In most steppermotors there are 200 steps (1.8 degree per step) in one rotation.

DECLSPEC void bsStepperDevice_reset bsStepperDevice_specifics_t  stp  ) 
 

Resets the internal state of the software, this causes the state of the module to be retrieved from the hardware. Also the timout and offset values are reset to their defaults.

Parameters:
stp a pointer to the motorDevice's instance specific data

DECLSPEC void bsStepperDevice_setTimeOutUs bsStepperDevice_specifics_t  stp,
uint32_t  timeOutUs
 

Sets the time out value which is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
stp a pointer to the motorDevice's instance specific data
timeOutUs the value in microseconds which is the maximum duraion between a request and its answer.


Generated on Mon Jan 21 17:51:55 2008 for BlueSense by  doxygen 1.4.4