PebbleOS v4.47.0-1219-g7c542d7a9
Loading...
Searching...
No Matches
pbl_canopen_callbacks Struct Reference

Node callbacks, all called from the node's thread. More...

#include <canopen.h>

Data Fields

void(* nmt )(struct pbl_canopen *co, enum pbl_canopen_nmt_state state, void *arg)
 NMT state changed.
 
void(* reset )(struct pbl_canopen *co, enum pbl_canopen_reset reset, void *arg)
 Reset requested by the NMT master, called once the defaults are restored and before the boot-up message, to set the values that differ from them.
 
int(* write )(struct pbl_canopen *co, uint16_t index, uint8_t subindex, const void *data, size_t len, void *arg)
 An application entry is about to be written over the bus, by an SDO or an RPDO.
 
void(* sync )(struct pbl_canopen *co, uint8_t counter, uint32_t cycles, void *arg)
 SYNC received in operational state, after the synchronous RPDOs are applied and before the synchronous TPDOs are sampled: where the application takes its new values and reports its own.
 
void(* heartbeat )(struct pbl_canopen *co, uint8_t node_id, enum pbl_canopen_hb_event event, enum pbl_canopen_nmt_state state, void *arg)
 Heartbeat consumer event.
 

Detailed Description

Node callbacks, all called from the node's thread.

Field Documentation

◆ heartbeat

void(* pbl_canopen_callbacks::heartbeat) (struct pbl_canopen *co, uint8_t node_id, enum pbl_canopen_hb_event event, enum pbl_canopen_nmt_state state, void *arg)

Heartbeat consumer event.

Parameters
coNode.
node_idMonitored node.
eventEvent.
stateThe node's last state.
argCallback argument.

◆ nmt

void(* pbl_canopen_callbacks::nmt) (struct pbl_canopen *co, enum pbl_canopen_nmt_state state, void *arg)

NMT state changed.

Parameters
coNode.
stateNew state.
argCallback argument.

◆ reset

void(* pbl_canopen_callbacks::reset) (struct pbl_canopen *co, enum pbl_canopen_reset reset, void *arg)

Reset requested by the NMT master, called once the defaults are restored and before the boot-up message, to set the values that differ from them.

Parameters
coNode.
resetReset.
argCallback argument.

◆ sync

void(* pbl_canopen_callbacks::sync) (struct pbl_canopen *co, uint8_t counter, uint32_t cycles, void *arg)

SYNC received in operational state, after the synchronous RPDOs are applied and before the synchronous TPDOs are sampled: where the application takes its new values and reports its own.

It holds up the node's thread while it runs.

Parameters
coNode.
counterSYNC counter, 0 without one.
cyclesValue of pbl_cycle_get_32() when the controller handed the SYNC over, to measure how late the callback runs.
argCallback argument.

◆ write

int(* pbl_canopen_callbacks::write) (struct pbl_canopen *co, uint16_t index, uint8_t subindex, const void *data, size_t len, void *arg)

An application entry is about to be written over the bus, by an SDO or an RPDO.

Parameters
coNode.
indexIndex.
subindexSub-index.
dataNew value, in the CPU's byte order.
lenSize of the new value in bytes.
argCallback argument.
Returns
0 to store the value, -EINVAL or -ERANGE to refuse it as invalid, -EBUSY to refuse it in the present state, or another negative errno to refuse it otherwise.

The documentation for this struct was generated from the following file: