Buttons

Button Support

Atom relies heavily on button inputs, making them the most important input method. MagiScript supports button press and release events from three devices:

  • Atom, which has 12 buttons,
  • PeekSmith 3, which has 3 buttons, and
  • SB Watch, which has a single button (the crown).

Atom Hardware

Atom has 12 buttons, numbered from 0 to 11. They are in 4 rows, and there are 3 buttons per row.

Currently, there is no default layout or behavior associated with them, but the system reports button press-related events.

Atom button layout, 12 buttons in 4 rows

Events

MagiScript is receiving events via the onEvent function. The event structure is the same for the buttons:

  • value: a string with the button ID
  • type: "press", "release" strings
  • source: "atom:button", "ps:button", "sbwatch:button"
function onEvent(e) {
    console.log(e.value, e.type, e.source);
}

Event Types

Different devices have different support.

  • Atom supports press, release, click, longpress and repeatpress events.
  • PeekSmith has press and release events only (for now, maybe a later firmware will introduce the same events as Atom).
  • SB Watch supports press, release, click, longpress and repeatpress events, however sometimes a click event is coming with no button press (it is a bug, which might be fixed in the future).
cross
Select your currency