20#ifndef DYNAMIXEL_READER_H
21#define DYNAMIXEL_READER_H
32#define DXL_PING_SIZE (10)
33#define DXL_STATUS_SIZE(len) (11+len)
34#define DXL_READ_SIZE (14)
35#define DXL_WRITE_SIZE(len) (12+len)
102 (((uint16_t)reader->
buffer[5]) & 0xFF) |
103 ((((uint16_t)reader->
buffer[6]) & 0xFF) << 8);
116 (((uint16_t)reader->
buffer[reader->
size - 2]) & 0xFF) |
117 ((((uint16_t)reader->
buffer[reader->
size - 1]) & 0xFF) << 8);
129 return &reader->
buffer[9];
Dynamixel protocol definitions.
static uint8_t dynamixel_reader_get_instr(const dynamixel_reader_t *reader)
Get the packet's instruction code.
static uint8_t dynamixel_reader_get_id(const dynamixel_reader_t *reader)
Get the packet's device id.
static size_t dynamixel_reader_status_get_payload_size(const dynamixel_reader_t *reader)
Get the packet's payload size (response)
static void dynamixel_reader_init(dynamixel_reader_t *reader, const uint8_t *buffer, size_t size)
Initialize the Dynamixel packet reader.
static const uint8_t * dynamixel_reader_status_get_payload(const dynamixel_reader_t *reader)
Get the packet's payload (response)
static uint16_t dynamixel_reader_get_length(const dynamixel_reader_t *reader)
Get the packet's length field.
bool dynamixel_reader_is_valid(const dynamixel_reader_t *reader)
Check if the packet is valid.
static uint16_t dynamixel_reader_get_crc(const dynamixel_reader_t *reader)
Get the packet's crc.
Dynamixel packet reader struct.
const uint8_t * buffer
data buffer
size_t size
data buffer's size