i2c

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: GPL-3.0, 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 {
	// 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) Copy

func (tr *Trace) Copy() []float32

Copy makes a copy of the activity trace.

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) 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