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 
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 packet writer struct.
size_t limit
data buffer&#39;s size
void dynamixel_writer_read_make(dynamixel_writer_t *writer, uint8_t id, uint16_t reg, size_t size)
Build a READ packet.
Dynamixel protocol definitions.
uint8_t * buffer
data buffer
void dynamixel_writer_ping_make(dynamixel_writer_t *writer, uint8_t id)
Build a PING packet.
const uint8_t * dynamixel_writer_get_data(const dynamixel_writer_t *writer)
Get the data buffer to send.
void dynamixel_writer_init(dynamixel_writer_t *writer, uint8_t *buffer, size_t limit)
Initialize the Dynamixel packet writer.
size_t dynamixel_writer_get_size(const dynamixel_writer_t *writer)
Get the data buffer&#39;s size to send.
stdlib.h wrapper for MSP430
size_t size
packet&#39;s size