Permalink
Browse files

Added LED feedback for shuffle

  • Loading branch information...
naveedgol committed Nov 29, 2016
1 parent 082d921 commit 3e75cdf50a5cfa2abaa7f137c68419bfd404aa8a
Showing with 27 additions and 10 deletions.
  1. +1 −1 tivaScript/buttons.ino
  2. +17 −1 tivaScript/shakeDetection.ino
  3. +1 −1 tivaScript/switches.ino
  4. +7 −6 tivaScript/tivaScript.ino
  5. +1 −1 tivaScript/volume.ino
View
@@ -13,7 +13,7 @@ struct buttonState
struct buttonState buttonStates[buttonCount];
void buttonInitialize()
void buttonInit()
{
for(int i = 0; i < buttonCount; i++)
pinMode(buttons[i], INPUT);
@@ -41,18 +41,34 @@ void ShakeTick()
ShakeAccumulator = sqrt(x*x + y*y + z*z);
}
void shakeInitialize()
void LEDInit()
{
GPIOPinTypeGPIOOutput(LED1Port, LED1);
GPIOPinTypeGPIOOutput(LED2Port, LED2);
GPIOPinTypeGPIOOutput(LED3Port, LED3);
GPIOPinTypeGPIOOutput(LED4Port, LED4);
}
void shakeShuffler()
{
ShakeTick();
if(ShakeIsShaking())
{
if(!shuffle)
{
GPIOPinWrite(LED1Port, LED1, LED1);
GPIOPinWrite(LED2Port, LED2, LED2);
GPIOPinWrite(LED3Port, LED3, LED3);
GPIOPinWrite(LED4Port, LED4, LED4);
Serial.println('h'); //shuffleOn
shuffle = true;
}
else
{
GPIOPinWrite(LED1Port, LED1, LOW);
GPIOPinWrite(LED2Port, LED2, LOW);
GPIOPinWrite(LED3Port, LED3, LOW);
GPIOPinWrite(LED4Port, LED4, LOW);
Serial.println('i'); //shuffleOff
shuffle = false;
}
View
2 tivaScript/switches.ino 100755 → 100644
@@ -4,7 +4,7 @@ const int switchCount = 2;
uint32_t switches[switchCount] = {leftSwitch, rightSwitch};
bool switchState[switchCount];
void switchInitialize()
void switchInit()
{
for(int i = 0; i < switchCount; i++)
pinMode(switches[i], INPUT);
View
@@ -17,15 +17,17 @@ void ShakeTick();
void setup()
{
Serial.begin(9600);
volumeInitialize();
switchInitialize();
buttonInitialize();
volumeInit();
switchInit();
buttonInit();
OrbitOledInit();
OrbitOledSetDrawMode(modOledSet);
WireInit();
ShakeInit();
ShakeInit();
LEDInit();
}
void loop()
@@ -36,8 +38,7 @@ void loop()
playpauseButton();
nextButton();
previousButton();
shakeInitialize();
shakeShuffler();
if(serialEvent())
{
View
2 tivaScript/volume.ino 100755 → 100644
@@ -1,6 +1,6 @@
uint32_t ulAIN0;
void volumeInitialize()
void volumeInit()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
GPIOPinTypeADC(AINPort, AIN);

0 comments on commit 3e75cdf

Please sign in to comment.