void rn42_init(void)
{
- // PF7: BT connection control(HiZ: connect, low: disconnect)
// JTAG disable for PORT F. write JTD bit twice within four cycles.
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
+
+ // PF7: BT connection control(high: connect, low: disconnect)
rn42_autoconnect();
+ // PF6: linked(input without pull-up)
+ DDRF &= ~(1<<6);
+ PORTF |= (1<<6);
+
// PF1: RTS(low: allowed to send, high: not allowed)
DDRF &= ~(1<<1);
PORTF &= ~(1<<1);
PORTD &= ~(1<<5);
}
+bool rn42_linked(void)
+{
+ // RN-42 GPIO2
+ // Hi-Z: Not powered
+ // High: Linked
+ // Low: Connecting
+ return !rn42_rts() && PINF&(1<<6);
+}
+
-static uint8_t keyboard_leds(void) { return 0; }
+static uint8_t leds = 0;
+static uint8_t keyboard_leds(void) { return leds; }
+void rn42_set_leds(uint8_t l) { leds = l; }
static void send_keyboard(report_keyboard_t *report)
{
config_send_consumer
};
-static uint8_t config_keyboard_leds(void) { return 0; }
+static uint8_t config_keyboard_leds(void) { return leds; }
static void config_send_keyboard(report_keyboard_t *report) {}
static void config_send_mouse(report_mouse_t *report) {}
static void config_send_system(uint16_t data) {}