ADC IMX6UL VF610 C/C++ Example code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

ADC IMX6UL VF610 C/C++ Example code

1,654 次查看
jmartinez1
Contributor II

Hi all,

I am developping an ADC app on Qt5 using an embedded based on IMX6UL. I would like to know how must I configure and use the driver in order to read the ADC input values programing in C or C++.

Thank you very much.

Joaquim.

标签 (2)
0 项奖励
回复
2 回复数

1,137 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Joaquim,

  In i.MX_Linux_Reference_Manual.pdf, software interface has been described, see it, please!

Have a great day,
TIC  Weidong Sun


-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,137 次查看
jmartinez1
Contributor II

Hi Wigros,

Thank for your answer.

When I use the console of my embedded system, I can do conversions without problems using "cat in_voltage0_raw". So I understand I have not make the menuconfig.

Before to post, I read the reference manual and I found the driver in my build directory, but in the manual there isn't any explanaition about how use the driver in C/C++. I included the VF610_adc.c file in my project, in order to see how the functions are and if there is any example of configuration/use. I can see several functions, but I looking for a main.c where can help me to see how the ADC is configured and used. The first problem I had is that the headers files included in VF610_adc.c are not found when I compile my project. Please see bellow. I have many doubts because I am not expert in linux embedded systems: the first is where I can found the headers files, and the second an example of use of the driver.

Thank you very much.

#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/regulator/consumer.h>
#include <linux/of_platform.h>
#include <linux/err.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/driver.h>
0 项奖励
回复