Test application to demonstrate MCP4xxxx_SPI library
Dependencies: DebugLibrary MCP4xxxx_SPI mbed
Revision 1:a463807bf483, committed 2013-01-27
- Comitter:
- Yann
- Date:
- Sun Jan 27 17:04:34 2013 +0000
- Parent:
- 0:62020bd58748
- Child:
- 2:cada7984284e
- Commit message:
- Validate test application with hardware (MCP4100)
Changed in this revision
MCP4xxxx_SPI.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MCP4xxxx_SPI.lib Fri Jan 25 16:13:03 2013 +0000 +++ b/MCP4xxxx_SPI.lib Sun Jan 27 17:04:34 2013 +0000 @@ -1,1 +1,1 @@ -MCP4xxxx_SPI#03314ad622d6 +MCP4xxxx_SPI#cf3cee91eb87
--- 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