Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
This section describes the programming interface of the AFE HAL driver.
Data Structures | |
struct | afe_chn_set_t |
Defines the structure to configure the AFE Channel. More... | |
struct | afe_converter_config_t |
Defines the structure to configure the AFE converter. More... | |
AFE Channel Configurations | |
void | AFE_HAL_ChnInit (AFE_Type *base, uint32_t chn) |
Resets the channel registers into a reset state. More... | |
static void | AFE_HAL_SetIntEnableCmd (AFE_Type *base, uint32_t chn, bool enable) |
Sets the interrupt request on conversion complete event. More... | |
static void | AFE_HAL_SetDmaEnableCmd (AFE_Type *base, uint32_t chn, bool enable) |
Sets the DMA request on conversion complete event. More... | |
static void | AFE_HAL_SetDelayVal (AFE_Type *base, uint32_t chn, int32_t delay) |
Sets the delay value. More... | |
static int32_t | AFE_HAL_GetDelayVal (AFE_Type *base, uint32_t chn) |
Gets the delay value. More... | |
static uint32_t | AFE_HAL_GetResult (AFE_Type *base, uint32_t chn) |
Gets the measurement result. More... | |
static bool | AFE_HAL_GetConvCompleteFlag (AFE_Type *base, uint32_t chn) |
Checks whether a conversion is completed. More... | |
static bool | AFE_HAL_GetOverflowFlag (AFE_Type *base, uint32_t chn) |
Checks whether the selected channel has overflown. More... | |
static bool | AFE_HAL_GetReadyFlag (AFE_Type *base, uint32_t chn) |
Checks whether the selected channel is ready for conversion. More... | |
AFE Common Configurations | |
void | AFE_HAL_Init (AFE_Type *base) |
Resets all registers into a reset state for the AFE module. More... | |
static void | AFE_HAL_SetMasterEnableCmd (AFE_Type *base, bool enable) |
Enables all ADCs and filters. More... | |
static void | AFE_HAL_ChnSwTriggerCmd (AFE_Type *base, uint32_t chnMask) |
Triggers conversion on the AFE channels. More... | |
static void | AFE_HAL_SetLowPowerCmd (AFE_Type *base, bool enable) |
Sets a low power mode. More... | |
static void | AFE_HAL_SetSwResetCmd (AFE_Type *base, bool enable) |
Sets the software reset. More... | |
static void | AFE_HAL_SetDelayOkCmd (AFE_Type *base) |
Asserts the delay OK. More... | |
static void | AFE_HAL_SetResultFormatMode (AFE_Type *base, afe_result_format_mode_t mode) |
Selects the result format mode. More... | |
static afe_result_format_mode_t | AFE_HAL_GetResultFormatMode (AFE_Type *base) |
Gets the conversion resolution mode. More... | |
static void | AFE_HAL_SetStartUpDelayVal (AFE_Type *base, int32_t startDelay) |
Sets the start up count value. More... | |
static void | AFE_HAL_SetClkDividerMode (AFE_Type *base, afe_clk_divider_mode_t mode) |
Selects the clock divider mode. More... | |
static void | AFE_HAL_SetClkSourceMode (AFE_Type *base, afe_clk_src_mode_t mode) |
Selects the input clock source for the AFE module. More... | |
static void | AFE_HAL_SetDmaIntReq (AFE_Type *base, uint32_t data) |
Sets the DMA and interrupt requests for all channels. More... | |
void | AFE_HAL_ConfigChn (AFE_Type *base, uint32_t chn, afe_chn_set_t *chnStructPtr) |
Configures the AFE channel. More... | |
void | AFE_HAL_ConfigConverter (AFE_Type *base, afe_converter_config_t *converterStructPtr) |
Configures the AFE converter. More... | |
struct afe_chn_set_t |
Data Fields | |
bool | hwTriggerEnable |
Enable triggering by hardware. More... | |
bool | continuousConvEnable |
Enable continuous conversion mode. More... | |
bool | bypassEnable |
Enable bypass mode that modulator and PGA of this channel are disabled. More... | |
afe_pga_gain_mode_t | pgaGainSel |
Select the analog gain applied to the input signal. More... | |
bool | pgaEnable |
Enable the analog gain. More... | |
afe_chn_osr_mode_t | decimOSR |
Select the over sampling ration. More... | |
bool | modulatorEnable |
Enable sigma delta modulator. More... | |
bool | decimFilterEnable |
Enable decimation filter. | |
bool | decimNegedgeEnable |
Enable falling edge for decimator input. | |
bool | externClockEnable |
Enable external clock for decimator. | |
bool afe_chn_set_t::hwTriggerEnable |
bool afe_chn_set_t::continuousConvEnable |
bool afe_chn_set_t::bypassEnable |
afe_pga_gain_mode_t afe_chn_set_t::pgaGainSel |
bool afe_chn_set_t::pgaEnable |
afe_chn_osr_mode_t afe_chn_set_t::decimOSR |
bool afe_chn_set_t::modulatorEnable |
struct afe_converter_config_t |
Data Fields | |
uint8_t | startupCnt |
Set startup delay of modulators. More... | |
afe_result_format_mode_t | resultFormat |
Select the result format. More... | |
bool | delayOk |
Confirm delay registers. More... | |
bool | swReset |
Do a software reset. More... | |
bool | lowPowerEnable |
Enable low power mode. More... | |
bool | swTriggChn0 |
Trigger conversion on channel 0. More... | |
bool | swTriggChn1 |
Trigger conversion on channel 1. More... | |
bool | swTriggChn2 |
Trigger conversion on channel 2. More... | |
bool | masterEnable |
Enable all ADCs and filters simultaneously whose modulatorEnable and decimFilterEnable is asserted. More... | |
uint8_t afe_converter_config_t::startupCnt |
afe_result_format_mode_t afe_converter_config_t::resultFormat |
bool afe_converter_config_t::delayOk |
bool afe_converter_config_t::swReset |
bool afe_converter_config_t::lowPowerEnable |
bool afe_converter_config_t::swTriggChn0 |
bool afe_converter_config_t::swTriggChn1 |
bool afe_converter_config_t::swTriggChn2 |
bool afe_converter_config_t::masterEnable |
enum afe_status_t |
enum afe_chn_osr_mode_t |
enum afe_pga_gain_mode_t |
enum afe_clk_src_mode_t |
void AFE_HAL_ChnInit | ( | AFE_Type * | base, |
uint32_t | chn | ||
) |
This function resets the channel registers into a reset state. This state is defined in the chip Reference Manual.
base | Register base address for the module. |
chn | AFE Channel. |
|
inlinestatic |
This function sets the interrupt request on conversion complete event. Once enabled, the conversion complete interrupt request is asserted for the desired channel when INTENx and COCx bits are set.
base | Register base address for the AFE module. |
chn | AFE Channel. |
enable | Bool value for enabling or disabling interrupt function. |
|
inlinestatic |
This function sets the DMA request on conversion complete event. Once enabled, the DMA request is asserted when the INTENx and the COCx bits are set.
base | Register base address for the AFE module. |
chn | AFE Channel. |
enable | Bool value for enabling or disabling DMA function. |
|
inlinestatic |
This function sets the delay value. This delay is inserted into the trigger response of the decimation filters in order to provide phase compensation between AFE channels.
base | Register base address for the AFE module. |
chn | AFE Channel. |
delay | Delay value. |
|
inlinestatic |
This function gets the delay value.
base | Register base address for the AFE module. |
chn | AFE Channel. |
|
inlinestatic |
This function gets the measurement result. The result can be represented in left justified twos complement 32-bit or right justified twos complement 32-bit format. See the "AFE_HAL_SetResultFormatMode()" for format setting.
base | Register base address for the AFE module. |
chn | AFE Channel. |
|
inlinestatic |
This function checks whether the conversion is completed. When the result is read (see the "AFE_HAL_GetResult()"), the corresponding bit is cleared.
base | Register base address for the AFE module. |
chn | AFE Channel. |
|
inlinestatic |
This function checks whether the selected channel has overflown. This function returns true when new data has already arrived but previous data has not been read. The corresponding bit is cleared when the result is read (see the "AFE_HAL_GetResult()").
base | Register base address for the AFE module. |
chn | AFE Channel. |
|
inlinestatic |
This function checks whether the selected channel is ready for conversion.
base | Register base address for the AFE module. |
chn | AFE Channel. |
void AFE_HAL_Init | ( | AFE_Type * | base | ) |
This function resets all registers into a reset state for the AFE module. This state is defined in the chip Reference Manual.
base | Register base address for the module. |
|
inlinestatic |
This function enables all ADCs and filters. The only ADCs that have asserted are SD_MOD_EN (only when AFE channel is not bypassed) and DEC_EN () are enabled by setting this bit.
base | Register base address for the AFE module. |
enable | Bool value for enabling or disabling ADCs and filters simultaneously. |
|
inlinestatic |
This function sets the software trigger conversion on the desired AFE channels. To trigger more channels simultaneously, use the red enumeration members.
base | Register base address for the AFE module. |
chnMask | Channels which will be triggered. |
|
inlinestatic |
This function sets an AFE low power mode. The maximal modulator clock in low power mode is bellow 1 MHz.
base | Register base address for the AFE module. |
enable | Bool value for enabling or disabling low power mode. |
|
inlinestatic |
This function sets the software reset which is used to reset all ADCs, decimation filters, and clock configuration bits.
base | Register base address for the AFE module. |
enable | If this value is true, all ADCs, PGAs and decimation filters are enabled. Otherwise, are disabled. |
|
inlinestatic |
This function asserts the delay OK. When all delay registers are loaded, the delay OK bit should be asserted.
base | Register base address for the AFE module. |
|
inlinestatic |
This function selects the result format mode.
base | Register base address for the AFE module. |
mode | Selection of mode enumeration. See to " afe_result_format_mode_t". |
|
inlinestatic |
This function gets the conversion resolution mode.
base | Register base address for the AFE module. |
|
inlinestatic |
This function sets the start up count value. A minimum value is two. This value should be greater than 20 µs. To compute the 20 µs value use, such as startDelay = (CLOCK_FREQ / DIV_factor)*20E-6
base | Register base address for the AFE module. |
startDelay | Value for start up count. |
|
inlinestatic |
This function selects the clock divider mode.
base | Register base address for the AFE module. |
mode | Selection of mode enumeration. See to "afe_clk_divider_mode_t". |
|
inlinestatic |
This function selects the input clock source for the AFE module.
base | Register base address for the AFE module. |
mode | Selection of mode enumeration. See to "afe_clk_src_mode_t". |
|
inlinestatic |
This function sets a DMA and Interrupt requests for all channels.
base | Register base address for the AFE module. |
data | which will be written to register. |
void AFE_HAL_ConfigChn | ( | AFE_Type * | base, |
uint32_t | chn, | ||
afe_chn_set_t * | chnStructPtr | ||
) |
This function configures the AFE channel.
base | Register base address for the AFE module. |
chn | AFE Channel. |
chnStructPtr | Channel configuration structure. |
void AFE_HAL_ConfigConverter | ( | AFE_Type * | base, |
afe_converter_config_t * | converterStructPtr | ||
) |
This function configures an AFE converter.
base | Register base address for the AFE module. |
converterStructPtr | Converter configuration structure. |