EasyManua.ls Logo

TELINK SEMICONDUCTOR TLSR8232 - Page 154

Default Icon
211 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1 153 Ver.1.0.0
same time; if previous kb_event.cnt is 1, it indicates the update is another button is
pressed with one button held; if previous kb_event.cnt is 3, it indicates the update is
one of the three pressed buttons is released……
kb_event.keycode[0] and kb_event.keycode[1] indicate key values of the two
pressed buttons currently. The subsequent keycodes are negligible.
User can manually clear the kb_event.keycode” before each key scan, so that it can be
used to check whether valid update occurs, as shown in the example below.
In the sample code, when kb_event.keycode[0]is not zero, it’s considered a button is
pressed, but the code won’t check further whether two buttons are pressed at the same
time or one of the two pressed buttons is released.
kb_event.keycode[0] = 0; //manually clear keycode[0]
int det_key = kb_scan_key (0, 1);
if (det_key)
{
key_not_released = 1;
u8 key = kb_event.keycode[0];
if (key) //key press
{
key_buf[2] = key;
//send key press
blt_push_notify_data (HID_HANDLE_KEYBOARD_REPORT, key_buf,
8);
}
else
{
key_not_released = 0;
key_buf[2] = 0;
//send key release
blt_push_notify_data (HID_HANDLE_KEYBOARD_REPORT, key_buf,
8);
}
}

Table of Contents