summaryrefslogtreecommitdiff
path: root/examples/device/board_test
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-11-24 11:33:34 +0700
committerGitHub <[email protected]>2023-11-24 11:33:34 +0700
commit0601d174b1eaf7a9bfe646ee6595016e58d67ea4 (patch)
tree849056bbdedc9b440468437304e4591543e87142 /examples/device/board_test
parentce627f431831e1fbaa3bb7bad35a489b8006b749 (diff)
parentd6b8b3515df4bb83b6038bd60260771e65af8de7 (diff)
Merge branch 'master' into feature/ch32f20x
Diffstat (limited to 'examples/device/board_test')
-rw-r--r--examples/device/board_test/Makefile4
-rw-r--r--examples/device/board_test/src/main.c22
2 files changed, 8 insertions, 18 deletions
diff --git a/examples/device/board_test/Makefile b/examples/device/board_test/Makefile
index 2a3d854fb..7fa475da5 100644
--- a/examples/device/board_test/Makefile
+++ b/examples/device/board_test/Makefile
@@ -1,4 +1,4 @@
-include ../../make.mk
+include ../../build_system/make/make.mk
INC += \
src \
@@ -8,4 +8,4 @@ INC += \
EXAMPLE_SOURCE += $(wildcard src/*.c)
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-include ../../rules.mk
+include ../../build_system/make/rules.mk
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