File x430_internal.h¶
FileList > src > x430_internal.h
Go to the source code of this file
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "x430.h"
Classes¶
| Type | Name |
|---|---|
| struct | x430_bus_ctx State behind the opaque x430_bus . |
| struct | x430_device_ctx State behind the opaque x430_device . |
| struct | x430_sim_ctx State behind the opaque x430_sim . |
| struct | x430_turn One hosted device of a SYNC_READ or BULK_READ that has not answered yet. |
Public Functions¶
| Type | Name |
|---|---|
| bool | x430_bus_id_taken (const struct x430_bus * bus, const struct x430_device * except, uint8_t id) True when another device on bus usesid (bus may be NULL). |
| uint32_t | x430_bus_millis (const struct x430_bus * bus) Milliseconds from the port of bus ; 0 without bus or clock. |
| void | x430_copy (uint8_t * destination, const uint8_t * source, uint16_t length) Copies length bytes (no <string.h>). |
| uint8_t | x430_device_alert (const struct x430_device * device) Status error alert: DXL2_ERR_ALERT_BIT when Hardware Error Status is not 0. |
| void | x430_device_attach (struct x430_device * device, struct x430_bus * bus) Records the bus of a device on x430_bus_attach() . |
| struct x430_bus * | x430_device_bus (const struct x430_device * device) Bus of the device, NULL when it is not attached. |
| uint8_t | x430_device_byte (const struct x430_device * device, uint16_t address) Control Table byte address , below ::X430_IMAGE_DIRECT (stored at its own index). |
| bool | x430_device_ready (const struct x430_device * device) True for a device that completed x430_device_init() (device may be NULL). |
| void | x430_device_store (struct x430_device * device, uint16_t address, int32_t value) Store value into the register that starts ataddress (none: no effect). |
| int32_t | x430_device_value (const struct x430_device * device, uint16_t address) Value of the register that starts at address , 0 when none starts there. |
| void | x430_device_watchdog (struct x430_device * device, uint32_t idle_ms) Bus Watchdog check; idle_ms is the time since the last instruction packet. |
| void | x430_fill (uint8_t * destination, uint8_t value, uint16_t length) Sets length bytes tovalue (no <string.h>). |
| size_t | x430_frame_status (uint8_t * tx, size_t capacity, uint8_t id, uint16_t count) Completes a status packet in place (no second buffer): header, id , the byte stuffing of instruction, error and data, the length field and the CRC. |
Public Static Functions¶
| Type | Name |
|---|---|
| struct x430_bus_ctx * | x430_bus_ctx_of (struct x430_bus * bus) State of a bus. |
| const struct x430_bus_ctx * | x430_bus_ctx_of_const (const struct x430_bus * bus) Read-only variant of x430_bus_ctx_of(). |
| struct x430_device_ctx * | x430_device_ctx_of (struct x430_device * device) State of a device. |
| const struct x430_device_ctx * | x430_device_ctx_of_const (const struct x430_device * device) Read-only variant of x430_device_ctx_of(). |
| struct x430_sim_ctx * | x430_sim_ctx_of (struct x430_sim * sim) State of a simulator. |
Macros¶
| Type | Name |
|---|---|
| define | X430_READY 0x58343330UValue of the ready field after a successful initialization. |
| define | X430_TURN_NOW 0xFFUx430_turn::after of an entry that may answer at once. |
Public Functions Documentation¶
function x430_bus_id_taken¶
True when another device on bus usesid (bus may be NULL).
bool x430_bus_id_taken (
const struct x430_bus * bus,
const struct x430_device * except,
uint8_t id
)
function x430_bus_millis¶
Milliseconds from the port of bus ; 0 without bus or clock.
function x430_copy¶
Copies length bytes (no <string.h>).
function x430_device_alert¶
Status error alert: DXL2_ERR_ALERT_BIT when Hardware Error Status is not 0.
function x430_device_attach¶
Records the bus of a device on x430_bus_attach() .
function x430_device_bus¶
Bus of the device, NULL when it is not attached.
function x430_device_byte¶
Control Table byte address , below ::X430_IMAGE_DIRECT (stored at its own index).
function x430_device_ready¶
True for a device that completed x430_device_init() (device may be NULL).
function x430_device_store¶
Store value into the register that starts ataddress (none: no effect).
function x430_device_value¶
Value of the register that starts at address , 0 when none starts there.
function x430_device_watchdog¶
Bus Watchdog check; idle_ms is the time since the last instruction packet.
function x430_fill¶
Sets length bytes tovalue (no <string.h>).
function x430_frame_status¶
Completes a status packet in place (no second buffer): header, id , the byte stuffing of instruction, error and data, the length field and the CRC.
The result is byte for byte the packet of dxl2_encode(). A status whose stuffed form does not fit capacity becomes a Data Length Error without data (the alert bit is kept).
Parameters:
txPacket buffer: error byte at offset 8,countdata bytes from 9.capacitySize oftx, at least 9 +countand at least 11 bytes.idID of the answering device.countStatus data bytes.
Returns:
Packet length (at least 11).
Public Static Functions Documentation¶
function x430_bus_ctx_of¶
State of a bus.
Note:
MISRA C:2012 Rule 11.3, deviation DEV-01 (docs/misra.md): x430_bus is the opaque storage of x430_bus_ctx; size and alignment are checked in x430_bus.c.
function x430_bus_ctx_of_const¶
Read-only variant of x430_bus_ctx_of().
function x430_device_ctx_of¶
State of a device.
Note:
MISRA C:2012 Rule 11.3, deviation DEV-01 (docs/misra.md); checked in x430_device.c.
function x430_device_ctx_of_const¶
Read-only variant of x430_device_ctx_of().
static inline const struct x430_device_ctx * x430_device_ctx_of_const (
const struct x430_device * device
)
function x430_sim_ctx_of¶
State of a simulator.
Note:
MISRA C:2012 Rule 11.3, deviation DEV-01 (docs/misra.md); checked in x430_sim.c.
Macro Definition Documentation¶
define X430_READY¶
Value of the ready field after a successful initialization.
A zeroed or never initialized instance holds another value: every function but the *_init() functions then returns X430_ERR_STATE.
define X430_TURN_NOW¶
x430_turn::after of an entry that may answer at once.
The documentation for this class was generated from the following file src/x430_internal.h