Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
rpihw::driver::mcp23008 Class Reference

8-bit I/O Expander with I2C. More...

#include <mcp23008.hpp>

+ Inheritance diagram for rpihw::driver::mcp23008:

Public Member Functions

 mcp23008 (const std::string &dev_path, uint8_t dev_addr)
 Constructor method. More...
 
virtual ~mcp23008 ()
 Destructor method.
 
- Public Member Functions inherited from rpihw::driver::mcp23x08
 mcp23x08 (const std::string &dev_path)
 Constructor method. More...
 
virtual ~mcp23x08 ()
 Destructor method.
 
void init ()
 Initialize the expander.
 
virtual void setup (uint8_t pin, uint8_t mode, uint8_t pull_mode=PULL_OFF)
 Sets the mode of a GPIO pin. More...
 
virtual void write (uint8_t pin, bool value)
 Sets the value of a output pin. More...
 
virtual bool read (uint8_t pin)
 Returns the value of a input pin. More...
 
virtual void setPullUpDown (uint8_t pin, uint8_t mode)
 Enables/disables the pull-up control on a GPIO pin. More...
 
- Public Member Functions inherited from rpihw::driver::io_expander
virtual bool checkEvent (uint8_t pin)
 Returns the event state of a GPIO pin. More...
 
virtual void setRisingEvent (uint8_t pin, bool enabled)
 Enables/disables the rising edge event on a GPIO pin. More...
 
virtual void setFallingEvent (uint8_t pin, bool enabled)
 Enables/disables the falling edge event on a GPIO pin. More...
 
virtual void setHighEvent (uint8_t pin, bool enabled)
 Enables/disables the high event on a GPIO pin. More...
 
virtual void setLowEvent (uint8_t pin, bool enabled)
 Enables/disables the low event on a GPIO pin. More...
 

Private Member Functions

virtual void send (uint8_t reg, uint8_t data)
 Sends data to the device.
 
virtual uint8_t receive (uint8_t reg)
 Receives data from the device.
 

Private Attributes

driver::i2cm_i2c
 Inter Integrated Circuit.
 
uint8_t m_dev_addr
 Device address.
 

Additional Inherited Members

- Public Types inherited from rpihw::driver::mcp23x08
enum  Commands { WRITE = 0x40, READ = 0x41 }
 The controller command set. More...
 
enum  Registers {
  IODIR = 0x00, IPOL = 0x02, GPINTEN = 0x04, DEFVAL = 0x06,
  INTCON = 0x08, IOCON = 0x0a, GPPU = 0x0c, INTF = 0x0e,
  INTCAP = 0x10, GPIO = 0x12, OLAT = 0x14
}
 Device registers. More...
 
enum  Settings {
  INTPOL = 0x02, ODR = 0x04, HAEN = 0x08, DISSLW = 0x10,
  SEQOP = 0x20, MIRROR = 0x40, BANK = 0x80
}
 The controller configuration set (bit flags). More...
 
- Protected Attributes inherited from rpihw::driver::mcp23x08
uint8_t m_states [4]
 Local registers.
 
std::string m_dev_path
 Device path.
 

Detailed Description

8-bit I/O Expander with I2C.

Definition at line 43 of file mcp23008.hpp.

Constructor & Destructor Documentation

rpihw::driver::mcp23008::mcp23008 ( const std::string &  dev_path,
uint8_t  dev_addr 
)

Constructor method.

Parameters
[in]dev_pathThe device path.
[in]dev_addrThe device address.

The documentation for this class was generated from the following files: