fix buttons working, add basic brightness control
This commit is contained in:
43
firmware/app/ui/temp_ui.c
Normal file
43
firmware/app/ui/temp_ui.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* temp_ui.c: temporary ui shit until I can write something better
|
||||
*/
|
||||
|
||||
#include "ch32x035_conf.h"
|
||||
#include "btn.h"
|
||||
|
||||
#include "led/matrix.h"
|
||||
|
||||
|
||||
|
||||
static uint32_t brt = 28;
|
||||
|
||||
|
||||
|
||||
void brt_set(uint8_t idx)
|
||||
{
|
||||
switch (idx) {
|
||||
case 1: {
|
||||
if (brt > 4)
|
||||
brt--;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
brt++;
|
||||
if (brt > 44) brt = 44;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aw20x_set_dim_global(&awled, brt);
|
||||
}
|
||||
|
||||
void tempui_init()
|
||||
{
|
||||
btn[2].cb_push = brt_set;
|
||||
btn[2].cb_hold = brt_set;
|
||||
btn[2].repeat = 200;
|
||||
|
||||
btn[1].cb_push = brt_set;
|
||||
btn[1].cb_hold = brt_set;
|
||||
btn[1].repeat = 200;
|
||||
}
|
||||
Reference in New Issue
Block a user