aboutsummaryrefslogtreecommitdiff
path: root/keyboards/dichotomy
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-02-06 09:20:48 +1100
committerGitHub <noreply@github.com>2021-02-06 09:20:48 +1100
commit5ea92a9c1cbe3e20bf4830d550d797a8e9650da8 (patch)
tree75ea1413ae4fa23bd0b1230629b6a3b3e215c5eb /keyboards/dichotomy
parent464eb7137d27e3a31e85032c85c9fda627a8b33f (diff)
downloadqmk_firmware-5ea92a9c1cbe3e20bf4830d550d797a8e9650da8.tar.gz
qmk_firmware-5ea92a9c1cbe3e20bf4830d550d797a8e9650da8.zip
Serial refactor (#11521)
Diffstat (limited to 'keyboards/dichotomy')
-rw-r--r--keyboards/dichotomy/config.h18
-rwxr-xr-xkeyboards/dichotomy/dichotomy.c16
-rwxr-xr-xkeyboards/dichotomy/matrix.c3
-rwxr-xr-xkeyboards/dichotomy/rules.mk11
4 files changed, 8 insertions, 40 deletions
diff --git a/keyboards/dichotomy/config.h b/keyboards/dichotomy/config.h
index 05210198c..0cdaf776b 100644
--- a/keyboards/dichotomy/config.h
+++ b/keyboards/dichotomy/config.h
@@ -60,19 +60,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
60 60
61//UART settings for communication with the RF microcontroller 61//UART settings for communication with the RF microcontroller
62#define SERIAL_UART_BAUD 1000000 62#define SERIAL_UART_BAUD 1000000
63#define SERIAL_UART_DATA UDR1
64#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
65#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
66#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) 63#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
67#define SERIAL_UART_INIT() do { \ 64#define SERIAL_UART_INIT_CUSTOM \
68 /* baud rate */ \ 65 /* enable TX and RX */ \
69 UBRR1L = SERIAL_UART_UBRR; \ 66 UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
70 /* baud rate */ \ 67 /* 8-bit data */ \
71 UBRR1H = SERIAL_UART_UBRR >> 8; \ 68 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10);
72 /* enable TX and RX */ \
73 UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
74 /* 8-bit data */ \
75 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
76 } while(0)
77 69
78#endif 70#endif
diff --git a/keyboards/dichotomy/dichotomy.c b/keyboards/dichotomy/dichotomy.c
index b94030a37..967d7e603 100755
--- a/keyboards/dichotomy/dichotomy.c
+++ b/keyboards/dichotomy/dichotomy.c
@@ -1,12 +1,7 @@
1#include "dichotomy.h" 1#include "dichotomy.h"
2 2
3void uart_init(void) {
4 SERIAL_UART_INIT();
5}
6
7void pointing_device_task(void){ 3void pointing_device_task(void){
8 /*report_mouse_t currentReport = {}; 4 /*report_mouse_t currentReport = {};
9 SERIAL_UART_INIT();
10 uint32_t timeout = 0; 5 uint32_t timeout = 0;
11 6
12 //the m character requests the RF slave to send the mouse report 7 //the m character requests the RF slave to send the mouse report
@@ -77,16 +72,5 @@ void matrix_init_kb(void) {
77 // put your keyboard start-up code here 72 // put your keyboard start-up code here
78 // runs once when the firmware starts up 73 // runs once when the firmware starts up
79 matrix_init_user(); 74 matrix_init_user();
80 uart_init();
81 led_init(); 75 led_init();
82} 76}
83
84void matrix_scan_kb(void) {
85 // put your looping keyboard code here
86 // runs every cycle (a lot)
87 matrix_scan_user();
88}
89
90void led_set_kb(uint8_t usb_led) {
91
92}
diff --git a/keyboards/dichotomy/matrix.c b/keyboards/dichotomy/matrix.c
index d93889e6a..2400753cc 100755
--- a/keyboards/dichotomy/matrix.c
+++ b/keyboards/dichotomy/matrix.c
@@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
29#include "dichotomy.h" 29#include "dichotomy.h"
30#include "pointing_device.h" 30#include "pointing_device.h"
31#include "report.h" 31#include "report.h"
32#include "protocol/serial.h"
32 33
33#if (MATRIX_COLS <= 8) 34#if (MATRIX_COLS <= 8)
34# define print_matrix_header() print("\nr/c 01234567\n") 35# define print_matrix_header() print("\nr/c 01234567\n")
@@ -93,11 +94,11 @@ uint8_t matrix_cols(void) {
93 94
94void matrix_init(void) { 95void matrix_init(void) {
95 matrix_init_quantum(); 96 matrix_init_quantum();
97 serial_init();
96} 98}
97 99
98uint8_t matrix_scan(void) 100uint8_t matrix_scan(void)
99{ 101{
100 SERIAL_UART_INIT();
101 //xprintf("\r\nTRYING TO SCAN"); 102 //xprintf("\r\nTRYING TO SCAN");
102 103
103 uint32_t timeout = 0; 104 uint32_t timeout = 0;
diff --git a/keyboards/dichotomy/rules.mk b/keyboards/dichotomy/rules.mk
index 14dc47435..d6f98125e 100755
--- a/keyboards/dichotomy/rules.mk
+++ b/keyboards/dichotomy/rules.mk
@@ -29,14 +29,5 @@ NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
29UNICODE_ENABLE = YES # Unicode 29UNICODE_ENABLE = YES # Unicode
30# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID 30# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
31 31
32USB = /dev/ttyACM0
33
34OPT_DEFS += -DDICHOTOMY_PROMICRO
35DICHOTOMY_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \
36 avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
37
38# # project specific files 32# # project specific files
39SRC = matrix.c 33SRC += matrix.c serial_uart.c
40
41#upload: build
42# $(DICHOTOMY_UPLOAD_COMMAND)