GlobLib
HAL and API libraries for MCUs and hardware.
|
This module contains low level functions for ADC interaction. More...
Files | |
file | stm32f103cb_adc.h |
Header file for stm32f103cb ADC API. | |
Macros | |
#define | ADC_VOLT_REF 3.3f |
Typical voltage reference value used by ADC_volts() | |
Functions | |
mcu_error | ADC_setup (gpio_port port, gpio_pin pin) |
Initialize ADC for a given port and pin. More... | |
uint16_t | ADC_addChannel (gpio_port port, gpio_pin pin) |
Add an aditional channel to the ADC. More... | |
uint16_t | ADC_sample (gpio_port port, gpio_pin pin) |
Get a sample from the ADC. More... | |
float | ADC_volts (gpio_port port, gpio_pin pin) |
Get a sample from the ADC and convert it to volts. More... | |
This module contains low level functions for ADC interaction.
The STM32f1x3 has one ADC with 10 channels on pins PA0 - PA7 and PB0 - PB1. This module containes basic routines to setup the ADC and obatin a sample from each of these channels.
Add an aditional channel to the ADC.
This can be used after ADC_setup() has been called once to add additional ADC channels
port | The port the pin is located on |
pin | The pin of the port |
Definition at line 56 of file stm32f103cb_adc.c.
Get a sample from the ADC.
port | The port the pin is located on |
pin | The pin of the port |
Definition at line 172 of file stm32f103cb_adc.c.
Initialize ADC for a given port and pin.
This must be called before any other API feature is used.
port | The port the pin is located on |
pin | The pin of the port |
Definition at line 50 of file stm32f103cb_adc.c.
Get a sample from the ADC and convert it to volts.
This uses ADC_VOLT_REF to convert the sample value to volts
port | The port the pin is located on |
pin | The pin of the port |
Definition at line 279 of file stm32f103cb_adc.c.