Loading...
Searching...
No Matches
dynamixel_reader.h File Reference

Interface definition for Dynamixel packet reader. More...

Detailed Description

Interface definition for Dynamixel packet reader.

Author
Loïc Dauphin loic..nosp@m.daup.nosp@m.hin@i.nosp@m.nria.nosp@m..fr

Definition in file dynamixel_reader.h.

#include <stdlib.h>
#include <stdbool.h>
#include "dynamixel_protocol.h"
+ Include dependency graph for dynamixel_reader.h:

Go to the source code of this file.

Data Structures

struct  dynamixel_reader_t
 Dynamixel packet reader struct. More...
 
#define DXL_PING_SIZE   (10)
 
#define DXL_STATUS_SIZE(len)   (11+len)
 
#define DXL_READ_SIZE   (14)
 
#define DXL_WRITE_SIZE(len)   (12+len)
 
static void dynamixel_reader_init (dynamixel_reader_t *reader, const uint8_t *buffer, size_t size)
 Initialize the Dynamixel packet reader.
 
bool dynamixel_reader_is_valid (const dynamixel_reader_t *reader)
 Check if the packet is valid.
 
static uint8_t dynamixel_reader_get_id (const dynamixel_reader_t *reader)
 Get the packet's device id.
 
static uint8_t dynamixel_reader_get_instr (const dynamixel_reader_t *reader)
 Get the packet's instruction code.
 
static uint16_t dynamixel_reader_get_length (const dynamixel_reader_t *reader)
 Get the packet's length field.
 
static uint16_t dynamixel_reader_get_crc (const dynamixel_reader_t *reader)
 Get the packet's crc.
 
static const uint8_t * dynamixel_reader_status_get_payload (const dynamixel_reader_t *reader)
 Get the packet's payload (response)
 
static size_t dynamixel_reader_status_get_payload_size (const dynamixel_reader_t *reader)
 Get the packet's payload size (response)
 

Macro Definition Documentation

◆ DXL_PING_SIZE

#define DXL_PING_SIZE   (10)

Definition at line 32 of file dynamixel_reader.h.

◆ DXL_READ_SIZE

#define DXL_READ_SIZE   (14)

Definition at line 34 of file dynamixel_reader.h.

◆ DXL_STATUS_SIZE

#define DXL_STATUS_SIZE (   len)    (11+len)

Definition at line 33 of file dynamixel_reader.h.

◆ DXL_WRITE_SIZE

#define DXL_WRITE_SIZE (   len)    (12+len)

Definition at line 35 of file dynamixel_reader.h.

Function Documentation

◆ dynamixel_reader_get_crc()

static uint16_t dynamixel_reader_get_crc ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's crc.

Parameters
[in]readerthe packet reader
Returns
the packet's length field

Definition at line 113 of file dynamixel_reader.h.

◆ dynamixel_reader_get_id()

static uint8_t dynamixel_reader_get_id ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's device id.

Parameters
[in]readerthe packet reader
Returns
the packet's device id

Definition at line 75 of file dynamixel_reader.h.

◆ dynamixel_reader_get_instr()

static uint8_t dynamixel_reader_get_instr ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's instruction code.

Parameters
[in]readerthe packet reader
Returns
the packet's instruction code

Definition at line 87 of file dynamixel_reader.h.

◆ dynamixel_reader_get_length()

static uint16_t dynamixel_reader_get_length ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's length field.

Parameters
[in]readerthe packet reader
Returns
the packet's length field

Definition at line 99 of file dynamixel_reader.h.

◆ dynamixel_reader_init()

static void dynamixel_reader_init ( dynamixel_reader_t reader,
const uint8_t *  buffer,
size_t  size 
)
inlinestatic

Initialize the Dynamixel packet reader.

Parameters
[out]readerthe packet reader
[in]bufferthe buffer used to store data
[in]sizethe size of the buffer

Definition at line 52 of file dynamixel_reader.h.

◆ dynamixel_reader_is_valid()

bool dynamixel_reader_is_valid ( const dynamixel_reader_t reader)

Check if the packet is valid.

Parameters
[in]readerthe packet reader
Returns
true if the packet is valid
false otherwise

◆ dynamixel_reader_status_get_payload()

static const uint8_t * dynamixel_reader_status_get_payload ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's payload (response)

Parameters
[in]readerthe packet reader
Returns
the address of the beginning of the payload

Definition at line 127 of file dynamixel_reader.h.

◆ dynamixel_reader_status_get_payload_size()

static size_t dynamixel_reader_status_get_payload_size ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's payload size (response)

Parameters
[in]readerthe packet reader
Returns
the size of the payload

Definition at line 139 of file dynamixel_reader.h.