MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / initExpander0

Function initExpander0

Devices/m5stack-tab5/Source/Configuration.cpp:61–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59constexpr auto GPIO_EXP1_PIN_IP2326_CHG_EN = 7;
60
61static void initExpander0(::Device* io_expander0) {
62 auto* rf_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_RF_INTERNAL_EXTERNAL, GPIO_OWNER_GPIO);
63 check(rf_pin);
64 auto* speaker_enable_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_SPEAKER_ENABLE, GPIO_OWNER_GPIO);
65 check(speaker_enable_pin);
66 auto* external_5v_bus_enable_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_EXTERNAL_5V_BUS_ENABLE, GPIO_OWNER_GPIO);
67 check(external_5v_bus_enable_pin);
68 auto* lcd_reset_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_LCD_RESET, GPIO_OWNER_GPIO);
69 check(lcd_reset_pin);
70 auto* touch_reset_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_TOUCH_RESET, GPIO_OWNER_GPIO);
71 check(touch_reset_pin);
72 auto* camera_reset_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_CAMERA_RESET, GPIO_OWNER_GPIO);
73 check(camera_reset_pin);
74 auto* headphone_detect_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_HEADPHONE_DETECT, GPIO_OWNER_GPIO);
75 check(headphone_detect_pin);
76
77 gpio_descriptor_set_flags(rf_pin, GPIO_FLAG_DIRECTION_OUTPUT);
78 gpio_descriptor_set_flags(speaker_enable_pin, GPIO_FLAG_DIRECTION_OUTPUT);
79 gpio_descriptor_set_flags(external_5v_bus_enable_pin, GPIO_FLAG_DIRECTION_OUTPUT);
80 gpio_descriptor_set_flags(lcd_reset_pin, GPIO_FLAG_DIRECTION_OUTPUT);
81 gpio_descriptor_set_flags(touch_reset_pin, GPIO_FLAG_DIRECTION_OUTPUT);
82 gpio_descriptor_set_flags(camera_reset_pin, GPIO_FLAG_DIRECTION_OUTPUT);
83 gpio_descriptor_set_flags(headphone_detect_pin, GPIO_FLAG_DIRECTION_INPUT);
84
85 gpio_descriptor_set_level(rf_pin, false);
86 gpio_descriptor_set_level(speaker_enable_pin, false);
87 gpio_descriptor_set_level(external_5v_bus_enable_pin, true);
88 gpio_descriptor_set_level(lcd_reset_pin, false);
89 gpio_descriptor_set_level(touch_reset_pin, false);
90 gpio_descriptor_set_level(camera_reset_pin, true);
91 vTaskDelay(pdMS_TO_TICKS(10));
92 // Enable touch and lcd, but not the camera
93 gpio_descriptor_set_level(lcd_reset_pin, true);
94 gpio_descriptor_set_level(touch_reset_pin, true);
95
96 gpio_descriptor_release(rf_pin);
97 gpio_descriptor_release(speaker_enable_pin);
98 gpio_descriptor_release(external_5v_bus_enable_pin);
99 gpio_descriptor_release(lcd_reset_pin);
100 gpio_descriptor_release(touch_reset_pin);
101 gpio_descriptor_release(camera_reset_pin);
102 gpio_descriptor_release(headphone_detect_pin);
103}
104
105static void initExpander1(::Device* io_expander1) {
106

Callers 1

initBootFunction · 0.85

Calls 5

gpio_descriptor_acquireFunction · 0.85
gpio_descriptor_releaseFunction · 0.85
checkFunction · 0.50

Tested by

no test coverage detected