Files
PFC/Code/STM32/Core/Src/Components/Start.cpp
2023-03-20 20:59:23 -03:00

50 lines
960 B
C++

#include "Start.hpp"
#include "SerialDebug.hpp"
#include "Robot.hpp"
extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;
extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim2;
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim4;
SerialDebug debug(&huart2, 32);
Robot robot;
//Temporary variables begin
//Temporary Variables end
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){
if(htim==&htim4){
robot.controlCallback();
}
}
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
if(huart == &huart2){
debug.serialTxCpltCallback();
}
}
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
}
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size){
if(huart == &huart1){
robot.uartCallback();
}
}
void start(){
debug.setLevel(SerialDebug::DEBUG_LEVEL_INFO);
debug.info("-----Init-----");
robot.init();
while(true){
}
}