54 lines
861 B
C
Raw Normal View History

2020-10-18 22:02:17 +02:00
#include <string.h>
#include <stdint.h>
2020-10-24 19:34:30 +02:00
#include <stdbool.h>
2020-10-18 22:02:17 +02:00
#include <PontCoopScheduler.h>
#include <stdlib.h>
#include <main.h>
#include <usart.h>
2020-10-27 15:12:19 +01:00
#include <led.h>
#include <loopCtrl.h>
2020-10-28 19:40:08 +01:00
#include <mbusComm.h>
2020-10-18 22:02:17 +02:00
void my_setup_1() {
2020-10-27 15:12:19 +01:00
schInit();
2020-10-18 22:02:17 +02:00
}
void my_errorHandler() {
2020-10-27 15:12:19 +01:00
ledRed(true);
2020-10-18 22:02:17 +02:00
}
void helloWorld(void *handle) {
2020-10-27 15:12:19 +01:00
static char hello[] = "Hello World\n\r";
HAL_UART_Transmit_IT(&debugUart, (uint8_t*) hello, strlen(hello));
2020-10-18 22:02:17 +02:00
}
2020-10-25 15:37:16 +01:00
void helloMeterbus(void *handle) {
2020-10-28 19:40:08 +01:00
mbusCommRequest(0x5b, 80);
}
2020-10-24 19:34:30 +02:00
2020-10-18 22:02:17 +02:00
void my_setup_2() {
2020-10-27 15:12:19 +01:00
ledRed(false);
ledGreen(true);
schAdd(helloWorld, NULL, 0, 5000);
2020-10-27 22:28:03 +01:00
schAdd(helloMeterbus, NULL, 0, 10000);
2020-10-25 15:37:16 +01:00
2020-10-18 22:02:17 +02:00
}
void my_loop() {
2020-10-27 15:12:19 +01:00
schExec();
2020-10-18 22:02:17 +02:00
}
void SYSTICK_Callback() {
2020-10-27 15:12:19 +01:00
schUpdate();
2020-10-18 22:02:17 +02:00
}
2020-10-27 22:28:03 +01:00
void HAL_GPIO_EXTI_Callback(uint16_t pin) {
if (pin == Loop_Status_Pin) {
loopStatusCallback();
}
}