• 基于iio的ADC驱动(android)


    rk3288开发板上的AD接口分为:高速ADC流(High-speed ADC Stream Interface)、温度传感器(Temperature Sensor)、逐次逼近ADC(Successive Approximation Register);
    ADC扩展知识:
    1、获取 AD 通道
            struct iio_channel *chan; //定义 IIO 通道结构体
            chan = iio_channel_get(&pdev->dev, NULL); //获取 IIO 通道结构体
    2、读取 AD 采集到的原始数据
            int value,Vresult;
            ret = iio_read_channel_raw(chan, &value);
            调用 iio_read_channel_raw 函数读取 AD 采集的原始数据并存入value变量中。
    3、计算采集到的电压
            使用标准电压将 AD 转换的值转换为用户所需要的电压值。其计算公式如下:
            Vresult = (Vref * value) / (2^n-1) ========> 用户需要的电压 = (rk3288标准电压 * 采集的原始数据) / (2^AD位数-1)
            例如,rk3288的AD标准电压为 1.8V,AD 采集位数为10位精度,AD采集到的原始数据为1234,则:
                                Vresult = (1800mv * 1234) / 1023;
    4、ADC 常用函数接口
            struct iio_channel *iio_channel_get(struct device *dev, const char *consumer_channel);
                功能:获取 iio 通道描述;
                参数:
                    dev: 使用该通道的设备描述指针;
                    consumer_channel: 该设备所使用的IIO通道描述指针;
                        
            void iio_channel_release(struct iio_channel *chan);
                功能:释放 iio_channel_get 函数获取到的通道;
                参数:
                    chan:要被释放的通道描述指针;
                            
            int iio_read_channel_raw(struct iio_channel *chan, int *val);
                功能:读取chan通道AD采集的原始数据;
                参数:
                    chan:要读取的采集通道指针;
                    val:存放读取结果的指针;

    rk3288-android5.1添加ADC驱动,以下以酒精传感器为例:
    1、在rk3288 linux设备数(DTS)上添加AD设备
            路径:androidkernelarcharmootdtsxxx-rk3288.dts
            

    (转载自:https://blog.csdn.net/soar999999/article/details/100715619)

  • 相关阅读:
    python常用模块: random模块, time模块, sys模块, os模块, 序列化模块
    (python)getattr等用法
    (Pytorch)涉及的常见操作
    对PatchGAN的感知域(receptive_field)理解
    心得
    dilated conv、deconv、fractional-strided conv
    (PatchGANs)Pecomputed Real-time Texture Synthesis With Markovian Generative Adversarial Networks
    (Pixel2PixelGANs)Image-to-Image translation with conditional adversarial networks
    CGANs
    Tensorflow--Debug
  • 原文地址:https://www.cnblogs.com/goahead--linux/p/13099005.html
Copyright © 2020-2023  润新知