2020-11-17 15:38:11 +01:00

101 lines
1.7 KiB
C

#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <main.h>
#include <usart.h>
#include <adc.h>
#include <spi.h>
#include <PontCoopScheduler.h>
#include <show.h>
#include <loopCtrl.h>
#include <mbusComm.h>
#include <logger.h>
#include <frontend.h>
#include <eeprom.h>
#include <wizHelper.h>
#include <mqttComm.h>
#include <cmdHandler.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");
eepromInit();
wizInit();
mqttCommInit();
cmdHandlerInit();
frontendInit();
frontendSetThreshold(240);
mbusCommInit();
}
void my_loop() {
show(DEBUG_1, TOGGLE);
schExec();
#ifndef LOGGER_OUTPUT_BY_INTERRUPT
logExec();
#endif //LOGGER_OUTPUT_BY_INTERRUPT
}
void SYSTICK_Callback() {
schUpdate();
}
void HAL_GPIO_EXTI_Callback(uint16_t pin) {
if (pin == Loop_Status_Pin) {
loopStatusCallback();
}
}
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
if (hadc == &frontendAdc) {
frontendAdcCallback(hadc);
}
}
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
if (huart == &mbusUart) {
mbusCommTxCpltCallback(huart);
}
#ifdef LOGGER_OUTPUT_BY_INTERRUPT
else if (huart == &debugUart) {
debugTxCpltCallback(huart);
}
#endif //LOGGER_OUTPUT_BY_INTERRUPT
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
if (huart == &mbusUart) {
mbusCommRxCpltCallback(huart);
}
}
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) {
if (hspi == &eepromSpi) {
eepromSpiTxCpltCallback(hspi);
}
}