pull/18/head
Jesse Vincent 9 years ago
parent 04ec58cced
commit fbb5e1e163

@ -11,7 +11,8 @@
#define ROWS 5
#define COLS 14
static const byte colPins[COLS] = {
A0, 3,13, 5, 10, 9, 8, 6, 12, 4, 11, 1, 0, 2 };
A0, 3,13, 5, 10, 9, 8, 6, 12, 4, 11, 1, 0, 2
};
static const byte rowPins[ROWS] = { A5,A4,A3,A2,A1};
#define LED_DATA_PIN 7

@ -33,8 +33,7 @@ int left_initted = 0;
#define TS(X) //Serial.print(micros() );Serial.print("\t");Serial.println(X);
void setup_matrix()
{
void setup_matrix() {
reset_key_report();
//blank out the matrix.
for (byte col = 0; col < COLS; col++) {
@ -80,8 +79,7 @@ void set_keymap(Key keymapEntry, byte matrixStateEntry) {
}
}
void scan_matrix()
{
void scan_matrix() {
x = 0;
y = 0;
//scan the Keyboard matrix looking for connections
@ -263,8 +261,7 @@ void process_command_buffer() {
}
void setup()
{
void setup() {
wdt_disable();
Serial.begin(115200);
//usbMaxPower = 100;
@ -282,8 +279,7 @@ setup_command_mode();
String myApp;
void loop()
{
void loop() {
// if(Serial.available()) {
// myApp = Serial.readString();
// myApp.trim();
@ -299,13 +295,11 @@ void loop()
void save_primary_keymap(byte keymap)
{
void save_primary_keymap(byte keymap) {
EEPROM.write(EEPROM_KEYMAP_LOCATION, keymap);
}
byte load_primary_keymap()
{
byte load_primary_keymap() {
byte keymap = EEPROM.read(EEPROM_KEYMAP_LOCATION);
if (keymap >= KEYMAPS ) {
return 0; // undefined positions get saved as 255
@ -319,8 +313,7 @@ return 0; // return keymap;
// Debugging Reporting
//
void report_matrix()
{
void report_matrix() {
#ifdef DEBUG_SERIAL
if (reporting_counter++ % 100 == 0 ) {
for (byte row = 0; row < ROWS; row++) {
@ -336,8 +329,7 @@ void report_matrix()
#endif
}
void report(byte row, byte col, boolean value)
{
void report(byte row, byte col, boolean value) {
#ifdef DEBUG_SERIAL
Serial.print("Detected a change on ");
Serial.print(col);
@ -353,8 +345,7 @@ void report(byte row, byte col, boolean value)
// Key Reports
//
void release_keys_not_being_pressed()
{
void release_keys_not_being_pressed() {
// we use charsReportedLastTime to figure out what we might
// not be holding anymore and can now release. this is
// destructive to charsReportedLastTime
@ -380,8 +371,7 @@ void release_keys_not_being_pressed()
}
}
void record_key_being_pressed(byte character)
{
void record_key_being_pressed(byte character) {
for (byte i = 0; i < KEYS_HELD_BUFFER; i++) {
// todo - deal with overflowing the 12 key buffer here
if (charsBeingReported[i] == 0x00) {
@ -391,8 +381,7 @@ void record_key_being_pressed(byte character)
}
}
void reset_key_report()
{
void reset_key_report() {
memcpy( charsReportedLastTime, charsBeingReported, KEYS_HELD_BUFFER);
memset(charsBeingReported, 0, KEYS_HELD_BUFFER);
@ -414,13 +403,11 @@ void handle_synthetic_key_press(byte switchState, Key mappedKey) {
next_led_mode();
}
}
}
else if (mappedKey.flags & IS_SYSCTL) {
} else if (mappedKey.flags & IS_SYSCTL) {
if (key_toggled_on (switchState)) {
SystemControl.press(mappedKey.rawKey);
}
}
else if (mappedKey.flags & IS_MACRO) {
} else if (mappedKey.flags & IS_MACRO) {
if (key_toggled_on (switchState)) {
if (mappedKey.rawKey == 1) {
Serial.print("Keyboard.IO keyboard driver v0.00");
@ -439,8 +426,7 @@ void handle_synthetic_key_press(byte switchState, Key mappedKey) {
}
}
void send_key_event(byte row, byte col)
{
void send_key_event(byte row, byte col) {
//for every newly pressed button, figure out what logical key it is and send a key down event
// for every newly released button, figure out what logical key it is and send a key up event
@ -465,8 +451,7 @@ void send_key_event(byte row, byte col)
} else if (mappedKey.flags & SYNTHETIC_KEY) {
handle_synthetic_key_press(switchState, mappedKey);
}
else {
} else {
if (key_is_pressed(switchState)) {
record_key_being_pressed(mappedKey.rawKey);
if (key_toggled_on (switchState)) {

@ -4,8 +4,7 @@
// switch debouncing and status
boolean key_was_pressed (byte keyState)
{
boolean key_was_pressed (byte keyState) {
return (! key_was_not_pressed(keyState));
@ -13,8 +12,7 @@ boolean key_was_pressed (byte keyState)
}
boolean key_was_not_pressed (byte keyState)
{
boolean key_was_not_pressed (byte keyState) {
if ( keyState & B00001000 || keyState & B00000100) {
return false;
} else {
@ -28,8 +26,7 @@ boolean key_was_not_pressed (byte keyState)
}
boolean key_is_pressed (byte keyState)
{
boolean key_is_pressed (byte keyState) {
if ( keyState & B00000001 && keyState & B00000010 ) {
@ -38,13 +35,11 @@ boolean key_is_pressed (byte keyState)
return false;
}
}
boolean key_is_not_pressed (byte keyState)
{
boolean key_is_not_pressed (byte keyState) {
return !key_is_pressed(keyState);
}
boolean key_toggled_on(byte keyState)
{
boolean key_toggled_on(byte keyState) {
if (key_is_pressed(keyState) && key_was_not_pressed(keyState)) {
return true;
} else {
@ -53,8 +48,7 @@ boolean key_toggled_on(byte keyState)
}
boolean key_toggled_off(byte keyState)
{
boolean key_toggled_off(byte keyState) {
if (key_was_pressed(keyState) && key_is_not_pressed(keyState)) {
return true;
} else {

@ -225,7 +225,9 @@ void led_effect_rainbow_update() {
if (rainbow_current_ticks++ < rainbow_ticks) {
return;
} else { rainbow_current_ticks = 0; }
} else {
rainbow_current_ticks = 0;
}
rainbow.SetHSV(rainbow_hue, rainbow_saturation, rainbow_value);
@ -246,7 +248,9 @@ void led_effect_rainbow_wave_update() {
if (rainbow_current_ticks++ < rainbow_wave_ticks) {
return;
} else { rainbow_current_ticks = 0; }
} else {
rainbow_current_ticks = 0;
}
for (int i = 0; i < LED_COUNT; i++) {

@ -16,8 +16,7 @@
#define LED_COUNT 64
static const int key_led_map[4][16] =
{
static const int key_led_map[4][16] = {
{3,4,11,12,19,20,26,27, 36,37,43,44,51,52,59,60},
{2,5,10,13,18,21,31,28, 35,32,42,45,50,53,58,61},
{1,6,9,14, 17,22,25,29, 34,38,41,46,49,54,57,62},

@ -96,8 +96,7 @@ void warp_mouse(Key ninth) {
#define ACCELERATION_CLIMB_SPEED 0.05
double mouse_accel (double cycles)
{
double mouse_accel (double cycles) {
double accel = (atan((cycles * ACCELERATION_CLIMB_SPEED)-ACCELERATION_RUNWAY) + ATAN_LIMIT) * ACCELERATION_MULTIPLIER;
if (accel < ACCELERATION_FLOOR) {
accel = ACCELERATION_FLOOR;
@ -105,8 +104,7 @@ double mouse_accel (double cycles)
return accel;
}
void handle_mouse_movement( char x, char y)
{
void handle_mouse_movement( char x, char y) {
if (x != 0 || y != 0) {
mouseActiveForCycles++;

Loading…
Cancel
Save