0.9.0 • Published 7 years ago
bossajs v0.9.0
Bossa.js
Node bindings for Bossa, the open source Atmel SAM-BA DFU utility.
Installing
yarn add bossajsOr from source:
git submodule update --init
yarn rebuildUsage
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();
}API Documentation
Constructor
Bossa()/Bossa(opts)optsis an optional object of options.{ debug: boolean, }
Methods
connect(port)->PromiseConnect to the device.
close()->PromiseClose the connection.
info()->Promise<Object>Return info about the device.
read(offset, size)->Promise<Buffer>Read
sizebytes starting fromoffset.write(buffer, offset)->PromiseWrite
bufferto device starting fromoffset.verify(buffer, offset)->PromiseVerify the data at
offsetis equivalent tobuffer.
Testing
Testing is possible on a development board running the SAM-BA bootloader, e.g. the Atmel SAMD21 Xplained Pro.
PORT=/dev/tty.usb1 yarn test0.9.0
7 years ago