Skip to content

Commit

Permalink
fixing a minor bug in mcp4352 driver
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmikwolf committed Jul 26, 2021
1 parent f53f76f commit 70ea711
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Zetaohm_MCP4352/Zetaohm_MCP4352.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void Zetaohm_MCP4352::setResistance(uint8_t port, uint8_t value){
writeByte(portAddress << 4, value);
};

uint8_t Zetaohm_MCP4352::readResistance(uint8_t port){
uint16_t Zetaohm_MCP4352::readResistance(uint8_t port){
uint8_t portAddress = 0x00;
switch (port) {
case 0:
Expand All @@ -52,7 +52,7 @@ uint8_t Zetaohm_MCP4352::readResistance(uint8_t port){
break;
}

readAddress((portAddress << 4) & 0x0C );
return readAddress((portAddress << 4) & 0x0C );
};


Expand Down
2 changes: 1 addition & 1 deletion src/Zetaohm_MCP4352/Zetaohm_MCP4352.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Zetaohm_MCP4352 {
Zetaohm_MCP4352();
void initialize(uint8_t csPin);
void setResistance(uint8_t port, uint8_t value);
uint8_t readResistance(uint8_t port);
uint16_t readResistance(uint8_t port);
uint16_t readAddress(byte addr);
void writeByte(byte addr, byte data);

Expand Down

0 comments on commit 70ea711

Please sign in to comment.