Prevent device from sleep mode while setuping display (#366)

This commit is contained in:
あく 2021-03-04 20:12:41 +03:00 committed by GitHub
parent 10978c51fd
commit 025b77ecc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
#include "icon_i.h" #include "icon_i.h"
#include <furi.h> #include <furi.h>
#include <api-hal.h>
uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr); uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr);
uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr); uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr);
@ -9,6 +10,8 @@ uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_
Canvas* canvas_init() { Canvas* canvas_init() {
Canvas* canvas = furi_alloc(sizeof(Canvas)); Canvas* canvas = furi_alloc(sizeof(Canvas));
api_hal_power_insomnia_enter();
u8g2_Setup_st7565_erc12864_alt_f( u8g2_Setup_st7565_erc12864_alt_f(
&canvas->fb, U8G2_R0, u8x8_hw_spi_stm32, u8g2_gpio_and_delay_stm32); &canvas->fb, U8G2_R0, u8x8_hw_spi_stm32, u8g2_gpio_and_delay_stm32);
@ -19,6 +22,8 @@ Canvas* canvas_init() {
u8g2_SetPowerSave(&canvas->fb, 0); u8g2_SetPowerSave(&canvas->fb, 0);
u8g2_SendBuffer(&canvas->fb); u8g2_SendBuffer(&canvas->fb);
api_hal_power_insomnia_exit();
return canvas; return canvas;
} }