Harmonsation cosmetique

This commit is contained in:
Aleksander Taban 2025-12-16 20:33:39 +01:00
parent b2d06d9efc
commit d5ce192720
No known key found for this signature in database
5 changed files with 157 additions and 3837 deletions

View file

@ -2,8 +2,7 @@
#include "DriverGPIO.h" #include "DriverGPIO.h"
void My_USART_Config(USART_TypeDef* USARTx, uint32_t baudrate) { //QUE POUR USART1 void My_USART_Config(USART_TypeDef* USARTx, uint32_t baudrate) { //QUE POUR USART_CR1_RE
// Configuration PA9 (Tx) en Alternate Function Push-Pull // Configuration PA9 (Tx) en Alternate Function Push-Pull
MyGPIO_Init(GPIOA, 9 , AltOut_Ppull); MyGPIO_Init(GPIOA, 9 , AltOut_Ppull);
// Configuration PA10 (Rx) en Input Floating // Configuration PA10 (Rx) en Input Floating
@ -11,7 +10,6 @@ void My_USART_Config(USART_TypeDef* USARTx, uint32_t baudrate) { //QUE POUR USAR
NVIC_EnableIRQ(USART1_IRQn); NVIC_EnableIRQ(USART1_IRQn);
NVIC_SetPriority(USART1_IRQn, 3<<4); NVIC_SetPriority(USART1_IRQn, 3<<4);
RCC->APB2ENR |= RCC_APB2ENR_USART1EN; RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
USARTx->CR1 |= USART_CR1_UE; USARTx->CR1 |= USART_CR1_UE;
USARTx->BRR = baudrate; USARTx->BRR = baudrate;
@ -20,7 +18,6 @@ void My_USART_Config(USART_TypeDef* USARTx, uint32_t baudrate) { //QUE POUR USAR
}; };
void USART_Send_Char(USART_TypeDef* USARTx, char car) { void USART_Send_Char(USART_TypeDef* USARTx, char car) {
while ((USARTx->SR & USART_SR_TXE)==0){} while ((USARTx->SR & USART_SR_TXE)==0){}
USARTx->DR = car; USARTx->DR = car;
@ -54,3 +51,4 @@ void USART1_IRQHandler(void){
pFnc_Receive(commande); pFnc_Receive(commande);
} }
}; };

View file

@ -4,7 +4,6 @@
#include "Horloge.h" #include "Horloge.h"
void initPlato(TIM_TypeDef * Timer, int Channel) { // Config du moteur servo void initPlato(TIM_TypeDef * Timer, int Channel) { // Config du moteur servo
MyGPIO_Init(GPIOB, 5, AltOut_Ppull); //config pin de direction 0 ou 1 MyGPIO_Init(GPIOB, 5, AltOut_Ppull); //config pin de direction 0 ou 1
if (Timer == TIM3) { if (Timer == TIM3) {
Timer_Init(TIM3, 159, 17); // Pour obtenir fréq de 20kHZ Timer_Init(TIM3, 159, 17); // Pour obtenir fréq de 20kHZ
@ -23,19 +22,14 @@ void initPlato(TIM_TypeDef * Timer, int Channel){ // Config du moteur servo
void Update_Motor_PWM(int Consigne, TIM_TypeDef * Timer, int Channel) { void Update_Motor_PWM(int Consigne, TIM_TypeDef * Timer, int Channel) {
int duty_cycle; int duty_cycle;
if (Consigne>=0) { if (Consigne>=0) {
MYGPIO_PinOn(GPIOB, 5); MYGPIO_PinOn(GPIOB, 5);
duty_cycle = Consigne; duty_cycle = Consigne;
}; }
if (Consigne<0){ if (Consigne<0){
MYGPIO_PinOff(GPIOB,5); MYGPIO_PinOff(GPIOB,5);
duty_cycle = -Consigne; duty_cycle = -Consigne;
}; }
Set_DutyCycle_PWM(Timer, Channel, duty_cycle);
Set_DutyCycle_PWM(Timer, Channel, duty_cycle);
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,11 +1,12 @@
#include "RTC.h" #include "RTC.h"
initRTC() { initRTC() {
RTC -> PRLL = 0x7FFF; // Obtenir un période de 1 seconde RTC -> PRLL = 0x7FFF; // Obtenir un période de 1 seconde
RTC -> PRLH = 0xFFFF; // Le plus grand possible RTC -> PRLH = 0xFFFF; // Le plus grand possible
} }
int getTime() { int getTime() {
return(RTC -> PRLH); return(RTC -> PRLH);
} }