timer

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package timer represents the timer part of the RIOT (the T in RIOT).

Index

Constants

View Source
const MaskTIMINT = 0b11000000

MaskTIMINT defines the bits of TIMINT that are actually used.

Variables

This section is empty.

Functions

This section is empty.

Types

type Divider added in v0.16.0

type Divider int

Divider indicates how often (in CPU cycles) the timer value decreases. the following rules apply:

  • set to 1, 8, 64 or 1024 depending on which address has been written to by the CPU
  • is used to reset the cyclesRemaining
  • is changed to 1 once value reaches 0
  • is reset to its initial value of 1, 8, 64, or 1024 whenever INTIM is read by the CPU
const (
	TIM1T  Divider = 1
	TIM8T  Divider = 8
	TIM64T Divider = 64
	T1024T Divider = 1024
)

List of valid Divider values.

func (Divider) String added in v0.16.0

func (in Divider) String() string

type Timer

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

Timer implements the timer part of the PIA 6532 (the T in RIOT).

func NewTimer

func NewTimer(env *environment.Environment, mem chipbus.Memory) *Timer

NewTimer is the preferred method of initialisation of the Timer type.

func (*Timer) PeekField added in v0.16.0

func (tmr *Timer) PeekField(fld string) interface{}

PeekINTIM pokes a new value into the INTIM register. Same as peeking the INTIM register on the cpubus - provided here for convenience.

Supported fields:

intim (uint8)
timint (uint8)
ticksRemainging (int)
divider (timer.Divider)

func (*Timer) Plumb added in v0.7.1

func (tmr *Timer) Plumb(mem chipbus.Memory)

Plumb a new ChipBus into the Timer.

func (*Timer) PokeField added in v0.16.0

func (tmr *Timer) PokeField(fld string, v interface{})

PokeINTIM pokes a new value into the INTIM register. Same as poking the INTIM register on the cpubus - provided here for convenience.

Fields as described for PeekField().

func (*Timer) Reset added in v0.7.1

func (tmr *Timer) Reset()

Reset timer to an initial state.

func (*Timer) Snapshot added in v0.7.1

func (tmr *Timer) Snapshot() *Timer

Snapshot creates a copy of the RIOT Timer in its current state.

func (*Timer) Step

func (tmr *Timer) Step()

Step timer forward one cycle.

func (*Timer) String

func (tmr *Timer) String() string

func (*Timer) Update

func (tmr *Timer) Update(data chipbus.ChangedRegister) bool

Update checks to see if ChipData applies to the Timer type and updates the internal timer state accordingly.

Returns true if ChipData has *not* been serviced.

Jump to

Keyboard shortcuts

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