diff options
author | Christian Pointner <equinox@spreadspace.org> | 2022-10-06 22:43:54 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2022-10-06 22:43:54 +0200 |
commit | 79d19fafff8d25297bbe8d8c4856ca088afbe7fd (patch) | |
tree | 3840eb55741c53824fec9a4e28d568af45bc330b /serial-led/serial-led.c | |
parent | add program target to makefiles (diff) |
Diffstat (limited to 'serial-led/serial-led.c')
-rw-r--r-- | serial-led/serial-led.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/serial-led/serial-led.c b/serial-led/serial-led.c index 8f10f9c..1ade02e 100644 --- a/serial-led/serial-led.c +++ b/serial-led/serial-led.c @@ -30,16 +30,18 @@ void handle_cmd(uint8_t cmd) switch(cmd) { case '0': gpio_put(LED_PIN, 0); break; case '1': gpio_put(LED_PIN, 1); break; - default: printf("error\r\n"); return; + case 't': gpio_xor_mask(1<<LED_PIN); break; + default: printf("error\n"); return; } - printf("ok\r\n"); + printf("ok\n"); } int main() { gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); - stdio_init_all(); + stdio_uart_init_full(uart0, 9600, PICO_DEFAULT_UART_TX_PIN, PICO_DEFAULT_UART_RX_PIN); + stdio_set_translate_crlf(&stdio_uart, true); for(;;) { int cmd = getchar_timeout_us(100000); |