MCP4018 library

Dependents:   mbed_MCP4018

See https://developer.mbed.org/users/yasuyuki/notebook/MCP4018/

Revision:
0:f32b8e382343
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP4018.cpp	Sat Nov 08 12:14:31 2014 +0000
@@ -0,0 +1,29 @@
+//**********************
+// MCP4018.cpp for mbed
+//
+// MCP4018 mcp4018(P0_5,P0_4);
+// or
+// I2C i2c(P0_5,P0_4);
+// MCP4018 mcp4018(i2c);
+//
+// (C)Copyright 2014 All rights reserved by Y.Onodera
+// http://einstlab.web.fc2.com
+//**********************
+
+#include "mbed.h"
+#include "MCP4018.h"
+
+MCP4018::MCP4018 (PinName sda, PinName scl) : _i2c(sda, scl) {
+}
+MCP4018::MCP4018 (I2C& p_i2c) : _i2c(p_i2c) {
+}
+
+
+void MCP4018::put(unsigned char a)
+{
+
+    buf[0]=0x7F & a;
+    _i2c.write(MCP4018_ADDR, buf, 1);
+ 
+}
+