ADC Example#
Overview#
This sample demonstrates the basic K230 ADC HAL workflow.
Source file:
src/rtsmart/examples/peripheral/adc/test_adc.c
Sample Behavior#
initialize ADC
read a raw value from the selected channel
convert it to a voltage value based on the selected reference voltage
Key APIs#
drv_adc_init()drv_adc_read(channel)drv_adc_read_uv(channel, ref_uv)drv_adc_deinit()
Build and Run#
cd src/rtsmart/examples/peripheral/adc
make
./test_adc [channel] [ref_uv]
channel: ADC channel index, default0ref_uv: reference voltage in microvolts, only1800000or3600000
Output Example#
The sample prints the raw ADC value and the converted voltage value for the selected channel.
