merge from simon to master
This commit is contained in:
commit
1ea43525ce
4 changed files with 99 additions and 0 deletions
30
README.md
30
README.md
|
@ -0,0 +1,30 @@
|
|||
|
||||
|
||||
# **Tableau de répartition des services
|
||||
|
||||
| Service | Nom | Fonction |
|
||||
| ---- | :-:| :-:|
|
||||
|Girouette|Simon|Mesure de l'angle girouette.|
|
||||
|Module Xbee|Yohan|Communication a distance.|
|
||||
|IMU|Guilhem|Mesure de roulis, système anti-chavirement.|
|
||||
|RTC|Guilhem|Horloge temp réel.|
|
||||
|Mesure analogique|Yohan|Mesure de la tension de batterie.|
|
||||
|Servo moteur|Alix|Controle de l'écoute des voiles.|
|
||||
|Motoréducteur|Alix|Rotation du plateau.|
|
||||
|
||||
|
||||
# **Tableau de répartition des périphériques
|
||||
|
||||
| Service | Nom | Designation| Périphériques Timer| Channel Timer|Périphériques GPIOX|
|
||||
| ---- | :-:| :-:| :-:|:-:|:-:|
|
||||
|Girouette|Simon|NC|Timer-4 1MHz| 0 |PB6 PB7 PA0|
|
||||
|Module Xbee|Yohan|UART|NC| NC |PA9 PA10|
|
||||
|IMU|Guilhem|SPI|NC| NC |PA4 PA5 PB10 PB11|
|
||||
|RTC|Alix|I2C|NC| NC |PB12 PB13 PB14 PB15|
|
||||
|Mesure analogique|Yohan|NC|Timer-5 1Hz| 10 |PC0|
|
||||
|Servo moteur|Alix|PWM|Timer-2 50Hz | 2 |PA1|
|
||||
|Motoréducteur|Alix|NC|Timer-3 50KHz| 3 |PB0|
|
||||
|
||||
|
||||
|
||||
|
53
implementation/girouette.c
Normal file
53
implementation/girouette.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include "girouette.h"
|
||||
|
||||
void MyGirouette_Init(TIM_TypeDef *TIMX)
|
||||
{
|
||||
|
||||
//configuration gpiob6 et gpiob7 en entrées In_Floating imposer par le timer4
|
||||
MyGPIO_Struct_TypeDef MyGPIO={GPIOB,6,In_Floating};
|
||||
MyGPIO_Init(&MyGPIO);
|
||||
MyGPIO.GPIO_Pin=7;
|
||||
MyGPIO_Init(&MyGPIO);
|
||||
//config pa0 en entrées
|
||||
MyGPIO.GPIO_Pin=0;
|
||||
MyGPIO.GPIO=GPIOA;
|
||||
MyGPIO_Init(&MyGPIO);
|
||||
//configuration TIM4 reset a 360
|
||||
MyTimer_Struct_Typedef MyTimerGirouette ={TIMX,1439,0};
|
||||
MyTimer_Base_Init(&MyTimerGirouette);
|
||||
|
||||
TIMX->SMCR &=~0x07;
|
||||
TIMX->SMCR |=TIM_SMCR_SMS_1;
|
||||
TIMX->CCMR1 &=~(0xF2F2);
|
||||
TIMX->CCMR1 |= TIM_CCMR1_CC1S_0;
|
||||
TIMX->CCMR1 |= TIM_CCMR1_CC2S_0; //CC2S dans CCMR1 et pas CCMR2
|
||||
TIMX->CCER &=~TIM_CCER_CC1P;
|
||||
TIMX->CCER &=~TIM_CCER_CC2P;
|
||||
TIMX->CCMR1&=~(0x0F<<4); //IC1F
|
||||
TIMX->CCMR1&=~(0x0F<<12);//IC2F
|
||||
TIMX->CR1 |= 1;
|
||||
}
|
||||
|
||||
|
||||
int MyGirouette_Angle(TIM_TypeDef *TIMX)
|
||||
{
|
||||
return (TIMX->CNT)/4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MyGirouette_Init_IT_Z(uint8_t GPIO_Pin)
|
||||
{
|
||||
RCC->APB2ENR |=0x01;
|
||||
EXTI->IMR |= (0x01<<GPIO_Pin); // Autorisation de l'interruption de la ligne
|
||||
EXTI->RTSR|= (0x01<<GPIO_Pin); // Activation du déclenchement de l'interruption sur un front montant
|
||||
AFIO->EXTICR[0] &= ~(0x0000000F);// L'interruption « EXTI0 » doit être provoquée par une modification PA0
|
||||
NVIC->ISER[0] |= (1 << (6 & 0x1F)); // Autorisation de l'interruption « EXTI0 » NUMERO 6,
|
||||
|
||||
}
|
||||
|
||||
void EXTI0_IRQHandler(void) {
|
||||
TIM4->CNT=0;
|
||||
EXTI->PR|=0x01;
|
||||
}
|
||||
|
10
implementation/girouette.h
Normal file
10
implementation/girouette.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef MYMOTOR_H
|
||||
#define MYMOTOR_H
|
||||
#include "stm32f10x.h"
|
||||
#include "../driver/gpio.h"
|
||||
#include "../driver/timer.h"
|
||||
|
||||
int MyGirouette_Angle(TIM_TypeDef *TIMX);
|
||||
void MyGirouette_Init(TIM_TypeDef *TIMX);
|
||||
|
||||
#endif
|
|
@ -6,10 +6,12 @@
|
|||
#include "remote.h"
|
||||
#include "accelerometer.h"
|
||||
#include "battery.h"
|
||||
#include "timer.h"
|
||||
|
||||
void initImplementation(void);
|
||||
|
||||
float GX, GY, GZ;
|
||||
int Angle_Girouette=0;
|
||||
int main (void)
|
||||
{
|
||||
|
||||
|
@ -22,6 +24,7 @@ int main (void)
|
|||
Lecture_accelerometre(&GX,&GY,&GZ);
|
||||
if(GZ < 5.5)
|
||||
MyServo_ChangeAngle(179);
|
||||
Angle_Girouette=MyGirouette_Angle(TIM4);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -31,6 +34,8 @@ void initImplementation(void)
|
|||
MyServo_ChangeAngle(179);
|
||||
initRemote();
|
||||
Init_accelerometre();
|
||||
MyGirouette_Init(TIM4);
|
||||
MyGirouette_Init_IT_Z(0);
|
||||
testRemote();
|
||||
MyMotor_Init();
|
||||
MyMotor_ChangeSpeed(0);
|
||||
|
@ -38,3 +43,4 @@ void initImplementation(void)
|
|||
MyRTC_Init();
|
||||
initBattery();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue