Commit 28327759b96b67aba709c50523ffce6d39de3072
1 parent
da8355be
--no commit message
Showing
2 changed files
with
28 additions
and
4 deletions
Project/applications/smartcities/adc.c
Project/applications/smartcities/include/adc.h
1 | + | ||
2 | +/**@file | ||
3 | + * @brief Declaration for the ADC functionality | ||
4 | + * @author Imanol Barba Sabariego | ||
5 | + * @date 07/06/2014 | ||
6 | + * | ||
7 | + * This is where all the methods previously declared in adc.h are defined. | ||
8 | + */ | ||
9 | + | ||
1 | #ifndef ADC_H | 10 | #ifndef ADC_H |
2 | #define ADC_H | 11 | #define ADC_H |
3 | 12 | ||
@@ -7,18 +16,29 @@ | @@ -7,18 +16,29 @@ | ||
7 | #include "stm32f10x_gpio.h" | 16 | #include "stm32f10x_gpio.h" |
8 | #include "stm32f10x_adc.h" | 17 | #include "stm32f10x_adc.h" |
9 | 18 | ||
19 | +//! Debug printing definition | ||
20 | +/*! This definition is used for debugging purposes, it is a shorthand for printing debug information */ | ||
10 | #define DBG_ADC(fmt,...) printf("%c[1;35madc.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__) | 21 | #define DBG_ADC(fmt,...) printf("%c[1;35madc.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__) |
11 | //#define DBG_ADC(fmt,...) printf("") | 22 | //#define DBG_ADC(fmt,...) printf("") |
12 | 23 | ||
24 | +//! Minimum battery ADC digital value | ||
13 | #define ADCbatt_MIN_VALUE (0) | 25 | #define ADCbatt_MIN_VALUE (0) |
26 | +//! Maximum battery ADC digital value | ||
14 | #define ADCbatt_MAX_VALUE (0xfff) | 27 | #define ADCbatt_MAX_VALUE (0xfff) |
28 | +//! Maximum battery ADC analog value | ||
15 | #define ADCbatt_VREF_PLUS (3300) | 29 | #define ADCbatt_VREF_PLUS (3300) |
30 | +//! Minimum battery ADC analog value | ||
16 | #define ADCbatt_VREF_MINUS (0) | 31 | #define ADCbatt_VREF_MINUS (0) |
17 | 32 | ||
33 | +//! Minimum sound ADC digital value | ||
18 | #define ADCsound_MIN_VALUE (0) | 34 | #define ADCsound_MIN_VALUE (0) |
19 | -#define ADCsound_MAX_VALUE (0xfff) /* 12-bit adc */ | ||
20 | -#define ADCsound_VREF_PLUS (2800) /* Vref+ is connected with Vdda (3.3v) */ | ||
21 | -#define ADCsound_VREF_MINUS (0) /* Vref- is connected with Vssa (0v) */ | 35 | +//! Maximum sound ADC digital value |
36 | +#define ADCsound_MAX_VALUE (0xfff) | ||
37 | +//! Maximum sound ADC analog value | ||
38 | +#define ADCsound_VREF_PLUS (3300) | ||
39 | +//! Minimum sound ADC analog value | ||
40 | +#define ADCsound_VREF_MINUS (0) | ||
41 | + | ||
22 | 42 | ||
23 | #define ADCbatt ADC1 | 43 | #define ADCbatt ADC1 |
24 | #define ADCbatt_RCC RCC_APB2Periph_ADC1 /* */ | 44 | #define ADCbatt_RCC RCC_APB2Periph_ADC1 /* */ |