te

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package provides Task and Event types that represent peripheral task and event registers.

Index

Constants

View Source
const NumChan = numChan

NumChan is the number of channels available to the application. It does not include pre-programmed channels.

View Source
const NumChanGroup = numChanGroup

NumChanGroup is the number of implemented channel groups (4 in case of nRF51, 6 in case of nRF52+).

Variables

This section is empty.

Functions

This section is empty.

Types

type Chan added in v0.1.3

type Chan int8

Chan represents PPI/DPPI channel.

func AllocChan added in v0.1.3

func AllocChan() Chan

AllocChan returns first unused PPI/DPPI channel. It returns negative number if all channels are in use.

func (Chan) Disable added in v0.1.3

func (c Chan) Disable()

Enable atomically disables channel c.

func (Chan) Enable added in v0.1.3

func (c Chan) Enable()

Enable atomically enables channel c.

func (Chan) Enabled added in v0.1.3

func (c Chan) Enabled() bool

Enabled reports whether channel c is enabled.

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) Mask added in v0.1.3

func (c Chan) Mask() Channels

Mask returns a Channels bitfield with c bit set.

type ChanGroup added in v0.1.3

type ChanGroup int8

ChanGroup repersents PPI channel group.

func AllocChanGroup added in v0.1.3

func AllocChanGroup() ChanGroup

AllocChanGroup returns first unused PPI channel group. It returns negative number if there is no free channel group.

func (ChanGroup) Channels added in v0.1.3

func (g ChanGroup) Channels() Channels

Channels returns channels that belongs to the group g.

func (ChanGroup) DIS added in v0.1.3

func (g ChanGroup) DIS() ChanGroupTask

DIS returns task that can be used to disable channel group g.

func (ChanGroup) EN added in v0.1.3

func (g ChanGroup) EN() ChanGroupTask

EN returns task that can be used to enable channel group g.

func (ChanGroup) Free added in v0.1.3

func (g ChanGroup) Free()

Free returns group to the pool of unused channel groups.

func (ChanGroup) SetChannels added in v0.1.3

func (g ChanGroup) SetChannels(c Channels)

SetChannels sets channels that belongs to the group g.

type ChanGroupTask added in v0.1.3

type ChanGroupTask uint8

func (ChanGroupTask) Task added in v0.1.3

func (t ChanGroupTask) Task() *Task

type Channels added in v0.1.3

type Channels uint32

Channels is a bitfield that represents multiple PPI/DPPI channels.

func Enabled added in v0.1.3

func Enabled() Channels

Enabled returns enabled channels.

func (Channels) Disable added in v0.1.3

func (c Channels) Disable()

Disable atomically disables channels.

func (Channels) Enable added in v0.1.3

func (c Channels) Enable()

Enable atomically enables channels.

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event represents a peripheral register that is used to record an occurence of one kind of events.

func (*Event) Chan added in v0.1.3

func (r *Event) Chan() (c Chan, en bool)

Chan returns the PPI/DPPI channel the event is connected to and reports whether publishing events on this channel is enabled. In case of nRF52- which PPI peripheral allows to connect one event to multiple PPI channels Chan returns the first channel found.

func (*Event) Clear

func (r *Event) Clear()

Clear clears the event flag in r

func (*Event) DisableIRQ

func (r *Event) DisableIRQ()

DisableIRQ disables generating of interrupts by events recorded in r.

func (*Event) DisablePPI

func (r *Event) DisablePPI()

DisablePPI disable routing the event to PPI. Only RTC supports this method.

func (*Event) EnableIRQ

func (r *Event) EnableIRQ()

EnableIRQ enables generating of interrupt by events recorded in r.

func (*Event) EnablePPI

func (r *Event) EnablePPI()

EnablePPI enables routing the event to PPI. Only RTC supports this method.

func (*Event) IRQ

func (r *Event) IRQ() rtos.IRQ

IRQ returns NVIC IRQ number associated to the peripheral.

func (*Event) IRQEnabled

func (r *Event) IRQEnabled() bool

IRQEnabled reports whether the events recorded in r generete interrupts.

