Tiva Driver Lib
|
Functions | |
void | ADCIntRegister (uint32_t ui32Base, uint32_t ui32SequenceNum, void(*pfnHandler)(void)) |
void | ADCIntUnregister (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCIntDisable (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCIntEnable (uint32_t ui32Base, uint32_t ui32SequenceNum) |
uint32_t | ADCIntStatus (uint32_t ui32Base, uint32_t ui32SequenceNum, bool bMasked) |
void | ADCIntClear (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCSequenceEnable (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCSequenceDisable (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCSequenceConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Trigger, uint32_t ui32Priority) |
void | ADCSequenceStepConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Step, uint32_t ui32Config) |
int32_t | ADCSequenceOverflow (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCSequenceOverflowClear (uint32_t ui32Base, uint32_t ui32SequenceNum) |
int32_t | ADCSequenceUnderflow (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCSequenceUnderflowClear (uint32_t ui32Base, uint32_t ui32SequenceNum) |
int32_t | ADCSequenceDataGet (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer) |
void | ADCProcessorTrigger (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCSoftwareOversampleConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Factor) |
void | ADCSoftwareOversampleStepConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Step, uint32_t ui32Config) |
void | ADCSoftwareOversampleDataGet (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer, uint32_t ui32Count) |
void | ADCHardwareOversampleConfigure (uint32_t ui32Base, uint32_t ui32Factor) |
void | ADCComparatorConfigure (uint32_t ui32Base, uint32_t ui32Comp, uint32_t ui32Config) |
void | ADCComparatorRegionSet (uint32_t ui32Base, uint32_t ui32Comp, uint32_t ui32LowRef, uint32_t ui32HighRef) |
void | ADCComparatorReset (uint32_t ui32Base, uint32_t ui32Comp, bool bTrigger, bool bInterrupt) |
void | ADCComparatorIntDisable (uint32_t ui32Base, uint32_t ui32SequenceNum) |
void | ADCComparatorIntEnable (uint32_t ui32Base, uint32_t ui32SequenceNum) |
uint32_t | ADCComparatorIntStatus (uint32_t ui32Base) |
void | ADCComparatorIntClear (uint32_t ui32Base, uint32_t ui32Status) |
void | ADCReferenceSet (uint32_t ui32Base, uint32_t ui32Ref) |
uint32_t | ADCReferenceGet (uint32_t ui32Base) |
void | ADCPhaseDelaySet (uint32_t ui32Base, uint32_t ui32Phase) |
uint32_t | ADCPhaseDelayGet (uint32_t ui32Base) |
void ADCComparatorConfigure | ( | uint32_t | ui32Base, |
uint32_t | ui32Comp, | ||
uint32_t | ui32Config | ||
) |
Configures an ADC digital comparator.
ui32Base | is the base address of the ADC module. |
ui32Comp | is the index of the comparator to configure. |
ui32Config | is the configuration of the comparator. |
This function configures a comparator. The ui32Config parameter is the result of a logical OR operation between the ADC_COMP_TRIG_xxx, and ADC_COMP_INT_xxx values.
The ADC_COMP_TRIG_xxx term can take on the following values:
The ADC_COMP_INT_xxx term can take on the following values:
void ADCComparatorIntClear | ( | uint32_t | ui32Base, |
uint32_t | ui32Status | ||
) |
Clears sample sequence comparator interrupt source.
ui32Base | is the base address of the ADC module. |
ui32Status | is the bit-mapped interrupts status to clear. |
The specified interrupt status is cleared.
void ADCComparatorIntDisable | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Disables a sample sequence comparator interrupt.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function disables the requested sample sequence comparator interrupt.
void ADCComparatorIntEnable | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Enables a sample sequence comparator interrupt.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function enables the requested sample sequence comparator interrupt.
uint32_t ADCComparatorIntStatus | ( | uint32_t | ui32Base | ) |
Gets the current comparator interrupt status.
ui32Base | is the base address of the ADC module. |
This function returns the digital comparator interrupt status bits. This status is sequence agnostic.
void ADCComparatorRegionSet | ( | uint32_t | ui32Base, |
uint32_t | ui32Comp, | ||
uint32_t | ui32LowRef, | ||
uint32_t | ui32HighRef | ||
) |
Defines the ADC digital comparator regions.
ui32Base | is the base address of the ADC module. |
ui32Comp | is the index of the comparator to configure. |
ui32LowRef | is the reference point for the low/mid band threshold. |
ui32HighRef | is the reference point for the mid/high band threshold. |
The ADC digital comparator operation is based on three ADC value regions:
void ADCComparatorReset | ( | uint32_t | ui32Base, |
uint32_t | ui32Comp, | ||
bool | bTrigger, | ||
bool | bInterrupt | ||
) |
Resets the current ADC digital comparator conditions.
ui32Base | is the base address of the ADC module. |
ui32Comp | is the index of the comparator. |
bTrigger | is the flag to indicate reset of Trigger conditions. |
bInterrupt | is the flag to indicate reset of Interrupt conditions. |
Because the digital comparator uses current and previous ADC values, this function allows the comparator to be reset to its initial value to prevent stale data from being used when a sequence is enabled.
void ADCHardwareOversampleConfigure | ( | uint32_t | ui32Base, |
uint32_t | ui32Factor | ||
) |
Configures the hardware oversampling factor of the ADC.
ui32Base | is the base address of the ADC module. |
ui32Factor | is the number of samples to be averaged. |
This function configures the hardware oversampling for the ADC, which can be used to provide better resolution on the sampled data. Oversampling is accomplished by averaging multiple samples from the same analog input. Six different oversampling rates are supported; 2x, 4x, 8x, 16x, 32x, and 64x. Specifying an oversampling factor of zero disables hardware oversampling.
Hardware oversampling applies uniformly to all sample sequencers. It does not reduce the depth of the sample sequencers like the software oversampling APIs; each sample written into the sample sequencer FIFO is a fully oversampled analog input reading.
Enabling hardware averaging increases the precision of the ADC at the cost of throughput. For example, enabling 4x oversampling reduces the throughput of a 250 k samples/second ADC to 62.5 k samples/second.
void ADCIntClear | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Clears sample sequence interrupt source.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
The specified sample sequence interrupt is cleared, so that it no longer asserts. This function must be called in the interrupt handler to keep the interrupt from being triggered again immediately upon exit.
void ADCIntDisable | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Disables a sample sequence interrupt.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function disables the requested sample sequence interrupt.
void ADCIntEnable | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Enables a sample sequence interrupt.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function enables the requested sample sequence interrupt. Any outstanding interrupts are cleared before enabling the sample sequence interrupt.
void ADCIntRegister | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
void(*)(void) | pfnHandler | ||
) |
Registers an interrupt handler for an ADC interrupt.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
pfnHandler | is a pointer to the function to be called when the ADC sample sequence interrupt occurs. |
This function sets the handler to be called when a sample sequence interrupt occurs. This function enables the global interrupt in the interrupt controller; the sequence interrupt must be enabled with ADCIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source via ADCIntClear().
uint32_t ADCIntStatus | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
bool | bMasked | ||
) |
Gets the current interrupt status.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
bMasked | is false if the raw interrupt status is required and true if the masked interrupt status is required. |
This function returns the interrupt status for the specified sample sequence. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.
void ADCIntUnregister | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Unregisters the interrupt handler for an ADC interrupt.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function unregisters the interrupt handler. This function disables the global interrupt in the interrupt controller; the sequence interrupt must be disabled via ADCIntDisable().
uint32_t ADCPhaseDelayGet | ( | uint32_t | ui32Base | ) |
Gets the phase delay between a trigger and the start of a sequence.
ui32Base | is the base address of the ADC module. |
This function gets the current phase delay between the detection of an ADC trigger event and the start of the sample sequence.
void ADCPhaseDelaySet | ( | uint32_t | ui32Base, |
uint32_t | ui32Phase | ||
) |
Sets the phase delay between a trigger and the start of a sequence.
ui32Base | is the base address of the ADC module. |
ui32Phase | is the phase delay, specified as one of ADC_PHASE_0, ADC_PHASE_22_5, ADC_PHASE_45, ADC_PHASE_67_5, ADC_PHASE_90, ADC_PHASE_112_5, ADC_PHASE_135, ADC_PHASE_157_5, ADC_PHASE_180, ADC_PHASE_202_5, ADC_PHASE_225, ADC_PHASE_247_5, ADC_PHASE_270, ADC_PHASE_292_5, ADC_PHASE_315, or ADC_PHASE_337_5. |
This function sets the phase delay between the detection of an ADC trigger event and the start of the sample sequence. By selecting a different phase delay for a pair of ADC modules (such as ADC_PHASE_0 and ADC_PHASE_180) and having each ADC module sample the same analog input, it is possible to increase the sampling rate of the analog input (with samples N, N+2, N+4, and so on, coming from the first ADC and samples N+1, N+3, N+5, and so on, coming from the second ADC). The ADC module has a single phase delay that is applied to all sample sequences within that module.
void ADCProcessorTrigger | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Causes a processor trigger for a sample sequence.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number, with ADC_TRIGGER_WAIT or ADC_TRIGGER_SIGNAL optionally ORed into it. |
This function triggers a processor-initiated sample sequence if the sample sequence trigger is configured to ADC_TRIGGER_PROCESSOR. If ADC_TRIGGER_WAIT is ORed into the sequence number, the processor-initiated trigger is delayed until a later processor-initiated trigger to a different ADC module that specifies ADC_TRIGGER_SIGNAL, allowing multiple ADCs to start from a processor-initiated trigger in a synchronous manner.
uint32_t ADCReferenceGet | ( | uint32_t | ui32Base | ) |
Returns the current setting of the ADC reference.
ui32Base | is the base address of the ADC module. |
Returns the value of the ADC reference setting. The returned value is one of ADC_REF_INT, ADC_REF_EXT_3V, or ADC_REF_EXT_1V.
void ADCReferenceSet | ( | uint32_t | ui32Base, |
uint32_t | ui32Ref | ||
) |
Selects the ADC reference.
ui32Base | is the base address of the ADC module. |
ui32Ref | is the reference to use. |
The ADC reference is set as specified by ui32Ref. It must be one of ADC_REF_INT, ADC_REF_EXT_3V, or ADC_REF_EXT_1V for internal or external reference. If ADC_REF_INT is chosen, then an internal 3V reference is used and no external reference is needed. If ADC_REF_EXT_3V is chosen, then a 3V reference must be supplied to the AVREF pin. If ADC_REF_EXT_1V is chosen, then a 1V external reference must be supplied to the AVREF pin.
void ADCSequenceConfigure | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
uint32_t | ui32Trigger, | ||
uint32_t | ui32Priority | ||
) |
Configures the trigger source and priority of a sample sequence.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
ui32Trigger | is the trigger source that initiates the sample sequence; must be one of the ADC_TRIGGER_* values. |
ui32Priority | is the relative priority of the sample sequence with respect to the other sample sequences. |
This function configures the initiation criteria for a sample sequence. Valid sample sequencers range from zero to three; sequencer zero captures up to eight samples, sequencers one and two capture up to four samples, and sequencer three captures a single sample. The trigger condition and priority (with respect to other sample sequencer execution) are set.
The ui32Trigger parameter can take on the following values:
Note that not all trigger sources are available on all Tiva family members; consult the data sheet for the device in question to determine the availability of triggers.
The ui32Priority parameter is a value between 0 and 3, where 0 represents the highest priority and 3 the lowest. Note that when programming the priority among a set of sample sequences, each must have unique priority; it is up to the caller to guarantee the uniqueness of the priorities.
int32_t ADCSequenceDataGet | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
uint32_t * | pui32Buffer | ||
) |
Gets the captured data for a sample sequence.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
pui32Buffer | is the address where the data is stored. |
This function copies data from the specified sample sequencer output FIFO to a memory resident buffer. The number of samples available in the hardware FIFO are copied into the buffer, which is assumed to be large enough to hold that many samples. This function only returns the samples that are presently available, which may not be the entire sample sequence if it is in the process of being executed.
void ADCSequenceDisable | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Disables a sample sequence.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
Prevents the specified sample sequence from being captured when its trigger is detected. A sample sequence should be disabled before it is configured.
void ADCSequenceEnable | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Enables a sample sequence.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
Allows the specified sample sequence to be captured when its trigger is detected. A sample sequence must be configured before it is enabled.
int32_t ADCSequenceOverflow | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Determines if a sample sequence overflow occurred.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function determines if a sample sequence overflow has occurred. Overflow happens if the captured samples are not read from the FIFO before the next trigger occurs.
void ADCSequenceOverflowClear | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Clears the overflow condition on a sample sequence.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function clears an overflow condition on one of the sample sequences. The overflow condition must be cleared in order to detect a subsequent overflow condition (it otherwise causes no harm).
void ADCSequenceStepConfigure | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
uint32_t | ui32Step, | ||
uint32_t | ui32Config | ||
) |
Configure a step of the sample sequencer.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
ui32Step | is the step to be configured. |
ui32Config | is the configuration of this step; must be a logical OR of ADC_CTL_TS, ADC_CTL_IE, ADC_CTL_END, ADC_CTL_D, one of the input channel selects (ADC_CTL_CH0 through ADC_CTL_CH23), and one of the digital comparator selects (ADC_CTL_CMP0 through ADC_CTL_CMP7). |
This function configures the ADC for one step of a sample sequence. The ADC can be configured for single-ended or differential operation (the ADC_CTL_D bit selects differential operation when set), the channel to be sampled can be chosen (the ADC_CTL_CH0 through ADC_CTL_CH23 values), and the internal temperature sensor can be selected (the ADC_CTL_TS bit). Additionally, this step can be defined as the last in the sequence (the ADC_CTL_END bit) and it can be configured to cause an interrupt when the step is complete (the ADC_CTL_IE bit). If the digital comparators are present on the device, this step may also be configured to send the ADC sample to the selected comparator using ADC_CTL_CMP0 through ADC_CTL_CMP7. The configuration is used by the ADC at the appropriate time when the trigger for this sequence occurs.
The ui32Step parameter determines the order in which the samples are captured by the ADC when the trigger occurs. It can range from zero to seven for the first sample sequencer, from zero to three for the second and third sample sequencer, and can only be zero for the fourth sample sequencer.
Differential mode only works with adjacent channel pairs (for example, 0 and 1). The channel select must be the number of the channel pair to sample (for example, ADC_CTL_CH0 for 0 and 1, or ADC_CTL_CH1 for 2 and 3) or undefined results are returned by the ADC. Additionally, if differential mode is selected when the temperature sensor is being sampled, undefined results are returned by the ADC.
It is the responsibility of the caller to ensure that a valid configuration is specified; this function does not check the validity of the specified configuration.
int32_t ADCSequenceUnderflow | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Determines if a sample sequence underflow occurred.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function determines if a sample sequence underflow has occurred. Underflow happens if too many samples are read from the FIFO.
void ADCSequenceUnderflowClear | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum | ||
) |
Clears the underflow condition on a sample sequence.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
This function clears an underflow condition on one of the sample sequencers. The underflow condition must be cleared in order to detect a subsequent underflow condition (it otherwise causes no harm).
void ADCSoftwareOversampleConfigure | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
uint32_t | ui32Factor | ||
) |
Configures the software oversampling factor of the ADC.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
ui32Factor | is the number of samples to be averaged. |
This function configures the software oversampling for the ADC, which can be used to provide better resolution on the sampled data. Oversampling is accomplished by averaging multiple samples from the same analog input. Three different oversampling rates are supported; 2x, 4x, and 8x.
Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per trigger. This also means that 8x oversampling is only available on the first sample sequencer.
void ADCSoftwareOversampleDataGet | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
uint32_t * | pui32Buffer, | ||
uint32_t | ui32Count | ||
) |
Gets the captured data for a sample sequence using software oversampling.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
pui32Buffer | is the address where the data is stored. |
ui32Count | is the number of samples to be read. |
This function copies data from the specified sample sequence output FIFO to a memory resident buffer with software oversampling applied. The requested number of samples are copied into the data buffer; if there are not enough samples in the hardware FIFO to satisfy this many oversampled data items, then incorrect results are returned. It is the caller's responsibility to read only the samples that are available and wait until enough data is available, for example as a result of receiving an interrupt.
void ADCSoftwareOversampleStepConfigure | ( | uint32_t | ui32Base, |
uint32_t | ui32SequenceNum, | ||
uint32_t | ui32Step, | ||
uint32_t | ui32Config | ||
) |
Configures a step of the software oversampled sequencer.
ui32Base | is the base address of the ADC module. |
ui32SequenceNum | is the sample sequence number. |
ui32Step | is the step to be configured. |
ui32Config | is the configuration of this step. |
This function configures a step of the sample sequencer when using the software oversampling feature. The number of steps available depends on the oversampling factor set by ADCSoftwareOversampleConfigure(). The value of ui32Config is the same as defined for ADCSequenceStepConfigure().