Seek forward and backward using scroll wheel in car
This commit is contained in:
parent
44f9e6393a
commit
2c53036d45
|
@ -9,6 +9,8 @@ namespace avrcp {
|
|||
void play_pause();
|
||||
void forward();
|
||||
void backward();
|
||||
void seek_forward();
|
||||
void seek_backward();
|
||||
|
||||
void set_volume(uint8_t volume);
|
||||
}
|
||||
|
|
|
@ -177,6 +177,18 @@ void avrcp::backward() {
|
|||
send_cmd(ESP_AVRC_PT_CMD_BACKWARD);
|
||||
}
|
||||
|
||||
void avrcp::seek_forward() {
|
||||
ESP_LOGI(AVRCP_TAG, "Seek forward");
|
||||
|
||||
send_cmd(ESP_AVRC_PT_CMD_FAST_FORWARD);
|
||||
}
|
||||
|
||||
void avrcp::seek_backward() {
|
||||
ESP_LOGI(AVRCP_TAG, "Seek backward");
|
||||
|
||||
send_cmd(ESP_AVRC_PT_CMD_REWIND);
|
||||
}
|
||||
|
||||
void avrcp::set_volume(uint8_t v) {
|
||||
// Make sure the volume is actually changed
|
||||
if (v == volume) {
|
||||
|
|
|
@ -336,6 +336,19 @@ static void can_task(void* params) {
|
|||
|
||||
static MultiPurposeButton button_backward(nullptr, avrcp::backward);
|
||||
button_backward.update(buttons.backward);
|
||||
|
||||
static uint8_t scroll = 0;
|
||||
if (scroll != buttons.scroll) {
|
||||
int8_t diff = buttons.scroll - scroll;
|
||||
|
||||
if (diff < 0) {
|
||||
avrcp::seek_backward();
|
||||
} else {
|
||||
avrcp::seek_forward();
|
||||
}
|
||||
|
||||
scroll = buttons.scroll;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user