mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
AP_HAL_ChibiOS: allow enabling GPIO as alt config
This commit is contained in:
parent
dc45a113f9
commit
a96150a528
@ -134,6 +134,17 @@ void GPIO::setup_alt_config(void)
|
||||
for (uint8_t i=0; i<ARRAY_SIZE(alternate_config); i++) {
|
||||
const struct alt_config &alt = alternate_config[i];
|
||||
if (alt_config == alt.alternate) {
|
||||
if (alt.periph_type == PERIPH_TYPE::GPIO) {
|
||||
// enable pin in GPIO table
|
||||
for (uint8_t j=0; j<ARRAY_SIZE(_gpio_tab); j++) {
|
||||
struct gpio_entry *g = &_gpio_tab[j];
|
||||
if (g->pal_line == alt.line) {
|
||||
g->enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const iomode_t mode = alt.mode & ~PAL_STM32_HIGH;
|
||||
const uint8_t odr = (alt.mode & PAL_STM32_HIGH)?1:0;
|
||||
palSetLineMode(alt.line, mode);
|
||||
|
@ -35,6 +35,7 @@ enum class PERIPH_TYPE : uint8_t {
|
||||
I2C_SDA,
|
||||
I2C_SCL,
|
||||
OTHER,
|
||||
GPIO,
|
||||
};
|
||||
|
||||
class ChibiOS::GPIO : public AP_HAL::GPIO {
|
||||
|
Loading…
Reference in New Issue
Block a user