Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
|
Public Member Functions | |
I2CIO () | |
int | begin (uint8_t i2cAddr) |
void | pinMode (uint8_t pin, uint8_t dir) |
void | portMode (uint8_t dir) |
uint8_t | read (void) |
uint8_t | digitalRead (uint8_t pin) |
int | write (uint8_t value) |
int | digitalWrite (uint8_t pin, uint8_t level) |
I2CIO::I2CIO | ( | ) |
Constructor method Class constructor constructor.
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.
i2cAddr | I2C Address where the device is located. |
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.
pin[in] | Pin from the port to read its status. Range (0..7) |
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.
pin[in] | device pin to change level. Range (0..7). level[in] logic level to set the pin at (HIGH, LOW). |
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.
pin[in] | Pin from the I2C IO expander to be configured. Range 0..7 |
dir[in] | Pin direction (INPUT, OUTPUT). |
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.
dir[in] | Direction of all the pins of the device (INPUT, OUTPUT). |
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.
none |
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.
value[in] | value to be written to the device. |