@dawee/bossajs v0.9.1
Bossa.js
Node bindings for Bossa, the open source Atmel SAM-BA DFU utility.
Currently only working on macOS. Other platforms coming soon.
Installing
yarn add bossajsOr from source:
git submodule update --init
yarn rebuildWindows
Only win32 is supported.
As a superuser install Python and MSVS build tools:
npm install --global --production windows-build-toolsThen build the app as:
npm config set arch ia32 
git submodule update --init
node-gyp configure --arch x86
node-gyp 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)->- Promise- Connect to the device. 
- close()->- Promise- Close the connection. 
- info()->- Promise<Object>- Return info about the device. 
- read(offset, size)->- Promise<Buffer>- Read - sizebytes starting from- offset.
- write(buffer, offset)->- Promise- Write - bufferto device starting from- offset.
- verify(buffer, offset)->- Promise- Verify the data at - offsetis equivalent to- buffer.
Events
Inherits from EventEmitter.
- progress->- (progress, total)- Progress update of the current operation (in device pages). 
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 testCopyright and License
Bossa.js is © 2019, Sports Performance Tracking. It is released under
a BSD 3-clause license, which you can find in LICENSE.
Bossa is © 2011-2016, ShumaTech. It is also released under a BSD
3-clause license, which you can find in extern/bossa/LICENSE.