static void write_data(const char *buf, int len) { cdc_acm_irq_tx_enable(); data_transmitted = false; cdc_acm_fifo_fill((uint8_t *)buf, len); while (data_transmitted == false) ; cdc_acm_irq_tx_disable(); }
static int write_data(const char *buf, int len) { int part = 0; while (part < len) { if (cdc_acm_tx_busy) { QM_PUTS("CDC ACM Busy (Package dropped.)"); return -EIO; } int size = cdc_acm_fifo_fill((uint8_t *)buf, len - part); if (size < 0) { QM_PRINTF("CDC ACM Write Error %d.\n", size); return size; } part += size; buf += size; } return 0; }