Commit 28327759b96b67aba709c50523ffce6d39de3072

Authored by Imanol-Mikel Barba Sabariego
1 parent da8355be

--no commit message

Project/applications/smartcities/adc.c
1 1 /**@file
2   - * @brief THE GAME
  2 + * @brief Definitions for the ADC functionality
  3 + * @author Imanol Barba Sabariego
  4 + * @date 07/06/2014
  5 + *
  6 + * This is where all the methods previously declared in adc.h are defined.
3 7 */
4 8  
5 9 #include "adc.h"
... ...
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 10 #ifndef ADC_H
2 11 #define ADC_H
3 12  
... ... @@ -7,18 +16,29 @@
7 16 #include "stm32f10x_gpio.h"
8 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 21 #define DBG_ADC(fmt,...) printf("%c[1;35madc.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__)
11 22 //#define DBG_ADC(fmt,...) printf("")
12 23  
  24 +//! Minimum battery ADC digital value
13 25 #define ADCbatt_MIN_VALUE (0)
  26 +//! Maximum battery ADC digital value
14 27 #define ADCbatt_MAX_VALUE (0xfff)
  28 +//! Maximum battery ADC analog value
15 29 #define ADCbatt_VREF_PLUS (3300)
  30 +//! Minimum battery ADC analog value
16 31 #define ADCbatt_VREF_MINUS (0)
17 32  
  33 +//! Minimum sound ADC digital value
18 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 43 #define ADCbatt ADC1
24 44 #define ADCbatt_RCC RCC_APB2Periph_ADC1 /* */
... ...