Compare commits
11 commits
f22d8aacd9
...
6687cffd8f
| Author | SHA1 | Date | |
|---|---|---|---|
| 6687cffd8f | |||
| 7930acf1ef | |||
| 27654ac30a | |||
| 7f879cf7af | |||
| 30ceea84e7 | |||
| a9d0437841 | |||
| 582dd2b5b7 | |||
| f979a89e5f | |||
| e8800d0c58 | |||
| 4b6629eb48 | |||
| c404ceeab2 |
10 changed files with 342 additions and 59 deletions
21
Drivers/Include/Driver_ADC.h
Normal file
21
Drivers/Include/Driver_ADC.h
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef MYADC_H
|
||||||
|
#define MYADC_H
|
||||||
|
|
||||||
|
#include "stm32f10x.h"
|
||||||
|
#include "Driver_GPIO.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ADC_TypeDef * ADC;
|
||||||
|
char Channel;
|
||||||
|
} MyADC_Struct_TypeDef;
|
||||||
|
|
||||||
|
|
||||||
|
void MyADC_Base_Init(MyADC_Struct_TypeDef * ADC);
|
||||||
|
void MyADC_Base_Start(ADC_TypeDef * ADC);
|
||||||
|
void MyADC_Base_Stop(ADC_TypeDef * ADC);
|
||||||
|
void MyADC_Base_Interuption(ADC_TypeDef * ADC);
|
||||||
|
int MyADC_Base_Result (MyADC_Struct_TypeDef * ADC);
|
||||||
|
void MyADC_Init_Periph (void (*fct)(void));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -23,4 +23,5 @@ int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ; // renvoie 0 ou autre
|
||||||
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 ) ;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
22
Drivers/Include/Driver_UART.h
Normal file
22
Drivers/Include/Driver_UART.h
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef MYUART_H
|
||||||
|
#define MYUART_H
|
||||||
|
|
||||||
|
#include "stm32f10x.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
USART_TypeDef * UART;
|
||||||
|
unsigned int baudrate;
|
||||||
|
}MyUART_Struct_Typedef;
|
||||||
|
|
||||||
|
void UART_send(char data);
|
||||||
|
char UART_read(char data, MyUART_Struct_Typedef * UART);
|
||||||
|
void UART_init(MyUART_Struct_Typedef * UART);
|
||||||
|
void USART1_IRQHandler(void);
|
||||||
|
void USART2_IRQHandler(void);
|
||||||
|
void USART3_IRQHandler(void);
|
||||||
|
void UART_InitGPIO(MyUART_Struct_Typedef * UART);
|
||||||
|
void UART_interruption (MyUART_Struct_Typedef * UART);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
21
Drivers/Sources/Driver_ADC.c
Normal file
21
Drivers/Sources/Driver_ADC.c
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef MYADC_H
|
||||||
|
#define MYADC_H
|
||||||
|
|
||||||
|
#include "stm32f10x.h"
|
||||||
|
#include "Driver_GPIO.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ADC_TypeDef * ADC;
|
||||||
|
char Channel;
|
||||||
|
} MyADC_Struct_TypeDef;
|
||||||
|
|
||||||
|
|
||||||
|
void MyADC_Base_Init(MyADC_Struct_TypeDef * ADC);
|
||||||
|
void MyADC_Base_Start(ADC_TypeDef * ADC);
|
||||||
|
void MyADC_Base_Stop(ADC_TypeDef * ADC);
|
||||||
|
void MyADC_Base_Interuption(ADC_TypeDef * ADC);
|
||||||
|
int MyADC_Base_Result (MyADC_Struct_TypeDef * ADC);
|
||||||
|
void MyADC_Init_Periph (void (*fct)(void));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -2,35 +2,47 @@
|
||||||
|
|
||||||
|
|
||||||
//---------------------FONCTION D'INITIALISATION-----------------//
|
//---------------------FONCTION D'INITIALISATION-----------------//
|
||||||
void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr){
|
void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr )
|
||||||
|
{
|
||||||
|
|
||||||
//INITIALISATION DE LA CLOCK CORRESPONDANT AU GPIO A, B ou C
|
/* Activation of the GPIO port specific clock */
|
||||||
if (GPIOStructPtr->GPIO == GPIOA) {
|
if (GPIOStructPtr->GPIO == GPIOA)
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
|
{
|
||||||
} else if (GPIOStructPtr->GPIO == GPIOB) {
|
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
|
}
|
||||||
} else if (GPIOStructPtr->GPIO == GPIOC) {
|
else if (GPIOStructPtr->GPIO == GPIOB)
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
|
{
|
||||||
} else if (GPIOStructPtr->GPIO == GPIOD) {
|
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
|
}
|
||||||
|
else if (GPIOStructPtr->GPIO == GPIOC)
|
||||||
|
{
|
||||||
|
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
|
||||||
|
}
|
||||||
|
else if (GPIOStructPtr->GPIO == GPIOD)
|
||||||
|
{
|
||||||
|
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Reset, and then configuration writing of the selected GPIO Pin */
|
||||||
|
if(GPIOStructPtr->GPIO_Pin <= 8)
|
||||||
|
{
|
||||||
|
GPIOStructPtr->GPIO->CRL &= ~0xF<<(4*(GPIOStructPtr->GPIO_Pin));
|
||||||
|
GPIOStructPtr->GPIO->CRL |= (GPIOStructPtr->GPIO_Conf)<<(4*(GPIOStructPtr->GPIO_Pin));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GPIOStructPtr->GPIO->CRH &= ~0xF<<(4*((GPIOStructPtr->GPIO_Pin)%8));
|
||||||
|
GPIOStructPtr->GPIO->CRH |= (GPIOStructPtr->GPIO_Conf)<<(4*((GPIOStructPtr->GPIO_Pin)%8));
|
||||||
}
|
}
|
||||||
|
|
||||||
//CONFIGURATION DE LA PIN UTILISEE (voir table20 p9.1)
|
if(GPIOStructPtr->GPIO_Conf == (char)In_PullDown)
|
||||||
if(GPIOStructPtr->GPIO_Pin < 8){
|
{
|
||||||
GPIOStructPtr->GPIO->CRL &= ~(0xF << (4 * GPIOStructPtr->GPIO_Pin));
|
GPIOStructPtr->GPIO->ODR &= ~(0x1<<(GPIOStructPtr->GPIO_Pin));
|
||||||
GPIOStructPtr->GPIO->CRL |= (GPIOStructPtr->GPIO_Conf << (4 * GPIOStructPtr->GPIO_Pin));
|
|
||||||
}
|
}
|
||||||
else {
|
else if(GPIOStructPtr->GPIO_Conf == (char)In_PullUp)
|
||||||
GPIOStructPtr->GPIO->CRH &= ~(0xF << (4 * GPIOStructPtr->GPIO_Pin - 8));
|
{
|
||||||
GPIOStructPtr->GPIO->CRH |= (GPIOStructPtr->GPIO_Conf << (4 * GPIOStructPtr->GPIO_Pin - 8));
|
GPIOStructPtr->GPIO->ODR |= 0x1<<(GPIOStructPtr->GPIO_Pin);
|
||||||
}
|
|
||||||
|
|
||||||
//CONFIGURATION DE L'ODR EN ENTREE (pull up et down uniquement)
|
|
||||||
if(GPIOStructPtr->GPIO_Conf == In_PullUp){
|
|
||||||
GPIOStructPtr->GPIO->ODR = 0x1;
|
|
||||||
}
|
|
||||||
else if(GPIOStructPtr->GPIO_Conf == In_PullDown){
|
|
||||||
GPIOStructPtr->GPIO->ODR = 0x0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,3 +74,4 @@ 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 ){
|
||||||
GPIO->ODR ^= (1 << GPIO_Pin);
|
GPIO->ODR ^= (1 << GPIO_Pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,5 +42,5 @@ void MyTimer_PWM( MyTimer_Struct_TypeDef * Timer, uint16_t cycle){
|
||||||
|
|
||||||
Timer->Timer->CCER |= TIM_CCER_CC1E; // Canal CH1 validé par bit CC1E (registre CCER)
|
Timer->Timer->CCER |= TIM_CCER_CC1E; // Canal CH1 validé par bit CC1E (registre CCER)
|
||||||
Timer->Timer->CR1 |= TIM_CR1_CEN; // Lancement du timer
|
Timer->Timer->CR1 |= TIM_CR1_CEN; // Lancement du timer
|
||||||
Timer->Timer->CCR1 = (cycle * Timer->ARR) / 100; // Fixer la durée à 20%
|
Timer->Timer->CCR1 = (cycle * Timer->ARR) / 100; // Fixer la durée à 20%
|
||||||
}
|
}
|
||||||
|
|
|
||||||
144
Drivers/Sources/Driver_UART.c
Normal file
144
Drivers/Sources/Driver_UART.c
Normal file
|
|
@ -0,0 +1,144 @@
|
||||||
|
#include "Driver_UART.h"
|
||||||
|
#include "Driver_GPIO.h"
|
||||||
|
|
||||||
|
|
||||||
|
char received_data1, received_data2, received_data3;
|
||||||
|
|
||||||
|
void UART_init(MyUART_Struct_Typedef * UART)
|
||||||
|
{
|
||||||
|
if(UART->UART ==USART1)
|
||||||
|
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
|
||||||
|
else if(UART->UART ==USART2)
|
||||||
|
RCC->APB1ENR |= RCC_APB1ENR_USART2EN;
|
||||||
|
else if(UART->UART ==USART3)
|
||||||
|
RCC->APB1ENR |= RCC_APB1ENR_USART3EN;
|
||||||
|
|
||||||
|
|
||||||
|
RCC->APB2ENR |= RCC_APB2ENR_USART1EN; // Validation horloge USART1
|
||||||
|
USART1->CR1 |= USART_CR1_UE; // Activer l'USART
|
||||||
|
USART1->CR1 &= ~USART_CR1_M; // Choisir la taille 8bits de donnée
|
||||||
|
USART1->CR2 |= USART_CR2_STOP; // 1 seul bit de stop
|
||||||
|
//USART1->BRR |= 468 << 4; // Fixe le baud rate à 9600bps partie entière
|
||||||
|
//USART1->BRR |= 75; // Fixe le baud rate à 9600bps partie fractionnaire
|
||||||
|
UART->UART->BRR = 72000000/(UART->baudrate);
|
||||||
|
USART1->CR1 |= USART_CR1_TE; // Autoriser la transmission
|
||||||
|
USART1->CR1 |= USART_CR1_RE; // Activer la réception
|
||||||
|
// USART1->CR1 |= USART_CR1_TCIE; // Activer l'interruption de transmission
|
||||||
|
USART1->CR1 |= USART_CR1_RXNEIE; // Activer l'interruption de réception
|
||||||
|
UART_interruption(UART);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void UART_send(char data)
|
||||||
|
{
|
||||||
|
while(!(USART1->SR & USART_SR_TXE) | !(USART2->SR & USART_SR_TXE)){} //Attendre l'autorisation de transmission
|
||||||
|
USART1->DR |= data;
|
||||||
|
while(!(USART1->SR & USART_SR_TC) | !(USART2->SR & USART_SR_TC)){} //Attendre la fin de transmission
|
||||||
|
}
|
||||||
|
|
||||||
|
char UART_read(char data, MyUART_Struct_Typedef * UART)
|
||||||
|
{
|
||||||
|
if(UART->UART == USART1)
|
||||||
|
return received_data1;
|
||||||
|
else if (UART->UART == USART2)
|
||||||
|
return received_data2;
|
||||||
|
else if (UART->UART == USART3)
|
||||||
|
return received_data3;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void USART1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if (USART1->SR & USART_SR_RXNE) // si une donnée a été reçue
|
||||||
|
{
|
||||||
|
received_data1 = USART1->DR; // lire la donnée reçue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (USART1->SR & USART_SR_TC) // si la transmission est terminée
|
||||||
|
{
|
||||||
|
USART1->SR &= ~USART_SR_TC; // effacer le bit de transmission terminée
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void USART2_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if (USART2->SR & USART_SR_RXNE) // si une donnée a été reçue
|
||||||
|
{
|
||||||
|
received_data2 = USART2->DR; // lire la donnée reçue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (USART2->SR & USART_SR_TC) // si la transmission est terminée
|
||||||
|
{
|
||||||
|
USART2->SR &= ~USART_SR_TC; // effacer le bit de transmission terminée
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void USART3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if (USART3->SR & USART_SR_RXNE) // si une donnée a été reçue
|
||||||
|
{
|
||||||
|
received_data3 = USART3->DR; // lire la donnée reçue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (USART3->SR & USART_SR_TC) // si la transmission est terminée
|
||||||
|
{
|
||||||
|
USART3->SR &= ~USART_SR_TC; // effacer le bit de transmission terminée
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UART_interruption (MyUART_Struct_Typedef * UART)
|
||||||
|
{
|
||||||
|
UART->UART->CR1 |= USART_CR1_RXNEIE;
|
||||||
|
|
||||||
|
if (UART->UART==USART1)
|
||||||
|
{
|
||||||
|
NVIC->ISER[1] |= (1<<(USART1_IRQn-32));
|
||||||
|
}
|
||||||
|
if (UART->UART==USART2)
|
||||||
|
{
|
||||||
|
NVIC->ISER[1] |= (1<<(USART2_IRQn-32));
|
||||||
|
}
|
||||||
|
if (UART->UART==USART3)
|
||||||
|
{
|
||||||
|
NVIC->ISER[1] |= (1<<(USART3_IRQn-32));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UART_InitGPIO(MyUART_Struct_Typedef * UART)
|
||||||
|
{
|
||||||
|
if(UART->UART == USART1)
|
||||||
|
{
|
||||||
|
MyUART_Struct_Typedef UART1 = {USART1,9600};
|
||||||
|
MyGPIO_Struct_TypeDef PA9 = {GPIOA,9,AltOut_Ppull};
|
||||||
|
MyGPIO_Struct_TypeDef PA10 = {GPIOA,10,In_PullUp};
|
||||||
|
MyGPIO_Init (&PA9);
|
||||||
|
MyGPIO_Init (&PA10);
|
||||||
|
UART_init(&UART1);
|
||||||
|
}
|
||||||
|
else if(UART->UART == USART2) {
|
||||||
|
MyUART_Struct_Typedef UART2 = {USART2,9600};
|
||||||
|
MyGPIO_Struct_TypeDef PA2 = {GPIOA,2,AltOut_Ppull};
|
||||||
|
MyGPIO_Struct_TypeDef PA3 = {GPIOA,3,In_Floating};
|
||||||
|
MyGPIO_Init (&PA2);
|
||||||
|
MyGPIO_Init (&PA3);
|
||||||
|
UART_init(&UART2);
|
||||||
|
}
|
||||||
|
else if(UART->UART == USART3) {
|
||||||
|
MyUART_Struct_Typedef UART3 = {USART3,9600};
|
||||||
|
MyGPIO_Struct_TypeDef PA10 = {GPIOA,10,AltOut_Ppull};
|
||||||
|
MyGPIO_Struct_TypeDef PA11 = {GPIOA,11,In_PullUp};
|
||||||
|
MyGPIO_Init (&PA10);
|
||||||
|
MyGPIO_Init (&PA11);
|
||||||
|
UART_init(&UART3);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>DLGDARM</Key>
|
<Key>DLGDARM</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=297,604,718,1031,0)(121=-1,-1,-1,-1,0)(122=546,289,967,716,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=911,135,1505,886,0)(131=997,343,1591,1094,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,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=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
|
<Name>(1010=937,133,1313,690,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=1357,482,1778,909,0)(121=-1,-1,-1,-1,0)(122=546,289,967,716,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=911,135,1505,886,0)(131=997,343,1591,1094,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=1375,56,1823,470,0)(161=1383,268,1831,682,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=240,283,843,1034,0)(151=-1,-1,-1,-1,0)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
|
@ -143,7 +143,24 @@
|
||||||
<Name>-U -O206 -S8 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO65554 -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>
|
<Name>-U -O206 -S8 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO65554 -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>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint>
|
||||||
|
<Bp>
|
||||||
|
<Number>0</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>69</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134219582</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>U:\INSA\Microcontrôleur\Projet_Voilier_grp\Voilier\GPIO_Test\Sources\Main.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\GPIO_Test\Sources/Main.c\69</Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
</Tracepoint>
|
</Tracepoint>
|
||||||
|
|
@ -152,7 +169,7 @@
|
||||||
<periodic>1</periodic>
|
<periodic>1</periodic>
|
||||||
<aLwin>0</aLwin>
|
<aLwin>0</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>0</aSer1>
|
<aSer1>1</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
<aPa>0</aPa>
|
<aPa>0</aPa>
|
||||||
<viewmode>1</viewmode>
|
<viewmode>1</viewmode>
|
||||||
|
|
@ -337,9 +354,9 @@
|
||||||
<DebugFlag>
|
<DebugFlag>
|
||||||
<trace>0</trace>
|
<trace>0</trace>
|
||||||
<periodic>1</periodic>
|
<periodic>1</periodic>
|
||||||
<aLwin>1</aLwin>
|
<aLwin>0</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>0</aSer1>
|
<aSer1>1</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
<aPa>0</aPa>
|
<aPa>0</aPa>
|
||||||
<viewmode>1</viewmode>
|
<viewmode>1</viewmode>
|
||||||
|
|
@ -416,24 +433,28 @@
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>3</FileNumber>
|
<FileNumber>3</FileNumber>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Drivers\Include\Driver_GPIO.h</PathWithFileName>
|
<PathWithFileName>..\Drivers\Sources\Driver_UART.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>Driver_GPIO.h</FilenameWithoutPath>
|
<FilenameWithoutPath>Driver_UART.c</FilenameWithoutPath>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>4</FileNumber>
|
<FileNumber>4</FileNumber>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
|
<<<<<<< HEAD
|
||||||
<tvExp>0</tvExp>
|
<tvExp>0</tvExp>
|
||||||
|
=======
|
||||||
|
<tvExp>1</tvExp>
|
||||||
|
>>>>>>> feature-branch
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Drivers\Include\Driver_Timer.h</PathWithFileName>
|
<PathWithFileName>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>Driver_Timer.h</FilenameWithoutPath>
|
<FilenameWithoutPath>Driver_ADC.c</FilenameWithoutPath>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
|
|
@ -441,7 +462,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>SRC</GroupName>
|
<GroupName>SRC</GroupName>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
|
@ -449,7 +470,7 @@
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</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>.\Sources\Main.c</PathWithFileName>
|
<PathWithFileName>.\Sources\Main.c</PathWithFileName>
|
||||||
|
|
@ -469,7 +490,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>
|
||||||
|
|
|
||||||
|
|
@ -394,14 +394,14 @@
|
||||||
<FilePath>..\Drivers\Sources\Driver_Timer.c</FilePath>
|
<FilePath>..\Drivers\Sources\Driver_Timer.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Driver_GPIO.h</FileName>
|
<FileName>Driver_UART.c</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Drivers\Include\Driver_GPIO.h</FilePath>
|
<FilePath>..\Drivers\Sources\Driver_UART.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Driver_Timer.h</FileName>
|
<FileName>Driver_ADC.c</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Drivers\Include\Driver_Timer.h</FilePath>
|
<FilePath>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
@ -811,14 +811,14 @@
|
||||||
<FilePath>..\Drivers\Sources\Driver_Timer.c</FilePath>
|
<FilePath>..\Drivers\Sources\Driver_Timer.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Driver_GPIO.h</FileName>
|
<FileName>Driver_UART.c</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Drivers\Include\Driver_GPIO.h</FilePath>
|
<FilePath>..\Drivers\Sources\Driver_UART.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Driver_Timer.h</FileName>
|
<FileName>Driver_ADC.c</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Drivers\Include\Driver_Timer.h</FilePath>
|
<FilePath>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,24 @@
|
||||||
#include "Driver_GPIO.h"
|
#include "Driver_GPIO.h"
|
||||||
#include "Driver_Timer.h"
|
#include "Driver_Timer.h"
|
||||||
|
#include "Driver_UART.h"
|
||||||
|
#include "Driver_ADC.h"
|
||||||
|
|
||||||
|
|
||||||
|
char data[] = "Hello World";
|
||||||
|
int i = 0;
|
||||||
|
int len = sizeof(data) - 1; // -1 pour ne pas envoyer le caractère nul
|
||||||
|
void ADC_interrup(void);
|
||||||
|
|
||||||
int main (void){
|
int main (void){
|
||||||
//Déclaration d'une LED et d'un BP par structure GPIO
|
//Déclaration d'une LED et d'un BP par structure GPIO
|
||||||
MyGPIO_Struct_TypeDef LED;
|
MyGPIO_Struct_TypeDef LED;
|
||||||
MyGPIO_Struct_TypeDef BP;
|
MyGPIO_Struct_TypeDef BP;
|
||||||
|
MyUART_Struct_Typedef UART;
|
||||||
//Déclaration d'un Timer 500 ms
|
//Déclaration d'un Timer 500 ms
|
||||||
MyTimer_Struct_TypeDef TIM500ms;
|
MyTimer_Struct_TypeDef TIM500ms;
|
||||||
|
|
||||||
|
//Déclaration ADC de Test
|
||||||
|
MyADC_Struct_TypeDef ADCTEST;
|
||||||
//Config LED PA5
|
//Config LED PA5
|
||||||
LED.GPIO_Conf = Out_Ppull;
|
LED.GPIO_Conf = Out_Ppull;
|
||||||
LED.GPIO_Pin = 5;
|
LED.GPIO_Pin = 5;
|
||||||
|
|
@ -25,6 +37,9 @@ int main (void){
|
||||||
TIM500ms.ARR = 5000;
|
TIM500ms.ARR = 5000;
|
||||||
MyTimer_Base_Init(&TIM500ms);
|
MyTimer_Base_Init(&TIM500ms);
|
||||||
|
|
||||||
|
//InitUART
|
||||||
|
UART.UART = USART1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TIM2->DIER |= 1<< 0 ; //INTERRUPTION PERIPH
|
TIM2->DIER |= 1<< 0 ; //INTERRUPTION PERIPH
|
||||||
//TIM2->DIER |= TIM_DIER_UIE ;
|
//TIM2->DIER |= TIM_DIER_UIE ;
|
||||||
|
|
@ -36,13 +51,28 @@ int main (void){
|
||||||
|
|
||||||
MyTimer_PWM(&TIM500ms, 50);
|
MyTimer_PWM(&TIM500ms, 50);
|
||||||
|
|
||||||
while(1){
|
|
||||||
// if (MyGPIO_Read(BP.GPIO,BP.GPIO_Pin)==0){
|
|
||||||
// MyGPIO_Set(LED.GPIO,LED.GPIO_Pin);
|
|
||||||
// }else{
|
//NVIC_EnableIRQ(USART1_IRQn);// Activer les interruptions
|
||||||
// MyGPIO_Reset(LED.GPIO,LED.GPIO_Pin);
|
UART_InitGPIO(&UART);
|
||||||
// }
|
// Envoyer les données
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
UART_send(data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//UART_read(data[i], &UART);
|
||||||
|
|
||||||
|
//ADC
|
||||||
|
//TEST ADC//
|
||||||
|
ADCTEST.ADC = ADC1;
|
||||||
|
ADCTEST.Channel = 0;
|
||||||
|
MyADC_Base_Init(&ADCTEST);
|
||||||
|
MyADC_Base_Interuption(ADCTEST.ADC);
|
||||||
|
MyADC_Init_Periph(ADC_interrup);
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
MyADC_Base_Start(ADCTEST.ADC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,4 +82,14 @@ void TIM2_IRQHandler (void)
|
||||||
MyGPIO_Toggle(GPIOA,5);
|
MyGPIO_Toggle(GPIOA,5);
|
||||||
TIM2->SR &= ~(1<<0);
|
TIM2->SR &= ~(1<<0);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
void Timer_interup(void)
|
||||||
|
{
|
||||||
|
MyGPIO_Toggle(GPIOA,5);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Interruption du programme par trigger de l'ADC
|
||||||
|
void ADC_interrup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue