diff --git a/keil_project/Services/Battery_status.c b/keil_project/Services/Battery_status.c deleted file mode 100644 index f996cfa..0000000 --- a/keil_project/Services/Battery_status.c +++ /dev/null @@ -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(){ - -} \ No newline at end of file diff --git a/keil_project/Services/accelerometer.c b/keil_project/Services/accelerometer.c deleted file mode 100644 index 8923426..0000000 --- a/keil_project/Services/accelerometer.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "accelerometer.h" -int x; -int y; -double angle; - -void accelero_init(void){ - RCC -> CFGR |= (0x1<<15); - RCC-> CFGR &= ~ (0x1<<14); - LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1); - LL_APB1_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC); - - LL_GPIO_InitTypeDef pc0, pc1; - LL_ADC_InitTypeDef adc; - LL_ADC_REG_InitTypeDef adcReg; - - pc0.Pin = LL_GPIO_PIN_0; - pc0.Mode = LL_GPIO_MODE_ANALOG; - pc1.Pin = LL_GPIO_PIN_1; - pc1.Mode = LL_GPIO_MODE_ANALOG; - - - adc.DataAlignment = LL_ADC_DATA_ALIGN_LEFT; - adc.SequencersScanMode = LL_ADC_SEQ_SCAN_DISABLE; - LL_ADC_Init(ADC1, &adc); - - adcReg.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE ; - adcReg.SequencerLength = LL_ADC_REG_SEQ_SCAN_DISABLE; - adcReg.SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE; - adcReg.ContinuousMode = LL_ADC_REG_CONV_SINGLE; - adcReg.DMATransfer = LL_ADC_REG_DMA_TRANSFER_NONE; - - - LL_ADC_REG_Init(ADC1, &adcReg); - - LL_ADC_SetChannelSamplingTime(ADC2, LL_ADC_CHANNEL_10, LL_ADC_SAMPLINGTIME_1CYCLE_5); - LL_ADC_SetChannelSamplingTime(ADC2, LL_ADC_CHANNEL_11, LL_ADC_SAMPLINGTIME_1CYCLE_5); - - - LL_ADC_Enable(ADC1); - - //LL_ADC_EnableIT_EOS(ADC1); - //wait 0,2 µs, calibration is advised - //LL_ADC_StartCalibration(ADC1); -} - - -int accelero_get_x(void){ - LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_1, LL_ADC_CHANNEL_10); - LL_ADC_REG_StartConversionSWStart(ADC1); - while (LL_ADC_IsActiveFlag_EOS(ADC1) != 1){ - //__asm__"nope"; - } - int x= LL_ADC_REG_ReadConversionData12(ADC1); - return x; -} - -int accelero_get_y(void){ - LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_1, LL_ADC_CHANNEL_11); - LL_ADC_REG_StartConversionSWStart(ADC1); - while (LL_ADC_IsActiveFlag_EOS(ADC1) != 1){ - //__asm__"nope"; - } - int y = LL_ADC_REG_ReadConversionData12(ADC1); - return y; -} - - -int accelero_angle_bon(void){ - x = accelero_get_x(); - y = accelero_get_y(); - angle = ((double) x)/((double) y); - - if (angle>0.84){ - return 0; - }else { - return 1; - } - - //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 -} - -int get_battery_level(void){ - LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_1, LL_ADC_CHANNEL_12); - LL_ADC_REG_StartConversionSWStart(ADC1); - int battery_level = LL_ADC_REG_ReadConversionData12(ADC1); - return battery_level; -} \ No newline at end of file diff --git a/keil_project/Services/accelerometer.h b/keil_project/Services/accelerometer.h deleted file mode 100644 index 4780684..0000000 --- a/keil_project/Services/accelerometer.h +++ /dev/null @@ -1,30 +0,0 @@ -// RIEN A MODIFIER // - -#ifndef ACCELERO_H -#define ACCELERO_H - - - -#include "stm32f103xb.h" -#include "stm32f1xx_ll_adc.h" -#include "stm32f1xx_ll_bus.h" -#include "stm32f1xx_ll_rcc.h" -#include "stm32f1xx_ll_gpio.h" -#include "math.h" - -/* ===================================================================================== -Les fonctions qui gèrent les IO (ajout par rapport à l'activité 1) -=======================================================================================*/ - -void accelero_init(void); - -int accelero_get_x(void); - -int accelero_get_y(void); - -int accelero_angle_bon(void); - -int get_battery_level(void); - - -#endif diff --git a/keil_project/Services/accelerometre.c b/keil_project/Services/accelerometre.c deleted file mode 100644 index e69de29..0000000