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:
		
							parent
							
								
									beeeb9bbdc
								
							
						
					
					
						commit
						d808884b97
					
				@ -128,19 +128,22 @@ void furi_hal_resources_init_early() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    furi_hal_resources_init_input_pins(GpioModeInput);
 | 
					    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
 | 
					    // SD Card stepdown control
 | 
				
			||||||
    furi_hal_gpio_write(&gpio_periph_power, 1);
 | 
					    furi_hal_gpio_write(&gpio_periph_power, 1);
 | 
				
			||||||
    furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
 | 
					    furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Display pins
 | 
					    // 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_simple(&gpio_display_rst_n, GpioModeOutputPushPull);
 | 
				
			||||||
    furi_hal_gpio_init(&gpio_display_di, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
 | 
					    LL_PWR_EnableGPIOPullUp(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_0); // gpio_display_rst_n
 | 
				
			||||||
 | 
					    furi_hal_gpio_write(&gpio_display_di, 0);
 | 
				
			||||||
    // Pullup display reset pin for shutdown
 | 
					    furi_hal_gpio_init_simple(&gpio_display_di, GpioModeOutputPushPull);
 | 
				
			||||||
    SET_BIT(PWR->PUCRB, gpio_display_rst_n.pin);
 | 
					    LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_1); // gpio_display_di
 | 
				
			||||||
    CLEAR_BIT(PWR->PDCRB, gpio_display_rst_n.pin);
 | 
					 | 
				
			||||||
    SET_BIT(PWR->CR3, PWR_CR3_APC);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Hard reset USB
 | 
					    // Hard reset USB
 | 
				
			||||||
    furi_hal_gpio_write(&gpio_usb_dm, 1);
 | 
					    furi_hal_gpio_write(&gpio_usb_dm, 1);
 | 
				
			||||||
@ -182,18 +185,6 @@ void furi_hal_resources_init() {
 | 
				
			|||||||
    // Button pins
 | 
					    // Button pins
 | 
				
			||||||
    furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall);
 | 
					    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
 | 
					    // SD pins
 | 
				
			||||||
    furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
 | 
					    furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
 | 
				
			||||||
    furi_hal_gpio_write(&gpio_sdcard_cd, 0);
 | 
					    furi_hal_gpio_write(&gpio_sdcard_cd, 0);
 | 
				
			||||||
 | 
				
			|||||||
@ -117,19 +117,23 @@ void furi_hal_resources_init_early() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    furi_hal_resources_init_input_pins(GpioModeInput);
 | 
					    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
 | 
					    // SD Card stepdown control
 | 
				
			||||||
    furi_hal_gpio_write(&gpio_periph_power, 1);
 | 
					    furi_hal_gpio_write(&gpio_periph_power, 1);
 | 
				
			||||||
    furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
 | 
					    furi_hal_gpio_init(&gpio_periph_power, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Display pins
 | 
					    // 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_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);
 | 
					    furi_hal_gpio_init_simple(&gpio_display_di, GpioModeOutputPushPull);
 | 
				
			||||||
 | 
					    LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_B, LL_PWR_GPIO_BIT_1); // gpio_display_di
 | 
				
			||||||
    // 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);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Hard reset USB
 | 
					    // Hard reset USB
 | 
				
			||||||
    furi_hal_gpio_write(&gpio_usb_dm, 1);
 | 
					    furi_hal_gpio_write(&gpio_usb_dm, 1);
 | 
				
			||||||
@ -171,19 +175,6 @@ void furi_hal_resources_init() {
 | 
				
			|||||||
    // Button pins
 | 
					    // Button pins
 | 
				
			||||||
    furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall);
 | 
					    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
 | 
					    // SD pins
 | 
				
			||||||
    furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
 | 
					    furi_hal_gpio_init(&gpio_sdcard_cd, GpioModeInput, GpioPullNo, GpioSpeedLow);
 | 
				
			||||||
    furi_hal_gpio_write(&gpio_sdcard_cd, 0);
 | 
					    furi_hal_gpio_write(&gpio_sdcard_cd, 0);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user