libbox0绑定
box0的Python项目详细描述
Pybox0
libbox0的python绑定
依赖关系
- CFFI
- 努比
在C中:
- libbox0
安装
$python setup.py生成 $python setup.py安装
配置
在local.properties中 _ binding.py,构建路径变量以指示在何处查找头和库
用法
在test/和example中有很多演示代码/ 打开设备和模块并对其执行操作的通用方法
import box0
# open any supported usb device
dev = box0.usb.open_supported()
# open the dio0 module (assuming the device support it)
# if you need to iterate over the supported modules using dev
dio0 = dev.dio(0)
# Prepare for basic mode (basic functionality)
dio0.basic_prepare()
# set to output mode
dio0.dir(0, dio0.OUTPUT)
# set value of pin 0
dio0.value(0, dio0.LOW)
#disable hiz mode of pin 0,
# note: all pins are in hiz mode right after opening (for protection)
dio0.hiz(0, dio0.DISABLE)
# start the basic mode
dio0.basic_start()
# wait
try:
while True:
time.sleep(.5)
except:
pass
# Stop basic mode
dio0.basic_stop()
# close resources
dio0.close()
dev.close()
注
pybox0使用与libbox0相同的样式,并且 libbox0的许多文档都适用于pybox0
int b0_<section>_<func>(<section-object>, params....)
在Pybox0中: 当int val<;0时出现异常(resultexception),而不是int 因此,现在返回值用于其他任务
"b0" tag is now replace with "box0." as python have concept of modules
<section> is replace with files.
for example: <section> = "device" , theirs device.py
and it contain Device.py
<func> these are under-scored style name in libbox0
in pyBox0, camelcasing is used
for example b0_usb_open_supported() is box0.usb.open_supported()
most of the library assumes numpy array.
numpy is good and you should always use numpy with pyBox0 as
it much better in long run
获取帮助
进入irc freenode上的box0 在https://gitlab.com/madresistor/pyBox0
上报告错误参与
进入irc freenode上的box0 在https://gitlab.com/madresistor/pyBox0
上报告错误许可证
GNU/GPLv3或更高版本(请参阅复制)
学分和参考资料
维修人员
库尔德普·辛格·达卡kuldeep@madresistor.com