npm

bossajs

0.9.0 • Public • Published

Bossa.js

Node bindings for Bossa, the open source Atmel SAM-BA DFU utility.

Installing

yarn add bossajs

Or from source:

git submodule update --init
yarn rebuild

Usage

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)

    opts is 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 size bytes starting from offset.

  • write(buffer, offset) -> Promise

    Write buffer to device starting from offset.

  • verify(buffer, offset) -> Promise

    Verify the data at offset is equivalent to buffer.

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 test

Readme

Keywords

none

Package Sidebar

Install

npm i bossajs

Weekly Downloads

0

Version

0.9.0

License

BSD-3-Clause

Unpacked Size

1.05 MB

Total Files

101

Last publish

Collaborators

  • dmadeley