diff --git a/driver/adc.c b/driver/adc.c index 7259e4c..0004c62 100644 --- a/driver/adc.c +++ b/driver/adc.c @@ -23,7 +23,7 @@ void MyADC_Init(MyADC_Struct_TypeDef * ADCStructPtr) ADCStructPtr->ADC->SQR3 |= ADCStructPtr->channel; //Sequence Reader, seulement le SQ1 est lu dans notre cas, nous associons un channel � ce dernier. ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTTRIG; //Activation du trigger externe ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTSEL; //Event externe choisie : SWSTART - MyADC_ActiveIT(ADCStructPtr->ADC,0); + MyADC_ActiveIT(ADCStructPtr->ADC,1); ADCStructPtr->ADC->CR2 |= ADC_CR2_ADON; //Init l'ADC MyADC_Base_Start(ADCStructPtr->ADC); //Debut du premier ADC } diff --git a/driver/uart.c b/driver/uart.c index c798880..6e6698a 100644 --- a/driver/uart.c +++ b/driver/uart.c @@ -80,7 +80,7 @@ void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr){ } //TxD Enable, RxD Enable, USART Global Enable UARTStructPtr->UART->CR1 |= (USART_CR1_TE | USART_CR1_RE); - MyUART_ActiveIT(UARTStructPtr->UART,1); + MyUART_ActiveIT(UARTStructPtr->UART,2); } void MyUART_InitGPIO(MyUART_Struct_Typedef * UARTStructPtr) diff --git a/implementation/battery.c b/implementation/battery.c index 0730561..3d0f95b 100644 --- a/implementation/battery.c +++ b/implementation/battery.c @@ -1,15 +1,15 @@ #include "battery.h" extern MyUART_Struct_Typedef uartCool; -int actualMinutes =-1; -uint32_t oldAdc =0; +extern int actualMinutes; +extern uint32_t oldAdc; void battery(uint32_t data) { MyRTC_Struct_TypeDef rtcBattery; MyRTC_GetTime(&rtcBattery); - if((actualMinutes == rtcBattery.minutes) && isClose(oldAdc,data,50)) //pas de precision/10 % + if((actualMinutes == rtcBattery.minutes) && isClose(oldAdc,data,100)) //pas de precision/10 % { return; } diff --git a/implementation/girouette.h b/implementation/girouette.h index 72da37d..73b757d 100644 --- a/implementation/girouette.h +++ b/implementation/girouette.h @@ -1,10 +1,12 @@ -#ifndef MYMOTOR_H -#define MYMOTOR_H +#ifndef MYGIROUETTE_H +#define MYGIROUETTE_H #include "stm32f10x.h" #include "../driver/gpio.h" #include "../driver/timer.h" int MyGirouette_Angle(TIM_TypeDef *TIMX); void MyGirouette_Init(TIM_TypeDef *TIMX); +void MyGirouette_Init_IT_Z(uint8_t GPIO_Pin); +void EXTI0_IRQHandler(void); #endif diff --git a/keilproject/Source/Principale.c b/keilproject/Source/Principale.c index f0d480b..a741249 100644 --- a/keilproject/Source/Principale.c +++ b/keilproject/Source/Principale.c @@ -7,11 +7,15 @@ #include "accelerometer.h" #include "battery.h" #include "timer.h" +#include "girouette.h" void initImplementation(void); float GX, GY, GZ; int Angle_Girouette=0; +int actualMinutes=-1; +uint32_t oldAdc=0; + int main (void) { diff --git a/keilproject/voilier.uvoptx b/keilproject/voilier.uvoptx index aa1f2a2..07bce37 100644 --- a/keilproject/voilier.uvoptx +++ b/keilproject/voilier.uvoptx @@ -427,7 +427,7 @@ MesDrivers - 0 + 1 0 0 0 @@ -631,6 +631,30 @@ 0 0 + + 3 + 18 + 1 + 0 + 0 + 0 + ..\implementation\battery.c + battery.c + 0 + 0 + + + 3 + 19 + 1 + 1 + 0 + 0 + ..\implementation\girouette.c + girouette.c + 0 + 0 + diff --git a/keilproject/voilier.uvprojx b/keilproject/voilier.uvprojx index 4976033..2af6843 100644 --- a/keilproject/voilier.uvprojx +++ b/keilproject/voilier.uvprojx @@ -16,7 +16,7 @@ STM32F103RB STMicroelectronics - Keil.STM32F1xx_DFP.2.4.0 + Keil.STM32F1xx_DFP.2.3.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE @@ -186,7 +186,6 @@ 0 0 0 - 0 0 0 8 @@ -479,6 +478,16 @@ 1 ..\implementation\servo.c + + battery.c + 1 + ..\implementation\battery.c + + + girouette.c + 1 + ..\implementation\girouette.c + @@ -493,13 +502,13 @@ Réel 0x4 ARM-ADS - 5060960::V5.06 update 7 (build 960)::.\ARM_Compiler_5.06u7 + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 STM32F103RB STMicroelectronics - Keil.STM32F1xx_DFP.2.4.0 + Keil.STM32F1xx_DFP.2.3.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE @@ -669,7 +678,6 @@ 0 0 0 - 0 0 0 8 @@ -962,6 +970,16 @@ 1 ..\implementation\servo.c + + battery.c + 1 + ..\implementation\battery.c + + + girouette.c + 1 + ..\implementation\girouette.c + @@ -996,7 +1014,7 @@ RTE\Device\STM32F103RB\RTE_Device.h - + @@ -1005,7 +1023,7 @@ RTE\Device\STM32F103RB\startup_stm32f10x_md.s - + @@ -1014,7 +1032,7 @@ RTE\Device\STM32F103RB\system_stm32f10x.c - +