mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
71 lines
1.5 KiB
Plaintext
71 lines
1.5 KiB
Plaintext
|
|
/*
|
|
How to use libsigrok4DSL
|
|
*/
|
|
|
|
1.Complie
|
|
cd libsigrok4DSL
|
|
cmake .
|
|
make
|
|
make install
|
|
|
|
2.Example
|
|
|
|
#include <libsigrok.h>
|
|
#include <stdio.h>
|
|
|
|
void event_cb(int ev)
|
|
{
|
|
|
|
}
|
|
|
|
void data_cb(pack p){
|
|
|
|
}
|
|
|
|
void main()
|
|
{
|
|
sr_init();
|
|
|
|
const char *res_path = "c:\DSView\res"
|
|
sr_set_firmware_resource_dir(res_path);
|
|
|
|
sr_disable_data_cache(flag); // don't manager data
|
|
sr_set_datafeed_callback(data_cb); //only transfers data
|
|
sr_set_event_callback(event_cb);
|
|
|
|
while(true){
|
|
if (getche() == 'x'){
|
|
//exit app
|
|
break;
|
|
}
|
|
}
|
|
|
|
sr_exit();
|
|
}
|
|
|
|
|
|
/* api
|
|
|
|
sr_lib_init();
|
|
|
|
sr_lib_exit();
|
|
|
|
sr_set_firmware_resource_dir();
|
|
|
|
sr_set_datafeed_callback(data_cb);
|
|
|
|
sr_set_event_callback(event_cb);
|
|
|
|
sr_update_device_list();
|
|
sr_get_device_list();
|
|
|
|
sr_get_device_channels();
|
|
|
|
//当断开设备时,如果属当前设备且存在数据,不能自动切换到其它设备,须提示用户保存数据,再自动切换当前设备
|
|
//当接入新设备时,如果当前设备有数据,须提示用户保存数据,再扫描设备列表
|
|
//加载文件时,由外部判断当前硬件是否存在数据,以便提示用户保存,再执行加载文件,并通知用户更新列表
|
|
//扫描设备列表会自动切换到最新设备,并通知用户更新列表
|
|
|
|
*/
|