Browse Source

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
Ryan 3 years ago
parent
commit
c12268807d
63 changed files with 154 additions and 393 deletions
  1. 1 1
      common_features.mk
  2. 3 3
      keyboards/40percentclub/ut47/keymaps/default/keymap.c
  3. 3 3
      keyboards/40percentclub/ut47/keymaps/non-us/keymap.c
  4. 3 3
      keyboards/40percentclub/ut47/keymaps/nordic/keymap.c
  5. 3 3
      keyboards/40percentclub/ut47/keymaps/rgb/keymap.c
  6. 0 8
      keyboards/40percentclub/ut47/matrix.c
  7. 2 1
      keyboards/40percentclub/ut47/rules.mk
  8. 6 2
      keyboards/40percentclub/ut47/ut47.c
  9. 0 9
      keyboards/centromere/config.h
  10. 5 5
      keyboards/centromere/matrix.c
  11. 2 1
      keyboards/centromere/rules.mk
  12. 0 9
      keyboards/chimera_ergo/config.h
  13. 5 5
      keyboards/chimera_ergo/matrix.c
  14. 2 1
      keyboards/chimera_ergo/rules.mk
  15. 0 9
      keyboards/chimera_ls/config.h
  16. 5 5
      keyboards/chimera_ls/matrix.c
  17. 2 1
      keyboards/chimera_ls/rules.mk
  18. 0 9
      keyboards/chimera_ortho/config.h
  19. 5 5
      keyboards/chimera_ortho/matrix.c
  20. 2 1
      keyboards/chimera_ortho/rules.mk
  21. 0 9
      keyboards/chimera_ortho_plus/config.h
  22. 5 5
      keyboards/chimera_ortho_plus/matrix.c
  23. 2 1
      keyboards/chimera_ortho_plus/rules.mk
  24. 0 9
      keyboards/comet46/config.h
  25. 5 5
      keyboards/comet46/matrix.c
  26. 2 2
      keyboards/comet46/rules.mk
  27. 0 55
      keyboards/converter/palm_usb/config.h
  28. 4 4
      keyboards/converter/palm_usb/matrix.c
  29. 0 7
      keyboards/converter/palm_usb/post_rules.mk
  30. 1 0
      keyboards/converter/palm_usb/rules.mk
  31. 11 11
      keyboards/converter/sun_usb/command_extra.c
  32. 0 47
      keyboards/converter/sun_usb/config.h
  33. 3 3
      keyboards/converter/sun_usb/led.c
  34. 10 10
      keyboards/converter/sun_usb/matrix.c
  35. 0 6
      keyboards/converter/sun_usb/post_rules.mk
  36. 1 0
      keyboards/converter/sun_usb/rules.mk
  37. 0 9
      keyboards/dichotomy/config.h
  38. 5 3
      keyboards/dichotomy/dichotomy.c
  39. 5 5
      keyboards/dichotomy/matrix.c
  40. 2 1
      keyboards/dichotomy/rules.mk
  41. 0 9
      keyboards/honeycomb/config.h
  42. 3 3
      keyboards/honeycomb/honeycomb.c
  43. 5 5
      keyboards/honeycomb/matrix.c
  44. 2 1
      keyboards/honeycomb/rules.mk
  45. 0 9
      keyboards/mitosis/config.h
  46. 5 5
      keyboards/mitosis/matrix.c
  47. 2 1
      keyboards/mitosis/rules.mk
  48. 1 11
      keyboards/planck/keymaps/thermal_printer/config.h
  49. 0 9
      keyboards/redox_w/config.h
  50. 5 5
      keyboards/redox_w/matrix.c
  51. 2 1
      keyboards/redox_w/rules.mk
  52. 0 9
      keyboards/sirius/uni660/rev1/config.h
  53. 5 5
      keyboards/sirius/uni660/rev1/matrix.c
  54. 2 1
      keyboards/sirius/uni660/rev1/rules.mk
  55. 0 9
      keyboards/sirius/uni660/rev2/ansi/config.h
  56. 0 9
      keyboards/sirius/uni660/rev2/iso/config.h
  57. 5 5
      keyboards/sirius/uni660/rev2/matrix.c
  58. 2 1
      keyboards/sirius/uni660/rev2/rules.mk
  59. 0 9
      keyboards/telophase/config.h
  60. 5 5
      keyboards/telophase/matrix.c
  61. 2 1
      keyboards/telophase/rules.mk
  62. 3 2
      quantum/process_keycode/process_printer.c
  63. 0 2
      quantum/process_keycode/process_printer.h

+ 1 - 1
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

+ 3 - 3
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) {

+ 3 - 3
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) {

+ 3 - 3
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) {

+ 3 - 3
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) {

+ 0 - 8
keyboards/40percentclub/ut47/matrix.c

@@ -26,10 +26,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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)

+ 2 - 1
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

+ 6 - 2
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);

+ 0 - 9
keyboards/centromere/config.h

@@ -56,12 +56,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 5 - 5
keyboards/centromere/matrix.c

@@ -26,7 +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"
+#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

+ 2 - 1
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

+ 0 - 9
keyboards/chimera_ergo/config.h

@@ -56,12 +56,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 5 - 5
keyboards/chimera_ergo/matrix.c

@@ -26,7 +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"
+#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

+ 2 - 1
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

+ 0 - 9
keyboards/chimera_ls/config.h

@@ -56,12 +56,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 5 - 5
keyboards/chimera_ls/matrix.c

@@ -26,7 +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"
+#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

+ 2 - 1
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
 

+ 0 - 9
keyboards/chimera_ortho/config.h

@@ -56,12 +56,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 5 - 5
keyboards/chimera_ortho/matrix.c

@@ -26,7 +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"
+#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

+ 2 - 1
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

+ 0 - 9
keyboards/chimera_ortho_plus/config.h

@@ -56,12 +56,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 5 - 5
keyboards/chimera_ortho_plus/matrix.c

@@ -26,7 +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"
+#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

+ 2 - 1
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

+ 0 - 9
keyboards/comet46/config.h

@@ -62,12 +62,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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);

+ 5 - 5
keyboards/comet46/matrix.c

@@ -26,7 +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"
+#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

+ 2 - 2
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

+ 0 - 55
keyboards/converter/palm_usb/config.h

@@ -60,58 +60,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
     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<<SERIAL_SOFT_RXD_BIT); \
-    SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
-    /* enable interrupt: INT0(rising edge) */ \
-    EICRA |= ((1<<ISC01)|(1<<ISC00)); \
-    EIMSK |= (1<<INT0); \
-    sei(); \
-} while (0)
-#define SERIAL_SOFT_RXD_INT_ENTER()
-#define SERIAL_SOFT_RXD_INT_EXIT()  do { \
-    /* clear interrupt  flag */ \
-    EIFR = (1<<INTF0); \
-} while (0)
-#define SERIAL_SOFT_RXD_READ()      (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
-
-/* TXD Port */
-#define SERIAL_SOFT_TXD_ENABLE
-#define SERIAL_SOFT_TXD_DDR         DDRD
-#define SERIAL_SOFT_TXD_PORT        PORTD
-#define SERIAL_SOFT_TXD_PIN         PIND
-#define SERIAL_SOFT_TXD_BIT         3
-#define SERIAL_SOFT_TXD_HI()        do { SERIAL_SOFT_TXD_PORT |=  (1<<SERIAL_SOFT_TXD_BIT); } while (0)
-#define SERIAL_SOFT_TXD_LO()        do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
-#define SERIAL_SOFT_TXD_INIT()      do { \
-    /* pin configuration: output */ \
-    SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
-    /* idle */ \
-    SERIAL_SOFT_TXD_ON(); \
-} while (0)
-
-

+ 4 - 4
keyboards/converter/palm_usb/matrix.c

@@ -18,7 +18,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #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 ++;

+ 0 - 7
keyboards/converter/palm_usb/post_rules.mk

@@ -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

+ 1 - 0
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

+ 11 - 11
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);

+ 0 - 47
keyboards/converter/sun_usb/config.h

