Skip to content

Commit

Permalink
add some missing registers
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Unger committed Feb 20, 2024
1 parent 0d149e5 commit 3a11d58
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/comms/SimpleFOCRegisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ bool SimpleFOCRegisters::registerToComms(RegisterIO& comms, uint8_t reg, FOCMoto
case SimpleFOCRegister::REG_DRIVER_VOLTAGE_LIMIT:
comms << ((BLDCMotor*)motor)->driver->voltage_limit; // TODO handle stepper motors
break;
case SimpleFOCRegister::REG_DRIVER_VOLTAGE_PSU:
comms << (((BLDCMotor*)motor)->driver->voltage_power_supply);
return true;
case SimpleFOCRegister::REG_VOLTAGE_SENSOR_ALIGN:
comms << (((BLDCMotor*)motor)->voltage_sensor_align);
return true;
case SimpleFOCRegister::REG_PWM_FREQUENCY:
comms << (uint32_t)((BLDCMotor*)motor)->driver->pwm_frequency; // TODO handle stepper motors
break;
Expand Down Expand Up @@ -497,6 +503,12 @@ bool SimpleFOCRegisters::commsToRegister(RegisterIO& comms, uint8_t reg, FOCMoto
case SimpleFOCRegister::REG_DRIVER_VOLTAGE_LIMIT:
comms >> (((BLDCMotor*)motor)->driver->voltage_limit);
return true;
case SimpleFOCRegister::REG_DRIVER_VOLTAGE_PSU:
comms >> (((BLDCMotor*)motor)->driver->voltage_power_supply);
return true;
case SimpleFOCRegister::REG_VOLTAGE_SENSOR_ALIGN:
comms >> (((BLDCMotor*)motor)->voltage_sensor_align);
return true;
case SimpleFOCRegister::REG_PWM_FREQUENCY:
comms >> val32;
((BLDCMotor*)motor)->driver->pwm_frequency = val32;
Expand Down Expand Up @@ -631,6 +643,8 @@ uint8_t SimpleFOCRegisters::sizeOfRegister(uint8_t reg){
case SimpleFOCRegister::REG_VOLTAGE_LIMIT:
case SimpleFOCRegister::REG_CURRENT_LIMIT:
case SimpleFOCRegister::REG_DRIVER_VOLTAGE_LIMIT:
case SimpleFOCRegister::REG_DRIVER_VOLTAGE_PSU:
case SimpleFOCRegister::REG_VOLTAGE_SENSOR_ALIGN:
case SimpleFOCRegister::REG_PWM_FREQUENCY:
case SimpleFOCRegister::REG_ZERO_ELECTRIC_ANGLE:
case SimpleFOCRegister::REG_ZERO_OFFSET:
Expand Down
1 change: 1 addition & 0 deletions src/comms/SimpleFOCRegisters.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ typedef enum : uint8_t {
REG_DRIVER_VOLTAGE_LIMIT = 0x53,// R/W - float
REG_PWM_FREQUENCY = 0x54, // R/W - uint32_t
REG_DRIVER_VOLTAGE_PSU = 0x55, // R/W - float
REG_VOLTAGE_SENSOR_ALIGN = 0x56,// R/W - float
REG_MOTION_DOWNSAMPLE = 0x5F, // R/W - uint32_t

REG_ZERO_ELECTRIC_ANGLE = 0x60, // RO - float
Expand Down

0 comments on commit 3a11d58

Please sign in to comment.