Loading...
Searching...
No Matches
dynamixel.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
24#ifndef DYNAMIXEL_H
25#define DYNAMIXEL_H
26
27#include <stdlib.h>
28#include <stdbool.h>
29
30#include "dynamixel_protocol.h"
31#include "uart_half_duplex.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37typedef uint8_t dynamixel_id_t;
38typedef uint16_t dynamixel_addr_t;
47
51enum {
56};
57
70
79
92int dynamixel_write8(const dynamixel_t *device, dynamixel_addr_t reg, uint8_t value);
93
106int dynamixel_write16(const dynamixel_t *device, dynamixel_addr_t reg, uint16_t value);
107
121int dynamixel_write(const dynamixel_t *device, dynamixel_addr_t reg, const uint8_t *data, size_t length);
122
135int dynamixel_read8(const dynamixel_t *device, dynamixel_addr_t reg, uint8_t *value);
136
149int dynamixel_read16(const dynamixel_t *device, dynamixel_addr_t reg, uint16_t *value);
150
164int dynamixel_read(const dynamixel_t *device, dynamixel_addr_t reg, uint8_t *data, size_t length);
165
166#ifdef __cplusplus
167}
168#endif
169
170#endif /* DYNAMIXEL_H */
Dynamixel protocol definitions.
uint16_t dynamixel_addr_t
register address type
Definition dynamixel.h:38
int dynamixel_read8(const dynamixel_t *device, dynamixel_addr_t reg, uint8_t *value)
Read from a device 8bits register.
uint8_t dynamixel_id_t
device id type
Definition dynamixel.h:37
int dynamixel_write16(const dynamixel_t *device, dynamixel_addr_t reg, uint16_t value)
Write to a device 16bits register.
int dynamixel_write(const dynamixel_t *device, dynamixel_addr_t reg, const uint8_t *data, size_t length)
Write to a device address.
void dynamixel_init(dynamixel_t *device, uart_half_duplex_t *stream, dynamixel_id_t id)
Initialize a Dynamixel device.
int dynamixel_read16(const dynamixel_t *device, dynamixel_addr_t reg, uint16_t *value)
Read from a device 16bits register.
int dynamixel_ping(uart_half_duplex_t *stream, dynamixel_id_t id)
Send a PING message to a device.
int dynamixel_write8(const dynamixel_t *device, dynamixel_addr_t reg, uint8_t value)
Write to a device 8bits register.
int dynamixel_read(const dynamixel_t *device, dynamixel_addr_t reg, uint8_t *data, size_t length)
Read from a device address.
@ DYNAMIXEL_INVALID_MESSAGE
Invalid message received.
Definition dynamixel.h:55
@ DYNAMIXEL_TIMEOUT
No response from the device.
Definition dynamixel.h:53
@ DYNAMIXEL_OK
Success.
Definition dynamixel.h:52
@ DYNAMIXEL_BUFFER_TOO_SMALL
Buffer is too small for the message.
Definition dynamixel.h:54
Descriptor struct for a dynamixel device.
Definition dynamixel.h:43
uart_half_duplex_t * stream
the stream used
Definition dynamixel.h:44
dynamixel_id_t id
the device address
Definition dynamixel.h:45
Descriptor struct for half-duplex UART.
Interface definition for half-duplex UART driver.