mcp23008

package module
v2.0.2 Latest Latest
Warning

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

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

Documentation

Overview

This is a library to manage Microchip MCP23008 This chip is used on onion.io Omega2 relay expension

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GpioAllOff

func GpioAllOff(module *Mcp23008)

Set all GPIO to OFF/Low state

func GpioAllOn

func GpioAllOn(module *Mcp23008)

Set all GPIO to ON/High state

func GpioOff

func GpioOff(module *Mcp23008, gpio byte)

GpioOff set GPIO to OFF/Low state other one are unchanged

func GpioOn

func GpioOn(module *Mcp23008, gpio byte)

GpioOn set GPIO to ON/High state other one are unchanged

func GpioReverse

func GpioReverse(module *Mcp23008, gpio byte)

GpioReverse change state of selected GPIO other one are unchanged

func Init

func Init(device string, add int, module *Mcp23008) error

Init function initialize MCP28003 after boot or restart of device

func ReadGpio

func ReadGpio(module *Mcp23008, gpio byte) byte

This function return state of selected GPIO 1 for ON/High or 0 for OFF/Low state

Types

type Mcp23008

type Mcp23008 struct {
	Device      *i2c.Device
	Name        string `json:"name"`
	Address     int    `json:"address"`
	Count       byte   `json:"count"`
	Description string `json:"description"`
	Gpios       []int8 `json:"gpios"` //Using int8 array instead byte for enconding with json.Marshall....
}

func New

func New(device string, name string, address int, count byte, description string) (Mcp23008, error)

Jump to

Keyboard shortcuts

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