Interface to Analog devices AD5258 digital I2C potentiometer

Revision:
2:8a71db02417b
Parent:
1:64570234d7b5
Child:
3:f5b60d166896
--- a/AD5258.cpp	Mon Nov 11 13:08:08 2013 +0000
+++ b/AD5258.cpp	Tue Nov 12 12:57:07 2013 +0000
@@ -54,4 +54,17 @@
     foo[0] = 0xA0;                       // command to store RDAC to EE
     foo[1] = 0x80;                       // NOP to restore low power mode
     _i2c.write(_address, foo, 1);      
+  }
+  
+   // software write protect
+ void AD5258::writeProtect(bool enable)  {
+    char foo[2];
+    foo[0] = 0x40;                       // command to store RDAC to EE
+    if (enable) {
+        foo[1] = 0x01;                       // SET WP
+    }
+    else {
+        foo[1] = 0x010;                       // RESET WP (enable writes)
+    }
+    _i2c.write(_address, foo, 2);      
   }
\ No newline at end of file