Add initial support for reading the "power fault" line

pull/365/head
Jesse Vincent 8 years ago
parent a691a949ab
commit c2a398f7ab

@ -35,10 +35,15 @@ void Model01::enable_high_power_leds(void) {
// PE6 // PE6
// pinMode(7, OUTPUT); // pinMode(7, OUTPUT);
// digitalWrite(7, LOW); // digitalWrite(7, LOW);
DDRE |= _BV(6); DDRE |= _BV(6);
PORTE &= ~_BV(6); PORTE &= ~_BV(6);
// Set B4, the overcurrent check to an input with an internal pull-up
DDRB &= ~_BV(4); // set bit, input
PORTB &= ~_BV(4); // set bit, enable pull-up resistor
} }
void Model01::setup(void) { void Model01::setup(void) {
@ -95,6 +100,14 @@ void Model01::led_sync() {
} }
boolean Model01::led_power_fault() {
if (PINB & _BV(4)) {
return true;
} else {
return false;
}
}
void debug_key_event(keydata_t state, keydata_t previousState, uint8_t keynum, uint8_t row, uint8_t col) { void debug_key_event(keydata_t state, keydata_t previousState, uint8_t keynum, uint8_t row, uint8_t col) {
if (bitRead(state.all, keynum) != bitRead(previousState.all, keynum )) { if (bitRead(state.all, keynum) != bitRead(previousState.all, keynum )) {
Serial.print("Looking at row "); Serial.print("Looking at row ");

@ -25,6 +25,8 @@ class Model01 {
void enable_scanner_power(void); void enable_scanner_power(void);
void reboot_bootloader(); void reboot_bootloader();
boolean led_power_fault(void);
uint8_t load_primary_layer(uint8_t layer_count); uint8_t load_primary_layer(uint8_t layer_count);
void save_primary_layer(uint8_t layer); void save_primary_layer(uint8_t layer);

Loading…
Cancel
Save