|
Zephyr API Documentation 4.3.0-rc1
A Scalable Open Source RTOS
|
Emulated ADC backend API. More...
Typedefs | |
| typedef int(* | adc_emul_value_func) (const struct device *dev, unsigned int chan, void *data, uint32_t *result) |
| Type definition of the function which is used to obtain ADC mV input values. | |
Functions | |
| int | adc_emul_const_value_set (const struct device *dev, unsigned int chan, uint32_t value) |
Set constant mV value input for emulated ADC chan. | |
| int | adc_emul_const_raw_value_set (const struct device *dev, unsigned int chan, uint32_t raw_value) |
Set constant raw value input for emulated ADC chan. | |
| int | adc_emul_value_func_set (const struct device *dev, unsigned int chan, adc_emul_value_func func, void *data) |
Set function used to obtain voltage for input of emulated ADC chan. | |
| int | adc_emul_raw_value_func_set (const struct device *dev, unsigned int chan, adc_emul_value_func func, void *data) |
Set function used to obtain voltage for raw input value of emulated ADC chan. | |
| int | adc_emul_ref_voltage_set (const struct device *dev, enum adc_reference ref, uint16_t value) |
| Set reference voltage. | |
Emulated ADC backend API.
Behaviour of emulated ADC is application-defined. As-such, each application may
An example of an appropriate Device Tree overlay file is in tests/drivers/adc/adc_api/boards/native_sim.overlay
An example of using emulated ADC backend API is in the file tests/drivers/adc/adc_emul/src/main.c
| typedef int(* adc_emul_value_func) (const struct device *dev, unsigned int chan, void *data, uint32_t *result) |
#include <zephyr/drivers/adc/adc_emul.h>
Type definition of the function which is used to obtain ADC mV input values.
| dev | Pointer to the device structure for the driver instance |
| chan | ADC channel to sample |
| data | User data which was passed on adc_emul_value_func_set |
| result | The result value which will be set as input for ADC chan |
| int adc_emul_const_raw_value_set | ( | const struct device * | dev, |
| unsigned int | chan, | ||
| uint32_t | raw_value ) |
#include <zephyr/drivers/adc/adc_emul.h>
Set constant raw value input for emulated ADC chan.
| dev | The emulated ADC device |
| chan | The channel of ADC which input is assigned |
| raw_value | New raw value to assign to chan input |
#include <zephyr/drivers/adc/adc_emul.h>
Set constant mV value input for emulated ADC chan.
| dev | The emulated ADC device |
| chan | The channel of ADC which input is assigned |
| value | New voltage in mV to assign to chan input |
| int adc_emul_raw_value_func_set | ( | const struct device * | dev, |
| unsigned int | chan, | ||
| adc_emul_value_func | func, | ||
| void * | data ) |
#include <zephyr/drivers/adc/adc_emul.h>
Set function used to obtain voltage for raw input value of emulated ADC chan.
| dev | The emulated ADC device |
| chan | The channel of ADC to which func is assigned |
| func | New function to assign to chan |
| data | Pointer to data passed to func on call |
| int adc_emul_ref_voltage_set | ( | const struct device * | dev, |
| enum adc_reference | ref, | ||
| uint16_t | value ) |
#include <zephyr/drivers/adc/adc_emul.h>
Set reference voltage.
| dev | The emulated ADC device |
| ref | Reference config which is changed |
| value | New reference voltage in mV |
| int adc_emul_value_func_set | ( | const struct device * | dev, |
| unsigned int | chan, | ||
| adc_emul_value_func | func, | ||
| void * | data ) |
#include <zephyr/drivers/adc/adc_emul.h>
Set function used to obtain voltage for input of emulated ADC chan.
| dev | The emulated ADC device |
| chan | The channel of ADC to which func is assigned |
| func | New function to assign to chan |
| data | Pointer to data passed to func on call |