bossajs
1.0.0
Bossa的节点绑定,开源Atmel Sam-BA DFU实用程序。
目前仅在MacOS上工作。其他平台即将推出。
yarn add bossajs
或来自来源:
git submodule update --init
yarn rebuild
仅支持win32 。
当超级用户安装Python和MSV构建工具:
npm install --global --production windows-build-tools
然后将该应用构建为:
npm config set arch ia32
git submodule update --init
node-gyp configure --arch x86
node-gyp rebuild
import { Bossa } from 'bossaja' ;
const PORT = '/dev/tty.usb1' ;
const bossa = new Bossa ( ) ;
await bossa . connect ( PORT ) ;
try {
const buffer = Buffer . from ( [ 0xd , 0xe , 0xa , 0xd , 0xb , 0xe , 0xe , 0xf ] ) ;
await bossa . write ( buffer , 0x2000 ) ;
await bossa . verify ( buffer , 0x2000 ) ;
} finally {
await bossa . close ( ) ;
} Bossa() / Bossa(opts)
opts是选项的可选对象。
{
debug : boolean ,
}connect(port) - > Promise
连接到设备。
close() - > Promise
关闭连接。
info() - > Promise<Object>
返回有关设备的信息。
read(offset, size) - > Promise<Buffer>
读取从offset开始的size字节。
write(buffer, offset) - > Promise
将buffer从offset开始。
verify(buffer, offset) - > Promise
验证offset时的数据等效于buffer 。
来自EventEmitter的继承。
progress - > (progress, total)
当前操作的进度更新(在设备页面中)。
可以在运行SAM-BA引导程序的开发板上进行测试,例如ATMEL SAMD21 XPLAINE PRO。
PORT=/dev/tty.usb1 yarn test
Bossa.js是©2019,运动表演跟踪。它是根据BSD 3范围许可发布的,您可以在LICENSE中找到该许可证。
Bossa是©2011-2016,Shumatech。它也是根据BSD 3范围许可发布的,您可以在extern/bossa/LICENSE中找到该许可证。