Added a customizable startup config
This commit is contained in:
parent
b3f561d3d3
commit
7052f556b6
@ -22,6 +22,9 @@
|
|||||||
#define CMD_SETBLOCK 9
|
#define CMD_SETBLOCK 9
|
||||||
#define CMD_SETLED 10
|
#define CMD_SETLED 10
|
||||||
|
|
||||||
|
#define IEE_ADDR_DEFAULT_BRIGHTNESS 0
|
||||||
|
#define IEE_ADDR_DEFAULT_BLOCK 4
|
||||||
|
|
||||||
volatile int change_block = 255;
|
volatile int change_block = 255;
|
||||||
|
|
||||||
const uint8_t PROGMEM gamma8[] = {
|
const uint8_t PROGMEM gamma8[] = {
|
||||||
@ -113,7 +116,7 @@ enum enum_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void keyboard(void) {
|
void keyboard(void) {
|
||||||
enum enum_state state = PREP_LOAD;
|
enum enum_state state = IDLE;
|
||||||
enum enum_state next_state = IDLE;
|
enum enum_state next_state = IDLE;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
uint8_t factor = 1;
|
uint8_t factor = 1;
|
||||||
@ -122,6 +125,7 @@ void keyboard(void) {
|
|||||||
uint16_t loadCount;
|
uint16_t loadCount;
|
||||||
uint8_t sleepcnt = 0;
|
uint8_t sleepcnt = 0;
|
||||||
uint16_t loadAddress_ld = 0;
|
uint16_t loadAddress_ld = 0;
|
||||||
|
int current_block = 0;
|
||||||
|
|
||||||
LED_PORT |= (1 << LED_RED);
|
LED_PORT |= (1 << LED_RED);
|
||||||
LED_PORT |= (1 << LED_GREEN);
|
LED_PORT |= (1 << LED_GREEN);
|
||||||
@ -145,7 +149,8 @@ void keyboard(void) {
|
|||||||
LED_PORT &= ~(1 << LED_RED);
|
LED_PORT &= ~(1 << LED_RED);
|
||||||
LED_PORT |= (1 << LED_GREEN);
|
LED_PORT |= (1 << LED_GREEN);
|
||||||
|
|
||||||
led[1].g = 66;
|
factor = eeprom_read_byte(IEE_ADDR_DEFAULT_BRIGHTNESS);
|
||||||
|
change_block = eeprom_read_byte(IEE_ADDR_DEFAULT_BLOCK);
|
||||||
|
|
||||||
for (;;) { /* main event loop */
|
for (;;) { /* main event loop */
|
||||||
wdt_reset();
|
wdt_reset();
|
||||||
@ -172,6 +177,7 @@ void keyboard(void) {
|
|||||||
loadAddress_ld = (change_block) * LEDS_PER_SLOT * 3;
|
loadAddress_ld = (change_block) * LEDS_PER_SLOT * 3;
|
||||||
state = PREP_LOAD;
|
state = PREP_LOAD;
|
||||||
next_state = IDLE;
|
next_state = IDLE;
|
||||||
|
current_block = change_block;
|
||||||
}
|
}
|
||||||
change_block = 255;
|
change_block = 255;
|
||||||
} else if (key) {
|
} else if (key) {
|
||||||
@ -185,7 +191,9 @@ void keyboard(void) {
|
|||||||
break;
|
break;
|
||||||
case KEY_SF_1:
|
case KEY_SF_1:
|
||||||
break;
|
break;
|
||||||
case KEY_SF_2:
|
case KEY_SF_2: /* Save current as default */
|
||||||
|
eeprom_write_byte(IEE_ADDR_DEFAULT_BRIGHTNESS, factor);
|
||||||
|
eeprom_write_byte(IEE_ADDR_DEFAULT_BLOCK, current_block);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -195,6 +203,7 @@ void keyboard(void) {
|
|||||||
} else { /* Program key */
|
} else { /* Program key */
|
||||||
loadAddress_ld = (key - 1) * LEDS_PER_SLOT * 3;
|
loadAddress_ld = (key - 1) * LEDS_PER_SLOT * 3;
|
||||||
state = PREP_LOAD;
|
state = PREP_LOAD;
|
||||||
|
current_block = (key - 1);
|
||||||
}
|
}
|
||||||
sleepcnt = 50;
|
sleepcnt = 50;
|
||||||
next_state = SLEEP;
|
next_state = SLEEP;
|
||||||
|
Loading…
Reference in New Issue
Block a user