Compare commits
5 commits
695a1f765d
...
c011e41742
Author | SHA1 | Date | |
---|---|---|---|
|
c011e41742 | ||
|
c44cf99375 | ||
|
f0159d79d5 | ||
ab7278d21a | |||
f17dd1744f |
10 changed files with 239 additions and 199 deletions
|
@ -2,7 +2,7 @@
|
||||||
#define MYGPIO_H
|
#define MYGPIO_H
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
|
||||||
#define In_Floating 0x4 // a completer
|
#define In_Floating 0x4
|
||||||
#define In_PullDown 0x8
|
#define In_PullDown 0x8
|
||||||
#define In_PullUp 0x9
|
#define In_PullUp 0x9
|
||||||
#define In_Analog 0x0
|
#define In_Analog 0x0
|
||||||
|
@ -21,7 +21,7 @@ typedef struct
|
||||||
|
|
||||||
|
|
||||||
void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr ) ;
|
void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr ) ;
|
||||||
int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ; // renvoie 0 ou autre chose different de 0
|
int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ; // renvoie 0 ou 1
|
||||||
void MyGPIO_Set ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
void MyGPIO_Set ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
||||||
void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
||||||
void MyGPIO_Toggle ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
void MyGPIO_Toggle ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
||||||
|
|
|
@ -31,6 +31,12 @@ void MyTimer_ActiveIT (TIM_TypeDef * Timer, char Prio, void (*IT_function)(void)
|
||||||
|
|
||||||
#define MyTimer_Base_Start(Timer) (Timer->CR1 |= 0x01)
|
#define MyTimer_Base_Start(Timer) (Timer->CR1 |= 0x01)
|
||||||
#define MyTimer_Base_Stop(Timer) (Timer->CR1 &= ~0x01)
|
#define MyTimer_Base_Stop(Timer) (Timer->CR1 &= ~0x01)
|
||||||
|
#define PWM_output 0x00
|
||||||
|
#define PWM_inputTI1 0x01
|
||||||
|
#define PWM_inputTI2 0x10
|
||||||
|
#define PWM_inputTRC 0x11
|
||||||
|
|
||||||
|
void MyPWM_init ( TIM_TypeDef * Timer,char Channel);
|
||||||
|
void MyPWM_Duty (TIM_TypeDef * Timer,char Channel, unsigned short CRR );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@ void (*adc2_ptr_func)(void);
|
||||||
void MyADC_init(MyADC_Struct_TypeDef* myADC)
|
void MyADC_init(MyADC_Struct_TypeDef* myADC)
|
||||||
{
|
{
|
||||||
MyGPIO_Struct_TypeDef Port_ADC;
|
MyGPIO_Struct_TypeDef Port_ADC;
|
||||||
switch (myADC->channel)
|
switch (myADC->channel) // On initialise et configure le port correspondant au channel choisi
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
Port_ADC.GPIO=GPIOA;
|
Port_ADC.GPIO=GPIOA;
|
||||||
|
@ -142,17 +142,17 @@ void MyADC_start_conversion(ADC_TypeDef* ADC)
|
||||||
|
|
||||||
void ADC1_2_IRQHandler(void)
|
void ADC1_2_IRQHandler(void)
|
||||||
{
|
{
|
||||||
if(ADC1->SR & ~ADC_SR_EOC)
|
if(ADC1->SR & ~ADC_SR_EOC) // On vérifie si le flag levé est celui de l'ADC1
|
||||||
{
|
{
|
||||||
ADC1->SR &= ~ADC_SR_EOC ;
|
ADC1->SR &= ~ADC_SR_EOC ; // On remet à 0 le drapeau
|
||||||
if(adc1_ptr_func!=0)
|
if(adc1_ptr_func!=0)
|
||||||
{
|
{
|
||||||
(*adc1_ptr_func)();
|
(*adc1_ptr_func)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ADC2->SR & ~ADC_SR_EOC)
|
else if(ADC2->SR & ~ADC_SR_EOC) // On vérifie si le flag levé est celui de l'ADC2
|
||||||
{
|
{
|
||||||
ADC2->SR &= ~ADC_SR_EOC ;
|
ADC2->SR &= ~ADC_SR_EOC ; // On remet à 0 le drapeau
|
||||||
if(adc2_ptr_func!=0)
|
if(adc2_ptr_func!=0)
|
||||||
{
|
{
|
||||||
(*adc2_ptr_func)();
|
(*adc2_ptr_func)();
|
||||||
|
@ -163,7 +163,7 @@ void ADC1_2_IRQHandler(void)
|
||||||
|
|
||||||
void MyADC_ActiveIT (ADC_TypeDef * ADC, char Prio, void (*IT_function)(void))
|
void MyADC_ActiveIT (ADC_TypeDef * ADC, char Prio, void (*IT_function)(void))
|
||||||
{
|
{
|
||||||
ADC->CR1 |= ADC_CR1_EOCIE;
|
ADC->CR1 |= ADC_CR1_EOCIE; // On autorise l'interruption sur les ADC// On précise quelle interruption on souhaite activé// On précise la priorité qu'on souhaite lui donner
|
||||||
if(ADC==ADC1)
|
if(ADC==ADC1)
|
||||||
{
|
{
|
||||||
adc1_ptr_func=IT_function;
|
adc1_ptr_func=IT_function;
|
||||||
|
@ -172,8 +172,8 @@ void MyADC_ActiveIT (ADC_TypeDef * ADC, char Prio, void (*IT_function)(void))
|
||||||
{
|
{
|
||||||
adc2_ptr_func=IT_function;
|
adc2_ptr_func=IT_function;
|
||||||
}
|
}
|
||||||
NVIC->ISER[0] |= 0x01<<ADC1_2_IRQn;
|
NVIC->ISER[0] |= 0x01<<ADC1_2_IRQn; // On précise quelle interruption on souhaite activé
|
||||||
NVIC->IP[ADC1_2_IRQn] |= Prio << 4;
|
NVIC->IP[ADC1_2_IRQn] |= Prio << 4; // On précise la priorité qu'on souhaite lui donner
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr )
|
||||||
{
|
{
|
||||||
if(GPIOStructPtr->GPIO==GPIOA)
|
if(GPIOStructPtr->GPIO==GPIOA)
|
||||||
{
|
{
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
|
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; // Active l'horloge pour
|
||||||
}
|
}
|
||||||
else if (GPIOStructPtr->GPIO==GPIOB)
|
else if (GPIOStructPtr->GPIO==GPIOB)
|
||||||
{
|
{
|
||||||
|
@ -22,41 +22,41 @@ void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr )
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
|
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GPIOStructPtr->GPIO_Conf==0x9)
|
if(GPIOStructPtr->GPIO_Conf==In_PullUp)
|
||||||
{
|
{
|
||||||
GPIOStructPtr->GPIO_Conf=GPIOStructPtr->GPIO_Conf-1;
|
GPIOStructPtr->GPIO_Conf=GPIOStructPtr->GPIO_Conf-1;
|
||||||
GPIOStructPtr->GPIO->ODR |= 0x1<<(((GPIOStructPtr->GPIO_Pin)));
|
GPIOStructPtr->GPIO->ODR |= 0x1<<(((GPIOStructPtr->GPIO_Pin)));
|
||||||
}
|
}
|
||||||
else if(GPIOStructPtr->GPIO_Conf==0x8)
|
else if(GPIOStructPtr->GPIO_Conf==In_PullDown)
|
||||||
{
|
{
|
||||||
GPIOStructPtr->GPIO->ODR &= ~0x1<<(((GPIOStructPtr->GPIO_Pin)));
|
GPIOStructPtr->GPIO->ODR &= ~0x1<<(((GPIOStructPtr->GPIO_Pin)));
|
||||||
}
|
}
|
||||||
if(GPIOStructPtr->GPIO_Pin>=8)
|
if(GPIOStructPtr->GPIO_Pin>=8) // Si le numéro de pin est supérieur ou égal à 8 alors on écrit dans le registre CRHigh
|
||||||
{
|
{
|
||||||
GPIOStructPtr->GPIO->CRH &= ~0xF<<(4*((GPIOStructPtr->GPIO_Pin)%8)); //on met a 0 les bit de config du pin
|
GPIOStructPtr->GPIO->CRH &= ~0xF<<(4*((GPIOStructPtr->GPIO_Pin)%8)); //on met a 0 les bit de config du pin
|
||||||
GPIOStructPtr->GPIO->CRH |= GPIOStructPtr->GPIO_Conf<<(4*((GPIOStructPtr->GPIO_Pin)%8));
|
GPIOStructPtr->GPIO->CRH |= GPIOStructPtr->GPIO_Conf<<(4*((GPIOStructPtr->GPIO_Pin)%8)); // On met à 1 les bons bits pour obtenir la config souhaité sur le pin
|
||||||
}
|
}
|
||||||
else
|
else // Si le numéro de pin est inférieur à 8 alors on écrit dans le registre CRLow
|
||||||
{
|
{
|
||||||
GPIOStructPtr->GPIO->CRL &= ~0xF<<(4*((GPIOStructPtr->GPIO_Pin)%8)); //on met a 0 les bit de config du pin
|
GPIOStructPtr->GPIO->CRL &= ~0xF<<(4*((GPIOStructPtr->GPIO_Pin)%8)); //on met a 0 les bit de config du pin
|
||||||
GPIOStructPtr->GPIO->CRL |= GPIOStructPtr->GPIO_Conf<<(4*((GPIOStructPtr->GPIO_Pin)%8)); //on met a 0 les bit de config du pin
|
GPIOStructPtr->GPIO->CRL |= GPIOStructPtr->GPIO_Conf<<(4*((GPIOStructPtr->GPIO_Pin)%8)); // On met à 1 les bons bits pour obtenir la config souhaité sur le pin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ) // renvoie 0 ou autre chose different de 0
|
int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ) // renvoie 0 ou 1
|
||||||
{
|
{
|
||||||
int bit=0;
|
int bit=0;
|
||||||
bit = (GPIO->IDR>>GPIO_Pin)&0x01;
|
bit = (GPIO->IDR>>GPIO_Pin)&0x01; // On récupère la donnée stocké dans le data register d'entré pour le pin souhaité
|
||||||
return bit;
|
return bit;
|
||||||
}
|
}
|
||||||
void MyGPIO_Set ( GPIO_TypeDef * GPIO , char GPIO_Pin )
|
void MyGPIO_Set ( GPIO_TypeDef * GPIO , char GPIO_Pin )
|
||||||
{
|
{
|
||||||
GPIO->ODR |=(0x01<<GPIO_Pin);
|
GPIO->ODR |=(0x01<<GPIO_Pin); // On envoie un 1 via le data register de sortie sur le pin souhaité
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin )
|
void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin )
|
||||||
{
|
{
|
||||||
GPIO->ODR &= ((~0x01)<<GPIO_Pin);
|
GPIO->ODR &= ((~0x01)<<GPIO_Pin); // On envoie un 0 via le data register de sortie sur le pin souhaité
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyGPIO_Toggle ( GPIO_TypeDef * GPIO , char GPIO_Pin )
|
void MyGPIO_Toggle ( GPIO_TypeDef * GPIO , char GPIO_Pin )
|
||||||
|
@ -73,7 +73,7 @@ void MyGPIO_Toggle ( GPIO_TypeDef * GPIO , char GPIO_Pin )
|
||||||
|
|
||||||
void MyGPIO_ActiveIT (GPIO_TypeDef * GPIO, char GPIO_Pin, char Prio, void (*IT_function)(void)) //p210
|
void MyGPIO_ActiveIT (GPIO_TypeDef * GPIO, char GPIO_Pin, char Prio, void (*IT_function)(void)) //p210
|
||||||
{
|
{
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN;
|
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN; // On active l'horloge pour AFIO
|
||||||
if (GPIO==GPIOA)
|
if (GPIO==GPIOA)
|
||||||
{
|
{
|
||||||
AFIO->EXTICR[0] |= (AFIO_EXTICR1_EXTI0_PA << (4*GPIO_Pin));
|
AFIO->EXTICR[0] |= (AFIO_EXTICR1_EXTI0_PA << (4*GPIO_Pin));
|
||||||
|
@ -91,8 +91,8 @@ void MyGPIO_ActiveIT (GPIO_TypeDef * GPIO, char GPIO_Pin, char Prio, void (*IT_f
|
||||||
AFIO->EXTICR[0] |= (AFIO_EXTICR1_EXTI0_PD << (4*GPIO_Pin));
|
AFIO->EXTICR[0] |= (AFIO_EXTICR1_EXTI0_PD << (4*GPIO_Pin));
|
||||||
}
|
}
|
||||||
// manque ligne pour activer l'interruption
|
// manque ligne pour activer l'interruption
|
||||||
NVIC->ISER[0] |= 0x01<<EXTI0_IRQn;
|
NVIC->ISER[0] |= 0x01<<EXTI0_IRQn; // On précise quelle interruption on souhaite activé
|
||||||
NVIC->IP[EXTI0_IRQn] |= Prio << 4;
|
NVIC->IP[EXTI0_IRQn] |= Prio << 4; // On précise la priorité qu'on souhaite lui donner
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXTI0_IRQHandler(void)
|
void EXTI0_IRQHandler(void)
|
||||||
|
@ -104,7 +104,7 @@ void EXTI0_IRQHandler(void)
|
||||||
(*gpio_ptr_func)();
|
(*gpio_ptr_func)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXTI->RTSR &=0xFFFFF;
|
EXTI->RTSR &=0xFFFFF; // On reset le flag lmevé
|
||||||
|
|
||||||
//reset flag
|
//reset flag
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#include "TIMER.h"
|
#include "TIMER.h"
|
||||||
|
|
||||||
/*periode_timer=peridoe_horloge*prescaler*resolution
|
|
||||||
debordement stocké dans registre UIF
|
|
||||||
fixer val prescaler+ autoreload(equivalent resolution)
|
|
||||||
demarrage timer => CEN=1*/
|
|
||||||
|
|
||||||
void (*tim_ptr1_func)(void);
|
void (*tim_ptr1_func)(void);
|
||||||
void (*tim_ptr2_func)(void);
|
void (*tim_ptr2_func)(void);
|
||||||
void (*tim_ptr3_func)(void);
|
void (*tim_ptr3_func)(void);
|
||||||
|
@ -14,28 +9,86 @@ void MyTimer_Base_Init ( MyTimer_Struct_TypeDef * Timer)
|
||||||
{
|
{
|
||||||
if(Timer->Timer==TIM1)
|
if(Timer->Timer==TIM1)
|
||||||
{
|
{
|
||||||
RCC->APB2ENR |= 0x01<<11;
|
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN;
|
||||||
}
|
}
|
||||||
else if (Timer->Timer==TIM2)
|
else if (Timer->Timer==TIM2)
|
||||||
{
|
{
|
||||||
RCC->APB1ENR |= 0x01;
|
RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
|
||||||
}
|
}
|
||||||
else if (Timer->Timer==TIM3)
|
else if (Timer->Timer==TIM3)
|
||||||
{
|
{
|
||||||
RCC->APB1ENR |= 0x01<<1;
|
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
|
||||||
}
|
}
|
||||||
else if (Timer->Timer==TIM4)
|
else if (Timer->Timer==TIM4)
|
||||||
{
|
{
|
||||||
RCC->APB1ENR |= 0x01<<2;
|
RCC->APB1ENR |= RCC_APB1ENR_TIM4EN;
|
||||||
}
|
}
|
||||||
Timer->Timer->ARR=Timer->ARR;
|
Timer->Timer->ARR=Timer->ARR; // On set la donnée d'autoreload
|
||||||
Timer->Timer->PSC=Timer->PSC;
|
Timer->Timer->PSC=Timer->PSC; // On set la donnée de prescaler (ce qui va nous permettre de diviser la valeur d'autoreaload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyPWM_init ( TIM_TypeDef * Timer,char Channel)
|
||||||
|
{
|
||||||
|
if(Channel==1)
|
||||||
|
{
|
||||||
|
Timer->CCMR1&=~0x00FF;
|
||||||
|
Timer->CCMR1 &= ~TIM_CCMR1_OC1M_0;
|
||||||
|
Timer->CCMR1 |= TIM_CCMR1_OC1M_1| TIM_CCMR1_OC1M_2;
|
||||||
|
Timer->CCER |= TIM_CCER_CC1E;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(Channel==2)
|
||||||
|
{
|
||||||
|
Timer->CCMR1&=~0xFF00;
|
||||||
|
Timer->CCMR1 &= ~TIM_CCMR1_OC2M_0;
|
||||||
|
Timer->CCMR1 |= TIM_CCMR1_OC2M_1| TIM_CCMR1_OC2M_2;
|
||||||
|
Timer->CCER |= TIM_CCER_CC2E;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(Channel==3)
|
||||||
|
{
|
||||||
|
Timer->CCMR2&=~0x00FF;
|
||||||
|
Timer->CCMR2 &= ~TIM_CCMR2_OC3M_0;
|
||||||
|
Timer->CCMR2 |= TIM_CCMR2_OC3M_1| TIM_CCMR2_OC3M_2;
|
||||||
|
Timer->CCER |= TIM_CCER_CC3E;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(Channel==4)
|
||||||
|
{
|
||||||
|
Timer->CCMR2&=~0xFF00;
|
||||||
|
Timer->CCMR2 &= ~TIM_CCMR2_OC4M_0;
|
||||||
|
Timer->CCMR2 |= TIM_CCMR2_OC4M_1| TIM_CCMR2_OC4M_2;
|
||||||
|
Timer->CCER |= TIM_CCER_CC4E;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void MyPWM_Duty (TIM_TypeDef * Timer,char Channel, unsigned short CRR )
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if(Channel==1)
|
||||||
|
{
|
||||||
|
Timer->CCR1=CRR;
|
||||||
|
}
|
||||||
|
if(Channel==2)
|
||||||
|
{
|
||||||
|
Timer->CCR2=CRR;
|
||||||
|
}
|
||||||
|
if(Channel==3)
|
||||||
|
{
|
||||||
|
Timer->CCR3=CRR;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(Channel==4)
|
||||||
|
{
|
||||||
|
Timer->CCR4=CRR;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
void MyTimer_ActiveIT (TIM_TypeDef * Timer, char Prio, void (*IT_function)(void))
|
void MyTimer_ActiveIT (TIM_TypeDef * Timer, char Prio, void (*IT_function)(void))
|
||||||
{
|
{
|
||||||
int num_tim;
|
int num_tim;
|
||||||
Timer->DIER |= 0x01;
|
Timer->DIER |= 0x01; // On autorise les interruptions sur timer
|
||||||
if(Timer==TIM1)
|
if(Timer==TIM1)
|
||||||
{
|
{
|
||||||
num_tim=TIM1_UP_IRQn;
|
num_tim=TIM1_UP_IRQn;
|
||||||
|
@ -56,8 +109,8 @@ void MyTimer_ActiveIT (TIM_TypeDef * Timer, char Prio, void (*IT_function)(void)
|
||||||
num_tim=TIM4_IRQn;
|
num_tim=TIM4_IRQn;
|
||||||
tim_ptr4_func=IT_function;
|
tim_ptr4_func=IT_function;
|
||||||
}
|
}
|
||||||
NVIC->ISER[0] |= 0x01<<num_tim;
|
NVIC->ISER[0] |= 0x01<<num_tim; // On précise quelle interruption on souhaite activé
|
||||||
NVIC->IP[num_tim] |= Prio << 4;
|
NVIC->IP[num_tim] |= Prio << 4; // On précise la priorité qu'on souhaite lui donner
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +126,7 @@ void TIM2_IRQHandler (void)
|
||||||
{
|
{
|
||||||
(*tim_ptr2_func)();
|
(*tim_ptr2_func)();
|
||||||
}
|
}
|
||||||
TIM2->SR &= ~(1<<0) ;
|
TIM2->SR &= ~(1<<0) ; // Remet à 0 le flag de l'interruption
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIM3_IRQHandler (void)
|
void TIM3_IRQHandler (void)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include "GPIO.h"
|
#include "GPIO.h"
|
||||||
|
|
||||||
void (*uart_rx_ptr_func)(void);
|
void (*uart_rx_ptr_func)(void);
|
||||||
char buffer[1000]={0};
|
|
||||||
|
|
||||||
void MyUART_init(void) // que pour du 9600 bauds
|
void MyUART_init(void) // que pour du 9600 bauds
|
||||||
{
|
{
|
||||||
|
@ -32,7 +31,7 @@ void MyUART_init(void) // que pour du 9600 bauds
|
||||||
|
|
||||||
void UART_send(char data)
|
void UART_send(char data)
|
||||||
{
|
{
|
||||||
while(!(USART1->SR & USART_SR_TXE))
|
while(!(USART1->SR & USART_SR_TXE)) // Tant que le buffer d'envoi n'est pas vide, on n'envoie pas plus de données
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
USART1->DR = data; // Ecriture de la donnée dans le registre DR
|
USART1->DR = data; // Ecriture de la donnée dans le registre DR
|
||||||
|
@ -40,18 +39,17 @@ void UART_send(char data)
|
||||||
|
|
||||||
void MyUART_ActiveIT(char Prio, void (*IT_function)(void))
|
void MyUART_ActiveIT(char Prio, void (*IT_function)(void))
|
||||||
{
|
{
|
||||||
//activer l'interrupt sur reception
|
USART1->CR1 |= USART_CR1_RXNEIE; // On autorise l'interruption sur réception de l'UART
|
||||||
USART1->CR1 |= USART_CR1_RXNEIE;
|
|
||||||
uart_rx_ptr_func=IT_function;
|
uart_rx_ptr_func=IT_function;
|
||||||
NVIC->ISER[1] |= 0x01<<(USART1_IRQn%32);
|
NVIC->ISER[1] |= 0x01<<(USART1_IRQn%32); // On précise quelle interruption on souhaite activé
|
||||||
NVIC->IP[USART1_IRQn] |= Prio << 4;
|
NVIC->IP[USART1_IRQn] |= Prio << 4; // On précise la priorité qu'on souhaite lui donner
|
||||||
}
|
}
|
||||||
|
|
||||||
void USART1_IRQHandler()
|
void USART1_IRQHandler()
|
||||||
{
|
{
|
||||||
if (USART1->SR & USART_SR_RXNE)
|
if (USART1->SR & USART_SR_RXNE)
|
||||||
{
|
{
|
||||||
USART1->SR &= ~USART_SR_RXNE;
|
USART1->SR &= ~USART_SR_RXNE; // On abaisse le flag d'interruption
|
||||||
if(uart_rx_ptr_func!=0)
|
if(uart_rx_ptr_func!=0)
|
||||||
{
|
{
|
||||||
(*uart_rx_ptr_func)();
|
(*uart_rx_ptr_func)();
|
||||||
|
|
49
Projet_DevDrivers/Sources/Principal.c
Normal file
49
Projet_DevDrivers/Sources/Principal.c
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#include "stm32f10x.h"
|
||||||
|
#include "GPIO.h"
|
||||||
|
#include "TIMER.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void MyFunction_IT (void);
|
||||||
|
MyGPIO_Struct_TypeDef PA5;
|
||||||
|
MyGPIO_Struct_TypeDef PA6;
|
||||||
|
MyGPIO_Struct_TypeDef PC13;
|
||||||
|
MyTimer_Struct_TypeDef timer3;
|
||||||
|
//PA5 LED
|
||||||
|
//PC13 Bouton
|
||||||
|
|
||||||
|
int main ( void )
|
||||||
|
{
|
||||||
|
PA5.GPIO=GPIOA;
|
||||||
|
PA5.GPIO_Conf=Out_Ppull;
|
||||||
|
PA5.GPIO_Pin=5;
|
||||||
|
MyGPIO_Init(&PA5);
|
||||||
|
PA6.GPIO=GPIOA;
|
||||||
|
PA6.GPIO_Conf=AltOut_Ppull;
|
||||||
|
PA6.GPIO_Pin=6;
|
||||||
|
MyGPIO_Init(&PA6);
|
||||||
|
|
||||||
|
timer3.Timer=TIM3;
|
||||||
|
timer3.ARR=35999; //pour avoir 500ms
|
||||||
|
timer3.PSC=1000;
|
||||||
|
MyTimer_Base_Init(&timer3);
|
||||||
|
MyTimer_ActiveIT(timer3.Timer,1, &MyFunction_IT);
|
||||||
|
MyTimer_Base_Start(timer3.Timer);
|
||||||
|
|
||||||
|
MyPWM_init (TIM3,1);
|
||||||
|
MyPWM_Duty (TIM3,1, 10000);
|
||||||
|
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void MyFunction_IT (void)
|
||||||
|
{
|
||||||
|
MyGPIO_Toggle(PA5.GPIO,5);
|
||||||
|
}
|
|
@ -26,7 +26,7 @@
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<CLKADS>8000000</CLKADS>
|
<CLKADS>12000000</CLKADS>
|
||||||
<OPTTT>
|
<OPTTT>
|
||||||
<gFlags>1</gFlags>
|
<gFlags>1</gFlags>
|
||||||
<BeepAtEnd>1</BeepAtEnd>
|
<BeepAtEnd>1</BeepAtEnd>
|
||||||
|
@ -77,10 +77,10 @@
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>1</IsCurrentTarget>
|
<IsCurrentTarget>1</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>0</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
<uSim>1</uSim>
|
<uSim>0</uSim>
|
||||||
<uTrg>0</uTrg>
|
<uTrg>1</uTrg>
|
||||||
<sLdApp>1</sLdApp>
|
<sLdApp>1</sLdApp>
|
||||||
<sGomain>1</sGomain>
|
<sGomain>1</sGomain>
|
||||||
<sRbreak>1</sRbreak>
|
<sRbreak>1</sRbreak>
|
||||||
|
@ -117,89 +117,25 @@
|
||||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||||
</DebugOpt>
|
</DebugOpt>
|
||||||
<TargetDriverDllRegistry>
|
<TargetDriverDllRegistry>
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>ARMRTXEVENTFLAGS</Key>
|
|
||||||
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>DLGDARM</Key>
|
|
||||||
<Name>(1010=984,109,1360,666,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1084,185,1505,612,0)(121=-1,-1,-1,-1,0)(122=939,341,1360,768,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=335,17,929,768,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=1177,417,1625,831,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=298,17,901,768,0)(151=-1,-1,-1,-1,0)</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>ARMDBGFLAGS</Key>
|
|
||||||
<Name>-T0</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>UL2CM3</Key>
|
<Key>UL2CM3</Key>
|
||||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))</Name>
|
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint>
|
<Breakpoint/>
|
||||||
<Bp>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>15</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>.\Sources\Principal.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
|
||||||
</Breakpoint>
|
|
||||||
<WatchWindow1>
|
|
||||||
<Ww>
|
|
||||||
<count>0</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>mode</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>1</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>ADC</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>2</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>MyChar</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>3</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>RX_pin</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>4</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>RX_pin</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>5</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>MyChar</ItemText>
|
|
||||||
</Ww>
|
|
||||||
</WatchWindow1>
|
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
</Tracepoint>
|
</Tracepoint>
|
||||||
<DebugFlag>
|
<DebugFlag>
|
||||||
<trace>0</trace>
|
<trace>0</trace>
|
||||||
<periodic>1</periodic>
|
<periodic>0</periodic>
|
||||||
<aLwin>0</aLwin>
|
<aLwin>0</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>0</aSer1>
|
<aSer1>0</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
<aPa>0</aPa>
|
<aPa>0</aPa>
|
||||||
<viewmode>1</viewmode>
|
<viewmode>0</viewmode>
|
||||||
<vrSel>0</vrSel>
|
<vrSel>0</vrSel>
|
||||||
<aSym>0</aSym>
|
<aSym>0</aSym>
|
||||||
<aTbox>0</aTbox>
|
<aTbox>0</aTbox>
|
||||||
|
@ -230,13 +166,6 @@
|
||||||
<pszMrulep></pszMrulep>
|
<pszMrulep></pszMrulep>
|
||||||
<pSingCmdsp></pSingCmdsp>
|
<pSingCmdsp></pSingCmdsp>
|
||||||
<pMultCmdsp></pMultCmdsp>
|
<pMultCmdsp></pMultCmdsp>
|
||||||
<LogicAnalyzers>
|
|
||||||
<Wi>
|
|
||||||
<IntNumber>0</IntNumber>
|
|
||||||
<FirstString>((PORTA & 0x00000020) >> 5 & 0x20) >> 5</FirstString>
|
|
||||||
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030323029203E3E2035000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F170000000000000000000000000000000000000090020008</SecondString>
|
|
||||||
</Wi>
|
|
||||||
</LogicAnalyzers>
|
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
<Enable>1</Enable>
|
<Enable>1</Enable>
|
||||||
<EnableFlashSeq>1</EnableFlashSeq>
|
<EnableFlashSeq>1</EnableFlashSeq>
|
||||||
|
@ -252,12 +181,12 @@
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<CLKADS>8000000</CLKADS>
|
<CLKADS>12000000</CLKADS>
|
||||||
<OPTTT>
|
<OPTTT>
|
||||||
<gFlags>1</gFlags>
|
<gFlags>0</gFlags>
|
||||||
<BeepAtEnd>1</BeepAtEnd>
|
<BeepAtEnd>1</BeepAtEnd>
|
||||||
<RunSim>0</RunSim>
|
<RunSim>1</RunSim>
|
||||||
<RunTarget>1</RunTarget>
|
<RunTarget>0</RunTarget>
|
||||||
<RunAbUc>0</RunAbUc>
|
<RunAbUc>0</RunAbUc>
|
||||||
</OPTTT>
|
</OPTTT>
|
||||||
<OPTHX>
|
<OPTHX>
|
||||||
|
@ -299,14 +228,14 @@
|
||||||
<LExpSel>0</LExpSel>
|
<LExpSel>0</LExpSel>
|
||||||
</OPTXL>
|
</OPTXL>
|
||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>0</IsCurrentTarget>
|
<IsCurrentTarget>0</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>0</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
<uSim>0</uSim>
|
<uSim>1</uSim>
|
||||||
<uTrg>1</uTrg>
|
<uTrg>0</uTrg>
|
||||||
<sLdApp>1</sLdApp>
|
<sLdApp>1</sLdApp>
|
||||||
<sGomain>1</sGomain>
|
<sGomain>1</sGomain>
|
||||||
<sRbreak>1</sRbreak>
|
<sRbreak>1</sRbreak>
|
||||||
|
@ -315,7 +244,7 @@
|
||||||
<sRfunc>1</sRfunc>
|
<sRfunc>1</sRfunc>
|
||||||
<sRbox>1</sRbox>
|
<sRbox>1</sRbox>
|
||||||
<tLdApp>1</tLdApp>
|
<tLdApp>1</tLdApp>
|
||||||
<tGomain>1</tGomain>
|
<tGomain>0</tGomain>
|
||||||
<tRbreak>1</tRbreak>
|
<tRbreak>1</tRbreak>
|
||||||
<tRwatch>1</tRwatch>
|
<tRwatch>1</tRwatch>
|
||||||
<tRmem>1</tRmem>
|
<tRmem>1</tRmem>
|
||||||
|
@ -329,7 +258,7 @@
|
||||||
<bEvRecOn>1</bEvRecOn>
|
<bEvRecOn>1</bEvRecOn>
|
||||||
<bSchkAxf>0</bSchkAxf>
|
<bSchkAxf>0</bSchkAxf>
|
||||||
<bTchkAxf>0</bTchkAxf>
|
<bTchkAxf>0</bTchkAxf>
|
||||||
<nTsel>6</nTsel>
|
<nTsel>-1</nTsel>
|
||||||
<sDll></sDll>
|
<sDll></sDll>
|
||||||
<sDllPa></sDllPa>
|
<sDllPa></sDllPa>
|
||||||
<sDlgDll></sDlgDll>
|
<sDlgDll></sDlgDll>
|
||||||
|
@ -340,53 +269,21 @@
|
||||||
<tDlgDll></tDlgDll>
|
<tDlgDll></tDlgDll>
|
||||||
<tDlgPa></tDlgPa>
|
<tDlgPa></tDlgPa>
|
||||||
<tIfile></tIfile>
|
<tIfile></tIfile>
|
||||||
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
|
<pMon></pMon>
|
||||||
</DebugOpt>
|
</DebugOpt>
|
||||||
<TargetDriverDllRegistry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>ARMRTXEVENTFLAGS</Key>
|
|
||||||
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>DLGTARM</Key>
|
|
||||||
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=318,388,739,793,0)(121=1101,403,1522,808,0)(122=1281,393,1702,798,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=1106,213,1554,627,1)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>ARMDBGFLAGS</Key>
|
|
||||||
<Name></Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>ST-LINKIII-KEIL_SWO</Key>
|
|
||||||
<Name>-U-O206 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>DLGUARM</Key>
|
|
||||||
<Name>(105=-1,-1,-1,-1,0)</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
<SetRegEntry>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Key>UL2CM3</Key>
|
|
||||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))</Name>
|
|
||||||
</SetRegEntry>
|
|
||||||
</TargetDriverDllRegistry>
|
|
||||||
<Breakpoint/>
|
<Breakpoint/>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
</Tracepoint>
|
</Tracepoint>
|
||||||
<DebugFlag>
|
<DebugFlag>
|
||||||
<trace>0</trace>
|
<trace>0</trace>
|
||||||
<periodic>1</periodic>
|
<periodic>0</periodic>
|
||||||
<aLwin>1</aLwin>
|
<aLwin>0</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>1</aSer1>
|
<aSer1>0</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
<aPa>0</aPa>
|
<aPa>0</aPa>
|
||||||
<viewmode>1</viewmode>
|
<viewmode>0</viewmode>
|
||||||
<vrSel>0</vrSel>
|
<vrSel>0</vrSel>
|
||||||
<aSym>0</aSym>
|
<aSym>0</aSym>
|
||||||
<aTbox>0</aTbox>
|
<aTbox>0</aTbox>
|
||||||
|
@ -417,13 +314,6 @@
|
||||||
<pszMrulep></pszMrulep>
|
<pszMrulep></pszMrulep>
|
||||||
<pSingCmdsp></pSingCmdsp>
|
<pSingCmdsp></pSingCmdsp>
|
||||||
<pMultCmdsp></pMultCmdsp>
|
<pMultCmdsp></pMultCmdsp>
|
||||||
<DebugDescription>
|
|
||||||
<Enable>1</Enable>
|
|
||||||
<EnableFlashSeq>0</EnableFlashSeq>
|
|
||||||
<EnableLog>0</EnableLog>
|
|
||||||
<Protocol>2</Protocol>
|
|
||||||
<DbgClock>10000000</DbgClock>
|
|
||||||
</DebugDescription>
|
|
||||||
</TargetOption>
|
</TargetOption>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
@ -449,7 +339,7 @@
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>2</FileNumber>
|
<FileNumber>2</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>.\Sources\Girouette.c</PathWithFileName>
|
<PathWithFileName>.\Sources\Girouette.c</PathWithFileName>
|
||||||
|
@ -461,7 +351,7 @@
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>3</FileNumber>
|
<FileNumber>3</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\DRIVERS\Src\GPIO.c</PathWithFileName>
|
<PathWithFileName>..\DRIVERS\Src\GPIO.c</PathWithFileName>
|
||||||
|
@ -473,7 +363,7 @@
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>4</FileNumber>
|
<FileNumber>4</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Drivers\Src\TIMER.c</PathWithFileName>
|
<PathWithFileName>..\Drivers\Src\TIMER.c</PathWithFileName>
|
||||||
|
@ -485,7 +375,7 @@
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>5</FileNumber>
|
<FileNumber>5</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Drivers\Src\ADC.c</PathWithFileName>
|
<PathWithFileName>..\Drivers\Src\ADC.c</PathWithFileName>
|
||||||
|
@ -517,7 +407,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>::Device</GroupName>
|
<GroupName>::Device</GroupName>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>1</RteFlg>
|
<RteFlg>1</RteFlg>
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
<TargetName>Simulé</TargetName>
|
<TargetName>Simulé</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
|
||||||
<uAC6>0</uAC6>
|
<uAC6>1</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
<Device>STM32F103RB</Device>
|
<Device>STM32F103RB</Device>
|
||||||
<Vendor>STMicroelectronics</Vendor>
|
<Vendor>STMicroelectronics</Vendor>
|
||||||
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
|
<PackID>Keil.STM32F1xx_DFP.2.4.0</PackID>
|
||||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||||
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||||
<FlashUtilSpec></FlashUtilSpec>
|
<FlashUtilSpec></FlashUtilSpec>
|
||||||
|
@ -134,11 +134,11 @@
|
||||||
<RunIndependent>0</RunIndependent>
|
<RunIndependent>0</RunIndependent>
|
||||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||||
<Capability>1</Capability>
|
<Capability>1</Capability>
|
||||||
<DriverSelection>-1</DriverSelection>
|
<DriverSelection>4096</DriverSelection>
|
||||||
</Flash1>
|
</Flash1>
|
||||||
<bUseTDR>1</bUseTDR>
|
<bUseTDR>1</bUseTDR>
|
||||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||||
<Flash3></Flash3>
|
<Flash3>"" ()</Flash3>
|
||||||
<Flash4></Flash4>
|
<Flash4></Flash4>
|
||||||
<pFcarmOut></pFcarmOut>
|
<pFcarmOut></pFcarmOut>
|
||||||
<pFcarmGrp></pFcarmGrp>
|
<pFcarmGrp></pFcarmGrp>
|
||||||
|
@ -186,6 +186,7 @@
|
||||||
<RvdsVP>0</RvdsVP>
|
<RvdsVP>0</RvdsVP>
|
||||||
<RvdsMve>0</RvdsMve>
|
<RvdsMve>0</RvdsMve>
|
||||||
<RvdsCdeCp>0</RvdsCdeCp>
|
<RvdsCdeCp>0</RvdsCdeCp>
|
||||||
|
<nBranchProt>0</nBranchProt>
|
||||||
<hadIRAM2>0</hadIRAM2>
|
<hadIRAM2>0</hadIRAM2>
|
||||||
<hadIROM2>0</hadIROM2>
|
<hadIROM2>0</hadIROM2>
|
||||||
<StupSel>8</StupSel>
|
<StupSel>8</StupSel>
|
||||||
|
@ -313,7 +314,7 @@
|
||||||
</ArmAdsMisc>
|
</ArmAdsMisc>
|
||||||
<Cads>
|
<Cads>
|
||||||
<interw>1</interw>
|
<interw>1</interw>
|
||||||
<Optim>1</Optim>
|
<Optim>2</Optim>
|
||||||
<oTime>0</oTime>
|
<oTime>0</oTime>
|
||||||
<SplitLS>0</SplitLS>
|
<SplitLS>0</SplitLS>
|
||||||
<OneElfS>1</OneElfS>
|
<OneElfS>1</OneElfS>
|
||||||
|
@ -322,7 +323,7 @@
|
||||||
<PlainCh>0</PlainCh>
|
<PlainCh>0</PlainCh>
|
||||||
<Ropi>0</Ropi>
|
<Ropi>0</Ropi>
|
||||||
<Rwpi>0</Rwpi>
|
<Rwpi>0</Rwpi>
|
||||||
<wLevel>2</wLevel>
|
<wLevel>3</wLevel>
|
||||||
<uThumb>0</uThumb>
|
<uThumb>0</uThumb>
|
||||||
<uSurpInc>0</uSurpInc>
|
<uSurpInc>0</uSurpInc>
|
||||||
<uC99>0</uC99>
|
<uC99>0</uC99>
|
||||||
|
@ -603,6 +604,7 @@
|
||||||
<RvdsVP>0</RvdsVP>
|
<RvdsVP>0</RvdsVP>
|
||||||
<RvdsMve>0</RvdsMve>
|
<RvdsMve>0</RvdsMve>
|
||||||
<RvdsCdeCp>0</RvdsCdeCp>
|
<RvdsCdeCp>0</RvdsCdeCp>
|
||||||
|
<nBranchProt>0</nBranchProt>
|
||||||
<hadIRAM2>0</hadIRAM2>
|
<hadIRAM2>0</hadIRAM2>
|
||||||
<hadIROM2>0</hadIROM2>
|
<hadIROM2>0</hadIROM2>
|
||||||
<StupSel>8</StupSel>
|
<StupSel>8</StupSel>
|
||||||
|
@ -845,15 +847,15 @@
|
||||||
<RTE>
|
<RTE>
|
||||||
<apis/>
|
<apis/>
|
||||||
<components>
|
<components>
|
||||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.4.0" condition="ARMv6_7_8-M Device">
|
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.6.0" condition="ARMv6_7_8-M Device">
|
||||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.7.0"/>
|
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
</targetInfos>
|
</targetInfos>
|
||||||
</component>
|
</component>
|
||||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS">
|
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS">
|
||||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
|
@ -864,7 +866,7 @@
|
||||||
<file attr="config" category="header" name="RTE_Driver\Config\RTE_Device.h" version="1.1.2">
|
<file attr="config" category="header" name="RTE_Driver\Config\RTE_Device.h" version="1.1.2">
|
||||||
<instance index="0">RTE\Device\STM32F103RB\RTE_Device.h</instance>
|
<instance index="0">RTE\Device\STM32F103RB\RTE_Device.h</instance>
|
||||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
|
@ -873,7 +875,7 @@
|
||||||
<file attr="config" category="source" condition="STM32F1xx MD ARMCC" name="Device\Source\ARM\startup_stm32f10x_md.s" version="1.0.0">
|
<file attr="config" category="source" condition="STM32F1xx MD ARMCC" name="Device\Source\ARM\startup_stm32f10x_md.s" version="1.0.0">
|
||||||
<instance index="0">RTE\Device\STM32F103RB\startup_stm32f10x_md.s</instance>
|
<instance index="0">RTE\Device\STM32F103RB\startup_stm32f10x_md.s</instance>
|
||||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
|
@ -882,7 +884,7 @@
|
||||||
<file attr="config" category="source" name="Device\Source\system_stm32f10x.c" version="1.0.0">
|
<file attr="config" category="source" name="Device\Source\system_stm32f10x.c" version="1.0.0">
|
||||||
<instance index="0">RTE\Device\STM32F103RB\system_stm32f10x.c</instance>
|
<instance index="0">RTE\Device\STM32F103RB\system_stm32f10x.c</instance>
|
||||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||||
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
|
|
42
README.md
Normal file
42
README.md
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# Projet Voilier
|
||||||
|
## Equipe 2
|
||||||
|
#### Noel JUMIN
|
||||||
|
#### Olivier Chevilley
|
||||||
|
#### Paul Jaulhiac
|
||||||
|
#### Cyril Vasseur
|
||||||
|
|
||||||
|
## Description du projet
|
||||||
|
|
||||||
|
Ce projet a été réalisé lors de séances de microcontroleur durant lesquels nous avons appris à maitriser l'utilisation des registres du STM32F103RB.
|
||||||
|
Le projet se sépare en 2 grandes parties :
|
||||||
|
- [La réalisation des drivers](#id_drivers)
|
||||||
|
- [La réalisation des différentes fonctions du bateau](#id_bateau)
|
||||||
|
|
||||||
|
## <a id="id_drivers">Réalisation des drivers</a>
|
||||||
|
|
||||||
|
Pour cela, nous avons utilisé les 3 documentations disponible dans la première section de ce [cours moodle](https://moodle.insa-toulouse.fr/course/view.php?id=79#section-1).
|
||||||
|
|
||||||
|
Nous avons donc réalisé les drivers suivant :
|
||||||
|
[x] l'[ADC](Drivers/Inc/ADC.h)
|
||||||
|
[x] les [GPIOs](Drivers/Inc/GPIO.h)
|
||||||
|
[x] l'[UART](Drivers/Inc/UART.h)
|
||||||
|
[x] les [Timers et le PWM](Drivers/Inc/TIMER.h)
|
||||||
|
|
||||||
|
Les drivers pour l'utilisation du SPI et de l'I2C nous sont fournis.
|
||||||
|
|
||||||
|
## <a id="id_bateau">Réalisation des différentes fonctions du bateau</a>
|
||||||
|
|
||||||
|
Pour cela nous avons utilisé les documentations disponible dans la [section suivante](https://moodle.insa-toulouse.fr/course/view.php?id=79#section-16) du cours moodle précédemment cité.
|
||||||
|
|
||||||
|
Nous avons donc réalisé les fonctions suivantes :
|
||||||
|
[ ] la [Girouette](Projet_voile/Includes/Girouette.h)
|
||||||
|
[ ] l' [Horloge](Drivers/Inc/Horloge.h)
|
||||||
|
[ ] l'[IMU](Drivers/Inc/IMU.h)
|
||||||
|
[ ] le [Moteur des voiles](Drivers/Inc/Moteur_voile.h)
|
||||||
|
[ ] le [Moteur du plateau](Drivers/Inc/Moteur_plateau.h)
|
||||||
|
[ ] la [Mesure de tension de la batterie](Drivers/Inc/Mesure_tension.h)
|
||||||
|
[ ] la [télécommande](Drivers/Inc/Telecommande.h)
|
||||||
|
|
||||||
|
Evidemment chacune de cesfonctions fait appel aux drivers de la couche en dessous.
|
||||||
|
|
||||||
|
Evidemment pour controler l'entiereté de ce bateau, nous utiliserons un code [principal](Projet_voile/Includes/Principal.h). Celui-ci fera appel aux sous programmes présentsau dessus.
|
Loading…
Reference in a new issue