@@ -33,50 +33,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
     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<<SERIAL_SOFT_RXD_BIT); \
-    SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
-    /* enable interrupt: INT2(rising edge) */ \
-    EICRA |= ((1<<ISC21)|(1<<ISC20)); \
-    EIMSK |= (1<<INT2); \
-    sei(); \
-} while (0)
-#define SERIAL_SOFT_RXD_INT_ENTER()
-#define SERIAL_SOFT_RXD_INT_EXIT()  do { \
-    /* clear interrupt  flag */ \
-    EIFR = (1<<INTF2); \
-} while (0)
-#define SERIAL_SOFT_RXD_READ()      (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
-/* TXD Port */
-#define SERIAL_SOFT_TXD_ENABLE
-#define SERIAL_SOFT_TXD_DDR         DDRD
-#define SERIAL_SOFT_TXD_PORT        PORTD
-#define SERIAL_SOFT_TXD_PIN         PIND
-#define SERIAL_SOFT_TXD_BIT         3
-#define SERIAL_SOFT_TXD_HI()        do { SERIAL_SOFT_TXD_PORT |=  (1<<SERIAL_SOFT_TXD_BIT); } while (0)
-#define SERIAL_SOFT_TXD_LO()        do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
-#define SERIAL_SOFT_TXD_INIT()      do { \
-    /* pin configuration: output */ \
-    SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
-    /* idle */ \
-    SERIAL_SOFT_TXD_ON(); \
-} while (0)

+ 3 - 3
keyboards/converter/sun_usb/led.c

@@ -16,7 +16,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #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<<USB_LED_CAPS_LOCK))   sun_led |= (1<<3);
     xprintf("LED: %02X\n", usb_led);
 
-    serial_send(0x0E);
-    serial_send(sun_led);
+    uart_write(0x0E);
+    uart_write(sun_led);
 }

+ 10 - 10
keyboards/converter/sun_usb/matrix.c

@@ -16,7 +16,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #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 <layout>
             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

+ 0 - 6
keyboards/converter/sun_usb/post_rules.mk

@@ -1,6 +0,0 @@
-ifdef HARDWARE_SERIAL
-  SRC += protocol/serial_uart.c
-  OPT_DEFS += -DHARDWARE_SERIAL
-else
-  SRC += protocol/serial_soft.c
-endif

+ 1 - 0
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

+ 0 - 9
keyboards/dichotomy/config.h

@@ -56,12 +56,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 5 - 3
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

+ 5 - 5
keyboards/dichotomy/matrix.c

@@ -29,7 +29,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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

+ 2 - 1
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

+ 0 - 9
keyboards/honeycomb/config.h

@@ -45,12 +45,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 3 - 3
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

+ 5 - 5
keyboards/honeycomb/matrix.c

@@ -30,7 +30,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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.

+ 2 - 1
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

+ 0 - 9
keyboards/mitosis/config.h

@@ -56,12 +56,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#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);

+ 5 - 5
keyboards/mitosis/matrix.c

@@ -26,7 +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"
+#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

+ 2 - 1
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

+ 1 - 11
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

+ 0 - 9
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);

+ 5 - 5
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

+ 2 - 1
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

+ 0 - 9
keyboards/sirius/uni660/rev1/config.h

@@ -57,13 +57,4 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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

+ 5 - 5
keyboards/sirius/uni660/rev1/matrix.c

@@ -27,7 +27,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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

+ 2 - 1
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

+ 0 - 9
keyboards/sirius/uni660/rev2/ansi/config.h

@@ -57,13 +57,4 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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

+ 0 - 9
keyboards/sirius/uni660/rev2/iso/config.h

@@ -57,13 +57,4 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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

+ 5 - 5
keyboards/sirius/uni660/rev2/matrix.c

@@ -27,7 +27,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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

+ 2 - 1
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

+ 0 - 9
keyboards/telophase/config.h

@@ -72,12 +72,3 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* 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);

+ 5 - 5
keyboards/telophase/matrix.c

@@ -18,10 +18,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #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

+ 2 - 1
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

+ 3 - 2
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();
 }
 

+ 0 - 2
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);