|
|
@ -44,22 +44,14 @@ Model01::Model01(void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Model01::enableScannerPower(void) {
|
|
|
|
void Model01::enableScannerPower(void) {
|
|
|
|
// PC7
|
|
|
|
|
|
|
|
//pinMode(13, OUTPUT);
|
|
|
|
|
|
|
|
//digitalWrite(13, HIGH);
|
|
|
|
|
|
|
|
// Turn on power to the LED net
|
|
|
|
// Turn on power to the LED net
|
|
|
|
DDRC |= _BV(7);
|
|
|
|
DDRC |= _BV(7);
|
|
|
|
PORTC |= _BV(7);
|
|
|
|
PORTC |= _BV(7);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// This lets the keyboard pull up to 1.6 amps from
|
|
|
|
|
|
|
|
// the host. That violates the USB spec. But it sure
|
|
|
|
|
|
|
|
// is pretty looking
|
|
|
|
|
|
|
|
void Model01::enableHighPowerLeds(void) {
|
|
|
|
void Model01::enableHighPowerLeds(void) {
|
|
|
|
// PE6
|
|
|
|
// This lets the keyboard pull up to 1.6 amps from the host.
|
|
|
|
// pinMode(7, OUTPUT);
|
|
|
|
// That violates the USB spec. But it sure is pretty looking
|
|
|
|
// digitalWrite(7, LOW);
|
|
|
|
|
|
|
|
DDRE |= _BV(6);
|
|
|
|
DDRE |= _BV(6);
|
|
|
|
PORTE &= ~_BV(6);
|
|
|
|
PORTE &= ~_BV(6);
|
|
|
|
|
|
|
|
|
|
|
@ -76,9 +68,8 @@ void Model01::setup(void) {
|
|
|
|
delay(100);
|
|
|
|
delay(100);
|
|
|
|
enableScannerPower();
|
|
|
|
enableScannerPower();
|
|
|
|
|
|
|
|
|
|
|
|
// Consider not doing this until 30s after keyboard
|
|
|
|
// TODO: Consider not doing this until 30s after keyboard
|
|
|
|
// boot up, to make it easier to rescue things
|
|
|
|
// boot up, to make it easier to rescue things in case of power draw issues.
|
|
|
|
// in case of power draw issues.
|
|
|
|
|
|
|
|
enableHighPowerLeds();
|
|
|
|
enableHighPowerLeds();
|
|
|
|
leftHandState.all = 0;
|
|
|
|
leftHandState.all = 0;
|
|
|
|
rightHandState.all = 0;
|
|
|
|
rightHandState.all = 0;
|
|
|
@ -142,6 +133,12 @@ void Model01::syncLeds() {
|
|
|
|
if (!isLEDChanged)
|
|
|
|
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
|
|
|
|
|
|
|
|
// we run into a race condition with updating the next bank
|
|
|
|
|
|
|
|
// on an ATTiny before it's done writing the previous one to memory
|
|
|
|
|
|
|
|
|
|
|
|
leftHand.sendLEDData();
|
|
|
|
leftHand.sendLEDData();
|
|
|
|
rightHand.sendLEDData();
|
|
|
|
rightHand.sendLEDData();
|
|
|
|
|
|
|
|
|
|
|
|