mirror of
https://github.com/clockworkpi/PicoCalc.git
synced 2026-03-23 20:42:38 +01:00
Prepare to update picocalc_keyboard to v1.6 made by @ernst
This version has the following changes: * return the bios version with REG_ID_VER * Improved backlight setting for LCD and Keyboard * Replaced delay() with a non-blocking delay nbDelay() * Implements monitoring of receive and request events * I2C reset if no events were recorded in previous 2.5 seconds indicating a possible I2C malfunction.
This commit is contained in:
@@ -22,8 +22,9 @@ void lcd_backlight_update(int v) {
|
||||
|
||||
val = reg_get_value(REG_ID_BKL);
|
||||
val += v;
|
||||
if(val < 0) val = 0;
|
||||
if(val > 0xff) val = 0xff;
|
||||
val = ( val / LCD_BACKLIGHT_STEP ) * LCD_BACKLIGHT_STEP;
|
||||
if(val < LCD_BACKLIGHT_STEP) val = LCD_BACKLIGHT_STEP;
|
||||
if(val > 240) val = 240;
|
||||
|
||||
analogWriteFrequency(10000);
|
||||
analogWrite(PA8, val);
|
||||
@@ -35,8 +36,9 @@ void kbd_backlight_update(int v){
|
||||
|
||||
val = reg_get_value(REG_ID_BK2);
|
||||
val += v;
|
||||
if(val < 20 ) val = 0;
|
||||
if(val > 0xff) val = 0;
|
||||
val = ( val / KBD_BACKLIGHT_STEP ) * KBD_BACKLIGHT_STEP;
|
||||
if(val < KBD_BACKLIGHT_STEP) val = 0;
|
||||
if(val > 240) val = 0;
|
||||
|
||||
analogWriteFrequency(10000);
|
||||
analogWrite(PC8, val);
|
||||
@@ -50,8 +52,8 @@ void kbd_backlight_update_offset(){
|
||||
|
||||
val = reg_get_value(REG_ID_BK2);
|
||||
val += kbd_backlight_segs[kbd_backlight_offset];
|
||||
if(val < 20 ) val = 0;
|
||||
if(val > 0xff) val = 0;
|
||||
if(val < 0x20) val = 0;
|
||||
if(val > 0xf0) val = 0;
|
||||
|
||||
analogWriteFrequency(10000);
|
||||
analogWrite(PC8, val);
|
||||
|
||||
Reference in New Issue
Block a user