Compare commits
8 commits
master
...
feature-AD
Author | SHA1 | Date | |
---|---|---|---|
30083f71b9 | |||
8a6d8b8dae | |||
8fc1457802 | |||
8d1127512c | |||
1c84636b75 | |||
4d69e527e5 | |||
6d91d3c4ae | |||
541f57dbef |
16 changed files with 255 additions and 131 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -28,3 +28,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
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
|
|
@ -11,14 +11,10 @@ typedef struct
|
||||||
} MyTimer_Struct_TypeDef;
|
} MyTimer_Struct_TypeDef;
|
||||||
|
|
||||||
|
|
||||||
void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer);
|
void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer, void (*fct)(void));
|
||||||
void MyTimer_Base_Start(TIM_TypeDef * Timer);
|
void MyTimer_Base_Start(TIM_TypeDef * Timer);
|
||||||
void MyTimer_Base_Stop(TIM_TypeDef * Timer);
|
void MyTimer_Base_Stop(TIM_TypeDef * Timer);
|
||||||
|
void MyTimer_PWM( MyTimer_Struct_TypeDef * Timer, uint16_t cycle);
|
||||||
|
|
||||||
/*#define MyTimer_Base_Start(Timer)
|
|
||||||
#define MyTimer_Base_Stop(Timer)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
60
Drivers/Sources/Driver_ADC.c
Normal file
60
Drivers/Sources/Driver_ADC.c
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
#include "Driver_ADC.h"
|
||||||
|
#include "Driver_GPIO.h"
|
||||||
|
|
||||||
|
|
||||||
|
void (*PtrfctADC)(void); //Déclaration du pointeur de fonction ADC
|
||||||
|
|
||||||
|
//---------------------INIT-------------------//
|
||||||
|
void MyADC_Base_Init(MyADC_Struct_TypeDef * ADC){
|
||||||
|
|
||||||
|
MyGPIO_Struct_TypeDef * GPIO_ADC; //Déclaration du GPIO de l'ADC
|
||||||
|
|
||||||
|
|
||||||
|
RCC->CFGR |= RCC_CFGR_ADCPRE_DIV6; //Division par 6 de la clock (72MHz) pour l'ADC (12MHz)
|
||||||
|
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; //Start clock ADC1
|
||||||
|
|
||||||
|
GPIO_ADC->GPIO = GPIOC; //Initialisation du GPIO de l'ADC
|
||||||
|
GPIO_ADC->GPIO_Conf = In_Analog;
|
||||||
|
GPIO_ADC->GPIO_Pin = 0;
|
||||||
|
MyGPIO_Init(GPIO_ADC);
|
||||||
|
|
||||||
|
|
||||||
|
ADC1->SQR1 &= ADC_SQR1_L; //fixe le nombre de conversion à 1
|
||||||
|
ADC1->SQR3|= ADC->Channel; //indique 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 end of conversion
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------DATA--------------------//
|
||||||
|
int MyADC_Base_Result (MyADC_Struct_TypeDef * ADC){
|
||||||
|
return ADC1->DR & ~((0x0F)<<12); //Retour de la conversion de l'ADC
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------POINTEUR-----------------//
|
||||||
|
void MyADC_Init_Periph (void (*fct)(void)){
|
||||||
|
PtrfctADC=fct; //Affectation du pointeur de fonction ADC
|
||||||
|
}
|
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
#include "Driver_Timer.h"
|
#include "Driver_Timer.h"
|
||||||
|
|
||||||
|
|
||||||
|
void (*Ptrfct)(void);
|
||||||
|
|
||||||
//-----------------------INITIALISATION TIMER---------------------//
|
//-----------------------INITIALISATION TIMER---------------------//
|
||||||
void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){
|
void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer, void (*fct)(void)){
|
||||||
|
|
||||||
|
Ptrfct=fct;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -36,3 +42,19 @@ void MyTimer_Base_Stop(TIM_TypeDef * Timer){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------PWM----------------------//
|
||||||
|
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_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->CCR1 = (cycle * Timer->ARR) / 100; // Fixer la durée à 20%
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------HANDLER--------------------//
|
||||||
|
void TIM2_IRQHandler (void)
|
||||||
|
{
|
||||||
|
Ptrfct();
|
||||||
|
TIM2->SR &= ~(1<<0);
|
||||||
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
#include "Driver_GPIO.h"
|
|
||||||
#include "Driver_Timer.h"
|
|
||||||
|
|
||||||
int main (void){
|
|
||||||
//Déclaration d'une LED et d'un BP par structure GPIO
|
|
||||||
MyGPIO_Struct_TypeDef LED;
|
|
||||||
MyGPIO_Struct_TypeDef BP;
|
|
||||||
//Déclaration d'un Timer 500 ms
|
|
||||||
MyTimer_Struct_TypeDef TIM500ms;
|
|
||||||
//Config LED PA5
|
|
||||||
LED.GPIO_Conf = Out_Ppull;
|
|
||||||
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 = 0xD2F0; // =0.5ms(calculé à partir de la fréquence du micro)
|
|
||||||
TIM500ms.ARR = 1000;
|
|
||||||
MyTimer_Base_Init(&TIM500ms);
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while(1){
|
|
||||||
// if (MyGPIO_Read(BP.GPIO,BP.GPIO_Pin)==0){
|
|
||||||
// MyGPIO_Set(LED.GPIO,LED.GPIO_Pin);
|
|
||||||
// }else{
|
|
||||||
// MyGPIO_Reset(LED.GPIO,LED.GPIO_Pin);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TIM2_IRQHandler (void)
|
|
||||||
{
|
|
||||||
MyGPIO_Toggle(GPIOA,5);
|
|
||||||
TIM2->SR &= ~(1<<0);
|
|
||||||
}
|
|
|
@ -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=-1,-1,-1,-1,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=374,206,750,763,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=419,236,840,663,0)(121=-1,-1,-1,-1,0)(122=546,286,967,713,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=708,0,1302,751,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=308,316,824,669,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=1008,49,1611,800,0)(151=-1,-1,-1,-1,0)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
|
@ -143,14 +143,54 @@
|
||||||
<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>57</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134219272</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>..\Drivers\Sources\Driver_Timer.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\GPIO_Test\../Drivers/Sources/Driver_Timer.c\57</Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>1</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>58</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134219274</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>..\Drivers\Sources\Driver_Timer.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\GPIO_Test\../Drivers/Sources/Driver_Timer.c\58</Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
|
<WatchWindow1>
|
||||||
|
<Ww>
|
||||||
|
<count>0</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>Ptrfct</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>1</periodic>
|
||||||
<aLwin>1</aLwin>
|
<aLwin>0</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>0</aSer1>
|
<aSer1>0</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
|
@ -158,13 +198,13 @@
|
||||||
<viewmode>1</viewmode>
|
<viewmode>1</viewmode>
|
||||||
<vrSel>0</vrSel>
|
<vrSel>0</vrSel>
|
||||||
<aSym>0</aSym>
|
<aSym>0</aSym>
|
||||||
<aTbox>1</aTbox>
|
<aTbox>0</aTbox>
|
||||||
<AscS1>0</AscS1>
|
<AscS1>0</AscS1>
|
||||||
<AscS2>0</AscS2>
|
<AscS2>0</AscS2>
|
||||||
<AscS3>0</AscS3>
|
<AscS3>0</AscS3>
|
||||||
<aSer3>0</aSer3>
|
<aSer3>0</aSer3>
|
||||||
<eProf>0</eProf>
|
<eProf>0</eProf>
|
||||||
<aLa>1</aLa>
|
<aLa>0</aLa>
|
||||||
<aPa1>0</aPa1>
|
<aPa1>0</aPa1>
|
||||||
<AscS4>0</AscS4>
|
<AscS4>0</AscS4>
|
||||||
<aSer4>0</aSer4>
|
<aSer4>0</aSer4>
|
||||||
|
@ -193,12 +233,6 @@
|
||||||
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030323029203E3E2035000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F1700000000000000000000000000000000000000DA040008</SecondString>
|
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030323029203E3E2035000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F1700000000000000000000000000000000000000DA040008</SecondString>
|
||||||
</Wi>
|
</Wi>
|
||||||
</LogicAnalyzers>
|
</LogicAnalyzers>
|
||||||
<SystemViewers>
|
|
||||||
<Entry>
|
|
||||||
<Name>System Viewer\GPIOA</Name>
|
|
||||||
<WinId>35905</WinId>
|
|
||||||
</Entry>
|
|
||||||
</SystemViewers>
|
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
<Enable>1</Enable>
|
<Enable>1</Enable>
|
||||||
<EnableFlashSeq>0</EnableFlashSeq>
|
<EnableFlashSeq>0</EnableFlashSeq>
|
||||||
|
@ -422,24 +456,12 @@
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>1</GroupNumber>
|
<GroupNumber>1</GroupNumber>
|
||||||
<FileNumber>3</FileNumber>
|
<FileNumber>3</FileNumber>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>..\Drivers\Include\Driver_GPIO.h</PathWithFileName>
|
<PathWithFileName>..\Drivers\Sources\Driver_ADC.c</PathWithFileName>
|
||||||
<FilenameWithoutPath>Driver_GPIO.h</FilenameWithoutPath>
|
<FilenameWithoutPath>Driver_ADC.c</FilenameWithoutPath>
|
||||||
<RteFlg>0</RteFlg>
|
|
||||||
<bShared>0</bShared>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<GroupNumber>1</GroupNumber>
|
|
||||||
<FileNumber>4</FileNumber>
|
|
||||||
<FileType>5</FileType>
|
|
||||||
<tvExp>0</tvExp>
|
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
|
||||||
<bDave2>0</bDave2>
|
|
||||||
<PathWithFileName>..\Drivers\Include\Driver_Timer.h</PathWithFileName>
|
|
||||||
<FilenameWithoutPath>Driver_Timer.h</FilenameWithoutPath>
|
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
|
@ -453,9 +475,9 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<File>
|
<File>
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>5</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>.\Sources\Main.c</PathWithFileName>
|
<PathWithFileName>.\Sources\Main.c</PathWithFileName>
|
|
@ -394,14 +394,9 @@
|
||||||
<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_ADC.c</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Drivers\Include\Driver_GPIO.h</FilePath>
|
<FilePath>..\Drivers\Sources\Driver_ADC.c</FilePath>
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>Driver_Timer.h</FileName>
|
|
||||||
<FileType>5</FileType>
|
|
||||||
<FilePath>..\Drivers\Include\Driver_Timer.h</FilePath>
|
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -811,14 +806,9 @@
|
||||||
<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_ADC.c</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Drivers\Include\Driver_GPIO.h</FilePath>
|
<FilePath>..\Drivers\Sources\Driver_ADC.c</FilePath>
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>Driver_Timer.h</FileName>
|
|
||||||
<FileType>5</FileType>
|
|
||||||
<FilePath>..\Drivers\Include\Driver_Timer.h</FilePath>
|
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
53
Voilier/Sources/Main.c
Normal file
53
Voilier/Sources/Main.c
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
#include "Driver_GPIO.h"
|
||||||
|
#include "Driver_Timer.h"
|
||||||
|
#include "Driver_ADC.h"
|
||||||
|
|
||||||
|
void Timer_interup(void);
|
||||||
|
void ADC_interrup(void);
|
||||||
|
|
||||||
|
|
||||||
|
int main (void){
|
||||||
|
//Déclaration ADC de Test
|
||||||
|
MyADC_Struct_TypeDef ADCTEST;
|
||||||
|
|
||||||
|
//Déclaration d'un Timer 500 ms
|
||||||
|
MyTimer_Struct_TypeDef TIM500ms;
|
||||||
|
//Init Timer 2 et Test
|
||||||
|
TIM500ms.Timer = TIM2;
|
||||||
|
TIM500ms.PSC = 7200-1; // =0.5ms(calculé à partir de la fréquence du micro)
|
||||||
|
TIM500ms.ARR = 5000-1;
|
||||||
|
MyTimer_Base_Init(&TIM500ms, Timer_interup);
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Interuption du programme par trigger du timer
|
||||||
|
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