extract my own code from main.c into main2.c and use only some hooks
This commit is contained in:
43
my_src/main2.c
Normal file
43
my_src/main2.c
Normal 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
17
my_src/main2.h
Normal 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_ */
|
Reference in New Issue
Block a user