Interface definition for Feetech packet reader. More...
Interface definition for Feetech packet reader.
Definition in file feetech_reader.h.
Go to the source code of this file.
Data Structures | |
struct | feetech_reader_t |
Feetech packet reader struct. More... | |
#define | FEETECH_ACK_SIZE (6) |
#define | FEETECH_RESPONSE_SIZE(len) (6 + len) |
static void | feetech_reader_init (feetech_reader_t *reader, const uint8_t *buffer, size_t size) |
Initialize the Feetech packet reader. More... | |
uint8_t | feetech_reader_compute_sum (const feetech_reader_t *reader) |
Compute the packet's sum. More... | |
static bool | feetech_reader_check_minsize (const feetech_reader_t *reader) |
Check if the packet has the minimum required size. More... | |
static bool | feetech_reader_check_start (const feetech_reader_t *reader) |
Check if the packet begins with 2 FEETECH_START bits. More... | |
static bool | feetech_reader_check_size (const feetech_reader_t *reader) |
Check if the packet's size is the same as the buffer's size. More... | |
static bool | feetech_reader_check_sum (const feetech_reader_t *reader) |
Check if the computed sum and the sum of the packet are equal. More... | |
bool | feetech_reader_is_valid (const feetech_reader_t *reader) |
Check if the packet is valid. More... | |
static uint8_t | feetech_reader_get_id (const feetech_reader_t *reader) |
Get the packet's device id. More... | |
static uint8_t | feetech_reader_get_instr (const feetech_reader_t *reader) |
Get the packet's instruction code. More... | |
static const uint8_t * | feetech_reader_response_get_payload (const feetech_reader_t *reader) |
Get the packet's payload (response) More... | |
static size_t | feetech_reader_response_get_payload_size (const feetech_reader_t *reader) |
Get the packet's payload size (response) More... | |
static const uint8_t * | feetech_reader_write_get_payload (const feetech_reader_t *reader) |
Get the packet's payload (WRITE) More... | |
static size_t | feetech_reader_write_get_payload_size (const feetech_reader_t *reader) |
Get the packet's payload size (WRITE) More... | |
static uint8_t | feetech_reader_write_get_reg (const feetech_reader_t *reader) |
Get the packet's target register address (WRITE) More... | |
static size_t | feetech_reader_read_get_size (const feetech_reader_t *reader) |
Get the packet's READ size. More... | |
static uint8_t | feetech_reader_read_get_reg (const feetech_reader_t *reader) |
Get the packet's target register address (READ) More... | |
static size_t | feetech_reader_sync_write_get_payload_size (const feetech_reader_t *reader) |
Get the packet items' payload size (SYNC_WRITE) More... | |
static uint8_t | feetech_reader_sync_write_get_reg (const feetech_reader_t *reader) |
Get the packet's target register address (SYNC_WRITE) More... | |
size_t | feetech_reader_sync_write_get_items_count (const feetech_reader_t *reader) |
Get the packet items' count (SYNC_WRITE) More... | |
uint8_t | feetech_reader_sync_write_item_get_id (const feetech_reader_t *reader, uint8_t index) |
Get the packet item's device id (SYNC_WRITE) More... | |
const uint8_t * | feetech_reader_sync_write_item_get_payload (const feetech_reader_t *reader, uint8_t index) |
Get the packet item's payload (SYNC_WRITE) More... | |
|
inlinestatic |
Check if the packet has the minimum required size.
[in] | reader | the packet reader |
Definition at line 74 of file feetech_reader.h.
|
inlinestatic |
Check if the packet's size is the same as the buffer's size.
[in] | reader | the packet reader |
Definition at line 103 of file feetech_reader.h.
|
inlinestatic |
Check if the packet begins with 2 FEETECH_START bits.
[in] | reader | the packet reader |
Definition at line 88 of file feetech_reader.h.
|
inlinestatic |
Check if the computed sum and the sum of the packet are equal.
[in] | reader | the packet reader |
Definition at line 116 of file feetech_reader.h.
uint8_t feetech_reader_compute_sum | ( | const feetech_reader_t * | reader | ) |
Compute the packet's sum.
[in] | reader | the packet reader |
|
inlinestatic |
Get the packet's device id.
[in] | reader | the packet reader |
Definition at line 138 of file feetech_reader.h.
|
inlinestatic |
Get the packet's instruction code.
[in] | reader | the packet reader |
Definition at line 150 of file feetech_reader.h.
|
inlinestatic |
Initialize the Feetech packet reader.
[out] | reader | the packet reader |
[in] | buffer | the buffer used to store data |
[in] | size | the size of the buffer |
Definition at line 51 of file feetech_reader.h.
bool feetech_reader_is_valid | ( | const feetech_reader_t * | reader | ) |
Check if the packet is valid.
[in] | reader | the packet reader |
|
inlinestatic |
Get the packet's target register address (READ)
[in] | reader | the packet reader |
Definition at line 234 of file feetech_reader.h.
|
inlinestatic |
Get the packet's READ size.
[in] | reader | the packet reader |
Definition at line 222 of file feetech_reader.h.
|
inlinestatic |
Get the packet's payload (response)
[in] | reader | the packet reader |
Definition at line 162 of file feetech_reader.h.
|
inlinestatic |
Get the packet's payload size (response)
[in] | reader | the packet reader |
Definition at line 174 of file feetech_reader.h.
size_t feetech_reader_sync_write_get_items_count | ( | const feetech_reader_t * | reader | ) |
Get the packet items' count (SYNC_WRITE)
[in] | reader | the packet reader |
|
inlinestatic |
Get the packet items' payload size (SYNC_WRITE)
[in] | reader | the packet reader |
Definition at line 246 of file feetech_reader.h.
|
inlinestatic |
Get the packet's target register address (SYNC_WRITE)
[in] | reader | the packet reader |
Definition at line 258 of file feetech_reader.h.
uint8_t feetech_reader_sync_write_item_get_id | ( | const feetech_reader_t * | reader, |
uint8_t | index | ||
) |
Get the packet item's device id (SYNC_WRITE)
[in] | reader | the packet reader |
[in] | index | the item index |
const uint8_t* feetech_reader_sync_write_item_get_payload | ( | const feetech_reader_t * | reader, |
uint8_t | index | ||
) |
Get the packet item's payload (SYNC_WRITE)
[in] | reader | the packet reader |
[in] | index | the item index |
|
inlinestatic |
Get the packet's payload (WRITE)
[in] | reader | the packet reader |
Definition at line 186 of file feetech_reader.h.
|
inlinestatic |
Get the packet's payload size (WRITE)
[in] | reader | the packet reader |
Definition at line 198 of file feetech_reader.h.
|
inlinestatic |
Get the packet's target register address (WRITE)
[in] | reader | the packet reader |
Definition at line 210 of file feetech_reader.h.