Skip to content

Commit

Permalink
Change SparkFun_APDS9960 to submodule (#2800)
Browse files Browse the repository at this point in the history
Submodule allows easier maintenance and tracking of upstream changes.
Only one function change, addition of `getStatusRegister` function.

Also patch fixing issue flagged by clang build:

```
 /home/runner/work/Sming/Sming/Sming/Libraries/SparkFun_APDS9960/SparkFun_APDS9960.cpp:508:32:
warning: result of comparison of constant -1 with expression of type 'uint8_t' (aka 'unsigned char') is always false
[-Wtautological-constant-out-of-range-compare]
                if( bytes_read == -1 ) {
                    ~~~~~~~~~~ ^  ~~
```
  • Loading branch information
mikee47 committed Jun 12, 2024
1 parent d4f490f commit 666c0c2
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 2,646 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@
path = Sming/Libraries/SolarCalculator
url = https://github.com/mikee47/SolarCalculator
ignore = dirty
[submodule "Libraries.SparkFun_APDS9960"]
path = Sming/Libraries/SparkFun_APDS9960
url = https://github.com/sparkfun/SparkFun_APDS-9960_Sensor_Arduino_Library
ignore = dirty
[submodule "Libraries.spiffs"]
path = Sming/Libraries/Spiffs/spiffs
url = https://github.com/pellepl/spiffs.git
Expand Down
29 changes: 29 additions & 0 deletions Sming/Libraries/.patches/SparkFun_APDS9960.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/src/SparkFun_APDS9960.cpp b/src/SparkFun_APDS9960.cpp
index 530c1f6..25968d0 100644
--- a/src/SparkFun_APDS9960.cpp
+++ b/src/SparkFun_APDS9960.cpp
@@ -163,7 +163,7 @@ bool SparkFun_APDS9960::init()
return false;
}

-#if 0
+#if DEBUG
/* Gesture config register dump */
uint8_t reg;
uint8_t val;
@@ -518,12 +518,13 @@ int SparkFun_APDS9960::readGesture()

/* If there's stuff in the FIFO, read it into our data block */
if( fifo_level > 0) {
- bytes_read = wireReadDataBlock( APDS9960_GFIFO_U,
+ int res = wireReadDataBlock( APDS9960_GFIFO_U,
(uint8_t*)fifo_data,
(fifo_level * 4) );
- if( bytes_read == -1 ) {
+ if( res == -1 ) {
return ERROR;
}
+ bytes_read = res;
#if DEBUG
Serial.print("FIFO Dump: ");
for ( i = 0; i < bytes_read; i++ ) {
2 changes: 2 additions & 0 deletions Sming/Libraries/.patches/SparkFun_APDS9960/component.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
COMPONENT_INCDIRS := src
COMPONENT_SRCDIRS := src
1 change: 1 addition & 0 deletions Sming/Libraries/SparkFun_APDS9960
Submodule SparkFun_APDS9960 added at bb9633
82 changes: 0 additions & 82 deletions Sming/Libraries/SparkFun_APDS9960/README.md

This file was deleted.

Loading

0 comments on commit 666c0c2

Please sign in to comment.