eensy/gpio

Types

pub type Direction {
  Input
  Output
  OutputOd
}

Constructors

  • Input
  • Output
  • OutputOd
pub type Level {
  Low
  High
}

Constructors

  • Low
  • High

Pin

opaque
pub opaque type Pin

PinActor

opaque
pub opaque type PinActor(model, msg)

Functions

pub fn digital_read(pin: Int) -> Result(Level, Nil)

Read from gpio pin

pub fn digital_write(pin: Int, level: Level) -> Result(Int, Nil)

Write to gpio pin

pub fn do_start() -> Result(Int, Nil)

Start gpio

pub fn init(pin: Int) -> Nil

Init pin

pub fn pin(
  level level: Level,
  pull pull: Pull,
  port port: Int,
  direction direction: Direction,
  update update: Option(fn(Level) -> Nil),
) -> Pin
pub fn read(actor: PinActor(a, b)) -> Result(Pin, Nil)
pub fn set_pin_mode(
  pin: Int,
  direction: Direction,
) -> Result(Int, Nil)

Set gpio pin direction

pub fn set_pin_pull(pin: Int, pull: Pull) -> Result(Nil, Nil)

Set pin pull

pub fn start(pin: Pin) -> Result(PinActor(a, b), StartError)
pub fn sync(actor: PinActor(a, b)) -> Nil
pub fn write(actor: PinActor(a, b), value: Level) -> Nil
Search Document