Feetech driver

Drivers for any device using feetech’s servomotors communication bus.

The bus is mainly used for servomotors, but a device can be anything : sensors, other actuators.

enum @120
FEETECH_OK
Success.
FEETECH_TIMEOUT
No response from the device.
FEETECH_BUFFER_TOO_SMALL
Buffer is too small for the message.
FEETECH_INVALID_MESSAGE
Invalid message received.
uint8_t feetech_id_t

device id type

uint8_t feetech_addr_t

address type

int feetech_ping(uart_half_duplex_t * stream, feetech.h::feetech_id_t id)

Send a PING message to a device.

Parameters

stream:the stream
id:the device address

Return values

  • FEETECH_OK if a device answered
  • FEETECH_TIMEOUT if the device did not answer
  • FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
  • FEETECH_INVALID_MESSAGE if an invalid message was received
void feetech_init(feetech_t * device, uart_half_duplex_t * stream, feetech.h::feetech_id_t id)

Initialize a Feetech device.

Parameters

device:the Feetech device
stream:the stream
id:the device address

int feetech_write8(const feetech_t * device, feetech.h::feetech_addr_t addr, uint8_t value)

Write to a device 8bits address.

Parameters

device:the Feetech device
addr:the address to write
value:the value to write

Return values

  • FEETECH_OK on success
  • FEETECH_TIMEOUT if the device did not answer
  • FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
  • FEETECH_INVALID_MESSAGE if an invalid message was received
int feetech_write16(const feetech_t * device, feetech.h::feetech_addr_t addr, uint16_t value)

Write to a device 16bits address.

Parameters

device:the Feetech device
addr:the address to write
value:the value to write

Return values

  • FEETECH_OK on success
  • FEETECH_TIMEOUT if the device did not answer
  • FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
  • FEETECH_INVALID_MESSAGE if an invalid message was received
int feetech_write(const feetech_t * device, feetech.h::feetech_addr_t addr, const uint8_t * data, msp430_types.h::size_t length)

Write to a device address.

Parameters

device:the Feetech device
addr:the address to start write
data:the data to write
length:the data length

Return values

  • FEETECH_OK on success
  • FEETECH_TIMEOUT if the device did not answer
  • FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
  • FEETECH_INVALID_MESSAGE if an invalid message was received
int feetech_read8(const feetech_t * device, feetech.h::feetech_addr_t addr, uint8_t * value)

Read from a device 8bits address.

Parameters

device:the Feetech device
addr:the address to read
value:the value to read

Return values

  • FEETECH_OK on success
  • FEETECH_TIMEOUT if the device did not answer
  • FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
  • FEETECH_INVALID_MESSAGE if an invalid message was received
int feetech_read16(const feetech_t * device, feetech.h::feetech_addr_t addr, uint16_t * value)

Read from a device 16bits address.

Parameters

device:the Feetech device
addr:the address to read
value:the value to read

Return values

  • FEETECH_OK on success
  • FEETECH_TIMEOUT if the device did not answer
  • FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
  • FEETECH_INVALID_MESSAGE if an invalid message was received
int feetech_read(const feetech_t * device, feetech.h::feetech_addr_t addr, uint8_t * data, msp430_types.h::size_t length)

Read from a device address.

Parameters

device:the Feetech device
addr:the address to start read
data:the data buffer to fill
length:the data length

Return values

  • FEETECH_OK on success
  • FEETECH_TIMEOUT if the device did not answer
  • FEETECH_BUFFER_TOO_SMALL if buffer is too small for the message
  • FEETECH_INVALID_MESSAGE if an invalid message was received
struct feetech_t

Descriptor struct for a feetech device.

uart_half_duplex_t * stream

the stream used

feetech.h::feetech_id_t id

the device address