turn backlight off on "poweroff" state
This commit is contained in:
parent
e22f151f24
commit
435ec0f848
12
src/main.c
12
src/main.c
|
@ -1,4 +1,5 @@
|
|||
#include <gint/display.h>
|
||||
#include <gint/drivers/r61524.h>
|
||||
#include <gint/gint.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include <gint/timer.h>
|
||||
|
@ -32,11 +33,14 @@ static int callback_keypoll(void) {
|
|||
return TIMER_STOP;
|
||||
}
|
||||
|
||||
extern void _set_backlight(char level);
|
||||
|
||||
int main(void) {
|
||||
int tick_ctr = 0;
|
||||
int shift_state = 0;
|
||||
int alpha_state = 0;
|
||||
int off_state = 0;
|
||||
uint16_t backlight_save;
|
||||
|
||||
set_statusbar(tick_ctr, shift_state, alpha_state, get_battery_voltage());
|
||||
set_menubar();
|
||||
|
@ -52,6 +56,9 @@ int main(void) {
|
|||
if (off_state) {
|
||||
if (kev.key == KEY_ACON) {
|
||||
off_state = 0;
|
||||
|
||||
// reset backlight
|
||||
r61524_set(0x5a1, backlight_save & 0x00ff);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
@ -66,8 +73,9 @@ int main(void) {
|
|||
if (kev.key == KEY_ACON && shift_state) {
|
||||
off_state = 1;
|
||||
|
||||
dclear(C_BLACK);
|
||||
dupdate();
|
||||
// turn backlight off
|
||||
backlight_save = r61524_get(0x5a1) & 0x00ff;
|
||||
r61524_set(0x5a1, 0);
|
||||
|
||||
shift_state = 0;
|
||||
alpha_state = 0;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
.global __poweroff
|
||||
.global __battery
|
||||
.global __battery_type
|
||||
.global __set_backlight
|
||||
|
||||
.section ".text"
|
||||
|
||||
|
@ -30,6 +31,9 @@ __battery:
|
|||
__battery_type:
|
||||
syscall(0x12d5)
|
||||
|
||||
__set_backlight:
|
||||
syscall(0x0199)
|
||||
|
||||
syscall_table:
|
||||
.long 0x80020070
|
||||
|
||||
|
|
Loading…
Reference in New Issue