Compare commits

..

No commits in common. "master" and "feature-branch" have entirely different histories.

16 changed files with 128 additions and 319 deletions

View file

@ -9,7 +9,6 @@ char GPIO_Pin ; //numero de 0 a 15
char GPIO_Conf ; // voir ci dessous char GPIO_Conf ; // voir ci dessous
} MyGPIO_Struct_TypeDef ; } MyGPIO_Struct_TypeDef ;
#define Out_PullUp 0x01
#define In_Floating 0x4 #define In_Floating 0x4
#define In_PullDown 0x8 #define In_PullDown 0x8
#define In_PullUp 0x8 #define In_PullUp 0x8

View file

@ -1,60 +0,0 @@
#include "Driver_ADC.h"
#include "Driver_GPIO.h"
void (*PtrfctADC)(void); /* Déclaration du pointeur de fonction ADC pour l'interrupt */
//---------------------INIT-------------------//
void MyADC_Base_Init(MyADC_Struct_TypeDef * ADC){
MyGPIO_Struct_TypeDef * GPIO_ADC; /* Déclaration du GPIO lié à l'ADC */
RCC->CFGR |= RCC_CFGR_ADCPRE_DIV6; /*Division par 6 de la clock (72MHz) pour l'ADC (12MHz) car clock max ADC : 14MHz */
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; /* Start clock de l'ADC1 */
GPIO_ADC->GPIO = GPIOC; /* Initialisation du GPIO lié à l'ADC */
GPIO_ADC->GPIO_Conf = In_Analog;
GPIO_ADC->GPIO_Pin = 0;
MyGPIO_Init(GPIO_ADC);
ADC1->SQR1 &= ADC_SQR1_L; /* Fixation du nombre de conversion à 1 */
ADC1->SQR3|= ADC->Channel; /* Choix de la voie à convertir */
ADC1->CR2 |= ADC_CR2_EXTTRIG; /* Activation du trigger externe */
ADC1->CR2 |= ADC_CR2_EXTSEL; /* event externe choisis : SWSTART */
MyADC_Base_Start(ADC->ADC); /* Sart ADC1 et Horloge ADC1 */
}
//--------------------START-------------------//
void MyADC_Base_Start(ADC_TypeDef * ADC){
ADC1->CR2 |= ADC_CR2_ADON;
}
//------------------INTERRUPTION--------------//
void MyADC_Base_Interuption(ADC_TypeDef * ADC){
/* Activation du trigger externe */
ADC->CR1 |= ADC_CR1_EOCIE; /* Interruption de l'ADC autorisée */
NVIC->ISER[0] |= (0x1<<ADC1_2_IRQn); /* Interruption active au niveau NVIC */
NVIC->IP[ADC1_2_IRQn] |= 1<<4; /* Affectation du niveau de priorité */
}
//--------------------HANDLER-----------------//
void ADC1_2_IRQHandler (void) {
(*PtrfctADC)(); /* Appel de la fonction pointée par le pointeur fonction ADC */
MyADC_Base_Start(ADC1);
ADC1->SR &= ~ADC_SR_EOC; /* RAZ du flag de fin de conversion */
}
//--------------------DATA--------------------//
int MyADC_Base_Result (MyADC_Struct_TypeDef * ADC){
return ADC1->DR & ~((0x0F)<<12); /* Récuperation du résultat de la conversion de l'ADC */
}
//-------------------POINTEUR-----------------//
void MyADC_Init_Periph (void (*fct)(void)){
PtrfctADC=fct; /* Affectation du pointeur de fonction ADC */
}

View file

