mirror of
https://github.com/demik/quack.git
synced 2025-02-16 19:30:58 +00:00
code cleaning
This commit is contained in:
parent
1bb3765cac
commit
ca5f9b4c84
11
main/adb.c
11
main/adb.c
@ -102,12 +102,19 @@ void adb_init(void) {
|
||||
rmt_config(&adb_rmt_rx);
|
||||
|
||||
/* 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);
|
||||
else
|
||||
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
|
||||
*
|
||||
@ -366,9 +373,7 @@ static uint16_t IRAM_ATTR adb_rx_mouse() {
|
||||
|
||||
if (adb_rx_isone(*(items+i)))
|
||||
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);
|
||||
|
||||
return data;
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
/* prototypes */
|
||||
void adb_init(void);
|
||||
bool adb_is_host(void);
|
||||
void adb_task_host(void *pvParameters);
|
||||
void adb_task_idle(void *pvParameters);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user