MCP41XXX/42XXX. Single/Dual Digital Potentiometer with SPI™ Interface

Files at this revision

API Documentation at this revision

Comitter:
mcm
Date:
Tue Aug 21 15:44:32 2018 +0000
Parent:
1:ba1b5b4001f7
Commit message:
cs pin was forgotten, now the chip selects works as expected.

Changed in this revision

MCP41XXX_42XXX.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ba1b5b4001f7 -r 81f5716e32f7 MCP41XXX_42XXX.cpp
--- a/MCP41XXX_42XXX.cpp	Tue Aug 21 15:26:49 2018 +0000
+++ b/MCP41XXX_42XXX.cpp	Tue Aug 21 15:44:32 2018 +0000
@@ -62,7 +62,9 @@
     /* Make the command byte and the new wiper value, update the register then     */
     cmd[0]           =   (char)( MCP41XXX_42XXX_COMMAND_WRITE_DATA | myChannel );
     cmd[1]           =   (char)myWiperValue.Dn;
+    _cs              =   0;
     mySPI_status     =   _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 );
+    _cs              =   1;
 
 
 
@@ -108,7 +110,9 @@
     /* Make the command byte, the new wiper value does not take place, update the register then     */
     cmd[0]           =   (char)( MCP41XXX_42XXX_COMMAND_SHUTDOWN | myChannel );
     cmd[1]           =   0;
+    _cs              =   0;
     mySPI_status     =   _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 );
+    _cs              =   1;