Skip to content

Commit

Permalink
DM: fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
deanm1278 committed Sep 20, 2018
1 parent f958316 commit 757cb3a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Adafruit_NeoTrellis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ void Adafruit_NeoTrellis::activateKey(uint8_t key, uint8_t edge, bool enable)
@brief read all events currently stored in the seesaw fifo and call any callbacks.
*/
/**************************************************************************/
void Adafruit_NeoTrellis::read()
void Adafruit_NeoTrellis::read(bool polling)
{
uint8_t count = getKeypadCount();
delayMicroseconds(500);
if(count > 0){
if(polling) count = count + 2;
keyEventRaw e[count];
readKeypad(e, count);
for(int i=0; i<count; i++){
Expand Down Expand Up @@ -311,6 +312,7 @@ void Adafruit_MultiTrellis::read()
uint8_t count = t->getKeypadCount();
delayMicroseconds(500);
if(count > 0){
count = count + 2;
keyEventRaw e[count];
t->readKeypad(e, count);
for(int i=0; i<count; i++){
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_NeoTrellis.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Adafruit_NeoTrellis : public Adafruit_seesaw {

void activateKey(uint8_t key, uint8_t edge, bool enable=true);

void read();
void read(bool polling = true);

seesaw_NeoPixel pixels; ///< the onboard neopixel matrix

Expand Down
6 changes: 3 additions & 3 deletions Adafruit_seesaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ void Adafruit_seesaw::disableKeypadInterrupt()
****************************************************************************************/
uint8_t Adafruit_seesaw::getKeypadCount()
{
return this->read8(SEESAW_KEYPAD_BASE, SEESAW_KEYPAD_COUNT);
return this->read8(SEESAW_KEYPAD_BASE, SEESAW_KEYPAD_COUNT, 500);
}

/**
Expand Down Expand Up @@ -682,10 +682,10 @@ void Adafruit_seesaw::write8(byte regHigh, byte regLow, byte value)
*
* @return the value between 0 and 255 read from the passed register
****************************************************************************************/
uint8_t Adafruit_seesaw::read8(byte regHigh, byte regLow)
uint8_t Adafruit_seesaw::read8(byte regHigh, byte regLow, uint16_t delay)
{
uint8_t ret;
this->read(regHigh, regLow, &ret, 1);
this->read(regHigh, regLow, &ret, 1, delay);

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_seesaw.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class Adafruit_seesaw : public Print {
int8_t _flow; /*!< The flow control pin to use */

void write8(byte regHigh, byte regLow, byte value);
uint8_t read8(byte regHigh, byte regLow);
uint8_t read8(byte regHigh, byte regLow, uint16_t delay = 125);

void read(uint8_t regHigh, uint8_t regLow, uint8_t *buf, uint8_t num, uint16_t delay = 125);
void write(uint8_t regHigh, uint8_t regLow, uint8_t *buf, uint8_t num);
Expand Down
2 changes: 1 addition & 1 deletion examples/NeoTrellis/interrupt/interrupt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void setup() {

void loop() {
if(!digitalRead(INT_PIN)){
trellis.read();
trellis.read(false);
}
delay(2);
}
2 changes: 1 addition & 1 deletion examples/NeoTrellis/ripples/ripples.ino
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void processRipples(){

void loop() {
if(!digitalRead(INT_PIN)){
trellis.read();
trellis.read(false);
}
processRipples();
delay(20);
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit seesaw Library
version=1.1.7
version=1.1.8
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=This is a library for the Adafruit seesaw helper IC.
Expand Down

0 comments on commit 757cb3a

Please sign in to comment.