22#ifndef PROTOCORE_CIA402_H
23#define PROTOCORE_CIA402_H
28#if PROTOCORE_ENABLE_CIA402
37#define CIA402_OD_ERROR_CODE 0x603Fu
38#define CIA402_OD_CONTROLWORD 0x6040u
39#define CIA402_OD_STATUSWORD 0x6041u
40#define CIA402_OD_QUICK_STOP_OPTION 0x605Au
41#define CIA402_OD_MODES_OF_OPERATION 0x6060u
42#define CIA402_OD_MODES_DISPLAY 0x6061u
43#define CIA402_OD_POSITION_ACTUAL 0x6064u
44#define CIA402_OD_VELOCITY_ACTUAL 0x606Cu
45#define CIA402_OD_TARGET_TORQUE 0x6071u
46#define CIA402_OD_TORQUE_ACTUAL 0x6077u
47#define CIA402_OD_TARGET_POSITION 0x607Au
48#define CIA402_OD_PROFILE_VELOCITY 0x6081u
49#define CIA402_OD_PROFILE_ACCEL 0x6083u
50#define CIA402_OD_PROFILE_DECEL 0x6084u
51#define CIA402_OD_TARGET_VELOCITY 0x60FFu
52#define CIA402_OD_SUPPORTED_MODES 0x6502u
55#define CIA402_CW_SWITCH_ON 0x0001
56#define CIA402_CW_ENABLE_VOLTAGE 0x0002
57#define CIA402_CW_QUICK_STOP 0x0004
58#define CIA402_CW_ENABLE_OPERATION 0x0008
59#define CIA402_CW_FAULT_RESET 0x0080
60#define CIA402_CW_HALT 0x0100
63#define CIA402_SW_READY_TO_SWITCH_ON 0x0001
64#define CIA402_SW_SWITCHED_ON 0x0002
65#define CIA402_SW_OPERATION_ENABLED 0x0004
66#define CIA402_SW_FAULT 0x0008
67#define CIA402_SW_VOLTAGE_ENABLED 0x0010
68#define CIA402_SW_QUICK_STOP 0x0020
69#define CIA402_SW_SWITCH_ON_DISABLED 0x0040
70#define CIA402_SW_WARNING 0x0080
71#define CIA402_SW_REMOTE 0x0200
72#define CIA402_SW_TARGET_REACHED 0x0400
73#define CIA402_SW_INTERNAL_LIMIT 0x0800
76static inline embed_bool protocore_cia402_target_reached(uint16_t sw)
78 return (sw & CIA402_SW_TARGET_REACHED) != 0;
81static inline embed_bool protocore_cia402_has_fault(uint16_t sw)
83 return (sw & CIA402_SW_FAULT) != 0;
86static inline embed_bool protocore_cia402_warning(uint16_t sw)
88 return (sw & CIA402_SW_WARNING) != 0;
91static inline embed_bool protocore_cia402_voltage_enabled(uint16_t sw)
93 return (sw & CIA402_SW_VOLTAGE_ENABLED) != 0;
96static inline embed_bool protocore_cia402_remote(uint16_t sw)
98 return (sw & CIA402_SW_REMOTE) != 0;
101static inline embed_bool protocore_cia402_internal_limit(uint16_t sw)
103 return (sw & CIA402_SW_INTERNAL_LIMIT) != 0;
107 CIA402_MODE_PROFILE_POSITION = 1,
108 CIA402_MODE_VELOCITY = 2,
109 CIA402_MODE_PROFILE_VELOCITY = 3,
110 CIA402_MODE_PROFILE_TORQUE = 4,
111 CIA402_MODE_HOMING = 6,
112 CIA402_MODE_INTERPOLATED_POSITION = 7,
113 CIA402_MODE_CYCLIC_SYNC_POSITION = 8,
114 CIA402_MODE_CYCLIC_SYNC_VELOCITY = 9,
115 CIA402_MODE_CYCLIC_SYNC_TORQUE = 10,
118EMBED_ENUM_BYTE(Cia402State, CIA402_STATE_NOT_READY_TO_SWITCH_ON, CIA402_STATE_SWITCH_ON_DISABLED,
119 CIA402_STATE_READY_TO_SWITCH_ON, CIA402_STATE_SWITCHED_ON, CIA402_STATE_OPERATION_ENABLED,
120 CIA402_STATE_QUICK_STOP_ACTIVE, CIA402_STATE_FAULT_REACTION_ACTIVE, CIA402_STATE_FAULT,
121 CIA402_STATE_UNKNOWN,
125 CIA402_COMMAND_SHUTDOWN,
126 CIA402_COMMAND_SWITCH_ON,
127 CIA402_COMMAND_ENABLE_OPERATION,
128 CIA402_COMMAND_DISABLE_VOLTAGE,
129 CIA402_COMMAND_QUICK_STOP,
130 CIA402_COMMAND_DISABLE_OPERATION,
131 CIA402_COMMAND_FAULT_RESET,
144} Cia402ControlwordArgs;
150} Cia402EnableSequenceArgs;
157 uint16_t controlword;
158} Cia402SdoSetControlwordArgs;
166} Cia402SdoSetModeArgs;
174} Cia402SdoSetTargetPositionArgs;
182} Cia402SdoSetTargetVelocityArgs;
190} Cia402SdoSetTargetTorqueArgs;
207} Cia402SdoGetU16Args;
215} Cia402SdoGetI32Args;
222 uint16_t controlword;
224} Cia402PackCommandArgs;
231 uint16_t *statusword;
233} Cia402UnpackStatusArgs;
282 Cia402StateArgs state_args;
283 Cia402ControlwordArgs controlword_args;
284 Cia402EnableSequenceArgs enable_sequence_args;
285 Cia402SdoSetControlwordArgs sdo_set_controlword_args;
286 Cia402SdoSetModeArgs sdo_set_mode_args;
287 Cia402SdoSetTargetPositionArgs sdo_set_target_position_args;
288 Cia402SdoSetTargetVelocityArgs sdo_set_target_velocity_args;
289 Cia402SdoSetTargetTorqueArgs sdo_set_target_torque_args;
290 Cia402SdoReadArgs sdo_read_args;
291 Cia402SdoGetU16Args sdo_get_u16_args;
292 Cia402SdoGetI32Args sdo_get_i32_args;
293 Cia402PackCommandArgs pack_command_args;
294 Cia402UnpackStatusArgs unpack_status_args;
302extern Cia402Vars Cia402V;
307 void (*
const state)(
const uint8_t *work);
308 void (*
const controlword)(
const uint8_t *work);
309 void (*
const enable_sequence)(
const uint8_t *work);
310 void (*
const sdo_set_controlword)(
const uint8_t *work);
311 void (*
const sdo_set_mode)(
const uint8_t *work);
312 void (*
const sdo_set_target_position)(
const uint8_t *work);
313 void (*
const sdo_set_target_velocity)(
const uint8_t *work);
314 void (*
const sdo_set_target_torque)(
const uint8_t *work);
315 void (*
const sdo_read)(
const uint8_t *work);
316 void (*
const sdo_get_u16)(uint8_t *work);
317 void (*
const sdo_get_i32)(uint8_t *work);
318 void (*
const pack_command)(
const uint8_t *work);
319 void (*
const unpack_status)(
const uint8_t *work);
324void protocore_cia402_state(
const uint8_t *work);
325void protocore_cia402_controlword(
const uint8_t *work);
326void protocore_cia402_enable_sequence(
const uint8_t *work);
327void protocore_cia402_sdo_set_controlword(
const uint8_t *work);
328void protocore_cia402_sdo_set_mode(
const uint8_t *work);
329void protocore_cia402_sdo_set_target_position(
const uint8_t *work);
330void protocore_cia402_sdo_set_target_velocity(
const uint8_t *work);
331void protocore_cia402_sdo_set_target_torque(
const uint8_t *work);
332void protocore_cia402_sdo_read(
const uint8_t *work);
333void protocore_cia402_sdo_get_u16(uint8_t *work);
334void protocore_cia402_sdo_get_i32(uint8_t *work);
335void protocore_cia402_pack_command(
const uint8_t *work);
336void protocore_cia402_unpack_status(
const uint8_t *work);
342static const Cia402Ns Cia402 __attribute__((unused)) = {
343 .state = protocore_cia402_state,
344 .controlword = protocore_cia402_controlword,
345 .enable_sequence = protocore_cia402_enable_sequence,
346 .sdo_set_controlword = protocore_cia402_sdo_set_controlword,
347 .sdo_set_mode = protocore_cia402_sdo_set_mode,
348 .sdo_set_target_position = protocore_cia402_sdo_set_target_position,
349 .sdo_set_target_velocity = protocore_cia402_sdo_set_target_velocity,
350 .sdo_set_target_torque = protocore_cia402_sdo_set_target_torque,
351 .sdo_read = protocore_cia402_sdo_read,
352 .sdo_get_u16 = protocore_cia402_sdo_get_u16,
353 .sdo_get_i32 = protocore_cia402_sdo_get_i32,
354 .pack_command = protocore_cia402_pack_command,
355 .unpack_status = protocore_cia402_unpack_status,
EMBED_ENUM_BYTE(ProtoConn, PROTO_NONE=0, PROTO_HTTP=1, PROTO_TELNET=2, PROTO_SSH=3, PROTO_MODBUS=4, PROTO_OPCUA=5, PROTO_SSH_RFWD=6, PROTO_RELAY=7, PROTO_BRIDGE=8, PROTO_NTRIP_CASTER=9, PROTO_MESH=10, PROTO_UDP=11,)
Application protocol spoken on a listener port or connection slot.
Shared CAN 2.0 frame type for the CAN-based industrial codecs (one source of truth).