code cleaning

This commit is contained in:
demik 2021-08-17 21:50:04 +02:00
parent 1bb3765cac
commit ca5f9b4c84
2 changed files with 9 additions and 3 deletions

View File

@ -102,12 +102,19 @@ void adb_init(void) {
rmt_config(&adb_rmt_rx); rmt_config(&adb_rmt_rx);
/* If jumper is set, switch to ADB host mode */ /* If jumper is set, switch to ADB host mode */
if (gpio_get_level(GPIO_ADBSRC) == 0) if (adb_is_host())
xTaskCreatePinnedToCore(adb_task_host, "ADB_HOST", 6 * 1024, NULL, tskADB_PRIORITY, NULL, 1); xTaskCreatePinnedToCore(adb_task_host, "ADB_HOST", 6 * 1024, NULL, tskADB_PRIORITY, NULL, 1);
else else
xTaskCreatePinnedToCore(adb_task_idle, "ADB_MOUSE", 6 * 1024, NULL, tskADB_PRIORITY, NULL, 1); xTaskCreatePinnedToCore(adb_task_idle, "ADB_MOUSE", 6 * 1024, NULL, tskADB_PRIORITY, NULL, 1);
} }
inline bool adb_is_host(void) {
if (gpio_get_level(GPIO_ADBSRC) == 0)
return true;
else
return false;
}
/* /*
* Probe ADB mouse. Also switch the mouse to a better mode if avaible * Probe ADB mouse. Also switch the mouse to a better mode if avaible
* *
@ -366,9 +373,7 @@ static uint16_t IRAM_ATTR adb_rx_mouse() {
if (adb_rx_isone(*(items+i))) if (adb_rx_isone(*(items+i)))
data |= 1; data |= 1;
//printf("%d:%dus %d:%dus ", (items+i)->level0, (items+i)->duration0, (items+i)->level1, (items+i)->duration1);
} }
//printf("\n");
vRingbufferReturnItem(rb, (void*) items); vRingbufferReturnItem(rb, (void*) items);
return data; return data;

View File

@ -27,6 +27,7 @@
/* prototypes */ /* prototypes */
void adb_init(void); void adb_init(void);
bool adb_is_host(void);
void adb_task_host(void *pvParameters); void adb_task_host(void *pvParameters);
void adb_task_idle(void *pvParameters); void adb_task_idle(void *pvParameters);