diff options
author | Michael Hope <michael.hope@linaro.org> | 2010-09-29 20:45:57 +1300 |
---|---|---|
committer | Michael Hope <michael.hope@linaro.org> | 2010-09-29 20:45:57 +1300 |
commit | 6fcd4cd306dbecf56f5b0b506a3c23762d1219fa (patch) | |
tree | 467125eca5a2e6706001cad8e09bc475e58a12d9 /libmaple/adc.c | |
parent | 368e4fc1662c2594b2a0908900713a2555a3ed8e (diff) | |
parent | adde11b099ff5dad176e410279d21feac39d2c7e (diff) | |
download | librambutan-6fcd4cd306dbecf56f5b0b506a3c23762d1219fa.tar.gz librambutan-6fcd4cd306dbecf56f5b0b506a3c23762d1219fa.zip |
Merge remote branch 'upstream/master'
Diffstat (limited to 'libmaple/adc.c')
-rw-r--r-- | libmaple/adc.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libmaple/adc.c b/libmaple/adc.c index 021758c..9b21b49 100644 --- a/libmaple/adc.c +++ b/libmaple/adc.c @@ -1,4 +1,4 @@ -/* ***************************************************************************** +/****************************************************************************** * The MIT License * * Copyright (c) 2010 Perry Hung. @@ -20,12 +20,12 @@ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. - * ****************************************************************************/ + *****************************************************************************/ /** - * @file adc.c + * @file adc.c * - * @brief Analog to digital converter routines + * @brief Analog to digital converter routines */ #include "libmaple.h" @@ -63,23 +63,25 @@ * At 55.5 cycles/sample, the external input impedance < 50kOhms*/ void adc_init(void) { - rcc_set_prescaler(RCC_PRESCALER_ADC, RCC_ADCPRE_PCLK_DIV_6); - rcc_clk_enable(RCC_ADC1); - rcc_reset_dev(RCC_ADC1); + rcc_set_prescaler(RCC_PRESCALER_ADC, RCC_ADCPRE_PCLK_DIV_6); + rcc_clk_enable(RCC_ADC1); + rcc_reset_dev(RCC_ADC1); ADC_CR1 = 0; - ADC_CR2 = CR2_EXTSEL_SWSTART | CR2_EXTTRIG; // Software triggers conversions + /* Software triggers conversions */ + ADC_CR2 = CR2_EXTSEL_SWSTART | CR2_EXTTRIG; ADC_SQR1 = 0; - /* Up the sample conversion time to 55.5 cycles/sec, see note above */ - /* TODO: fix magic numbers */ + /* Up the sample conversion time to 55.5 cycles/sec, see note + above */ + /* TODO: fix magic numbers */ ADC_SMPR1 = 0xB6DB6D; ADC_SMPR2 = 0x2DB6DB6D; - /* Enable the ADC */ + /* Enable the ADC */ CR2_ADON_BIT = 1; - /* Reset the calibration registers and then perform a reset */ + /* Reset the calibration registers and then perform a reset */ CR2_RSTCAL_BIT = 1; while(CR2_RSTCAL_BIT) ; |