diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-10-18 12:23:31 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-10-18 12:23:31 +0000 |
commit | be302132c782b951b6f81f2833b642a514a70dad (patch) | |
tree | 386f7f8c8677f5110c1aa2edd36c65623df60cdc /testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm_adc.c | |
parent | 7c0786cae15cf93e09604abcc66c6d017c4238bd (diff) | |
download | ChibiOS-be302132c782b951b6f81f2833b642a514a70dad.tar.gz ChibiOS-be302132c782b951b6f81f2833b642a514a70dad.tar.bz2 ChibiOS-be302132c782b951b6f81f2833b642a514a70dad.zip |
FSMC. Files moved to
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7414 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm_adc.c')
-rw-r--r-- | testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm_adc.c | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm_adc.c b/testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm_adc.c deleted file mode 100644 index 4e37b757c..000000000 --- a/testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm_adc.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2014 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -/* - Concepts and parts of this file have been contributed by Uladzimir Pylinsky - aka barthess. - */ - -#include "ch.h" -#include "hal.h" - -#define ADC_NUM_CHANNELS 6 -#define ADC_BUF_DEPTH 8 - -/* human readable names */ -#define ADC_CURRENT_SENS ADC_CHANNEL_IN10 -#define ADC_MAIN_SUPPLY ADC_CHANNEL_IN11 -#define ADC_6V_SUPPLY ADC_CHANNEL_IN12 -#define ADC_AN33_0 ADC_CHANNEL_IN13 -#define ADC_AN33_1 ADC_CHANNEL_IN14 -#define ADC_AN33_2 ADC_CHANNEL_IN15 - -#define ADC_CURRENT_SENS_OFFSET (ADC_CHANNEL_IN10 - 10) -#define ADC_MAIN_VOLTAGE_OFFSET (ADC_CHANNEL_IN11 - 10) -#define ADC_6V_OFFSET (ADC_CHANNEL_IN12 - 10) -#define ADC_AN33_0_OFFSET (ADC_CHANNEL_IN13 - 10) -#define ADC_AN33_1_OFFSET (ADC_CHANNEL_IN14 - 10) -#define ADC_AN33_2_OFFSET (ADC_CHANNEL_IN15 - 10) - -static void adcerrorcallback(ADCDriver *adcp, adcerror_t err); -static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n); - -static adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH]; - -static uint32_t ints = 0; -static uint32_t errors = 0; - -static const ADCConversionGroup adccg = { - TRUE, - ADC_NUM_CHANNELS, - adccallback, - adcerrorcallback, - 0, /* CR1 */ - ADC_CR2_SWSTART, /* CR2 */ - ADC_SMPR1_SMP_AN10(ADC_SAMPLE_3) | - ADC_SMPR1_SMP_AN11(ADC_SAMPLE_3) | - ADC_SMPR1_SMP_AN12(ADC_SAMPLE_3) | - ADC_SMPR1_SMP_AN13(ADC_SAMPLE_3) | - ADC_SMPR1_SMP_AN14(ADC_SAMPLE_3) | - ADC_SMPR1_SMP_AN15(ADC_SAMPLE_3), - 0, /* SMPR2 */ - ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS), - 0, - ADC_SQR3_SQ6_N(ADC_AN33_2) | - ADC_SQR3_SQ5_N(ADC_AN33_1) | - ADC_SQR3_SQ4_N(ADC_AN33_0) | - ADC_SQR3_SQ3_N(ADC_6V_SUPPLY) | - ADC_SQR3_SQ2_N(ADC_MAIN_SUPPLY) | - ADC_SQR3_SQ1_N(ADC_CURRENT_SENS) -}; - -static void adcerrorcallback(ADCDriver *adcp, adcerror_t err) { - (void)adcp; - (void)err; - - osalSysHalt(""); -} - -static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n) { - (void)adcp; - (void)buffer; - (void)n; - ints++; -} - -/* - * - */ -void dma_storm_adc_start(void){ - ints = 0; - errors = 0; - - /* Activates the ADC1 driver and the temperature sensor.*/ - adcStart(&ADCD1, NULL); - adcSTM32EnableTSVREFE(); - - /* Starts an ADC continuous conversion.*/ - adcStartConversion(&ADCD1, &adccg, samples, ADC_BUF_DEPTH); -} - -/* - * - */ -uint32_t dma_storm_adc_stop(void){ - adcStopConversion(&ADCD1); - adcSTM32DisableTSVREFE(); - adcStop(&ADCD1); - return ints; -} - |