File syn_devicenet.c¶
FileList > proto > syn_devicenet.c
Go to the source code of this file
ODVA DeviceNet Protocol Stack Implementation.
#include "syn_devicenet.h"#include "../util/syn_pack.h"#include <string.h>
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. |
Public Static Functions¶
| Type | Name |
|---|---|
| bool | handle_explicit_message (SYN_DeviceNet_Node * node, const uint8_t * data, uint8_t len, uint8_t * tx_data, uint8_t * tx_len) Process an explicit DeviceNet message payload. |
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.
Public Static Functions Documentation¶
function handle_explicit_message¶
Process an explicit DeviceNet message payload.
static bool handle_explicit_message (
SYN_DeviceNet_Node * node,
const uint8_t * data,
uint8_t len,
uint8_t * tx_data,
uint8_t * tx_len
)
Parameters:
nodeTarget DeviceNet node instance.dataReceived message payload buffer.lenByte length of received payload.tx_dataResponse message payload output buffer.tx_lenPointer to output byte length variable.
Returns:
true if response frame was constructed, false on error.
The documentation for this class was generated from the following file src/syntropic/proto/syn_devicenet.c