power

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package power provides interface to the power managemnt peripheral.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearRAMPOWER

func ClearRAMPOWER(n int, mask RAMPower)

ClearRAMPOWER sets off power configuration of RAM block n according to mask (nRF52).

func ClearRESETREAS

func ClearRESETREAS(mask ResetReas)

ClearRESETREAS clears reset reason bits specified by mask.

func DisableIRQ

func DisableIRQ(mask te.EventMask)

DisableIRQ disables generating interrupts by events specified by mask

func EnableIRQ

func EnableIRQ(mask te.EventMask)

EnableIRQ enables generating interrupts by events specified by mask.

func GPREGRET

func GPREGRET(n int) *mmio.U32

GPREGRET returns pointer to n-th general purpose retention register. nRF51 supports one, nRF52 supports two. Only lowest 8 bits can be used.

func IRQ

func IRQ() rtos.IRQ

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

func IRQEnabled

func IRQEnabled() te.EventMask

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

func LoadDCDCEN

func LoadDCDCEN() bool

LoadDCDCEN reports wheter the DC/DC converter is enabled.

func LoadRESET

func LoadRESET() bool

LoadRESET reports wheter pin reset is enabled in debug mode (nRF51).

func SetRAMPOWER

func SetRAMPOWER(n int, mask RAMPower)

SetRAMPOWER sets on power configuration of RAM block n according to mask (nRF52).

func SetSYSTEMOFF

func SetSYSTEMOFF()

SetSYSTEMOFF sets system into OFF state.

func StoreDCDCEN

func StoreDCDCEN(en bool)

StoreDCDCEN enables/disables DC/DC converter.

func StorePOFCON

func StorePOFCON(pofcon POFCon)

StorePOFCON sets power failure comparator configuration.

func StoreRAMON

func StoreRAMON(on, retain RAMBlocks)

StoreRAMON sets configuration of four RAM blocks. On lists RAM blocks that should be kept on in system ON mode, retain lists RAM blocks that should be retained in system off mode.

func StoreRAMPOWER

func StoreRAMPOWER(n int, val RAMPower)

LoadRAMPOWER power configuration of RAM block n (nRF52).

func StoreRESET

func StoreRESET(pinreset bool)

StoreRESET enables/disables pin reset in debug mode (nRF51).

Types

type Event

type Event byte
const (
	POFWARN    Event = 2 // Power failure warning.
	SLEEPENTER Event = 5 // CPU entered WFI/WFE sleep (nRF52).
	SLEEPEXIT  Event = 6 // CPU exited WFI/WFE sleep (nRF52).
)

func (Event) Event

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

type POFCon

type POFCon byte

POFCon is power failure comparator configuration.

const (
	POF       POFCon = 1 << 0  // Set if power failure comparoator is enabled.
	THRESHOLD POFCon = 15 << 1 // Power failure comparator threshold mask.

	V2_1 POFCon = 0 << 1 // Threshold: 2.1 V (nrF51).
	V2_3 POFCon = 1 << 1 // Threshold: 2.3 V (nrF51).
	V2_5 POFCon = 2 << 1 // Threshold: 2.5 V (nrF51).
	V2_7 POFCon = 3 << 1 // Threshold: 2.5 V (nrF51).

	V17 POFCon = 4 << 1  // Threshold: 1.7 V (nRF52).
	V18 POFCon = 5 << 1  // Threshold: 1.8 V (nRF52).
	V19 POFCon = 6 << 1  // Threshold: 1.9 V (nRF52).
	V20 POFCon = 7 << 1  // Threshold: 2.0 V (nRF52).
	V21 POFCon = 8 << 1  // Threshold: 2.1 V (nRF52).
	V22 POFCon = 9 << 1  // Threshold: 2.2 V (nRF52).
	V23 POFCon = 10 << 1 // Threshold: 2.3 V (nRF52).
	V24 POFCon = 11 << 1 // Threshold: 2.4 V (nRF52).
	V25 POFCon = 12 << 1 // Threshold: 2.5 V (nRF52).
	V26 POFCon = 13 << 1 // Threshold: 2.6 V (nRF52).
	V27 POFCon = 14 << 1 // Threshold: 2.7 V (nRF52).
	V28 POFCon = 15 << 1 // Threshold: 2.8 V (nRF52).
)

func LoadPOFCON

func LoadPOFCON() POFCon

LoadPOFCON returns power failure comparator configuration.

type RAMBlocks

type RAMBlocks byte

RAMBlocks is a bitfield that describes RAM blocks.

const (
	RAMBLOCK0 RAMBlocks = 1 << 0 // RAM block 0.
	RAMBLOCK1 RAMBlocks = 1 << 1 // RAM block 1.
	RAMBLOCK2 RAMBlocks = 1 << 2 // RAM block 2.
	RAMBLOCK3 RAMBlocks = 1 << 3 // RAM block 3.
)

func LoadRAMON

func LoadRAMON() (on, retain RAMBlocks)

LoadRAMON returns configuration of four RAM blocks. On lists RAM blocks that are kept on in system ON mode, retain lists RAM blocks that should be retained when RAM block is off.

func LoadRAMSTATUS

func LoadRAMSTATUS() RAMBlocks

LoadRAMSTATUS returns bitfield that lists RAM blocks that are powered up.

type RAMPower

type RAMPower uint32

RAMPower describes power configuration for two sections of RAM block (nRF52).

const (
	S0POWER     RAMPower = 1 << 0  // Keep RAM section S0 on in system on mode.
	S1POWER     RAMPower = 1 << 1  // Keep RAM section S1 on in system on mode.
	S0RETENTION RAMPower = 1 << 16 // Keep retention of S0 when RAM is off.
	S1RETENTION RAMPower = 1 << 17 // Keep retention of S1 when RAM is off.
)

func LoadRAMPOWER

func LoadRAMPOWER(n int) RAMPower

LoadRAMPOWER returns power configuration of RAM block n (nRF52).

type ResetReas

type ResetReas uint32

ResetReas is a bitfield that describes reset reason.

const (
	RESETPIN ResetReas = 1 << 0  // Reset from pin-reset.
	DOG      ResetReas = 1 << 1  // Reset from watchdog.
	SREQ     ResetReas = 1 << 2  // Reset from AIRCR.SYSRESETREQ.
	LOCKUP   ResetReas = 1 << 3  // Reset from CPU lock-up.
	OFF      ResetReas = 1 << 16 // Wake up from OFF mode by GPIO DETECT.
	LPCOMP   ResetReas = 1 << 17 // Wake up from OFF mode by LPCOMP ANADETECT.
	DIF      ResetReas = 1 << 18 // Wake up from OFF mode by debug interface.
	NFC      ResetReas = 1 << 19 // Wake up from OFF mode by NFC.
)

func LoadRESETREAS

func LoadRESETREAS() ResetReas

LoadRESETREAS returns reset reason bits.

type Task

type Task byte
const (
	CONSTLAT Task = 30 // Enable constant latency mode.
	LOWPWR   Task = 31 // Enable low power mode (variable latency).
)

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