Compare commits

...

1 commit

Author SHA1 Message Date
6aa420d19e Initial commit 2020-11-10 19:06:18 +01:00
8 changed files with 0 additions and 93 deletions

View file

@ -1,11 +0,0 @@
#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges
#include "stm32f1xx_ll_tim.h"
#include "stm32f1xx_ll_adc.h"
void init(){
LL_ADC
}
int get_value(){
}

View file

@ -1,6 +0,0 @@
void init(){
}
get_value(){
}

View file

@ -1,4 +0,0 @@
void init(void) {
}
send

View file

@ -1,54 +0,0 @@
#include "stm32f1xx_ll_adc.h"
#include "stm32f1xx_ll_bus.h"
#include "stm32f1xx_ll_rcc.h"
#include "math.h"
void accelero_init(void){
RCC -> CFGR |= (0x1<<15);
RCC-> CFGR &= ~ (0x1<<14);
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1);
LL_ADC_REG_InitTypeDef adc;
adc.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE ;
adc.SequencerLength = LL_ADC_REG_SEQ_SCAN_DISABLE;
adc.SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_1RANK;
adc.ContinuousMode = LL_ADC_REG_CONV_SINGLE;
adc.DMATransfer = LL_ADC_REG_DMA_TRANSFER_NONE;
LL_ADC_REG_Init(ADC1, &adc);
LL_ADC_Enable(ADC1);
}
int accelero_roulis(void){
int x=0;
int y=0;
int angle;
LL_ADC_SetAnalogWDMonitChannels(ADC1, LL_ADC_AWD_CHANNEL_10_REG);
LL_ADC_REG_StartConversionSWStart(ADC1);
while (LL_ADC_IsActiveFlag_EOS(ADC1) != 1){
//__asm__"nope";
}
x = LL_ADC_REG_ReadConversionData32(ADC1);
LL_ADC_SetAnalogWDMonitChannels(ADC1, LL_ADC_AWD_CHANNEL_11_REG);
while (LL_ADC_IsActiveFlag_EOS(ADC1) != 1){
//__asm__"nope";
}
y = LL_ADC_REG_ReadConversionData32(ADC1);
angle = atan(x/y);
if (angle>40.0) {
return 1;
}else {
return 0;
}
//le flag EOC n'est jamais mis à un ....
// Soit la conversion est mal faite soit on n'utilise pas bien la simulation
//soit on n'utilise pas bien isActiveFlag dans la boucle
}

View file

@ -1,18 +0,0 @@
// RIEN A MODIFIER //
#ifndef ACCELERO_H
#define ACCELERO_H
#include "stm32f103xb.h"
/* =====================================================================================
Les fonctions qui gèrent les IO (ajout par rapport à l'activité 1)
=======================================================================================*/
void accelero_init(void);
int accelero_roulis(void);
#endif