diff options
Diffstat (limited to 'protocol/iwrap/main.c')
| -rw-r--r-- | protocol/iwrap/main.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/protocol/iwrap/main.c b/protocol/iwrap/main.c index ac83280f1..3abdce8df 100644 --- a/protocol/iwrap/main.c +++ b/protocol/iwrap/main.c | |||
| @@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 25 | #include "keyboard.h" | 25 | #include "keyboard.h" |
| 26 | #include "matrix.h" | 26 | #include "matrix.h" |
| 27 | #include "host.h" | 27 | #include "host.h" |
| 28 | #include "action.h" | ||
| 28 | #include "iwrap.h" | 29 | #include "iwrap.h" |
| 29 | #ifdef PROTOCOL_VUSB | 30 | #ifdef PROTOCOL_VUSB |
| 30 | # include "vusb.h" | 31 | # include "vusb.h" |
| @@ -40,7 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 40 | 41 | ||
| 41 | static void sleep(uint8_t term); | 42 | static void sleep(uint8_t term); |
| 42 | static bool console(void); | 43 | static bool console(void); |
| 43 | static uint8_t console_command(uint8_t c); | 44 | static bool console_command(uint8_t c); |
| 44 | static uint8_t key2asc(uint8_t key); | 45 | static uint8_t key2asc(uint8_t key); |
| 45 | 46 | ||
| 46 | 47 | ||
| @@ -108,10 +109,13 @@ static void init_vusb(void) | |||
| 108 | 109 | ||
| 109 | void change_driver(host_driver_t *driver) | 110 | void change_driver(host_driver_t *driver) |
| 110 | { | 111 | { |
| 112 | /* | ||
| 111 | host_clear_keyboard_report(); | 113 | host_clear_keyboard_report(); |
| 112 | host_swap_keyboard_report(); | 114 | host_swap_keyboard_report(); |
| 113 | host_clear_keyboard_report(); | 115 | host_clear_keyboard_report(); |
| 114 | host_send_keyboard_report(); | 116 | host_send_keyboard_report(); |
| 117 | */ | ||
| 118 | clear_keyboard(); | ||
| 115 | _delay_ms(1000); | 119 | _delay_ms(1000); |
| 116 | host_set_driver(driver); | 120 | host_set_driver(driver); |
| 117 | } | 121 | } |
| @@ -168,6 +172,7 @@ int main(void) | |||
| 168 | if (host_get_driver() == vusb_driver()) | 172 | if (host_get_driver() == vusb_driver()) |
| 169 | vusb_transfer_keyboard(); | 173 | vusb_transfer_keyboard(); |
| 170 | #endif | 174 | #endif |
| 175 | // TODO: depricated | ||
| 171 | if (matrix_is_modified() || console()) { | 176 | if (matrix_is_modified() || console()) { |
| 172 | last_timer = timer_read(); | 177 | last_timer = timer_read(); |
| 173 | sleeping = false; | 178 | sleeping = false; |
| @@ -176,6 +181,7 @@ int main(void) | |||
| 176 | iwrap_check_connection(); | 181 | iwrap_check_connection(); |
| 177 | } | 182 | } |
| 178 | 183 | ||
| 184 | // TODO: suspend.h | ||
| 179 | if (host_get_driver() == iwrap_driver()) { | 185 | if (host_get_driver() == iwrap_driver()) { |
| 180 | if (sleeping && !insomniac) { | 186 | if (sleeping && !insomniac) { |
| 181 | _delay_ms(1); // wait for UART to send | 187 | _delay_ms(1); // wait for UART to send |
| @@ -201,11 +207,6 @@ static void sleep(uint8_t term) | |||
| 201 | WD_SET(WD_OFF); | 207 | WD_SET(WD_OFF); |
| 202 | } | 208 | } |
| 203 | 209 | ||
| 204 | ISR(WDT_vect) | ||
| 205 | { | ||
| 206 | // wake up | ||
| 207 | } | ||
| 208 | |||
| 209 | static bool console(void) | 210 | static bool console(void) |
| 210 | { | 211 | { |
| 211 | // Send to Bluetoot module WT12 | 212 | // Send to Bluetoot module WT12 |
| @@ -244,12 +245,12 @@ static bool console(void) | |||
| 244 | } | 245 | } |
| 245 | } | 246 | } |
| 246 | 247 | ||
| 247 | uint8_t command_extra() | 248 | bool command_extra(uint8_t code) |
| 248 | { | 249 | { |
| 249 | return console_command(key2asc(host_get_first_key())); | 250 | return console_command(key2asc(code)); |
| 250 | } | 251 | } |
| 251 | 252 | ||
| 252 | static uint8_t console_command(uint8_t c) | 253 | static bool console_command(uint8_t c) |
| 253 | { | 254 | { |
| 254 | switch (c) { | 255 | switch (c) { |
| 255 | case 'h': | 256 | case 'h': |
