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 drivermaster
parent
c0bb153151
commit
c12268807d
|
@ -356,7 +356,7 @@ endif
|
||||||
ifeq ($(strip $(PRINTING_ENABLE)), yes)
|
ifeq ($(strip $(PRINTING_ENABLE)), yes)
|
||||||
OPT_DEFS += -DPRINTING_ENABLE
|
OPT_DEFS += -DPRINTING_ENABLE
|
||||||
SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
|
SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
|
||||||
SRC += $(TMK_DIR)/protocol/serial_uart.c
|
QUANTUM_LIB_SRC += uart.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VARIABLE_TRACE ?= no
|
VARIABLE_TRACE ?= no
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LT3_TAB LT(3, KC_TAB)
|
#define LT3_TAB LT(3, KC_TAB)
|
||||||
|
@ -108,11 +108,11 @@ LAYOUT( /* Tab */
|
||||||
//LED keymap functions
|
//LED keymap functions
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
void led_chmode(void) {
|
void led_chmode(void) {
|
||||||
serial_send(101);
|
uart_write(0x65);
|
||||||
}
|
}
|
||||||
|
|
||||||
void led_toggle(void) {
|
void led_toggle(void) {
|
||||||
serial_send(100);
|
uart_write(0x64);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LT3_TAB LT(3, KC_TAB)
|
#define LT3_TAB LT(3, KC_TAB)
|
||||||
|
@ -108,11 +108,11 @@ LAYOUT( /* Tab */
|
||||||
//LED keymap functions
|
//LED keymap functions
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
void led_chmode(void) {
|
void led_chmode(void) {
|
||||||
serial_send(101);
|
uart_write(0x65);
|
||||||
}
|
}
|
||||||
|
|
||||||
void led_toggle(void) {
|
void led_toggle(void) {
|
||||||
serial_send(100);
|
uart_write(0x64);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -151,11 +151,11 @@ LAYOUT( /* GAMING, toggled on and off - L5 */
|
||||||
//LED keymap functions
|
//LED keymap functions
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
void led_chmode(void) {
|
void led_chmode(void) {
|
||||||
serial_send(101);
|
uart_write(0x65);
|
||||||
}
|
}
|
||||||
|
|
||||||
void led_toggle(void) {
|
void led_toggle(void) {
|
||||||
serial_send(100);
|
uart_write(0x64);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LT3_TAB LT(3, KC_TAB)
|
#define LT3_TAB LT(3, KC_TAB)
|
||||||
|
@ -60,11 +60,11 @@ LAYOUT( /* Tab */
|
||||||
//LED keymap functions
|
//LED keymap functions
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
void led_chmode(void) {
|
void led_chmode(void) {
|
||||||
serial_send(101);
|
uart_write(0x65);
|
||||||
}
|
}
|
||||||
|
|
||||||
void led_toggle(void) {
|
void led_toggle(void) {
|
||||||
serial_send(100);
|
uart_write(0x64);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
|
@ -26,10 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#ifdef LED_ENABLE
|
|
||||||
#include "protocol/serial.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DEBOUNCE
|
#ifndef DEBOUNCE
|
||||||
# define DEBOUNCE 5
|
# define DEBOUNCE 5
|
||||||
|
@ -69,10 +65,6 @@ void matrix_init(void)
|
||||||
matrix[i] = 0;
|
matrix[i] = 0;
|
||||||
matrix_debouncing[i] = 0;
|
matrix_debouncing[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LED_ENABLE
|
|
||||||
serial_init();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
|
|
@ -18,4 +18,5 @@ AUDIO_ENABLE = no # Audio output
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC += matrix.c protocol/serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -15,15 +15,19 @@
|
||||||
*/
|
*/
|
||||||
#include "ut47.h"
|
#include "ut47.h"
|
||||||
#ifdef LED_ENABLE
|
#ifdef LED_ENABLE
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void matrix_init_kb() {
|
||||||
|
uart_init(9600);
|
||||||
|
}
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
// put your per-action keyboard code here
|
// put your per-action keyboard code here
|
||||||
// runs for every action, just before processing by the firmware
|
// runs for every action, just before processing by the firmware
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef LED_ENABLE
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
return process_record_user(keycode, record);
|
return process_record_user(keycode, record);
|
||||||
|
|
|
@ -56,12 +56,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -80,7 +80,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(500000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -88,7 +88,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF remote slave to send the matrix information
|
//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
|
//trust the external keystates, erase the last set of data
|
||||||
uint8_t uart_data[11] = {0};
|
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
|
//there are 10 bytes corresponding to 1w columns, and an end byte
|
||||||
for (uint8_t i = 0; i < 11; i++) {
|
for (uint8_t i = 0; i < 11; i++) {
|
||||||
//wait for the serial data, timeout if it's been too long
|
//wait for the serial data, timeout if it's been too long
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -21,6 +21,7 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
UNICODE_ENABLE = yes # Unicode
|
UNICODE_ENABLE = yes # Unicode
|
||||||
|
|
||||||
# # project specific files
|
# # project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
||||||
LAYOUTS = split_3x5_3 split_3x6_3
|
LAYOUTS = split_3x5_3 split_3x6_3
|
||||||
|
|
|
@ -56,12 +56,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -89,7 +89,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -97,7 +97,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[14] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -17,4 +17,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
|
||||||
# # project specific files
|
# # project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -56,12 +56,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -93,7 +93,7 @@ uint8_t matrix_cols(void) {
|
||||||
|
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -101,7 +101,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[11] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -17,7 +17,8 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
||||||
LAYOUTS = ortho_4x12
|
LAYOUTS = ortho_4x12
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -79,7 +79,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -87,7 +87,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[11] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -17,4 +17,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -56,12 +56,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -79,7 +79,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -87,7 +87,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[14] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -20,4 +20,5 @@ UNICODE_ENABLE = yes
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -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_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
|
||||||
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
|
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
|
||||||
#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
|
#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);
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -79,7 +79,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -87,7 +87,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[11] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -19,5 +19,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC += matrix.c \
|
SRC += matrix.c \
|
||||||
i2c.c \
|
i2c.c \
|
||||||
ssd1306.c \
|
ssd1306.c
|
||||||
serial_uart.c
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -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_LGUI) | MOD_BIT(KC_RGUI)) || \
|
||||||
get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
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)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ uint8_t rts_reset(void) {
|
||||||
uint8_t get_serial_byte(void) {
|
uint8_t get_serial_byte(void) {
|
||||||
static uint8_t code;
|
static uint8_t code;
|
||||||
while(1) {
|
while(1) {
|
||||||
code = serial_recv();
|
code = uart_read();
|
||||||
if (code) {
|
if (code) {
|
||||||
debug_hex(code); debug(" ");
|
debug_hex(code); debug(" ");
|
||||||
return code;
|
return code;
|
||||||
|
@ -240,7 +240,7 @@ void matrix_init(void)
|
||||||
debug_enable = true;
|
debug_enable = true;
|
||||||
//debug_matrix =true;
|
//debug_matrix =true;
|
||||||
|
|
||||||
serial_init(); // arguments all #defined
|
uart_init(9600); // arguments all #defined
|
||||||
|
|
||||||
#if (HANDSPRING == 0)
|
#if (HANDSPRING == 0)
|
||||||
pins_init(); // set all inputs and outputs.
|
pins_init(); // set all inputs and outputs.
|
||||||
|
@ -290,7 +290,7 @@ void matrix_init(void)
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
{
|
{
|
||||||
uint8_t code;
|
uint8_t code;
|
||||||
code = serial_recv();
|
code = uart_read();
|
||||||
if (!code) {
|
if (!code) {
|
||||||
/*
|
/*
|
||||||
disconnect_counter ++;
|
disconnect_counter ++;
|
||||||
|
|
|
@ -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
|
|
|
@ -20,5 +20,6 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
|
|
||||||
SRC += matrix.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
||||||
DEFAULT_FOLDER = converter/palm_usb/stowaway
|
DEFAULT_FOLDER = converter/palm_usb/stowaway
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
bool sun_bell = false;
|
bool sun_bell = false;
|
||||||
bool sun_click = false;
|
bool sun_click = false;
|
||||||
|
@ -20,41 +20,41 @@ bool command_extra(uint8_t code)
|
||||||
return false;
|
return false;
|
||||||
case KC_DEL:
|
case KC_DEL:
|
||||||
print("Reset\n");
|
print("Reset\n");
|
||||||
serial_send(0x01);
|
uart_write(0x01);
|
||||||
break;
|
break;
|
||||||
case KC_HOME:
|
case KC_HOME:
|
||||||
sun_bell = !sun_bell;
|
sun_bell = !sun_bell;
|
||||||
if (sun_bell) {
|
if (sun_bell) {
|
||||||
print("Bell On\n");
|
print("Bell On\n");
|
||||||
serial_send(0x02);
|
uart_write(0x02);
|
||||||
} else {
|
} else {
|
||||||
print("Bell Off\n");
|
print("Bell Off\n");
|
||||||
serial_send(0x03);
|
uart_write(0x03);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KC_END:
|
case KC_END:
|
||||||
sun_click = !sun_click;
|
sun_click = !sun_click;
|
||||||
if (sun_click) {
|
if (sun_click) {
|
||||||
print("Click On\n");
|
print("Click On\n");
|
||||||
serial_send(0x0A);
|
uart_write(0x0A);
|
||||||
} else {
|
} else {
|
||||||
print("Click Off\n");
|
print("Click Off\n");
|
||||||
serial_send(0x0B);
|
uart_write(0x0B);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KC_PGUP:
|
case KC_PGUP:
|
||||||
print("LED all on\n");
|
print("LED all on\n");
|
||||||
serial_send(0x0E);
|
uart_write(0x0E);
|
||||||
serial_send(0xFF);
|
uart_write(0xFF);
|
||||||
break;
|
break;
|
||||||
case KC_PGDOWN:
|
case KC_PGDOWN:
|
||||||
print("LED all off\n");
|
print("LED all off\n");
|
||||||
serial_send(0x0E);
|
uart_write(0x0E);
|
||||||
serial_send(0x00);
|
uart_write(0x00);
|
||||||
break;
|
break;
|
||||||
case KC_INSERT:
|
case KC_INSERT:
|
||||||
print("layout\n");
|
print("layout\n");
|
||||||
serial_send(0x0F);
|
uart_write(0x0F);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
xprintf("Unknown extra command: %02X\n", code);
|
xprintf("Unknown extra command: %02X\n", code);
|
||||||
|
|
|
@ -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_LGUI) | MOD_BIT(KC_RGUI)) || \
|
||||||
get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
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)
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
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);
|
if (usb_led & (1<<USB_LED_CAPS_LOCK)) sun_led |= (1<<3);
|
||||||
xprintf("LED: %02X\n", usb_led);
|
xprintf("LED: %02X\n", usb_led);
|
||||||
|
|
||||||
serial_send(0x0E);
|
uart_write(0x0E);
|
||||||
serial_send(sun_led);
|
uart_write(sun_led);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Matrix Array usage:
|
* Matrix Array usage:
|
||||||
|
@ -74,7 +74,7 @@ void matrix_init(void)
|
||||||
/* PORTD |= (1<<6); */
|
/* PORTD |= (1<<6); */
|
||||||
debug_enable = true;
|
debug_enable = true;
|
||||||
|
|
||||||
serial_init();
|
uart_init(1200);
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
// initialize matrix state: all keys off
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
||||||
|
@ -84,12 +84,12 @@ void matrix_init(void)
|
||||||
/* print("Reseting "); */
|
/* print("Reseting "); */
|
||||||
/* while (1) { */
|
/* while (1) { */
|
||||||
/* print("."); */
|
/* print("."); */
|
||||||
/* while (serial_recv()); */
|
/* while (uart_read()); */
|
||||||
/* serial_send(0x01); */
|
/* uart_write(0x01); */
|
||||||
/* _delay_ms(500); */
|
/* _delay_ms(500); */
|
||||||
/* if (serial_recv() == 0xFF) { */
|
/* if (uart_read() == 0xFF) { */
|
||||||
/* _delay_ms(500); */
|
/* _delay_ms(500); */
|
||||||
/* if (serial_recv() == 0x04) */
|
/* if (uart_read() == 0x04) */
|
||||||
/* break; */
|
/* break; */
|
||||||
/* } */
|
/* } */
|
||||||
/* } */
|
/* } */
|
||||||
|
@ -104,7 +104,7 @@ void matrix_init(void)
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
{
|
{
|
||||||
uint8_t code;
|
uint8_t code;
|
||||||
code = serial_recv();
|
code = uart_read();
|
||||||
if (!code) return 0;
|
if (!code) return 0;
|
||||||
|
|
||||||
debug_hex(code); debug(" ");
|
debug_hex(code); debug(" ");
|
||||||
|
@ -113,7 +113,7 @@ uint8_t matrix_scan(void)
|
||||||
case 0xFF: // reset success: FF 04
|
case 0xFF: // reset success: FF 04
|
||||||
print("reset: ");
|
print("reset: ");
|
||||||
_delay_ms(500);
|
_delay_ms(500);
|
||||||
code = serial_recv();
|
code = uart_read();
|
||||||
xprintf("%02X\n", code);
|
xprintf("%02X\n", code);
|
||||||
if (code == 0x04) {
|
if (code == 0x04) {
|
||||||
// LED status
|
// LED status
|
||||||
|
@ -123,12 +123,12 @@ uint8_t matrix_scan(void)
|
||||||
case 0xFE: // layout: FE <layout>
|
case 0xFE: // layout: FE <layout>
|
||||||
print("layout: ");
|
print("layout: ");
|
||||||
_delay_ms(500);
|
_delay_ms(500);
|
||||||
xprintf("%02X\n", serial_recv());
|
xprintf("%02X\n", uart_read());
|
||||||
return 0;
|
return 0;
|
||||||
case 0x7E: // reset fail: 7E 01
|
case 0x7E: // reset fail: 7E 01
|
||||||
print("reset fail: ");
|
print("reset fail: ");
|
||||||
_delay_ms(500);
|
_delay_ms(500);
|
||||||
xprintf("%02X\n", serial_recv());
|
xprintf("%02X\n", uart_read());
|
||||||
return 0;
|
return 0;
|
||||||
case 0x7F:
|
case 0x7F:
|
||||||
// all keys up
|
// all keys up
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
ifdef HARDWARE_SERIAL
|
|
||||||
SRC += protocol/serial_uart.c
|
|
||||||
OPT_DEFS += -DHARDWARE_SERIAL
|
|
||||||
else
|
|
||||||
SRC += protocol/serial_soft.c
|
|
||||||
endif
|
|
|
@ -20,5 +20,6 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
|
|
||||||
SRC += matrix.c led.c
|
SRC += matrix.c led.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
||||||
DEFAULT_FOLDER = converter/sun_usb/type5
|
DEFAULT_FOLDER = converter/sun_usb/type5
|
||||||
|
|
|
@ -56,12 +56,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#include "dichotomy.h"
|
#include "dichotomy.h"
|
||||||
|
|
||||||
|
//#include "uart.h"
|
||||||
|
|
||||||
void pointing_device_task(void){
|
void pointing_device_task(void){
|
||||||
/*report_mouse_t currentReport = {};
|
/*report_mouse_t currentReport = {};
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the m character requests the RF slave to send the mouse report
|
//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
|
//trust the external inputs completely, erase old data
|
||||||
uint8_t uart_data[5] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
xprintf("\r\nTIMED OUT");
|
xprintf("\r\nTIMED OUT");
|
||||||
|
@ -23,7 +25,7 @@ void pointing_device_task(void){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xprintf("\r\nGOT DATA for %d",i);
|
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
|
//check for the end packet, bytes 1-4 are movement and scroll
|
||||||
|
|
|
@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "dichotomy.h"
|
#include "dichotomy.h"
|
||||||
#include "pointing_device.h"
|
#include "pointing_device.h"
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -94,7 +94,7 @@ uint8_t matrix_cols(void) {
|
||||||
|
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -104,7 +104,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[11] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
xprintf("\r\nTime out in keyboard.");
|
xprintf("\r\nTime out in keyboard.");
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -18,4 +18,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
|
||||||
# # project specific files
|
# # project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -45,12 +45,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ void pointing_device_task(void){
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the m character requests the RF slave to send the mouse report
|
//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
|
//trust the external inputs completely, erase old data
|
||||||
uint8_t uart_data[5] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
xprintf("\r\nTIMED OUT");
|
xprintf("\r\nTIMED OUT");
|
||||||
|
@ -25,7 +25,7 @@ void pointing_device_task(void){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xprintf("\r\nGOT DATA for %d",i);
|
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
|
//check for the end packet, bytes 1-4 are movement and scroll
|
||||||
|
|
|
@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "honeycomb.h"
|
#include "honeycomb.h"
|
||||||
#include "pointing_device.h"
|
#include "pointing_device.h"
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -95,7 +95,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -103,7 +103,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
// The 's' character requests the RF slave to send the matrix
|
// 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
|
// Trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[4] = {0};
|
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
|
// Wait for the serial data, timeout if it's been too long
|
||||||
// This only happened in testing with a loose wire, but does no
|
// This only happened in testing with a loose wire, but does no
|
||||||
// harm to leave it in here
|
// harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
xprintf("\r\nTime out in keyboard.");
|
xprintf("\r\nTime out in keyboard.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uart_data[i] = SERIAL_UART_DATA;
|
uart_data[i] = uart_read();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for the end packet, it's our checksum.
|
// Check for the end packet, it's our checksum.
|
||||||
|
|
|
@ -18,4 +18,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
|
||||||
# # project specific files
|
# # project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -56,12 +56,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -80,7 +80,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -88,7 +88,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[11] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -18,4 +18,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
UNICODE_ENABLE = yes # Unicode
|
UNICODE_ENABLE = yes # Unicode
|
||||||
|
|
||||||
# # project specific files
|
# # project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
#ifndef CONFIG_USER_H
|
#pragma once
|
||||||
#define CONFIG_USER_H
|
|
||||||
|
|
||||||
#include "../../config.h"
|
|
||||||
|
|
||||||
#define SERIAL_UART_BAUD 19200
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MIDI options
|
* MIDI options
|
||||||
|
@ -21,8 +16,3 @@
|
||||||
- etc.
|
- etc.
|
||||||
*/
|
*/
|
||||||
//#define MIDI_ADVANCED
|
//#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
|
|
|
@ -55,12 +55,3 @@
|
||||||
//#define NO_ACTION_ONESHOT
|
//#define NO_ACTION_ONESHOT
|
||||||
//#define NO_ACTION_MACRO
|
//#define NO_ACTION_MACRO
|
||||||
//#define NO_ACTION_FUNCTION
|
//#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);
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -87,7 +87,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -95,7 +95,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[11] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -17,4 +17,5 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||||
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
|
||||||
# # project specific files
|
# # project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -57,13 +57,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define NO_ACTION_MACRO
|
#define NO_ACTION_MACRO
|
||||||
#define NO_ACTION_FUNCTION
|
#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
|
#define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
||||||
|
|
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "debounce.h"
|
#include "debounce.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -81,7 +81,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
debounce_init(MATRIX_ROWS);
|
debounce_init(MATRIX_ROWS);
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -91,7 +91,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[17] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -20,4 +20,5 @@ UNICODE_ENABLE = yes # Unicode
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
|
@ -57,13 +57,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define NO_ACTION_MACRO
|
#define NO_ACTION_MACRO
|
||||||
#define NO_ACTION_FUNCTION
|
#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
|
#define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
||||||
|
|
|
@ -57,13 +57,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define NO_ACTION_MACRO
|
#define NO_ACTION_MACRO
|
||||||
#define NO_ACTION_FUNCTION
|
#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
|
#define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
||||||
|
|
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "debounce.h"
|
#include "debounce.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
#if (MATRIX_COLS <= 8)
|
#if (MATRIX_COLS <= 8)
|
||||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
@ -81,7 +81,7 @@ uint8_t matrix_cols(void) {
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
debounce_init(MATRIX_ROWS);
|
debounce_init(MATRIX_ROWS);
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
|
@ -91,7 +91,7 @@ uint8_t matrix_scan(void)
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[17] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while(!SERIAL_UART_RXD_PRESENT){
|
while(!uart_available()){
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000){
|
if (timeout > 10000){
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -20,6 +20,7 @@ UNICODE_ENABLE = yes # Unicode
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
||||||
DEFAULT_FOLDER = sirius/uni660/rev2/ansi
|
DEFAULT_FOLDER = sirius/uni660/rev2/ansi
|
||||||
|
|
|
@ -72,12 +72,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
/* disable these deprecated features by default */
|
/* disable these deprecated features by default */
|
||||||
#define NO_ACTION_MACRO
|
#define NO_ACTION_MACRO
|
||||||
#define NO_ACTION_FUNCTION
|
#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);
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "protocol/serial.h"
|
#include "uart.h"
|
||||||
|
|
||||||
void matrix_init_custom(void) {
|
void matrix_init_custom(void) {
|
||||||
serial_init();
|
uart_init(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
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;
|
bool changed = false;
|
||||||
|
|
||||||
//the s character requests the RF slave to send the matrix
|
//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
|
//trust the external keystates entirely, erase the last data
|
||||||
uint8_t uart_data[13] = {0};
|
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
|
//wait for the serial data, timeout if it's been too long
|
||||||
//this only happened in testing with a loose wire, but does no
|
//this only happened in testing with a loose wire, but does no
|
||||||
//harm to leave it in here
|
//harm to leave it in here
|
||||||
while (!SERIAL_UART_RXD_PRESENT) {
|
while (!uart_available()) {
|
||||||
timeout++;
|
timeout++;
|
||||||
if (timeout > 10000) {
|
if (timeout > 10000) {
|
||||||
break;
|
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
|
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||||
|
|
|
@ -19,7 +19,8 @@ AUDIO_ENABLE = no # Audio output
|
||||||
CUSTOM_MATRIX = lite
|
CUSTOM_MATRIX = lite
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC += matrix.c serial_uart.c
|
SRC += matrix.c
|
||||||
|
QUANTUM_LIB_SRC += uart.c
|
||||||
|
|
||||||
# Disable unsupported hardware
|
# Disable unsupported hardware
|
||||||
RGBLIGHT_SUPPORTED = no
|
RGBLIGHT_SUPPORTED = no
|
||||||
|
|
|
@ -16,13 +16,14 @@
|
||||||
|
|
||||||
#include "process_printer.h"
|
#include "process_printer.h"
|
||||||
#include "action_util.h"
|
#include "action_util.h"
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
bool printing_enabled = false;
|
bool printing_enabled = false;
|
||||||
uint8_t character_shift = 0;
|
uint8_t character_shift = 0;
|
||||||
|
|
||||||
void enable_printing(void) {
|
void enable_printing(void) {
|
||||||
printing_enabled = true;
|
printing_enabled = true;
|
||||||
serial_init();
|
uart_init(19200);
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable_printing(void) { printing_enabled = false; }
|
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) {
|
void print_char(char c) {
|
||||||
USB_Disable();
|
USB_Disable();
|
||||||
serial_send(c);
|
uart_write(c);
|
||||||
USB_Init();
|
USB_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,4 @@
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#include "protocol/serial.h"
|
|
||||||
|
|
||||||
bool process_printer(uint16_t keycode, keyrecord_t *record);
|
bool process_printer(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
Loading…
Reference in New Issue