| 103 | } |
| 104 | |
| 105 | static void initExpander1(::Device* io_expander1) { |
| 106 | |
| 107 | auto* c6_wlan_enable_pin = gpio_descriptor_acquire(io_expander1, GPIO_EXP1_PIN_C6_WLAN_ENABLE, GPIO_OWNER_GPIO); |
| 108 | check(c6_wlan_enable_pin); |
| 109 | auto* usb_a_5v_enable_pin = gpio_descriptor_acquire(io_expander1, GPIO_EXP1_PIN_USB_A_5V_ENABLE, GPIO_OWNER_GPIO); |
| 110 | check(usb_a_5v_enable_pin); |
| 111 | auto* device_power_pin = gpio_descriptor_acquire(io_expander1, GPIO_EXP1_PIN_DEVICE_POWER, GPIO_OWNER_GPIO); |
| 112 | check(device_power_pin); |
| 113 | auto* ip2326_ncharge_qc_enable_pin = gpio_descriptor_acquire(io_expander1, GPIO_EXP1_PIN_IP2326_NCHG_QC_EN, GPIO_OWNER_GPIO); |
| 114 | check(ip2326_ncharge_qc_enable_pin); |
| 115 | auto* ip2326_charge_state_led_pin = gpio_descriptor_acquire(io_expander1, GPIO_EXP1_PIN_IP2326_CHG_STAT_LED, GPIO_OWNER_GPIO); |
| 116 | check(ip2326_charge_state_led_pin); |
| 117 | auto* ip2326_charge_enable_pin = gpio_descriptor_acquire(io_expander1, GPIO_EXP1_PIN_IP2326_CHG_EN, GPIO_OWNER_GPIO); |
| 118 | check(ip2326_charge_enable_pin); |
| 119 | |
| 120 | gpio_descriptor_set_flags(c6_wlan_enable_pin, GPIO_FLAG_DIRECTION_OUTPUT); |
| 121 | gpio_descriptor_set_flags(usb_a_5v_enable_pin, GPIO_FLAG_DIRECTION_OUTPUT); |
| 122 | gpio_descriptor_set_flags(device_power_pin, GPIO_FLAG_DIRECTION_OUTPUT); |
| 123 | gpio_descriptor_set_flags(ip2326_ncharge_qc_enable_pin, GPIO_FLAG_DIRECTION_OUTPUT); |
| 124 | gpio_descriptor_set_flags(ip2326_charge_state_led_pin, GPIO_FLAG_DIRECTION_OUTPUT); |
| 125 | gpio_descriptor_set_flags(ip2326_charge_enable_pin, GPIO_FLAG_DIRECTION_INPUT | GPIO_FLAG_PULL_UP); |
| 126 | |
| 127 | gpio_descriptor_set_level(c6_wlan_enable_pin, true); |
| 128 | gpio_descriptor_set_level(usb_a_5v_enable_pin, true); |
| 129 | gpio_descriptor_set_level(device_power_pin, false); |
| 130 | gpio_descriptor_set_level(ip2326_ncharge_qc_enable_pin, false); |
| 131 | gpio_descriptor_set_level(ip2326_charge_state_led_pin, false); |
| 132 | |
| 133 | gpio_descriptor_release(c6_wlan_enable_pin); |
| 134 | gpio_descriptor_release(usb_a_5v_enable_pin); |
| 135 | gpio_descriptor_release(device_power_pin); |
| 136 | gpio_descriptor_release(ip2326_ncharge_qc_enable_pin); |
| 137 | gpio_descriptor_release(ip2326_charge_state_led_pin); |
| 138 | gpio_descriptor_release(ip2326_charge_enable_pin); |
| 139 | } |
| 140 | |
| 141 | static error_t initSound(::Device* i2c_controller, ::Device* io_expander0 = nullptr) { |
| 142 | // Init data from M5Unified: |
no test coverage detected