Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Latest commit

 

History

History

board

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Board API

The Board API provides low level interfaces for I/O operations:

Hardware pin names are usually marked on the circuit boards. However, operating systems, such as Zephyr define a pin name mapping that is consistent across the boards supported by the OS. This API supports both board and OS defined namespaces. In this API, Pin names are opaque to the application. Applications can open a given pin with a pin name that is either a string or a number, in either board or OS namespace. Implementations encapsulate the pin mapping. Also, the API exposes board name, OS name (including OS version) and API version for all board APIs.

The supported board namespaces are listed in this directory:

For the supported OS pin namespace, consult the documentation of the implementation and its underlying OS documentation.

The full Web IDL definition for Board and IO APIs can be found in webidl.md.

The Board API object

The API entry point is a Board object provided by an implementation (module). When requiring "board", the following steps are run:

  • If there is no permission for using the functionality, throw SecurityError.
  • If the Board functionality is not supported on the board, throw "NotSupportedError".
  • Let board be the Board API object, and initialize it by fetching board name and OS name. Return board.
var board = require("board");

console.log("Connected to board: " + board.name + " running " + board.os);

If the functionality is not supported by the platform, require should throw NotSupportedError.

The Board interface

Represents a hardware circuit board such as Arduino 101.

Property Type Optional Default value Represents
name String no undefined board name
os String no undefined OS name
apiVersion String no versions.board in package.json API version
Event name Event callback argument
error Error object

The name property is read-only, and provides the board name.

The os property is read-only, and provides the underlying operating system name.

The apiVersion property is read-only, and provides the provides the Board API version, as specified in the versions.board property of package.json.

Board errors are represented as augmented Error objects. The following Error names are used for signaling issues:

  • BoardDisconnectError
  • BoardTimeoutError
  • BoardIOError.