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
This commit is contained in:
Ryan 2021-12-15 22:00:39 +11:00 • committed by GitHub
commit c12268807d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 154 additions and 393 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

Some files were not shown because too many files have changed in this diff Show more