2 * (c) 2015 flabberast <s3+flabbergast@sdfeu.org>
4 * Based on the following work:
5 * - Guillaume Duc's raw hid example (MIT License)
6 * https://github.com/guiduc/usb-hid-chibios-example
7 * - PJRC Teensy examples (MIT License)
8 * https://www.pjrc.com/teensy/usb_keyboard.html
9 * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD)
10 * https://github.com/tmk/tmk_keyboard/
11 * - ChibiOS demo code (Apache 2.0 License)
12 * http://www.chibios.org
14 * Since some GPL'd code is used, this work is licensed under
26 #include "host_driver.h"
32 #ifdef SLEEP_LED_ENABLE
33 #include "sleep_led.h"
38 /* -------------------------
39 * TMK host driver defs
40 * -------------------------
43 host_driver_t chibios_driver = {
53 * Amber LED blinker thread, times are in milliseconds.
55 // uint8_t blinkLedState = 0;
56 // static THD_WORKING_AREA(waThread1, 128);
57 // static THD_FUNCTION(Thread1, arg) {
59 // chRegSetThreadName("blinker1");
61 // if(blinkLedState) {
63 // palSetPad(GPIOC, GPIOC_LED_ORANGE);
64 // chThdSleepMilliseconds(100);
65 // palClearPad(GPIOC, GPIOC_LED_ORANGE);
67 // chThdSleepMilliseconds(100);
80 palSetPad(GPIOC, GPIOC_LED_BLUE);
81 chThdSleepMilliseconds(400);
82 palClearPad(GPIOC, GPIOC_LED_BLUE);
85 // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
88 init_usb_driver(&USB_DRIVER);
91 init_printf(NULL,sendchar_pf);
93 /* Wait until the USB is active */
94 while(USB_DRIVER.state != USB_ACTIVE)
95 chThdSleepMilliseconds(50);
97 print("USB configured.\n");
99 /* init TMK modules */
101 host_set_driver(&chibios_driver);
103 #ifdef SLEEP_LED_ENABLE
107 print("Keyboard start.\n");
111 /* TODO: check for suspended event */
114 chThdSleepMilliseconds(5);