4 #include <avr/interrupt.h>
5 #include <util/delay.h>
6 #include <avr/eeprom.h>
7 #include "split_util.h"
12 volatile bool isLeftHand = true;
14 static void setup_handedness(void) {
16 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
18 #if defined(MASTER_RIGHT)
19 isLeftHand = !has_usb();
21 isLeftHand = has_usb();
26 static void keyboard_master_setup(void) {
30 static void keyboard_slave_setup(void) {
35 USBCON |= (1 << OTGPADE); //enables VBUS pad
37 return (USBSTA & (1<<VBUS)); //checks state of VBUS
40 void split_keyboard_setup(void) {
44 keyboard_master_setup();
46 keyboard_slave_setup();
51 // this code runs before the usb and keyboard is initialized
52 void matrix_setup(void) {
53 split_keyboard_setup();