Skip to content

Commit db56283

Browse files
committed
Fix compiler warnings
Bump version number Remove check for unsigned integer being negative Fix logical OR operator Use unused variable in `writeRam()` (required zero/one-indexing to be fixed, and in `readRAM()` too)
1 parent 470c18e commit db56283

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun Qwiic Alphanumeric Display Arduino Library
2-
version=2.2.7
2+
version=2.2.8
33
author=SparkFun Electronics
44
maintainer=SparkFun Electronics
55
sentence=A library to drive the Holtek HT16K33 LED Driver with an Alphanumeric Display.

src/SparkFun_Alphanumeric_Display.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,6 @@ bool HT16K33::setBrightnessSingle(uint8_t displayNumber, uint8_t duty)
340340
{
341341
if (duty > 15) // Error check
342342
duty = 15;
343-
else if (duty < 0)
344-
duty = 0;
345343

346344
uint8_t dataToWrite = ALPHA_CMD_DIMMING_SETUP | duty;
347345
return (writeRAM(lookUpDisplayAddress(displayNumber), dataToWrite));
@@ -744,7 +742,7 @@ uint16_t HT16K33::getSegmentsToTurnOn(uint8_t charPos)
744742
size_t HT16K33::write(uint8_t b)
745743
{
746744
// If user wants to print '.' or ':', don't increment the digitPosition!
747-
if (b == '.' | b == ':')
745+
if (b == '.' || b == ':')
748746
printChar(b, 0);
749747
else
750748
{
@@ -869,13 +867,13 @@ bool HT16K33::shiftLeft(uint8_t shiftAmt)
869867

870868
bool HT16K33::readRAM(uint8_t address, uint8_t reg, uint8_t *buff, uint8_t buffSize)
871869
{
872-
uint8_t displayNum = 0;
870+
uint8_t displayNum = 1;
873871
if (address == _deviceAddressDisplayTwo)
874-
displayNum = 1;
875-
else if (address == _deviceAddressDisplayThree)
876872
displayNum = 2;
877-
else if (address == _deviceAddressDisplayFour)
873+
else if (address == _deviceAddressDisplayThree)
878874
displayNum = 3;
875+
else if (address == _deviceAddressDisplayFour)
876+
displayNum = 4;
879877
isConnected(displayNum); // Wait until display is ready
880878

881879
_i2cPort->beginTransmission(address);
@@ -895,14 +893,14 @@ bool HT16K33::readRAM(uint8_t address, uint8_t reg, uint8_t *buff, uint8_t buffS
895893
// Write the contents of the RAM array out to the Holtek IC
896894
bool HT16K33::writeRAM(uint8_t address, uint8_t reg, uint8_t *buff, uint8_t buffSize)
897895
{
898-
uint8_t displayNum = 0;
896+
uint8_t displayNum = 1;
899897
if (address == _deviceAddressDisplayTwo)
900-
displayNum = 1;
901-
else if (address == _deviceAddressDisplayThree)
902898
displayNum = 2;
903-
else if (address == _deviceAddressDisplayFour)
899+
else if (address == _deviceAddressDisplayThree)
904900
displayNum = 3;
905-
//isConnected(displayNum); //Wait until display is ready
901+
else if (address == _deviceAddressDisplayFour)
902+
displayNum = 4;
903+
isConnected(displayNum); //Wait until display is ready
906904

907905
_i2cPort->beginTransmission(address);
908906
_i2cPort->write(reg);

0 commit comments

Comments
 (0)