Skip to content

Latest commit

 

History

History
68 lines (61 loc) · 2.1 KB

sys_adc.md

File metadata and controls

68 lines (61 loc) · 2.1 KB

🏠 Main Page

sys_adc - Analog to Digital Converter Functions

💾File: sys_adc.h
📦Library: lib2_sys


Default pin assignment for lib2

image

Constants:


ADC channel

🔟Const: ADC_CH_0 ADC0
🔟Const: ADC_CH_1 ADC1
🔟Const: ADC_CH_2 ADC2
🔟Const: ADC_CH_V VSYS Voltage
🔟Const: ADC_CH_T Internal Temp. Sensor


ADC Reference Voltage

🔟Const: ADC_VREF ADC Reference Voltage (3.3V)


Functions:


💠Function: sys_adc_init - Init ADC channel

void sys_adc_init(uint8_t ch)
  • ▶️Param: ch ADC channel

💠Function: sys_adc_raw - Read ADC raw value

uint16_t sys_adc_raw(uint8_t ch)
  • ▶️Param: ch ADC channel
  • ✅Return: ADC raw value 0..4095 (0..VREF)

💠Function: sys_adc_scale - Read ADC and scale raw value to low..high

static inline double sys_adc_scale(uint8_t ch, double low, double high)
  • ▶️Param: ch ADC channel
  • ▶️Param: low Low value for 0
  • ▶️Param: high High value for 4095 (3.3V or VREF)
  • ✅Return: Value between low and high

💠Function: sys_adc_volt - Read ADC voltage value

static inline double sys_adc_volt(uint8_t ch)
  • ▶️Param: ch ADC channel
  • ✅Return: ADC voltage value 0..3.3V (VREF)

💠Function: sys_adc_vsys - Read ADC VSYS voltage

static inline double sys_adc_vsys()
  • ✅Return: VSYS voltage value ~5V

💠Function: sys_adc_temp_c - Read ADC internal temp. sensor in celsius

static inline double sys_adc_temp_c()
  • ✅Return: Temp. value in celsius

💠Function: sys_adc_temp_f - Read ADC internal temp. sensor in fahrenheit

static inline double sys_adc_temp_f()
  • ✅Return: Temp. value in fahrenheit