i2c

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: 0 Imported by: 0

Documentation

Overview

Package i2c facilitates the reading of i2c data for the SaveKey (and AtariVox) peripherals.

information about i2c taken from:

https://learn.sparkfun.com/tutorials/i2c/all (13/09/2020)

Index

Constants

View Source
const (
	TraceHi = 1.0
	TraceLo = -1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Trace

type Trace struct {
	// a recent history of the i2c trace. wraps around at activityLength
	Activity []float32
	// contains filtered or unexported fields
}

Trace records the state of electrical line, whether it is high or low, and also whether the immediately previous state is also high or low.

moving from one state to the other is done with tick(bool) where a boolean value of true indicates a high voltage state.

the function hi2lo() returns true if the line voltage has moved from a high state to low state; and low2hi() returns true if the opposite is true.

deriving conditions from two traces is convenient. for example, give two traces A and B, a condition for event E might be:

 if A.hi() && B.lo2hi() {
		E()
 }

func NewTrace

func NewTrace() Trace

func (*Trace) Changed

func (tr *Trace) Changed() bool

func (*Trace) Falling

func (tr *Trace) Falling() bool

func (*Trace) Hi

func (tr *Trace) Hi() bool

func (*Trace) Lo

func (tr *Trace) Lo() bool

func (*Trace) Rising

func (tr *Trace) Rising() bool

func (*Trace) Snapshot added in v0.25.0

func (tr *Trace) Snapshot() *Trace

func (*Trace) Tick

func (tr *Trace) Tick(v bool)

Jump to

Keyboard shortcuts

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