summaryrefslogtreecommitdiff
path: root/tmk_core/common/webusb.c
blob: 5183d7754325c2e8a32dbab5a75a569e3efc5736 (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
#include "webusb.h"
#include "wait.h"

webusb_state_t webusb_state = {
  .paired = false,
  .pairing = false,
};

void webusb_set_pairing_state() {
    webusb_state.pairing = true;
    uint8_t tick = 0;
    do {
        tick++;
        wait_ms(1000);
        //TODO Blink some leds
    } while(webusb_state.paired == false && tick <= 30);
    webusb_state.pairing = false;
}

void webusb_error(uint8_t code) {
    uint8_t buffer[1];
    buffer[0] = code;
    webusb_send(buffer, 1);
}