timer

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package timer provides interface to manage nRF5 timers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmode

type Bitmode uint8
const (
	Bit8  Bitmode = 1
	Bit16 Bitmode = 0
	Bit24 Bitmode = 2
	Bit32 Bitmode = 3
)

type Event

type Event byte

func COMPARE

func COMPARE(n int) Event

COMPARE returns Compare event for CCn register.

type Mode

type Mode uint8
const (
	Timer           Mode = 0
	Counter         Mode = 1
	LowPowerCounter Mode = 2
)

type Periph

type Periph struct {
	te.Regs
	// contains filtered or unexported fields
}

Periph represents timer/counter peripheral.

func TIMER

func TIMER(n int) *Periph

TIMER returns n-th instance of TIMER peripheral or nil if this instance is not implemented.

func (*Periph) Event

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

func (*Periph) LoadBITMODE

func (p *Periph) LoadBITMODE() Bitmode

func (*Periph) LoadCC

func (p *Periph) LoadCC(n int) uint32

LoadCC returns value of n-th Capture/Compare register. nRF51/nRF52 has 4/6 CC registers

func (*Periph) LoadMODE

func (p *Periph) LoadMODE() Mode

func (*Periph) LoadPRESCALER

func (p *Periph) LoadPRESCALER() int

func (*Periph) LoadSHORTS

func (p *Periph) LoadSHORTS() Shorts

func (*Periph) StoreBITMODE

func (p *Periph) StoreBITMODE(m Bitmode)

func (*Periph) StoreCC

func (p *Periph) StoreCC(n int, cc uint32)

StoreCC stores cc into n-th Capture/Compare register. nRF51/nRF52 has 4/6 CC registers

func (*Periph) StoreMODE

func (p *Periph) StoreMODE(m Mode)

func (*Periph) StorePRESCALER

func (p *Periph) StorePRESCALER(exp int)

StorePRESCALER sets prescaler to exp (freq = 16MHz/2^exp). Must only be used when the timer is stopped.

func (*Periph) StoreSHORTS

func (p *Periph) StoreSHORTS(s Shorts)

func (*Periph) Task

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

type Shorts

type Shorts uint32
const (
	COMPARE0_CLEAR Shorts = 1 << 0
	COMPARE1_CLEAR Shorts = 1 << 1
	COMPARE2_CLEAR Shorts = 1 << 2
	COMPARE3_CLEAR Shorts = 1 << 3
	COMPARE4_CLEAR Shorts = 1 << 4
	COMPARE5_CLEAR Shorts = 1 << 5
	COMPARE0_STOP  Shorts = 1 << 8
	COMPARE1_STOP  Shorts = 1 << 9
	COMPARE2_STOP  Shorts = 1 << 10
	COMPARE3_STOP  Shorts = 1 << 11
	COMPARE4_STOP  Shorts = 1 << 12
	COMPARE5_STOP  Shorts = 1 << 13
)

type Task

type Task byte
const (
	START Task = 0 // Start Timer.
	STOP  Task = 1 // Stop Timer.
	COUNT Task = 2 // Increment Timer (Counter mode only).
	CLEAR Task = 3 // Clear timer.
)

func CAPTURE

func CAPTURE(n int) Task

CAPTURE returns Capture task for CCn register.

Jump to

Keyboard shortcuts

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