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.
Diff: M24LC64.cpp
- Revision:
- 0:4ab58ea5ecf6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/M24LC64.cpp Sat Oct 04 12:03:05 2014 +0000
@@ -0,0 +1,41 @@
+//**********************
+// M24LC64.cpp for mbed
+//
+// M24LC64 lcd(P0_5,P0_4);
+// or
+// I2C i2c(P0_5,P0_4);
+// M24LC64 lcd(i2c);
+//
+// (C)Copyright 2014 All rights reserved by Y.Onodera
+// http://einstlab.web.fc2.com
+//**********************
+
+#include "mbed.h"
+#include "M24LC64.h"
+
+M24LC64::M24LC64 (PinName sda, PinName scl) : _i2c(sda, scl) {
+}
+M24LC64::M24LC64 (I2C& p_i2c) : _i2c(p_i2c) {
+}
+
+void M24LC64::put(unsigned int a, unsigned char b)
+{
+ adr.Val=a;
+ buf[0]=adr.byte.HB;
+ buf[1]=adr.byte.LB;
+ buf[2]=b;
+ _i2c.write(M24LC64_ADDR, buf, 3);
+ wait_ms(5);
+}
+
+
+unsigned char M24LC64::get(unsigned int a)
+{
+ adr.Val=a;
+ buf[0]=adr.byte.HB;
+ buf[1]=adr.byte.LB;
+ _i2c.write(M24LC64_ADDR, buf, 2, true); // no stop, repeated
+ _i2c.read( M24LC64_ADDR, buf, 1);
+ return buf[0];
+}
+