@ -5,26 +5,26 @@
void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr ) void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr )
{ {
/* Activation de la clock liée au GPIO sélectionné */ /* Activation of the GPIO port specific clock */
if (GPIOStructPtr->GPIO == GPIOA) if (GPIOStructPtr->GPIO == GPIOA)
{ {
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
} }
else if (GPIOStructPtr->GPIO == GPIOB) else if (GPIOStructPtr->GPIO == GPIOB)
{ {
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
} }
else if (GPIOStructPtr->GPIO == GPIOC) else if (GPIOStructPtr->GPIO == GPIOC)
{ {
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN; RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
} }
else if (GPIOStructPtr->GPIO == GPIOD) else if (GPIOStructPtr->GPIO == GPIOD)
{ {
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN; RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
} }
/* Reset & configuration de la pin avec le mode adéquat */ /* Reset, and then configuration writing of the selected GPIO Pin */
if(GPIOStructPtr->GPIO_Pin <= 8) if(GPIOStructPtr->GPIO_Pin <= 8)
{ {
GPIOStructPtr->GPIO->CRL &= ~0xF<<(4*(GPIOStructPtr->GPIO_Pin)); GPIOStructPtr->GPIO->CRL &= ~0xF<<(4*(GPIOStructPtr->GPIO_Pin));
@ -36,7 +36,6 @@ void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr )
GPIOStructPtr->GPIO->CRH |= (GPIOStructPtr->GPIO_Conf)<<(4*((GPIOStructPtr->GPIO_Pin)%8)); GPIOStructPtr->GPIO->CRH |= (GPIOStructPtr->GPIO_Conf)<<(4*((GPIOStructPtr->GPIO_Pin)%8));
} }
/* Ecriture de l'ODR pour choisir entre pulldown & pushpull*/
if(GPIOStructPtr->GPIO_Conf == (char)In_PullDown) if(GPIOStructPtr->GPIO_Conf == (char)In_PullDown)
{ {
GPIOStructPtr->GPIO->ODR &= ~(0x1<<(GPIOStructPtr->GPIO_Pin)); GPIOStructPtr->GPIO->ODR &= ~(0x1<<(GPIOStructPtr->GPIO_Pin));
@ -50,8 +49,7 @@ void MyGPIO_Init ( MyGPIO_Struct_TypeDef * GPIOStructPtr )
//----------------------------READ--------------------------// //----------------------------READ--------------------------//
int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ){ int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ){
int etatbit; int etatbit;
//On vérifie si la valeur lue dans l'IDR est un 0 ou un 1
/* Verification de la valeur de l'IDR */
if((GPIO->IDR & (1<<GPIO_Pin))!=0){ if((GPIO->IDR & (1<<GPIO_Pin))!=0){
etatbit = 1; etatbit = 1;
} }
@ -63,16 +61,13 @@ int MyGPIO_Read ( GPIO_TypeDef * GPIO , char GPIO_Pin ){
//---------------------SET-------------------// //---------------------SET-------------------//
void MyGPIO_Set ( GPIO_TypeDef * GPIO , char GPIO_Pin ){ void MyGPIO_Set ( GPIO_TypeDef * GPIO , char GPIO_Pin ){
/*Ecriture du 1 sur le numéro de la pin dans le registre BSRR*/
GPIO->BSRR |= (1 << GPIO_Pin); GPIO->BSRR |= (1 << GPIO_Pin);
} }
//---------------------RESET-----------------// //---------------------RESET-----------------//
void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin ){ void MyGPIO_Reset ( GPIO_TypeDef * GPIO , char GPIO_Pin ){
/*Ecriture du 1 sur le numéro de la pin dans le registre BRR*/
GPIO->BRR = (1 << GPIO_Pin); GPIO->BRR = (1 << GPIO_Pin);
//Pas besoin de | puisque les 0 n'impactent pas la fonction reset
} }
//---------------------TOGGLE-----------------// //---------------------TOGGLE-----------------//

View file

@ -2,8 +2,6 @@
//-----------------------INITIALISATION TIMER---------------------// //-----------------------INITIALISATION TIMER---------------------//
void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){ void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){
/* Activation de la clock liée au TIMER sélectionné */
if(Timer->Timer == TIM1){ if(Timer->Timer == TIM1){
//RCC->APB2ENR |= 0x0001<<11; //RCC->APB2ENR |= 0x0001<<11;
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN; RCC->APB2ENR |= RCC_APB2ENR_TIM1EN;
@ -21,7 +19,6 @@ void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){
RCC->APB1ENR |= RCC_APB1ENR_TIM4EN; RCC->APB1ENR |= RCC_APB1ENR_TIM4EN;
} }
/* Load des valeurs de l'ARR et du PSC pour définir la période de comptage du TIMER et sa limite*/
Timer->Timer->ARR = Timer->ARR; Timer->Timer->ARR = Timer->ARR;
Timer->Timer->PSC = Timer->PSC; Timer->Timer->PSC = Timer->PSC;
@ -30,21 +27,20 @@ void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){
//-----------------------START----------------------// //-----------------------START----------------------//
void MyTimer_Base_Start(TIM_TypeDef * Timer){ void MyTimer_Base_Start(TIM_TypeDef * Timer){
Timer->CR1 |= TIM_CR1_CEN; //* Masque OU pour placer un 1 décalé avec des 0 */ Timer->CR1 |= TIM_CR1_CEN; //Masque OU pour placer un 1 décalé avec des 0
} }
//------------------------STOP----------------------// //------------------------STOP----------------------//
void MyTimer_Base_Stop(TIM_TypeDef * Timer){ void MyTimer_Base_Stop(TIM_TypeDef * Timer){
Timer->CR1 |= ~TIM_CR1_CEN; /* Masque ET pour placer un 0 décalé avec des 1 (~) */ Timer->CR1 |= ~TIM_CR1_CEN; //Masque ET pour placer un 0 décalé avec des 1 (~)
} }
void MyTimer_PWM( MyTimer_Struct_TypeDef * Timer, uint16_t cycle){ void MyTimer_PWM( MyTimer_Struct_TypeDef * Timer, uint16_t cycle){
Timer->Timer->CCMR1 &= ~TIM_CCMR1_OC1M_0; //Configuration du canal CH1
Timer->Timer->CCMR1 &= ~TIM_CCMR1_OC1M_0; /* Configuration du canal CH1 */ Timer->Timer->CCMR1 |= TIM_CCMR1_OC1M_1| TIM_CCMR1_OC1M_2; // Ajouter 110 aux bits OC1M (registre CCMR1)
Timer->Timer->CCMR1 |= TIM_CCMR1_OC1M_1| TIM_CCMR1_OC1M_2; /* Ajouter 110 aux bits OC1M (registre CCMR1) */
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%
} }

View file

@ -18,12 +18,12 @@ void UART_init(MyUART_Struct_Typedef * UART)
USART1->CR1 |= USART_CR1_UE; // Activer l'USART USART1->CR1 |= USART_CR1_UE; // Activer l'USART
USART1->CR1 &= ~USART_CR1_M; // Choisir la taille 8bits de donnée USART1->CR1 &= ~USART_CR1_M; // Choisir la taille 8bits de donnée
USART1->CR2 |= USART_CR2_STOP; // 1 seul bit de stop USART1->CR2 |= USART_CR2_STOP; // 1 seul bit de stop
//USART1->BRR |= 468 << 4; // Fixe le baud rate à 9600bps partie entière //USART1->BRR |= 468 << 4; // Fixe le baud rate à 9600bps partie entière
//USART1->BRR |= 75; // Fixe le baud rate à 9600bps partie fractionnaire //USART1->BRR |= 75; // Fixe le baud rate à 9600bps partie fractionnaire
UART->UART->BRR = 72000000/(UART->baudrate); UART->UART->BRR = 72000000/(UART->baudrate);
USART1->CR1 |= USART_CR1_TE; // Autoriser la transmission USART1->CR1 |= USART_CR1_TE; // Autoriser la transmission
USART1->CR1 |= USART_CR1_RE; // Activer la réception USART1->CR1 |= USART_CR1_RE; // Activer la réception
// USART1->CR1 |= USART_CR1_TCIE; // Activer l'interruption de transmission // USART1->CR1 |= USART_CR1_TCIE; // Activer l'interruption de transmission
USART1->CR1 |= USART_CR1_RXNEIE; // Activer l'interruption de réception USART1->CR1 |= USART_CR1_RXNEIE; // Activer l'interruption de réception
UART_interruption(UART); UART_interruption(UART);
@ -88,6 +88,7 @@ void USART3_IRQHandler(void)
} }
} }
void UART_interruption (MyUART_Struct_Typedef * UART) void UART_interruption (MyUART_Struct_Typedef * UART)
{ {
UART->UART->CR1 |= USART_CR1_RXNEIE; UART->UART->CR1 |= USART_CR1_RXNEIE;

View file

@ -1 +0,0 @@
#include "Driver_Timer.h"

View file

@ -1,42 +0,0 @@
#include "Driver_Timer.h"
#include "Driver_UART.h"
#include "Plateau.h"
#include "Driver_GPIO.h"
void Plateau_init(void)
{
MyTimer_Struct_TypeDef Timer;
MyGPIO_Struct_TypeDef Pin_Sens;
Pin_Sens.GPIO=GPIOB;
Pin_Sens.GPIO_Pin=1;
Pin_Sens.GPIO_Conf = Out_PullUp;
//Fréquence
Timer.Timer = TIM3;
Timer.ARR=3599;
Timer.PSC=0;
MyTimer_Base_Init(&Timer);
MyGPIO_Init(&Pin_Sens);
MyTimer_PWM(&Timer, 50);
MyTimer_Base_Start(TIM3);
Plateau_direction(DROITE);
}
void Plateau_direction(uint8_t Sens)
{
if(Sens == DROITE)
MyGPIO_Set(GPIOB,1);
if (Sens == GAUCHE)
MyGPIO_Reset(GPIOB,1);
}

View file

@ -1,12 +0,0 @@
#ifndef MYPLATEAU_H
#define MYPLATEAU_H
#include "stm32f10x.h"
#define DROITE 0x1
#define GAUCHE 0x0
void Plateau_init(void);
void Plateau_direction(uint8_t Sens);
#endif

View file

@ -1,32 +0,0 @@
#include "telecommande.h"
#include "Driver_GPIO.h"
#include "Plateau.h"
MyUART_Struct_Typedef UART_plateau = {USART1,9600};
void init_telecommande(void)
{
UART_InitGPIO(&UART_plateau);
UART_init(&UART_plateau);
}
void telecommande_plateau (int data)
{
int datar;
UART_send(data);
datar = data;
if(datar >= 0)
Plateau_direction(DROITE);
else
Plateau_direction(GAUCHE);
}
void testRemote(void)
{
UART_send('t');
UART_send('e');
UART_send('s');
UART_send('t');
}

View file

@ -1,12 +0,0 @@
#ifndef TELECOMMANDE_H
#define TELECOMMANDE_H
#include "Driver_UART.h"
#include "stm32f10x.h"
void init_telecommande(void);
void telecommande_plateau (int data);
void testRemote(void);
#endif

View file

@ -75,7 +75,7 @@
<OPTFL> <OPTFL>
<tvExp>1</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget> <IsCurrentTarget>1</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>18</CpuCode> <CpuCode>18</CpuCode>
<DebugOpt> <DebugOpt>
@ -125,7 +125,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGDARM</Key> <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=1042,189,1463,616,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=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>
@ -257,7 +274,7 @@
<OPTFL> <OPTFL>
<tvExp>1</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget> <IsCurrentTarget>0</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>18</CpuCode> <CpuCode>18</CpuCode>
<DebugOpt> <DebugOpt>
@ -429,10 +446,10 @@
<GroupNumber>1</GroupNumber> <GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber> <FileNumber>4</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\Drivers\Sources\Driver_ADC.c</PathWithFileName> <PathWithFileName>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</PathWithFileName>
<FilenameWithoutPath>Driver_ADC.c</FilenameWithoutPath> <FilenameWithoutPath>Driver_ADC.c</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<bShared>0</bShared> <bShared>0</bShared>
@ -441,7 +458,7 @@
<Group> <Group>
<GroupName>SRC</GroupName> <GroupName>SRC</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -459,50 +476,6 @@
</File> </File>
</Group> </Group>
<Group>
<GroupName>Voilier_fonction</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Drivers\Voilier_fonction\telecommande.c</PathWithFileName>
<FilenameWithoutPath>telecommande.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>7</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Drivers\Voilier_fonction\Girouette.c</PathWithFileName>
<FilenameWithoutPath>Girouette.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Drivers\Voilier_fonction\Plateau.c</PathWithFileName>
<FilenameWithoutPath>Plateau.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp> <tvExp>0</tvExp>
@ -513,7 +486,7 @@
<Group> <Group>
<GroupName>::Device</GroupName> <GroupName>::Device</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>1</RteFlg> <RteFlg>1</RteFlg>

View file

@ -339,7 +339,7 @@
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>..\Drivers\Include;..\Drivers\Voilier_fonction;..\Drivers\Sources</IncludePath> <IncludePath>..\Drivers\Include</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>
@ -401,7 +401,7 @@
<File> <File>
<FileName>Driver_ADC.c</FileName> <FileName>Driver_ADC.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\Drivers\Sources\Driver_ADC.c</FilePath> <FilePath>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</FilePath>
</File> </File>
</Files> </Files>
</Group> </Group>
@ -415,26 +415,6 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Voilier_fonction</GroupName>
<Files>
<File>
<FileName>telecommande.c</FileName>
<FileType>1</FileType>
<FilePath>..\Drivers\Voilier_fonction\telecommande.c</FilePath>
</File>
<File>
<FileName>Girouette.c</FileName>
<FileType>1</FileType>
<FilePath>..\Drivers\Voilier_fonction\Girouette.c</FilePath>
</File>
<File>
<FileName>Plateau.c</FileName>
<FileType>1</FileType>
<FilePath>..\Drivers\Voilier_fonction\Plateau.c</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>
@ -776,7 +756,7 @@
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>..\Drivers\Include;..\Drivers\Voilier_fonction</IncludePath> <IncludePath>..\Drivers\Include</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>
@ -838,7 +818,7 @@
<File> <File>
<FileName>Driver_ADC.c</FileName> <FileName>Driver_ADC.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\Drivers\Sources\Driver_ADC.c</FilePath> <FilePath>C:\Users\chanfreau\Downloads\voilier\Drivers\Sources\Driver_ADC.c</FilePath>
</File> </File>
</Files> </Files>
</Group> </Group>
@ -852,26 +832,6 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Voilier_fonction</GroupName>
<Files>
<File>
<FileName>telecommande.c</FileName>
<FileType>1</FileType>
<FilePath>..\Drivers\Voilier_fonction\telecommande.c</FilePath>
</File>
<File>
<FileName>Girouette.c</FileName>
<FileType>1</FileType>
<FilePath>..\Drivers\Voilier_fonction\Girouette.c</FilePath>
</File>
<File>
<FileName>Plateau.c</FileName>
<FileType>1</FileType>
<FilePath>..\Drivers\Voilier_fonction\Plateau.c</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>

View file

@ -2,32 +2,95 @@
#include "Driver_Timer.h" #include "Driver_Timer.h"
#include "Driver_UART.h" #include "Driver_UART.h"
#include "Driver_ADC.h" #include "Driver_ADC.h"
#include "Plateau.h"
#include "telecommande.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
MyGPIO_Struct_TypeDef LED;
MyGPIO_Struct_TypeDef BP;
MyUART_Struct_Typedef UART;
//Déclaration d'un Timer 500 ms
MyTimer_Struct_TypeDef TIM500ms;
MyGPIO_Struct_TypeDef * GPIO; //Déclaration ADC de Test
MyADC_Struct_TypeDef ADCTEST;
//init_telecommande(); //Config LED PA5
//Plateau_init(); LED.GPIO_Conf = Out_Ppull;
//Plateau_direction(DROITE); LED.GPIO_Pin = 5;
LED.GPIO = GPIOA;
MyGPIO_Init (&LED) ;
//Config BP PC13
BP.GPIO_Conf = In_Floating;
BP.GPIO_Pin = 13;
BP.GPIO = GPIOC;
//Init BP & LED
MyGPIO_Init (&LED);
MyGPIO_Init (&BP);
//Init Timer 2 et Test
TIM500ms.Timer = TIM2;
TIM500ms.PSC = 7200; // =0.5ms(calculé à partir de la fréquence du micro)
TIM500ms.ARR = 5000;
MyTimer_Base_Init(&TIM500ms);
//InitUART
UART.UART = USART1;
/*
TIM2->DIER |= 1<< 0 ; //INTERRUPTION PERIPH
//TIM2->DIER |= TIM_DIER_UIE ;
NVIC->ISER[0] |= 1<<TIM2_IRQn ; //INTERRUPTION COEUR
NVIC->IP[TIM2_IRQn] = 2<< 4 ;
*/
MyTimer_Base_Start(TIM500ms.Timer);
//Boucle infinie de la réponse de la LED à l'état BP
MyTimer_PWM(&TIM500ms, 50);
//testRemote();
MyGPIO_Init(GPIO);
//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){ while(1){
MyGPIO_Set(GPIOA,3); MyADC_Base_Start(ADCTEST.ADC);
} }
}
/*
void TIM2_IRQHandler (void)
{
MyGPIO_Toggle(GPIOA,5);
TIM2->SR &= ~(1<<0);
}
*/
void Timer_interup(void)
{
MyGPIO_Toggle(GPIOA,5);
}
//Interruption du programme par trigger de l'ADC
void ADC_interrup()
{
} }

View file

@ -1,19 +0,0 @@
# Projet Voilier
## Equipe 4
* Clement MARCE
* Louis ROUSSET
* Cedric CHANFREAU
## Réalisation des drivers :
* [GPIOS](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_GPIO.c) //Done
* [TIMERS](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_Timer.c) //Done
* [PWM](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_Timer.c) //Done (Cédric)
* [ADC](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_ADC.c) //Done (Clement+Louis)
* [UART](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Sources/Driver_UART.c) //Done (Cédric)
## Réalisation des différentes fonctions du bateau :
* [Girouette](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Voilier_fonction/Girouette.c) //Work in progress (Clement)
* [Plateau](https://git.etud.insa-toulouse.fr/marce/Voilier/src/branch/master/Drivers/Voilier_fonction/Plateau.c) //Need to test (Cédric)
! : Rousset Louis a été absent à 3séances de TP sur les 6 prévues, ce qui a causé du retard à l'équipe.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.