4 #include <avr/interrupt.h>
5 #include <util/delay.h>
6 #include <avr/eeprom.h>
7 #include "split_util.h"
13 volatile bool isLeftHand = true;
15 static void setup_handedness(void) {
17 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
19 // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
20 #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
21 isLeftHand = !has_usb();
23 isLeftHand = has_usb();
28 static void keyboard_master_setup(void) {
32 static void keyboard_slave_setup(void) {
37 USBCON |= (1 << OTGPADE); //enables VBUS pad
39 return (USBSTA & (1<<VBUS)); //checks state of VBUS
42 void split_keyboard_setup(void) {
46 keyboard_master_setup();
48 keyboard_slave_setup();
53 // this code runs before the usb and keyboard is initialized
54 void matrix_setup(void) {
55 split_keyboard_setup();