Version finale Plateau

This commit is contained in:
Vincent Goncalves 2025-11-18 15:09:57 +01:00
parent cb8e5cc6e1
commit 596d8a93e8
5 changed files with 12 additions and 12 deletions

View file

@ -1,9 +1,9 @@
#include <stm32f10x.h> #include <stm32f10x.h>
#include <Plateau.h> #include <Plateau.h>
#include <MyTimer.h> #include <MyTimer.h>
#include "GPIO.h" #include <GPIO.h>
#include "ADC.h" #include <ADC.h>
#include "USART.h" #include <USART.h>
void handler_USART1 (void) { void handler_USART1 (void) {
//Pour le projet : Lancer PWM en fonction de la valeur du curseur //Pour le projet : Lancer PWM en fonction de la valeur du curseur
@ -11,14 +11,14 @@ void handler_USART1 (void) {
char valabs; char valabs;
if (data & (1<<7)) { if (data & (1<<7)) {
MyGPIO_Set(GPIOA, 1); MyGPIO_Set(GPIOA, 1);
valabs = 2^7 - (data & 0x7F); valabs = (1<<7) - (data & 0x7F);
Mytimer_PWM_cycle(TIM3, 3, valabs); Mytimer_PWM_cycle(TIM3, 3, valabs);
} }
else { else {
MyGPIO_Reset(GPIOA, 1); MyGPIO_Reset(GPIOA, 1);
Mytimer_PWM_cycle(TIM3, 3, data); Mytimer_PWM_cycle(TIM3, 3, data);
} }
MyTimer_Base_Start(TIM3);
} }
void Plateau_Init (void){ void Plateau_Init (void){
@ -28,5 +28,5 @@ void Plateau_Init (void){
Mytimer_PWM(TIM3, 3); Mytimer_PWM(TIM3, 3);
My_USART_Init(USART1); My_USART_Init(USART1);
MyUSART_ActiveIT(USART1, 6, &handler_USART1); MyUSART_ActiveIT(USART1, 6, &handler_USART1);
} MyTimer_Base_Start(TIM3);
}

View file

@ -1,5 +1,5 @@
#include "stm32f10x.h" #include <stm32f10x.h>
#include "GPIO.h" #include <GPIO.h>
void MyGPIO_Init(GPIO_TypeDef *GPIO, char pin, char conf){ void MyGPIO_Init(GPIO_TypeDef *GPIO, char pin, char conf){
if (GPIO == GPIOA) {RCC->APB2ENR |= (RCC_APB2ENR_IOPAEN);} if (GPIO == GPIOA) {RCC->APB2ENR |= (RCC_APB2ENR_IOPAEN);}

View file

@ -1,6 +1,6 @@
#ifndef MYGPIO_H #ifndef MYGPIO_H
#define MYGPIO_H #define MYGPIO_H
#include "stm32f10x.h" #include <stm32f10x.h>
#define In_Floating 0x4 #define In_Floating 0x4
#define In_PullDown 0x8 #define In_PullDown 0x8

View file

@ -1,6 +1,6 @@
#ifndef MYTIMER_H #ifndef MYTIMER_H
#define MYTIMER_H #define MYTIMER_H
#include "stm32f10x.h" #include <stm32f10x.h>
#define MyTimer_Base_Start(Timer) Timer->CR1|=TIM_CR1_CEN; #define MyTimer_Base_Start(Timer) Timer->CR1|=TIM_CR1_CEN;
#define MyTimer_Base_Stop(Timer) Timer->CR1&=~TIM_CR1_CEN; #define MyTimer_Base_Stop(Timer) Timer->CR1&=~TIM_CR1_CEN;

View file

@ -1,5 +1,5 @@
#include <stm32f10x.h> #include <stm32f10x.h>
#include "USART.h" #include <USART.h>
#include <GPIO.h> #include <GPIO.h>
void (*ptr_fct_u1) (void); void (*ptr_fct_u1) (void);