|
Files | |
file | microchip-mcp23008.h |
Microchip MCP23008 driver. | |
Defines | |
#define | MCP_REG_IODIR 0x00 |
#define | MCP_REG_IPOL 0x01 |
#define | MCP_REG_GPINTEN 0x02 |
#define | MCP_REG_DEFVAL 0x03 |
#define | MCP_REG_INTCON 0x04 |
#define | MCP_REG_IOCON 0x05 |
#define | MCP_REG_GPPU 0x06 |
#define | MCP_REG_INTF 0x07 |
#define | MCP_REG_INTCAP 0x08 |
#define | MCP_REG_GPIO 0x09 |
#define | MCP_REG_OLAT 0x0A |
#define | MCP_BIT_INTPOL 1 |
#define | MCP_BIT_ODR 2 |
#define | MCP_BIT_DISSLW 4 |
#define | MCP_BIT_SREAD 5 |
#define | MCP_I2C_ADDR 0x40 |
Functions | |
bool | MCP23008setupIO (tSensors link, byte addr, byte mask, byte pullup) |
bool | MCP23008setupIO (tSensors link, byte addr, byte mask) |
byte | MCP23008readIO (tSensors link, byte addr, byte mask) |
byte | MCP23008readIO (tSensors link, byte addr) |
bool | MCP23008writeIO (tSensors link, byte addr, byte mask) |
bool | MCP23008writeReg (tSensors link, byte addr, byte reg, byte data) |
byte | MCP23008readReg (tSensors link, byte addr, byte reg) |
Variables | |
tByteArray | MCP23008_I2CRequest |
tByteArray | MCP23008_I2CReply |
Microchip MCP23008
#define MCP_BIT_DISSLW 4 |
Slew Rate control bit for SDA output
Definition at line 55 of file microchip-mcp23008.h.
#define MCP_BIT_INTPOL 1 |
This bit sets the polarity of the INT output pin
Definition at line 53 of file microchip-mcp23008.h.
#define MCP_BIT_ODR 2 |
This bit configures the INT pin as an open-drain output
Definition at line 54 of file microchip-mcp23008.h.
#define MCP_BIT_SREAD 5 |
Sequential Operation mode bit
Definition at line 56 of file microchip-mcp23008.h.
#define MCP_I2C_ADDR 0x40 |
Default base address (A0-A2 tied to gnd)
Definition at line 58 of file microchip-mcp23008.h.
#define MCP_REG_DEFVAL 0x03 |
DEFAULT COMPARE REGISTER FOR INTERRUPT-ONCHANGE
Definition at line 43 of file microchip-mcp23008.h.
#define MCP_REG_GPINTEN 0x02 |
INTERRUPT-ON-CHANGE CONTROL REGISTER
Definition at line 42 of file microchip-mcp23008.h.
#define MCP_REG_GPIO 0x09 |
PORT REGISTER
Definition at line 49 of file microchip-mcp23008.h.
#define MCP_REG_GPPU 0x06 |
PULL-UP RESISTOR CONFIGURATION REGISTER
Definition at line 46 of file microchip-mcp23008.h.
#define MCP_REG_INTCAP 0x08 |
INTERRUPT CAPTURE REGISTER
Definition at line 48 of file microchip-mcp23008.h.
#define MCP_REG_INTCON 0x04 |
INTERRUPT CONTROL REGISTER
Definition at line 44 of file microchip-mcp23008.h.
#define MCP_REG_INTF 0x07 |
INTERRUPT FLAG (INTF)REGISTER
Definition at line 47 of file microchip-mcp23008.h.
#define MCP_REG_IOCON 0x05 |
CONFIGURATION REGISTER
Definition at line 45 of file microchip-mcp23008.h.
#define MCP_REG_IODIR 0x00 |
I/O DIRECTION REGISTER
Definition at line 40 of file microchip-mcp23008.h.
#define MCP_REG_IPOL 0x01 |
INPUT POLARITY REGISTER
Definition at line 41 of file microchip-mcp23008.h.
#define MCP_REG_OLAT 0x0A |
OUTPUT LATCH REGISTER
Definition at line 50 of file microchip-mcp23008.h.
byte MCP23008readIO | ( | tSensors | link, |
byte | addr, | ||
byte | mask | ||
) |
Read the states of the pins as specified by the mask
link | the sensor port number |
addr | the address of the MCP23008 |
mask | the pins to get the status for |
Definition at line 157 of file microchip-mcp23008.h.
byte MCP23008readIO | ( | tSensors | link, |
byte | addr | ||
) |
Read the states of all of the pins
link | the sensor port number |
addr | the address of the MCP23008 |
Definition at line 168 of file microchip-mcp23008.h.
byte MCP23008readReg | ( | tSensors | link, |
byte | addr, | ||
byte | reg | ||
) |
Read from the device at the specified register.
Note: this is an internal function and should not be called directly.
link | the sensor port number |
addr | the address of the MCP23008 |
reg | the register to write to |
Definition at line 102 of file microchip-mcp23008.h.
bool MCP23008setupIO | ( | tSensors | link, |
byte | addr, | ||
byte | mask, | ||
byte | pullup | ||
) |
Setup the pins as either inputs or outputs as specified by the mask. 0 is input, 1 is output
link | the sensor port number |
addr | the address of the MCP23008 |
mask | the pins to change the configuration for |
pullup | the pins to change the internal pullup resistor for |
Definition at line 124 of file microchip-mcp23008.h.
bool MCP23008setupIO | ( | tSensors | link, |
byte | addr, | ||
byte | mask | ||
) |
Setup the pins as either inputs or outputs as specified by the mask. 0 is input, 1 is output
link | the sensor port number |
addr | the address of the MCP23008 |
mask | the pins to change the configuration for |
Definition at line 142 of file microchip-mcp23008.h.
bool MCP23008writeIO | ( | tSensors | link, |
byte | addr, | ||
byte | mask | ||
) |
Write to the pins specified specified by the mask.
link | the sensor port number |
addr | the address of the MCP23008 |
mask | the state of the pins that is to be written |
Definition at line 180 of file microchip-mcp23008.h.
bool MCP23008writeReg | ( | tSensors | link, |
byte | addr, | ||
byte | reg, | ||
byte | data | ||
) |
Write data to the device at the specified register.
Note: this is an internal function and should not be called directly.
link | the sensor port number |
addr | the address of the MCP23008 |
reg | the register to write to |
data | the data to be written (single byte) |
Definition at line 82 of file microchip-mcp23008.h.
Array to hold I2C reply data
Definition at line 61 of file microchip-mcp23008.h.
Array to hold I2C command data
Definition at line 60 of file microchip-mcp23008.h.