func (d *MCP23017) SetPullupB(value byte) error {
	return d.device.WriteByte(REG_GPPUB, value)
}
Set pull-up configuration for port B. If a bit is 1 and the corresponding pin is
an input, a pull-up resistor of about 100K is enabled. A zero bit indicates no pull-up.
package mcp23017
import (
	"fmt"
	"github.com/mrmorphic/hwio"
)
const (
	DEFAULT_BASE_ADDRESS = 0x20
	REG_IODIRA  = 0x00
	REG_IODIRB  = 0x01
	REG_IPOLA   = 0x02
	REG_IPOLB   = 0x03
	REG_GPINENA = 0x04
	REG_GPINENB = 0x05
	REG_DEFVALA = 0x06
	REG_DEFVALB = 0x07
	REG_INTCONA = 0x08
	REG_INTCONB = 0x09
	REG_IOCON   = 0x0a
	REG_GPPUA   = 0x0c
	REG_GPPUB   = 0x0d
	REG_INTFA   = 0x0e
	REG_INTFB   = 0x0f
	REG_INTCAPA = 0x10
	REG_INTCAPB = 0x11
	REG_GPIOA   = 0x12
	REG_GPIOB   = 0x13
	REG_OLATA   = 0x14
	REG_OLATB   = 0x15
)
type MCP23017 struct {
	device hwio.I2CDevice
}
func NewMCP23017(module hwio.I2CModule, address int) (*MCP23017, error) {
	if address < 8 {
		address += DEFAULT_BASE_ADDRESS
	}
	if address < 0x20 || address > 0x27 {
		return nil, fmt.Errorf("Device address %d is invalid for an MCP23017. It must be in the range 0x20-0x27", address)
	}
	device := module.GetDevice(address)
	result := &MCP23017{device: device}
	device.WriteByte(REG_IOCON, 0)
	return result, nil
}
func (d *MCP23017) SetDirA(value byte) error {
	return d.device.WriteByte(REG_IODIRA, value)
}
func (d *MCP23017) SetDirB(value byte) error {
	return d.device.WriteByte(REG_IODIRB, value)
}
func (d *MCP23017) GetPortA() (byte, error) {
	return d.device.ReadByte(REG_GPIOA)
}
func (d *MCP23017) GetPortB() (byte, error) {
	return d.device.ReadByte(REG_GPIOB)
}
func (d *MCP23017) SetPortA(value byte) error {
	return d.device.WriteByte(REG_GPIOA, value)
}
func (d *MCP23017) SetPortB(value byte) error {
	return d.device.WriteByte(REG_GPIOB, value)
}
func (d *MCP23017) SetPullupA(value byte) error {
	return d.device.WriteByte(REG_GPPUA, value)
}