Add SetOff menu (experimental)

This commit is contained in:
Armel FAUVEAU
2024-09-24 22:55:33 +02:00
parent 7fdc2cc3f9
commit 4a144cb522
13 changed files with 115 additions and 2 deletions

View File

@@ -31,6 +31,10 @@
uint16_t gBacklightCountdown_500ms = 0;
bool backlightOn;
#ifdef ENABLE_FEAT_F4HWN_SLEEP
uint16_t gSleepModeCountdown_500ms = 0;
#endif
void BACKLIGHT_InitHardware()
{
// 48MHz / 94 / 1024 ~ 500Hz
@@ -117,6 +121,10 @@ void BACKLIGHT_TurnOn(void)
gBacklightCountdown_500ms = 0;
break;
}
#ifdef ENABLE_FEAT_F4HWN_SLEEP
gSleepModeCountdown_500ms = gSetting_set_off * 120;
#endif
}
void BACKLIGHT_TurnOff()

View File

@@ -23,6 +23,10 @@
extern uint16_t gBacklightCountdown_500ms;
extern uint8_t gBacklightBrightness;
#ifdef ENABLE_FEAT_F4HWN_SLEEP
extern uint16_t gSleepModeCountdown_500ms;
#endif
#ifdef ENABLE_BLMIN_TMP_OFF
typedef enum {
BLMIN_STAT_ON,

View File

@@ -256,6 +256,17 @@ void ST7565_Init(void)
ST7565_FillScreen(0x00);
}
#ifdef ENABLE_FEAT_F4HWN_SLEEP
void ST7565_ShutDown(void)
{
SPI_ToggleMasterMode(&SPI0->CR, false);
ST7565_WriteByte(ST7565_CMD_POWER_CIRCUIT | 0b000); // VB=0 VR=1 VF=1
ST7565_WriteByte(ST7565_CMD_SET_START_LINE | 0); // line 0
ST7565_WriteByte(ST7565_CMD_DISPLAY_ON_OFF | 0); // D=1
SPI_ToggleMasterMode(&SPI0->CR, true);
}
#endif
void ST7565_FixInterfGlitch(void)
{
SPI_ToggleMasterMode(&SPI0->CR, false);

View File

@@ -33,6 +33,9 @@ void ST7565_BlitLine(unsigned line);
void ST7565_BlitStatusLine(void);
void ST7565_FillScreen(uint8_t Value);
void ST7565_Init(void);
#ifdef ENABLE_FEAT_F4HWN_SLEEP
void ST7565_ShutDown(void);
#endif
void ST7565_FixInterfGlitch(void);
void ST7565_HardwareReset(void);
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);