4 #include <avr/interrupt.h>
5 #include <util/delay.h>
6 #include <avr/eeprom.h>
7 #include "split_util.h"
18 volatile bool isLeftHand = true;
20 static void setup_handedness(void) {
22 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
24 #ifdef I2C_MASTER_RIGHT
25 isLeftHand = !has_usb();
27 isLeftHand = has_usb();
32 static void keyboard_master_setup(void) {
40 static void keyboard_slave_setup(void) {
42 i2c_slave_init(SLAVE_I2C_ADDRESS);
49 USBCON |= (1 << OTGPADE); //enables VBUS pad
51 return (USBSTA & (1<<VBUS)); //checks state of VBUS
54 void split_keyboard_setup(void) {
58 keyboard_master_setup();
60 keyboard_slave_setup();
65 void keyboard_slave_loop(void) {
73 // this code runs before the usb and keyboard is initialized
74 void matrix_setup(void) {
75 split_keyboard_setup();
78 keyboard_slave_loop();