picofuse

Typedefs
adc.h File Reference

ADC (Analog-to-Digital Converter) interface. More...

#include "gpio.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for adc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct hw_adc_t hw_adc_t
 Opaque ADC handle.
 
typedef bool(* hw_adc_dma_callback_t) (hw_adc_t *adc, uint16_t *buf, size_t samples, void *userdata)
 DMA read completion callback. More...
 

Functions

Lifecycle
hw_adc_thw_adc_init_pin (hw_gpio_t *gpio)
 Initialize an ADC handle for a specific GPIO pin. More...
 
hw_adc_thw_adc_init_temperature (void)
 Initialize an ADC handle for the internal temperature sensor channel. More...
 
void hw_adc_deinit (hw_adc_t *adc)
 Finalize and release an ADC handle. More...
 
uint8_t hw_adc_count (void)
 Get the number of external, GPIO-mappable ADC channels. More...
 
uint8_t hw_adc_gpio_channel (uint8_t pin)
 Get the ADC channel number for a GPIO pin on bank 0. More...
 
uint8_t hw_adc_gpio_pin (uint8_t channel)
 Get the GPIO pin number for an ADC channel. More...
 
Methods
uint16_t hw_adc_read_12 (hw_adc_t *adc, uint16_t num_samples)
 Read the current value from an ADC channel as a 12-bit value. More...
 
uint16_t hw_adc_read_16 (hw_adc_t *adc, uint16_t num_samples)
 Read the current value from an ADC channel as a 16-bit value. More...
 
float hw_adc_read_voltage (hw_adc_t *adc, uint16_t num_samples)
 Read the current value from an ADC channel as a voltage. More...
 
float hw_adc_read_temperature (hw_adc_t *adc, uint16_t num_samples)
 Read the current value from an ADC channel as a temperature. More...
 
bool hw_adc_read_dma (hw_adc_t *adc, uint16_t *buf, size_t samples, size_t partitions, uint32_t freq, hw_adc_dma_callback_t callback, void *userdata)
 Start an asynchronous, DMA-driven read of raw samples. More...
 

Detailed Description

ADC (Analog-to-Digital Converter) interface.

Definition in file adc.h.