diff --git a/common/keyboard.c b/common/keyboard.c
index e973c46d..b0e0ed79 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -555,6 +555,7 @@ void keyboard_init(void)
void keyboard_task(void)
{
static matrix_row_t matrix_prev[MATRIX_ROWS];
+ static uint8_t led_status = 0;
matrix_row_t matrix_row = 0;
matrix_row_t matrix_change = 0;
@@ -617,6 +618,12 @@ void keyboard_task(void)
}
}
+ // update LED
+ if (led_status != host_keyboard_leds()) {
+ led_status = host_keyboard_leds();
+ keyboard_set_leds(led_status);
+ }
+
return;
}
diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h
index 66961d93..b4f0ff97 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<>= 1;
+#else
+ mask <<= 1;
+#endif
+ }
+
+ /* stop bit */
+ SERIAL_TXD_ON();
+ _delay_us(WAIT_US);
+}
+
+/* detect edge of start bit */
ISR(SERIAL_RXD_VECT)
{
SERIAL_RXD_INT_ENTER()
uint8_t data = 0;
#ifdef SERIAL_BIT_ORDER_MSB
- uint8_t pos = 0x80;
+ uint8_t mask = 0x80;
#else
- uint8_t pos = 0x01;
+ uint8_t mask = 0x01;
#endif
- // to center of start bit
+ /* to center of start bit */
_delay_us(WAIT_US/2);
do {
- // to center of next bit
+ /* to center of next bit */
_delay_us(WAIT_US);
- if (SERIAL_RXD_PIN&(1<>= 1;
+ mask >>= 1;
#else
- pos <<= 1;
+ mask <<= 1;
#endif
- } while (pos);
- // to center of stop bit
+ } while (mask);
+ /* to center of stop bit */
_delay_us(WAIT_US);
-#ifdef SERIAL_NEGATIVE_LOGIC
- data = ~data;
-#endif
-
uint8_t next = (rbuf_head + 1) % RBUF_SIZE;
if (next != rbuf_tail) {
rbuf[rbuf_head] = data;