Compare commits
No commits in common. "6687cffd8f43d44744206b9a4c8ed2be5607da84" and "f22d8aacd9400ca32c4c8d631c143cff4a5ef405" have entirely different histories.
6687cffd8f
...
f22d8aacd9
10 changed files with 59 additions and 342 deletions
|
|
@ -1,21 +0,0 @@
|
|||
#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,5 +23,4 @@ int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ; // renvoie 0 ou autre
|
|||
void MyGPIO_Set ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
||||
void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
||||
void MyGPIO_Toggle ( GPIO_TypeDef * GPIO , char GPIO_Pin ) ;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
#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
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#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,47 +2,35 @@
|
|||
|
||||
|
||||
//---------------------FONCTION D'INITIALISATION-----------------//
|
||||
void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr )
|
||||
{
|
||||
void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr){
|
||||
|
||||
/* Activation of the GPIO port specific clock */
|
||||
if (GPIOStructPtr->GPIO == GPIOA)
|
||||
{
|
||||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
|
||||
}
|
||||
else if (GPIOStructPtr->GPIO == GPIOB)
|
||||
{
|
||||
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
|
||||
}
|
||||
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));
|
||||
//INITIALISATION DE LA CLOCK CORRESPONDANT AU GPIO A, B ou C
|
||||
if (GPIOStructPtr->GPIO == GPIOA) {
|
||||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
|
||||
} else if (GPIOStructPtr->GPIO == GPIOB) {
|
||||
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
|
||||
} else if (GPIOStructPtr->GPIO == GPIOC) {
|
||||
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
|
||||
} else if (GPIOStructPtr->GPIO == GPIOD) {
|
||||
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
|
||||
}
|
||||
|
||||
if(GPIOStructPtr->GPIO_Conf == (char)In_PullDown)
|
||||
{
|
||||
GPIOStructPtr->GPIO->ODR &= ~(0x1<<(GPIOStructPtr->GPIO_Pin));
|
||||
//CONFIGURATION DE LA PIN UTILISEE (voir table20 p9.1)
|
||||
if(GPIOStructPtr->GPIO_Pin < 8){
|
||||
GPIOStructPtr->GPIO->CRL &= ~(0xF << (4 * GPIOStructPtr->GPIO_Pin));
|
||||
GPIOStructPtr->GPIO->CRL |= (GPIOStructPtr->GPIO_Conf << (4 * GPIOStructPtr->GPIO_Pin));
|
||||
}
|
||||
else if(GPIOStructPtr->GPIO_Conf == (char)In_PullUp)
|
||||
{
|
||||
GPIOStructPtr->GPIO->ODR |= 0x1<<(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 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -74,4 +62,3 @@ void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin ){
|
|||
void MyGPIO_Toggle ( GPIO_TypeDef * GPIO , char 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->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%
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,144 +0,0 @@
|
|||
#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>
|
||||
<Number>0</Number>
|
||||
<Key>DLGDARM</Key>
|
||||
<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>
|
||||
<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>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
|
@ -143,24 +143,7 @@
|
|||
<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>
|
||||
</TargetDriverDllRegistry>
|
||||
<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>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
|
|
@ -169,7 +152,7 @@
|
|||
<periodic>1</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>1</aSer1>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>1</viewmode>
|
||||
|
|
@ -354,9 +337,9 @@
|
|||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>1</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aLwin>1</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>1</aSer1>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>1</viewmode>
|
||||
|
|
@ -433,28 +416,24 @@
|
|||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Drivers\Sources\Driver_UART.c</PathWithFileName>
|
||||
<FilenameWithoutPath>Driver_UART.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\Include\Driver_GPIO.h</PathWithFileName>
|
||||
<FilenameWithoutPath>Driver_GPIO.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<<<<<<< HEAD
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
=======
|
||||
<tvExp>1</tvExp>
|
||||
>>>>>>> feature-branch
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</PathWithFileName>
|
||||
<FilenameWithoutPath>Driver_ADC.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\Include\Driver_Timer.h</PathWithFileName>
|
||||
<FilenameWithoutPath>Driver_Timer.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
|
|
@ -462,7 +441,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>SRC</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
|
@ -470,7 +449,7 @@
|
|||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\Sources\Main.c</PathWithFileName>
|
||||
|
|
@ -490,7 +469,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>::Device</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
|
|
|
|||
|
|
@ -394,14 +394,14 @@
|
|||
<FilePath>..\Drivers\Sources\Driver_Timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Driver_UART.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\Sources\Driver_UART.c</FilePath>
|
||||
<FileName>Driver_GPIO.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Drivers\Include\Driver_GPIO.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Driver_ADC.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</FilePath>
|
||||
<FileName>Driver_Timer.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Drivers\Include\Driver_Timer.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
|
|
@ -811,14 +811,14 @@
|
|||
<FilePath>..\Drivers\Sources\Driver_Timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Driver_UART.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\Sources\Driver_UART.c</FilePath>
|
||||
<FileName>Driver_GPIO.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Drivers\Include\Driver_GPIO.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Driver_ADC.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</FilePath>
|
||||
<FileName>Driver_Timer.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Drivers\Include\Driver_Timer.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,12 @@
|
|||
#include "Driver_GPIO.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){
|
||||
//Déclaration d'une LED et d'un BP par structure GPIO
|
||||
MyGPIO_Struct_TypeDef LED;
|
||||
MyGPIO_Struct_TypeDef BP;
|
||||
MyUART_Struct_Typedef UART;
|
||||
//Déclaration d'un Timer 500 ms
|
||||
MyTimer_Struct_TypeDef TIM500ms;
|
||||
|
||||
//Déclaration ADC de Test
|
||||
MyADC_Struct_TypeDef ADCTEST;
|
||||
//Config LED PA5
|
||||
LED.GPIO_Conf = Out_Ppull;
|
||||
LED.GPIO_Pin = 5;
|
||||
|
|
@ -37,9 +25,6 @@ int main (void){
|
|||
TIM500ms.ARR = 5000;
|
||||
MyTimer_Base_Init(&TIM500ms);
|
||||
|
||||
//InitUART
|
||||
UART.UART = USART1;
|
||||
|
||||
/*
|
||||
TIM2->DIER |= 1<< 0 ; //INTERRUPTION PERIPH
|
||||
//TIM2->DIER |= TIM_DIER_UIE ;
|
||||
|
|
@ -51,28 +36,13 @@ int main (void){
|
|||
|
||||
MyTimer_PWM(&TIM500ms, 50);
|
||||
|
||||
|
||||
|
||||
|
||||
//NVIC_EnableIRQ(USART1_IRQn);// Activer les interruptions
|
||||
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);
|
||||
// if (MyGPIO_Read(BP.GPIO,BP.GPIO_Pin)==0){
|
||||
// MyGPIO_Set(LED.GPIO,LED.GPIO_Pin);
|
||||
// }else{
|
||||
// MyGPIO_Reset(LED.GPIO,LED.GPIO_Pin);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,13 +53,3 @@ void TIM2_IRQHandler (void)
|
|||
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