func (*Event) IsSet

func (r *Event) IsSet() bool

IsSet reports whether any event has been generated since the last clearing of r.

func (*Event) PPIEnabled

func (r *Event) PPIEnabled() bool

PPIEnabled reports whether the event has enabled routing to PPI. Only RTC supports this method.

func (*Event) SetChan added in v0.1.3

func (r *Event) SetChan(c Chan, en bool)

SetChan connects the event to the PPI/DPPI channel. En allows to enable or disable publishing events on connected channel.

SetChan allows to write portable code that can work with PPI (nRF52-) and DPPI (nRF53) but has some limitations in case of PPI:

- you cannot connect one event to multiple channels,

  • if en is false the channel is set to -1 which as a result disconnects the event from all channels.

The one advantage of PPI over DPPI is its ablility to conect one event to multiple channels. If you need this feature use SetEEP from ppi package.

type EventMask

type EventMask uint32

EventMask is a bitmask that can represent multiple events of one peripheral.

const EvAll EventMask = 0xFFFFFFFF

EvAll represents all 32 possible events of one peripheral.

type Regs

type Regs struct {
	// contains filtered or unexported fields
}

Regs should be the first field on any Periph struct. It takes 0x400 bytes of memory.

func (*Regs) DisableIRQ

func (r *Regs) DisableIRQ(mask EventMask)

DisableIRQ disables generating interrupts by events specified by mask

func (*Regs) DisablePPI

func (r *Regs) DisablePPI(mask EventMask)

DisablePPI disables routing to PPI for events specified by mask. Only RTC supports this method.

func (*Regs) EnableIRQ

func (r *Regs) EnableIRQ(mask EventMask)

EnableIRQ enables generating interrupts by events specified by mask.

func (*Regs) EnablePPI

func (r *Regs) EnablePPI(mask EventMask)

EnablePPI enables routing to PPI for events specified by mask. Only RTC supports this method.

func (*Regs) Event

func (r *Regs) Event(n int) *Event

Task returns a pointer to n-th event register.

func (*Regs) IRQ

func (r *Regs) IRQ() rtos.IRQ

IRQ returns the IRQ number in NVIC associated to the peripheral.

func (*Regs) IRQEnabled

func (r *Regs) IRQEnabled() EventMask

IRQEnabled returns EventMask that lists events that have enabled generating interrupts..

func (*Regs) LoadSHORTS

func (r *Regs) LoadSHORTS() uint32

LoadSHORTS returns value of the SHORTS register.

func (*Regs) PPIEnabled

func (r *Regs) PPIEnabled() EventMask

PPIEnabled returns EventMask that lists events that have enabled routing to PPI. Only RTC supports this method.

func (*Regs) StoreSHORTS

func (r *Regs) StoreSHORTS(s uint32)

StoreSHORTS stores s to the SHORTS register.

func (*Regs) Task

func (r *Regs) Task(n int) *Task

Task returns a pointer to n-th task register.

type Task

type Task struct {
	// contains filtered or unexported fields
}

Task represents a peripheral register that is used to trigger events.

func (*Task) Chan added in v0.1.3

func (r *Task) Chan() (c Chan, en bool)

Chan returns the PPI/DPPI channel the task is connected to and reports whether subscription of events on this channel is enabled. In case of nRF52- which PPI peripheral allows to connect task to multiple PPI channels Chan returns the first channel found.

func (*Task) SetChan added in v0.1.3

func (r *Task) SetChan(c Chan, en bool)

SetChan connects the task to the PPI/DPPI channel. En allows to enable or disable subscription of events on connected channel.

SetChan allows to write portable code that can work with PPI (nRF52-) and DPPI (nRF53) but has some limitations in case of PPI:

- you can connect only up to two tasks to the same channel,

  • if en is false the channel is set to -1 which as a result disconnects the task from all channels.

The one advantage of PPI over DPPI is ablility to conect one task to multiple channels. If you need this feature use SetTEP from ppi package.

func (*Task) Trigger

func (r *Task) Trigger()

Trigger starts action corresponding to task.

Jump to

Keyboard shortcuts

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