ADB code cleaning

This commit is contained in:
demik 2021-05-08 11:30:07 +02:00
parent acf34b4c24
commit b045d081da

View File

@ -67,7 +67,7 @@ static void adb_handle_button(bool action) {
if (status == ADB_B_DOWN && action == ADB_B_UP) {
xTaskNotify(t_click, 0, eSetValueWithOverwrite);
status = ADB_B_UP;
ESP_LOGD("ADB", "ADB button released");
ESP_LOGD("ADB", "button released");
return ;
}
@ -75,7 +75,7 @@ static void adb_handle_button(bool action) {
if (status == ADB_B_UP && action == ADB_B_DOWN) {
xTaskNotify(t_click, 1, eSetValueWithOverwrite);
status = ADB_B_DOWN;
ESP_LOGD("ADB", "ADB button pressed");
ESP_LOGD("ADB", "button pressed");
return ;
}
}
@ -126,6 +126,7 @@ void adb_task_host(void *pvParameters) {
else
adb_handle_button(ADB_B_UP);
/* cast negative signed 7 bits to signed 8 bits */
move = (data & ADB_CMD_MX) >> 0;
if (move & 0x40) {
move &= ~0x40;
@ -154,11 +155,6 @@ void adb_task_mouse(void *pvParameters) {
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...
* 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)
* 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) {
@ -241,7 +240,7 @@ static uint16_t adb_rx_mouse() {
data |= 1;
//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);
return data;