Skip to content

Commit c0d4f41

Browse files
committed
Final updates for version 2.0.0
Fixing/adding comments in examples. Update keywords.txt and header file with new library functions.
1 parent fd261a8 commit c0d4f41

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

examples/Example6_WireSettings/Example6_WireSettings.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ QwiicButton button;
2121
void setup() {
2222
Serial.begin(115200);
2323
Serial.println("Qwiic button examples");
24+
Wire1.setClock(400000); //set I2C communication to 400kHz
2425
Wire1.begin(); //Compilation will fail here if your platform doesn't have multiple I2C ports
2526

2627
//check if button will acknowledge over I2C
27-
if (button.begin() == false) {
28+
if (button.begin(0x6F, Wire1) == false) {
2829
Serial.println("Device did not acknowledge! Freezing.");
2930
while(1);
3031
}

examples/Example7_2Buttons/Example7_2Buttons.ino

+2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ void setup() {
2828
Wire.begin(); //Join I2C bus
2929

3030
//check if the buttons will acknowledge over I2C
31+
//connect to Qwiic button at address 0x5B
3132
if (button1.begin(0x5B) == false){
3233
Serial.println("Button 1 did not acknowledge! Freezing.");
3334
while(1);
3435
}
36+
//connect to Qwiic button at default address, 0x6F
3537
if (button2.begin() == false) {
3638
Serial.println("Button 2 did not acknowledge! Freezing.");
3739
while(1);

examples/Example8_ExtInterrupt/Example8_ExtInterrupt.ino

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ void setup() {
2525
Serial.begin(115200);
2626
Serial.println("Qwiic button examples");
2727

28-
// while(1);
2928
Wire.begin(); //Join I2C bus
3029

3130
//intialize interrupt pin

keywords.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ enablePressedInterrupt KEYWORD2
2626
disablePressedInterrupt KEYWORD2
2727
enableClickedInterrupt KEYWORD2
2828
disableClickedInterrupt KEYWORD2
29-
interruptTriggered KEYWORD2
30-
clearInterrupt KEYWORD2
29+
available KEYWORD2
30+
clearEventBits KEYWORD2
3131
resetInterruptConfig KEYWORD2
3232
isPressedQueueFull KEYWORD2
3333
isPressedQueueEmpty KEYWORD2

src/SparkFun_Qwiic_Button.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ uint8_t QwiicButton::readSingleRegister(Qwiic_Button_Register reg)
298298
{
299299
return _i2cPort->read();
300300
}
301+
return 0;
301302
}
302303

303304
uint16_t QwiicButton::readDoubleRegister(Qwiic_Button_Register reg)
@@ -314,6 +315,7 @@ uint16_t QwiicButton::readDoubleRegister(Qwiic_Button_Register reg)
314315
data |= (_i2cPort->read() << 8);
315316
return data;
316317
}
318+
return 0;
317319
}
318320

319321
unsigned long QwiicButton::readQuadRegister(Qwiic_Button_Register reg)

src/SparkFun_Qwiic_Button.h

+3-5
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ class QwiicButton
5757
uint8_t disablePressedInterrupt(); //When called, the interrupt will no longer be configured to trigger when the button is pressed. If enableClickedInterrupt() has also been called, then the interrupt will still trigger on the button click.
5858
uint8_t enableClickedInterrupt(); //When called, the interrupt will be configured to trigger when the button is clicked. If enablePressedInterrupt() has also been called, then the interrupt will trigger on either a push or a click.
5959
uint8_t disableClickedInterrupt(); //When called, the interrupt will no longer be configured to trigger when the button is clicked. If enablePressedInterrupt() has also been called, then the interrupt will still trigger on the button press.
60-
bool interruptTriggered(); //Returns true if the interrupt has been triggered, false otherwise.
61-
uint8_t clearInterrupt(); //Clears the interrupt flag on the button. Also resets the INT pin to whatever it's resting state is.
62-
bool available();
63-
uint8_t clearEventBits();
64-
uint8_t resetInterruptConfig(); //Resets the interrupt configuration back to defaults.
60+
bool available(); //Returns the eventAvailable bit
61+
uint8_t clearEventBits(); //Sets isPressed, hasBeenClicked, and eventAvailable to zero
62+
uint8_t resetInterruptConfig(); //Resets the interrupt configuration back to defaults.
6563

6664
//Queue manipulation
6765
bool isPressedQueueFull(); //Returns true if the queue of button press timestamps is full, and false otherwise.

0 commit comments

Comments
 (0)