Main Page | Directories | File List | Globals | Examples

bsMotorDevice.h File Reference

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

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

Defines

#define BLUESENSE_MOTORCONTROLLER_MOTORCOUNT   2

Typedefs

typedef _bsMotorDevice_specificsStruct * bsMotorDevice_specifics_t

Enumerations

enum  bsMotorDevice_portEnum

Functions

DECLSPEC bsMotorDevice_specifics_t bsMotorDevice_getDeviceSpecifics (bsDeviceTable_deviceInfo_t deviceInstancePtr)
DECLSPEC uint8_t bsMotorDevice_requestSetSpeeds (bsMotorDevice_specifics_t mtr, uint8_t relevantSpeeds, int8_t *speeds)
DECLSPEC uint8_t bsMotorDevice_requestSetSpeed (bsMotorDevice_specifics_t mtr, bsMotorDevice_portEnum port, int8_t speed)
DECLSPEC uint8_t bsMotorDevice_requestGetSpeeds (bsMotorDevice_specifics_t mtr)
DECLSPEC void bsMotorDevice_getPendingSpeeds (bsMotorDevice_specifics_t mtr, int8_t *speeds)
DECLSPEC int8_t bsMotorDevice_getPendingSpeed (bsMotorDevice_specifics_t mtr, bsMotorDevice_portEnum port)
DECLSPEC uint8_t bsMotorDevice_getRequestSetSpeedsDone (bsMotorDevice_specifics_t mtr)
DECLSPEC int8_t bsMotorDevice_getCurrentSpeed (bsMotorDevice_specifics_t mtr, bsMotorDevice_portEnum port)
DECLSPEC void bsMotorDevice_getCurrentSpeeds (bsMotorDevice_specifics_t mtr, int8_t *speedArray)
DECLSPEC void bsMotorDevice_reset (bsMotorDevice_specifics_t mtr)
DECLSPEC void bsMotorDevice_setTimeOutUs (bsMotorDevice_specifics_t mtr, uint32_t timeOutUs)
DECLSPEC uint32_t bsMotorDevice_getTimeOutUs (bsMotorDevice_specifics_t mtr)


Detailed Description

interface to the motor control module BMxxxx.


Define Documentation

#define BLUESENSE_MOTORCONTROLLER_MOTORCOUNT   2
 

The number of motors that can be controlled

Examples:
motor.c.


Typedef Documentation

typedef struct _bsMotorDevice_specificsStruct* bsMotorDevice_specifics_t
 

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

Examples:
motor.c.


Enumeration Type Documentation

enum bsMotorDevice_portEnum
 

This enumeration describes the motor output ports


Function Documentation

DECLSPEC int8_t bsMotorDevice_getCurrentSpeed bsMotorDevice_specifics_t  mtr,
bsMotorDevice_portEnum  port
 

Returns the current set speed of a specific motor.

Parameters:
mtr a pointer to the motorDevice's instance specific data
port the port of the motor motor.
See also:
bsMotorDevice_portEnum
Returns:
the speed off the motor.

DECLSPEC void bsMotorDevice_getCurrentSpeeds bsMotorDevice_specifics_t  mtr,
int8_t *  speedArray
 

Fills an array with the current set speeds.

Parameters:
mtr a pointer to the motorDevice's instance specific data
speedArray a pointer to an array of uint8_t speeds with enough space for all motors.
See also:
BLUESENSE_MOTORCONTROLLER_MOTORCOUNT 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 bsMotorDevice_specifics_t bsMotorDevice_getDeviceSpecifics bsDeviceTable_deviceInfo_t  deviceInstancePtr  ) 
 

Returns a Motor 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:
motor.c.

DECLSPEC int8_t bsMotorDevice_getPendingSpeed bsMotorDevice_specifics_t  mtr,
bsMotorDevice_portEnum  port
 

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

Parameters:
mtr a pointer to the motorDevice's instance specific data
port the motor motor port.
See also:
bsMotorDevice_portEnum
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 void bsMotorDevice_getPendingSpeeds bsMotorDevice_specifics_t  mtr,
int8_t *  speeds
 

Fills an array with speeds which are currently underway to the device

Parameters:
mtr a pointer to the motorDevice's instance specific data
speeds a pointer to an array of uint8_t speeds with enough space for all motors.
See also:
BLUESENSE_MOTORCONTROLLER_MOTORCOUNT 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 bsMotorDevice_getRequestSetSpeedsDone bsMotorDevice_specifics_t  mtr  ) 
 

Checks if the speed set request is finished

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

DECLSPEC uint32_t bsMotorDevice_getTimeOutUs bsMotorDevice_specifics_t  mtr  ) 
 

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:
mtr a pointer to the motorDevice's instance specific data
Returns:
the time out value in microseconds.

DECLSPEC uint8_t bsMotorDevice_requestGetSpeeds bsMotorDevice_specifics_t  mtr  ) 
 

Sends a request to retrieve the current set speeds

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

DECLSPEC uint8_t bsMotorDevice_requestSetSpeed bsMotorDevice_specifics_t  mtr,
bsMotorDevice_portEnum  port,
int8_t  speed
 

Requests the motor device to set one of its motors to a new speed

Parameters:
mtr a pointer to the motorDevice's instance specific data
port the motor motor port.
See also:
bsMotorDevice_portEnum
Parameters:
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.

DECLSPEC uint8_t bsMotorDevice_requestSetSpeeds bsMotorDevice_specifics_t  mtr,
uint8_t  relevantSpeeds,
int8_t *  speeds
 

Requests the motor device to set its motors to new speeds

Parameters:
mtr a pointer to the motorDevice's instance specific data
relevantSpeeds a bit mask indicating which motors to update
speeds a pointer to an array of int8_t speeds with enough space for all motors.
See also:
BLUESENSE_MOTORCONTROLLER_MOTORCOUNT Only those speeds for which a bit in the bit mask is set will be sent to the device. 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:
motor.c.

DECLSPEC void bsMotorDevice_reset bsMotorDevice_specifics_t  mtr  ) 
 

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:
mtr a pointer to the motorDevice's instance specific data

DECLSPEC void bsMotorDevice_setTimeOutUs bsMotorDevice_specifics_t  mtr,
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:
mtr 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