mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-24 17:53:39 +08:00
update header file generator to address axes by number
This commit is contained in:
+2
-2
@@ -166,12 +166,12 @@ namespace odrive {
|
||||
|
||||
template<int IPropertyId>
|
||||
bool read_axis_property(uint8_t num, uint8_t axis, endpoint_type_t<IPropertyId>* value) {
|
||||
return read_property<IPropertyId>(num, value, IPropertyId + axis * AXIS_ENDPOINT_COUNT);
|
||||
return read_property<IPropertyId>(num, value, IPropertyId + axis * per_axis_offset);
|
||||
}
|
||||
|
||||
template<int IPropertyId>
|
||||
bool write_axis_property(uint8_t num, uint8_t axis, endpoint_type_t<IPropertyId> value) {
|
||||
return write_property<IPropertyId>(num, value, IPropertyId + axis * AXIS_ENDPOINT_COUNT);
|
||||
return write_property<IPropertyId>(num, value, IPropertyId + axis * per_axis_offset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+141
-319
@@ -9,234 +9,145 @@
|
||||
#ifndef __ODRIVE_ENDPOINTS_HPP
|
||||
#define __ODRIVE_ENDPOINTS_HPP
|
||||
|
||||
#define AXIS_ENDPOINT_COUNT 101
|
||||
|
||||
namespace odrive {
|
||||
|
||||
static constexpr const uint16_t json_crc = 0x64cd;
|
||||
|
||||
static constexpr const uint16_t per_axis_offset = 101;
|
||||
|
||||
enum {
|
||||
VBUS_VOLTAGE = 1,
|
||||
SERIAL_NUMBER = 2,
|
||||
HW_VERSION_MAJOR = 3,
|
||||
HW_VERSION_MINOR = 4,
|
||||
HW_VERSION_VARIANT = 5,
|
||||
FW_VERSION_MAJOR = 6,
|
||||
FW_VERSION_MINOR = 7,
|
||||
FW_VERSION_REVISION = 8,
|
||||
FW_VERSION_UNRELEASED = 9,
|
||||
USER_CONFIG_LOADED = 10,
|
||||
BRAKE_RESISTOR_ARMED = 11,
|
||||
SYSTEM_STATS__UPTIME = 12,
|
||||
SYSTEM_STATS__MIN_HEAP_SPACE = 13,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_AXIS0 = 14,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_AXIS1 = 15,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_COMMS = 16,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_USB = 17,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_UART = 18,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_USB_IRQ = 19,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_STARTUP = 20,
|
||||
SYSTEM_STATS__USB__RX_CNT = 21,
|
||||
SYSTEM_STATS__USB__TX_CNT = 22,
|
||||
SYSTEM_STATS__USB__TX_OVERRUN_CNT = 23,
|
||||
SYSTEM_STATS__I2C__ADDR = 24,
|
||||
SYSTEM_STATS__I2C__ADDR_MATCH_CNT = 25,
|
||||
SYSTEM_STATS__I2C__RX_CNT = 26,
|
||||
SYSTEM_STATS__I2C__ERROR_CNT = 27,
|
||||
CONFIG__BRAKE_RESISTANCE = 28,
|
||||
CONFIG__ENABLE_UART = 29,
|
||||
CONFIG__ENABLE_I2C_INSTEAD_OF_CAN = 30,
|
||||
CONFIG__DC_BUS_UNDERVOLTAGE_TRIP_LEVEL = 31,
|
||||
CONFIG__DC_BUS_OVERVOLTAGE_TRIP_LEVEL = 32,
|
||||
AXIS__ERROR = 33,
|
||||
AXIS__ENABLE_STEP_DIR = 34,
|
||||
AXIS__CURRENT_STATE = 35,
|
||||
AXIS__REQUESTED_STATE = 36,
|
||||
AXIS__LOOP_COUNTER = 37,
|
||||
AXIS__CONFIG__STARTUP_MOTOR_CALIBRATION = 38,
|
||||
AXIS__CONFIG__STARTUP_ENCODER_INDEX_SEARCH = 39,
|
||||
AXIS__CONFIG__STARTUP_ENCODER_OFFSET_CALIBRATION = 40,
|
||||
AXIS__CONFIG__STARTUP_CLOSED_LOOP_CONTROL = 41,
|
||||
AXIS__CONFIG__STARTUP_SENSORLESS_CONTROL = 42,
|
||||
AXIS__CONFIG__ENABLE_STEP_DIR = 43,
|
||||
AXIS__CONFIG__COUNTS_PER_STEP = 44,
|
||||
AXIS__CONFIG__RAMP_UP_TIME = 45,
|
||||
AXIS__CONFIG__RAMP_UP_DISTANCE = 46,
|
||||
AXIS__CONFIG__SPIN_UP_CURRENT = 47,
|
||||
AXIS__CONFIG__SPIN_UP_ACCELERATION = 48,
|
||||
AXIS__CONFIG__SPIN_UP_TARGET_VEL = 49,
|
||||
AXIS__MOTOR__ERROR = 50,
|
||||
AXIS__MOTOR__ARMED_STATE = 51,
|
||||
AXIS__MOTOR__IS_CALIBRATED = 52,
|
||||
AXIS__MOTOR__CURRENT_MEAS_PHB = 53,
|
||||
AXIS__MOTOR__CURRENT_MEAS_PHC = 54,
|
||||
AXIS__MOTOR__DC_CALIB_PHB = 55,
|
||||
AXIS__MOTOR__DC_CALIB_PHC = 56,
|
||||
AXIS__MOTOR__PHASE_CURRENT_REV_GAIN = 57,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__P_GAIN = 58,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__I_GAIN = 59,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_D = 60,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_Q = 61,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__IBUS = 62,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__FINAL_V_ALPHA = 63,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__FINAL_V_BETA = 64,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__IQ_SETPOINT = 65,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__IQ_MEASURED = 66,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__MAX_ALLOWED_CURRENT = 67,
|
||||
AXIS__MOTOR__GATE_DRIVER__DRV_FAULT = 68,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_GENERAL = 69,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_I = 70,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_DC = 71,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_R = 72,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_L = 73,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_ENC_CALIB = 74,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_IDX_SEARCH = 75,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_FOC_VOLTAGE = 76,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_FOC_CURRENT = 77,
|
||||
AXIS__MOTOR__CONFIG__PRE_CALIBRATED = 78,
|
||||
AXIS__MOTOR__CONFIG__POLE_PAIRS = 79,
|
||||
AXIS__MOTOR__CONFIG__CALIBRATION_CURRENT = 80,
|
||||
AXIS__MOTOR__CONFIG__RESISTANCE_CALIB_MAX_VOLTAGE = 81,
|
||||
AXIS__MOTOR__CONFIG__PHASE_INDUCTANCE = 82,
|
||||
AXIS__MOTOR__CONFIG__PHASE_RESISTANCE = 83,
|
||||
AXIS__MOTOR__CONFIG__DIRECTION = 84,
|
||||
AXIS__MOTOR__CONFIG__MOTOR_TYPE = 85,
|
||||
AXIS__MOTOR__CONFIG__CURRENT_LIM = 86,
|
||||
AXIS__CONTROLLER__POS_SETPOINT = 87,
|
||||
AXIS__CONTROLLER__VEL_SETPOINT = 88,
|
||||
AXIS__CONTROLLER__VEL_INTEGRATOR_CURRENT = 89,
|
||||
AXIS__CONTROLLER__CURRENT_SETPOINT = 90,
|
||||
AXIS__CONTROLLER__CONFIG__CONTROL_MODE = 91,
|
||||
AXIS__CONTROLLER__CONFIG__POS_GAIN = 92,
|
||||
AXIS__CONTROLLER__CONFIG__VEL_GAIN = 93,
|
||||
AXIS__CONTROLLER__CONFIG__VEL_INTEGRATOR_GAIN = 94,
|
||||
AXIS__CONTROLLER__CONFIG__VEL_LIMIT = 95,
|
||||
AXIS__CONTROLLER__START_ANTICOGGING_CALIBRATION = 105,
|
||||
AXIS__ENCODER__ERROR = 106,
|
||||
AXIS__ENCODER__IS_READY = 107,
|
||||
AXIS__ENCODER__INDEX_FOUND = 108,
|
||||
AXIS__ENCODER__SHADOW_COUNT = 109,
|
||||
AXIS__ENCODER__COUNT_IN_CPR = 110,
|
||||
AXIS__ENCODER__OFFSET = 111,
|
||||
AXIS__ENCODER__INTERPOLATION = 112,
|
||||
AXIS__ENCODER__PHASE = 113,
|
||||
AXIS__ENCODER__POS_ESTIMATE = 114,
|
||||
AXIS__ENCODER__POS_CPR = 115,
|
||||
AXIS__ENCODER__HALL_STATE = 116,
|
||||
AXIS__ENCODER__PLL_VEL = 117,
|
||||
AXIS__ENCODER__PLL_KP = 118,
|
||||
AXIS__ENCODER__PLL_KI = 119,
|
||||
AXIS__ENCODER__CONFIG__MODE = 120,
|
||||
AXIS__ENCODER__CONFIG__USE_INDEX = 121,
|
||||
AXIS__ENCODER__CONFIG__PRE_CALIBRATED = 122,
|
||||
AXIS__ENCODER__CONFIG__IDX_SEARCH_SPEED = 123,
|
||||
AXIS__ENCODER__CONFIG__CPR = 124,
|
||||
AXIS__ENCODER__CONFIG__OFFSET = 125,
|
||||
AXIS__ENCODER__CONFIG__OFFSET_FLOAT = 126,
|
||||
AXIS__ENCODER__CONFIG__CALIB_RANGE = 127,
|
||||
AXIS__SENSORLESS_ESTIMATOR__ERROR = 128,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PHASE = 129,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_POS = 130,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_VEL = 131,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_KP = 132,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_KI = 133,
|
||||
AXIS1__ERROR = 134,
|
||||
AXIS1__ENABLE_STEP_DIR = 135,
|
||||
AXIS1__CURRENT_STATE = 136,
|
||||
AXIS1__REQUESTED_STATE = 137,
|
||||
AXIS1__LOOP_COUNTER = 138,
|
||||
AXIS1__CONFIG__STARTUP_MOTOR_CALIBRATION = 139,
|
||||
AXIS1__CONFIG__STARTUP_ENCODER_INDEX_SEARCH = 140,
|
||||
AXIS1__CONFIG__STARTUP_ENCODER_OFFSET_CALIBRATION = 141,
|
||||
AXIS1__CONFIG__STARTUP_CLOSED_LOOP_CONTROL = 142,
|
||||
AXIS1__CONFIG__STARTUP_SENSORLESS_CONTROL = 143,
|
||||
AXIS1__CONFIG__ENABLE_STEP_DIR = 144,
|
||||
AXIS1__CONFIG__COUNTS_PER_STEP = 145,
|
||||
AXIS1__CONFIG__RAMP_UP_TIME = 146,
|
||||
AXIS1__CONFIG__RAMP_UP_DISTANCE = 147,
|
||||
AXIS1__CONFIG__SPIN_UP_CURRENT = 148,
|
||||
AXIS1__CONFIG__SPIN_UP_ACCELERATION = 149,
|
||||
AXIS1__CONFIG__SPIN_UP_TARGET_VEL = 150,
|
||||
AXIS1__MOTOR__ERROR = 151,
|
||||
AXIS1__MOTOR__ARMED_STATE = 152,
|
||||
AXIS1__MOTOR__IS_CALIBRATED = 153,
|
||||
AXIS1__MOTOR__CURRENT_MEAS_PHB = 154,
|
||||
AXIS1__MOTOR__CURRENT_MEAS_PHC = 155,
|
||||
AXIS1__MOTOR__DC_CALIB_PHB = 156,
|
||||
AXIS1__MOTOR__DC_CALIB_PHC = 157,
|
||||
AXIS1__MOTOR__PHASE_CURRENT_REV_GAIN = 158,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__P_GAIN = 159,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__I_GAIN = 160,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_D = 161,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_Q = 162,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__IBUS = 163,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__FINAL_V_ALPHA = 164,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__FINAL_V_BETA = 165,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__IQ_SETPOINT = 166,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__IQ_MEASURED = 167,
|
||||
AXIS1__MOTOR__CURRENT_CONTROL__MAX_ALLOWED_CURRENT = 168,
|
||||
AXIS1__MOTOR__GATE_DRIVER__DRV_FAULT = 169,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_GENERAL = 170,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_I = 171,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_DC = 172,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_R = 173,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_L = 174,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_ENC_CALIB = 175,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_IDX_SEARCH = 176,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_FOC_VOLTAGE = 177,
|
||||
AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_FOC_CURRENT = 178,
|
||||
AXIS1__MOTOR__CONFIG__PRE_CALIBRATED = 179,
|
||||
AXIS1__MOTOR__CONFIG__POLE_PAIRS = 180,
|
||||
AXIS1__MOTOR__CONFIG__CALIBRATION_CURRENT = 181,
|
||||
AXIS1__MOTOR__CONFIG__RESISTANCE_CALIB_MAX_VOLTAGE = 182,
|
||||
AXIS1__MOTOR__CONFIG__PHASE_INDUCTANCE = 183,
|
||||
AXIS1__MOTOR__CONFIG__PHASE_RESISTANCE = 184,
|
||||
AXIS1__MOTOR__CONFIG__DIRECTION = 185,
|
||||
AXIS1__MOTOR__CONFIG__MOTOR_TYPE = 186,
|
||||
AXIS1__MOTOR__CONFIG__CURRENT_LIM = 187,
|
||||
AXIS1__CONTROLLER__POS_SETPOINT = 188,
|
||||
AXIS1__CONTROLLER__VEL_SETPOINT = 189,
|
||||
AXIS1__CONTROLLER__VEL_INTEGRATOR_CURRENT = 190,
|
||||
AXIS1__CONTROLLER__CURRENT_SETPOINT = 191,
|
||||
AXIS1__CONTROLLER__CONFIG__CONTROL_MODE = 192,
|
||||
AXIS1__CONTROLLER__CONFIG__POS_GAIN = 193,
|
||||
AXIS1__CONTROLLER__CONFIG__VEL_GAIN = 194,
|
||||
AXIS1__CONTROLLER__CONFIG__VEL_INTEGRATOR_GAIN = 195,
|
||||
AXIS1__CONTROLLER__CONFIG__VEL_LIMIT = 196,
|
||||
AXIS1__CONTROLLER__START_ANTICOGGING_CALIBRATION = 206,
|
||||
AXIS1__ENCODER__ERROR = 207,
|
||||
AXIS1__ENCODER__IS_READY = 208,
|
||||
AXIS1__ENCODER__INDEX_FOUND = 209,
|
||||
AXIS1__ENCODER__SHADOW_COUNT = 210,
|
||||
AXIS1__ENCODER__COUNT_IN_CPR = 211,
|
||||
AXIS1__ENCODER__OFFSET = 212,
|
||||
AXIS1__ENCODER__INTERPOLATION = 213,
|
||||
AXIS1__ENCODER__PHASE = 214,
|
||||
AXIS1__ENCODER__POS_ESTIMATE = 215,
|
||||
AXIS1__ENCODER__POS_CPR = 216,
|
||||
AXIS1__ENCODER__HALL_STATE = 217,
|
||||
AXIS1__ENCODER__PLL_VEL = 218,
|
||||
AXIS1__ENCODER__PLL_KP = 219,
|
||||
AXIS1__ENCODER__PLL_KI = 220,
|
||||
AXIS1__ENCODER__CONFIG__MODE = 221,
|
||||
AXIS1__ENCODER__CONFIG__USE_INDEX = 222,
|
||||
AXIS1__ENCODER__CONFIG__PRE_CALIBRATED = 223,
|
||||
AXIS1__ENCODER__CONFIG__IDX_SEARCH_SPEED = 224,
|
||||
AXIS1__ENCODER__CONFIG__CPR = 225,
|
||||
AXIS1__ENCODER__CONFIG__OFFSET = 226,
|
||||
AXIS1__ENCODER__CONFIG__OFFSET_FLOAT = 227,
|
||||
AXIS1__ENCODER__CONFIG__CALIB_RANGE = 228,
|
||||
AXIS1__SENSORLESS_ESTIMATOR__ERROR = 229,
|
||||
AXIS1__SENSORLESS_ESTIMATOR__PHASE = 230,
|
||||
AXIS1__SENSORLESS_ESTIMATOR__PLL_POS = 231,
|
||||
AXIS1__SENSORLESS_ESTIMATOR__PLL_VEL = 232,
|
||||
AXIS1__SENSORLESS_ESTIMATOR__PLL_KP = 233,
|
||||
AXIS1__SENSORLESS_ESTIMATOR__PLL_KI = 234,
|
||||
TEST_PROPERTY = 235,
|
||||
SAVE_CONFIGURATION = 242,
|
||||
ERASE_CONFIGURATION = 243,
|
||||
REBOOT = 244,
|
||||
ENTER_DFU_MODE = 245,
|
||||
VBUS_VOLTAGE = 1,
|
||||
SERIAL_NUMBER = 2,
|
||||
HW_VERSION_MAJOR = 3,
|
||||
HW_VERSION_MINOR = 4,
|
||||
HW_VERSION_VARIANT = 5,
|
||||
FW_VERSION_MAJOR = 6,
|
||||
FW_VERSION_MINOR = 7,
|
||||
FW_VERSION_REVISION = 8,
|
||||
FW_VERSION_UNRELEASED = 9,
|
||||
USER_CONFIG_LOADED = 10,
|
||||
BRAKE_RESISTOR_ARMED = 11,
|
||||
SYSTEM_STATS__UPTIME = 12,
|
||||
SYSTEM_STATS__MIN_HEAP_SPACE = 13,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_AXIS0 = 14,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_AXIS1 = 15,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_COMMS = 16,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_USB = 17,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_UART = 18,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_USB_IRQ = 19,
|
||||
SYSTEM_STATS__MIN_STACK_SPACE_STARTUP = 20,
|
||||
SYSTEM_STATS__USB__RX_CNT = 21,
|
||||
SYSTEM_STATS__USB__TX_CNT = 22,
|
||||
SYSTEM_STATS__USB__TX_OVERRUN_CNT = 23,
|
||||
SYSTEM_STATS__I2C__ADDR = 24,
|
||||
SYSTEM_STATS__I2C__ADDR_MATCH_CNT = 25,
|
||||
SYSTEM_STATS__I2C__RX_CNT = 26,
|
||||
SYSTEM_STATS__I2C__ERROR_CNT = 27,
|
||||
CONFIG__BRAKE_RESISTANCE = 28,
|
||||
CONFIG__ENABLE_UART = 29,
|
||||
CONFIG__ENABLE_I2C_INSTEAD_OF_CAN = 30,
|
||||
CONFIG__DC_BUS_UNDERVOLTAGE_TRIP_LEVEL = 31,
|
||||
CONFIG__DC_BUS_OVERVOLTAGE_TRIP_LEVEL = 32,
|
||||
TEST_PROPERTY = 235,
|
||||
SAVE_CONFIGURATION = 242,
|
||||
ERASE_CONFIGURATION = 243,
|
||||
REBOOT = 244,
|
||||
ENTER_DFU_MODE = 245,
|
||||
|
||||
// Per-Axis endpoints (to be used with read_axis_property and write_axis_property)
|
||||
AXIS__ERROR = 33,
|
||||
AXIS__ENABLE_STEP_DIR = 34,
|
||||
AXIS__CURRENT_STATE = 35,
|
||||
AXIS__REQUESTED_STATE = 36,
|
||||
AXIS__LOOP_COUNTER = 37,
|
||||
AXIS__CONFIG__STARTUP_MOTOR_CALIBRATION = 38,
|
||||
AXIS__CONFIG__STARTUP_ENCODER_INDEX_SEARCH = 39,
|
||||
AXIS__CONFIG__STARTUP_ENCODER_OFFSET_CALIBRATION = 40,
|
||||
AXIS__CONFIG__STARTUP_CLOSED_LOOP_CONTROL = 41,
|
||||
AXIS__CONFIG__STARTUP_SENSORLESS_CONTROL = 42,
|
||||
AXIS__CONFIG__ENABLE_STEP_DIR = 43,
|
||||
AXIS__CONFIG__COUNTS_PER_STEP = 44,
|
||||
AXIS__CONFIG__RAMP_UP_TIME = 45,
|
||||
AXIS__CONFIG__RAMP_UP_DISTANCE = 46,
|
||||
AXIS__CONFIG__SPIN_UP_CURRENT = 47,
|
||||
AXIS__CONFIG__SPIN_UP_ACCELERATION = 48,
|
||||
AXIS__CONFIG__SPIN_UP_TARGET_VEL = 49,
|
||||
AXIS__MOTOR__ERROR = 50,
|
||||
AXIS__MOTOR__ARMED_STATE = 51,
|
||||
AXIS__MOTOR__IS_CALIBRATED = 52,
|
||||
AXIS__MOTOR__CURRENT_MEAS_PHB = 53,
|
||||
AXIS__MOTOR__CURRENT_MEAS_PHC = 54,
|
||||
AXIS__MOTOR__DC_CALIB_PHB = 55,
|
||||
AXIS__MOTOR__DC_CALIB_PHC = 56,
|
||||
AXIS__MOTOR__PHASE_CURRENT_REV_GAIN = 57,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__P_GAIN = 58,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__I_GAIN = 59,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_D = 60,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_Q = 61,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__IBUS = 62,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__FINAL_V_ALPHA = 63,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__FINAL_V_BETA = 64,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__IQ_SETPOINT = 65,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__IQ_MEASURED = 66,
|
||||
AXIS__MOTOR__CURRENT_CONTROL__MAX_ALLOWED_CURRENT = 67,
|
||||
AXIS__MOTOR__GATE_DRIVER__DRV_FAULT = 68,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_GENERAL = 69,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_I = 70,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_DC = 71,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_R = 72,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_L = 73,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_ENC_CALIB = 74,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_IDX_SEARCH = 75,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_FOC_VOLTAGE = 76,
|
||||
AXIS__MOTOR__TIMING_LOG__TIMING_LOG_FOC_CURRENT = 77,
|
||||
AXIS__MOTOR__CONFIG__PRE_CALIBRATED = 78,
|
||||
AXIS__MOTOR__CONFIG__POLE_PAIRS = 79,
|
||||
AXIS__MOTOR__CONFIG__CALIBRATION_CURRENT = 80,
|
||||
AXIS__MOTOR__CONFIG__RESISTANCE_CALIB_MAX_VOLTAGE = 81,
|
||||
AXIS__MOTOR__CONFIG__PHASE_INDUCTANCE = 82,
|
||||
AXIS__MOTOR__CONFIG__PHASE_RESISTANCE = 83,
|
||||
AXIS__MOTOR__CONFIG__DIRECTION = 84,
|
||||
AXIS__MOTOR__CONFIG__MOTOR_TYPE = 85,
|
||||
AXIS__MOTOR__CONFIG__CURRENT_LIM = 86,
|
||||
AXIS__CONTROLLER__POS_SETPOINT = 87,
|
||||
AXIS__CONTROLLER__VEL_SETPOINT = 88,
|
||||
AXIS__CONTROLLER__VEL_INTEGRATOR_CURRENT = 89,
|
||||
AXIS__CONTROLLER__CURRENT_SETPOINT = 90,
|
||||
AXIS__CONTROLLER__CONFIG__CONTROL_MODE = 91,
|
||||
AXIS__CONTROLLER__CONFIG__POS_GAIN = 92,
|
||||
AXIS__CONTROLLER__CONFIG__VEL_GAIN = 93,
|
||||
AXIS__CONTROLLER__CONFIG__VEL_INTEGRATOR_GAIN = 94,
|
||||
AXIS__CONTROLLER__CONFIG__VEL_LIMIT = 95,
|
||||
AXIS__CONTROLLER__START_ANTICOGGING_CALIBRATION = 105,
|
||||
AXIS__ENCODER__ERROR = 106,
|
||||
AXIS__ENCODER__IS_READY = 107,
|
||||
AXIS__ENCODER__INDEX_FOUND = 108,
|
||||
AXIS__ENCODER__SHADOW_COUNT = 109,
|
||||
AXIS__ENCODER__COUNT_IN_CPR = 110,
|
||||
AXIS__ENCODER__OFFSET = 111,
|
||||
AXIS__ENCODER__INTERPOLATION = 112,
|
||||
AXIS__ENCODER__PHASE = 113,
|
||||
AXIS__ENCODER__POS_ESTIMATE = 114,
|
||||
AXIS__ENCODER__POS_CPR = 115,
|
||||
AXIS__ENCODER__HALL_STATE = 116,
|
||||
AXIS__ENCODER__PLL_VEL = 117,
|
||||
AXIS__ENCODER__PLL_KP = 118,
|
||||
AXIS__ENCODER__PLL_KI = 119,
|
||||
AXIS__ENCODER__CONFIG__MODE = 120,
|
||||
AXIS__ENCODER__CONFIG__USE_INDEX = 121,
|
||||
AXIS__ENCODER__CONFIG__PRE_CALIBRATED = 122,
|
||||
AXIS__ENCODER__CONFIG__IDX_SEARCH_SPEED = 123,
|
||||
AXIS__ENCODER__CONFIG__CPR = 124,
|
||||
AXIS__ENCODER__CONFIG__OFFSET = 125,
|
||||
AXIS__ENCODER__CONFIG__OFFSET_FLOAT = 126,
|
||||
AXIS__ENCODER__CONFIG__CALIB_RANGE = 127,
|
||||
AXIS__SENSORLESS_ESTIMATOR__ERROR = 128,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PHASE = 129,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_POS = 130,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_VEL = 131,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_KP = 132,
|
||||
AXIS__SENSORLESS_ESTIMATOR__PLL_KI = 133,
|
||||
};
|
||||
|
||||
template<int I>
|
||||
@@ -274,6 +185,14 @@ template<> struct endpoint_type<CONFIG__ENABLE_UART> { typedef bool type; };
|
||||
template<> struct endpoint_type<CONFIG__ENABLE_I2C_INSTEAD_OF_CAN> { typedef bool type; };
|
||||
template<> struct endpoint_type<CONFIG__DC_BUS_UNDERVOLTAGE_TRIP_LEVEL> { typedef float type; };
|
||||
template<> struct endpoint_type<CONFIG__DC_BUS_OVERVOLTAGE_TRIP_LEVEL> { typedef float type; };
|
||||
template<> struct endpoint_type<TEST_PROPERTY> { typedef uint32_t type; };
|
||||
template<> struct endpoint_type<SAVE_CONFIGURATION> { typedef void type; };
|
||||
template<> struct endpoint_type<ERASE_CONFIGURATION> { typedef void type; };
|
||||
template<> struct endpoint_type<REBOOT> { typedef void type; };
|
||||
template<> struct endpoint_type<ENTER_DFU_MODE> { typedef void type; };
|
||||
|
||||
|
||||
// Per-axis endpoints
|
||||
template<> struct endpoint_type<AXIS__ERROR> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS__ENABLE_STEP_DIR> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS__CURRENT_STATE> { typedef uint8_t type; };
|
||||
@@ -366,103 +285,6 @@ template<> struct endpoint_type<AXIS__SENSORLESS_ESTIMATOR__PLL_POS> { typedef f
|
||||
template<> struct endpoint_type<AXIS__SENSORLESS_ESTIMATOR__PLL_VEL> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS__SENSORLESS_ESTIMATOR__PLL_KP> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS__SENSORLESS_ESTIMATOR__PLL_KI> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ERROR> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENABLE_STEP_DIR> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__CURRENT_STATE> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__REQUESTED_STATE> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__LOOP_COUNTER> { typedef uint32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__STARTUP_MOTOR_CALIBRATION> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__STARTUP_ENCODER_INDEX_SEARCH> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__STARTUP_ENCODER_OFFSET_CALIBRATION> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__STARTUP_CLOSED_LOOP_CONTROL> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__STARTUP_SENSORLESS_CONTROL> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__ENABLE_STEP_DIR> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__COUNTS_PER_STEP> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__RAMP_UP_TIME> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__RAMP_UP_DISTANCE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__SPIN_UP_CURRENT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__SPIN_UP_ACCELERATION> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONFIG__SPIN_UP_TARGET_VEL> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__ERROR> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__ARMED_STATE> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__IS_CALIBRATED> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_MEAS_PHB> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_MEAS_PHC> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__DC_CALIB_PHB> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__DC_CALIB_PHC> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__PHASE_CURRENT_REV_GAIN> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__P_GAIN> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__I_GAIN> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_D> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__V_CURRENT_CONTROL_INTEGRAL_Q> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__IBUS> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__FINAL_V_ALPHA> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__FINAL_V_BETA> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__IQ_SETPOINT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__IQ_MEASURED> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CURRENT_CONTROL__MAX_ALLOWED_CURRENT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__GATE_DRIVER__DRV_FAULT> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_GENERAL> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_I> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_ADC_CB_DC> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_R> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_MEAS_L> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_ENC_CALIB> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_IDX_SEARCH> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_FOC_VOLTAGE> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__TIMING_LOG__TIMING_LOG_FOC_CURRENT> { typedef uint16_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__PRE_CALIBRATED> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__POLE_PAIRS> { typedef int32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__CALIBRATION_CURRENT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__RESISTANCE_CALIB_MAX_VOLTAGE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__PHASE_INDUCTANCE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__PHASE_RESISTANCE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__DIRECTION> { typedef int32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__MOTOR_TYPE> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__MOTOR__CONFIG__CURRENT_LIM> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__POS_SETPOINT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__VEL_SETPOINT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__VEL_INTEGRATOR_CURRENT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__CURRENT_SETPOINT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__CONFIG__CONTROL_MODE> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__CONFIG__POS_GAIN> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__CONFIG__VEL_GAIN> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__CONFIG__VEL_INTEGRATOR_GAIN> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__CONFIG__VEL_LIMIT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__CONTROLLER__START_ANTICOGGING_CALIBRATION> { typedef void type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__ERROR> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__IS_READY> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__INDEX_FOUND> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__SHADOW_COUNT> { typedef int32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__COUNT_IN_CPR> { typedef int32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__OFFSET> { typedef int32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__INTERPOLATION> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__PHASE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__POS_ESTIMATE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__POS_CPR> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__HALL_STATE> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__PLL_VEL> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__PLL_KP> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__PLL_KI> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__MODE> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__USE_INDEX> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__PRE_CALIBRATED> { typedef bool type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__IDX_SEARCH_SPEED> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__CPR> { typedef int32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__OFFSET> { typedef int32_t type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__OFFSET_FLOAT> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__ENCODER__CONFIG__CALIB_RANGE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__SENSORLESS_ESTIMATOR__ERROR> { typedef uint8_t type; };
|
||||
template<> struct endpoint_type<AXIS1__SENSORLESS_ESTIMATOR__PHASE> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__SENSORLESS_ESTIMATOR__PLL_POS> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__SENSORLESS_ESTIMATOR__PLL_VEL> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__SENSORLESS_ESTIMATOR__PLL_KP> { typedef float type; };
|
||||
template<> struct endpoint_type<AXIS1__SENSORLESS_ESTIMATOR__PLL_KI> { typedef float type; };
|
||||
template<> struct endpoint_type<TEST_PROPERTY> { typedef uint32_t type; };
|
||||
template<> struct endpoint_type<SAVE_CONFIGURATION> { typedef void type; };
|
||||
template<> struct endpoint_type<ERASE_CONFIGURATION> { typedef void type; };
|
||||
template<> struct endpoint_type<REBOOT> { typedef void type; };
|
||||
template<> struct endpoint_type<ENTER_DFU_MODE> { typedef void type; };
|
||||
|
||||
|
||||
template<int I>
|
||||
|
||||
@@ -3,10 +3,12 @@ import jinja2
|
||||
import os
|
||||
import json
|
||||
|
||||
def get_flat_endpoint_list(json, prefix):
|
||||
def get_flat_endpoint_list(json, prefix, id_offset):
|
||||
flat_list = []
|
||||
for item in json:
|
||||
item = item.copy()
|
||||
if 'id' in item:
|
||||
item['id'] -= id_offset
|
||||
if 'type' in item:
|
||||
if item['type'] in {'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64'}:
|
||||
item['type'] += '_t'
|
||||
@@ -25,14 +27,22 @@ def get_flat_endpoint_list(json, prefix):
|
||||
item['name'] = prefix + item['name']
|
||||
flat_list.append(item)
|
||||
if 'members' in item:
|
||||
flat_list = flat_list + get_flat_endpoint_list(item['members'], prefix + item['name'] + '.')
|
||||
flat_list = flat_list + get_flat_endpoint_list(item['members'], prefix + item['name'] + '.', id_offset)
|
||||
return flat_list
|
||||
|
||||
def generate_code(odrv, template_file, output_file):
|
||||
json_data = odrv._json_data
|
||||
json_crc = odrv._json_crc
|
||||
|
||||
endpoints = get_flat_endpoint_list(json_data, '')
|
||||
axis0_json = [item for item in json_data if item['name'].startswith("axis0")][0]
|
||||
axis1_json = [item for item in json_data if item['name'].startswith("axis1")][0]
|
||||
json_data = [item for item in json_data if not item['name'].startswith("axis")]
|
||||
endpoints = get_flat_endpoint_list(json_data, '', 0)
|
||||
per_axis_offset = axis1_json['members'][0]['id'] - axis0_json['members'][0]['id']
|
||||
axis_endpoints = get_flat_endpoint_list(axis0_json['members'], 'axis.', 0)
|
||||
axis_endpoints_copy = get_flat_endpoint_list(axis1_json['members'], 'axis.', per_axis_offset)
|
||||
if axis_endpoints != axis_endpoints_copy:
|
||||
raise Exception("axis0 and axis1 don't look exactly equal")
|
||||
|
||||
env = jinja2.Environment(
|
||||
#loader = jinja2.FileSystemLoader("/Data/Projects/")
|
||||
@@ -43,11 +53,15 @@ def generate_code(odrv, template_file, output_file):
|
||||
# Expose helper functions to jinja template code
|
||||
#env.filters["delimit"] = camel_case_to_words
|
||||
|
||||
#import ipdb; ipdb.set_trace()
|
||||
|
||||
# Load and render template
|
||||
template = env.from_string(template_file.read())
|
||||
output = template.render(
|
||||
json_crc=json_crc,
|
||||
endpoints=endpoints,
|
||||
per_axis_offset=per_axis_offset,
|
||||
axis_endpoints=axis_endpoints,
|
||||
output_name=os.path.basename(output_file.name)
|
||||
)
|
||||
|
||||
|
||||
@@ -14,8 +14,15 @@ namespace odrive {
|
||||
|
||||
static constexpr const uint16_t json_crc = 0x{{ "%0x" | format(json_crc) }};
|
||||
|
||||
static constexpr const uint16_t per_axis_offset = {{ per_axis_offset }};
|
||||
|
||||
enum { {% for endpoint in endpoints %}
|
||||
{{enum_name(endpoint)}} = {{endpoint.id}},
|
||||
{{enum_name(endpoint)}} = {{endpoint.id}},
|
||||
{%- endfor %}
|
||||
|
||||
// Per-Axis endpoints (to be used with read_axis_property and write_axis_property)
|
||||
{%- for endpoint in axis_endpoints %}
|
||||
{{enum_name(endpoint)}} = {{endpoint.id}},
|
||||
{%- endfor %}
|
||||
};
|
||||
|
||||
@@ -26,6 +33,11 @@ struct endpoint_type;
|
||||
template<> struct endpoint_type<{{enum_name(endpoint)}}> { typedef {{endpoint.type}} type; };
|
||||
{% endfor %}
|
||||
|
||||
// Per-axis endpoints
|
||||
{% for endpoint in axis_endpoints -%}
|
||||
template<> struct endpoint_type<{{enum_name(endpoint)}}> { typedef {{endpoint.type}} type; };
|
||||
{% endfor %}
|
||||
|
||||
template<int I>
|
||||
using endpoint_type_t = typename endpoint_type<I>::type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user