From 5ea92a9c1cbe3e20bf4830d550d797a8e9650da8 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 6 Feb 2021 09:20:48 +1100 Subject: Serial refactor (#11521) --- keyboards/honeycomb/config.h | 18 +++++------------- keyboards/honeycomb/honeycomb.c | 16 ---------------- keyboards/honeycomb/matrix.c | 4 ++-- keyboards/honeycomb/rules.mk | 7 +------ 4 files changed, 8 insertions(+), 37 deletions(-) (limited to 'keyboards/honeycomb') diff --git a/keyboards/honeycomb/config.h b/keyboards/honeycomb/config.h index 4991c8a0ea..725f9490cb 100755 --- a/keyboards/honeycomb/config.h +++ b/keyboards/honeycomb/config.h @@ -48,17 +48,9 @@ along with this program. If not, see . //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/honeycomb/honeycomb.c b/keyboards/honeycomb/honeycomb.c index add4af1536..1254196d39 100755 --- a/keyboards/honeycomb/honeycomb.c +++ b/keyboards/honeycomb/honeycomb.c @@ -2,13 +2,8 @@ #include "pointing_device.h" #include "report.h" -void uart_init(void) { - SERIAL_UART_INIT(); -} - void pointing_device_task(void){ /*report_mouse_t currentReport = {}; - SERIAL_UART_INIT(); uint32_t timeout = 0; //the m character requests the RF slave to send the mouse report @@ -77,16 +72,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/honeycomb/matrix.c b/keyboards/honeycomb/matrix.c index a06afb6d96..2bed690689 100755 --- a/keyboards/honeycomb/matrix.c +++ b/keyboards/honeycomb/matrix.c @@ -30,6 +30,7 @@ along with this program. If not, see . #include "honeycomb.h" #include "pointing_device.h" #include "report.h" +#include "protocol/serial.h" #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") @@ -94,12 +95,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/honeycomb/rules.mk b/keyboards/honeycomb/rules.mk index 19852d7ec3..d6f98125ee 100755 --- a/keyboards/honeycomb/rules.mk +++ b/keyboards/honeycomb/rules.mk @@ -30,9 +30,4 @@ UNICODE_ENABLE = YES # Unicode # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID # # project specific files -SRC += matrix.c - -USB = /dev/ttyACM0 - -#upload: build -# $(honeycomb_UPLOAD_COMMAND) +SRC += matrix.c serial_uart.c -- cgit v1.2.3