Added a GPIO to power on/off for external I2C sensor(s) (with LEDs)

Dependencies:   UniGraphic mbed vt100

18-Jun-2018 外部センサの電源オン・オフ機能は下位互換の為に無効になっていました。 この版で再度有効にしました。

Revision:
0:846e2321c637
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sensors/MMA8451Q.h	Fri Apr 13 04:19:23 2018 +0000
@@ -0,0 +1,53 @@
+#ifndef _MMA8451Q_H_
+#define _MMA8451Q_H_
+
+#include "mbed.h"
+/**
+ * MMA8451Q 3-Axis, 14-bit/8-bit Digital Accelerometer
+ */
+ 
+class MMA8451Q {
+public:
+  /**
+  * MMA8451Q constructor
+  *
+  * @param i2c pointer to the I2C object
+  * @param addr 7bit addr of the I2C peripheral
+  */
+  MMA8451Q(I2C *i2c, int addr);
+
+  /**
+  * MMA8451Q destructor
+  */
+  ~MMA8451Q();
+ 
+  /**
+   * get all x, y, z data as int16_t
+   * @param data[] three int16_t data will be returned
+   * @returns I2C status 0: success others: I2C error
+   */ 
+  int     getAllRawData(int16_t data[]) ;
+  
+  /**
+   * get all x, y, z data as float
+   * @param data three float data will be returned
+   * @returns I2C status 0: success others: I2C error
+   */
+  int     getAllData(float value[]) ;
+  int16_t getRawData(uint8_t addr) ;
+  int16_t getRawX(void) ;
+  int16_t getRawY(void) ;
+  int16_t getRawZ(void) ;
+  
+  float getAccX(void) ;
+  float getAccY(void) ;
+  float getAccZ(void) ;
+  
+private:
+  I2C *p_i2c;
+  int m_addr;
+  int readRegs(int addr, uint8_t * data, int len);
+  int writeRegs(uint8_t * data, int len);
+} ;
+
+#endif /* _MMA8451Q_H_ */
\ No newline at end of file