1
0
Fork 0

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
parent c0bb153151
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

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

View file

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

View file

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

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

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

View file

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

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,6 +18,4 @@
#include "quantum.h"
#include "protocol/serial.h"
bool process_printer(uint16_t keycode, keyrecord_t *record);