diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp index fdc827f9..fd6f07cb 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp @@ -22,6 +22,8 @@ #include "kaleidoscope/key_events.h" #include "kaleidoscope/driver/keyscanner/Base_Impl.h" +#include "Wire.h" + #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD @@ -51,6 +53,13 @@ void Model100Hands::setup(void) { // TODO DDRE |= _BV(6); // TODO PORTE &= ~_BV(6); + +// Turn on the switched 5V network. +// TODO - make sure this happens at least 100ms after USB connect +// to satisfy inrush limits +pinMode(PC13, OUTPUT_OPEN_DRAIN); +digitalWrite(PC13, LOW); +Wire.begin(); // Set B4, the overcurrent check to an input with an internal pull-up // TODO DDRB &= ~_BV(4); // set bit, input // TODO PORTB &= ~_BV(4); // set bit, enable pull-up resistor @@ -100,8 +109,7 @@ cRGB Model100LEDDriver::getCrgbAt(uint8_t i) { void Model100LEDDriver::syncLeds() { if (!isLEDChanged) - return; - + return; // LED Data is stored in four "banks" for each side // We send it all at once to make it look nicer. // We alternate left and right hands because otherwise diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp index ee9019aa..1ae8a999 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp @@ -169,7 +169,6 @@ void Model100Side::sendLEDData() { } } -auto constexpr gamma8 = kaleidoscope::driver::color::gamma_correction; void Model100Side::sendLEDBank(byte bank) { uint8_t data[LED_BYTES_PER_BANK + 1]; @@ -181,20 +180,20 @@ void Model100Side::sendLEDBank(byte bank) { * that results in a considerably smoother curve. */ uint8_t c = ledData.bytes[bank][i]; if (c > brightness_adjustment_) - c -= brightness_adjustment_; + c -= brightness_adjustment_; else - c = 0; + c = 0; - data[i + 1] = pgm_read_byte(&gamma8[c]); + data[i + 1] = c; } uint8_t result = writeData(data, ELEMENTS(data)); } void Model100Side::setAllLEDsTo(cRGB color) { uint8_t data[] = {TWI_CMD_LED_SET_ALL_TO, - pgm_read_byte(&gamma8[color.b]), - pgm_read_byte(&gamma8[color.g]), - pgm_read_byte(&gamma8[color.r]) + color.b, + color.g, + color.r }; uint8_t result = writeData(data, ELEMENTS(data)); } @@ -202,9 +201,9 @@ void Model100Side::setAllLEDsTo(cRGB color) { void Model100Side::setOneLEDTo(byte led, cRGB color) { uint8_t data[] = {TWI_CMD_LED_SET_ONE_TO, led, - pgm_read_byte(&gamma8[color.b]), - pgm_read_byte(&gamma8[color.g]), - pgm_read_byte(&gamma8[color.r]) + color.b, + color.g, + color.r }; uint8_t result = writeData(data, ELEMENTS(data));