aboutsummaryrefslogtreecommitdiff
path: root/converter/x68k_usb
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-06-21 21:48:18 +0900
committertmk <nobody@nowhere>2013-06-22 02:33:08 +0900
commitf45f4193f221d3ede706e02fc6b67916f90adf36 (patch)
treeae0eebc099b4867637a1880a2149b62e5d045ecb /converter/x68k_usb
parent42c962412b92a0ab4bd26c95f25867c645064bd6 (diff)
downloadqmk_firmware-f45f4193f221d3ede706e02fc6b67916f90adf36.tar.gz
qmk_firmware-f45f4193f221d3ede706e02fc6b67916f90adf36.zip
Use serial_uart.c instead of x68k.c now
Diffstat (limited to 'converter/x68k_usb')
-rw-r--r--converter/x68k_usb/Makefile3
-rw-r--r--converter/x68k_usb/config_pjrc.h18
-rw-r--r--converter/x68k_usb/led.c5
-rw-r--r--converter/x68k_usb/matrix.c13
4 files changed, 13 insertions, 26 deletions
diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile
index fd66ed563..948622c7c 100644
--- a/converter/x68k_usb/Makefile
+++ b/converter/x68k_usb/Makefile
@@ -16,8 +16,7 @@ TARGET_DIR = .
16SRC = keymap.c \ 16SRC = keymap.c \
17 matrix.c \ 17 matrix.c \
18 led.c \ 18 led.c \
19 protocol/x68k.c 19 protocol/serial_uart.c
20# protocol/serial_uart.c
21 20
22CONFIG_H = config_pjrc.h 21CONFIG_H = config_pjrc.h
23 22
diff --git a/converter/x68k_usb/config_pjrc.h b/converter/x68k_usb/config_pjrc.h
index dd277cff1..c49b4a73e 100644
--- a/converter/x68k_usb/config_pjrc.h
+++ b/converter/x68k_usb/config_pjrc.h
@@ -34,7 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
34/* key combination for command */ 34/* key combination for command */
35#define IS_COMMAND() ( \ 35#define IS_COMMAND() ( \
36 keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \ 36 keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
37 keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \ 37 keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
38 keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) \
38) 39)
39 40
40/* legacy keymap support */ 41/* legacy keymap support */
@@ -45,17 +46,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
45 * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control 46 * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control
46 */ 47 */
47#ifdef __AVR_ATmega32U4__ 48#ifdef __AVR_ATmega32U4__
48# define KBD_RX_VECT USART1_RX_vect
49# define KBD_RX_DATA UDR1
50# define KBD_RX_BAUD 2400
51# define KBD_RX_UBBR ((F_CPU/(16UL*KBD_RX_BAUD))-1)
52# define KBD_RX_INIT() do { \
53 UBRR1L = (uint8_t) KBD_RX_UBBR; \
54 UBRR1H = (uint8_t) (KBD_RX_UBBR>>8); \
55 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1) | (1<<TXEN1); \
56 } while(0)
57
58
59 #define SERIAL_UART_BAUD 2400 49 #define SERIAL_UART_BAUD 2400
60 #define SERIAL_UART_DATA UDR1 50 #define SERIAL_UART_DATA UDR1
61 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) 51 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
@@ -66,8 +56,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
66 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \ 56 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
67 UCSR1B = (1<<RXCIE1) | (1<<RXEN1) | /* RX: interrupt, RX: enable */ \ 57 UCSR1B = (1<<RXCIE1) | (1<<RXEN1) | /* RX: interrupt, RX: enable */ \
68 (1<<TXEN1); /* TX: enable */ \ 58 (1<<TXEN1); /* TX: enable */ \
69 UCSR1C = (1<<UPM11) | (1<<UPM10) | /* parity: none(00), even(01), odd(11) */ \ 59 UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
70 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* 8bit-data(011) */ \ 60 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
71 sei(); \ 61 sei(); \
72 } while(0) 62 } while(0)
73#else 63#else
diff --git a/converter/x68k_usb/led.c b/converter/x68k_usb/led.c
index a1c1d546e..ccc38699c 100644
--- a/converter/x68k_usb/led.c
+++ b/converter/x68k_usb/led.c
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#include "serial.h" 19#include "serial.h"
20#include "led.h" 20#include "led.h"
21#include "debug.h" 21#include "debug.h"
22#include "x68k.h"
23 22
24 23
25void led_set(uint8_t usb_led) 24void led_set(uint8_t usb_led)
@@ -35,12 +34,10 @@ void led_set(uint8_t usb_led)
35 * bit 0 かな 34 * bit 0 かな
36 */ 35 */
37 uint8_t led = 0xFF; 36 uint8_t led = 0xFF;
38 xprintf("usb_led: %02X\n", usb_led);
39 if (usb_led&(1<<USB_LED_NUM_LOCK)) led &= ~(1<<2); 37 if (usb_led&(1<<USB_LED_NUM_LOCK)) led &= ~(1<<2);
40 if (usb_led&(1<<USB_LED_CAPS_LOCK)) led &= ~(1<<3); 38 if (usb_led&(1<<USB_LED_CAPS_LOCK)) led &= ~(1<<3);
41 if (usb_led&(1<<USB_LED_SCROLL_LOCK)) led &= ~(1<<1); 39 if (usb_led&(1<<USB_LED_SCROLL_LOCK)) led &= ~(1<<1);
42 if (usb_led&(1<<USB_LED_COMPOSE)) led &= ~(1<<4); 40 if (usb_led&(1<<USB_LED_COMPOSE)) led &= ~(1<<4);
43 if (usb_led&(1<<USB_LED_KANA)) led &= ~(1<<0); 41 if (usb_led&(1<<USB_LED_KANA)) led &= ~(1<<0);
44 xprintf("led: %02X\n", led); 42 serial_send(led);
45 x68k_send(led);
46} 43}
diff --git a/converter/x68k_usb/matrix.c b/converter/x68k_usb/matrix.c
index 954e7ef12..2d5a1e116 100644
--- a/converter/x68k_usb/matrix.c
+++ b/converter/x68k_usb/matrix.c
@@ -21,8 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21#include <util/delay.h> 21#include <util/delay.h>
22#include "print.h" 22#include "print.h"
23#include "util.h" 23#include "util.h"
24#include "x68k.h" 24#include "serial.h"
25#include "matrix.h" 25#include "matrix.h"
26#include "debug.h"
26 27
27 28
28/* 29/*
@@ -63,7 +64,7 @@ uint8_t matrix_cols(void)
63 64
64void matrix_init(void) 65void matrix_init(void)
65{ 66{
66 x68k_init(); 67 serial_init();
67 68
68 // initialize matrix state: all keys off 69 // initialize matrix state: all keys off
69 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; 70 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
@@ -75,13 +76,13 @@ uint8_t matrix_scan(void)
75{ 76{
76 is_modified = false; 77 is_modified = false;
77 78
78 uint8_t code; 79 uint16_t code;
79 code = x68k_recv(); 80 code = serial_recv2();
80 if (code == 0) { 81 if (code == -1) {
81 return 0; 82 return 0;
82 } 83 }
83 84
84 phex(code); print(" "); 85 dprintf("%02X\n", code);
85 if (code&0x80) { 86 if (code&0x80) {
86 // break code 87 // break code
87 if (matrix_is_on(ROW(code), COL(code))) { 88 if (matrix_is_on(ROW(code), COL(code))) {