removed outdated service chrono and outdated drivers
This commit is contained in:
parent
6ec006ddd2
commit
e125c339a0
6 changed files with 0 additions and 618 deletions
|
@ -1,182 +0,0 @@
|
|||
// TOUT A FAIRE !! //
|
||||
|
||||
/*
|
||||
indispensable pour pouvoir adresser les registres des périphériques.
|
||||
Rem : OBLIGATION d'utiliser les définitions utiles contenues dans ce fichier (ex : TIM_CR1_CEN, RCC_APB1ENR_TIM2EN ...)
|
||||
pour une meilleure lisibilité du code.
|
||||
|
||||
Pour les masques, utiliser également les définitions proposée
|
||||
Rappel : pour mettre à 1 , reg = reg | Mask (ou Mask est le représente le ou les bits à positionner à 1)
|
||||
pour mettre à 0 , reg = reg&~ Mask (ou Mask est le représente le ou les bits à positionner à 0)
|
||||
|
||||
*/
|
||||
|
||||
#include "MyTimer.h"
|
||||
#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges
|
||||
#include "stm32f1xx_ll_tim.h"
|
||||
|
||||
|
||||
// variable pointeur de fonction permettant de mémoriser le callback à appeler depuis
|
||||
// le handler d'IT
|
||||
void (*Ptr_ItFct_TIM1)(void);
|
||||
void (*Ptr_ItFct_TIM2)(void);
|
||||
void (*Ptr_ItFct_TIM3)(void);
|
||||
void (*Ptr_ItFct_TIM4)(void);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Active l'horloge et règle l'ARR et le PSC du timer visé
|
||||
* @note Fonction à lancer avant toute autre. Le timer n'est pas encore lancé (voir MyTimerStart)
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* int Arr : valeur à placer dans ARR
|
||||
* int Psc : valeur à placer dans PSC
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_Conf(TIM_TypeDef * Timer,int Arr, int Psc)
|
||||
{
|
||||
LL_TIM_InitTypeDef My_LL_Tim_Init_Struct;
|
||||
|
||||
// Validation horloge locale
|
||||
if (Timer==TIM1) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1);
|
||||
else if (Timer==TIM2) LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM2);
|
||||
else if (Timer==TIM3) LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM3);
|
||||
else LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM4);
|
||||
|
||||
// chargement structure Arr, Psc, Up Count
|
||||
My_LL_Tim_Init_Struct.Autoreload=Arr;
|
||||
My_LL_Tim_Init_Struct.Prescaler=Psc;
|
||||
My_LL_Tim_Init_Struct.ClockDivision=LL_TIM_CLOCKDIVISION_DIV1;
|
||||
My_LL_Tim_Init_Struct.CounterMode=LL_TIM_COUNTERMODE_UP;
|
||||
My_LL_Tim_Init_Struct.RepetitionCounter=0;
|
||||
|
||||
LL_TIM_Init(Timer,&My_LL_Tim_Init_Struct);
|
||||
|
||||
|
||||
// Blocage IT
|
||||
LL_TIM_DisableIT_UPDATE(Timer);
|
||||
|
||||
|
||||
// Blocage Timer
|
||||
LL_TIM_DisableCounter(Timer);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Démarre le timer considéré
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_Start(TIM_TypeDef * Timer)
|
||||
{
|
||||
LL_TIM_EnableCounter(Timer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Arrêt le timer considéré
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_Stop(TIM_TypeDef * Timer)
|
||||
{
|
||||
LL_TIM_DisableCounter(Timer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Configure le Timer considéré en interruption sur débordement.
|
||||
* @note A ce stade, les interruptions ne sont pas validés (voir MyTimer_IT_Enable )
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* void (*IT_function) (void) : nom (adresse) de la fonction à lancer sur interruption
|
||||
* int Prio : priorité associée à l'interruption
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_IT_Conf(TIM_TypeDef * Timer, void (*IT_function) (void),int Prio)
|
||||
{
|
||||
// affectation de la fonction
|
||||
if (Timer==TIM1) Ptr_ItFct_TIM1=IT_function;
|
||||
else if (Timer==TIM2) Ptr_ItFct_TIM2=IT_function;
|
||||
else if (Timer==TIM3) Ptr_ItFct_TIM3=IT_function;
|
||||
else Ptr_ItFct_TIM4=IT_function;
|
||||
|
||||
|
||||
// Blocage IT (il faudra la débloquer voir fct suivante)
|
||||
LL_TIM_DisableIT_UPDATE(Timer);
|
||||
|
||||
// validation du canal NVIC
|
||||
IRQn_Type TIM_irq;
|
||||
|
||||
if (Timer==TIM1) TIM_irq=TIM1_UP_IRQn;
|
||||
else if (Timer==TIM2) TIM_irq=TIM2_IRQn;
|
||||
else if (Timer==TIM3) TIM_irq=TIM3_IRQn;
|
||||
else TIM_irq=TIM4_IRQn;
|
||||
|
||||
NVIC_SetPriority(TIM_irq, Prio);
|
||||
NVIC_EnableIRQ(TIM_irq);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Autorise les interruptions
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_IT_Enable(TIM_TypeDef * Timer)
|
||||
{
|
||||
LL_TIM_EnableIT_UPDATE(Timer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Interdit les interruptions
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_IT_Disable(TIM_TypeDef * Timer)
|
||||
{
|
||||
LL_TIM_DisableIT_UPDATE(Timer);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============ LES INTERRUPTIONS =================================
|
||||
|
||||
*/
|
||||
|
||||
void TIM1_UP_IRQHandler(void)
|
||||
{
|
||||
// rabaisser le flag d'IT
|
||||
LL_TIM_ClearFlag_UPDATE(TIM1);
|
||||
(*Ptr_ItFct_TIM1)();
|
||||
}
|
||||
|
||||
void TIM2_IRQHandler(void)
|
||||
{
|
||||
// rabaisser le flag d'IT
|
||||
LL_TIM_ClearFlag_UPDATE(TIM2);
|
||||
(*Ptr_ItFct_TIM2)();
|
||||
}
|
||||
|
||||
void TIM3_IRQHandler(void)
|
||||
{
|
||||
// rabaisser le flag d'IT
|
||||
LL_TIM_ClearFlag_UPDATE(TIM3);
|
||||
(*Ptr_ItFct_TIM3)();
|
||||
}
|
||||
|
||||
void TIM4_IRQHandler(void)
|
||||
{
|
||||
// rabaisser le flag d'IT
|
||||
LL_TIM_ClearFlag_UPDATE(TIM4);
|
||||
(*Ptr_ItFct_TIM4)();
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
// RIEN A MODIFIER //
|
||||
|
||||
#ifndef MY_TIMER_H
|
||||
#define MY_TIMER_H
|
||||
|
||||
/*
|
||||
Driver pour Timer 1 à 4 du STM32F103RB
|
||||
|
||||
*/
|
||||
|
||||
#include "stm32f103xb.h"
|
||||
|
||||
/**
|
||||
* @brief Active l'horloge et règle l'ARR et le PSC du timer visé
|
||||
* @note Fonction à lancer avant toute autre. Le timer n'est pas encore lancé (voir MyTimerStart)
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* int Arr : valeur à placer dans ARR
|
||||
* int Psc : valeur à placer dans PSC
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_Conf(TIM_TypeDef * Timer,int Arr, int Psc);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Démarre le timer considéré
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_Start(TIM_TypeDef * Timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Arrêt le timer considéré
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_Stop(TIM_TypeDef * Timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Configure le Timer considéré en interruption sur débordement.
|
||||
* @note A ce stade, les interruptions ne sont pas validés (voir MyTimer_IT_Enable )
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* void (*IT_function) (void) : nom (adresse) de la fonction à lancer sur interruption
|
||||
* int Prio : priorité associée à l'interruption
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_IT_Conf(TIM_TypeDef * Timer, void (*IT_function) (void),int Prio);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Autorise les interruptions
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_IT_Enable(TIM_TypeDef * Timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Interdit les interruptions
|
||||
* @note
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void MyTimer_IT_Disable(TIM_TypeDef * Timer);
|
||||
|
||||
#endif
|
|
@ -1,67 +0,0 @@
|
|||
#include "MyUart.h"
|
||||
#include "stm32f1xx_ll_bus.h"
|
||||
#include "stm32f1xx_ll_usart.h"
|
||||
#include "stm32f1xx_ll_gpio.h"
|
||||
|
||||
void MyUart_Conf(USART_TypeDef * uart_port, int baudrate){
|
||||
|
||||
LL_USART_InitTypeDef My_LL_Usart_Init_Struct;
|
||||
|
||||
if (uart_port==USART1) {
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1);
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
||||
LL_GPIO_InitTypeDef tx;
|
||||
tx.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
tx.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
tx.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
tx.Pin = LL_GPIO_PIN_9;
|
||||
LL_GPIO_Init(GPIOA, &tx);
|
||||
}
|
||||
if (uart_port==USART2){
|
||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
||||
LL_GPIO_InitTypeDef tx;
|
||||
tx.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
tx.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
tx.Pull = LL_GPIO_PULL_UP;
|
||||
tx.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
tx.Pin = LL_GPIO_PIN_2;
|
||||
LL_GPIO_Init(GPIOA, &tx);
|
||||
}
|
||||
if (uart_port==USART3){
|
||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3);
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
|
||||
LL_GPIO_InitTypeDef tx;
|
||||
tx.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
tx.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
tx.Pull = LL_GPIO_PULL_UP;
|
||||
tx.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
tx.Pin = LL_GPIO_PIN_10;
|
||||
LL_GPIO_Init(GPIOC, &tx);
|
||||
}
|
||||
|
||||
My_LL_Usart_Init_Struct.BaudRate = baudrate;
|
||||
My_LL_Usart_Init_Struct.DataWidth = LL_USART_DATAWIDTH_8B ;
|
||||
My_LL_Usart_Init_Struct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||
My_LL_Usart_Init_Struct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||
My_LL_Usart_Init_Struct.Parity = LL_USART_PARITY_NONE;
|
||||
My_LL_Usart_Init_Struct.StopBits = LL_USART_STOPBITS_1;
|
||||
My_LL_Usart_Init_Struct.TransferDirection = LL_USART_DIRECTION_TX_RX ;
|
||||
|
||||
LL_USART_Init(uart_port,&My_LL_Usart_Init_Struct);
|
||||
LL_USART_Enable(uart_port);
|
||||
|
||||
/*int periph_speed;
|
||||
if (uart_port==USART1) periph_speed = 36000000;
|
||||
if (uart_port==USART2) periph_speed = 72000000;
|
||||
if (uart_port==USART3) periph_speed = 72000000;
|
||||
|
||||
LL_USART_SetBaudRate(uart_port, periph_speed, baudrate);
|
||||
*/}
|
||||
|
||||
void MyUart_send_bytes(USART_TypeDef * uart_port,char* buf, int len){
|
||||
for(int i = 0; i < len; i++){
|
||||
LL_USART_TransmitData8(uart_port, buf[i]);
|
||||
while(!LL_USART_IsActiveFlag_TXE(uart_port));
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef MYUART_H
|
||||
#define MYUART_H
|
||||
|
||||
#include "stm32f1xx_ll_usart.h"
|
||||
|
||||
void MyUart_Conf(USART_TypeDef * uart_port, int baudrate);
|
||||
|
||||
void MyUart_send_bytes(USART_TypeDef * uart_port,char* buf, int len);
|
||||
|
||||
#endif
|
|
@ -1,182 +0,0 @@
|
|||
// A COMPLETER
|
||||
|
||||
/*
|
||||
Service permettant de chornométrer jusqu'à 59mn 59s 99 1/100
|
||||
Utilise un timer au choix (TIMER1 à TIMER4).
|
||||
Utilise la lib MyTimers.h /.c
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Chrono.h"
|
||||
#include "MyTimer.h"
|
||||
#include "stm32f1xx_ll_gpio.h"
|
||||
#include "stm32f1xx_ll_bus.h"
|
||||
|
||||
// variable privée de type Time qui mémorise la durée mesurée
|
||||
static Time Chrono_Time; // rem : static rend la visibilité de la variable Chrono_Time limitée à ce fichier
|
||||
|
||||
// variable privée qui mémorise pour le module le timer utilisé par le module
|
||||
static TIM_TypeDef * Chrono_Timer=TIM1; // init par défaut au cas où l'utilisateur ne lance pas Chrono_Conf avant toute autre fct.
|
||||
|
||||
// déclaration callback appelé toute les 10ms
|
||||
void Chrono_Task_10ms(void);
|
||||
|
||||
int running = 0;
|
||||
|
||||
/**
|
||||
* @brief Configure le chronomètre.
|
||||
* @note A lancer avant toute autre fonction.
|
||||
* @param Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void Chrono_Conf(TIM_TypeDef * Timer)
|
||||
{
|
||||
// Reset Time
|
||||
Chrono_Time.Hund=0;
|
||||
Chrono_Time.Sec=0;
|
||||
Chrono_Time.Min=0;
|
||||
|
||||
// Fixation du Timer
|
||||
Chrono_Timer=Timer;
|
||||
|
||||
Chrono_Conf_io();
|
||||
// Réglage Timer pour un débordement à 10ms
|
||||
MyTimer_Conf(Chrono_Timer,999, 719);
|
||||
|
||||
// Réglage interruption du Timer avec callback : Chrono_Task_10ms()
|
||||
MyTimer_IT_Conf(Chrono_Timer, Chrono_Task_10ms,3);
|
||||
|
||||
// Validation IT
|
||||
MyTimer_IT_Enable(Chrono_Timer);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Démarre le chronomètre.
|
||||
* @note si la durée dépasse 59mn 59sec 99 Hund, elle est remise à zéro et repart
|
||||
* @param Aucun
|
||||
* @retval Aucun
|
||||
*/
|
||||
void Chrono_Start(void)
|
||||
{
|
||||
MyTimer_Start(Chrono_Timer);
|
||||
running = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Arrête le chronomètre.
|
||||
* @note
|
||||
* @param Aucun
|
||||
* @retval Aucun
|
||||
*/
|
||||
void Chrono_Stop(void)
|
||||
{
|
||||
MyTimer_Stop(Chrono_Timer);
|
||||
running = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Remet le chronomètre à 0
|
||||
* @note
|
||||
* @param Aucun
|
||||
* @retval Aucun
|
||||
*/
|
||||
void Chrono_Reset(void)
|
||||
{
|
||||
// Arrêt Chrono
|
||||
MyTimer_Stop(Chrono_Timer);
|
||||
|
||||
// Reset Time
|
||||
Chrono_Time.Hund=0;
|
||||
Chrono_Time.Sec=0;
|
||||
Chrono_Time.Min=0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Renvoie l'adresse de la variable Time privée gérée dans le module Chrono.c
|
||||
* @note
|
||||
* @param Aucun
|
||||
* @retval adresse de la variable Time
|
||||
*/
|
||||
Time * Chrono_Read(void)
|
||||
{
|
||||
return &Chrono_Time;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief incrémente la variable privée Chron_Time modulo 60mn
|
||||
* @note
|
||||
* @param Aucun
|
||||
* @retval Aucun
|
||||
*/
|
||||
void Chrono_Task_10ms(void)
|
||||
{
|
||||
Chrono_Time.Hund++;
|
||||
if (Chrono_Time.Hund==100)
|
||||
{
|
||||
Chrono_Time.Sec++;
|
||||
Chrono_Time.Hund=0;
|
||||
}
|
||||
if (Chrono_Time.Sec==60)
|
||||
{
|
||||
Chrono_Time.Min++;
|
||||
Chrono_Time.Sec=0;
|
||||
}
|
||||
if (Chrono_Time.Min==60)
|
||||
{
|
||||
Chrono_Time.Hund=0;
|
||||
}
|
||||
if ( Chrono_Time.Sec % 2) {
|
||||
LL_GPIO_SetOutputPin(GPIOC,LL_GPIO_PIN_10);
|
||||
} else {
|
||||
LL_GPIO_ResetOutputPin(GPIOC,LL_GPIO_PIN_10);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configurer les 3 IO pour recevoir les 2 BP et la LED
|
||||
*/
|
||||
void Chrono_Conf_io(void) {
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
|
||||
|
||||
LL_GPIO_InitTypeDef button_rouge_conf;
|
||||
button_rouge_conf.Mode = LL_GPIO_MODE_FLOATING;
|
||||
button_rouge_conf.Pin = LL_GPIO_PIN_8;
|
||||
LL_GPIO_Init(GPIOC, &button_rouge_conf);
|
||||
|
||||
|
||||
LL_GPIO_InitTypeDef button_bleu_conf;
|
||||
button_bleu_conf.Mode = LL_GPIO_MODE_FLOATING;
|
||||
button_bleu_conf.Pin = LL_GPIO_PIN_13;
|
||||
LL_GPIO_Init(GPIOC, &button_bleu_conf);
|
||||
|
||||
LL_GPIO_InitTypeDef led;
|
||||
led.Mode = LL_GPIO_MODE_OUTPUT;
|
||||
led.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
|
||||
led.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
led.Pin = LL_GPIO_PIN_10;
|
||||
LL_GPIO_Init(GPIOC, &led);
|
||||
}
|
||||
|
||||
void Chrono_Background(void){
|
||||
if(LL_GPIO_IsInputPinSet(GPIOC, LL_GPIO_PIN_8)) {
|
||||
if(running) {
|
||||
Chrono_Stop();
|
||||
} else {
|
||||
Chrono_Start();
|
||||
}
|
||||
}
|
||||
if(!(LL_GPIO_IsInputPinSet(GPIOC, LL_GPIO_PIN_13))) { // negative logic for blue button
|
||||
Chrono_Reset();
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
// RIEN A MODIFIER //
|
||||
|
||||
#ifndef CHRONO_H
|
||||
#define CHRONO_H
|
||||
|
||||
/*
|
||||
Service permettant de chornométrer jusqu'à 59mn 59s 99 1/100
|
||||
Utilise un timer au choix (TIMER1 à TIMER4).
|
||||
Utilise la lib MyTimers.h /.c
|
||||
*/
|
||||
|
||||
#include "stm32f103xb.h"
|
||||
|
||||
/* =====================================================================================
|
||||
Les fonctions qui gèrent les IO (ajout par rapport à l'activité 1)
|
||||
=======================================================================================*/
|
||||
|
||||
|
||||
#define PinStart LL_GPIO_PIN_8
|
||||
#define PinStop LL_GPIO_PIN_6
|
||||
// à compléter pour la pin reset du chronometre
|
||||
#define PinLED LL_GPIO_PIN_10
|
||||
#define GPIO_Pin GPIOC
|
||||
#define GPIO_LED GPIOC
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief polle les 3 entrées et gènère les actions à faire
|
||||
* @note Fct à lancer en tâche de fond (non bloquante)
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
void Chrono_Background(void);
|
||||
|
||||
//=======================================================================================//
|
||||
|
||||
|
||||
|
||||
|
||||
// Type de donnée utilisé dans le module
|
||||
|
||||
typedef struct {
|
||||
char Hund;
|
||||
char Sec;
|
||||
char Min;
|
||||
} Time;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Configure le chronomètre.
|
||||
* @note A lancer avant toute autre fonction.
|
||||
* @param TIM_TypeDef Timer : indique le timer à utiliser par le chronomètre, TIM1, TIM2, TIM3 ou TIM4
|
||||
* @retval None
|
||||
*/
|
||||
void Chrono_Conf(TIM_TypeDef * Timer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Démarre le chronomètre.
|
||||
* @note si la durée dépasse 59mn 59sec 99 cent, elle est remise à zéro et repart
|
||||
* @param Aucun
|
||||
* @retval Aucun
|
||||
*/
|
||||
void Chrono_Start(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Arrête le chronomètre.
|
||||
* @note
|
||||
* @param Aucun
|
||||
* @retval Aucun
|
||||
*/
|
||||
void Chrono_Stop(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Remet le chronomètre à 0
|
||||
* @note
|
||||
* @param Aucun
|
||||
* @retval Aucun
|
||||
*/
|
||||
void Chrono_Reset(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Renvoie l'adresse de la variable Time privée gérée dans le module Chrono.c
|
||||
* @note
|
||||
* @param Aucun
|
||||
* @retval adresse de la variable Time
|
||||
*/
|
||||
Time * Chrono_Read(void);
|
||||
|
||||
void Chrono_Conf_io(void);
|
||||
|
||||
void Chrono_Background(void);
|
||||
#endif
|
Loading…
Reference in a new issue