gpiote

package
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NumChan = numChan

NumChan is the number of implemented GPIOTE channels (4 in case of nRF51, 8 in case of nRF52).

Variables

This section is empty.

Functions

func DisableIRQ

func DisableIRQ(mask te.EventMask)

func EnableIRQ

func EnableIRQ(mask te.EventMask)

func IRQ

func IRQ() rtos.IRQ

func IRQEnabled

func IRQEnabled() te.EventMask

Types

type Chan

type Chan int8

Chan represents GPIOTE channel.

func Alloc added in v0.4.0

func Alloc() Chan

Alloc returns an unused GPIOTE channel. It returns negative number if there is no free channel.

func (Chan) CLR

func (c Chan) CLR() Task

CLR returns task for clear pin associated with channel c. nRF52.

func (Chan) Config

func (c Chan) Config() (gpio.Pin, Config)

Config returns current configuration of channel c.

func (Chan) Free added in v0.1.3

func (c Chan) Free()

Free disables channel and returns it to the pool of unused channels.

func (Chan) IN

func (c Chan) IN() Event

IN returns event generated from pin associated with channel c.

func (Chan) OUT

func (c Chan) OUT() Task

OUT returns task for writing to pin associated with channel c.

func (Chan) SET

func (c Chan) SET() Task

SET returns task for set pin associated with channel c. nRF52.

func (Chan) Setup

func (c Chan) Setup(pin gpio.Pin, cfg Config)

Setup setups channel c to use pin and cfg configuration.

type Config

type Config uint32
const (
	ModeNC    Config = 0 // Disconnect pin from GPIOTE module.
	ModeEvent Config = 1 // Pin generates IN event.
	ModeTask  Config = 3 // Pin controlled by OUT, SET, CLR task.

	PolarityNone   Config = 0 << 16 // No task on pin, no event from pin.
	PolarityLoToHi Config = 1 << 16 // OUT sets pin, IN when rising edge.
	PolarityHiToLo Config = 2 << 16 // OUT clears pin, IN when falling edge.
	PolarityToggle Config = 3 << 16 // OUT toggles pin, IN when any change.

	OutInitLow  Config = 0       // Low initial output value.
	OutInitHigh Config = 1 << 20 // High initial output value.
)

type Event

type Event uint8
const PORT Event = 31 // From multiple input pins with SENSE mechanism enabled.

func (Event) Event

func (e Event) Event() *te.Event

type Task

type Task uint8

func (Task) Task

func (t Task) Task() *te.Task

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL