Robot
The embedded systems for UTRA's autonomous humanoid soccer-playing robot

Implements low-level IO functions. More...

Collaboration diagram for IO:

Modules

 Header
 
 Private Functions
 Functions only accessible from within the IO library.
 
 Public functions
 Functions accessible from outside this file.
 

Macros

#define BUFF_SIZE_RX   8
 
#define TX_PACKET_SIZE   9
 
#define INST_PING   0x01
 
#define INST_READ_DATA   0x02
 
#define INST_WRITE_DATA   0x03
 
#define INST_REG_WRITE   0x04
 
#define INST_ACTION   0x05
 
#define INST_RESET   0x06
 
#define INST_SYNC_WRITE   0x83
 

Variables

static const uint32_t TRANSMIT_TIMEOUT = 1
 
static const uint32_t RECEIVE_TIMEOUT = 1
 
ioFlags_t IOType = IO_POLL
 Configures the low-level I/O mode used by the library Default: polled I/O.
 
static uint8_t arrReceive [NUM_MOTORS][BUFF_SIZE_RX] = {{0}}
 Pre-allocated buffer for reading in packets from motors.
 
static uint8_t arrTransmit [NUM_MOTORS+1][TX_PACKET_SIZE]
 Pre-allocated buffer for transmitting packets to motors. More...
 

Detailed Description

Implements low-level IO functions.

Provides a set of functions which provide flexible interfaces for transferring packets between motors and the MCU.

This driver uses polled I/O, interrupt-based I/O, or DMA-based I/O depending on the value of IOType. The user is responsible for ensuring their system configuration is appropriate when using interrupt-based or DMA-based I/O. For example, the interrupt-based mode assumes that the user has enabled interrupts for the UART module corresponding to this motor, and similarly, the DMA-based mode assumes that a DMA channel has been allocated. Both of these non-blocking modes also assumes the user is calling from within the context of a FreeRTOS thread, and that the callback function has been implemented to unblock the thread using task notifications.

Macro Definition Documentation

◆ BUFF_SIZE_RX

#define BUFF_SIZE_RX   8

Receive buffer size for UART receptions (number of bytes)

Definition at line 42 of file DynamixelProtocolV1_IO.c.

◆ INST_ACTION

#define INST_ACTION   0x05

Triggers instructions registered by INST_REG_WRITE

Definition at line 50 of file DynamixelProtocolV1_IO.c.

◆ INST_PING

#define INST_PING   0x01

Gets a status packet

Definition at line 46 of file DynamixelProtocolV1_IO.c.

◆ INST_READ_DATA

#define INST_READ_DATA   0x02

Reads data from a motor register

Definition at line 47 of file DynamixelProtocolV1_IO.c.

◆ INST_REG_WRITE

#define INST_REG_WRITE   0x04

Registers an instruction to be executed at a later time

Definition at line 49 of file DynamixelProtocolV1_IO.c.

◆ INST_RESET

#define INST_RESET   0x06

Resets the control tables of the Dynamixel actuator(s) specified

Definition at line 51 of file DynamixelProtocolV1_IO.c.

◆ INST_SYNC_WRITE

#define INST_SYNC_WRITE   0x83

Writes on a specified address with a specified data length on multiple devices

Definition at line 52 of file DynamixelProtocolV1_IO.c.

◆ INST_WRITE_DATA

#define INST_WRITE_DATA   0x03

Writes data for immediate execution

Definition at line 48 of file DynamixelProtocolV1_IO.c.

◆ TX_PACKET_SIZE

#define TX_PACKET_SIZE   9

Maximum packet size for regular motor commands (exclusion: sync write)

Definition at line 43 of file DynamixelProtocolV1_IO.c.

Variable Documentation

◆ arrTransmit

uint8_t arrTransmit[NUM_MOTORS+1][TX_PACKET_SIZE]
static
Initial value:
= {
{0xFF, 0xFF, 0xFE, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 1, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 2, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 3, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 4, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 5, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 6, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 7, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 8, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 9, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 10, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 11, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 12, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 13, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 14, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 15, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 16, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 17, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 18, 0x00, INST_WRITE_DATA, 0x00, 0x00, 0x00, 0x00}
}
#define INST_WRITE_DATA

Pre-allocated buffer for transmitting packets to motors.

Definition at line 82 of file DynamixelProtocolV1_IO.c.

◆ RECEIVE_TIMEOUT

const uint32_t RECEIVE_TIMEOUT = 1
static

Timeout for blocking UART receptions, in milliseconds

Definition at line 62 of file DynamixelProtocolV1_IO.c.

◆ TRANSMIT_TIMEOUT

const uint32_t TRANSMIT_TIMEOUT = 1
static

Timeout for blocking UART transmissions, in milliseconds

Definition at line 59 of file DynamixelProtocolV1_IO.c.