mcp23008

package module
v3.0.0-...-732bb54 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: BSD-2-Clause Imports: 6 Imported by: 4

Documentation

Overview

This is a library to handle Microchip MCP23008 GPIO expansion ic

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 GpioSetRead

func GpioSetRead(module *Mcp23008, gpio byte) error

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

func RegisterInterrupt

func RegisterInterrupt(module *Mcp23008, interrupt chan byte)

This function handle event on GPIOs

Types

type Mcp23008

type Mcp23008 struct {
	Device      *i2c.Dev
	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