chegewara / EspTinyUSB

ESP32S2 native USB library. Implemented few common classes, like MIDI, CDC, HID or DFU (update).
MIT License
473 stars 70 forks source link

tud_midi_available() not working #141

Open nateexptr opened 1 year ago

nateexptr commented 1 year ago

tud_midi_available() not working

I tried using tusb midi and found that it works fine to sending MIDI message . But when I want to receive the data it doesn't work

till I try to print out the status It's not show anything. While I can still send MIDI message normally.

static void midi_task_read_example(void *arg) { // The MIDI interface always creates input and output port/jack descriptors // regardless of these being used or not. Therefore incoming traffic should be read // (possibly just discarded) to avoid the sender blocking in IO uint8_t packet[4]; bool read = false; for (;;) { vTaskDelay(1); while (tud_midi_available()) { printf("tud_midi_available\n"); read = tud_midi_packet_read(packet); if (read) {

        printf(" Data: %02hhX %02hhX %02hhX %02hhX\n", packet[0], packet[1], packet[2], packet[3]);
        // ESP_LOGI(TAG, "Read - Time (ms since boot): %lld, Data: %02hhX %02hhX %02hhX %02hhX",
        //          esp_timer_get_time(), packet[0], packet[1], packet[2], packet[3]);
    }
}

} }