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.
I2CBusDevice.h
- Committer:
- skyscraper
- Date:
- 2020-03-26
- Revision:
- 8:c5dc1ce10722
- Child:
- 9:87a7169b4d5c
File content as of revision 8:c5dc1ce10722:
#ifndef SKYSCRAPER_MBED_I2C_BUS_DEVICE_HPP_INCLUDED
#define SKYSCRAPER_MBED_I2C_BUS_DEVICE_HPP_INCLUDED
#include "mbed.h"
struct I2CBusDevice{
constexpr I2CBusDevice(I2C& i2cIn,uint8_t addressIn)
: m_i2c{i2cIn},m_address{addressIn}{}
int i2c_write(const char *data, int length,bool repeated = false)const
{
return m_i2c.write(m_address,data,length, repeated);
}
int i2c_read(char *data, int length, bool repeated=false)const
{
return m_i2c.read(m_address,data,length,repeated);
}
private:
I2C & m_i2c;
int const m_address;
};
#endif