MCP4726 library

Dependents:   mbed_MCP4726

See http://developer.mbed.org/users/yasuyuki/notebook/MCP4726/

Committer:
yasuyuki
Date:
Wed Oct 15 14:42:50 2014 +0000
Revision:
0:f0980556dfc0
first release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yasuyuki 0:f0980556dfc0 1 //**********************
yasuyuki 0:f0980556dfc0 2 // MCP4726.h for mbed
yasuyuki 0:f0980556dfc0 3 //
yasuyuki 0:f0980556dfc0 4 // (C)Copyright 2014 All rights reserved by Y.Onodera
yasuyuki 0:f0980556dfc0 5 // http://einstlab.web.fc2.com
yasuyuki 0:f0980556dfc0 6 //**********************
yasuyuki 0:f0980556dfc0 7
yasuyuki 0:f0980556dfc0 8 #ifndef MCP4726_H_
yasuyuki 0:f0980556dfc0 9 #define MCP4726_H_
yasuyuki 0:f0980556dfc0 10
yasuyuki 0:f0980556dfc0 11 #define MCP4726_ADDR 0xC0
yasuyuki 0:f0980556dfc0 12
yasuyuki 0:f0980556dfc0 13 #include "mbed.h"
yasuyuki 0:f0980556dfc0 14 #include "typedef.h"
yasuyuki 0:f0980556dfc0 15
yasuyuki 0:f0980556dfc0 16
yasuyuki 0:f0980556dfc0 17 class MCP4726{
yasuyuki 0:f0980556dfc0 18 public:
yasuyuki 0:f0980556dfc0 19 MCP4726 (PinName sda, PinName scl);
yasuyuki 0:f0980556dfc0 20 MCP4726 (I2C& p_i2c);
yasuyuki 0:f0980556dfc0 21 void init();
yasuyuki 0:f0980556dfc0 22 void put(unsigned short a);
yasuyuki 0:f0980556dfc0 23
yasuyuki 0:f0980556dfc0 24 protected:
yasuyuki 0:f0980556dfc0 25
yasuyuki 0:f0980556dfc0 26 I2C _i2c;
yasuyuki 0:f0980556dfc0 27
yasuyuki 0:f0980556dfc0 28 WORD_VAL da;
yasuyuki 0:f0980556dfc0 29 char buf[3];
yasuyuki 0:f0980556dfc0 30
yasuyuki 0:f0980556dfc0 31 };
yasuyuki 0:f0980556dfc0 32
yasuyuki 0:f0980556dfc0 33 #endif /* MCP4726_H_ */
yasuyuki 0:f0980556dfc0 34
yasuyuki 0:f0980556dfc0 35
yasuyuki 0:f0980556dfc0 36