updated 7seg controls for new 7 seg boards
Dependencies: PixelArray WS2812 mbed
Fork of frdm_pong_table_controller by
Diff: main.h
- Revision:
- 6:5e8e2645cd93
- Parent:
- 5:2d439ccefc7d
- Child:
- 7:dc6f1f105c52
--- a/main.h Thu Jul 06 16:16:36 2017 +0000 +++ b/main.h Mon Jul 10 11:05:06 2017 +0000 @@ -32,6 +32,7 @@ //K64F On-board Switches DigitalIn PB1(PTC6); DigitalIn PB2(PTA4); +InterruptIn idleButton(PTB2); // SERIAL Serial pc(USBTX, USBRX); // tx, rx @@ -47,7 +48,6 @@ // LED Variables bool seg1A, seg1B, seg1C, seg1D, seg1E, seg1F, seg1G; -//int seg1Array[122]; int mainArray[11][122]; int rand_colors[] = {0x00FF00, 0x7FFF00, 0xFFFF00, 0xFF7F00, 0xFF0000, 0xFE00FF, 0x7F00FF, 0x0000FF, 0x007FFF, 0x00FFFE, 0x00FF7F}; @@ -59,27 +59,40 @@ int endFlashes = 3; int numFlashes; +// Flags +volatile int idle_flag = 0; + // Robot Bream Beam value double prevRbbValue; // Previous Robot break beam value double prevPbbValue; // Previous player break beam value // FUNCTION DECLERATIONS -void Setup(); -void SetNumberPatterns(); -void SetFigureOf8Pattern(); -void SetCirclePattern(); -void SetLEDArray(int x); -void WriteScores(); -void HandleGoal(bool hasRobotScored); -void WritePxScores(int line_num, bool isRobot); -void WritePxAnimation(int line_num,bool isRobot); -void WritePxScoresRandomColours(int line_num,bool isRobot); -void WritePxGoal(unsigned int colour,bool isRobot); +void Setup(); // initial pattern +void SetNumberPatterns(); // sets segment patterns for numbers +void SetLEDArray(int x); // sets segment patterns in mainArray +void WriteAnimation(); // writes scores to the LEDs +void WritePxAnimation(int line_num,bool isRobot,bool colour); // writes mainArray to either LED buffer in blue or random colours + +void HandleGoal(bool hasRobotScored); void HandleWin(); + void GoalAnimation(bool hasRobotScored); void WinAnimation(bool isRobotWinner); -void FigureOf8Animation(bool robot, bool player, int numberOfRepitions); -void CircleAnimation(bool robot, bool player, int numberOfRepitions); + +void CircleAnimation(bool robot, bool robotColour,bool player, bool playerColour, int numberOfRepitions); void DrainAnimation(bool robot, bool robotColour, int robotScore, bool player, bool playerColour, int playerScore); +void ZeroInAnimation(bool robot, bool robotColour,bool player, bool playerColour); +void ZeroOutAnimation(bool robot, bool robotColour,bool player, bool playerColour); +void OneInAnimation(bool robot, bool robotColour,bool player, bool playerColour); +void OneOutAnimation(bool robot, bool robotColour,bool player, bool playerColour); +void TwoInAnimation(bool robot, bool robotColour,bool player, bool playerColour); +void TwoOutAnimation(bool robot, bool robotColour,bool player, bool playerColour); +void ThreeInAnimation(bool robot, bool robotColour,bool player, bool playerColour); +void ThreeOutAnimation(bool robot, bool robotColour,bool player, bool playerColour); + +// ISRs +void idleButtonISR(); + + #endif \ No newline at end of file