Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Aug 16, 2023
1 parent d802295 commit 87b7781
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions MCP23S17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,6 @@ bool MCP23S17::getPullup8(uint8_t port, uint8_t &mask)
bool MCP23S17::pinMode16(uint16_t value)
{
writeReg16(MCP23S17_DDR_A, value);
// writeReg(MCP23S17_DDR_A, value >> 8);
// writeReg(MCP23S17_DDR_B, value & 0xFF);
_error = MCP23S17_OK;
return true;
}
Expand All @@ -500,8 +498,6 @@ bool MCP23S17::pinMode16(uint16_t value)
bool MCP23S17::write16(uint16_t value)
{
writeReg16(MCP23S17_GPIO_A, value);
// writeReg(MCP23S17_GPIO_A, value >> 8);
// writeReg(MCP23S17_GPIO_B, value & 0xFF);
_error = MCP23S17_OK;
return true;
}
Expand All @@ -512,9 +508,6 @@ uint16_t MCP23S17::read16()
{
_error = MCP23S17_OK;
uint16_t value = readReg16(MCP23S17_GPIO_A);
// uint16_t value = readReg(MCP23S17_GPIO_A);
// value <<= 8;
// value += readReg(MCP23S17_GPIO_B);
return value;
}

Expand All @@ -523,8 +516,6 @@ uint16_t MCP23S17::read16()
bool MCP23S17::setPolarity16(uint16_t mask)
{
writeReg16(MCP23S17_POL_A, mask);
// writeReg(MCP23S17_POL_A, mask >> 8);
// writeReg(MCP23S17_POL_B, mask & 0xFF);
if (_error != MCP23S17_OK)
{
return false;
Expand All @@ -537,9 +528,6 @@ bool MCP23S17::setPolarity16(uint16_t mask)
bool MCP23S17::getPolarity16(uint16_t &mask)
{
mask = readReg16(MCP23S17_POL_A);
// mask = readReg(MCP23S17_POL_A);
// mask <<= 8;
// mask += readReg(MCP23S17_POL_B);
if (_error != MCP23S17_OK)
{
return false;
Expand All @@ -552,8 +540,6 @@ bool MCP23S17::getPolarity16(uint16_t &mask)
bool MCP23S17::setPullup16(uint16_t mask)
{
writeReg16(MCP23S17_PUR_A, mask);
// writeReg(MCP23S17_PUR_A, mask >> 8);
// writeReg(MCP23S17_PUR_B, mask & 0xFF);
if (_error != MCP23S17_OK)
{
return false;
Expand All @@ -566,9 +552,6 @@ bool MCP23S17::setPullup16(uint16_t mask)
bool MCP23S17::getPullup16(uint16_t &mask)
{
mask = readReg16(MCP23S17_PUR_A);
// mask = readReg(MCP23S17_PUR_A);
// mask <<= 8;
// mask += readReg(MCP23S17_PUR_B);
if (_error != MCP23S17_OK)
{
return false;
Expand Down Expand Up @@ -732,6 +715,7 @@ uint8_t MCP23S17::readReg(uint8_t reg)
return rv;
}


// writes HIGH byte first, LOW byte last
bool MCP23S17::writeReg16(uint8_t reg, uint16_t value)
{
Expand Down

0 comments on commit 87b7781

Please sign in to comment.