summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-05-15 19:28:15 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-05-15 19:28:15 +0300
commita20d513e3cdacbf6e0e70a80402497ad10166434 (patch)
tree3a094c4f0222424c6085e291e67337b1b5b61c80
parenta0297a892ee1fc571cd9bdc447d2c2726a210629 (diff)
Add function to check if the keyboard is a master
-rw-r--r--serial_link/system/serial_link.c6
-rw-r--r--serial_link/system/serial_link.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/serial_link/system/serial_link.c b/serial_link/system/serial_link.c
index 27e61a9e97..75c7e77a76 100644
--- a/serial_link/system/serial_link.c
+++ b/serial_link/system/serial_link.c
@@ -35,6 +35,7 @@ SOFTWARE.
static event_source_t new_data_event;
static bool serial_link_connected;
+static bool is_master = false;
static uint8_t keyboard_leds(void);
static void send_keyboard(report_keyboard_t *report);
@@ -109,6 +110,10 @@ static void print_error(char* str, eventflags_t flags, SerialDriver* driver) {
#endif
}
+bool is_serial_link_master(void) {
+ return is_master;
+}
+
// TODO: Optimize the stack size, this is probably way too big
static THD_WORKING_AREA(serialThreadStack, 1024);
static THD_FUNCTION(serialThread, arg) {
@@ -128,7 +133,6 @@ static THD_FUNCTION(serialThread, arg) {
EVENT_MASK(2),
events);
bool need_wait = false;
- bool is_master = false;
while(true) {
eventflags_t flags1 = 0;
eventflags_t flags2 = 0;
diff --git a/serial_link/system/serial_link.h b/serial_link/system/serial_link.h
index 132cb657ff..351e03877b 100644
--- a/serial_link/system/serial_link.h
+++ b/serial_link/system/serial_link.h
@@ -31,6 +31,7 @@ SOFTWARE.
void init_serial_link(void);
void init_serial_link_hal(void);
bool is_serial_link_connected(void);
+bool is_serial_link_master(void);
host_driver_t* get_serial_link_driver(void);
void serial_link_update(void);