| LCD Library 1.3.0 LCD Library - LCD control class hierarchy library. Drop in replacement for the LiquidCrystal Library.

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
I2CIO Class Reference

`#include <I2CIO.h>`

List of all members.

## Public Member Functions
int | begin (uint8_t i2cAddr)
uint8_t | digitalRead (uint8_t pin)
int | digitalWrite (uint8_t pin, uint8_t level)
| I2CIO ()
void | pinMode (uint8_t pin, uint8_t dir)
void | portMode (uint8_t dir)
uint8_t | read (void)
int | write (uint8_t value)

## Detailed Description

Definition at line 41 of file I2CIO.h.

## Constructor & Destructor Documentation

I2CIO::I2CIO | ( |  | ) |

Constructor method Class constructor constructor.

Definition at line 44 of file I2CIO.cpp.

## Member Function Documentation

int I2CIO::begin | ( | uint8_t | i2cAddr | ) |

Initializes the device. This method initializes the device allocating an I2C address. This method is the first method that should be call prior to calling any other method form this class. On initialization all pins are configured as INPUT on the device.

Parameters:

  i2cAddr,: | I2C Address where the device is located.

Returns:
  1 if the device was initialized correctly, 0 otherwise

Definition at line 57 of file I2CIO.cpp.

uint8_t I2CIO::digitalRead | ( | uint8_t | pin | ) |

Read a pin from the device. Reads a particular pin from the device. To read a particular pin it has to be configured as INPUT. During initialization all pins are configured as INPUTs by default. Please refer to pinMode or portMode.

Parameters:

  pin[in] | Pin from the port to read its status. Range (0..7)

Returns:
  Returns the pin status (HIGH, LOW) if the pin is configured as an output, reading its value will always return LOW regardless of its real state.

Definition at line 153 of file I2CIO.cpp.

int I2CIO::digitalWrite | ( | uint8_t | pin,
|  | uint8_t | level
| ) |  |

Writes a digital level to a particular pin. Write a level to the indicated pin of the device. For this method to have effect, the pin has to be configured as OUTPUT using the pinMode or portMode methods.

Parameters:

  pin[in] | device pin to change level. Range (0..7). level[in] logic level to set the pin at (HIGH, LOW).

Returns:
  1 on success, 0 otherwise.

Definition at line 170 of file I2CIO.cpp.

void I2CIO::pinMode | ( | uint8_t | pin,
|  | uint8_t | dir
| ) |  |

Sets the mode of a particular pin. Sets the mode of a particular pin to INPUT, OUTPUT. digitalWrite has no effect on pins which are not declared as output.

Parameters:

  pin[in] | Pin from the I2C IO expander to be configured. Range 0..7
  dir[in] | Pin direction (INPUT, OUTPUT).

Definition at line 76 of file I2CIO.cpp.

void I2CIO::portMode | ( | uint8_t | dir | ) |

Sets all the pins of the device in a particular direction. This method sets all the pins of the device in a particular direction. This method is useful to set all the pins of the device to be either inputs or outputs.

Parameters:

  dir[in] | Direction of all the pins of the device (INPUT, OUTPUT).

Definition at line 93 of file I2CIO.cpp.

uint8_t I2CIO::read | ( | void |  | ) |

Reads all the pins of the device that are configured as INPUT. Reads from the device the status of the pins that are configured as INPUT. During initialization all pins are configured as INPUTs by default. Please refer to pinMode or portMode.

Parameters:

  none |

Definition at line 111 of file I2CIO.cpp.

int I2CIO::write | ( | uint8_t | value | ) |

Write a value to the device. Writes to a set of pins in the device. The value is the binary representation of all the pins in device. The value written is masked with the configuration of the direction of the pins; to change the state of a particular pin with this method, such pin has to be configured as OUTPUT using the portMode or pinMode methods. If no pins have been configured as OUTPUTs this method will have no effect.

Parameters:

  value[in] | value to be written to the device.

Returns:
  1 on success, 0 otherwise

Definition at line 130 of file I2CIO.cpp.

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

- I2CIO.h
- I2CIO.cpp

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines