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. | |
uint8_t | feetech_reader_compute_sum (const feetech_reader_t *reader) |
Compute the packet's sum. | |
static bool | feetech_reader_check_minsize (const feetech_reader_t *reader) |
Check if the packet has the minimum required size. | |
static bool | feetech_reader_check_start (const feetech_reader_t *reader) |
Check if the packet begins with 2 FEETECH_START bits. | |
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. | |
static bool | feetech_reader_check_sum (const feetech_reader_t *reader) |
Check if the computed sum and the sum of the packet are equal. | |
bool | feetech_reader_is_valid (const feetech_reader_t *reader) |
Check if the packet is valid. | |
static uint8_t | feetech_reader_get_id (const feetech_reader_t *reader) |
Get the packet's device id. | |
static uint8_t | feetech_reader_get_instr (const feetech_reader_t *reader) |
Get the packet's instruction code. | |
static const uint8_t * | feetech_reader_response_get_payload (const feetech_reader_t *reader) |
Get the packet's payload (response) | |
static size_t | feetech_reader_response_get_payload_size (const feetech_reader_t *reader) |
Get the packet's payload size (response) | |
static const uint8_t * | feetech_reader_write_get_payload (const feetech_reader_t *reader) |
Get the packet's payload (WRITE) | |
static size_t | feetech_reader_write_get_payload_size (const feetech_reader_t *reader) |
Get the packet's payload size (WRITE) | |
static uint8_t | feetech_reader_write_get_reg (const feetech_reader_t *reader) |
Get the packet's target register address (WRITE) | |
static size_t | feetech_reader_read_get_size (const feetech_reader_t *reader) |
Get the packet's READ size. | |
static uint8_t | feetech_reader_read_get_reg (const feetech_reader_t *reader) |
Get the packet's target register address (READ) | |
static size_t | feetech_reader_sync_write_get_payload_size (const feetech_reader_t *reader) |
Get the packet items' payload size (SYNC_WRITE) | |
static uint8_t | feetech_reader_sync_write_get_reg (const feetech_reader_t *reader) |
Get the packet's target register address (SYNC_WRITE) | |
size_t | feetech_reader_sync_write_get_items_count (const feetech_reader_t *reader) |
Get the packet items' count (SYNC_WRITE) | |
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) | |
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) | |
#define FEETECH_ACK_SIZE (6) |
Definition at line 33 of file feetech_reader.h.
#define FEETECH_RESPONSE_SIZE | ( | len | ) | (6 + len) |
Definition at line 34 of file feetech_reader.h.
|
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 102 of file feetech_reader.h.
|
inlinestatic |
Check if the packet begins with 2 FEETECH_START bits.
[in] | reader | the packet reader |
Definition at line 87 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 115 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 137 of file feetech_reader.h.
|
inlinestatic |
Get the packet's instruction code.
[in] | reader | the packet reader |
Definition at line 149 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 233 of file feetech_reader.h.
|
inlinestatic |
Get the packet's READ size.
[in] | reader | the packet reader |
Definition at line 221 of file feetech_reader.h.
|
inlinestatic |
Get the packet's payload (response)
[in] | reader | the packet reader |
Definition at line 161 of file feetech_reader.h.
|
inlinestatic |
Get the packet's payload size (response)
[in] | reader | the packet reader |
Definition at line 173 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 245 of file feetech_reader.h.
|
inlinestatic |
Get the packet's target register address (SYNC_WRITE)
[in] | reader | the packet reader |
Definition at line 257 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 185 of file feetech_reader.h.
|
inlinestatic |
Get the packet's payload size (WRITE)
[in] | reader | the packet reader |
Definition at line 197 of file feetech_reader.h.
|
inlinestatic |
Get the packet's target register address (WRITE)
[in] | reader | the packet reader |
Definition at line 209 of file feetech_reader.h.