主题中讨论的其他器件:ADS1015
您好!
使用 libiio 读取 ADS1015时遇到问题。
我可以访问上下文和器件。 我甚至可以启用所需的通道、但当我运行函数来创建缓冲区 ICO_DEVICE_CREATE 缓冲区时 、我始终得到一个空值。
它显示 errno 22: 参数无效
我使用此函数(ICO_CHANNEL_IS_SCAN_ELEMENT)来确保通道具有缓冲能力。
IIO_INFO 输出:
IIO:device2:ADS1015
找到9个通道:
voltage0-voltage1:(输入,索引:0,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:比例值:3.000000000
属性1:原始值:0
属性2:SAMPLING_FREQUENCY 值:128
voltage0-voltage3:(输入,索引:1,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:原始值:0
属性1:比例值:3.000000000
属性2:SAMPLING_FREQUENCY 值:128
voltage1-voltage3:(输入,索引:2,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:原始值:0
属性1:比例值:3.000000000
属性2:SAMPLING_FREQUENCY 值:128
voltage2-voltage3:(输入,索引:3,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:比例值:3.000000000
属性1:原始值:0
属性2:SAMPLING_FREQUENCY 值:128
voltage0:(输入,索引:4,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:比例值:2.000000000
属性1:原始值:0
属性2:SAMPLING_FREQUENCY 值:3300
voltage1:(输入,索引:5,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:SAMPLING_FREQUENCY 值:3300
属性1:比例值:2.000000000
属性2:原始值:0
voltage2:(输入,索引:6,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:比例值:2.000000000
属性1:SAMPLING_FREQUENCY 值:3300
属性2:原始值:0
voltage3:(输入,索引:7,格式:LE:s-12/16->4)
找到3个通道特定属性:
属性0:比例值:2.000000000
属性1:原始值:0
属性2:SAMPLING_FREQUENCY 值:3300
时间戳:(输入,索引:8,格式:LE:s-64/64->0)
代码:
NT main (){
struct iop_context* ctx = iop_create_local_context ();
if (!ctx){
log (error)<<"No context found";
return;
}
struct IIO_device * dev = IIO_context_find_device (ctx、deviceName.c_str ());
if (!
struct IIO_device *=
0);if (not found);instructure I return = 4);if (not channel_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_int_ i++){
voltage[i]= ICO_DEVICE_GET_CHANNEL (dev、i+4);
log (info)<<" Channel found:"<< ICO_CHANNEL_GET_id (voltage[i]);
}
if (!voltage[0]|||int voltage [1]||!chine_voltage[2]|| voltage[3](voltage[3]);<
I sple return)
<!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! i++){
if (io_channel_is_scan_element (voltage[i])}{
io_channel_enable (voltage[i]);
if (io_channel_is_enabled (voltage[i])) log (info)<< Channel enable:"<< io_channel_get_id (voltage [i]);if (volt_sample_sage
)<
context、device_sample_sample_sage =<_device_sample_sumptc)<"< context、device_s/simumplime_se_se_se_se_se_se_s/simumplimumb <"<"<?se_se_se_se_se_se_se_s/simumplimumplimumple_se_se_s/simumplimumb (<"
如果(!buffer){
log (error)<< Error creating buffer "<< errno;
delete[] voltage;
return;
}
}