![]() |
Midnight Sun Firmware
|
ADC library. More...
Macros | |
| #define | NUM_ADC_CHANNELS 19U |
| Total Number of ADC channels (16 external, 3 internal) | |
| #define | ADC_TIMEOUT_MS 100U |
| Maximum time permitted for an ADC transaction. | |
Enumerations | |
| enum | AdcMode { ADC_MODE_SINGLE = 0 , ADC_MODE_CONTINUOUS , NUM_ADC_MODES } |
| Available ADC modes. More... | |
Functions | |
| StatusCode | adc_init (void) |
| Initialize the ADC instance. More... | |
| StatusCode | adc_add_channel (GpioAddress *address) |
| Adds an ADC channel for a given Gpio. More... | |
| StatusCode | adc_run (void) |
| Runs ADC conversions for all added channels. More... | |
| StatusCode | adc_read_raw (GpioAddress *address, uint16_t *reading) |
| Read the most recent raw value for a Gpio address. More... | |
| StatusCode | adc_read_converted (GpioAddress *address, uint16_t *reading) |
| Read the most recent converted value for a Gpio address in mV. More... | |
| void | adc_deinit (void) |
| Clears the ADC state. | |
ADC library.
| enum AdcMode |
| StatusCode adc_add_channel | ( | GpioAddress * | address | ) |
Adds an ADC channel for a given Gpio.
Configures a Gpio to be used as an ADC channel Must be called for all pins in use before adc_init
| address | Specifies which Gpio to set as an ADC channel |
| StatusCode adc_init | ( | void | ) |
Initialize the ADC instance.
This shall configure the ADC for DMA transactions, increasing throughput ADC channels must be already added prior to calling this function
| StatusCode adc_read_converted | ( | GpioAddress * | address, |
| uint16_t * | reading | ||
| ) |
Read the most recent converted value for a Gpio address in mV.
| address | Specifies which Gpio to read from |
| reading | Pointer to a 16-bit value that will be updated with the reading |
| StatusCode adc_read_raw | ( | GpioAddress * | address, |
| uint16_t * | reading | ||
| ) |
Read the most recent raw value for a Gpio address.
| address | Specifies which Gpio to read from |
| reading | Pointer to a 16-bit value that will be updated with the reading |
| StatusCode adc_run | ( | void | ) |
Runs ADC conversions for all added channels.
Uses DMA to perform the transaction