Skip to content

File dxl2_protocol.c

FileList > src > dxl2_protocol.c

Go to the source code of this file

  • #include <stdbool.h>
  • #include <string.h>
  • #include "dxl2_defs.h"
  • #include "dxl2_protocol.h"

Public Static Attributes

Type Name
const uint8_t dxl2_header = {0xFF, 0xFF, 0xFD, 0x00}
DYNAMIXEL Protocol 2.0 packet header.

Public Static Functions

Type Name
int dxl2_decode_packet (const struct dxl2_parser * parser, struct dxl2_packet * packet, size_t total_length)
Validate CRC and decode a complete wire packet.
void dxl2_parser_reset (struct dxl2_parser * parser)
Discard the parser's current partial packet.

Macros

Type Name
define DXL2_BODY_OFFSET 7U
define DXL2_CRC_SIZE 2U
define DXL2_HEADER_SIZE 4U
define DXL2_LENGTH_OFFSET 5U
define DXL2_MIN_LENGTH 3U

Public Static Attributes Documentation

variable dxl2_header

DYNAMIXEL Protocol 2.0 packet header.

const uint8_t dxl2_header[DXL2_HEADER_SIZE];


Public Static Functions Documentation

function dxl2_decode_packet

Validate CRC and decode a complete wire packet.

static int dxl2_decode_packet (
    const struct dxl2_parser * parser,
    struct dxl2_packet * packet,
    size_t total_length
) 

Parameters:

  • parser - Parser containing the complete wire packet
  • packet - Receives the decoded packet on success
  • total_length - Complete wire-packet length, including header and CRC

Returns:

1 on success, DXL2_PARSE_ERROR on CRC mismatch, invalid stuffing or payload


function dxl2_parser_reset

Discard the parser's current partial packet.

static void dxl2_parser_reset (
    struct dxl2_parser * parser
) 

Parameters:

  • parser - Parser state to reset

Macro Definition Documentation

define DXL2_BODY_OFFSET

#define DXL2_BODY_OFFSET `7U`

define DXL2_CRC_SIZE

#define DXL2_CRC_SIZE `2U`

define DXL2_HEADER_SIZE

#define DXL2_HEADER_SIZE `4U`

define DXL2_LENGTH_OFFSET

#define DXL2_LENGTH_OFFSET `5U`

define DXL2_MIN_LENGTH

#define DXL2_MIN_LENGTH `3U`


The documentation for this class was generated from the following file src/dxl2_protocol.c