FuriHal: explicitly pull display pins at early init stage, move PUPD config to early stage (#3004)

Co-authored-by: hedger <hedger@users.noreply.github.com>
This commit is contained in:
あく 2023-08-24 01:17:39 +09:00 committed by GitHub
parent beeeb9bbdc
commit d808884b97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 38 deletions

View File

@ -128,19 +128,22 @@ void furi_hal_resources_init_early() {
furi_hal_resources_init_input_pins(GpioModeInput);
// Explicit, surviving reset, pulls
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
// SD Card stepdown control
furi_hal_gpio_write(&gpio_periph_power, 1);
furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
// Display pins
furi_hal_gpio_write(&gpio_display_rst_n, 1);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init_simple(&gpio_display_rst_n, GpioModeOutputPushPull);
furi_hal_gpio_init(&gpio_display_di, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
// Pullup display reset pin for shutdown
SET_BIT(PWR->PUCRB, gpio_display_rst_n.pin);
CLEAR_BIT(PWR->PDCRB, gpio_display_rst_n.pin);
SET_BIT(PWR->CR3, PWR_CR3_APC);
LL_PWR_EnableGPIOPullUp(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_0); // gpio_display_rst_n
furi_hal_gpio_write(&gpio_display_di, 0);
furi_hal_gpio_init_simple(&gpio_display_di, GpioModeOutputPushPull);
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_1); // gpio_display_di
// Hard reset USB
furi_hal_gpio_write(&gpio_usb_dm, 1);
@ -182,18 +185,6 @@ void furi_hal_resources_init() {
// Button pins
furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall);
// Explicit pulls pins
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
// Display pins
furi_hal_gpio_init(&gpio_display_rst_n, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init(&gpio_display_di, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_di, 0);
// SD pins
furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_sdcard_cd, 0);

View File

@ -117,19 +117,23 @@ void furi_hal_resources_init_early() {
furi_hal_resources_init_input_pins(GpioModeInput);
// Explicit, surviving reset, pulls
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_9); // gpio_infrared_tx
// SD Card stepdown control
furi_hal_gpio_write(&gpio_periph_power, 1);
furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
// Display pins
furi_hal_gpio_write(&gpio_display_rst_n, 1);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init_simple(&gpio_display_rst_n, GpioModeOutputPushPull);
LL_PWR_EnableGPIOPullUp(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_0); // gpio_display_rst_n
furi_hal_gpio_write(&gpio_display_di, 0);
furi_hal_gpio_init_simple(&gpio_display_di, GpioModeOutputPushPull);
// Alternative pull configuration for shutdown
SET_BIT(PWR->PUCRB, DISPLAY_RST_Pin);
CLEAR_BIT(PWR->PDCRB, DISPLAY_RST_Pin);
SET_BIT(PWR->CR3, PWR_CR3_APC);
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_1); // gpio_display_di
// Hard reset USB
furi_hal_gpio_write(&gpio_usb_dm, 1);
@ -171,19 +175,6 @@ void furi_hal_resources_init() {
// Button pins
furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall);
// Explicit, surviving reset, pulls
LL_PWR_EnablePUPDCfg();
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_9); // gpio_infrared_tx
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_8); // gpio_speaker
LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_8); // gpio_vibro
// Display pins
furi_hal_gpio_init(&gpio_display_rst_n, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_rst_n, 0);
furi_hal_gpio_init(&gpio_display_di, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_display_di, 0);
// SD pins
furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_write(&gpio_sdcard_cd, 0);