84 lines
1.4 KiB
C
84 lines
1.4 KiB
C
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <main.h>
|
|
#include <usart.h>
|
|
#include <spi.h>
|
|
#include <tim.h>
|
|
|
|
#include <PontCoopScheduler.h>
|
|
|
|
#include <show.h>
|
|
#include <logger.h>
|
|
#include <eeprom.h>
|
|
#include <networkAbstractionLayer.h>
|
|
#include <config.h>
|
|
#include <counter.h>
|
|
|
|
|
|
|
|
|
|
|
|
void my_setup_1() {
|
|
schInit();
|
|
logInit();
|
|
showInit();
|
|
}
|
|
|
|
void my_errorHandler() {
|
|
show(LED_RED, ON);
|
|
}
|
|
|
|
void my_setup_2() {
|
|
show(LED_RED, OFF);
|
|
show(LED_GREEN, BLINK);
|
|
logMsg("Application starting");
|
|
logMsg("Version: " VERSION);
|
|
|
|
eepromInit();
|
|
|
|
configInit();
|
|
|
|
networkInit();
|
|
|
|
counterInit();
|
|
|
|
logMsg("Application running");
|
|
}
|
|
|
|
void my_loop() {
|
|
// show(DEBUG_2, TOGGLE);
|
|
|
|
schExec();
|
|
|
|
#ifndef LOGGER_OUTPUT_BY_INTERRUPT
|
|
logExec();
|
|
#endif //LOGGER_OUTPUT_BY_INTERRUPT
|
|
}
|
|
|
|
void SYSTICK_Callback() {
|
|
schUpdate();
|
|
}
|
|
|
|
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
|
|
#ifdef LOGGER_OUTPUT_BY_INTERRUPT
|
|
if (huart == &debugUart) {
|
|
debugTxCpltCallback(huart);
|
|
}
|
|
#endif //LOGGER_OUTPUT_BY_INTERRUPT
|
|
}
|
|
|
|
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) {
|
|
if (hspi == &eepromSpi) {
|
|
eepromSpiTxCpltCallback(hspi);
|
|
}
|
|
}
|
|
|
|
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
|
|
if (htim == &mainsCnt) {
|
|
mainsCntsInputCaptureCallback(htim);
|
|
}
|
|
}
|