Simplified access to a Microchip Digital Potentiometer (MCP41xxx/MCP42xxx) devices

Dependents:   MCP41xxxApp MCP320xApp MCP41xxxApp

Revision:
5:4f6133144e7e
Parent:
4:bbfc8e352ff5
Child:
6:ded0d8a6729c
--- a/MCP4xxxx_SPI.cpp	Mon Feb 04 17:15:33 2013 +0000
+++ b/MCP4xxxx_SPI.cpp	Fri Apr 05 13:36:29 2013 +0000
@@ -28,14 +28,14 @@
 
         CMCP4xxxx_SPI::SPIModuleRefCounter += 1;
         if (CMCP4xxxx_SPI::SPIModuleRefCounter > 1) {
-            // Nothing to do
+            //FIXME Check that SPI settings are identical. Otherwise it should failed
             return;
         }
 
         _spiInstance = new SPI(p_mosi, p_miso, p_sclk);
         _spiInstance->frequency(p_frequency); // Set the frequency of the SPI interface
         _spiInstance->format(16, 0); // See http://mbed.org/users/mbed_official/code/mbed/docs/0954ebd79f59//classmbed_1_1SPI.html
-        DEBUG_ENTER("CMCP4xxxx_SPI: refCounter=%d", CMCP4xxxx_SPI::SPIModuleRefCounter)
+        DEBUG("CMCP4xxxx_SPI: refCounter=%d", CMCP4xxxx_SPI::SPIModuleRefCounter)
 
         if (p_cs != NC) {
             DEBUG("CMCP4xxxx_SPI: /CS managed");
@@ -79,7 +79,7 @@
         }
         // Release _reset if required
         if (_cs != NULL) {
-            _cs->write(0);
+            _cs->write(1);
             delete _cs;
         }
         // Release _reset if required