dynamixel_writer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
20 #ifndef DYNAMIXEL_WRITER_H
21 #define DYNAMIXEL_WRITER_H
22 
23 #include "dynamixel_protocol.h"
24 #include <stdint.h>
25 #include <stdlib.h>
26 #include <stdbool.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 typedef struct {
36  uint8_t *buffer;
37  size_t size;
38  size_t limit;
40 
48 void dynamixel_writer_init(dynamixel_writer_t *writer, uint8_t *buffer, size_t limit);
49 
57 const uint8_t *dynamixel_writer_get_data(const dynamixel_writer_t *writer);
58 
66 size_t dynamixel_writer_get_size(const dynamixel_writer_t *writer);
67 
74 void dynamixel_writer_ping_make(dynamixel_writer_t *writer, uint8_t id);
75 
85 void dynamixel_writer_write_make(dynamixel_writer_t *writer, uint8_t id, uint16_t reg, const uint8_t *buffer, size_t size);
86 
95 void dynamixel_writer_read_make(dynamixel_writer_t *writer, uint8_t id, uint16_t reg, size_t size);
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* DYNAMIXEL_WRITER_H */
102 
dynamixel_writer_t::size
size_t size
packet's size
Definition: dynamixel_writer.h:37
dynamixel_writer_t::buffer
uint8_t * buffer
data buffer
Definition: dynamixel_writer.h:36
dynamixel_writer_init
void dynamixel_writer_init(dynamixel_writer_t *writer, uint8_t *buffer, size_t limit)
Initialize the Dynamixel packet writer.
dynamixel_protocol.h
Dynamixel protocol definitions.
dynamixel_writer_get_size
size_t dynamixel_writer_get_size(const dynamixel_writer_t *writer)
Get the data buffer's size to send.
dynamixel_writer_read_make
void dynamixel_writer_read_make(dynamixel_writer_t *writer, uint8_t id, uint16_t reg, size_t size)
Build a READ packet.
dynamixel_writer_get_data
const uint8_t * dynamixel_writer_get_data(const dynamixel_writer_t *writer)
Get the data buffer to send.
dynamixel_writer_t::limit
size_t limit
data buffer's size
Definition: dynamixel_writer.h:38
dynamixel_writer_write_make
void dynamixel_writer_write_make(dynamixel_writer_t *writer, uint8_t id, uint16_t reg, const uint8_t *buffer, size_t size)
Build a WRITE packet.
dynamixel_writer_t
Dynamixel packet writer struct.
Definition: dynamixel_writer.h:35
dynamixel_writer_ping_make
void dynamixel_writer_ping_make(dynamixel_writer_t *writer, uint8_t id)
Build a PING packet.