diff options
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_device_epsize.h | 2 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/adafruit_ble.cpp | 45 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/adafruit_ble.h | 11 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 2 |
4 files changed, 27 insertions, 33 deletions
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_device_epsize.h b/tmk_core/protocol/arm_atsam/usb/udi_device_epsize.h index 65339bffec..09de475469 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_device_epsize.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_device_epsize.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define KEYBOARD_EPSIZE 8 #define MOUSE_EPSIZE 8 #define EXTRAKEY_EPSIZE 8 -#define RAW_EPSIZE 64 +#define RAW_EPSIZE 32 #define CONSOLE_EPSIZE 32 #define NKRO_EPSIZE 32 #define MIDI_STREAM_EPSIZE 64 diff --git a/tmk_core/protocol/lufa/adafruit_ble.cpp b/tmk_core/protocol/lufa/adafruit_ble.cpp index 79b35fca31..3f2cc35734 100644 --- a/tmk_core/protocol/lufa/adafruit_ble.cpp +++ b/tmk_core/protocol/lufa/adafruit_ble.cpp @@ -11,6 +11,7 @@ #include "spi_master.h" #include "wait.h" #include "analog.h" +#include "progmem.h" // These are the pin assignments for the 32u4 boards. // You may define them to something else in your config.h @@ -36,10 +37,8 @@ #define SAMPLE_BATTERY #define ConnectionUpdateInterval 1000 /* milliseconds */ -#ifdef SAMPLE_BATTERY -# ifndef BATTERY_LEVEL_PIN -# define BATTERY_LEVEL_PIN B5 -# endif +#ifndef BATTERY_LEVEL_PIN +# define BATTERY_LEVEL_PIN B5 #endif static struct { @@ -118,15 +117,15 @@ enum sdep_type { SdepResponse = 0x20, SdepAlert = 0x40, SdepError = 0x80, - SdepSlaveNotReady = 0xfe, // Try again later - SdepSlaveOverflow = 0xff, // You read more data than is available + SdepSlaveNotReady = 0xFE, // Try again later + SdepSlaveOverflow = 0xFF, // You read more data than is available }; enum ble_cmd { - BleInitialize = 0xbeef, - BleAtWrapper = 0x0a00, - BleUartTx = 0x0a01, - BleUartRx = 0x0a02, + BleInitialize = 0xBEEF, + BleAtWrapper = 0x0A00, + BleUartTx = 0x0A01, + BleUartRx = 0x0A02, }; enum ble_system_event_bits { @@ -176,7 +175,7 @@ static bool sdep_send_pkt(const struct sdep_msg *msg, uint16_t timeout) { static inline void sdep_build_pkt(struct sdep_msg *msg, uint16_t command, const uint8_t *payload, uint8_t len, bool moredata) { msg->type = SdepCommand; - msg->cmd_low = command & 0xff; + msg->cmd_low = command & 0xFF; msg->cmd_high = command >> 8; msg->len = len; msg->more = (moredata && len == SdepMaxPayload) ? 1 : 0; @@ -407,11 +406,11 @@ static bool at_command(const char *cmd, char *resp, uint16_t resplen, bool verbo } if (resp == NULL) { - auto now = timer_read(); + uint16_t now = timer_read(); while (!resp_buf.enqueue(now)) { resp_buf_read_one(false); } - auto later = timer_read(); + uint16_t later = timer_read(); if (TIMER_DIFF_16(later, now) > 0) { dprintf("waited %dms for resp_buf\n", TIMER_DIFF_16(later, now)); } @@ -422,7 +421,7 @@ static bool at_command(const char *cmd, char *resp, uint16_t resplen, bool verbo } bool at_command_P(const char *cmd, char *resp, uint16_t resplen, bool verbose) { - auto cmdbuf = (char *)alloca(strlen_P(cmd) + 1); + char *cmdbuf = (char *)alloca(strlen_P(cmd) + 1); strcpy_P(cmdbuf, cmd); return at_command(cmdbuf, resp, resplen, verbose); } @@ -484,9 +483,9 @@ fail: static void set_connected(bool connected) { if (connected != state.is_connected) { if (connected) { - print("****** BLE CONNECT!!!!\n"); + dprint("BLE connected\n"); } else { - print("****** BLE DISCONNECT!!!!\n"); + dprint("BLE disconnected\n"); } state.is_connected = connected; @@ -612,7 +611,7 @@ static bool process_queue_item(struct queue_item *item, uint16_t timeout) { } } -bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys) { +void adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys) { struct queue_item item; bool didWait = false; @@ -638,30 +637,27 @@ bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nk } if (nkeys <= 6) { - return true; + return; } nkeys -= 6; keys += 6; } - - return true; } -bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration) { +void adafruit_ble_send_consumer_key(uint16_t usage) { struct queue_item item; item.queue_type = QTConsumer; - item.consumer = keycode; + item.consumer = usage; while (!send_buf.enqueue(item)) { send_buf_send_one(); } - return true; } #ifdef MOUSE_ENABLE -bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons) { +void adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons) { struct queue_item item; item.queue_type = QTMouseMove; @@ -674,7 +670,6 @@ bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, while (!send_buf.enqueue(item)) { send_buf_send_one(); } - return true; } #endif diff --git a/tmk_core/protocol/lufa/adafruit_ble.h b/tmk_core/protocol/lufa/adafruit_ble.h index 9dfc9b4355..b43e0771d9 100644 --- a/tmk_core/protocol/lufa/adafruit_ble.h +++ b/tmk_core/protocol/lufa/adafruit_ble.h @@ -10,7 +10,6 @@ #include <string.h> #include "config_common.h" -#include "progmem.h" #ifdef __cplusplus extern "C" { @@ -35,17 +34,17 @@ extern void adafruit_ble_task(void); * this set of keys. * Also sends a key release indicator, so that the keys do not remain * held down. */ -extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys); +extern void adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys); -/* Send a consumer keycode, holding it down for the specified duration +/* Send a consumer usage. * (milliseconds) */ -extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration); +extern void adafruit_ble_send_consumer_key(uint16_t usage); #ifdef MOUSE_ENABLE /* Send a mouse/wheel movement report. - * The parameters are signed and indicate positive of negative direction + * The parameters are signed and indicate positive or negative direction * change. */ -extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons); +extern void adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons); #endif /* Compute battery voltage by reading an analog pin. diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 8fd4be8af5..623aa33ff5 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -809,7 +809,7 @@ static void send_consumer(uint16_t data) { if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { # ifdef MODULE_ADAFRUIT_BLE - adafruit_ble_send_consumer_key(data, 0); + adafruit_ble_send_consumer_key(data); # elif MODULE_RN42 static uint16_t last_data = 0; if (data == last_data) return; |