Dependencies: MMA8452 N5110 PowerControl beep mbed
Diff: Clock.h
- Revision:
- 9:522f9311ff4b
- Parent:
- 8:aebb468546c5
--- a/Clock.h Sat May 09 22:59:15 2015 +0000 +++ b/Clock.h Sun May 10 17:21:39 2015 +0000 @@ -1,7 +1,9 @@ /** -@ file Clock.h - -@ brief Header file of a count down clock containing Ticker on RTC and display time on N5110 Nokia Screen +@file Clock.h +@brief Header file of a count down clock containing Ticker on RTC and display time on N5110 Nokia Screen +@brief Revision 1.0 +@author Huynh Minh Tuan Le +@date April 2015 */ #ifndef CLOCK_H @@ -12,25 +14,51 @@ #include "MMA8452.h" #include "beep.h" -Ticker timer; -int CClock; -DigitalOut led(p22); -BusOut leds(LED1, LED2, LED3, LED4); -Beep beep(p26); +Ticker timer; ///<Ticker object for the count down clock. Called as a timer +int CClock; ///<A variable for storing clock value in seconds. +/** +@namespace Flashing led. +@brief A led to give a notification when the game is in last 10s. +*/ +DigitalOut led(p22); ///<A variable of the flashing led. +/** +@namespace Knightrunner leds. +*/ +BusOut leds(LED1, LED2, LED3, LED4); ///<A variable for outputing a set of four on-board leds. +/** +@namespace Beep sound. +*/ +Beep beep(p26); ///<An output analgoue signal of a piezzo buzzer. -int timerFlag = 0; +int timerFlag = 0; ///<A flag for timer ticker object. -void timerExpired() +void timerExpired() ///Function of setting flag for timer. { timerFlag = 1; //Set flag for timer of the countdown } +///Clock Class class Clock { public: + /** + * The function that makes a LED flash. + */ void flashLed(); + /** + * The function that display LEDs on the embed. + */ void knightrunner(); + /** + * The count down function occur during the game. + * The clock start from 60s to 0s. + * In the last 10s of the clock, the function will flash an LED and generate alerting sound. + */ void countDown(); + /** + * The function that display "Time Out" message on the Nokia screen + * and run funtion knightrunner. + */ void timeout(); };