-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Daniel/chromadeck/starting changes (#134)
* starting work for chromadeck * mainmenu files * idk what im doing * idk what im doing 2 * fixed leds * chromadeck is starting to look good * fixed tests
- Loading branch information
1 parent
fd69e27
commit e430b21
Showing
233 changed files
with
602,620 additions
and
602,483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <Arduino.h> | ||
|
||
#include "src/VortexEngine.h" | ||
|
||
void setup() | ||
{ | ||
if (!VortexEngine::init()) { | ||
// uhoh | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
VortexEngine::tick(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#include "MainMenu.h" | ||
|
||
#include "../Time/TimeControl.h" | ||
#include "../Buttons/Buttons.h" | ||
#include "../Leds/LedTypes.h" | ||
#include "../Leds/Leds.h" | ||
|
||
bool MainMenu::m_isOpen = false; | ||
uint8_t MainMenu::m_curSelection = 0; | ||
|
||
#define NUM_SELECTIONS (LED_COUNT / 2) | ||
|
||
bool MainMenu::init() | ||
{ | ||
// main menus start open | ||
m_isOpen = true; | ||
m_curSelection = 0; | ||
return true; | ||
} | ||
|
||
bool MainMenu::run() | ||
{ | ||
// if the main menus aren't open then nothing to do here | ||
if (!m_isOpen) { | ||
return false; | ||
} | ||
|
||
// press < | ||
if (g_pButtonL->onShortClick()) { | ||
pressLeft(); | ||
} | ||
// press o | ||
if (g_pButtonM->onShortClick()) { | ||
select(); | ||
} | ||
// press > | ||
if (g_pButtonR->onShortClick()) { | ||
pressRight(); | ||
} | ||
|
||
// render | ||
show(); | ||
return true; | ||
} | ||
|
||
void MainMenu::show() | ||
{ | ||
Leds::clearAll(); | ||
// render the main menu | ||
uint8_t hue = 0; | ||
uint32_t now = Time::getCurtime(); | ||
MAP_FOREACH_LED(MAP_OUTER_RING) { | ||
Leds::breathIndex(pos, hue, (now / 2), 8, 255, 180); | ||
hue -= (255 / (LED_COUNT / 2)); | ||
} | ||
hue = 0; | ||
MAP_FOREACH_LED(MAP_INNER_RING) { | ||
Leds::breathIndex(pos, hue, (now / 2), 8, 255, 180); | ||
hue -= (255 / (LED_COUNT / 2)); | ||
} | ||
Leds::blinkIndex((LedPos)m_curSelection); | ||
Leds::blinkIndex((LedPos)(m_curSelection + 10)); | ||
} | ||
|
||
void MainMenu::pressLeft() | ||
{ | ||
m_curSelection = (m_curSelection + 1) % NUM_SELECTIONS; | ||
} | ||
|
||
void MainMenu::pressRight() | ||
{ | ||
if (!m_curSelection) { | ||
m_curSelection = NUM_SELECTIONS - 1; | ||
} else { | ||
m_curSelection--; | ||
} | ||
} | ||
|
||
void MainMenu::select() | ||
{ | ||
m_isOpen = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef MAINMENU_H | ||
#define MAINMENU_H | ||
|
||
#include <inttypes.h> | ||
|
||
class MainMenu | ||
{ | ||
public: | ||
static bool init(); | ||
static bool run(); | ||
static void show(); | ||
private: | ||
static void pressLeft(); | ||
static void pressRight(); | ||
static void select(); | ||
|
||
static bool m_isOpen; | ||
static uint8_t m_curSelection; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.