Skip to content

Commit 7d5c88c

Browse files
committed
add conn_handle to BLEHidAdafruit KeyboardLedCallback signature
1 parent 396f7a4 commit 7d5c88c

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

libraries/Bluefruit52Lib/examples/Peripheral/hid_keyboard/hid_keyboard.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ void loop()
132132
* The LED bit map is as follows: (also defined by KEYBOARD_LED_* )
133133
* Kana (4) | Compose (3) | ScrollLock (2) | CapsLock (1) | Numlock (0)
134134
*/
135-
void set_keyboard_led(uint8_t led_bitmap)
135+
void set_keyboard_led(uint16_t conn_handle, uint8_t led_bitmap)
136136
{
137+
(void) conn_handle;
138+
137139
// light up Red Led if any bits is set
138140
if ( led_bitmap )
139141
{

libraries/Bluefruit52Lib/examples/Peripheral/hid_keyscan/hid_keyscan.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ void loop()
180180
* The LED bit map is as follows: (also defined by KEYBOARD_LED_* )
181181
* Kana (4) | Compose (3) | ScrollLock (2) | CapsLock (1) | Numlock (0)
182182
*/
183-
void set_keyboard_led(uint8_t led_bitmap)
183+
void set_keyboard_led(uint16_t conn_handle, uint8_t led_bitmap)
184184
{
185+
(void) conn_handle;
186+
185187
// light up Red Led if any bits is set
186188
if ( led_bitmap )
187189
{

libraries/Bluefruit52Lib/src/services/BLEHidAdafruit.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,12 @@ err_t BLEHidAdafruit::begin(void)
222222
/* Keyboard
223223
*------------------------------------------------------------------*/
224224

225-
void blehid_ada_keyboard_output_cb(uint16_t conn_hdl, BLECharacteristic* chr, uint8_t* data, uint16_t len)
225+
void BLEHidAdafruit::blehid_ada_keyboard_output_cb(uint16_t conn_hdl, BLECharacteristic* chr, uint8_t* data, uint16_t len)
226226
{
227-
(void) conn_hdl;
228-
229227
LOG_LV2("HID", "Keyboard LED : 0x%02X", data[0]);
230-
VERIFY(len == 1, );
231228

232229
BLEHidAdafruit& svc = (BLEHidAdafruit&) chr->parentService();
233-
if ( svc._kbd_led_cb ) svc._kbd_led_cb(data[0]);
230+
if ( svc._kbd_led_cb ) svc._kbd_led_cb(conn_hdl, data[0]);
234231
}
235232

236233
void BLEHidAdafruit::setKeyboardLedCallback(kbd_led_cb_t fp)

libraries/Bluefruit52Lib/src/services/BLEHidAdafruit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class BLEHidAdafruit : public BLEHidGeneric
4747
{
4848
public:
4949
/*--------- Callback Signatures ----------*/
50-
typedef void (*kbd_led_cb_t) (uint8_t leds_bitmap);
50+
typedef void (*kbd_led_cb_t) (uint16_t conn_hdl, uint8_t leds_bitmap);
5151

5252
BLEHidAdafruit(void);
5353

@@ -83,7 +83,7 @@ class BLEHidAdafruit : public BLEHidGeneric
8383
uint8_t _mse_buttons;
8484
kbd_led_cb_t _kbd_led_cb;
8585

86-
friend void blehid_ada_keyboard_output_cb(uint16_t conn_hdl, BLECharacteristic* chr, uint8_t* data, uint16_t len);
86+
static void blehid_ada_keyboard_output_cb(uint16_t conn_hdl, BLECharacteristic* chr, uint8_t* data, uint16_t len);
8787
};
8888

8989
#endif /* BLEHIDADAFRUIT_H_ */

0 commit comments

Comments
 (0)