Module grisp_gpio

GRiSP API for configuration of pins.

Description

GRiSP API for configuration of pins

Data Types

pin()

pin() = integer() | gpio1_1 | gpio1_2 | gpio1_3 | gpio1_4 | gpio2_1 | gpio2_2 | gpio2_3 | gpio2_4 | led1_r | led1_g | led1_b | led2_r | led2_g | led2_b | jumper_1 | jumper_2 | jumper_3 | jumper_4 | jumper_5 | spi1_pin7 | spi1_pin8 | spi1_pin9 | spi1_pin10 | ss1 | ss2 | uart_1_cts | uart_2_txd | uart_3_rxd | uart_4_rts

See the GRiSP Wiki for the physical to atom pin mappings.

pin_type()

pin_type() = periph_a | periph_b | periph_c | periph_d | input | output_0 | output_1

slot()

slot() = gpio1 | gpio2 | spi1 | spi2

Function Index

clear/1Sets a pin to false.
configure/2Equivalent to configure(Pin, Type, [default]).
configure/3Configure pin type.
configure_slot/2Configure slot.
get/1Gets the value of a pin.
set/1Sets a pin to true.

Function Details

clear/1

clear(Pin::pin()) -> any()

Sets a pin to false.

Example

Turn off the red led of led_1 with:
 1> grisp_gpio:clear(led1_r).
 <<>>

configure/2

configure(Pin::pin(), Type::pin_type()) -> any()

Equivalent to configure(Pin, Type, [default]).

configure/3

configure(Pin::pin(), Type::pin_type(), Attr::[default]) -> any()

Configure pin type.

configure_slot/2

configure_slot(Slot::slot(), Config::{T1::pin_type(), T2::pin_type(), T3::pin_type(), T4::pin_type()} | disable_cs | enable_cs) -> ok

Configure slot.

The GPIO slots can be configured with {T1, T2, T3, T4} and the SPI slots allow the configuration disable_cs | enable_cs.

get/1

get(Pin::pin()) -> any()

Gets the value of a pin.

Example

To see whether the red led of led_1 is on use:
 2> grisp_gpio:get(led1_r).
 false
In this case it was off.

set/1

set(Pin::pin()) -> any()

Sets a pin to true.

Example

Turn on the red led of led_1 with:
 3> grisp_gpio:set(led1_r).
 <<>>


Generated by EDoc