Documentation
¶
Overview ¶
Package provides Task and Event types that represent peripheral task and event registers.
Index ¶
- Constants
- type Chan
- type ChanGroup
- type ChanGroupTask
- type Channels
- type Event
- func (r *Event) Chan() (c Chan, en bool)
- func (r *Event) Clear()
- func (r *Event) DisableIRQ()
- func (r *Event) DisablePPI()
- func (r *Event) EnableIRQ()
- func (r *Event) EnablePPI()
- func (r *Event) IRQ() rtos.IRQ
- func (r *Event) IRQEnabled() bool
- func (r *Event) IsSet() bool
- func (r *Event) PPIEnabled() bool
- func (r *Event) SetChan(c Chan, en bool)
- type EventMask
- type Regs
- func (r *Regs) DisableIRQ(mask EventMask)
- func (r *Regs) DisablePPI(mask EventMask)
- func (r *Regs) EnableIRQ(mask EventMask)
- func (r *Regs) EnablePPI(mask EventMask)
- func (r *Regs) Event(n int) *Event
- func (r *Regs) IRQ() rtos.IRQ
- func (r *Regs) IRQEnabled() EventMask
- func (r *Regs) LoadSHORTS() uint32
- func (r *Regs) PPIEnabled() EventMask
- func (r *Regs) StoreSHORTS(s uint32)
- func (r *Regs) Task(n int) *Task
- type Task
Constants ¶
const NumChan = numChan
NumChan is the number of channels available to the application. It does not include pre-programmed channels.
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.
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) 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
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.
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
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) 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) IRQEnabled ¶
IRQEnabled reports whether the events recorded in r generete interrupts.
func (*Event) IsSet ¶
IsSet reports whether any event has been generated since the last clearing of r.
func (*Event) PPIEnabled ¶
PPIEnabled reports whether the event has enabled routing to PPI. Only RTC supports this method.
func (*Event) SetChan ¶ added in v0.1.3
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 ¶
DisableIRQ disables generating interrupts by events specified by mask
func (*Regs) DisablePPI ¶
DisablePPI disables routing to PPI for events specified by mask. Only RTC supports this method.
func (*Regs) EnablePPI ¶
EnablePPI enables routing to PPI for events specified by mask. Only RTC supports this method.
func (*Regs) IRQEnabled ¶
IRQEnabled returns EventMask that lists events that have enabled generating interrupts..
func (*Regs) LoadSHORTS ¶
LoadSHORTS returns value of the SHORTS register.
func (*Regs) PPIEnabled ¶
PPIEnabled returns EventMask that lists events that have enabled routing to PPI. Only RTC supports this method.
func (*Regs) StoreSHORTS ¶
StoreSHORTS stores s to the SHORTS 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
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
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.