File syn_devicenet.h¶
FileList > proto > syn_devicenet.h
Go to the source code of this file
ODVA DeviceNet (Common Industrial Protocol over CAN) Protocol Stack. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_CIP_Assembly CIP Assembly Object (Class 0x04) Context. |
| struct | SYN_CIP_DeviceNet CIP DeviceNet Object (Class 0x03) Attributes. |
| struct | SYN_CIP_Identity CIP Identity Object (Class 0x01) Attributes. |
| struct | SYN_DeviceNet_Node DeviceNet Node Context Structure. |
Public Types¶
| Type | Name |
|---|---|
| enum | SYN_DeviceNet_Baud DeviceNet Baud Rates. |
| enum | SYN_DeviceNet_State DeviceNet Node States. |
Public Functions¶
| Type | Name |
|---|---|
| bool | syn_devicenet_init (SYN_DeviceNet_Node * node, uint8_t mac_id, SYN_DeviceNet_Baud baud) Initialize DeviceNet node instance context. |
| bool | syn_devicenet_on_can_rx (SYN_DeviceNet_Node * node, uint32_t can_id, const uint8_t * data, uint8_t len, uint32_t * tx_can_id, uint8_t * tx_data, uint8_t * tx_len) Process incoming CAN message frame and generate optional response frame. |
| void | syn_devicenet_poll (SYN_DeviceNet_Node * node, uint32_t dt_ms) Periodic timer tick to service Duplicate MAC ID check & QuickConnect timers. |
| bool | syn_devicenet_set_assembly (SYN_DeviceNet_Node * node, uint8_t * in_buf, uint8_t in_len, uint8_t * out_buf, uint8_t out_len) Configure Assembly Object (Class 0x04) input/output I/O buffers. |
| bool | syn_devicenet_set_quickconnect (SYN_DeviceNet_Node * node, bool enable) Enable or disable QuickConnect™ fast startup mode. |
| void | syn_devicenet_set_serial_number (SYN_DeviceNet_Node * node, uint32_t serial_number) Set CIP Identity serial number for DeviceNet node. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_DEVICENET_DUP_MAC_TIMEOUT_MS 1000U |
| define | SYN_DEVICENET_MAX_MAC_ID 63U |
| define | SYN_DEVICENET_MAX_PAYLOAD 8U |
Detailed Description¶
Provides a zero-heap, lightweight DeviceNet slave node protocol stack including Group 2 Predefined Master/Slave Connection Set, Duplicate MAC ID Check state machine, CIP Object Model (Identity 0x01, DeviceNet 0x03, Assembly 0x04), Polled I/O messaging, Explicit messaging, and QuickConnect™ hot-swapping.
Public Types Documentation¶
enum SYN_DeviceNet_Baud¶
DeviceNet Baud Rates.
enum SYN_DeviceNet_Baud {
SYN_DEVICENET_BAUD_125K = 0U,
SYN_DEVICENET_BAUD_250K = 1U,
SYN_DEVICENET_BAUD_500K = 2U
};
enum SYN_DeviceNet_State¶
DeviceNet Node States.
enum SYN_DeviceNet_State {
SYN_DEVICENET_STATE_OFFLINE = 0U,
SYN_DEVICENET_STATE_DUP_MAC_CHECK = 1U,
SYN_DEVICENET_STATE_ONLINE = 2U,
SYN_DEVICENET_STATE_BUS_OFF = 3U
};
Public Functions Documentation¶
function syn_devicenet_init¶
Initialize DeviceNet node instance context.
Parameters:
nodePointer to DeviceNet node context.mac_idInitial Node Address (0..63).baudNetwork baud rate setting.
Returns:
true on success, false if parameters invalid.
function syn_devicenet_on_can_rx¶
Process incoming CAN message frame and generate optional response frame.
bool syn_devicenet_on_can_rx (
SYN_DeviceNet_Node * node,
uint32_t can_id,
const uint8_t * data,
uint8_t len,
uint32_t * tx_can_id,
uint8_t * tx_data,
uint8_t * tx_len
)
Parameters:
nodePointer to DeviceNet node instance.can_idReceived 11-bit CAN Identifier.dataReceived CAN payload bytes.lenReceived CAN payload length (0..8).tx_can_idOutput pointer for response CAN ID.tx_dataOutput buffer for response payload bytes (min 8 bytes capacity).tx_lenOutput pointer for response payload length.
Returns:
true if response CAN frame generated, false if no response required.
function syn_devicenet_poll¶
Periodic timer tick to service Duplicate MAC ID check & QuickConnect timers.
Parameters:
nodePointer to DeviceNet node instance.dt_msTime elapsed in milliseconds since last poll call.
function syn_devicenet_set_assembly¶
Configure Assembly Object (Class 0x04) input/output I/O buffers.
bool syn_devicenet_set_assembly (
SYN_DeviceNet_Node * node,
uint8_t * in_buf,
uint8_t in_len,
uint8_t * out_buf,
uint8_t out_len
)
Parameters:
nodePointer to DeviceNet node instance.in_bufPointer to input data buffer (sensor/status data to Master).in_lenLength of input buffer (max 8 bytes).out_bufPointer to output data buffer (actuator/cmd data from Master).out_lenLength of output buffer (max 8 bytes).
Returns:
true on success, false if parameters invalid.
function syn_devicenet_set_quickconnect¶
Enable or disable QuickConnect™ fast startup mode.
Parameters:
nodePointer to DeviceNet node instance.enableTrue to enable QuickConnect feature.
Returns:
true on success, false if node is NULL.
function syn_devicenet_set_serial_number¶
Set CIP Identity serial number for DeviceNet node.
Parameters:
nodePointer to DeviceNet node context.serial_number32-bit serial number.
Macro Definition Documentation¶
define SYN_DEVICENET_DUP_MAC_TIMEOUT_MS¶
Duplicate MAC check timeout
define SYN_DEVICENET_MAX_MAC_ID¶
Maximum valid MAC ID
define SYN_DEVICENET_MAX_PAYLOAD¶
Maximum CAN frame payload size
The documentation for this class was generated from the following file src/syntropic/proto/syn_devicenet.h