shifter

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: BSD-3-Clause Imports: 2 Imported by: 50

Documentation

Overview

Package shifter is for 8bit shift register, most common are 74HC165 and 74165

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Pins []ShiftPin
	// contains filtered or unexported fields
}

Device holds the Pins.

func New

func New(numBits NumberBit, latch, clk, out machine.Pin) Device

New returns a new shifter driver given the correct pins.

func (*Device) Configure

func (d *Device) Configure()

Configure here just for interface compatibility.

func (*Device) GetShiftPin

func (d *Device) GetShiftPin(input int) ShiftPin

GetShiftPin returns an ShiftPin for a specific input.

func (*Device) Read16Input

func (d *Device) Read16Input() (uint16, error)

Read16Input updates the internal pins' states and returns it as an uint16.

func (*Device) Read32Input

func (d *Device) Read32Input() (uint32, error)

Read32Input updates the internal pins' states and returns it as an uint32.

func (*Device) Read8Input

func (d *Device) Read8Input() (uint8, error)

Read8Input updates the internal pins' states and returns it as an uint8.

type NumberBit

type NumberBit int8
const (
	EIGHT_BITS     NumberBit = 8
	SIXTEEN_BITS   NumberBit = 16
	THIRTYTWO_BITS NumberBit = 32
)

type ShiftPin

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

ShiftPin is the implementation of the ShiftPin interface.

func (ShiftPin) Configure

func (p ShiftPin) Configure()

Configure here just for interface compatibility.

func (ShiftPin) Get

func (p ShiftPin) Get() bool

Get the pin's state for a specific ShiftPin. Read{8|16|32}Input should be called before to update the state. Read{8|16|32}Input updates all the pins, no need to call it for each pin individually.

Jump to

Keyboard shortcuts

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