Added Simon part, trying to correct some bugs on battery given by all the while loop
This commit is contained in:
parent
1ea43525ce
commit
8cfcdf0385
7 changed files with 64 additions and 16 deletions
|
@ -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 <20> ce dernier.
|
ADCStructPtr->ADC->SQR3 |= ADCStructPtr->channel; //Sequence Reader, seulement le SQ1 est lu dans notre cas, nous associons un channel <20> ce dernier.
|
||||||
ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTTRIG; //Activation du trigger externe
|
ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTTRIG; //Activation du trigger externe
|
||||||
ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTSEL; //Event externe choisie : SWSTART
|
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
|
ADCStructPtr->ADC->CR2 |= ADC_CR2_ADON; //Init l'ADC
|
||||||
MyADC_Base_Start(ADCStructPtr->ADC); //Debut du premier ADC
|
MyADC_Base_Start(ADCStructPtr->ADC); //Debut du premier ADC
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr){
|
||||||
}
|
}
|
||||||
//TxD Enable, RxD Enable, USART Global Enable
|
//TxD Enable, RxD Enable, USART Global Enable
|
||||||
UARTStructPtr->UART->CR1 |= (USART_CR1_TE | USART_CR1_RE);
|
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)
|
void MyUART_InitGPIO(MyUART_Struct_Typedef * UARTStructPtr)
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#include "battery.h"
|
#include "battery.h"
|
||||||
|
|
||||||
extern MyUART_Struct_Typedef uartCool;
|
extern MyUART_Struct_Typedef uartCool;
|
||||||
int actualMinutes =-1;
|
extern int actualMinutes;
|
||||||
uint32_t oldAdc =0;
|
extern uint32_t oldAdc;
|
||||||
|
|
||||||
void battery(uint32_t data)
|
void battery(uint32_t data)
|
||||||
{
|
{
|
||||||
MyRTC_Struct_TypeDef rtcBattery;
|
MyRTC_Struct_TypeDef rtcBattery;
|
||||||
MyRTC_GetTime(&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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#ifndef MYMOTOR_H
|
#ifndef MYGIROUETTE_H
|
||||||
#define MYMOTOR_H
|
#define MYGIROUETTE_H
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
#include "../driver/gpio.h"
|
#include "../driver/gpio.h"
|
||||||
#include "../driver/timer.h"
|
#include "../driver/timer.h"
|
||||||
|
|
||||||
int MyGirouette_Angle(TIM_TypeDef *TIMX);
|
int MyGirouette_Angle(TIM_TypeDef *TIMX);
|
||||||
void MyGirouette_Init(TIM_TypeDef *TIMX);
|
void MyGirouette_Init(TIM_TypeDef *TIMX);
|
||||||
|
void MyGirouette_Init_IT_Z(uint8_t GPIO_Pin);
|
||||||
|
void EXTI0_IRQHandler(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,11 +7,15 @@
|
||||||
#include "accelerometer.h"
|
#include "accelerometer.h"
|
||||||
#include "battery.h"
|
#include "battery.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
#include "girouette.h"
|
||||||
|
|
||||||
void initImplementation(void);
|
void initImplementation(void);
|
||||||
|
|
||||||
float GX, GY, GZ;
|
float GX, GY, GZ;
|
||||||
int Angle_Girouette=0;
|
int Angle_Girouette=0;
|
||||||
|
int actualMinutes=-1;
|
||||||
|
uint32_t oldAdc=0;
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>MesDrivers</GroupName>
|
<GroupName>MesDrivers</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>
|
||||||
|
@ -631,6 +631,30 @@
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
<bShared>0</bShared>
|
<bShared>0</bShared>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>3</GroupNumber>
|
||||||
|
<FileNumber>18</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>0</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\implementation\battery.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>battery.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<GroupNumber>3</GroupNumber>
|
||||||
|
<FileNumber>19</FileNumber>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<tvExp>1</tvExp>
|
||||||
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
|
<bDave2>0</bDave2>
|
||||||
|
<PathWithFileName>..\implementation\girouette.c</PathWithFileName>
|
||||||
|
<FilenameWithoutPath>girouette.c</FilenameWithoutPath>
|
||||||
|
<RteFlg>0</RteFlg>
|
||||||
|
<bShared>0</bShared>
|
||||||
|
</File>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
<Device>STM32F103RB</Device>
|
<Device>STM32F103RB</Device>
|
||||||
<Vendor>STMicroelectronics</Vendor>
|
<Vendor>STMicroelectronics</Vendor>
|
||||||
<PackID>Keil.STM32F1xx_DFP.2.4.0</PackID>
|
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
|
||||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||||
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||||
<FlashUtilSpec></FlashUtilSpec>
|
<FlashUtilSpec></FlashUtilSpec>
|
||||||
|
@ -186,7 +186,6 @@
|
||||||
<RvdsVP>0</RvdsVP>
|
<RvdsVP>0</RvdsVP>
|
||||||
<RvdsMve>0</RvdsMve>
|
<RvdsMve>0</RvdsMve>
|
||||||
<RvdsCdeCp>0</RvdsCdeCp>
|
<RvdsCdeCp>0</RvdsCdeCp>
|
||||||
<nBranchProt>0</nBranchProt>
|
|
||||||
<hadIRAM2>0</hadIRAM2>
|
<hadIRAM2>0</hadIRAM2>
|
||||||
<hadIROM2>0</hadIROM2>
|
<hadIROM2>0</hadIROM2>
|
||||||
<StupSel>8</StupSel>
|
<StupSel>8</StupSel>
|
||||||
|
@ -479,6 +478,16 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\implementation\servo.c</FilePath>
|
<FilePath>..\implementation\servo.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>battery.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\implementation\battery.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>girouette.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\implementation\girouette.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -493,13 +502,13 @@
|
||||||
<TargetName>Réel</TargetName>
|
<TargetName>Réel</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARM_Compiler_5.06u7</pCCUsed>
|
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||||
<uAC6>0</uAC6>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
<Device>STM32F103RB</Device>
|
<Device>STM32F103RB</Device>
|
||||||
<Vendor>STMicroelectronics</Vendor>
|
<Vendor>STMicroelectronics</Vendor>
|
||||||
<PackID>Keil.STM32F1xx_DFP.2.4.0</PackID>
|
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
|
||||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||||
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00020000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||||
<FlashUtilSpec></FlashUtilSpec>
|
<FlashUtilSpec></FlashUtilSpec>
|
||||||
|
@ -669,7 +678,6 @@
|
||||||
<RvdsVP>0</RvdsVP>
|
<RvdsVP>0</RvdsVP>
|
||||||
<RvdsMve>0</RvdsMve>
|
<RvdsMve>0</RvdsMve>
|
||||||
<RvdsCdeCp>0</RvdsCdeCp>
|
<RvdsCdeCp>0</RvdsCdeCp>
|
||||||
<nBranchProt>0</nBranchProt>
|
|
||||||
<hadIRAM2>0</hadIRAM2>
|
<hadIRAM2>0</hadIRAM2>
|
||||||
<hadIROM2>0</hadIROM2>
|
<hadIROM2>0</hadIROM2>
|
||||||
<StupSel>8</StupSel>
|
<StupSel>8</StupSel>
|
||||||
|
@ -962,6 +970,16 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\implementation\servo.c</FilePath>
|
<FilePath>..\implementation\servo.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>battery.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\implementation\battery.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>girouette.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\implementation\girouette.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -996,7 +1014,7 @@
|
||||||
<file attr="config" category="header" name="RTE_Driver\Config\RTE_Device.h" version="1.1.2">
|
<file attr="config" category="header" name="RTE_Driver\Config\RTE_Device.h" version="1.1.2">
|
||||||
<instance index="0">RTE\Device\STM32F103RB\RTE_Device.h</instance>
|
<instance index="0">RTE\Device\STM32F103RB\RTE_Device.h</instance>
|
||||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||||
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
|
@ -1005,7 +1023,7 @@
|
||||||
<file attr="config" category="source" condition="STM32F1xx MD ARMCC" name="Device\Source\ARM\startup_stm32f10x_md.s" version="1.0.1">
|
<file attr="config" category="source" condition="STM32F1xx MD ARMCC" name="Device\Source\ARM\startup_stm32f10x_md.s" version="1.0.1">
|
||||||
<instance index="0">RTE\Device\STM32F103RB\startup_stm32f10x_md.s</instance>
|
<instance index="0">RTE\Device\STM32F103RB\startup_stm32f10x_md.s</instance>
|
||||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||||
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
|
@ -1014,7 +1032,7 @@
|
||||||
<file attr="config" category="source" name="Device\Source\system_stm32f10x.c" version="1.0.1">
|
<file attr="config" category="source" name="Device\Source\system_stm32f10x.c" version="1.0.1">
|
||||||
<instance index="0">RTE\Device\STM32F103RB\system_stm32f10x.c</instance>
|
<instance index="0">RTE\Device\STM32F103RB\system_stm32f10x.c</instance>
|
||||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="1.0.0" condition="STM32F1xx CMSIS"/>
|
||||||
<package name="STM32F1xx_DFP" schemaVersion="1.7.2" url="http://www.keil.com/pack/" vendor="Keil" version="2.4.0"/>
|
<package name="STM32F1xx_DFP" schemaVersion="1.4.0" url="http://www.keil.com/pack/" vendor="Keil" version="2.3.0"/>
|
||||||
<targetInfos>
|
<targetInfos>
|
||||||
<targetInfo name="Réel"/>
|
<targetInfo name="Réel"/>
|
||||||
<targetInfo name="Simulé"/>
|
<targetInfo name="Simulé"/>
|
||||||
|
|
Loading…
Reference in a new issue