From edce1d19a6af040df994243e7b6b1851e3eccebc Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 21 Oct 2012 22:12:36 +0900 Subject: Add LED feature to Sun converter --- converter/sun_usb/config.h | 17 ++++++++++++++++- converter/sun_usb/led.c | 10 +++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'converter') diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h index 66961d9330..b4f0ff977a 100644 --- a/converter/sun_usb/config.h +++ b/converter/sun_usb/config.h @@ -43,8 +43,8 @@ along with this program. If not, see . * asynchronous, negative logic, 1200baud, no flow control * 1-start bit, 8-data bit, non parity, 1-stop bit */ -#define SERIAL_NEGATIVE_LOGIC #define SERIAL_BAUD 1200 + #define SERIAL_RXD_DDR DDRD #define SERIAL_RXD_PORT PORTD #define SERIAL_RXD_PIN PIND @@ -63,5 +63,20 @@ along with this program. If not, see . /* clear interrupt flag */ \ EIFR = (1<. */ #include "stdint.h" +#include "serial.h" #include "led.h" void led_set(uint8_t usb_led) { - // not supported now + uint8_t sun_led = 0; + if (usb_led & (1< Date: Sun, 21 Oct 2012 22:36:44 +0900 Subject: Add extra commands Bell/Click to Sun converter --- converter/sun_usb/Makefile | 1 + converter/sun_usb/command_extra.c | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 converter/sun_usb/command_extra.c (limited to 'converter') diff --git a/converter/sun_usb/Makefile b/converter/sun_usb/Makefile index 4c79a8d278..c6e8390cc9 100644 --- a/converter/sun_usb/Makefile +++ b/converter/sun_usb/Makefile @@ -11,6 +11,7 @@ TARGET_DIR = . SRC = keymap.c \ matrix.c \ led.c \ + command_extra.c \ protocol/serial_soft.c CONFIG_H = config.h diff --git a/converter/sun_usb/command_extra.c b/converter/sun_usb/command_extra.c new file mode 100644 index 0000000000..50389467ea --- /dev/null +++ b/converter/sun_usb/command_extra.c @@ -0,0 +1,43 @@ +#include "stdbool.h" +#include "stdint.h" +#include "keycode.h" +#include "serial.h" +#include "print.h" +#include "command.h" + +bool command_extra(uint8_t code) +{ + switch (code) { + case KC_H: + case KC_SLASH: /* ? */ + print("\n\n----- Sun converter Help -----\n"); + print("UP: Bell On\n"); + print("DOWN: Bell Off\n"); + print("LEFT: Click On\n"); + print("RIGHT: Click Off\n"); + return false; + case KC_UP: + print("Bell On\n"); + serial_send(0x02); + break; + case KC_DOWN: + print("Bell Off\n"); + serial_send(0x03); + break; + case KC_LEFT: + print("Click On\n"); + serial_send(0x0A); + break; + case KC_RIGHT: + print("Click Off\n"); + serial_send(0x0B); + break; + case KC_NUMLOCK: + print("layout\n"); + serial_send(0x0F); + break; + default: + return false; + } + return true; +} -- cgit v1.2.3