Changed the GPIO configuration for the mechanical brake to only take effect at boot

This commit is contained in:
Shaun Meehan
2020-08-27 22:02:25 -07:00
parent b61ac4c50e
commit 801bda211e
2 changed files with 5 additions and 7 deletions
+3 -7
View File
@@ -14,13 +14,9 @@ void MechanicalBrake::release() {
get_gpio(config_.gpio_num).write(config_.is_active_low ? 1 : 0);
}
void MechanicalBrake::set_enabled(bool enable) {
Stm32Gpio gpio = get_gpio(config_.gpio_num);
// We need this flag to alert the system to the configuration on boot
odrv.config_.gpio_modes[config_.gpio_num] = ODriveIntf::GPIO_MODE_MECH_BRAKE;
void MechanicalBrake::set_enabled(bool enable) {
if (enable) {
gpio.config(GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_SPEED_FREQ_LOW);
// We need this flag to alert the system to the configuration on boot
odrv.config_.gpio_modes[config_.gpio_num] = ODriveIntf::GPIO_MODE_MECH_BRAKE;
}
}
+2
View File
@@ -22,12 +22,14 @@ The GPIO pin number, according to the silkscreen labels on ODrive. Set with thes
```
<odrv>.<axis>.mechanical_brake.config.gpio_num = <1, 2, 3, 4, 5, 6, 7, 8>
```
After GPIO pin number is changed, you'll need to run `<odrv>.save_configuration()` and `<odrv>.reboot()` for changes to take effect.
### enabled
Enables/disables the operation of the mechanical brake.
```
<odrv>.<axis>.mechanical_brake.config.enabled = <True, False>
```
After mechanical brake is enabled or disabled, you'll need to run `<odrv>.save_configuration()` and `<odrv>.reboot()` for changes to take effect.
### is_active_low
Most safety braking systems are active low, e.g. when the power is off, the brake is on. If the system uses brake drive electronics which use active high logic, flip this bit then reconsider the safety implications of your design...