extract my own code from main.c into main2.c and use only some hooks

This commit is contained in:
Wolfgang Hottgenroth
2016-10-21 15:56:02 +02:00
parent 0fbdca7aa6
commit 8fe1e172ab
6 changed files with 186 additions and 99 deletions

43
my_src/main2.c Normal file
View File

@ -0,0 +1,43 @@
/*
* 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
*/
#include <stdlib.h>
#include <PontCoopScheduler.h>
#include "stm32f1xx_hal.h"
void blink(void *handle) {
HAL_GPIO_TogglePin(LED_PIN_GPIO_Port, LED_PIN_Pin);
}
void my_setup_1() {
schInit();
schAdd(blink, NULL, 0, 1000);
}
void my_setup_2() {
}
void my_loop() {
schExec();
}
void HAL_SYSTICK_Callback() {
//HAL_GPIO_TogglePin(LED_PIN_GPIO_Port, LED_PIN_Pin);
schUpdate();
}

17
my_src/main2.h Normal file
View File

@ -0,0 +1,17 @@
/*
* main2.h
*
* Created on: Oct 21, 2016
* Author: wn
*/
#ifndef MAIN2_H_
#define MAIN2_H_
void my_setup_1();
void my_setup_2();
void my_loop();
#endif /* MAIN2_H_ */