| 86 | {} |
| 87 | |
| 88 | void GPIO::init() |
| 89 | { |
| 90 | #if !APM_BUILD_TYPE(APM_BUILD_iofirmware) && !defined(HAL_BOOTLOADER_BUILD) |
| 91 | #if HAL_WITH_IO_MCU || HAVE_GPIO_PINS |
| 92 | uint8_t chan_offset = 0; |
| 93 | #endif |
| 94 | #if HAL_WITH_IO_MCU |
| 95 | if (AP_BoardConfig::io_enabled()) { |
| 96 | uint8_t GPIO_mask = 0; |
| 97 | for (uint8_t i=0; i<8; i++) { |
| 98 | if (SRV_Channels::is_GPIO(i)) { |
| 99 | GPIO_mask |= 1U << i; |
| 100 | } |
| 101 | } |
| 102 | iomcu.set_GPIO_mask(GPIO_mask); |
| 103 | chan_offset = 8; |
| 104 | } |
| 105 | #endif |
| 106 | // auto-disable pins being used for PWM output |
| 107 | #if HAVE_GPIO_PINS |
| 108 | for (uint8_t i=0; i<ARRAY_SIZE(_gpio_tab); i++) { |
| 109 | struct gpio_entry *g = &_gpio_tab[i]; |
| 110 | if (g->pwm_num != 0) { |
| 111 | g->enabled = SRV_Channels::is_GPIO((g->pwm_num-1)+chan_offset); |
| 112 | } |
| 113 | } |
| 114 | #endif // HAVE_GPIO_PINS |
| 115 | #endif // HAL_BOOTLOADER_BUILD |
| 116 | #ifdef HAL_PIN_ALT_CONFIG |
| 117 | setup_alt_config(); |
| 118 | #endif |
| 119 | } |
| 120 | |
| 121 | #ifdef HAL_PIN_ALT_CONFIG |
| 122 | // chosen alternative config |
no test coverage detected