+ init_time = timer_read();
+ state = WAIT_SETTLE;
+ break;
+ case WAIT_SETTLE:
+ // wait for keyboard to settle after plugin
+ if (timer_elapsed(init_time) > 1000) {
+ state = AT_RESET;
+ }
+ break;
+ case AT_RESET:
+ ibmpc_host_isr_clear();
+ ibmpc_host_enable();
+ wait_ms(1); // keyboard can't respond to command without this
+
+ // SKIDATA-2-DE(and some other keyboards?) stores 'Code Set' setting in nonvlatile memory
+ // and keeps it until receiving reset. Sending reset here may be useful to clear it, perhaps.
+ // https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#select-alternate-scan-codesf0
+
+ // reset command
+ if (0xFA == ibmpc_host_send(0xFF)) {
+ state = WAIT_AA;
+ } else {
+ state = XT_RESET;
+ }
+ xprintf("A%u ", timer_read());