mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 18:20:15 +08:00
Changed the GPIO configuration for the mechanical brake to only take effect at boot
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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...
|
||||
|
||||
Reference in New Issue
Block a user