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.
DevI2C Class Reference
Helper class DevI2C providing functions for multi-register I2C communication common for a series of I2C devices. More...
#include <DevI2C.h>
Public Member Functions | |
| DevI2C (PinName sda, PinName scl) | |
| Create a DevI2C Master interface, connected to the specified pins. | |
| int | i2c_write (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToWrite) |
| Writes a buffer towards the I2C peripheral device. | |
| int | i2c_read (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToRead) |
| Reads a buffer from the I2C peripheral device. | |
| DevI2C (PinName sda, PinName scl) | |
| Create a DevI2C Master interface, connected to the specified pins. | |
| int | i2c_write (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToWrite) |
| Writes a buffer towards the I2C peripheral device. | |
| int | i2c_read (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToRead) |
| Reads a buffer from the I2C peripheral device. | |
| DevI2C (PinName sda, PinName scl) | |
| Create a DevI2C Master interface, connected to the specified pins. | |
| int | i2c_write (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToWrite) |
| Writes a buffer towards the I2C peripheral device. | |
| int | i2c_read (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToRead) |
| Reads a buffer from the I2C peripheral device. | |
| DevI2C (PinName sda, PinName scl) | |
| Create a DevI2C Master interface, connected to the specified pins. | |
| int | i2c_write (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToWrite) |
| Writes a buffer towards the I2C peripheral device. | |
| int | i2c_read (uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToRead) |
| Reads a buffer from the I2C peripheral device. | |
Detailed Description
Helper class DevI2C providing functions for multi-register I2C communication common for a series of I2C devices.
Definition at line 51 of file HTS221/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
Constructor & Destructor Documentation
| DevI2C | ( | PinName | sda, |
| PinName | scl | ||
| ) |
Create a DevI2C Master interface, connected to the specified pins.
- Parameters:
-
sda I2C data line pin scl I2C clock line pin
Definition at line 59 of file HTS221/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| DevI2C | ( | PinName | sda, |
| PinName | scl | ||
| ) |
Create a DevI2C Master interface, connected to the specified pins.
- Parameters:
-
sda I2C data line pin scl I2C clock line pin
Definition at line 59 of file LPS22HB/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| DevI2C | ( | PinName | sda, |
| PinName | scl | ||
| ) |
Create a DevI2C Master interface, connected to the specified pins.
- Parameters:
-
sda I2C data line pin scl I2C clock line pin
Definition at line 59 of file LSM303AGR/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| DevI2C | ( | PinName | sda, |
| PinName | scl | ||
| ) |
Create a DevI2C Master interface, connected to the specified pins.
- Parameters:
-
sda I2C data line pin scl I2C clock line pin
Definition at line 59 of file LSM6DSL/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
Member Function Documentation
| int i2c_read | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToRead | ||
| ) |
Reads a buffer from the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array to read data in to DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start reading from (must be correctly masked). NumByteToRead number of bytes to be read.
- Return values:
-
0 if ok, -1 if an I2C error has occured
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 103 of file HTS221/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| int i2c_read | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToRead | ||
| ) |
Reads a buffer from the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array to read data in to DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start reading from (must be correctly masked). NumByteToRead number of bytes to be read.
- Return values:
-
0 if ok, -1 if an I2C error has occured
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 103 of file LPS22HB/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| int i2c_read | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToRead | ||
| ) |
Reads a buffer from the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array to read data in to DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start reading from (must be correctly masked). NumByteToRead number of bytes to be read.
- Return values:
-
0 if ok, -1 if an I2C error has occured
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 103 of file LSM6DSL/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| int i2c_read | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToRead | ||
| ) |
Reads a buffer from the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array to read data in to DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start reading from (must be correctly masked). NumByteToRead number of bytes to be read.
- Return values:
-
0 if ok, -1 if an I2C error has occured
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 103 of file LSM303AGR/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| int i2c_write | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToWrite | ||
| ) |
Writes a buffer towards the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array data to send DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start writing to (must be correctly masked). NumByteToWrite number of bytes to be written.
- Return values:
-
0 if ok, -1 if an I2C error has occured, or -2 on temporary buffer overflow (i.e. NumByteToWrite was too high)
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 74 of file LSM303AGR/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| int i2c_write | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToWrite | ||
| ) |
Writes a buffer towards the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array data to send DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start writing to (must be correctly masked). NumByteToWrite number of bytes to be written.
- Return values:
-
0 if ok, -1 if an I2C error has occured, or -2 on temporary buffer overflow (i.e. NumByteToWrite was too high)
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 74 of file HTS221/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| int i2c_write | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToWrite | ||
| ) |
Writes a buffer towards the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array data to send DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start writing to (must be correctly masked). NumByteToWrite number of bytes to be written.
- Return values:
-
0 if ok, -1 if an I2C error has occured, or -2 on temporary buffer overflow (i.e. NumByteToWrite was too high)
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 74 of file LPS22HB/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
| int i2c_write | ( | uint8_t * | pBuffer, |
| uint8_t | DeviceAddr, | ||
| uint8_t | RegisterAddr, | ||
| uint16_t | NumByteToWrite | ||
| ) |
Writes a buffer towards the I2C peripheral device.
- Parameters:
-
pBuffer pointer to the byte-array data to send DeviceAddr specifies the peripheral device slave address. RegisterAddr specifies the internal address register where to start writing to (must be correctly masked). NumByteToWrite number of bytes to be written.
- Return values:
-
0 if ok, -1 if an I2C error has occured, or -2 on temporary buffer overflow (i.e. NumByteToWrite was too high)
- Note:
- On some devices if NumByteToWrite is greater than one, the RegisterAddr must be masked correctly!
Definition at line 74 of file LSM6DSL/X_NUCLEO_COMMON/DevI2C/DevI2C.h.
Generated on Tue Jul 12 2022 21:38:10 by
1.7.2