2016-11-11 21:55:58 +01:00

71 lines
1.3 KiB
C

/*
* main2.c
*
* Created on: Oct 21, 2016
* Author: wn
*/
/*
* 1. insert #include "main2.h" at USER CODE Includes of main.c
* 2. insert my_setup_1(); at USER CODE 1 in main.c
* 3. insert my_setup_2(); at USER CODE 2 in main.c
* 4. insert my_loop(); at USER CODE 3 in main.c
* 5. insert my_errorHandler(); at USER CODE BEGIN Error_Handler in main.c
* All this is done by the script insertMyCode.sh in tools
*/
#include <stdlib.h>
#include <PontCoopScheduler.h>
#include "stm32f1xx_hal.h"
#include "inverter.h"
void blink(void *handle) {
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
}
void my_setup_1() {
schInit();
schAdd(blink, NULL, 0, 100);
}
void my_loop() {
schExec();
}
void HAL_SYSTICK_Callback() {
schUpdate();
}
void my_errorHandler() {
HAL_GPIO_WritePin(ERROR_PIN_GPIO_Port, ERROR_PIN_Pin, GPIO_PIN_SET);
}
void testSwitchFrequency1(void *handle) {
inverterStart(100, CLOCKWISE);
}
void testSwitchFrequency2(void *handle) {
inverterStart(50, CLOCKWISE);
}
void testSwitchFrequency3(void *handle) {
static uint8_t f = 1;
inverterStart(f, CLOCKWISE);
f++;
}
void my_setup_2() {
inverterBegin();
inverterStart(25, CLOCKWISE);
// schAdd(testSwitchFrequency1, NULL, 5000, 0);
// schAdd(testSwitchFrequency2, NULL, 10000, 0);
// schAdd(testSwitchFrequency1, NULL, 15000, 0);
// schAdd(testSwitchFrequency3, NULL, 0, 1000);
}