mirror of
https://github.com/demik/quack.git
synced 2025-02-28 06:29:25 +00:00
ADB code cleaning
This commit is contained in:
parent
acf34b4c24
commit
b045d081da
15
main/adb.c
15
main/adb.c
@ -67,7 +67,7 @@ static void adb_handle_button(bool action) {
|
|||||||
if (status == ADB_B_DOWN && action == ADB_B_UP) {
|
if (status == ADB_B_DOWN && action == ADB_B_UP) {
|
||||||
xTaskNotify(t_click, 0, eSetValueWithOverwrite);
|
xTaskNotify(t_click, 0, eSetValueWithOverwrite);
|
||||||
status = ADB_B_UP;
|
status = ADB_B_UP;
|
||||||
ESP_LOGD("ADB", "ADB button released");
|
ESP_LOGD("ADB", "button released");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ static void adb_handle_button(bool action) {
|
|||||||
if (status == ADB_B_UP && action == ADB_B_DOWN) {
|
if (status == ADB_B_UP && action == ADB_B_DOWN) {
|
||||||
xTaskNotify(t_click, 1, eSetValueWithOverwrite);
|
xTaskNotify(t_click, 1, eSetValueWithOverwrite);
|
||||||
status = ADB_B_DOWN;
|
status = ADB_B_DOWN;
|
||||||
ESP_LOGD("ADB", "ADB button pressed");
|
ESP_LOGD("ADB", "button pressed");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,6 +126,7 @@ void adb_task_host(void *pvParameters) {
|
|||||||
else
|
else
|
||||||
adb_handle_button(ADB_B_UP);
|
adb_handle_button(ADB_B_UP);
|
||||||
|
|
||||||
|
/* cast negative signed 7 bits to signed 8 bits */
|
||||||
move = (data & ADB_CMD_MX) >> 0;
|
move = (data & ADB_CMD_MX) >> 0;
|
||||||
if (move & 0x40) {
|
if (move & 0x40) {
|
||||||
move &= ~0x40;
|
move &= ~0x40;
|
||||||
@ -154,11 +155,6 @@ void adb_task_mouse(void *pvParameters) {
|
|||||||
vTaskSuspend(NULL);
|
vTaskSuspend(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dur( uint32_t level, uint32_t duration ) {
|
|
||||||
if ( level == 0 ) { return duration; }
|
|
||||||
else { return -1.0 * duration; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* some ADB mouses are using cells as short as 24µs+49µs, try to get that...
|
* some ADB mouses are using cells as short as 24µs+49µs, try to get that...
|
||||||
* spec allow ±30% variance
|
* spec allow ±30% variance
|
||||||
@ -209,6 +205,9 @@ static uint16_t adb_rx_mouse() {
|
|||||||
/*
|
/*
|
||||||
* Mouse response size in bits is events / sizeof(rmt_item32_t) (4)
|
* Mouse response size in bits is events / sizeof(rmt_item32_t) (4)
|
||||||
* start bit + 16 data bits + stop bit = 72 bytes in RMT buffer (18 bits received)
|
* start bit + 16 data bits + stop bit = 72 bytes in RMT buffer (18 bits received)
|
||||||
|
*
|
||||||
|
* Check start / stop bits and size.
|
||||||
|
* On real Macintoshes, ADB Manager does something similar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (rx_size) {
|
switch (rx_size) {
|
||||||
@ -241,7 +240,7 @@ static uint16_t adb_rx_mouse() {
|
|||||||
data |= 1;
|
data |= 1;
|
||||||
//printf("%d:%dus %d:%dus ", (items+i)->level0, (items+i)->duration0, (items+i)->level1, (items+i)->duration1);
|
//printf("%d:%dus %d:%dus ", (items+i)->level0, (items+i)->duration0, (items+i)->level1, (items+i)->duration1);
|
||||||
}
|
}
|
||||||
printf("\n");
|
//printf("\n");
|
||||||
vRingbufferReturnItem(rb, (void*) items);
|
vRingbufferReturnItem(rb, (void*) items);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user