diff --git a/keyboard/hhkb_rn42/MEMO.txt b/keyboard/hhkb_rn42/MEMO.txt
index 100b4442d66..86f5faef2d6 100644
--- a/keyboard/hhkb_rn42/MEMO.txt
+++ b/keyboard/hhkb_rn42/MEMO.txt
@@ -8,6 +8,7 @@ Roving RN-42
TODO
----
+- LUFA sendchar should be buffered and serial_uart.c buffur size is too large(256).
- Factroy reset doesn't work; need to test again. 10K pull-up is too high?
- Lipo voltage ADC sensing
- Lipo charger configuration: fast charge time: USB charger spec?
diff --git a/keyboard/hhkb_rn42/config.h b/keyboard/hhkb_rn42/config.h
index cd8fc176de3..e641a5a2bbc 100644
--- a/keyboard/hhkb_rn42/config.h
+++ b/keyboard/hhkb_rn42/config.h
@@ -57,20 +57,23 @@ along with this program. If not, see .
#define RTSEN 0
#define CTSEN 1
- #define SERIAL_UART_BAUD 115200
- #define SERIAL_UART_DATA UDR1
- #define SERIAL_UART_UBRR ((F_CPU/(16.0*SERIAL_UART_BAUD)-1+0.5))
- #define SERIAL_UART_RXD_VECT USART1_RX_vect
- #define SERIAL_UART_TXD_READY (UCSR1A&(1<>8); /* baud rate */ \
UCSR1B |= (1< 2) SERIAL_UART_RTS_LO(); } while (0)
+ // prohibit to send
+ #define rbuf_check_rts_hi() do { if (RBUF_SPACE() <= 2) SERIAL_UART_RTS_HI(); } while (0)
+#else
+ #define rbuf_check_rts_lo()
+ #define rbuf_check_rts_hi()
+#endif
+
+
void serial_init(void)
{
SERIAL_UART_INIT();
@@ -61,6 +77,7 @@ uint8_t serial_recv(void)
data = rbuf[rbuf_tail];
rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE;
+ rbuf_check_rts_lo();
return data;
}
@@ -73,6 +90,7 @@ int16_t serial_recv2(void)
data = rbuf[rbuf_tail];
rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE;
+ rbuf_check_rts_lo();
return data;
}
@@ -90,4 +108,5 @@ ISR(SERIAL_UART_RXD_VECT)
rbuf[rbuf_head] = SERIAL_UART_DATA;
rbuf_head = next;
}
+ rbuf_check_rts_hi();
}