Drivers for any device using feetech's servomotors communication bus. More...

Detailed Description

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.

Files

file  feetech_protocol.h
 Feetech protocol definitions.
 
file  feetech_reader.h
 Interface definition for Feetech packet reader.
 
file  feetech_writer.h
 Interface definition for Feetech packet writer.
 
file  feetech.h
 Interface definition for Feetech devices driver.
 

Data Structures

struct  feetech_t
 Descriptor struct for a feetech device. More...
 

Typedefs

typedef uint8_t feetech_id_t
 device id type
 
typedef uint8_t feetech_addr_t
 address type
 

Enumerations

enum  { FEETECH_OK, FEETECH_TIMEOUT, FEETECH_BUFFER_TOO_SMALL, FEETECH_INVALID_MESSAGE }
 Possible feetech return values. More...
 

Functions

int feetech_ping (uart_half_duplex_t *stream, feetech_id_t id)
 Send a PING message to a device. More...
 
void feetech_init (feetech_t *device, uart_half_duplex_t *stream, feetech_id_t id)
 Initialize a Feetech device. More...
 
int feetech_write8 (const feetech_t *device, feetech_addr_t addr, uint8_t value)
 Write to a device 8bits address. More...
 
int feetech_write16 (const feetech_t *device, feetech_addr_t addr, uint16_t value)
 Write to a device 16bits address. More...
 
int feetech_write (const feetech_t *device, feetech_addr_t addr, const uint8_t *data, size_t length)
 Write to a device address. More...
 
int feetech_read8 (const feetech_t *device, feetech_addr_t addr, uint8_t *value)
 Read from a device 8bits address. More...
 
int feetech_read16 (const feetech_t *device, feetech_addr_t addr, uint16_t *value)
 Read from a device 16bits address. More...
 
int feetech_read (const feetech_t *device, feetech_addr_t addr, uint8_t *data, size_t length)
 Read from a device address. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Possible feetech return values.

Enumerator
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.

Definition at line 50 of file feetech.h.

Function Documentation

◆ feetech_init()

void feetech_init ( feetech_t device,
uart_half_duplex_t stream,
feetech_id_t  id 
)

Initialize a Feetech device.

Parameters
[out]devicethe Feetech device
[in]streamthe stream
[in]idthe device address

◆ feetech_ping()

int feetech_ping ( uart_half_duplex_t stream,
feetech_id_t  id 
)

Send a PING message to a device.

Parameters
[in]streamthe stream
[in]idthe device address
Returns
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

◆ feetech_read()

int feetech_read ( const feetech_t device,
feetech_addr_t  addr,
uint8_t *  data,
size_t  length 
)

Read from a device address.

Parameters
[in]devicethe Feetech device
[in]addrthe address to start read
[out]datathe data buffer to fill
[in]lengththe data length
Returns
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

◆ feetech_read16()

int feetech_read16 ( const feetech_t device,
feetech_addr_t  addr,
uint16_t *  value 
)

Read from a device 16bits address.

Parameters
[in]devicethe Feetech device
[in]addrthe address to read
[out]valuethe value to read
Returns
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

◆ feetech_read8()

int feetech_read8 ( const feetech_t device,
feetech_addr_t  addr,
uint8_t *  value 
)

Read from a device 8bits address.

Parameters
[in]devicethe Feetech device
[in]addrthe address to read
[out]valuethe value to read
Returns
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

◆ feetech_write()

int feetech_write ( const feetech_t device,
feetech_addr_t  addr,
const uint8_t *  data,
size_t  length 
)

Write to a device address.

Parameters
[in]devicethe Feetech device
[in]addrthe address to start write
[in]datathe data to write
[in]lengththe data length
Returns
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

◆ feetech_write16()

int feetech_write16 ( const feetech_t device,
feetech_addr_t  addr,
uint16_t  value 
)

Write to a device 16bits address.

Parameters
[in]devicethe Feetech device
[in]addrthe address to write
[in]valuethe value to write
Returns
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

◆ feetech_write8()

int feetech_write8 ( const feetech_t device,
feetech_addr_t  addr,
uint8_t  value 
)

Write to a device 8bits address.

Parameters
[in]devicethe Feetech device
[in]addrthe address to write
[in]valuethe value to write
Returns
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