From c12268807d8622a05dc445e6101a575eae16860d Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 15 Dec 2021 22:00:39 +1100 Subject: Migrate serial_uart usages to UART driver (#15479) * Migrate Thermal Printer feature to UART driver * Migrate 40percentclub UT47 to UART driver * Migrate Centromere to UART driver * Migrate Chimera Ergo to UART driver * Migrate Chimera Let's Split to UART driver * Migrate Chimera Ortho to UART driver * Migrate Chimera Ortho Plus to UART driver * Migrate Comet46 to UART driver * Migrate Palm USB converter to UART driver * Migrate Sun USB converter to UART driver * Migrate Dichotomy to UART driver * Migrate Honeycomb to UART driver * Migrate Mitosis to UART driver * Migrate Redox W to UART driver * Migrate Uni660 to UART driver * Migrate Telophase to UART driver --- common_features.mk | 2 +- .../40percentclub/ut47/keymaps/default/keymap.c | 6 +-- .../40percentclub/ut47/keymaps/non-us/keymap.c | 6 +-- .../40percentclub/ut47/keymaps/nordic/keymap.c | 6 +-- keyboards/40percentclub/ut47/keymaps/rgb/keymap.c | 6 +-- keyboards/40percentclub/ut47/matrix.c | 8 ---- keyboards/40percentclub/ut47/rules.mk | 3 +- keyboards/40percentclub/ut47/ut47.c | 8 +++- keyboards/centromere/config.h | 9 ---- keyboards/centromere/matrix.c | 10 ++-- keyboards/centromere/rules.mk | 3 +- keyboards/chimera_ergo/config.h | 9 ---- keyboards/chimera_ergo/matrix.c | 10 ++-- keyboards/chimera_ergo/rules.mk | 3 +- keyboards/chimera_ls/config.h | 9 ---- keyboards/chimera_ls/matrix.c | 10 ++-- keyboards/chimera_ls/rules.mk | 3 +- keyboards/chimera_ortho/config.h | 9 ---- keyboards/chimera_ortho/matrix.c | 10 ++-- keyboards/chimera_ortho/rules.mk | 3 +- keyboards/chimera_ortho_plus/config.h | 9 ---- keyboards/chimera_ortho_plus/matrix.c | 10 ++-- keyboards/chimera_ortho_plus/rules.mk | 3 +- keyboards/comet46/config.h | 9 ---- keyboards/comet46/matrix.c | 10 ++-- keyboards/comet46/rules.mk | 4 +- keyboards/converter/palm_usb/config.h | 55 ---------------------- keyboards/converter/palm_usb/matrix.c | 8 ++-- keyboards/converter/palm_usb/post_rules.mk | 7 --- keyboards/converter/palm_usb/rules.mk | 1 + keyboards/converter/sun_usb/command_extra.c | 22 ++++----- keyboards/converter/sun_usb/config.h | 47 ------------------ keyboards/converter/sun_usb/led.c | 6 +-- keyboards/converter/sun_usb/matrix.c | 20 ++++---- keyboards/converter/sun_usb/post_rules.mk | 6 --- keyboards/converter/sun_usb/rules.mk | 1 + keyboards/dichotomy/config.h | 9 ---- keyboards/dichotomy/dichotomy.c | 8 ++-- keyboards/dichotomy/matrix.c | 10 ++-- keyboards/dichotomy/rules.mk | 3 +- keyboards/honeycomb/config.h | 9 ---- keyboards/honeycomb/honeycomb.c | 6 +-- keyboards/honeycomb/matrix.c | 10 ++-- keyboards/honeycomb/rules.mk | 3 +- keyboards/mitosis/config.h | 9 ---- keyboards/mitosis/matrix.c | 10 ++-- keyboards/mitosis/rules.mk | 3 +- keyboards/planck/keymaps/thermal_printer/config.h | 12 +---- keyboards/redox_w/config.h | 9 ---- keyboards/redox_w/matrix.c | 10 ++-- keyboards/redox_w/rules.mk | 3 +- keyboards/sirius/uni660/rev1/config.h | 9 ---- keyboards/sirius/uni660/rev1/matrix.c | 10 ++-- keyboards/sirius/uni660/rev1/rules.mk | 3 +- keyboards/sirius/uni660/rev2/ansi/config.h | 9 ---- keyboards/sirius/uni660/rev2/iso/config.h | 9 ---- keyboards/sirius/uni660/rev2/matrix.c | 10 ++-- keyboards/sirius/uni660/rev2/rules.mk | 3 +- keyboards/telophase/config.h | 9 ---- keyboards/telophase/matrix.c | 10 ++-- keyboards/telophase/rules.mk | 3 +- quantum/process_keycode/process_printer.c | 5 +- quantum/process_keycode/process_printer.h | 2 - 63 files changed, 154 insertions(+), 393 deletions(-) delete mode 100644 keyboards/converter/palm_usb/post_rules.mk delete mode 100644 keyboards/converter/sun_usb/post_rules.mk diff --git a/common_features.mk b/common_features.mk index 56a9a286ea..fed005ff5a 100644 --- a/common_features.mk +++ b/common_features.mk @@ -356,7 +356,7 @@ endif ifeq ($(strip $(PRINTING_ENABLE)), yes) OPT_DEFS += -DPRINTING_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c - SRC += $(TMK_DIR)/protocol/serial_uart.c + QUANTUM_LIB_SRC += uart.c endif VARIABLE_TRACE ?= no diff --git a/keyboards/40percentclub/ut47/keymaps/default/keymap.c b/keyboards/40percentclub/ut47/keymaps/default/keymap.c index 0fa7838dfd..4eb2c190c1 100644 --- a/keyboards/40percentclub/ut47/keymaps/default/keymap.c +++ b/keyboards/40percentclub/ut47/keymaps/default/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H #ifdef LED_ENABLE - #include "protocol/serial.h" + #include "uart.h" #endif #define LT3_TAB LT(3, KC_TAB) @@ -108,11 +108,11 @@ LAYOUT( /* Tab */ //LED keymap functions #ifdef LED_ENABLE void led_chmode(void) { - serial_send(101); + uart_write(0x65); } void led_toggle(void) { - serial_send(100); + uart_write(0x64); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/40percentclub/ut47/keymaps/non-us/keymap.c b/keyboards/40percentclub/ut47/keymaps/non-us/keymap.c index 0c1c2e7599..8a0ba7b391 100644 --- a/keyboards/40percentclub/ut47/keymaps/non-us/keymap.c +++ b/keyboards/40percentclub/ut47/keymaps/non-us/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H #ifdef LED_ENABLE - #include "protocol/serial.h" + #include "uart.h" #endif #define LT3_TAB LT(3, KC_TAB) @@ -108,11 +108,11 @@ LAYOUT( /* Tab */ //LED keymap functions #ifdef LED_ENABLE void led_chmode(void) { - serial_send(101); + uart_write(0x65); } void led_toggle(void) { - serial_send(100); + uart_write(0x64); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/40percentclub/ut47/keymaps/nordic/keymap.c b/keyboards/40percentclub/ut47/keymaps/nordic/keymap.c index 52372e2857..5e79cdb9a4 100644 --- a/keyboards/40percentclub/ut47/keymaps/nordic/keymap.c +++ b/keyboards/40percentclub/ut47/keymaps/nordic/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H #ifdef LED_ENABLE - #include "protocol/serial.h" + #include "uart.h" #endif @@ -151,11 +151,11 @@ LAYOUT( /* GAMING, toggled on and off - L5 */ //LED keymap functions #ifdef LED_ENABLE void led_chmode(void) { - serial_send(101); + uart_write(0x65); } void led_toggle(void) { - serial_send(100); + uart_write(0x64); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c index ae8ad3e378..75dba3a2d4 100644 --- a/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c +++ b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H #ifdef LED_ENABLE - #include "protocol/serial.h" + #include "uart.h" #endif #define LT3_TAB LT(3, KC_TAB) @@ -60,11 +60,11 @@ LAYOUT( /* Tab */ //LED keymap functions #ifdef LED_ENABLE void led_chmode(void) { - serial_send(101); + uart_write(0x65); } void led_toggle(void) { - serial_send(100); + uart_write(0x64); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/40percentclub/ut47/matrix.c b/keyboards/40percentclub/ut47/matrix.c index c1284535bc..89537592c5 100644 --- a/keyboards/40percentclub/ut47/matrix.c +++ b/keyboards/40percentclub/ut47/matrix.c @@ -26,10 +26,6 @@ along with this program. If not, see . #include "debug.h" #include "util.h" #include "matrix.h" -#ifdef LED_ENABLE - #include "protocol/serial.h" -#endif - #ifndef DEBOUNCE # define DEBOUNCE 5 @@ -69,10 +65,6 @@ void matrix_init(void) matrix[i] = 0; matrix_debouncing[i] = 0; } - -#ifdef LED_ENABLE - serial_init(); -#endif } uint8_t matrix_scan(void) diff --git a/keyboards/40percentclub/ut47/rules.mk b/keyboards/40percentclub/ut47/rules.mk index 29cee474ff..6c9805e0fc 100644 --- a/keyboards/40percentclub/ut47/rules.mk +++ b/keyboards/40percentclub/ut47/rules.mk @@ -18,4 +18,5 @@ AUDIO_ENABLE = no # Audio output # custom matrix setup CUSTOM_MATRIX = yes -SRC += matrix.c protocol/serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/40percentclub/ut47/ut47.c b/keyboards/40percentclub/ut47/ut47.c index 9054335e5a..c01562cb68 100644 --- a/keyboards/40percentclub/ut47/ut47.c +++ b/keyboards/40percentclub/ut47/ut47.c @@ -15,15 +15,19 @@ */ #include "ut47.h" #ifdef LED_ENABLE - #include "protocol/serial.h" + #include "uart.h" #endif +void matrix_init_kb() { + uart_init(9600); +} + bool process_record_kb(uint16_t keycode, keyrecord_t *record) { // put your per-action keyboard code here // runs for every action, just before processing by the firmware if (record->event.pressed) { #ifdef LED_ENABLE - serial_send((record->event.key.row*16)+record->event.key.col); + uart_write((record->event.key.row*16)+record->event.key.col); #endif } return process_record_user(keycode, record); diff --git a/keyboards/centromere/config.h b/keyboards/centromere/config.h index e502e2534b..b4cae20332 100644 --- a/keyboards/centromere/config.h +++ b/keyboards/centromere/config.h @@ -56,12 +56,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 500000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/centromere/matrix.c b/keyboards/centromere/matrix.c index 7256cd5cb5..a46701275a 100644 --- a/keyboards/centromere/matrix.c +++ b/keyboards/centromere/matrix.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -80,7 +80,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(500000); } uint8_t matrix_scan(void) @@ -88,7 +88,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF remote slave to send the matrix information - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates, erase the last set of data uint8_t uart_data[11] = {0}; @@ -96,13 +96,13 @@ uint8_t matrix_scan(void) //there are 10 bytes corresponding to 1w columns, and an end byte for (uint8_t i = 0; i < 11; i++) { //wait for the serial data, timeout if it's been too long - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/centromere/rules.mk b/keyboards/centromere/rules.mk index ed777e1b9e..15c6a20746 100644 --- a/keyboards/centromere/rules.mk +++ b/keyboards/centromere/rules.mk @@ -21,6 +21,7 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality UNICODE_ENABLE = yes # Unicode # # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c LAYOUTS = split_3x5_3 split_3x6_3 diff --git a/keyboards/chimera_ergo/config.h b/keyboards/chimera_ergo/config.h index 0767a218b5..3c0cc5c162 100644 --- a/keyboards/chimera_ergo/config.h +++ b/keyboards/chimera_ergo/config.h @@ -56,12 +56,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/chimera_ergo/matrix.c b/keyboards/chimera_ergo/matrix.c index 577176c466..ec438beb56 100644 --- a/keyboards/chimera_ergo/matrix.c +++ b/keyboards/chimera_ergo/matrix.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -89,7 +89,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -97,7 +97,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[14] = {0}; @@ -107,13 +107,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/chimera_ergo/rules.mk b/keyboards/chimera_ergo/rules.mk index a8bd3a027a..483485cb7d 100644 --- a/keyboards/chimera_ergo/rules.mk +++ b/keyboards/chimera_ergo/rules.mk @@ -17,4 +17,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/chimera_ls/config.h b/keyboards/chimera_ls/config.h index 2eb028471d..ca92e1e2e4 100644 --- a/keyboards/chimera_ls/config.h +++ b/keyboards/chimera_ls/config.h @@ -56,12 +56,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/chimera_ls/matrix.c b/keyboards/chimera_ls/matrix.c index 9edd91818f..354346ca09 100644 --- a/keyboards/chimera_ls/matrix.c +++ b/keyboards/chimera_ls/matrix.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -93,7 +93,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -101,7 +101,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; @@ -111,13 +111,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/chimera_ls/rules.mk b/keyboards/chimera_ls/rules.mk index 377c379911..ae0cc8b749 100644 --- a/keyboards/chimera_ls/rules.mk +++ b/keyboards/chimera_ls/rules.mk @@ -17,7 +17,8 @@ NKRO_ENABLE = yes # Enable N-Key Rollover # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c LAYOUTS = ortho_4x12 diff --git a/keyboards/chimera_ortho/config.h b/keyboards/chimera_ortho/config.h index 974502525c..3d86343a67 100644 --- a/keyboards/chimera_ortho/config.h +++ b/keyboards/chimera_ortho/config.h @@ -56,12 +56,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/chimera_ortho/matrix.c b/keyboards/chimera_ortho/matrix.c index 34930af7e2..1403f410c0 100644 --- a/keyboards/chimera_ortho/matrix.c +++ b/keyboards/chimera_ortho/matrix.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -79,7 +79,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -87,7 +87,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; @@ -97,13 +97,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/chimera_ortho/rules.mk b/keyboards/chimera_ortho/rules.mk index fbe6872001..c35dc9ba2e 100644 --- a/keyboards/chimera_ortho/rules.mk +++ b/keyboards/chimera_ortho/rules.mk @@ -17,4 +17,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/chimera_ortho_plus/config.h b/keyboards/chimera_ortho_plus/config.h index 4b12796e95..ebffb85657 100644 --- a/keyboards/chimera_ortho_plus/config.h +++ b/keyboards/chimera_ortho_plus/config.h @@ -56,12 +56,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/chimera_ortho_plus/matrix.c b/keyboards/chimera_ortho_plus/matrix.c index 818e05ac98..51898e35d1 100644 --- a/keyboards/chimera_ortho_plus/matrix.c +++ b/keyboards/chimera_ortho_plus/matrix.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -79,7 +79,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -87,7 +87,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[14] = {0}; @@ -97,13 +97,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/chimera_ortho_plus/rules.mk b/keyboards/chimera_ortho_plus/rules.mk index e99e79c327..cd98979306 100644 --- a/keyboards/chimera_ortho_plus/rules.mk +++ b/keyboards/chimera_ortho_plus/rules.mk @@ -20,4 +20,5 @@ UNICODE_ENABLE = yes CUSTOM_MATRIX = yes # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/comet46/config.h b/keyboards/comet46/config.h index 067dabb103..5ea40c14c5 100644 --- a/keyboards/comet46/config.h +++ b/keyboards/comet46/config.h @@ -62,12 +62,3 @@ along with this program. If not, see . #define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL)) #define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/comet46/matrix.c b/keyboards/comet46/matrix.c index 34930af7e2..1403f410c0 100644 --- a/keyboards/comet46/matrix.c +++ b/keyboards/comet46/matrix.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -79,7 +79,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -87,7 +87,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; @@ -97,13 +97,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/comet46/rules.mk b/keyboards/comet46/rules.mk index 814622226a..10d828cc7f 100644 --- a/keyboards/comet46/rules.mk +++ b/keyboards/comet46/rules.mk @@ -19,5 +19,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover # project specific files SRC += matrix.c \ i2c.c \ - ssd1306.c \ - serial_uart.c + ssd1306.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/converter/palm_usb/config.h b/keyboards/converter/palm_usb/config.h index 4afc654e85..35032835cd 100644 --- a/keyboards/converter/palm_usb/config.h +++ b/keyboards/converter/palm_usb/config.h @@ -60,58 +60,3 @@ along with this program. If not, see . get_mods() == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \ get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ ) - - -/* Serial(USART) configuration - * asynchronous, negative logic, 9600baud, no flow control - * 1-start bit, 8-data bit, non parity, 1-stop bit - */ -#define SERIAL_SOFT_BAUD 9600 -#define SERIAL_SOFT_PARITY_NONE -#define SERIAL_SOFT_BIT_ORDER_LSB -#if (HANDSPRING == 0) - #define SERIAL_SOFT_LOGIC_NEGATIVE //RS232 logic -#endif -/* RXD Port */ -#define SERIAL_SOFT_RXD_ENABLE - -// we are using Pro micro pin 3 / D0 as serial -#define SERIAL_SOFT_RXD_DDR DDRD -#define SERIAL_SOFT_RXD_PORT PORTD -#define SERIAL_SOFT_RXD_PIN PIND -#define SERIAL_SOFT_RXD_BIT 0 -#define SERIAL_SOFT_RXD_VECT INT0_vect - -/* RXD Interupt */ -#define SERIAL_SOFT_RXD_INIT() do { \ - /* pin configuration: input with pull-up */ \ - SERIAL_SOFT_RXD_DDR &= ~(1<. */ #include QMK_KEYBOARD_H -#include "protocol/serial.h" +#include "uart.h" #include "timer.h" @@ -164,7 +164,7 @@ uint8_t rts_reset(void) { uint8_t get_serial_byte(void) { static uint8_t code; while(1) { - code = serial_recv(); + code = uart_read(); if (code) { debug_hex(code); debug(" "); return code; @@ -240,7 +240,7 @@ void matrix_init(void) debug_enable = true; //debug_matrix =true; - serial_init(); // arguments all #defined + uart_init(9600); // arguments all #defined #if (HANDSPRING == 0) pins_init(); // set all inputs and outputs. @@ -290,7 +290,7 @@ void matrix_init(void) uint8_t matrix_scan(void) { uint8_t code; - code = serial_recv(); + code = uart_read(); if (!code) { /* disconnect_counter ++; diff --git a/keyboards/converter/palm_usb/post_rules.mk b/keyboards/converter/palm_usb/post_rules.mk deleted file mode 100644 index 9c11076701..0000000000 --- a/keyboards/converter/palm_usb/post_rules.mk +++ /dev/null @@ -1,7 +0,0 @@ -ifdef HARDWARE_SERIAL - # Untested with palm_usb - SRC += protocol/serial_uart.c - OPT_DEFS += -DHARDWARE_SERIAL -else - SRC += protocol/serial_soft.c -endif diff --git a/keyboards/converter/palm_usb/rules.mk b/keyboards/converter/palm_usb/rules.mk index c5e680b883..a1d2e39b23 100644 --- a/keyboards/converter/palm_usb/rules.mk +++ b/keyboards/converter/palm_usb/rules.mk @@ -20,5 +20,6 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. CUSTOM_MATRIX = yes SRC += matrix.c +QUANTUM_LIB_SRC += uart.c DEFAULT_FOLDER = converter/palm_usb/stowaway diff --git a/keyboards/converter/sun_usb/command_extra.c b/keyboards/converter/sun_usb/command_extra.c index 756a9160bb..332776ab90 100644 --- a/keyboards/converter/sun_usb/command_extra.c +++ b/keyboards/converter/sun_usb/command_extra.c @@ -1,5 +1,5 @@ #include QMK_KEYBOARD_H -#include "protocol/serial.h" +#include "uart.h" bool sun_bell = false; bool sun_click = false; @@ -20,41 +20,41 @@ bool command_extra(uint8_t code) return false; case KC_DEL: print("Reset\n"); - serial_send(0x01); + uart_write(0x01); break; case KC_HOME: sun_bell = !sun_bell; if (sun_bell) { print("Bell On\n"); - serial_send(0x02); + uart_write(0x02); } else { print("Bell Off\n"); - serial_send(0x03); + uart_write(0x03); } break; case KC_END: sun_click = !sun_click; if (sun_click) { print("Click On\n"); - serial_send(0x0A); + uart_write(0x0A); } else { print("Click Off\n"); - serial_send(0x0B); + uart_write(0x0B); } break; case KC_PGUP: print("LED all on\n"); - serial_send(0x0E); - serial_send(0xFF); + uart_write(0x0E); + uart_write(0xFF); break; case KC_PGDOWN: print("LED all off\n"); - serial_send(0x0E); - serial_send(0x00); + uart_write(0x0E); + uart_write(0x00); break; case KC_INSERT: print("layout\n"); - serial_send(0x0F); + uart_write(0x0F); break; default: xprintf("Unknown extra command: %02X\n", code); diff --git a/keyboards/converter/sun_usb/config.h b/keyboards/converter/sun_usb/config.h index c67ae5ebae..0a4aa019f7 100644 --- a/keyboards/converter/sun_usb/config.h +++ b/keyboards/converter/sun_usb/config.h @@ -33,50 +33,3 @@ along with this program. If not, see . get_mods() == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \ get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ ) - - -/* Serial(USART) configuration - * asynchronous, negative logic, 1200baud, no flow control - * 1-start bit, 8-data bit, non parity, 1-stop bit - */ -#define SERIAL_SOFT_BAUD 1200 -#define SERIAL_SOFT_PARITY_NONE -#define SERIAL_SOFT_BIT_ORDER_LSB -#define SERIAL_SOFT_LOGIC_NEGATIVE -/* RXD Port */ -#define SERIAL_SOFT_RXD_ENABLE -#define SERIAL_SOFT_RXD_DDR DDRD -#define SERIAL_SOFT_RXD_PORT PORTD -#define SERIAL_SOFT_RXD_PIN PIND -#define SERIAL_SOFT_RXD_BIT 2 -#define SERIAL_SOFT_RXD_VECT INT2_vect -/* RXD Interupt */ -#define SERIAL_SOFT_RXD_INIT() do { \ - /* pin configuration: input with pull-up */ \ - SERIAL_SOFT_RXD_DDR &= ~(1<. */ #include QMK_KEYBOARD_H -#include "protocol/serial.h" +#include "uart.h" void led_set(uint8_t usb_led) { @@ -27,6 +27,6 @@ void led_set(uint8_t usb_led) if (usb_led & (1<. */ #include QMK_KEYBOARD_H -#include "protocol/serial.h" +#include "uart.h" /* * Matrix Array usage: @@ -74,7 +74,7 @@ void matrix_init(void) /* PORTD |= (1<<6); */ debug_enable = true; - serial_init(); + uart_init(1200); // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; @@ -84,12 +84,12 @@ void matrix_init(void) /* print("Reseting "); */ /* while (1) { */ /* print("."); */ - /* while (serial_recv()); */ - /* serial_send(0x01); */ + /* while (uart_read()); */ + /* uart_write(0x01); */ /* _delay_ms(500); */ - /* if (serial_recv() == 0xFF) { */ + /* if (uart_read() == 0xFF) { */ /* _delay_ms(500); */ - /* if (serial_recv() == 0x04) */ + /* if (uart_read() == 0x04) */ /* break; */ /* } */ /* } */ @@ -104,7 +104,7 @@ void matrix_init(void) uint8_t matrix_scan(void) { uint8_t code; - code = serial_recv(); + code = uart_read(); if (!code) return 0; debug_hex(code); debug(" "); @@ -113,7 +113,7 @@ uint8_t matrix_scan(void) case 0xFF: // reset success: FF 04 print("reset: "); _delay_ms(500); - code = serial_recv(); + code = uart_read(); xprintf("%02X\n", code); if (code == 0x04) { // LED status @@ -123,12 +123,12 @@ uint8_t matrix_scan(void) case 0xFE: // layout: FE print("layout: "); _delay_ms(500); - xprintf("%02X\n", serial_recv()); + xprintf("%02X\n", uart_read()); return 0; case 0x7E: // reset fail: 7E 01 print("reset fail: "); _delay_ms(500); - xprintf("%02X\n", serial_recv()); + xprintf("%02X\n", uart_read()); return 0; case 0x7F: // all keys up diff --git a/keyboards/converter/sun_usb/post_rules.mk b/keyboards/converter/sun_usb/post_rules.mk deleted file mode 100644 index 2ea1f0a5bf..0000000000 --- a/keyboards/converter/sun_usb/post_rules.mk +++ /dev/null @@ -1,6 +0,0 @@ -ifdef HARDWARE_SERIAL - SRC += protocol/serial_uart.c - OPT_DEFS += -DHARDWARE_SERIAL -else - SRC += protocol/serial_soft.c -endif diff --git a/keyboards/converter/sun_usb/rules.mk b/keyboards/converter/sun_usb/rules.mk index 2f2ddde1d0..d25bcc7ffa 100644 --- a/keyboards/converter/sun_usb/rules.mk +++ b/keyboards/converter/sun_usb/rules.mk @@ -20,5 +20,6 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. CUSTOM_MATRIX = yes SRC += matrix.c led.c +QUANTUM_LIB_SRC += uart.c DEFAULT_FOLDER = converter/sun_usb/type5 diff --git a/keyboards/dichotomy/config.h b/keyboards/dichotomy/config.h index 03e19b1388..40e7f18e6f 100644 --- a/keyboards/dichotomy/config.h +++ b/keyboards/dichotomy/config.h @@ -56,12 +56,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/dichotomy/dichotomy.c b/keyboards/dichotomy/dichotomy.c index 967d7e603c..afd52cc8b3 100755 --- a/keyboards/dichotomy/dichotomy.c +++ b/keyboards/dichotomy/dichotomy.c @@ -1,11 +1,13 @@ #include "dichotomy.h" +//#include "uart.h" + void pointing_device_task(void){ /*report_mouse_t currentReport = {}; uint32_t timeout = 0; //the m character requests the RF slave to send the mouse report - SERIAL_UART_DATA = 'm'; + uart_write('m'); //trust the external inputs completely, erase old data uint8_t uart_data[5] = {0}; @@ -15,7 +17,7 @@ void pointing_device_task(void){ //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ xprintf("\r\nTIMED OUT"); @@ -23,7 +25,7 @@ void pointing_device_task(void){ } } xprintf("\r\nGOT DATA for %d",i); - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, bytes 1-4 are movement and scroll diff --git a/keyboards/dichotomy/matrix.c b/keyboards/dichotomy/matrix.c index ed83bd452c..806b66d498 100755 --- a/keyboards/dichotomy/matrix.c +++ b/keyboards/dichotomy/matrix.c @@ -29,7 +29,7 @@ along with this program. If not, see . #include "dichotomy.h" #include "pointing_device.h" #include "report.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -94,7 +94,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -104,7 +104,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; @@ -114,14 +114,14 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ xprintf("\r\nTime out in keyboard."); break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/dichotomy/rules.mk b/keyboards/dichotomy/rules.mk index 2b5eb0360c..a6029e3dbf 100755 --- a/keyboards/dichotomy/rules.mk +++ b/keyboards/dichotomy/rules.mk @@ -18,4 +18,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/honeycomb/config.h b/keyboards/honeycomb/config.h index 725f9490cb..c959543618 100755 --- a/keyboards/honeycomb/config.h +++ b/keyboards/honeycomb/config.h @@ -45,12 +45,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/honeycomb/honeycomb.c b/keyboards/honeycomb/honeycomb.c index 1254196d39..603400c7a3 100755 --- a/keyboards/honeycomb/honeycomb.c +++ b/keyboards/honeycomb/honeycomb.c @@ -7,7 +7,7 @@ void pointing_device_task(void){ uint32_t timeout = 0; //the m character requests the RF slave to send the mouse report - SERIAL_UART_DATA = 'm'; + uart_write('m'); //trust the external inputs completely, erase old data uint8_t uart_data[5] = {0}; @@ -17,7 +17,7 @@ void pointing_device_task(void){ //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ xprintf("\r\nTIMED OUT"); @@ -25,7 +25,7 @@ void pointing_device_task(void){ } } xprintf("\r\nGOT DATA for %d",i); - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, bytes 1-4 are movement and scroll diff --git a/keyboards/honeycomb/matrix.c b/keyboards/honeycomb/matrix.c index 7fef6f0fd8..fe1e4ce8ff 100755 --- a/keyboards/honeycomb/matrix.c +++ b/keyboards/honeycomb/matrix.c @@ -30,7 +30,7 @@ along with this program. If not, see . #include "honeycomb.h" #include "pointing_device.h" #include "report.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -95,7 +95,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -103,7 +103,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; // The 's' character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); // Trust the external keystates entirely, erase the last data uint8_t uart_data[4] = {0}; @@ -113,14 +113,14 @@ uint8_t matrix_scan(void) // Wait for the serial data, timeout if it's been too long // This only happened in testing with a loose wire, but does no // harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ xprintf("\r\nTime out in keyboard."); break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } // Check for the end packet, it's our checksum. diff --git a/keyboards/honeycomb/rules.mk b/keyboards/honeycomb/rules.mk index 2b5eb0360c..a6029e3dbf 100755 --- a/keyboards/honeycomb/rules.mk +++ b/keyboards/honeycomb/rules.mk @@ -18,4 +18,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/mitosis/config.h b/keyboards/mitosis/config.h index 94e84e680e..2c72eed5f2 100644 --- a/keyboards/mitosis/config.h +++ b/keyboards/mitosis/config.h @@ -56,12 +56,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/mitosis/matrix.c b/keyboards/mitosis/matrix.c index 71c372a3ce..102431eb67 100644 --- a/keyboards/mitosis/matrix.c +++ b/keyboards/mitosis/matrix.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -80,7 +80,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -88,7 +88,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; @@ -98,13 +98,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/mitosis/rules.mk b/keyboards/mitosis/rules.mk index 6c7aa30d88..04cafae718 100644 --- a/keyboards/mitosis/rules.mk +++ b/keyboards/mitosis/rules.mk @@ -18,4 +18,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover UNICODE_ENABLE = yes # Unicode # # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/planck/keymaps/thermal_printer/config.h b/keyboards/planck/keymaps/thermal_printer/config.h index 4ae9ced258..dd9d6a9d25 100644 --- a/keyboards/planck/keymaps/thermal_printer/config.h +++ b/keyboards/planck/keymaps/thermal_printer/config.h @@ -1,9 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - -#define SERIAL_UART_BAUD 19200 +#pragma once /* * MIDI options @@ -21,8 +16,3 @@ - etc. */ //#define MIDI_ADVANCED - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 2 - - #endif \ No newline at end of file diff --git a/keyboards/redox_w/config.h b/keyboards/redox_w/config.h index b480b072f9..c4aeb32d58 100644 --- a/keyboards/redox_w/config.h +++ b/keyboards/redox_w/config.h @@ -55,12 +55,3 @@ //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/redox_w/matrix.c b/keyboards/redox_w/matrix.c index 703987a939..752324837c 100644 --- a/keyboards/redox_w/matrix.c +++ b/keyboards/redox_w/matrix.c @@ -24,7 +24,7 @@ #include "util.h" #include "matrix.h" #include "timer.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -87,7 +87,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -95,7 +95,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; @@ -105,13 +105,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/redox_w/rules.mk b/keyboards/redox_w/rules.mk index a8bd3a027a..483485cb7d 100644 --- a/keyboards/redox_w/rules.mk +++ b/keyboards/redox_w/rules.mk @@ -17,4 +17,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/sirius/uni660/rev1/config.h b/keyboards/sirius/uni660/rev1/config.h index 91d7c5d7a3..f9815844cb 100644 --- a/keyboards/sirius/uni660/rev1/config.h +++ b/keyboards/sirius/uni660/rev1/config.h @@ -57,13 +57,4 @@ along with this program. If not, see . #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); - #define DYNAMIC_KEYMAP_LAYER_COUNT 4 diff --git a/keyboards/sirius/uni660/rev1/matrix.c b/keyboards/sirius/uni660/rev1/matrix.c index 2db6767a46..65c35c968b 100644 --- a/keyboards/sirius/uni660/rev1/matrix.c +++ b/keyboards/sirius/uni660/rev1/matrix.c @@ -27,7 +27,7 @@ along with this program. If not, see . #include "matrix.h" #include "timer.h" #include "debounce.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -81,7 +81,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { debounce_init(MATRIX_ROWS); matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -91,7 +91,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[17] = {0}; @@ -101,13 +101,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/sirius/uni660/rev1/rules.mk b/keyboards/sirius/uni660/rev1/rules.mk index 836bf6b442..77b9af362e 100644 --- a/keyboards/sirius/uni660/rev1/rules.mk +++ b/keyboards/sirius/uni660/rev1/rules.mk @@ -20,4 +20,5 @@ UNICODE_ENABLE = yes # Unicode CUSTOM_MATRIX = yes # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c diff --git a/keyboards/sirius/uni660/rev2/ansi/config.h b/keyboards/sirius/uni660/rev2/ansi/config.h index 13e33ebf11..8777dc4011 100644 --- a/keyboards/sirius/uni660/rev2/ansi/config.h +++ b/keyboards/sirius/uni660/rev2/ansi/config.h @@ -57,13 +57,4 @@ along with this program. If not, see . #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); - #define DYNAMIC_KEYMAP_LAYER_COUNT 4 diff --git a/keyboards/sirius/uni660/rev2/iso/config.h b/keyboards/sirius/uni660/rev2/iso/config.h index 3283f0cd67..763230dca8 100644 --- a/keyboards/sirius/uni660/rev2/iso/config.h +++ b/keyboards/sirius/uni660/rev2/iso/config.h @@ -57,13 +57,4 @@ along with this program. If not, see . #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION -//UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); - #define DYNAMIC_KEYMAP_LAYER_COUNT 4 diff --git a/keyboards/sirius/uni660/rev2/matrix.c b/keyboards/sirius/uni660/rev2/matrix.c index 2db6767a46..65c35c968b 100644 --- a/keyboards/sirius/uni660/rev2/matrix.c +++ b/keyboards/sirius/uni660/rev2/matrix.c @@ -27,7 +27,7 @@ along with this program. If not, see . #include "matrix.h" #include "timer.h" #include "debounce.h" -#include "protocol/serial.h" +#include "uart.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -81,7 +81,7 @@ uint8_t matrix_cols(void) { void matrix_init(void) { debounce_init(MATRIX_ROWS); matrix_init_quantum(); - serial_init(); + uart_init(1000000); } uint8_t matrix_scan(void) @@ -91,7 +91,7 @@ uint8_t matrix_scan(void) uint32_t timeout = 0; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[17] = {0}; @@ -101,13 +101,13 @@ uint8_t matrix_scan(void) //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while(!SERIAL_UART_RXD_PRESENT){ + while(!uart_available()){ timeout++; if (timeout > 10000){ break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/sirius/uni660/rev2/rules.mk b/keyboards/sirius/uni660/rev2/rules.mk index 0abebb07c6..f3ff80d92e 100644 --- a/keyboards/sirius/uni660/rev2/rules.mk +++ b/keyboards/sirius/uni660/rev2/rules.mk @@ -20,6 +20,7 @@ UNICODE_ENABLE = yes # Unicode CUSTOM_MATRIX = yes # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c DEFAULT_FOLDER = sirius/uni660/rev2/ansi diff --git a/keyboards/telophase/config.h b/keyboards/telophase/config.h index 51718da9d4..837bb8ab9b 100644 --- a/keyboards/telophase/config.h +++ b/keyboards/telophase/config.h @@ -72,12 +72,3 @@ along with this program. If not, see . /* disable these deprecated features by default */ #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION - -// UART settings for communication with the RF microcontroller -#define SERIAL_UART_BAUD 1000000 -#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) -#define SERIAL_UART_INIT_CUSTOM \ - /* enable TX and RX */ \ - UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ - /* 8-bit data */ \ - UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); diff --git a/keyboards/telophase/matrix.c b/keyboards/telophase/matrix.c index a153dd4bf1..44b7e4c9e9 100644 --- a/keyboards/telophase/matrix.c +++ b/keyboards/telophase/matrix.c @@ -18,10 +18,10 @@ along with this program. If not, see . #include "quantum.h" #include "matrix.h" -#include "protocol/serial.h" +#include "uart.h" void matrix_init_custom(void) { - serial_init(); + uart_init(1000000); } bool matrix_scan_custom(matrix_row_t current_matrix[]) { @@ -29,7 +29,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { bool changed = false; //the s character requests the RF slave to send the matrix - SERIAL_UART_DATA = 's'; + uart_write('s'); //trust the external keystates entirely, erase the last data uint8_t uart_data[13] = {0}; @@ -39,13 +39,13 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here - while (!SERIAL_UART_RXD_PRESENT) { + while (!uart_available()) { timeout++; if (timeout > 10000) { break; } } - uart_data[i] = SERIAL_UART_DATA; + uart_data[i] = uart_read(); } //check for the end packet, the key state bytes use the LSBs, so 0xE0 diff --git a/keyboards/telophase/rules.mk b/keyboards/telophase/rules.mk index c3a8aaf79f..41a6ee25f5 100644 --- a/keyboards/telophase/rules.mk +++ b/keyboards/telophase/rules.mk @@ -19,7 +19,8 @@ AUDIO_ENABLE = no # Audio output CUSTOM_MATRIX = lite # project specific files -SRC += matrix.c serial_uart.c +SRC += matrix.c +QUANTUM_LIB_SRC += uart.c # Disable unsupported hardware RGBLIGHT_SUPPORTED = no diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c index 82528cc680..0801f078ef 100644 --- a/quantum/process_keycode/process_printer.c +++ b/quantum/process_keycode/process_printer.c @@ -16,13 +16,14 @@ #include "process_printer.h" #include "action_util.h" +#include "uart.h" bool printing_enabled = false; uint8_t character_shift = 0; void enable_printing(void) { printing_enabled = true; - serial_init(); + uart_init(19200); } void disable_printing(void) { printing_enabled = false; } @@ -35,7 +36,7 @@ uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0 void print_char(char c) { USB_Disable(); - serial_send(c); + uart_write(c); USB_Init(); } diff --git a/quantum/process_keycode/process_printer.h b/quantum/process_keycode/process_printer.h index 3c6d06ff94..6f4d09f333 100644 --- a/quantum/process_keycode/process_printer.h +++ b/quantum/process_keycode/process_printer.h @@ -18,6 +18,4 @@ #include "quantum.h" -#include "protocol/serial.h" - bool process_printer(uint16_t keycode, keyrecord_t *record); -- cgit v1.2.3