Skip to content

Commit

Permalink
More fixes for spark
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Nov 14, 2023
1 parent 76eb434 commit 062f2bb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
5 changes: 4 additions & 1 deletion VortexEngine/src/Buttons/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ bool Button::init(uint8_t pin)
m_longClick = false;

m_pinNum = pin;
#ifdef VORTEX_EMBEDDED
pinMode(m_pinNum, INPUT_PULLUP);
#endif
return true;
}

bool Button::check()
{
#ifdef VORTEX_EMBEDDED
return digitalRead(m_pinNum) == HIGH;
return digitalRead(m_pinNum) == LOW;
#else
return (Vortex::vcallbacks()->checkPinHook(m_pinNum) == 0);
#endif
Expand Down
10 changes: 9 additions & 1 deletion VortexEngine/src/Buttons/Buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
#include "../Time/Timings.h"
#endif

#ifdef SPARK_HANDLE
// handle is on 47
#define BUTTON_PIN 47
#else
// orbit is on 7
#define BUTTON_PIN 7
#endif

// Since there is only one button I am just going to expose a global pointer to
// access it, instead of making the Button class static in case a second button
// is added. This makes it easier to access the button from other places while
Expand All @@ -23,7 +31,7 @@ Button Buttons::m_buttons[NUM_BUTTONS];
bool Buttons::init()
{
// initialize the button on pins 9/10/11
if (!m_buttons[0].init(7)) {
if (!m_buttons[0].init(BUTTON_PIN)) {
return false;
}
g_pButton = &m_buttons[0];
Expand Down
5 changes: 5 additions & 0 deletions VortexEngine/src/Leds/Leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#include <FastLED.h>
#define LED_PIN 16
#ifdef SPARK_HANDLE
#define MOSFET_PIN 48
#else
#define MOSFET_PIN 18
#endif
#endif

// array of led color values
RGBColor Leds::m_ledColors[LED_COUNT] = { RGB_OFF };
Expand All @@ -28,6 +32,7 @@ bool Leds::init()
{
#ifdef VORTEX_EMBEDDED
FastLED.addLeds<WS2812B, LED_PIN, GRB>((CRGB *)m_ledColors, LED_COUNT);
FastLED.setMaxRefreshRate(0);
pinMode(MOSFET_PIN, OUTPUT);
digitalWrite(MOSFET_PIN, HIGH);
#endif
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/VortexConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
//
// The starting default global brightness if there is no savefile
// present The maximum value is 255
#define DEFAULT_BRIGHTNESS 15
#define DEFAULT_BRIGHTNESS 255

// Max Modes
//
Expand Down

0 comments on commit 062f2bb

Please sign in to comment.