73 lines
1.2 KiB
C
73 lines
1.2 KiB
C
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#include <PontCoopScheduler.h>
|
|
#include <stdlib.h>
|
|
#include <main.h>
|
|
#include <usart.h>
|
|
|
|
#include <led.h>
|
|
#include <loopCtrl.h>
|
|
|
|
void my_setup_1() {
|
|
schInit();
|
|
}
|
|
|
|
void my_errorHandler() {
|
|
ledRed(true);
|
|
}
|
|
|
|
|
|
|
|
void blinkRed(void *handle) {
|
|
static bool on = false;
|
|
ledRed(on);
|
|
on ^= true;
|
|
}
|
|
|
|
void blinkGreen(void *handle) {
|
|
static bool on = false;
|
|
ledGreen(on);
|
|
on ^= true;
|
|
}
|
|
|
|
void helloWorld(void *handle) {
|
|
static char hello[] = "Hello World\n\r";
|
|
HAL_UART_Transmit_IT(&debugUart, (uint8_t*) hello, strlen(hello));
|
|
}
|
|
|
|
void helloMeterbus(void *handle) {
|
|
static char hello[] = "Hello Meterbus\n\r";
|
|
HAL_UART_Transmit_IT(&mbusUart, (uint8_t*) hello, strlen(hello));
|
|
}
|
|
|
|
void toggleLoop(void *handle) {
|
|
static bool state = false;
|
|
|
|
if (state) {
|
|
loopDisable();
|
|
} else {
|
|
loopEnable();
|
|
}
|
|
state ^= true;
|
|
}
|
|
|
|
void my_setup_2() {
|
|
ledRed(false);
|
|
ledGreen(true);
|
|
|
|
schAdd(helloWorld, NULL, 0, 5000);
|
|
schAdd(toggleLoop, NULL, 0, 10000);
|
|
schAdd(helloMeterbus, NULL, 0, 1000);
|
|
|
|
}
|
|
|
|
void my_loop() {
|
|
schExec();
|
|
}
|
|
|
|
void SYSTICK_Callback() {
|
|
schUpdate();
|
|
}
|