Compare commits
No commits in common. "572f31fef632e82df13a2f7e2d12fbdef4be6118" and "7e482594206c8db2dbce7d588bd87a5b46911efa" have entirely different histories.
572f31fef6
...
7e48259420
@ -21,18 +21,11 @@
|
||||
#define CMD_IEEREAD 8 // int. eep.
|
||||
#define CMD_SETBLOCK 9
|
||||
#define CMD_SETLED 10
|
||||
#define CMD_GETLED 11
|
||||
#define CMD_SETBRIGHTNESS 12
|
||||
#define CMD_GETBRIGHTNESS 13
|
||||
|
||||
#define IEE_ADDR_DEFAULT_BRIGHTNESS 0
|
||||
#define IEE_ADDR_DEFAULT_BLOCK 4
|
||||
|
||||
#define BLOCKCODE_RERENDER 254
|
||||
#define BLOCKCODE_RELOAD 253
|
||||
|
||||
volatile int change_block = 255;
|
||||
volatile uint8_t brightness = 1;
|
||||
|
||||
const uint8_t PROGMEM gamma8[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@ -56,7 +49,7 @@ const uint8_t PROGMEM gammaBright[] = {
|
||||
0, 1, 2, 3, 6, 10, 14,
|
||||
18, 26, 31, 38, 46, 54, 66,
|
||||
76, 89, 104, 128, 150, 180, 240,
|
||||
290, 400, 500};
|
||||
250, 280, 340};
|
||||
|
||||
struct cRGB led[LEDS_PER_SLOT];
|
||||
|
||||
@ -110,26 +103,12 @@ USB_PUBLIC uchar usbFunctionSetup(uchar data[8])
|
||||
change_block = rq->wValue.bytes[0];
|
||||
return 0;
|
||||
}
|
||||
else if (rq->bRequest == CMD_SETBRIGHTNESS) {
|
||||
brightness = rq->wValue.bytes[0];
|
||||
return 0;
|
||||
}
|
||||
else if(rq->bRequest == CMD_GETBRIGHTNESS) {
|
||||
reportBuffer[0] = brightness;
|
||||
return 1;
|
||||
}
|
||||
else if (rq->bRequest == CMD_SETLED) {
|
||||
led[rq->wValue.bytes[0]].r = rq->wValue.bytes[1];
|
||||
led[rq->wValue.bytes[0]].g = rq->wIndex.bytes[0];
|
||||
led[rq->wValue.bytes[0]].b = rq->wIndex.bytes[1];
|
||||
return 0;
|
||||
}
|
||||
else if (rq->bRequest == CMD_GETLED) {
|
||||
reportBuffer[0] = led[rq->wValue.bytes[0]].r;
|
||||
reportBuffer[1] = led[rq->wValue.bytes[0]].g;
|
||||
reportBuffer[2] = led[rq->wValue.bytes[0]].b;
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -147,6 +126,7 @@ void keyboard(void) {
|
||||
enum enum_state next_state = IDLE;
|
||||
uint8_t i;
|
||||
uint16_t factor = 1;
|
||||
uint8_t brightness = 1;
|
||||
uint8_t key = 0;
|
||||
uint16_t loadAddress;
|
||||
uint16_t loadCount;
|
||||
@ -197,12 +177,10 @@ void keyboard(void) {
|
||||
switch (state) {
|
||||
case IDLE:
|
||||
if (change_block != 255) {
|
||||
if (change_block == BLOCKCODE_RERENDER) {
|
||||
if (change_block == 254) {
|
||||
state = RENDER;
|
||||
next_state = IDLE;
|
||||
} else {
|
||||
if (change_block = BLOCKCODE_RELOAD)
|
||||
change_block = current_block;
|
||||
loadAddress_ld = (change_block) * LEDS_PER_SLOT * 3;
|
||||
state = PREP_LOAD;
|
||||
next_state = IDLE;
|
||||
@ -216,8 +194,7 @@ void keyboard(void) {
|
||||
brightness = (brightness <= 0 ? 0 : brightness - 1);
|
||||
break;
|
||||
case KEY_BRIGHTNESS_DOWN:
|
||||
brightness = (brightness >= sizeof(gammaBright) - 3 ? /* No idea why -3... */
|
||||
sizeof(gammaBright) - 3 : brightness + 1);
|
||||
brightness = (brightness >= 21 ? 21 : brightness + 1);
|
||||
break;
|
||||
case KEY_SF_1:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user