Simplified access to a Microchip Digital Potentiometer (MCP41xxx/MCP42xxx) devices
Dependents: MCP41xxxApp MCP320xApp MCP41xxxApp
Diff: MCP4xxxx_SPI.h
- Revision:
- 7:12a0d89aa72f
- Parent:
- 6:ded0d8a6729c
diff -r ded0d8a6729c -r 12a0d89aa72f MCP4xxxx_SPI.h --- a/MCP4xxxx_SPI.h Thu Jun 06 07:59:16 2013 +0000 +++ b/MCP4xxxx_SPI.h Thu Sep 05 07:29:00 2013 +0000 @@ -65,15 +65,15 @@ */ unsigned char _incStep; public: - /** MCP32xx familly + /** MCP32xx family */ - enum Mcp4xxxFamilly { - _41xxx = 0x00, //<! 41xxx familly such as MCP41010 - See DS11195C - _42xxx = 0x01, //<! 42xxx familly such as MCP42010 - See DS11195C - _41xx = 0x02, //<! 41xx familly such as MCP4251 - Single Potentiometer/Rheostat - _42xx = 0x03 //<! 42x2 familly such as MCP42x2 - Dual Potentiometer/Rheostat + enum Mcp4xxxFamily { + _41xxx = 0x00, //<! 41xxx family such as MCP41010 - See DS11195C + _42xxx = 0x01, //<! 42xxx family such as MCP42010 - See DS11195C + _41xx = 0x02, //<! 41xx family such as MCP4251 - Single Potentiometer/Rheostat + _42xx = 0x03 //<! 42x2 family such as MCP42x2 - Dual Potentiometer/Rheostat }; - Mcp4xxxFamilly _familly; + Mcp4xxxFamily _family; public: /** Authorized commands * See DS11195C-page 18 @@ -104,7 +104,7 @@ * @param p_shdn: MBed pin to manage /SHDN input. If NC, /SHDN is not managed, default value is NC, not connected * @param p_frequency: Frequency of the SPI interface (SCK), default value is 1MHz */ - CMCP4xxxx_SPI(const PinName p_mosi, const PinName p_miso, const PinName p_sclk, const PinName p_cs = NC, const PinName p_reset = NC, const PinName p_shdn = NC, const Mcp4xxxFamilly familly = _41xxx, const unsigned int p_frequency = 1000000); + CMCP4xxxx_SPI(const PinName p_mosi, const PinName p_miso, const PinName p_sclk, const PinName p_cs = NC, const PinName p_reset = NC, const PinName p_shdn = NC, const Mcp4xxxFamily family = _41xxx, const unsigned int p_frequency = 1000000); /** Destructor */ @@ -131,7 +131,7 @@ * @param p_command The digital potentiometer to increment. Default: WriteToDigiPot1 * @return 0x0000 on success, any value otherwise */ - unsigned short Incrememt(const Commands p_command = WriteToDigiPot1); + unsigned short Increment(const Commands p_command = WriteToDigiPot1); /** Decrement the specified digital potentiometer * @param p_command The digital potentiometer to decrement. Default: WriteToDigiPot1 @@ -174,13 +174,13 @@ /** Write a NOP command */ - unsigned short Write(); + //unsigned short Write(); - /** Change the current familly - * @param familly The new type of ICs + /** Change the current family + * @param family The new type of ICs * @return the previous type of ICs */ - Mcp4xxxFamilly SetFamilly(const Mcp4xxxFamilly familly); + Mcp4xxxFamily SetFamilly(const Mcp4xxxFamily family); /** Reset the device * @code