uart_write.c 761 B

1234567891011121314151617181920212223242526272829303132
  1. #include <furi.h>
  2. #include <string.h>
  3. void application_uart_write(void* p) {
  4. // Red led for showing progress
  5. GpioPin led = {.pin = GPIO_PIN_8, .port = GPIOA};
  6. // TODO open record
  7. GpioPin* led_record = &led;
  8. gpio_init(led_record, GpioModeOutputOpenDrain);
  9. // create buffer
  10. const char test_string[] = "test\n";
  11. printf(test_string);
  12. // for example, create counter and show its value
  13. uint8_t counter = 0;
  14. while(1) {
  15. // continously write it to UART
  16. printf("counter: %d\n", counter);
  17. counter++;
  18. // flash at every send
  19. gpio_write(led_record, false);
  20. delay(50);
  21. gpio_write(led_record, true);
  22. // delay with overall perion of 1s
  23. delay(950);
  24. }
  25. }