TACOS/App/Src/startup.cpp
2023-09-01 18:48:51 +02:00

43 lines
1016 B
C++

/*
* printable.cpp
*
* Created on: Aug 30, 2023
* Author: Dario
*/
#include <cmsis_os2.h>
#include <usart.h>
#include <sta/rtos/mutex.hpp>
#include <sta/devices/stm32/bus/uart.hpp>
#include <sta/debug/printing/printable_uart.hpp>
#include <sta/debug/debug.hpp>
// The UART mutex defined in freertos.c
extern osMutexId_t uartMutexHandle;
namespace sta
{
// Here the printable used for debugging is defined.
Printable * Debug;
namespace rtos
{
// Override the weak implementation of startupExtras provided in rtos2-utils.
void startupExtras(void * argument)
{
// Initialize the mutex for UART communication.
RtosMutex * mutex = new RtosMutex(&uartMutexHandle);
// Initialize the UART interface and printable object.
UARTSettings settings = { .mode = UARTMode::RX_TX };
STM32UART * intf_ptr = new STM32UART(&huart2, settings, mutex);
Debug = new PrintableUART(intf_ptr);
STA_DEBUG_PRINTLN("UART SUCCESSFULLY INITIALIZED");
}
} // namespace rtos
} // namespace sta