From 3c144fac5e2b634166f6b9cc0fc45029d63d3398 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 20 Mar 2023 08:12:05 +1100 Subject: Clean up usage of `QMK_KEYBOARD_H` (#20167) --- keyboards/converter/palm_usb/matrix.c | 18 ++++---- keyboards/converter/sun_usb/command_extra.c | 64 ----------------------------- keyboards/converter/sun_usb/led.c | 3 +- keyboards/converter/sun_usb/matrix.c | 16 +++++--- keyboards/converter/xmk/xmk.c | 2 +- keyboards/converter/xmk/xmk_matrix.c | 2 + keyboards/converter/xmk/xmk_matrix.h | 3 +- 7 files changed, 27 insertions(+), 81 deletions(-) delete mode 100644 keyboards/converter/sun_usb/command_extra.c (limited to 'keyboards/converter') diff --git a/keyboards/converter/palm_usb/matrix.c b/keyboards/converter/palm_usb/matrix.c index 4226dfa52c..016b562254 100644 --- a/keyboards/converter/palm_usb/matrix.c +++ b/keyboards/converter/palm_usb/matrix.c @@ -17,7 +17,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include QMK_KEYBOARD_H +#include "matrix.h" +#include "debug.h" +#include "wait.h" #include "uart.h" #include "timer.h" @@ -134,14 +136,14 @@ uint8_t rts_reset(void) { if (firstread) { writePinLow(RTS_PIN); } - _delay_ms(10); + wait_ms(10); writePinHigh(RTS_PIN); /* the future is Arm if (!palReadPad(RTS_PIN_IOPRT)) { - _delay_ms(10); + wait_ms(10); palSetPadMode(RTS_PINn_IOPORT, PinDirectionOutput_PUSHPULL); palSetPad(RTS_PORT, RTS_PIN); } @@ -150,13 +152,13 @@ uint8_t rts_reset(void) { palSetPadMode(RTS_PIN_RTS_PORT, PinDirectionOutput_PUSHPULL); palSetPad(RTS_PORT, RTS_PIN); palClearPad(RTS_PORT, RTS_PIN); - _delay_ms(10); + wait_ms(10); palSetPad(RTS_PORT, RTS_PIN); } */ - _delay_ms(5); + wait_ms(5); //print("rts\n"); return 1; } @@ -222,7 +224,7 @@ uint8_t handspring_handshake(void) { uint8_t handspring_reset(void) { writePinLow(VCC_PIN); - _delay_ms(5); + wait_ms(5); writePinHigh(VCC_PIN); if ( handspring_handshake() ) { @@ -257,7 +259,7 @@ void matrix_init(void) last_activity = timer_read(); } else { print("failed handshake"); - _delay_ms(1000); + wait_ms(1000); //BUG /should/ power cycle or toggle RTS & reset, but this usually works. } @@ -271,7 +273,7 @@ void matrix_init(void) last_activity = timer_read(); } else { print("failed handshake"); - _delay_ms(1000); + wait_ms(1000); //BUG /should/ power cycle or toggle RTS & reset, but this usually works. } diff --git a/keyboards/converter/sun_usb/command_extra.c b/keyboards/converter/sun_usb/command_extra.c deleted file mode 100644 index b15f9dc9bd..0000000000 --- a/keyboards/converter/sun_usb/command_extra.c +++ /dev/null @@ -1,64 +0,0 @@ -#include QMK_KEYBOARD_H -#include "uart.h" - -bool sun_bell = false; -bool sun_click = false; - - -bool command_extra(uint8_t code) -{ - switch (code) { - case KC_H: - case KC_SLASH: /* ? */ - print("\n\n----- Sun converter Help -----\n"); - print("Home: Toggle Bell\n"); - print("End: Toggle Click\n"); - print("PgUp: LED all On\n"); - print("PgDown: LED all Off\n"); - print("Insert: Layout\n"); - print("Delete: Reset\n"); - return false; - case KC_DEL: - print("Reset\n"); - uart_write(0x01); - break; - case KC_HOME: - sun_bell = !sun_bell; - if (sun_bell) { - print("Bell On\n"); - uart_write(0x02); - } else { - print("Bell Off\n"); - uart_write(0x03); - } - break; - case KC_END: - sun_click = !sun_click; - if (sun_click) { - print("Click On\n"); - uart_write(0x0A); - } else { - print("Click Off\n"); - uart_write(0x0B); - } - break; - case KC_PGUP: - print("LED all on\n"); - uart_write(0x0E); - uart_write(0xFF); - break; - case KC_PGDN: - print("LED all off\n"); - uart_write(0x0E); - uart_write(0x00); - break; - case KC_INSERT: - print("layout\n"); - uart_write(0x0F); - break; - default: - xprintf("Unknown extra command: %02X\n", code); - return false; - } - return true; -} diff --git a/keyboards/converter/sun_usb/led.c b/keyboards/converter/sun_usb/led.c index f8d183fd48..493825bac8 100644 --- a/keyboards/converter/sun_usb/led.c +++ b/keyboards/converter/sun_usb/led.c @@ -15,7 +15,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include QMK_KEYBOARD_H +#include "led.h" +#include "print.h" #include "uart.h" void led_set(uint8_t usb_led) diff --git a/keyboards/converter/sun_usb/matrix.c b/keyboards/converter/sun_usb/matrix.c index 9f22eca1eb..bf1d5f807f 100644 --- a/keyboards/converter/sun_usb/matrix.c +++ b/keyboards/converter/sun_usb/matrix.c @@ -15,7 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include QMK_KEYBOARD_H +#include "matrix.h" +#include "host.h" +#include "led.h" +#include "debug.h" +#include "wait.h" #include "uart.h" /* @@ -86,9 +90,9 @@ void matrix_init(void) /* print("."); */ /* while (uart_read()); */ /* uart_write(0x01); */ - /* _delay_ms(500); */ + /* wait_ms(500); */ /* if (uart_read() == 0xFF) { */ - /* _delay_ms(500); */ + /* wait_ms(500); */ /* if (uart_read() == 0x04) */ /* break; */ /* } */ @@ -112,7 +116,7 @@ uint8_t matrix_scan(void) switch (code) { case 0xFF: // reset success: FF 04 print("reset: "); - _delay_ms(500); + wait_ms(500); code = uart_read(); xprintf("%02X\n", code); if (code == 0x04) { @@ -122,12 +126,12 @@ uint8_t matrix_scan(void) return 0; case 0xFE: // layout: FE print("layout: "); - _delay_ms(500); + wait_ms(500); xprintf("%02X\n", uart_read()); return 0; case 0x7E: // reset fail: 7E 01 print("reset fail: "); - _delay_ms(500); + wait_ms(500); xprintf("%02X\n", uart_read()); return 0; case 0x7F: diff --git a/keyboards/converter/xmk/xmk.c b/keyboards/converter/xmk/xmk.c index a0426e95dc..e0df96fc2d 100644 --- a/keyboards/converter/xmk/xmk.c +++ b/keyboards/converter/xmk/xmk.c @@ -3,7 +3,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#include QMK_KEYBOARD_H +#include "quantum.h" #if defined (XMK_DEBUG) void keyboard_post_init_kb(void) { diff --git a/keyboards/converter/xmk/xmk_matrix.c b/keyboards/converter/xmk/xmk_matrix.c index 7327ad5cfe..41eca9fe46 100644 --- a/keyboards/converter/xmk/xmk_matrix.c +++ b/keyboards/converter/xmk/xmk_matrix.c @@ -4,6 +4,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "xmk_matrix.h" +#include "matrix.h" +#include "debug.h" bool xmk_changed = false; matrix_row_t xmk_rows[MATRIX_ROWS]; diff --git a/keyboards/converter/xmk/xmk_matrix.h b/keyboards/converter/xmk/xmk_matrix.h index 45514dea04..2a988253f9 100644 --- a/keyboards/converter/xmk/xmk_matrix.h +++ b/keyboards/converter/xmk/xmk_matrix.h @@ -5,6 +5,7 @@ #pragma once -#include QMK_KEYBOARD_H +#include +#include void xmk_matrix_key(bool press, uint8_t key); -- cgit v1.2.3