Test application to demonstrate MCP4xxxx_SPI library
Dependencies: DebugLibrary MCP4xxxx_SPI mbed
Diff: main.cpp
- Revision:
- 1:a463807bf483
- Parent:
- 0:62020bd58748
- Child:
- 3:7dbac45b8fd3
diff -r 62020bd58748 -r a463807bf483 main.cpp --- a/main.cpp Fri Jan 25 16:13:03 2013 +0000 +++ b/main.cpp Sun Jan 27 17:04:34 2013 +0000 @@ -61,6 +61,23 @@ g_digitalPot.Write(CMCP4xxxx_SPI::WriteToPot2, potLevel); g_chipSelect.write(1); break; + case 'e': + potLevel -= 1; + g_chipSelect.write(0); + g_digitalPot.Write(CMCP4xxxx_SPI::ShutdownPot1); + g_chipSelect.write(1); + break; + case 'f': + potLevel -= 1; + g_chipSelect.write(0); + g_digitalPot.Write(CMCP4xxxx_SPI::ShutdownPot2); + g_chipSelect.write(1); + break; + case 'r': + g_chipSelect.write(0); + g_digitalPot.Reset(); + g_chipSelect.write(1); + break; default: std::cout << "Invalid user choice\r" << std::endl; break; @@ -84,6 +101,9 @@ std::cout << "\tIncrease level on pot #2:\t\t\tb\r" << std::endl; std::cout << "\tDecrease level on pot #1:\t\t\tc\r" << std::endl; std::cout << "\tDecrease level on pot #2:\t\t\td\r" << std::endl; + std::cout << "\tShutdown pot #1 :\t\t\te\r" << std::endl; + std::cout << "\tShutdown pot #2 :\t\t\tf\r" << std::endl; + std::cout << "\tReset MCP4xxxx :\t\t\tr\r" << std::endl; std::cout << "Enter your choice: " << std::flush; userChoice.choice = getchar(); // Display the menu