custom button mapping
This commit is contained in:
parent
c7372d21d2
commit
7f11d709aa
|
@ -92,7 +92,7 @@ extern struct BT_DEVICE_T app_bt_device;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void send_vol_up(void) {
|
void send_vol_up(void) {
|
||||||
uint8_t action[] = {IBRT_ACTION_LOCAL_VOLUP};
|
uint8_t action[] = {IBRT_ACTION_AVRCP_VOLUP};
|
||||||
app_ibrt_if_start_user_action(action, sizeof(action));
|
app_ibrt_if_start_user_action(action, sizeof(action));
|
||||||
}
|
}
|
||||||
void send_play_pause(void) {
|
void send_play_pause(void) {
|
||||||
|
@ -105,7 +105,7 @@ void send_play_pause(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void send_vol_down(void) {
|
void send_vol_down(void) {
|
||||||
uint8_t action[] = {IBRT_ACTION_LOCAL_VOLDN};
|
uint8_t action[] = {IBRT_ACTION_AVRCP_VOLDN};
|
||||||
app_ibrt_if_start_user_action(action, sizeof(action));
|
app_ibrt_if_start_user_action(action, sizeof(action));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void send_prev_track(void) {
|
||||||
uint8_t action[] = {IBRT_ACTION_BACKWARD};
|
uint8_t action[] = {IBRT_ACTION_BACKWARD};
|
||||||
app_ibrt_if_start_user_action(action, sizeof(action));
|
app_ibrt_if_start_user_action(action, sizeof(action));
|
||||||
}
|
}
|
||||||
void app_key_single_tap(APP_KEY_STATUS *status, void *param) {
|
/*void app_key_single_tap(APP_KEY_STATUS *status, void *param) {
|
||||||
TRACE(2, "%s event %d", __func__, status->event);
|
TRACE(2, "%s event %d", __func__, status->event);
|
||||||
|
|
||||||
if (!app_tws_ibrt_tws_link_connected()) {
|
if (!app_tws_ibrt_tws_link_connected()) {
|
||||||
|
@ -137,35 +137,14 @@ void app_key_single_tap(APP_KEY_STATUS *status, void *param) {
|
||||||
send_play_pause();
|
send_play_pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
void app_key_double_tap(APP_KEY_STATUS *status, void *param) {
|
void app_key_double_tap(APP_KEY_STATUS *status, void *param) {
|
||||||
TRACE(2, "%s event %d", __func__, status->event);
|
TRACE(2, "%s event %d", __func__, status->event);
|
||||||
|
|
||||||
if (!app_tws_ibrt_tws_link_connected()) {
|
if (!app_tws_ibrt_tws_link_connected()) {
|
||||||
// No other bud paired
|
// No other bud paired
|
||||||
TRACE(0, "Handling %s in single bud mode", __func__);
|
TRACE(0, "Handling %s in single bud mode", __func__);
|
||||||
send_next_track();
|
send_vol_down();
|
||||||
} else {
|
|
||||||
// Bud's are working as a pair
|
|
||||||
if (app_tws_is_left_side()) {
|
|
||||||
TRACE(0, "Handling %s as left bud", __func__);
|
|
||||||
// Lefty
|
|
||||||
send_prev_track();
|
|
||||||
} else {
|
|
||||||
TRACE(0, "Handling %s as right bud", __func__);
|
|
||||||
// Righty
|
|
||||||
send_next_track();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
|
|
||||||
TRACE(2, "%s event %d", __func__, status->event);
|
|
||||||
|
|
||||||
if (!app_tws_ibrt_tws_link_connected()) {
|
|
||||||
// No other bud paired
|
|
||||||
TRACE(0, "Handling %s in single bud mode", __func__);
|
|
||||||
send_vol_up();
|
|
||||||
} else {
|
} else {
|
||||||
// Bud's are working as a pair
|
// Bud's are working as a pair
|
||||||
if (app_tws_is_left_side()) {
|
if (app_tws_is_left_side()) {
|
||||||
|
@ -179,7 +158,28 @@ void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void app_key_quad_tap(APP_KEY_STATUS *status, void *param) {
|
|
||||||
|
void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
|
||||||
|
TRACE(2, "%s event %d", __func__, status->event);
|
||||||
|
|
||||||
|
if (!app_tws_ibrt_tws_link_connected()) {
|
||||||
|
// No other bud paired
|
||||||
|
TRACE(0, "Handling %s in single bud mode", __func__);
|
||||||
|
send_vol_up();
|
||||||
|
}/* else {
|
||||||
|
// Bud's are working as a pair
|
||||||
|
if (app_tws_is_left_side()) {
|
||||||
|
TRACE(0, "Handling %s as left bud", __func__);
|
||||||
|
// Lefty
|
||||||
|
send_vol_down();
|
||||||
|
} else {
|
||||||
|
TRACE(0, "Handling %s as right bud", __func__);
|
||||||
|
// Righty
|
||||||
|
send_vol_up();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
/*void app_key_quad_tap(APP_KEY_STATUS *status, void *param) {
|
||||||
TRACE(2, "%s event %d", __func__, status->event);
|
TRACE(2, "%s event %d", __func__, status->event);
|
||||||
|
|
||||||
if (!app_tws_ibrt_tws_link_connected()) {
|
if (!app_tws_ibrt_tws_link_connected()) {
|
||||||
|
@ -196,7 +196,7 @@ void app_key_quad_tap(APP_KEY_STATUS *status, void *param) {
|
||||||
// Righty
|
// Righty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void app_key_long_press_down(APP_KEY_STATUS *status, void *param) {
|
void app_key_long_press_down(APP_KEY_STATUS *status, void *param) {
|
||||||
TRACE(2, "%s event %d", __func__, status->event);
|
TRACE(2, "%s event %d", __func__, status->event);
|
||||||
|
@ -204,7 +204,7 @@ void app_key_long_press_down(APP_KEY_STATUS *status, void *param) {
|
||||||
if (!app_tws_ibrt_tws_link_connected()) {
|
if (!app_tws_ibrt_tws_link_connected()) {
|
||||||
// No other bud paired
|
// No other bud paired
|
||||||
TRACE(0, "Handling %s in single bud mode", __func__);
|
TRACE(0, "Handling %s in single bud mode", __func__);
|
||||||
send_prev_track();
|
//send_prev_track();
|
||||||
} else {
|
} else {
|
||||||
// Bud's are working as a pair
|
// Bud's are working as a pair
|
||||||
app_anc_key(status, param);
|
app_anc_key(status, param);
|
||||||
|
@ -222,7 +222,7 @@ void app_key_init(void) {
|
||||||
|
|
||||||
const APP_KEY_HANDLE key_cfg[] = {
|
const APP_KEY_HANDLE key_cfg[] = {
|
||||||
|
|
||||||
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_CLICK}, "", app_key_single_tap, NULL},
|
//{{APP_KEY_CODE_PWR, APP_KEY_EVENT_CLICK}, "", app_key_single_tap, NULL},
|
||||||
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_DOUBLECLICK},
|
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_DOUBLECLICK},
|
||||||
"",
|
"",
|
||||||
app_key_double_tap,
|
app_key_double_tap,
|
||||||
|
@ -231,10 +231,10 @@ void app_key_init(void) {
|
||||||
"",
|
"",
|
||||||
app_key_triple_tap,
|
app_key_triple_tap,
|
||||||
NULL},
|
NULL},
|
||||||
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_ULTRACLICK},
|
/*{{APP_KEY_CODE_PWR, APP_KEY_EVENT_ULTRACLICK},
|
||||||
"",
|
"",
|
||||||
app_key_quad_tap,
|
app_key_quad_tap,
|
||||||
NULL},
|
NULL},*/
|
||||||
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_LONGPRESS},
|
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_LONGPRESS},
|
||||||
"",
|
"",
|
||||||
app_key_long_press_down,
|
app_key_long_press_down,
|
||||||
|
@ -268,4 +268,4 @@ void app_key_init_on_charging(void) {
|
||||||
for (i = 0; i < (sizeof(key_cfg) / sizeof(APP_KEY_HANDLE)); i++) {
|
for (i = 0; i < (sizeof(key_cfg) / sizeof(APP_KEY_HANDLE)); i++) {
|
||||||
app_key_handle_registration(&key_cfg[i]);
|
app_key_handle_registration(&key_cfg[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue