uart_write.c 838 B

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