summaryrefslogtreecommitdiff
path: root/keyboards/splitty/split_util.c
blob: 5d81a7a1605b905a14f644d4f3035ff1c4556572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>
#include "split_util.h"
#include "matrix.h"
#include "keyboard.h"
#include "config.h"
#include "timer.h"


volatile bool isLeftHand = true;
volatile bool contacted_by_master = false;

static void setup_handedness(void) {
  #ifdef EE_HANDS
    isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
  #else
    #error "Only EE_HANDS supported"
  #endif
}

void split_keyboard_setup(void) {
    timer_init();
    setup_handedness();
}

// this code runs before the usb and keyboard is initialized
void matrix_setup(void) {
    split_keyboard_setup();
}