Skip to content

Commit

Permalink
conditionalize for library presence
Browse files Browse the repository at this point in the history
  • Loading branch information
tlyu committed Jun 5, 2024
1 parent f1f7b3d commit 6a7245d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef ARDUINO_ARCH_NRF52
#if USE_TINYUSB && KALEIDOSCOPE_USE_NEOTRELLIS

#include "kaleidoscope/device/adafruit/NeoTrellis.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@

#pragma once

#ifdef ARDUINO_ARCH_NRF52
#if USE_TINYUSB

#include <Arduino.h>

#if KALEIDOSCOPE_USE_NEOTRELLIS
#include <Adafruit_NeoTrellis.h>
#endif

#define CRGB(r, g, b) \
(cRGB) { \
Expand Down Expand Up @@ -62,9 +64,11 @@ struct NeoTrellisLEDDriverProps : public kaleidoscope::driver::led::BaseProps {

class NeoTrellisLEDDriver : public kaleidoscope::driver::led::Base<NeoTrellisLEDDriverProps> {
public:
#if KALEIDOSCOPE_USE_NEOTRELLIS
static void syncLeds();
static void setCrgbAt(uint8_t i, cRGB crgb);
static cRGB getCrgbAt(uint8_t i);
#endif
};


Expand All @@ -75,6 +79,7 @@ struct NeoTrellisKeyScannerProps : public kaleidoscope::driver::keyscanner::Base
};

class NeoTrellisKeyScanner : public kaleidoscope::driver::keyscanner::Base<NeoTrellisKeyScannerProps> {
#if KALEIDOSCOPE_USE_NEOTRELLIS
private:
typedef NeoTrellisKeyScanner ThisType;
static uint16_t last_scan;
Expand All @@ -86,6 +91,7 @@ class NeoTrellisKeyScanner : public kaleidoscope::driver::keyscanner::Base<NeoTr
static void readMatrix();

protected:
#endif
};


Expand All @@ -110,15 +116,19 @@ class NeoTrellis : public kaleidoscope::device::Base<NeoTrellisProps> {
auto serialPort() -> decltype(Serial) & {
return Serial;
}
#if KALEIDOSCOPE_USE_NEOTRELLIS
void setup() {
trellis.begin();
Base<NeoTrellisProps>::setup();
}
#endif

private:
#if KALEIDOSCOPE_USE_NEOTRELLIS
friend class NeoTrellisLEDDriver;
friend class NeoTrellisKeyScanner;
static Adafruit_NeoTrellis trellis;
#endif
};


Expand Down

0 comments on commit 6a7245d

Please sign in to comment.