summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-10-31 13:27:54 +0700
committerGitHub <[email protected]>2023-10-31 13:27:54 +0700
commit4c01c5a714e535fdc89ba005b5453e454817d4c5 (patch)
tree1c16fa45ff830a8691b2df24a91b832b079d4eeb /examples
parenta91b720c2e9af142cc7b26801381e84cf4e50953 (diff)
parent3e140756dc5e3761209bf5b399621e6c0ed1dadd (diff)
Merge pull request #2300 from hathach/add-u5a5
Add support for stm32u5a5 (highspeed with built-in femtoPHY)
Diffstat (limited to 'examples')
-rw-r--r--examples/device/board_test/src/main.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 0a134a2e6..91799eb89 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -26,39 +26,31 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-
#include "bsp/board_api.h"
-//--------------------------------------------------------------------+
-// MACRO CONSTANT TYPEDEF PROTOTYPES
-//--------------------------------------------------------------------+
-
/* Blink pattern
* - 250 ms : button is not pressed
* - 1000 ms : button is pressed (and hold)
*/
-enum {
+enum {
BLINK_PRESSED = 250,
BLINK_UNPRESSED = 1000
};
#define HELLO_STR "Hello from TinyUSB\r\n"
-int main(void)
-{
+int main(void) {
board_init();
board_led_write(true);
uint32_t start_ms = 0;
bool led_state = false;
- while (1)
- {
+ while (1) {
uint32_t interval_ms = board_button_read() ? BLINK_PRESSED : BLINK_UNPRESSED;
// Blink and print every interval ms
- if ( !(board_millis() - start_ms < interval_ms) )
- {
+ if (!(board_millis() - start_ms < interval_ms)) {
board_uart_write(HELLO_STR, strlen(HELLO_STR));
start_ms = board_millis();
@@ -69,16 +61,14 @@ int main(void)
// echo
uint8_t ch;
- if ( board_uart_read(&ch, 1) > 0 )
- {
+ if (board_uart_read(&ch, 1) > 0) {
board_uart_write(&ch, 1);
}
}
}
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
-void app_main(void)
-{
+void app_main(void) {
main();
}
#endif