summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-02-06 09:20:48 +1100
committerGitHub <noreply@github.com>2021-02-06 09:20:48 +1100
commit5ea92a9c1cbe3e20bf4830d550d797a8e9650da8 (patch)
tree75ea1413ae4fa23bd0b1230629b6a3b3e215c5eb
parent464eb7137d27e3a31e85032c85c9fda627a8b33f (diff)
Serial refactor (#11521)
-rw-r--r--keyboards/40percentclub/ut47/config.h22
-rw-r--r--keyboards/centromere/centromere.c5
-rw-r--r--keyboards/centromere/config.h18
-rw-r--r--keyboards/centromere/matrix.c4
-rw-r--r--keyboards/centromere/rules.mk9
-rw-r--r--keyboards/chimera_ergo/chimera_ergo.c15
-rw-r--r--keyboards/chimera_ergo/config.h18
-rw-r--r--keyboards/chimera_ergo/matrix.c4
-rw-r--r--keyboards/chimera_ergo/rules.mk9
-rw-r--r--keyboards/chimera_ls/chimera_ls.c15
-rw-r--r--keyboards/chimera_ls/config.h18
-rw-r--r--keyboards/chimera_ls/matrix.c4
-rw-r--r--keyboards/chimera_ls/rules.mk8
-rw-r--r--keyboards/chimera_ortho/chimera_ortho.c15
-rw-r--r--keyboards/chimera_ortho/config.h18
-rw-r--r--keyboards/chimera_ortho/matrix.c4
-rw-r--r--keyboards/chimera_ortho/rules.mk8
-rw-r--r--keyboards/chimera_ortho_plus/chimera_ortho_plus.c5
-rw-r--r--keyboards/chimera_ortho_plus/config.h18
-rw-r--r--keyboards/chimera_ortho_plus/matrix.c4
-rw-r--r--keyboards/chimera_ortho_plus/rules.mk2
-rw-r--r--keyboards/comet46/comet46.c21
-rw-r--r--keyboards/comet46/config.h18
-rw-r--r--keyboards/comet46/matrix.c4
-rw-r--r--keyboards/comet46/rules.mk4
-rw-r--r--keyboards/dichotomy/config.h18
-rwxr-xr-xkeyboards/dichotomy/dichotomy.c16
-rwxr-xr-xkeyboards/dichotomy/matrix.c3
-rwxr-xr-xkeyboards/dichotomy/rules.mk11
-rw-r--r--keyboards/hhkb/ansi/config.h35
-rw-r--r--keyboards/hhkb/jp/config.h35
-rwxr-xr-xkeyboards/honeycomb/config.h18
-rwxr-xr-xkeyboards/honeycomb/honeycomb.c16
-rwxr-xr-xkeyboards/honeycomb/matrix.c4
-rwxr-xr-xkeyboards/honeycomb/rules.mk7
-rw-r--r--keyboards/mitosis/config.h18
-rw-r--r--keyboards/mitosis/matrix.c4
-rw-r--r--keyboards/mitosis/mitosis.c5
-rw-r--r--keyboards/mitosis/rules.mk11
-rw-r--r--keyboards/planck/keymaps/thermal_printer/config.h17
-rw-r--r--keyboards/redox_w/config.h18
-rw-r--r--keyboards/redox_w/matrix.c4
-rw-r--r--keyboards/redox_w/redox_w.c15
-rw-r--r--keyboards/redox_w/rules.mk11
-rw-r--r--keyboards/sirius/uni660/rev1/config.h16
-rw-r--r--keyboards/sirius/uni660/rev1/matrix.c4
-rw-r--r--keyboards/sirius/uni660/rev1/rev1.c5
-rw-r--r--keyboards/sirius/uni660/rev2/ansi/config.h16
-rw-r--r--keyboards/sirius/uni660/rev2/iso/config.h16
-rw-r--r--keyboards/sirius/uni660/rev2/matrix.c4
-rw-r--r--keyboards/sirius/uni660/rev2/rev2.c5
-rw-r--r--keyboards/telophase/config.h18
-rw-r--r--keyboards/telophase/matrix.c4
-rw-r--r--keyboards/telophase/rules.mk13
-rw-r--r--keyboards/telophase/telophase.c15
-rw-r--r--quantum/config_common.h45
-rw-r--r--tmk_core/protocol/serial.h2
-rw-r--r--tmk_core/protocol/serial_uart.c25
58 files changed, 162 insertions, 562 deletions
diff --git a/keyboards/40percentclub/ut47/config.h b/keyboards/40percentclub/ut47/config.h
index 197d6cd181..9622f58bb3 100644
--- a/keyboards/40percentclub/ut47/config.h
+++ b/keyboards/40percentclub/ut47/config.h
@@ -54,25 +54,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Enable GNAP matrix serial output */
#define GNAP_ENABLE
-
-/* USART configuration */
-#ifdef __AVR_ATmega32U4__
-# define SERIAL_UART_BAUD 9600
-# define SERIAL_UART_DATA UDR1
-# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
-# define SERIAL_UART_RXD_VECT USART1_RX_vect
-# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
-# define SERIAL_UART_INIT() do { \
- /* baud rate */ \
- UBRR1L = SERIAL_UART_UBRR; \
- /* baud rate */ \
- UBRR1H = SERIAL_UART_UBRR >> 8; \
- /* enable TX */ \
- UCSR1B = _BV(TXEN1); \
- /* 8-bit data */ \
- UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
- sei(); \
- } while(0)
-# else
-# error "USART configuration is needed."
-#endif
diff --git a/keyboards/centromere/centromere.c b/keyboards/centromere/centromere.c
index 8800e2ce6a..269c60fd75 100644
--- a/keyboards/centromere/centromere.c
+++ b/keyboards/centromere/centromere.c
@@ -1,9 +1,5 @@
#include "centromere.h"
-void uart_init(void) {
- SERIAL_UART_INIT();
-}
-
void led_init(void) {
#if MCU == atmega32u2
setPinOutput(C4); // Set red LED pin as output
@@ -32,7 +28,6 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
- uart_init();
led_init();
}
diff --git a/keyboards/centromere/config.h b/keyboards/centromere/config.h
index 0a908f60f9..e502e2534b 100644
--- a/keyboards/centromere/config.h
+++ b/keyboards/centromere/config.h
@@ -59,17 +59,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 500000
-#define SERIAL_UART_DATA UDR1
-#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
-#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
-#define SERIAL_UART_INIT() do { \
- /* baud rate */ \
- UBRR1L = SERIAL_UART_UBRR; \
- /* baud rate */ \
- UBRR1H = SERIAL_UART_UBRR >> 8; \
- /* enable TX and RX */ \
- UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
- /* 8-bit data */ \
- UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
- } while(0)
+#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 c5fc8db6ce..5ca083b435 100644
--- a/keyboards/centromere/matrix.c
+++ b/keyboards/centromere/matrix.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "matrix.h"
#include "timer.h"
+#include "protocol/serial.h"
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
@@ -79,12 +80,11 @@ uint8_t matrix_cols(void) {
void matrix_init(void) {
matrix_init_quantum();
+ serial_init();
}
uint8_t matrix_scan(void)
{
- SERIAL_UART_INIT();
-
uint32_t timeout = 0;
//the s character requests the RF remote slave to send the matrix information
diff --git a/keyboards/centromere/rules.mk b/keyboards/centromere/rules.mk
index f08f6e6ebd..2469d244a6 100644
--- a/keyboards/centromere/rules.mk
+++ b/keyboards/centromere/rules.mk
@@ -31,14 +31,7 @@ MIDI_ENABLE = no # MIDI controls
UNICODE_ENABLE = yes # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
-USB = /dev/ttyACM0
-
-# upload: build
-# $(CENTROMERE_UPLOAD_COMMAND)
-
-OPT_DEFS += -DCENTROMERE_PROMICRO
-
# # project specific files
-SRC = matrix.c
+SRC += matrix.c serial_uart.c
LAYOUTS = split_3x5_3 split_3x6_3
diff --git a/keyboards/chimera_ergo/chimera_ergo.c b/keyboards/chimera_ergo/chimera_ergo.c
index 29470f9080..47653c2e4b 100644
--- a/keyboards/chimera_ergo/chimera_ergo.c
+++ b/keyboards/chimera_ergo/chimera_ergo.c
@@ -1,9 +1,5 @@
#include "chimera_ergo.h"
-void uart_init(void) {
- SERIAL_UART_INIT();
-}
-
void led_init(void) {
DDRD |= (1<<1);
PORTD |= (1<<1);
@@ -16,16 +12,5 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
- uart_init();
led_init();
}
-
-void matrix_scan_kb(void) {
- // put your looping keyboard code here
- // runs every cycle (a lot)
- matrix_scan_user();
-}
-
-void led_set_kb(uint8_t usb_led) {
-
-}
diff --git a/keyboards/chimera_ergo/config.h b/keyboards/chimera_ergo/config.h
index 262f287a50..4021cdcd50 100644
--- a/keyboards/chimera_ergo/config.h
+++ b/keyboards/chimera_ergo/config.h
@@ -60,19 +60,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 1000000
-#define SERIAL_UART_DATA UDR1
-#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
-#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
-#define SERIAL_UART_INIT() do { \
- /* baud rate */ \
- UBRR1L = SERIAL_UART_UBRR; \
- /* baud rate */ \
- UBRR1H = SERIAL_UART_UBRR >> 8; \
- /* enable TX and RX */ \
- UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
- /* 8-bit data */ \
- UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
- } while(0)
+#define SERIAL_UART_INIT_CUSTOM \
+ /* enable TX and RX */ \
+ UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
+ /* 8-bit data */ \
+ UCSR1C = _BV(UCSZ11) | _BV(UCSZ10);
#endif
diff --git a/keyboards/chimera_ergo/matrix.c b/keyboards/chimera_ergo/matrix.c
index d512a51d97..112b9a40d1 100644
--- a/keyboards/chimera_ergo/matrix.c
+++ b/keyboards/chimera_ergo/matrix.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "matrix.h"
#include "timer.h"
+#include "protocol/serial.h"
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
@@ -88,12 +89,11 @@ uint8_t matrix_cols(void) {
void matrix_init(void) {
matrix_init_quantum();
+ serial_init();
}
uint8_t matrix_scan(void)
{
- SERIAL_UART_INIT();
-
uint32_t timeout = 0;
//the s character requests the RF slave to send the matrix
diff --git a/keyboards/chimera_ergo/rules.mk b/keyboards/chimera_ergo/rules.mk
index f37d14107b..01d5c3c70c 100644
--- a/keyboards/chimera_ergo/rules.mk
+++ b/keyboards/chimera_ergo/rules.mk
@@ -28,12 +28,5 @@ NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
UNICODE_ENABLE = YES # Unicode
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
-
-OPT_DEFS += -DCHIMERA_ERGO_PROMICRO
-CHIMERA_ERGO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
- avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
-
# # project specific files
-SRC = matrix.c
-
-USB = /dev/ttyACM0
+SRC += matrix.c serial_uart.c
diff --git a/keyboards/chimera_ls/chimera_ls.c b/keyboards/chimera_ls/chimera_ls.c
index 588b02b2d1..f88e9a4f12 100644
--- a/keyboards/chimera_ls/chimera_ls.c
+++ b/keyboards/chimera_ls/chimera_ls.c
@@ -1,9 +1,5 @@
#include "chimera_ls.h"
-void uart_init(void) {
- SERIAL_UART_INIT();
-}
-
void led_init(void) {
DDRD |= (1<<1);
PORTD |= (1<<1);
@@ -16,16 +12,5 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
- uart_init();
led_init();
}
-
-void matrix_scan_kb(void) {
- // put your looping keyboard code here
- // runs every cycle (a lot)
- matrix_scan_user();
-}
-
-void led_set_kb(uint8_t usb_led) {
-
-}
diff --git a/keyboards/chimera_ls/config.h b/keyboards/chimera_ls/config.h
index 87e9196095..d9c14a3fce 100644
--- a/keyboards/chimera_ls/config.h
+++ b/keyboards/chimera_ls/config.h
@@ -60,19 +60,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 1000000
-#define SERIAL_UART_DATA UDR1
-#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
-#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
-#define SERIAL_UART_INIT() do { \
- /* baud rate */ \
- UBRR1L = SERIAL_UART_UBRR; \
- /* baud rate */ \
- UBRR1H = SERIAL_UART_UBRR >> 8; \
- /* enable TX and RX */ \
- UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
- /* 8-bit data */ \
- UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
- } while(0)
+#define SERIAL_UART_INIT_CUSTOM \
+ /* enable TX and RX */ \
+ UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
+ /* 8-bit data */ \
+ UCSR1C = _BV(UCSZ11) | _BV(UCSZ10);
#endif
diff --git a/keyboards/chimera_ls/matrix.c b/keyboards/chimera_ls/matrix.c
index 72fe441370..7208d971e1 100644
--- a/keyboards/chimera_ls/matrix.c
+++ b/keyboards/chimera_ls/matrix.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "matrix.h"
#include "timer.h"
+#include "protocol/serial.h"
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
@@ -92,12 +93,11 @@ uint8_t matrix_cols(void) {
void matrix_init(void) {
matrix_init_quantum();
+ serial_init();
}
uint8_t matrix_scan(void)
{
- SERIAL_UART_INIT();
-
uint32_t timeout = 0;
//the s character requests the RF slave to send the matrix
diff --git a/keyboards/chimera_ls/rules.mk b/keyboards/chimera_ls/rules.mk
index 162e06aaf7..536e6053a1 100644
--- a/keyboards/chimera_ls/rules.mk
+++ b/keyboards/chimera_ls/rules.mk
@@ -28,14 +28,8 @@ NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
UNICODE_ENABLE = YES # Unicode
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
-USB = /dev/ttyACM0
-
-OPT_DEFS += -DCHIMERA_LS_PROMICRO
-CHIMERA_LS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
- avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
-
# project specific files
-SRC = matrix.c
+SRC += matrix.c serial_uart.c
LAYOUTS = ortho_4x12
diff --git a/keyboards/chimera_ortho/chimera_ortho.c b/keyboards/chimera_ortho/chimera_ortho.c
index 2a602cf2f7..2cdc3d9331 100644
--- a/keyboards/chimera_ortho/chimera_ortho.c
+++ b/keyboards/chimera_ortho/chimera_ortho.c
@@ -1,9 +1,5 @@
#include "chimera_ortho.h"
-void uart_init(void) {
- SERIAL_UART_INIT();
-}
-
void led_init(void) {
DDRD |= (1<<1);
PORTD |= (1<<1);
@@ -16,16 +12,5 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
- uart_init();
led_init();
}
-
-void matrix_scan_kb(void) {
- // put your looping keyboard code here
- // runs every cycle (a lot)
- matrix_scan_user();
-}
-
-void led_set_kb(uint8_t usb_led) {
-
-}
diff --git a/keyboards/chimera_ortho/config.h b/keyboards/chimera_ortho/config.h
index 4ce70e68ba..b103589879 100644
--- a/keyboards/chimera_ortho/config.h
+++ b/keyboards/chimera_ortho/config.h
@@ -60,19 +60,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 1000000
-#define SERIAL_UART_DATA UDR1
-#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
-#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
-#define SERIAL_UART_INIT() do { \
- /* baud rate */ \
- UBRR1L = SERIAL_UART_UBRR; \
- /* baud rate */ \
- UBRR1H = SERIAL_UART_UBRR >> 8; \
- /* enable TX and RX */ \
- UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
- /* 8-bit data */ \
- UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
- } while(0)
+#define SERIAL_UART_INIT_CUSTOM \
+ /* enable TX and RX */ \
+ UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
+ /* 8-bit data */ \
+ UCSR1C = _BV(UCSZ11) | _BV(UCSZ10);
#endif
diff --git a/keyboards/chimera_ortho/matrix.c b/keyboards/chimera_ortho/matrix.c
index dc38ba74f8..eb2f18473e 100644
--- a/keyboards/chimera_ortho/matrix.c
+++ b/keyboards/chimera_ortho/matrix.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "matrix.h"
#include "timer.h"
+#include "protocol/serial.h"
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
@@ -78,12 +79,11 @@ uint8_t matrix_cols(void) {
void matrix_init(void) {
matrix_init_quantum();
+ serial_init();
}
uint8_t matrix_scan(void)
{
- SERIAL_UART_INIT();
-
uint32_t timeout = 0;
//the s character requests the RF slave to send the matrix
diff --git a/keyboards/chimera_ortho/rules.mk b/keyboards/chimera_ortho/rules.mk
index bf341ab5dd..e3bbaa39d4 100644
--- a/keyboards/chimera_ortho/rules.mk
+++ b/keyboards/chimera_ortho/rules.mk
@@ -28,11 +28,5 @@ NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
UNICODE_ENABLE = YES # Unicode
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
-USB = /dev/ttyACM0
-
-OPT_DEFS += -DCHIMERA_ORTHO_PROMICRO
-CHIMERA_ORTHO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
- avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
-
# project specific files
-SRC = matrix.c
+SRC += matrix.c serial_uart.c
diff --git a/keyboards/chimera_ortho_plus/chimera_ortho_plus.c b/keyboards/chimera_ortho_plus/chimera_ortho_plus.c
index 1972f2a9c3..6d87ed7053 100644
--- a/keyboards/chimera_ortho_plus/chimera_ortho_plus.c
+++ b/keyboards/chimera_ortho_plus/chimera_ortho_plus.c
@@ -1,9 +1,5 @@
#include "chimera_ortho_plus.h"
-void uart_init(void) {
- SERIAL_UART_INIT();
-}
-
void led_init(void) {
setPinOutput(D1);
setPinOutput(F4);
@@ -18,6 +14,5 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
- uart_init();
led_init();
}
diff --git a/keyboards/chimera_ortho_plus/config.h b/keyboards/chimera_ortho_plus/config.h
index e060e196aa..4b12796e95 100644
--- a/keyboards/chimera_ortho_plus/config.h
+++ b/keyboards/chimera_ortho_plus/config.h
@@ -59,17 +59,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 1000000
-#define SERIAL_UART_DATA UDR1
-#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
-#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
-#define SERIAL_UART_INIT() do { \
- /* baud rate */ \
- UBRR1L = SERIAL_UART_UBRR; \
- /* baud rate */ \
- UBRR1H = SERIAL_UART_UBRR >> 8; \
- /* enable TX and RX */ \
- UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
- /* 8-bit data */ \
- UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
- } while(0)
+#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 ed6eac2b09..2bdc97991c 100644
--- a/keyboards/chimera_ortho_plus/matrix.c
+++ b/keyboards/chimera_ortho_plus/matrix.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "matrix.h"
#include "timer.h"
+#include "protocol/serial.h"
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
@@ -78,12 +79,11 @@ uint8_t matrix_cols(void) {
void matrix_init(void) {
matrix_init_quantum();
+ serial_init();
}
uint8_t matrix_scan(void)
{
- SERIAL_UART_INIT();
-
uint32_t timeout = 0;
//the s character requests the RF slave to send the matrix
diff --git a/keyboards/chimera_ortho_plus/rules.mk b/keyboards/chimera_ortho_plus/rules.mk
index 2dd6c3e1f0..fec1bef730 100644
--- a/keyboards/chimera_ortho_plus/rules.mk
+++ b/keyboards/chimera_ortho_plus/rules.mk
@@ -33,4 +33,4 @@ UNICODE_ENABLE = yes
CUSTOM_MATRIX = yes
# project specific files
-SRC = matrix.c
+SRC += matrix.c serial_uart.c
diff --git a/keyboards/comet46/comet46.c b/keyboards/comet46/comet46.c
index 0710b8e330..7c7edba93e 100644
--- a/keyboards/comet46/comet46.c
+++ b/keyboards/comet46/comet46.c
@@ -1,22 +1 @@
#include "comet46.h"
-
-void uart_init(void) {
- SERIAL_UART_INIT();
-}
-
-void matrix_init_kb(void) {
- // put your keyboard start-up code here
- // runs once when the firmware starts up
- matrix_init_user();
- uart_init();
-}
-
-void matrix_scan_kb(void) {
- // put your looping keyboard code here
- // runs every cycle (a lot)
- matrix_scan_user();
-}
-
-void led_set_kb(uint8_t usb_led) {
-
-}
diff --git a/keyboards/comet46/config.h b/keyboards/comet46/config.h
index d50224eb60..5ae026f923 100644
--- a/keyboards/comet46/config.h
+++ b/keyboards/comet46/config.h
@@ -66,19 +66,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 1000000
-#define SERIAL_UART_DATA UDR1
-#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
-#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
-#define SERIAL_UART_INIT() do { \
- /* baud rate */ \
- UBRR1L = SERIAL_UART_UBRR; \
- /* baud rate */ \
- UBRR1H = SERIAL_UART_UBRR >> 8; \
- /* enable TX and RX */ \
- UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
- /* 8-bit data */ \
- UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
- } while(0)
+#define SERIAL_UART_INIT_CUSTOM \
+ /* enable TX and RX */ \
+ UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
+ /* 8-bit data */ \
+ UCSR1C = _BV(UCSZ11) | _BV(UCSZ10);
#endif
diff --git a/keyboards/comet46/matrix.c b/keyboards/comet46/matrix.c
index dc38ba74f8..eb2f18473e 100644
--- a/keyboards/comet46/matrix.c
+++ b/keyboards/c