4 #include <avr/interrupt.h>
5 #include <util/delay.h>
6 #include <avr/eeprom.h>
7 #include "split_util.h"
19 volatile bool isLeftHand = true;
21 static void setup_handedness(void) {
23 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
25 // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
26 #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
27 isLeftHand = !has_usb();
29 isLeftHand = has_usb();
34 static void keyboard_master_setup(void) {
38 matrix_master_OLED_init ();
45 static void keyboard_slave_setup(void) {
48 i2c_slave_init(SLAVE_I2C_ADDRESS);
55 USBCON |= (1 << OTGPADE); //enables VBUS pad
57 return (USBSTA & (1<<VBUS)); //checks state of VBUS
60 void split_keyboard_setup(void) {
64 keyboard_master_setup();
66 keyboard_slave_setup();
71 void keyboard_slave_loop(void) {
79 // this code runs before the usb and keyboard is initialized
80 void matrix_setup(void) {
81 split_keyboard_setup();
84 keyboard_slave_loop();