Module grisp

GRiSP Runtime API.

Description

GRiSP Runtime API.

This module contains the main API for working with the GRiSP runtime.

Data Types

device()

abstract datatype: device()

An object representing the running device.

slot()

slot() = atom()

Designates a hardware slot on the GRiSP board. This should be the lower case version of the slot names printed on the board itself.

E.g. spi1 for SPI1 or gpio2 for GPIO2.

Function Index

add_device/2See add_device/3.
add_device/3Add and start the device instance for a connected device.
device/1Return the device instance at the specified slot (if any).
devices/0List all running devices instances.
remove_device/1Remove and stop the device instance for a device.

Function Details

add_device/2

add_device(Slot::slot(), Driver::module()) -> device()

Equivalent to add_device(Slot, Driver, #{}).

See add_device/3.

add_device/3

add_device(Slot::slot(), Driver::module(), Opts::map()) -> device()

Add and start the device instance for a connected device.

This starts a device driver instance of the specified module and connected to the specified slot. No hardware validation is possible to check that the correct device is actually connected, but many drivers run an initialization check for specific device IDs and other similar characteristics which will fail if no device or the wrong device is connected.

The set of options is passed to the driver and is specific to each driver.

Returns the created device instance.

device/1

device(Slot::slot()) -> device()

Return the device instance at the specified slot (if any).

Errors

devices/0

devices() -> [device()]

List all running devices instances.

Returns a list of all running device instances as device objects.

remove_device/1

remove_device(Device::device()) -> ok

Remove and stop the device instance for a device.

This will gracefully stop the device instance and remove it from the runtime. This includes running any termination code inside the device driver module (see the specific driver module for your device for more information).


Generated by EDoc