Simplified access to the Microchip 1//8-Channels 12-Bit A/D Converters with SPI Serial Interface
Diff: MCP320x_SPI.cpp
- Revision:
- 2:a273b5fcad50
- Parent:
- 1:f0a81abeaef5
--- a/MCP320x_SPI.cpp Thu Jun 06 07:59:25 2013 +0000 +++ b/MCP320x_SPI.cpp Thu Sep 05 07:22:02 2013 +0000 @@ -35,7 +35,7 @@ _familly = p_familly; switch (_familly) { case _3201: - _channelsNum = 0; + _channelsNum = 1; break; case _3204: _channelsNum = 4; @@ -154,10 +154,10 @@ cmd0 = mask; cmd1 = _channels << 6; // MCP3204 has 4 channels in single-ended mode } else { // MCP3208 - cmd0 = mask | ((p_channels & 0x04) >> 2); // Extract D2 bit - See DS21298E-page 19 Clause 5.0 SERIAL COMMUNICATIONS - cmd1 = p_channels << 6; // MCP3204 has 8 channels in single-ended mode + cmd0 = mask | ((_channels & 0x04) >> 2); // Extract D2 bit - See DS21298E-page 19 Clause 5.0 SERIAL COMMUNICATIONS + cmd1 = _channels << 6; // MCP3204 has 8 channels in single-ended mode } - DEBUG_ENTER("CMCP320x_SPI::Read_320x: cmd0:%02x - cmd1:%02x", cmd0, cmd1) + DEBUG("CMCP320x_SPI::Read_320x: cmd0:%02x - cmd1:%02x", cmd0, cmd1) if (_cs != NULL) { _cs->write(0); wait_us(1);