Harmonsation cosmetique
This commit is contained in:
parent
b2d06d9efc
commit
d5ce192720
5 changed files with 157 additions and 3837 deletions
|
|
@ -2,8 +2,7 @@
|
|||
#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
|
||||
MyGPIO_Init(GPIOA, 9 , AltOut_Ppull);
|
||||
// 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_SetPriority(USART1_IRQn, 3<<4);
|
||||
|
||||
|
||||
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
|
||||
USARTx->CR1 |= USART_CR1_UE;
|
||||
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) {
|
||||
while ((USARTx->SR & USART_SR_TXE)==0){}
|
||||
USARTx->DR = car;
|
||||
|
|
@ -54,3 +51,4 @@ void USART1_IRQHandler(void){
|
|||
pFnc_Receive(commande);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "Horloge.h"
|
||||
|
||||
void initPlato(TIM_TypeDef * Timer, int Channel) { // Config du moteur servo
|
||||
|
||||
MyGPIO_Init(GPIOB, 5, AltOut_Ppull); //config pin de direction 0 ou 1
|
||||
if (Timer == TIM3) {
|
||||
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) {
|
||||
|
||||
int duty_cycle;
|
||||
|
||||
if (Consigne>=0) {
|
||||
MYGPIO_PinOn(GPIOB, 5);
|
||||
duty_cycle = Consigne;
|
||||
};
|
||||
|
||||
}
|
||||
if (Consigne<0){
|
||||
MYGPIO_PinOff(GPIOB,5);
|
||||
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
|
|
@ -1,11 +1,12 @@
|
|||
#include "RTC.h"
|
||||
|
||||
|
||||
initRTC() {
|
||||
RTC -> PRLL = 0x7FFF; // Obtenir un période de 1 seconde
|
||||
RTC -> PRLH = 0xFFFF; // Le plus grand possible
|
||||
|
||||
}
|
||||
|
||||
|
||||
int getTime() {
|
||||
return(RTC -> PRLH);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue