git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1320 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
ed930d3c0f
commit
6150f3b4a3
|
@ -121,7 +121,7 @@ void adcStop(ADCDriver *adcp) {
|
||||||
* with no gaps.
|
* with no gaps.
|
||||||
*/
|
*/
|
||||||
bool_t adcStartConversion(ADCDriver *adcp,
|
bool_t adcStartConversion(ADCDriver *adcp,
|
||||||
ADCConversionGroup *grpp,
|
const ADCConversionGroup *grpp,
|
||||||
adcsample_t *samples,
|
adcsample_t *samples,
|
||||||
size_t depth,
|
size_t depth,
|
||||||
adccallback_t callback) {
|
adccallback_t callback) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ extern "C" {
|
||||||
void adcStart(ADCDriver *adcp, const ADCConfig *config);
|
void adcStart(ADCDriver *adcp, const ADCConfig *config);
|
||||||
void adcStop(ADCDriver *adcp);
|
void adcStop(ADCDriver *adcp);
|
||||||
bool_t adcStartConversion(ADCDriver *adcp,
|
bool_t adcStartConversion(ADCDriver *adcp,
|
||||||
ADCConversionGroup *grpp,
|
const ADCConversionGroup *grpp,
|
||||||
adcsample_t *samples,
|
adcsample_t *samples,
|
||||||
size_t depth,
|
size_t depth,
|
||||||
adccallback_t callback);
|
adccallback_t callback);
|
||||||
|
|
|
@ -190,7 +190,7 @@ void adc_lld_stop(ADCDriver *adcp) {
|
||||||
*/
|
*/
|
||||||
void adc_lld_start_conversion(ADCDriver *adcp) {
|
void adc_lld_start_conversion(ADCDriver *adcp) {
|
||||||
uint32_t ccr, n;
|
uint32_t ccr, n;
|
||||||
ADCConversionGroup *grpp = adcp->ad_grpp;
|
const ADCConversionGroup *grpp = adcp->ad_grpp;
|
||||||
|
|
||||||
/* DMA setup.*/
|
/* DMA setup.*/
|
||||||
adcp->ad_dma->CMAR = (uint32_t)adcp->ad_samples;
|
adcp->ad_dma->CMAR = (uint32_t)adcp->ad_samples;
|
||||||
|
|
|
@ -144,45 +144,45 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* @brief Enables the circular buffer mode for the group.
|
* @brief Enables the circular buffer mode for the group.
|
||||||
*/
|
*/
|
||||||
bool_t acg_circular;
|
bool_t acg_circular;
|
||||||
/**
|
/**
|
||||||
* @brief Number of the analog channels belonging to the conversion group.
|
* @brief Number of the analog channels belonging to the conversion group.
|
||||||
*/
|
*/
|
||||||
adc_channels_num_t acg_num_channels;
|
adc_channels_num_t acg_num_channels;
|
||||||
/* End of the mandatory fields.*/
|
/* End of the mandatory fields.*/
|
||||||
/**
|
/**
|
||||||
* @brief ADC CR1 register initialization data.
|
* @brief ADC CR1 register initialization data.
|
||||||
* @note All the required bits must be defined into this field except
|
* @note All the required bits must be defined into this field except
|
||||||
* @p ADC_CR1_SCAN that is enforced inside the driver.
|
* @p ADC_CR1_SCAN that is enforced inside the driver.
|
||||||
*/
|
*/
|
||||||
uint32_t acg_cr1;
|
uint32_t acg_cr1;
|
||||||
/**
|
/**
|
||||||
* @brief ADC CR2 register initialization data.
|
* @brief ADC CR2 register initialization data.
|
||||||
* @note All the required bits must be defined into this field except
|
* @note All the required bits must be defined into this field except
|
||||||
* @p ADC_CR2_DMA and @p ADC_CR2_ADON that are enforced inside the
|
* @p ADC_CR2_DMA and @p ADC_CR2_ADON that are enforced inside the
|
||||||
* driver.
|
* driver.
|
||||||
*/
|
*/
|
||||||
uint32_t acg_cr2;
|
uint32_t acg_cr2;
|
||||||
/**
|
/**
|
||||||
* @brief ADC SMPR1 register initialization data.
|
* @brief ADC SMPR1 register initialization data.
|
||||||
*/
|
*/
|
||||||
uint32_t acg_smpr1;
|
uint32_t acg_smpr1;
|
||||||
/**
|
/**
|
||||||
* @brief ADC SMPR2 register initialization data.
|
* @brief ADC SMPR2 register initialization data.
|
||||||
*/
|
*/
|
||||||
uint32_t acg_smpr2;
|
uint32_t acg_smpr2;
|
||||||
/**
|
/**
|
||||||
* @brief ADC SQR1 register initialization data.
|
* @brief ADC SQR1 register initialization data.
|
||||||
*/
|
*/
|
||||||
uint32_t acg_sqr1;
|
uint32_t acg_sqr1;
|
||||||
/**
|
/**
|
||||||
* @brief ADC SQR2 register initialization data.
|
* @brief ADC SQR2 register initialization data.
|
||||||
*/
|
*/
|
||||||
uint32_t acg_sqr2;
|
uint32_t acg_sqr2;
|
||||||
/**
|
/**
|
||||||
* @brief ADC SQR3 register initialization data.
|
* @brief ADC SQR3 register initialization data.
|
||||||
*/
|
*/
|
||||||
uint32_t acg_sqr3;
|
uint32_t acg_sqr3;
|
||||||
} ADCConversionGroup;
|
} ADCConversionGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,44 +206,44 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* @brief Driver state.
|
* @brief Driver state.
|
||||||
*/
|
*/
|
||||||
adcstate_t ad_state;
|
adcstate_t ad_state;
|
||||||
/**
|
/**
|
||||||
* @brief Current configuration data.
|
* @brief Current configuration data.
|
||||||
*/
|
*/
|
||||||
const ADCConfig *ad_config;
|
const ADCConfig *ad_config;
|
||||||
/**
|
/**
|
||||||
* @brief Synchronization semaphore.
|
* @brief Synchronization semaphore.
|
||||||
*/
|
*/
|
||||||
Semaphore ad_sem;
|
Semaphore ad_sem;
|
||||||
/**
|
/**
|
||||||
* @brief Current callback function or @p NULL.
|
* @brief Current callback function or @p NULL.
|
||||||
*/
|
*/
|
||||||
adccallback_t ad_callback;
|
adccallback_t ad_callback;
|
||||||
/**
|
/**
|
||||||
* @brief Current samples buffer pointer or @p NULL.
|
* @brief Current samples buffer pointer or @p NULL.
|
||||||
*/
|
*/
|
||||||
adcsample_t *ad_samples;
|
adcsample_t *ad_samples;
|
||||||
/**
|
/**
|
||||||
* @brief Current samples buffer depth or @p 0.
|
* @brief Current samples buffer depth or @p 0.
|
||||||
*/
|
*/
|
||||||
size_t ad_depth;
|
size_t ad_depth;
|
||||||
/**
|
/**
|
||||||
* @brief Current conversion group pointer or @p NULL.
|
* @brief Current conversion group pointer or @p NULL.
|
||||||
*/
|
*/
|
||||||
ADCConversionGroup *ad_grpp;
|
const ADCConversionGroup *ad_grpp;
|
||||||
/* End of the mandatory fields.*/
|
/* End of the mandatory fields.*/
|
||||||
/**
|
/**
|
||||||
* @brief Pointer to the ADCx registers block.
|
* @brief Pointer to the ADCx registers block.
|
||||||
*/
|
*/
|
||||||
ADC_TypeDef *ad_adc;
|
ADC_TypeDef *ad_adc;
|
||||||
/**
|
/**
|
||||||
* @brief Pointer to the DMA channel registers block.
|
* @brief Pointer to the DMA channel registers block.
|
||||||
*/
|
*/
|
||||||
DMA_Channel_TypeDef *ad_dma;
|
DMA_Channel_TypeDef *ad_dma;
|
||||||
/**
|
/**
|
||||||
* @brief DMA priority bit mask.
|
* @brief DMA priority bit mask.
|
||||||
*/
|
*/
|
||||||
uint32_t ad_dmaprio;
|
uint32_t ad_dmaprio;
|
||||||
} ADCDriver;
|
} ADCDriver;
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
@ -29,15 +29,15 @@
|
||||||
#include <stm32_dma.h>
|
#include <stm32_dma.h>
|
||||||
#include <nvic.h>
|
#include <nvic.h>
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver exported variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if USE_STM32_SPI1 || defined(__DOXYGEN__)
|
#if USE_STM32_SPI1 || defined(__DOXYGEN__)
|
||||||
/** @brief SPI1 driver identifier.*/
|
/** @brief SPI1 driver identifier.*/
|
||||||
SPIDriver SPID1;
|
SPIDriver SPID1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*/
|
|
||||||
/* Low Level Driver exported variables. */
|
|
||||||
/*===========================================================================*/
|
|
||||||
|
|
||||||
#if USE_STM32_SPI2 || defined(__DOXYGEN__)
|
#if USE_STM32_SPI2 || defined(__DOXYGEN__)
|
||||||
/** @brief SPI2 driver identifier.*/
|
/** @brief SPI2 driver identifier.*/
|
||||||
SPIDriver SPID2;
|
SPIDriver SPID2;
|
||||||
|
|
|
@ -65,11 +65,11 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* @brief Enables the circular buffer mode for the group.
|
* @brief Enables the circular buffer mode for the group.
|
||||||
*/
|
*/
|
||||||
bool_t acg_circular;
|
bool_t acg_circular;
|
||||||
/**
|
/**
|
||||||
* @brief Number of the analog channels belonging to the conversion group.
|
* @brief Number of the analog channels belonging to the conversion group.
|
||||||
*/
|
*/
|
||||||
adc_channels_num_t acg_num_channels;
|
adc_channels_num_t acg_num_channels;
|
||||||
/* End of the mandatory fields.*/
|
/* End of the mandatory fields.*/
|
||||||
} ADCConversionGroup;
|
} ADCConversionGroup;
|
||||||
|
|
||||||
|
@ -88,31 +88,31 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* @brief Driver state.
|
* @brief Driver state.
|
||||||
*/
|
*/
|
||||||
adcstate_t ad_state;
|
adcstate_t ad_state;
|
||||||
/**
|
/**
|
||||||
* @brief Current configuration data.
|
* @brief Current configuration data.
|
||||||
*/
|
*/
|
||||||
const ADCConfig *ad_config;
|
const ADCConfig *ad_config;
|
||||||
/**
|
/**
|
||||||
* @brief Synchronization semaphore.
|
* @brief Synchronization semaphore.
|
||||||
*/
|
*/
|
||||||
Semaphore ad_sem;
|
Semaphore ad_sem;
|
||||||
/**
|
/**
|
||||||
* @brief Current callback function or @p NULL.
|
* @brief Current callback function or @p NULL.
|
||||||
*/
|
*/
|
||||||
adccallback_t ad_callback;
|
adccallback_t ad_callback;
|
||||||
/**
|
/**
|
||||||
* @brief Current samples buffer pointer or @p NULL.
|
* @brief Current samples buffer pointer or @p NULL.
|
||||||
*/
|
*/
|
||||||
adcsample_t *ad_samples;
|
adcsample_t *ad_samples;
|
||||||
/**
|
/**
|
||||||
* @brief Current samples buffer depth or @p 0.
|
* @brief Current samples buffer depth or @p 0.
|
||||||
*/
|
*/
|
||||||
size_t ad_depth;
|
size_t ad_depth;
|
||||||
/**
|
/**
|
||||||
* @brief Current conversion group pointer or @p NULL.
|
* @brief Current conversion group pointer or @p NULL.
|
||||||
*/
|
*/
|
||||||
ADCConversionGroup *ad_grpp;
|
const ADCConversionGroup *ad_grpp;
|
||||||
/* End of the mandatory fields.*/
|
/* End of the mandatory fields.*/
|
||||||
} ADCDriver;
|
} ADCDriver;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue