mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-20 22:14:34 +08:00
Added GPIO_MODE_MECH_BRAKE, removed pull-ups for outputs, updated docs, added check for GPIO_MODE_MECH_BRAKE to startup in main
This commit is contained in:
@@ -411,7 +411,8 @@ extern "C" int main(void) {
|
||||
GPIO_InitStruct.Pin = get_gpio(i).pin_mask_;
|
||||
|
||||
// Set Alternate Function setting for this GPIO mode
|
||||
if (mode == ODriveIntf::GPIO_MODE_DIGITAL || mode == ODriveIntf::GPIO_MODE_ANALOG_IN) {
|
||||
if (mode == ODriveIntf::GPIO_MODE_DIGITAL || mode == ODriveIntf::GPIO_MODE_ANALOG_IN
|
||||
|| mode == ODriveIntf::GPIO_MODE_MECH_BRAKE) {
|
||||
GPIO_InitStruct.Alternate = 0;
|
||||
} else {
|
||||
auto it = std::find_if(
|
||||
@@ -497,6 +498,11 @@ extern "C" int main(void) {
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
} break;
|
||||
case ODriveIntf::GPIO_MODE_MECH_BRAKE: {
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
} break;
|
||||
default: {
|
||||
odrv.misconfigured_ = true;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user