code format

This commit is contained in:
Martin Brodbeck 2024-02-26 12:17:18 +01:00
parent 7a5d0b97e7
commit e420930ce6

View file

@ -22,7 +22,7 @@ extern const uint LEFT_PADDLE_PIN = 14;
extern const uint RIGHT_PADDLE_PIN = 15; extern const uint RIGHT_PADDLE_PIN = 15;
extern const uint BUZZER_PIN = 18; extern const uint BUZZER_PIN = 18;
extern const uint CW_OUT_PIN = 17; extern const uint CW_OUT_PIN = 17;
//extern const uint AUDIO_OUT_PIN = 16; // extern const uint AUDIO_OUT_PIN = 16;
extern const uint ADC_PIN = 26; extern const uint ADC_PIN = 26;
// Stuff for communicating between cores // Stuff for communicating between cores
@ -113,7 +113,8 @@ static void usbSend(uint8_t itf, uint8_t buf[], uint32_t count)
tud_cdc_n_write_flush(itf); tud_cdc_n_write_flush(itf);
} }
static void usbSend(uint8_t itf, uint8_t value) { static void usbSend(uint8_t itf, uint8_t value)
{
tud_cdc_n_write_char(itf, value); tud_cdc_n_write_char(itf, value);
tud_cdc_n_write_flush(itf); tud_cdc_n_write_flush(itf);
} }
@ -125,20 +126,20 @@ void cdc_task()
if (tud_cdc_n_available(USB_IF)) { if (tud_cdc_n_available(USB_IF)) {
uint8_t buf[64]; uint8_t buf[64];
//printf("AHA!!! %d\n", (int)tud_cdc_n_available(USB_IF)); // printf("AHA!!! %d\n", (int)tud_cdc_n_available(USB_IF));
uint32_t count = tud_cdc_n_read(USB_IF, buf, sizeof(buf)); uint32_t count = tud_cdc_n_read(USB_IF, buf, sizeof(buf));
if (count > 0) { if (count > 0) {
switch (buf[0]) { switch (buf[0]) {
case 'a' ... 'z': case 'a' ... 'z':
case 'A' ... 'Z': case 'A' ... 'Z':
case '0' ... '9': case '0' ... '9':
printf("TODO: Send it!\n"); printf("TODO: Send it!\n");
break; break;
case 0x00: // ADMIN COMMAND case 0x00: // ADMIN COMMAND
switch (buf[1]) { switch (buf[1]) {
case 0x02: // Host open case 0x02: // Host open
usbSend(USB_IF, 9); // Send WK1 (v9) for now (no WinKeyer PTT control) usbSend(USB_IF, 9); // Send WK1 (v9) for now (no WinKeyer PTT control)
break; break;
case 0x04: // Echo test case 0x04: // Echo test
printf("Echo test: %x\n", buf[2]); printf("Echo test: %x\n", buf[2]);
@ -221,13 +222,12 @@ int main()
lastWpm = currentWpm; lastWpm = currentWpm;
} }
//busy_wait_ms(5000); // busy_wait_ms(5000);
if (!used) { if (!used) {
//KeyerQueueData keyerQueueData {KeyerQueueCommand::SendMessage, 0, settings.mode, "cq cq de dg2smb dg2smb pse k"}; // KeyerQueueData keyerQueueData {KeyerQueueCommand::SendMessage, 0, settings.mode, "cq cq de dg2smb dg2smb
//queue_add_blocking(&keyerQueue, &keyerQueueData); // pse k"}; queue_add_blocking(&keyerQueue, &keyerQueueData);
used = true; used = true;
} }
} }
return 0; return 0;