Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of tilt_angles by
ENGO333_I2C Class Reference
Class A class to handle I2C read/write operation. More...
#include <ENGO333_I2C.h>
Public Member Functions | |
| ENGO333_I2C (PinName sda, PinName scl) | |
| Constructor. | |
| ~ENGO333_I2C () | |
| Destructor. | |
| void | setSpeed (int freq) |
| Function : Set I2C bus frequency. | |
| void | writeOneByte (char deviceAddress, char registerAddress, char value) |
| Function : Write one byte data into device's register. | |
| char | readOneByte (char deviceAddress, char registerAddress) |
| Function : Read one byte from device's register address. | |
| void | readBytes (char deviceAddress, char registerAddress, char *value, int length) |
| Function : Read multiple bytes from device's register address. | |
Detailed Description
Class A class to handle I2C read/write operation.
Definition at line 19 of file ENGO333_I2C.h.
Constructor & Destructor Documentation
| ENGO333_I2C | ( | PinName | sda, |
| PinName | scl | ||
| ) |
Constructor.
Input sda = SDA or I2C serial data pin scl = SCL or I2C serial clock pin
Definition at line 3 of file ENGO333_I2C.cpp.
| ~ENGO333_I2C | ( | ) |
Destructor.
Definition at line 8 of file ENGO333_I2C.cpp.
Member Function Documentation
| void readBytes | ( | char | deviceAddress, |
| char | registerAddress, | ||
| char * | value, | ||
| int | length | ||
| ) |
Function : Read multiple bytes from device's register address.
Input : deviceAddress = Device's I2C address registerAddress = Device's register address to be read value = Array of data to store values read from device's register
Definition at line 34 of file ENGO333_I2C.cpp.
| char readOneByte | ( | char | deviceAddress, |
| char | registerAddress | ||
| ) |
Function : Read one byte from device's register address.
Input : deviceAddress = Device's I2C address registerAddress = Device's register address to be read
Return : One byte data read from device's register
Definition at line 26 of file ENGO333_I2C.cpp.
| void setSpeed | ( | int | freq ) |
Function : Set I2C bus frequency.
Input : freq = desired frequency in Hz
Definition at line 13 of file ENGO333_I2C.cpp.
| void writeOneByte | ( | char | deviceAddress, |
| char | registerAddress, | ||
| char | value | ||
| ) |
Function : Write one byte data into device's register.
Input : deviceAddress = Device's I2C address registerAddress = Device's register address to be written on value = Value to be written on device's register address
Definition at line 18 of file ENGO333_I2C.cpp.
Generated on Sat Jul 16 2022 15:16:04 by
1.7.2
