add basic scheduler functions
This commit is contained in:
parent
cdcf3a2f9d
commit
7e6eb879f1
3 changed files with 69 additions and 4 deletions
21
Services/Scheduler.c
Normal file
21
Services/Scheduler.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "Scheduler.h"
|
||||
#include "Timer.h"
|
||||
#include "stm32f1xx_ll_utils.h"
|
||||
|
||||
void (*it_callback_SysTick)(void);
|
||||
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
(*it_callback_SysTick)();
|
||||
}
|
||||
|
||||
void Scheduler_conf(void (*it_callback) (void))
|
||||
{
|
||||
it_callback_SysTick = it_callback;
|
||||
LL_Init1msTick(1000);
|
||||
}
|
||||
|
||||
void Scheduler_start(void)
|
||||
{
|
||||
|
||||
}
|
22
Services/Scheduler.h
Normal file
22
Services/Scheduler.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef SCHEDULER_H
|
||||
#define SCHEDULER_H
|
||||
|
||||
#include "stm32f103xb.h"
|
||||
|
||||
/**
|
||||
* @brief Configure l'horloge interne comme ordonanceur
|
||||
* @note
|
||||
* @param (void)* it_callback : Tache de fond à executer
|
||||
* @retval None
|
||||
*/
|
||||
void Scheduler_conf(void (*it_callback) (void));
|
||||
|
||||
/**
|
||||
* @brief Démarre ordonanceur
|
||||
* @note
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void Scheduler_start(void);
|
||||
|
||||
#endif
|
30
Src/main.c
30
Src/main.c
|
@ -21,17 +21,36 @@
|
|||
#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
|
||||
|
||||
#include "Sail.h"
|
||||
#include "Scheduler.h"
|
||||
|
||||
void SystemClock_Config(void);
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
int counter = 1;
|
||||
|
||||
void backgroundTask()
|
||||
{
|
||||
counter++;
|
||||
Sail_background();
|
||||
}
|
||||
|
||||
|
||||
void configurePeripherals()
|
||||
{
|
||||
Sail_conf();
|
||||
}
|
||||
|
||||
void startPeripherals()
|
||||
{
|
||||
Sail_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main program
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Configure the system clock to 72 MHz */
|
||||
|
@ -43,9 +62,12 @@ int main(void)
|
|||
// Lancement chronomètre
|
||||
// Chrono_Start();
|
||||
// time = Chrono_Read();
|
||||
|
||||
Sail_conf();
|
||||
Sail_start();
|
||||
configurePeripherals();
|
||||
startPeripherals();
|
||||
|
||||
Scheduler_conf(backgroundTask);
|
||||
Scheduler_start();
|
||||
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue