Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
This section describes the programming interface of the CADC HAL driver.
Data Structures | |
struct | cadc_controller_config_t |
Defines a structure to configure the CyclicADC module during initialization. More... | |
struct | cadc_converter_config_t |
Defines a structure to configure each converter in the CyclicADC module. More... | |
struct | cadc_chn_config_t |
Defines a structure to configure each input channel. More... | |
struct | cadc_slot_config_t |
Defines a structure to configure each slot. More... | |
Functions | |
void | CADC_HAL_Init (ADC_Type *base) |
Initializes all ADC registers to a known state. More... | |
void | CADC_HAL_ConfigController (ADC_Type *base, const cadc_controller_config_t *configPtr) |
Configures the common features in cyclic ADC module. More... | |
void | CADC_HAL_ConfigConvA (ADC_Type *base, const cadc_converter_config_t *configPtr) |
Configures the features for the converter A. More... | |
void | CADC_HAL_ConfigConvB (ADC_Type *base, const cadc_converter_config_t *configPtr) |
Configures the features for the conversion B. More... | |
void | CADC_HAL_ConfigChn (ADC_Type *base, const cadc_chn_config_t *configPtr) |
Configures the feature for the sample channel. More... | |
void | CADC_HAL_ConfigSeqSlot (ADC_Type *base, uint32_t slotIdx, const cadc_slot_config_t *configPtr) |
Configures the features for the sample sequence slot. More... | |
static void | CADC_HAL_SetConvAStartCmd (ADC_Type *base) |
Executes the command that starts conversion of the converter A. More... | |
static void | CADC_HAL_SetConvBStartCmd (ADC_Type *base) |
Executes the command that start conversion of the converter B. More... | |
static void | CADC_HAL_SetConvAPowerDownCmd (ADC_Type *base, bool enable) |
Shuts down the conversion power manually for the converter A. More... | |
static void | CADC_HAL_SetConvBPowerDownCmd (ADC_Type *base, bool enable) |
Shuts down the conversion power manually for the converter B. More... | |
static bool | CADC_HAL_GetConvAInProgressFlag (ADC_Type *base) |
Gets the flag whether the converter A is in process. More... | |
static bool | CADC_HAL_GetConvBInProgressFlag (ADC_Type *base) |
Gets the flag whether the converter B is in process. More... | |
static bool | CADC_HAL_GetConvAEndOfScanIntFlag (ADC_Type *base) |
Gets the flag whether the converter A has finished the conversion. More... | |
static bool | CADC_HAL_GetConvBEndOfScanIntFlag (ADC_Type *base) |
Gets the flag whether the converter B has finished the conversion. More... | |
static void | CADC_HAL_ClearConvAEndOfScanIntFlag (ADC_Type *base) |
Clears the flag that finishes the conversion of the converter A. More... | |
static void | CADC_HAL_ClearConvBEndOfScanIntFlag (ADC_Type *base) |
Clears the flag that finishes the conversion of the converter B. More... | |
static bool | CADC_HAL_GetZeroCrossingIntFlag (ADC_Type *base) |
Gets the flag whether a sample zero-crossing event has happened. More... | |
static uint16_t | CADC_HAL_GetSlotZeroCrossingFlag (ADC_Type *base, uint16_t slotIdxMask) |
Gets the flag whether a sample zero-crossing event has happened. More... | |
static void | CADC_HAL_ClearSlotZeroCrossingFlag (ADC_Type *base, uint16_t slotIdxMask) |
Clears the flags of a sample zero-crossing events. More... | |
static bool | CADC_HAL_GetLowLimitIntFlag (ADC_Type *base) |
Gets the flag whether any sample value is lower than the low limit value. More... | |
static uint16_t | CADC_HAL_GetSlotLowLimitFlag (ADC_Type *base, uint16_t slotIdxMask) |
Gets the flags whether a sample value is lower than the low limit value. More... | |
static void | CADC_HAL_ClearSlotLowLimitFlag (ADC_Type *base, uint16_t slotIdxMask) |
Clears the flags of the sample low limit event. More... | |
static bool | CADC_HAL_GetHighLimitIntFlag (ADC_Type *base) |
Gets the flag whether any sample value is higher than the high limit value. More... | |
static uint16_t | CADC_HAL_GetSlotHighLimitFlag (ADC_Type *base, uint16_t slotIdxMask) |
Gets the flags whether a sample value is higher than the high limit value. More... | |
static void | CADC_HAL_ClearSlotHighLimitFlag (ADC_Type *base, uint16_t slotIdxMask) |
Clears the flags of the sample high limit event. More... | |
static uint16_t | CADC_HAL_GetSlotReadyFlag (ADC_Type *base, uint16_t slotIdxMask) |
Gets the flags whether a sample value is ready. More... | |
static bool | CADC_HAL_GetConvAPowerDownFlag (ADC_Type *base) |
Gets the flag whether the converter A is powered down. More... | |
static bool | CADC_HAL_GetConvBPowerDownFlag (ADC_Type *base) |
Gets the flag whether the converter B is powered down. More... | |
static uint16_t | CADC_HAL_GetSampleValue (ADC_Type *base, uint16_t slotIdx) |
Gets the sample value. More... | |
struct cadc_controller_config_t |
This structure holds the configuration when initializing the CyclicADC module.
Data Fields | |
bool | zeroCrossingIntEnable |
Global zero crossing interrupt enable. | |
bool | lowLimitIntEnable |
Global low limit interrupt enable. | |
bool | highLimitIntEnable |
Global high limit interrupt enable. | |
cadc_scan_mode_t | scanMode |
ADC scan mode control. | |
bool | parallelSimultModeEnable |
Parallel scans done simultaneously enable. | |
cadc_dma_trigger_src_t | dmaSrc |
DMA trigger source. | |
bool | autoStandbyEnable |
Auto standby mode enable. | |
uint16_t | powerUpDelayCount |
Power up delay. | |
bool | autoPowerDownEnable |
Auto power down mode enable. | |
struct cadc_converter_config_t |
This structure holds the configuration for each converter in the CyclicADC module. Normally, there are two converters, ConvA and ConvB in the cyclic ADC module. However, each converter can be configured separately for some features.
Data Fields | |
bool | dmaEnable |
DMA enable. | |
bool | stopEnable |
Stop mode enable. | |
bool | syncEnable |
Enable external sync input to trigger conversion. | |
bool | endOfScanIntEnable |
End of scan interrupt enable. | |
uint16_t | clkDivValue |
ADC clock divider from the bus clock. | |
bool | useChnInputAsVrefH |
Use input channel as high reference voltage, such as AN2. | |
bool | useChnInputAsVrefL |
Use input channel as low reference voltage, such as AN3. | |
cadc_conv_speed_mode_t | speedMode |
ADC speed control mode. | |
uint16_t | sampleWindowCount |
Sample window count. | |
struct cadc_chn_config_t |
This structure holds the configuration for each input channel. In CylicADC module, the input channels are handled by a differential sample. However, the user can still configure the function for each channel when set to operate as a single end sample.
Data Fields | |
cadc_diff_chn_t | diffChns |
Select the differential channel pair. | |
cadc_chn_sel_mode_t | diffSelMode |
Select which channel is indicated in a pair. | |
cadc_gain_mode_t | gainMode |
Gain mode for each channel. | |
struct cadc_slot_config_t |
This structure holds the configuration for each slot in a conversion sequence.
Data Fields | |
bool | slotDisable |
Keep the slot unavailable. | |
bool | syncPointEnable |
Sample waits for an enabled SYNC input to occur. | |
bool | syncIntEnable |
Scan interrupt enable. | |
cadc_diff_chn_t | diffChns |
Select the differential pair. | |
cadc_chn_sel_mode_t | diffSel |
Positive or negative channel in differential pair. | |
cadc_zero_crossing_mode_t | zeroCrossingMode |
Select zero crossing detection mode. | |
uint16_t | lowLimitValue |
Select low limit for hardware compare. | |
uint16_t | highLimitValue |
Select high limit for hardware compare. | |
uint16_t | offsetValue |
Select sign change limit for hardware compare. | |
enum cadc_status_t |
enum cadc_diff_chn_t |
Note, "cadc_diff_chn_t" and "cadc_chn_sel_mode_t" can determine to select the single ADC sample channel.
enum cadc_chn_sel_mode_t |
enum cadc_scan_mode_t |
See the ADC_CTRL1[SMODE] in the chip Reference Manual for detailed information about the ADC converter scan mode.
enum cadc_gain_mode_t |
These items represent the clock speed at which the ADC converter can operate. Faster conversion speeds require greater current consumption.
During sequential and simultaneous parallel scan modes, it selects between end of scan for ConvA's scan and RDY status as the DMA source. During non-simultaneous parallel scan mode it selects between end of scan for converters A and B, and the RDY status as the DMA source.
Enumerator | |
---|---|
kCAdcDmaTriggeredByEndOfScan |
DMA trigger source is end of scan interrupt. |
kCAdcDmaTriggeredByConvReady |
DMA trigger source is RDY status. |
void CADC_HAL_Init | ( | ADC_Type * | base | ) |
The initial states of ADC registers are set as specified in the chip Reference Manual.
base | Register base address for the module. |
void CADC_HAL_ConfigController | ( | ADC_Type * | base, |
const cadc_controller_config_t * | configPtr | ||
) |
This function configures the common features in cyclic ADC module. For detailed items, see the "cadc_controller_config_t".
base | Register base address for the module. |
configPtr | Pointer to configuration structure. |
void CADC_HAL_ConfigConvA | ( | ADC_Type * | base, |
const cadc_converter_config_t * | configPtr | ||
) |
This function configures the features for the converter A. For detailed items, see the "cadc_converter_config_t".
base | Register base address for the module. |
configPtr | Pointer to configuration structure. |
void CADC_HAL_ConfigConvB | ( | ADC_Type * | base, |
const cadc_converter_config_t * | configPtr | ||
) |
This function configures the features for the conversion B. For detailed items, see the "cadc_converter_config_t".
base | Register base address for the module. |
configPtr | Pointer to configuration structure. |
void CADC_HAL_ConfigChn | ( | ADC_Type * | base, |
const cadc_chn_config_t * | configPtr | ||
) |
This function configures the features for the sample channel. For detailed items, see the "cadc_chn_config_t".
base | Register base address for the module. |
configPtr | Pointer to configuration structure. |
void CADC_HAL_ConfigSeqSlot | ( | ADC_Type * | base, |
uint32_t | slotIdx, | ||
const cadc_slot_config_t * | configPtr | ||
) |
This function configures the features for the sample sequence slot. For detailed items, see the "cadc_slot_config_t".
base | Register base address for the module. |
slotIdx | Sample slot index. |
configPtr | Pointer to configuration structure. |
|
inlinestatic |
This function executes the command that start the conversion of the converter A when using the software trigger.
base | Register base address for the module. |
|
inlinestatic |
This function executes the command that start the conversion of the converter B when using the software trigger.
base | Register base address for the module. |
|
inlinestatic |
This function shuts down the conversion power manually for the conversion A. The conversion stops immediately after calling this function.
base | Register base address for the module. |
enable | Switcher to enable the feature or not. |
|
inlinestatic |
This function shots downs the conversion power manually for the conversion B. The conversion stops immediately after calling this function.
base | Register base address for the module. |
enable | Switcher to enable the feature or not. |
|
inlinestatic |
This function gets the flag whether the converter A is in process.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flag whether the converter B is in process.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flag whether the converter A has finished the conversion.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flag whether the converter B has finished the conversion.
base | Register base address for the module. |
|
inlinestatic |
This function clears the flag that finishes the conversion of the converter A.
base | Register base address for the module. |
|
inlinestatic |
This function clears the flag that finishes the conversion of the converter B.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flag whether any sample zero-crossing event has happened.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flags whether a sample zero-crossing event has happened.
base | Register base address for the module. |
slotIdxMask | Mask for indicated slots. |
|
inlinestatic |
This function clears the flags of the sample zero-crossing events.
base | Register base address for the module. |
slotIdxMask | Mask for indicated slots. |
|
inlinestatic |
This function gets the flag whether any sample value is lower than the low limit value.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flags whether a samples value is lower than the low limit value.
base | Register base address for the module. |
slotIdxMask | Mask for indicated slots. |
|
inlinestatic |
This function clears the flags of the sample low limit event.
base | Register base address for the module. |
slotIdxMask | Mask for indicated slots. |
|
inlinestatic |
This function gets the flag whether any sample value is higher than the high limit value.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flags whether a sample value is higher than the high limit value.
base | Register base address for the module. |
slotIdxMask | Mask for indicated slots. |
|
inlinestatic |
This function clears the flags of the sample high limit event.
base | Register base address for the module. |
slotIdxMask | Mask for indicated slots. |
|
inlinestatic |
This function gets the flags whether a sample value is ready.
base | Register base address for the module. |
slotIdxMask | Mask for indicated slots. |
|
inlinestatic |
This function gets the flag whether the converter A is powered down.
base | Register base address for the module. |
|
inlinestatic |
This function gets the flag whether the converter B is powered down.
base | Register base address for the module. |
|
inlinestatic |
This function gets the sample value. Note that the 3 LSBs are not available. When the differential conversion is executed, the MSB is the sign bit.
base | Register base address for the module. |
slotIdx | Index of slot in conversion sequence. |