First draft HMC5883 magnetometer sensor using physical quantities, outputting via serial port using std::cout on mbed os 5

Revision:
8:c5dc1ce10722
Child:
9:87a7169b4d5c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/I2CBusDevice.h	Thu Mar 26 21:13:44 2020 +0000
@@ -0,0 +1,25 @@
+
+#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
\ No newline at end of file