GlobLib
HAL and API libraries for MCUs and hardware.
stm32f103cb_adc.h
Go to the documentation of this file.
1 #ifndef STM32F103CB_ADC_H_
2 #define STM32F103CB_ADC_H_
3 
39 #include "stm32f103cb_gpio.h"
40 #include "stm32f103cb_debug.h"
41 #include <libopencm3/stm32/adc.h>
42 #include <stdint.h>
43 
47 #define ADC_VOLT_REF 3.3f
48 
59 
69 uint16_t ADC_addChannel(gpio_port port, gpio_pin pin);
70 
79 uint16_t ADC_sample(gpio_port port, gpio_pin pin);
88 float ADC_volts(gpio_port port, gpio_pin pin);
91 #endif
gpio_port
GPIO ports available for the MCU.
uint16_t ADC_sample(gpio_port port, gpio_pin pin)
Get a sample from the ADC.
Header file for stm32f103cb DEBUG.
Header file for stm32f103 GPIO.
uint16_t ADC_addChannel(gpio_port port, gpio_pin pin)
Add an aditional channel to the ADC.
mcu_error ADC_setup(gpio_port port, gpio_pin pin)
Initialize ADC for a given port and pin.
float ADC_volts(gpio_port port, gpio_pin pin)
Get a sample from the ADC and convert it to volts.
gpio_pin
GPIO pins available for each port.
mcu_error
Error enumerators for the Debug peripheral.