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: MCP4661.h
- Revision:
- 0:960d250e49b2
diff -r 000000000000 -r 960d250e49b2 MCP4661.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP4661.h Thu May 17 23:11:08 2012 +0000
@@ -0,0 +1,69 @@
+/* mbed MCP4661 DigiPot Driver Library
+ *
+ * Copyright (c) 2012, Kevin Kent Trane US Inc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MCP4661_H
+#define MCP4661_H
+
+#include "mbed.h"
+
+// register names
+#define MCP4661_VOL_WIPER0 0
+#define MCP4661_VOL_WIPER1 1
+#define MCP4661_NV_WIPER0 2
+#define MCP4661_NV_WIPER1 3
+#define MCP4661_REG_TCON 4
+#define MCP4661_REG_STATUS 5
+#define MCP4661_EEPROM_0 6
+// #define MCP4661_EEPROM1 7
+// The Data EEPROM is 0x6 to 0xf
+
+
+// Command modes
+#define MCP4661_WR 0
+#define MODE_ON 1
+#define MODE_PWM0 2
+#define MODE_PWM1 3
+
+class MCP4661 {
+
+public:
+
+ MCP4661(PinName sda, PinName scl, int addr);
+
+ int SetLed (int led, int mode);
+ int SetMode (int mask, int mode);
+ int Duty (int channel, float duty);
+ int Period (int channel, float period);
+ int SetValue (int wiper, int value);
+
+protected:
+
+ void _write(int reg, int data);
+ int _read(int reg);
+ int _addr;
+ I2C _i2c;
+
+};
+
+
+#endif
\ No newline at end of file
