103 lines
1.7 KiB
C
Raw Normal View History

2021-01-09 22:01:21 +01:00
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <main.h>
#include <usart.h>
#include <spi.h>
2021-02-06 18:01:43 +01:00
#include <tim.h>
2021-01-09 22:01:21 +01:00
#include <PontCoopScheduler.h>
#include <show.h>
#include <logger.h>
#include <eeprom.h>
2021-02-16 10:37:09 +01:00
#include <networkAbstractionLayer.h>
2021-01-09 22:01:21 +01:00
#include <config.h>
2021-02-07 23:03:40 +01:00
#include <counter.h>
2021-01-09 22:01:21 +01:00
2021-02-19 21:21:08 +01:00
#if NETWORK_STACK == 2
#include <modemCom.h>
#endif
2021-01-09 22:01:21 +01:00
2021-02-16 10:37:09 +01:00
2021-01-09 22:01:21 +01:00
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");
2021-02-16 13:14:49 +01:00
logMsg("Version: " VERSION);
2021-01-09 22:01:21 +01:00
eepromInit();
configInit();
2021-02-16 10:37:09 +01:00
networkInit();
2021-01-09 22:01:21 +01:00
2021-02-28 21:00:50 +01:00
// counterInit();
2021-02-06 18:01:43 +01:00
2021-01-30 17:56:50 +01:00
logMsg("Application running");
2021-01-09 22:01:21 +01:00
}
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
2021-02-18 17:32:15 +01:00
#if NETWORK_STACK == 2
if (huart == &modemUart) {
modemTxCpltCallback(huart);
}
#endif
2021-01-09 22:01:21 +01:00
}
2021-02-19 21:21:08 +01:00
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
#if NETWORK_STACK == 2
if (huart == &modemUart) {
modemRxCpltCallback(huart);
}
#endif
}
2021-01-09 22:01:21 +01:00
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) {
if (hspi == &eepromSpi) {
eepromSpiTxCpltCallback(hspi);
}
}
2021-02-06 15:31:03 +01:00
2021-02-06 18:01:43 +01:00
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
if (htim == &mainsCnt) {
2021-02-07 23:03:40 +01:00
mainsCntsInputCaptureCallback(htim);
2021-02-06 18:01:43 +01:00
}
2021-02-07 13:14:35 +01:00
}