diff options
| author | QMK Bot <hello@qmk.fm> | 2022-02-12 10:29:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-12 18:29:31 +0000 |
| commit | 63646e8906e062d1c1de3925cba70c4e3426a855 (patch) | |
| tree | 4e91648b77b838e1125cf86331d7e84bde6d07a9 /drivers/bluetooth | |
| parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
Format code according to conventions (#16322)
Diffstat (limited to 'drivers/bluetooth')
| -rw-r--r-- | drivers/bluetooth/bluefruit_le.cpp | 26 | ||||
| -rw-r--r-- | drivers/bluetooth/outputselect.c | 2 | ||||
| -rw-r--r-- | drivers/bluetooth/rn42.c | 8 |
3 files changed, 22 insertions, 14 deletions
diff --git a/drivers/bluetooth/bluefruit_le.cpp b/drivers/bluetooth/bluefruit_le.cpp index 86581a1a48..19310767cf 100644 --- a/drivers/bluetooth/bluefruit_le.cpp +++ b/drivers/bluetooth/bluefruit_le.cpp | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | #ifndef BLUEFRUIT_LE_SCK_DIVISOR | 31 | #ifndef BLUEFRUIT_LE_SCK_DIVISOR |
| 32 | # define BLUEFRUIT_LE_SCK_DIVISOR 2 // 4MHz SCK/8MHz CPU, calculated for Feather 32U4 BLE | 32 | # define BLUEFRUIT_LE_SCK_DIVISOR 2 // 4MHz SCK/8MHz CPU, calculated for Feather 32U4 BLE |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #define SAMPLE_BATTERY | 35 | #define SAMPLE_BATTERY |
| @@ -77,10 +77,10 @@ struct sdep_msg { | |||
| 77 | // information here. | 77 | // information here. |
| 78 | 78 | ||
| 79 | enum queue_type { | 79 | enum queue_type { |
| 80 | QTKeyReport, // 1-byte modifier + 6-byte key report | 80 | QTKeyReport, // 1-byte modifier + 6-byte key report |
| 81 | QTConsumer, // 16-bit key code | 81 | QTConsumer, // 16-bit key code |
| 82 | #ifdef MOUSE_ENABLE | 82 | #ifdef MOUSE_ENABLE |
| 83 | QTMouseMove, // 4-byte mouse report | 83 | QTMouseMove, // 4-byte mouse report |
| 84 | #endif | 84 | #endif |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| @@ -115,8 +115,8 @@ enum sdep_type { | |||
| 115 | SdepResponse = 0x20, | 115 | SdepResponse = 0x20, |
| 116 | SdepAlert = 0x40, | 116 | SdepAlert = 0x40, |
| 117 | SdepError = 0x80, | 117 | SdepError = 0x80, |
| 118 | SdepSlaveNotReady = 0xFE, // Try again later | 118 | SdepSlaveNotReady = 0xFE, // Try again later |
| 119 | SdepSlaveOverflow = 0xFF, // You read more data than is available | 119 | SdepSlaveOverflow = 0xFF, // You read more data than is available |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | enum ble_cmd { | 122 | enum ble_cmd { |
| @@ -306,13 +306,15 @@ static bool ble_init(void) { | |||
| 306 | wait_ms(10); | 306 | wait_ms(10); |
| 307 | writePinHigh(BLUEFRUIT_LE_RST_PIN); | 307 | writePinHigh(BLUEFRUIT_LE_RST_PIN); |
| 308 | 308 | ||
| 309 | wait_ms(1000); // Give it a second to initialize | 309 | wait_ms(1000); // Give it a second to initialize |
| 310 | 310 | ||
| 311 | state.initialized = true; | 311 | state.initialized = true; |
| 312 | return state.initialized; | 312 | return state.initialized; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | static inline uint8_t min(uint8_t a, uint8_t b) { return a < b ? a : b; } | 315 | static inline uint8_t min(uint8_t a, uint8_t b) { |
| 316 | return a < b ? a : b; | ||
| 317 | } | ||
| 316 | 318 | ||
| 317 | static bool read_response(char *resp, uint16_t resplen, bool verbose) { | 319 | static bool read_response(char *resp, uint16_t resplen, bool verbose) { |
| 318 | char *dest = resp; | 320 | char *dest = resp; |
| @@ -424,7 +426,9 @@ bool at_command_P(const char *cmd, char *resp, uint16_t resplen, bool verbose) { | |||
| 424 | return at_command(cmdbuf, resp, resplen, verbose); | 426 | return at_command(cmdbuf, resp, resplen, verbose); |
| 425 | } | 427 | } |
| 426 | 428 | ||
| 427 | bool bluefruit_le_is_connected(void) { return state.is_connected; } | 429 | bool bluefruit_le_is_connected(void) { |
| 430 | return state.is_connected; | ||
| 431 | } | ||
| 428 | 432 | ||
| 429 | bool bluefruit_le_enable_keyboard(void) { | 433 | bool bluefruit_le_enable_keyboard(void) { |
| 430 | char resbuf[128]; | 434 | char resbuf[128]; |
| @@ -671,7 +675,9 @@ void bluefruit_le_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, | |||
| 671 | } | 675 | } |
| 672 | #endif | 676 | #endif |
| 673 | 677 | ||
| 674 | uint32_t bluefruit_le_read_battery_voltage(void) { return state.vbat; } | 678 | uint32_t bluefruit_le_read_battery_voltage(void) { |
| 679 | return state.vbat; | ||
| 680 | } | ||
| 675 | 681 | ||
| 676 | bool bluefruit_le_set_mode_leds(bool on) { | 682 | bool bluefruit_le_set_mode_leds(bool on) { |
| 677 | if (!state.configured) { | 683 | if (!state.configured) { |
diff --git a/drivers/bluetooth/outputselect.c b/drivers/bluetooth/outputselect.c index 44bc4a9aa3..b986ba274e 100644 --- a/drivers/bluetooth/outputselect.c +++ b/drivers/bluetooth/outputselect.c | |||
| @@ -52,7 +52,7 @@ uint8_t auto_detect_output(void) { | |||
| 52 | #endif | 52 | #endif |
| 53 | 53 | ||
| 54 | #ifdef BLUETOOTH_ENABLE | 54 | #ifdef BLUETOOTH_ENABLE |
| 55 | return OUTPUT_BLUETOOTH; // should check if BT is connected here | 55 | return OUTPUT_BLUETOOTH; // should check if BT is connected here |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | return OUTPUT_NONE; | 58 | return OUTPUT_NONE; |
diff --git a/drivers/bluetooth/rn42.c b/drivers/bluetooth/rn42.c index 2ef40bb7e0..5d497cda20 100644 --- a/drivers/bluetooth/rn42.c +++ b/drivers/bluetooth/rn42.c | |||
| @@ -61,7 +61,9 @@ static inline uint16_t rn42_consumer_usage_to_bitmap(uint16_t usage) { | |||
| 61 | } | 61 | } |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | void rn42_init(void) { uart_init(RN42_BAUD_RATE); } | 64 | void rn42_init(void) { |
| 65 | uart_init(RN42_BAUD_RATE); | ||
| 66 | } | ||
| 65 | 67 | ||
| 66 | void rn42_send_keyboard(report_keyboard_t *report) { | 68 | void rn42_send_keyboard(report_keyboard_t *report) { |
| 67 | uart_write(0xFD); | 69 | uart_write(0xFD); |
| @@ -81,8 +83,8 @@ void rn42_send_mouse(report_mouse_t *report) { | |||
| 81 | uart_write(report->buttons); | 83 | uart_write(report->buttons); |
| 82 | uart_write(report->x); | 84 | uart_write(report->x); |
| 83 | uart_write(report->y); | 85 | uart_write(report->y); |
| 84 | uart_write(report->v); // should try sending the wheel v here | 86 | uart_write(report->v); // should try sending the wheel v here |
| 85 | uart_write(report->h); // should try sending the wheel h here | 87 | uart_write(report->h); // should try sending the wheel h here |
| 86 | uart_write(0x00); | 88 | uart_write(0x00); |
| 87 | } | 89 | } |
| 88 | 90 | ||
