Improve app

This commit is contained in:
Attila Body 2025-06-16 19:45:13 +02:00
parent 01807f47ab
commit d72d3af2a7
Signed by: abody
GPG key ID: BD0C6214E68FB5CF
4 changed files with 13 additions and 11 deletions

2
.gitignore vendored
View file

@ -15,3 +15,5 @@ compile_commands.json
/Debug/ /Debug/
/Release/ /Release/
/config_*/ /config_*/
.project
.cproject

4
.vscode/launch.json vendored
View file

@ -16,7 +16,7 @@
"device": "STM32F446RETx", //MCU used "device": "STM32F446RETx", //MCU used
"interface": "swd", "interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time "serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToEntryPoint": "main", // "runToEntryPoint": "main",
"svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F446.svd", "svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F446.svd",
"v1": false, //Change it depending on ST Link version "v1": false, //Change it depending on ST Link version
"serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver", "serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
@ -43,7 +43,7 @@
"device": "STM32F446RETx", //MCU used "device": "STM32F446RETx", //MCU used
"interface": "swd", "interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time "serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToEntryPoint": "main", // "runToEntryPoint": "main",
"svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F446.svd", "svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F446.svd",
"v1": false, //Change it depending on ST Link version "v1": false, //Change it depending on ST Link version
"serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver", "serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",

View file

@ -16,7 +16,7 @@
#include <task.h> #include <task.h>
#include <thread_safe_console_output.h> #include <thread_safe_console_output.h>
class app : public f4ll::initialized_singleton<app>, f4ll::console_handler::iconsole_input class app : public f4ll::initialized_singleton<app>, public f4ll::console_handler::iconsole_input
{ {
friend class f4ll::initialized_singleton<app>; friend class f4ll::initialized_singleton<app>;
@ -43,7 +43,7 @@ private:
thread_safe_console_output m_safe_conout; thread_safe_console_output m_safe_conout;
void queue_ts(); void queue_timestamp();
}; };
extern "C" { extern "C" {

View file

@ -30,7 +30,7 @@ app::app(void const *param)
: m_con( : m_con(
f4ll::console_handler::init( f4ll::console_handler::init(
USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6, m_rx_buf_mem, sizeof(m_rx_buf_mem), m_tx_buf_mem, sizeof(m_tx_buf_mem), USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6, m_rx_buf_mem, sizeof(m_rx_buf_mem), m_tx_buf_mem, sizeof(m_tx_buf_mem),
nullptr)), this)),
m_safe_conout(m_con) m_safe_conout(m_con)
{ {
@ -42,12 +42,12 @@ void app::main()
m_cli_task_handle = xTaskCreateStatic( m_cli_task_handle = xTaskCreateStatic(
cli_task_dispatch, "CLI_task", CLI_TASK_STACK_LEN, this, osPriorityAboveNormal, m_cli_task_stack, &m_cli_task_buffer); cli_task_dispatch, "CLI_task", CLI_TASK_STACK_LEN, this, osPriorityAboveNormal, m_cli_task_stack, &m_cli_task_buffer);
queue_ts(); queue_timestamp();
m_safe_conout.print("-------------------------------------------\n"); m_safe_conout.print("-------------------------------------------\n");
while (true) { while (true) {
queue_ts(); queue_timestamp();
m_safe_conout.print("Hello woooooooooooooooooooooooooooooooorld!\n"); m_safe_conout.print("Hello woooooooooooooooooooooooooooooooorld!\n");
vTaskDelay(pdMS_TO_TICKS(500)); vTaskDelay(pdMS_TO_TICKS(2000));
LL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin); LL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
} }
} }
@ -71,12 +71,12 @@ void app::cli_task()
{ {
while (1) { while (1) {
vTaskDelay(pdMS_TO_TICKS(10000)); vTaskDelay(pdMS_TO_TICKS(10000));
queue_ts(); // queue_ts();
m_safe_conout.print(">>> TICK <<<\n"); // m_safe_conout.print(">>> TICK <<<\n");
} }
} }
void app::queue_ts() void app::queue_timestamp()
{ {
char ts_buf[12]; char ts_buf[12];
uitodec(ts_buf, xTaskGetTickCount()); uitodec(ts_buf, xTaskGetTickCount());