2 Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 //#include <avr/interrupt.h>
27 bool keyboard_nkro = true;
30 static host_driver_t *driver;
31 static uint16_t last_system_report = 0;
32 static uint16_t last_consumer_report = 0;
35 void host_set_driver(host_driver_t *d)
40 host_driver_t *host_get_driver(void)
45 uint8_t host_keyboard_leds(void)
47 if (!driver) return 0;
48 return (*driver->keyboard_leds)();
51 void host_keyboard_send(report_keyboard_t *report)
54 (*driver->send_keyboard)(report);
58 for (uint8_t i = 0; i < KEYBOARD_REPORT_SIZE; i++) {
59 dprintf("%02X ", report->raw[i]);
65 void host_mouse_send(report_mouse_t *report)
68 (*driver->send_mouse)(report);
71 void host_system_send(uint16_t report)
73 if (report == last_system_report) return;
74 last_system_report = report;
77 (*driver->send_system)(report);
80 dprintf("system: %04X\n", report);
84 void host_consumer_send(uint16_t report)
86 if (report == last_consumer_report) return;
87 last_consumer_report = report;
90 (*driver->send_consumer)(report);
93 dprintf("consumer: %04X\n", report);
97 uint16_t host_last_system_report(void)
99 return last_system_report;
102 uint16_t host_last_consumer_report(void)
104 return last_consumer_report;