Library for the Analog to Digital Conversion (ADC) of analog pins (A0..A5).
Note that GPIO numbering (SWB_A0..SWB_A5) used in gpio.h and pinmap.h is different from A0..A5.
◆ adc_channel_t
Enumerate the different available ADC channels.
Enumerator |
---|
ADC0 | ADC channel for pin SWB_A0
|
ADC1 | ADC channel for pin SWB_A1
|
ADC2 | ADC channel for pin SWB_A2
|
ADC3 | ADC channel for pin SWB_A3
|
ADC4 | ADC channel for pin SWB_A4
|
ADC5 | ADC channel for pin SWB_A5
|
Definition at line 43 of file adc.h.
◆ adc_destroy()
void adc_destroy |
( |
void |
| ) |
|
De-initialize the ADC library and free up the used memory in the shared memory space.
Definition at line 80 of file adc.c.
◆ adc_init()
Initialization of the ADC library.
Definition at line 78 of file adc.c.
◆ adc_read_channel()
- Parameters
-
channel | The channel to read the analog value from. Read ADC channel #channel and return the read out voltage. |
- Returns
- a value between 0.0 and 3.3V.
- Warning
- Fails with program exit when channel is outside valid range or has not been initialized..
Definition at line 87 of file adc.c.
◆ adc_read_channel_raw()
- Parameters
-
channel | The channel to read the analog value from. Read ADC channel #channel and return the raw value. |
- Returns
- a value between 0 and 65535.
- Warning
- Fails with program exit when channel is outside valid range.
Definition at line 97 of file adc.c.
◆ initialized_adc()
bool initialized_adc |
( |
void |
| ) |
|
Check if ADC has been initialized.
- Returns
- True when initialized, false otherwise.
Definition at line 57 of file adc.c.