Be more explicit in what is geting bitshifted

Signed-off-by: npotts <npotts@users.noreply.github.com>
This commit is contained in:
npotts 2016-01-10 00:51:02 -07:00
parent 90b7ee68d8
commit 9242ae8dd9
1 changed files with 1 additions and 2 deletions

View File

@ -44,8 +44,7 @@ func (m *MCP3008) AnalogValueAt(chanNum int) (int, error) {
data[1] = uint8(m.Mode)<<7 | uint8(chanNum)<<4
data[2] = 0
case Bits12:
//[0x06| (channel >> 2), channel << 6, 0]
data[0] = 0x06 | (uint8(chanNum) >> 2)
data[0] = (uint8(startBit) << 2) + (uint8(m.Mode) << 1) + (uint8(chanNum) >> 2)
data[1] = uint8(chanNum) << 6
data[2] = 0
}