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 proto_bool protocore_cia402_target_reached(uint16_t sw)
78 return (sw & CIA402_SW_TARGET_REACHED) != 0;
81static inline proto_bool protocore_cia402_has_fault(uint16_t sw)
83 return (sw & CIA402_SW_FAULT) != 0;
86static inline proto_bool protocore_cia402_warning(uint16_t sw)
88 return (sw & CIA402_SW_WARNING) != 0;
91static inline proto_bool protocore_cia402_voltage_enabled(uint16_t sw)
93 return (sw & CIA402_SW_VOLTAGE_ENABLED) != 0;
96static inline proto_bool protocore_cia402_remote(uint16_t sw)
98 return (sw & CIA402_SW_REMOTE) != 0;
101static inline proto_bool protocore_cia402_internal_limit(uint16_t sw)
103 return (sw & CIA402_SW_INTERNAL_LIMIT) != 0;
108 CIA402_MODE_NO_MODE = 0,
109 CIA402_MODE_PROFILE_POSITION = 1,
110 CIA402_MODE_VELOCITY = 2,
111 CIA402_MODE_PROFILE_VELOCITY = 3,
112 CIA402_MODE_PROFILE_TORQUE = 4,
113 CIA402_MODE_HOMING = 6,
114 CIA402_MODE_INTERPOLATED_POSITION = 7,
115 CIA402_MODE_CYCLIC_SYNC_POSITION = 8,
116 CIA402_MODE_CYCLIC_SYNC_VELOCITY = 9,
117 CIA402_MODE_CYCLIC_SYNC_TORQUE = 10,
122 CIA402_STATE_NOT_READY_TO_SWITCH_ON,
123 CIA402_STATE_SWITCH_ON_DISABLED,
124 CIA402_STATE_READY_TO_SWITCH_ON,
125 CIA402_STATE_SWITCHED_ON,
126 CIA402_STATE_OPERATION_ENABLED,
127 CIA402_STATE_QUICK_STOP_ACTIVE,
128 CIA402_STATE_FAULT_REACTION_ACTIVE,
130 CIA402_STATE_UNKNOWN,
135 CIA402_COMMAND_SHUTDOWN,
136 CIA402_COMMAND_SWITCH_ON,
137 CIA402_COMMAND_ENABLE_OPERATION,
138 CIA402_COMMAND_DISABLE_VOLTAGE,
139 CIA402_COMMAND_QUICK_STOP,
140 CIA402_COMMAND_DISABLE_OPERATION,
141 CIA402_COMMAND_FAULT_RESET,
154} Cia402ControlwordArgs;
160} Cia402EnableSequenceArgs;
167 uint16_t controlword;
168} Cia402SdoSetControlwordArgs;
176} Cia402SdoSetModeArgs;
184} Cia402SdoSetTargetPositionArgs;
192} Cia402SdoSetTargetVelocityArgs;
200} Cia402SdoSetTargetTorqueArgs;
217} Cia402SdoGetU16Args;
225} Cia402SdoGetI32Args;
232 uint16_t controlword;
234} Cia402PackCommandArgs;
241 uint16_t *statusword;
243} Cia402UnpackStatusArgs;
292 Cia402StateArgs state_args;
293 Cia402ControlwordArgs controlword_args;
294 Cia402EnableSequenceArgs enable_sequence_args;
295 Cia402SdoSetControlwordArgs sdo_set_controlword_args;
296 Cia402SdoSetModeArgs sdo_set_mode_args;
297 Cia402SdoSetTargetPositionArgs sdo_set_target_position_args;
298 Cia402SdoSetTargetVelocityArgs sdo_set_target_velocity_args;
299 Cia402SdoSetTargetTorqueArgs sdo_set_target_torque_args;
300 Cia402SdoReadArgs sdo_read_args;
301 Cia402SdoGetU16Args sdo_get_u16_args;
302 Cia402SdoGetI32Args sdo_get_i32_args;
303 Cia402PackCommandArgs pack_command_args;
304 Cia402UnpackStatusArgs unpack_status_args;
312extern Cia402Vars Cia402V;
317 void (*
const state)(uint8_t *work);
318 void (*
const controlword)(uint8_t *work);
319 void (*
const enable_sequence)(uint8_t *work);
320 void (*
const sdo_set_controlword)(uint8_t *work);
321 void (*
const sdo_set_mode)(uint8_t *work);
322 void (*
const sdo_set_target_position)(uint8_t *work);
323 void (*
const sdo_set_target_velocity)(uint8_t *work);
324 void (*
const sdo_set_target_torque)(uint8_t *work);
325 void (*
const sdo_read)(uint8_t *work);
326 void (*
const sdo_get_u16)(uint8_t *work);
327 void (*
const sdo_get_i32)(uint8_t *work);
328 void (*
const pack_command)(uint8_t *work);
329 void (*
const unpack_status)(uint8_t *work);
334void protocore_cia402_state(uint8_t *work);
335void protocore_cia402_controlword(uint8_t *work);
336void protocore_cia402_enable_sequence(uint8_t *work);
337void protocore_cia402_sdo_set_controlword(uint8_t *work);
338void protocore_cia402_sdo_set_mode(uint8_t *work);
339void protocore_cia402_sdo_set_target_position(uint8_t *work);
340void protocore_cia402_sdo_set_target_velocity(uint8_t *work);
341void protocore_cia402_sdo_set_target_torque(uint8_t *work);
342void protocore_cia402_sdo_read(uint8_t *work);
343void protocore_cia402_sdo_get_u16(uint8_t *work);
344void protocore_cia402_sdo_get_i32(uint8_t *work);
345void protocore_cia402_pack_command(uint8_t *work);
346void protocore_cia402_unpack_status(uint8_t *work);
352static const Cia402Ns Cia402 __attribute__((unused)) = {
353 .state = protocore_cia402_state,
354 .controlword = protocore_cia402_controlword,
355 .enable_sequence = protocore_cia402_enable_sequence,
356 .sdo_set_controlword = protocore_cia402_sdo_set_controlword,
357 .sdo_set_mode = protocore_cia402_sdo_set_mode,
358 .sdo_set_target_position = protocore_cia402_sdo_set_target_position,
359 .sdo_set_target_velocity = protocore_cia402_sdo_set_target_velocity,
360 .sdo_set_target_torque = protocore_cia402_sdo_set_target_torque,
361 .sdo_read = protocore_cia402_sdo_read,
362 .sdo_get_u16 = protocore_cia402_sdo_get_u16,
363 .sdo_get_i32 = protocore_cia402_sdo_get_i32,
364 .pack_command = protocore_cia402_pack_command,
365 .unpack_status = protocore_cia402_unpack_status,
PROTO_ENUM_PACKED
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).
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS