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.
Dependents: 2016_mother_3 WRS2019_master WRS2020_mecanum_node WRS2021_mecanum_driver
Revision 0:8c3f6ccf349c, committed 2016-04-16
- Comitter:
- sgrsn
- Date:
- Sat Apr 16 04:23:13 2016 +0000
- Child:
- 1:f5811e90881f
- Child:
- 2:890301330892
- Commit message:
- I2C_Master class
Changed in this revision
| i2cmaster.cpp | Show annotated file Show diff for this revision Revisions of this file |
| i2cmaster.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/i2cmaster.cpp Sat Apr 16 04:23:13 2016 +0000
@@ -0,0 +1,15 @@
+#include "i2cmaster.h"
+
+
+i2c::i2c(PinName p1,PinName p2) : I2C(p1,p2)
+{
+ frequency(400000);
+}
+bool i2c::put(char addr,char reg, char data ,int size)
+{
+ char Data[2] = {data,0};
+ char DATA[2] = {reg,size};
+ bool N = I2C::write(addr,DATA,2);
+ N|= I2C::write(addr,Data,size);
+ return N;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/i2cmaster.h Sat Apr 16 04:23:13 2016 +0000
@@ -0,0 +1,14 @@
+#ifndef MBED_I2CMASTER_H
+#define MBED_I2CMASTER_H
+
+#include "mbed.h"
+
+class i2c : public I2C//,DigitalOut
+{
+ public:
+ i2c(PinName p1,PinName p2);
+
+ bool put(char addr,char reg, char data ,int size);
+};
+
+#endif
\ No newline at end of file