Library for supporting the Nucleo Sensor Shield.
Dependents: Nucleo_Sensors_Demo m2x-temp_ethernet_demo m2x-MEMS_ACKme_Wifi_demo m2x_MEMS_Ublox_Cellular_demo ... more
Fork of Nucleo_Sensor_Shield by
DevI2C Class Reference
Helper class DevI2C providing some common functionality useful for on-board communication. More...
#include <x_cube_mems_i2c.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 from 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 some common functionality useful for on-board communication.
Definition at line 56 of file x_cube_mems_i2c.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 64 of file x_cube_mems_i2c.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 data to be read. DaviceAddr specifies the peripheral device slave address (correctly masked).. RegisterAddr specifies internal address register to read from. NumByteToRead number of bytes to be read.
- Return values:
-
0 if ok, -1 if an I2C error has occured
- Note:
- on some devices if NumByteToRead is greater than one, the DeviceAddr must be masked correctly
Definition at line 112 of file x_cube_mems_i2c.h.
int i2c_write | ( | uint8_t * | pBuffer, |
uint8_t | DeviceAddr, | ||
uint8_t | RegisterAddr, | ||
uint16_t | NumByteToWrite | ||
) |
Writes a buffer from the I2C peripheral device.
- Parameters:
-
pBuffer pointer to data to be read. DeviceAddr specifies the peripheral device slave address (correctly masked). RegisterAddr specifies internal address register to read from. NumByteToWrite number of bytes to be written.
- Return values:
-
0 if ok, -1 if an I2C error has occured
- Note:
- on some devices if NumByteToWrite is greater than one, the DeviceAddr must be masked correctly
Definition at line 77 of file x_cube_mems_i2c.h.
Generated on Tue Jul 12 2022 14:47:53 by 1.7.2