update cdc_msc/cdc_msc_freertos to also support notification

This commit is contained in:
hathach
2025-07-03 14:28:19 +07:00
parent 41606a533d
commit 0df3bfb81d
7 changed files with 42 additions and 30 deletions

View File

@@ -119,6 +119,16 @@ void cdc_task(void) {
tud_cdc_write(buf, count);
tud_cdc_write_flush();
}
// Press on-board button to send Uart status notification
static uint32_t btn_prev = 0;
static cdc_notify_uart_state_t uart_state = { .value = 0 };
const uint32_t btn = board_button_read();
if (!btn_prev && btn) {
uart_state.dsr ^= 1;
tud_cdc_notify_uart_state(&uart_state);
}
btn_prev = btn;
}
}