|
| ADC () |
|
void | resetError () |
|
|
void | setReference (ADC_REFERENCE type) |
| Set the voltage reference for all ADCs, default is vcc. More...
|
|
void | setResolution (uint8_t bits) |
| Change the resolution for all ADCs. More...
|
|
void | setConversionSpeed (ADC_CONVERSION_SPEED speed) |
| Sets the conversion speed for all ADCs. More...
|
|
void | setSamplingSpeed (ADC_SAMPLING_SPEED speed) |
| Sets the sampling speed for all ADCs. More...
|
|
void | setAveraging (uint8_t num) |
| Set the number of averages for all ADCs. More...
|
|
void | enableInterrupts (void(*isr)(void), uint8_t priority=255) |
| Enable interrupts for all ADCs. More...
|
|
void | disableInterrupts () |
| Disable interrupts for all ADCs.
|
|
void | enableDMA () |
| Enable DMA request for all ADCs. More...
|
|
void | disableDMA () |
| Disable DMA request for all ADCs.
|
|
void | enableCompare (int16_t compValue, bool greaterThan) |
| Enable the compare function to a single value. More...
|
|
void | enableCompareRange (int16_t lowerLimit, int16_t upperLimit, bool insideRange, bool inclusive) |
| Enable the compare function to a range. More...
|
|
void | disableCompare () |
| Disable the compare function. More...
|
|
|
int | analogRead (uint8_t pin, int8_t adc_num=-1) |
| Returns the analog value of the pin. More...
|
|
int | analogRead (ADC_INTERNAL_SOURCE pin, int8_t adc_num=-1) |
|
|
bool | startSingleRead (uint8_t pin, int8_t adc_num=-1) |
| Starts an analog measurement on the pin and enables interrupts. More...
|
|
int | readSingle (int8_t adc_num=-1) |
| Reads the analog value of a single conversion. More...
|
|
|
bool | startContinuous (uint8_t pin, int8_t adc_num=-1) |
| Starts continuous conversion on the pin. More...
|
|
int | analogReadContinuous (int8_t adc_num=-1) |
| Reads the analog value of a continuous conversion. More...
|
|
void | stopContinuous (int8_t adc_num=-1) |
| Stops continuous conversion. More...
|
|
|
ADC0 and ADC1 will measure simultaneously
|
Sync_result | analogSynchronizedRead (uint8_t pin0, uint8_t pin1) |
|
Sync_result | analogSyncRead (uint8_t pin0, uint8_t pin1) |
| Same as analogSynchronizedRead. More...
|
|
bool | startSynchronizedSingleRead (uint8_t pin0, uint8_t pin1) |
| Starts an analog measurement at the same time on the two ADC modules. More...
|
|
Sync_result | readSynchronizedSingle () |
| Reads the analog value of a single conversion. More...
|
|
bool | startSynchronizedContinuous (uint8_t pin0, uint8_t pin1) |
| Starts a continuous conversion in both ADCs simultaneously. More...
|
|
Sync_result | readSynchronizedContinuous () |
| Returns the values of both ADCs. More...
|
|
void | stopSynchronizedContinuous () |
| Stops synchronous continuous conversion.
|
|
Class ADC: Controls the Teensy 3.x, 4 ADC
Definition at line 69 of file ADC.h.
int ADC::analogRead |
( |
uint8_t |
pin, |
|
|
int8_t |
adc_num = -1 |
|
) |
| |
Returns the analog value of the pin.
It waits until the value is read and then returns the result. If a comparison has been set up and fails, it will return ADC_ERROR_VALUE. This function is interrupt safe, so it will restore the adc to the state it was before being called If more than one ADC exists, it will select the module with less workload, you can force a selection using adc_num. If you select ADC1 in a board with just one ADC, it will return ADC_ERROR_VALUE.
- Parameters
-
pin | can be any of the analog pins |
adc_num | ADC_X ADC module |
- Returns
- the analog value of the pin.
Definition at line 284 of file ADC.cpp.
int ADC::analogReadContinuous |
( |
int8_t |
adc_num = -1 | ) |
|
Reads the analog value of a continuous conversion.
Set the continuous conversion with with analogStartContinuous(pin) or startContinuousDifferential(pinP, pinN). If single-ended and 16 bits it's necessary to typecast it to an unsigned type (like uint16_t), otherwise values larger than 3.3/2 V are interpreted as negative!
- Parameters
-
- Returns
- the last converted value.
Set the continuous conversion with with analogStartContinuous(pin) or startContinuousDifferential(pinP, pinN).
- Returns
- the last converted value. If single-ended and 16 bits it's necessary to typecast it to an unsigned type (like uint16_t), otherwise values larger than 3.3/2 V are interpreted as negative!
Definition at line 660 of file ADC.cpp.
void ADC::enableCompareRange |
( |
int16_t |
lowerLimit, |
|
|
int16_t |
upperLimit, |
|
|
bool |
insideRange, |
|
|
bool |
inclusive |
|
) |
| |
|
inline |
Enable the compare function to a range.
A conversion will be completed only when the ADC value is inside (insideRange=1) or outside (=0) the range given by (lowerLimit, upperLimit),including (inclusive=1) the limits or not (inclusive=0). See Table 31-78, p. 617 of the freescale manual. Call it after changing the resolution Use with interrupts or poll conversion completion with isComplete()
- Parameters
-
lowerLimit | lower value to compare |
upperLimit | upper value to compare |
insideRange | true or false |
inclusive | true or false |
Definition at line 254 of file ADC.h.