BlinkLed automatically. This library requires RTOS.

Dependents:   mpod_nhk_english mpod_picasa_photoframe mpod_nhk_english_spxml

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BlinkLed.h Source File

BlinkLed.h

00001 /* BlinkLed.h */
00002 #ifndef BLINKLED_H_
00003 #define BLINKLED_H_
00004 
00005 #include "mbed.h"
00006 #include "rtos.h"
00007 
00008 /** LED which blinks automatically with RTOS
00009 */
00010 class BlinkLed
00011 {
00012 public:
00013     /** Constructor
00014      */
00015     BlinkLed(PinName pin, float dutyChangeStep);
00016     
00017     /** Destructor
00018      */
00019     ~BlinkLed();
00020     
00021     /** Start biinking
00022      */
00023     void startBlink();
00024     
00025     /** Finish biinking
00026      */
00027     void finishBlink();
00028     
00029     /** Check biinking
00030      */
00031     bool isBlinking();
00032       
00033 private:
00034     /** Copy constructor
00035      *  Disable because it is only declaration
00036      */
00037     BlinkLed(const BlinkLed&);
00038     
00039     /** Copy assignment operators
00040      *  Disable because it is only declaration
00041      */
00042     BlinkLed& operator=(const BlinkLed&);
00043     
00044     /** Function for blinking
00045      *  This function will be bind to new thread
00046      */
00047     static void blink(void const *argument);
00048     
00049     /** Target Led
00050      */
00051     PwmOut led;
00052     
00053     /** Duty ratio step of changing every 20ms
00054      */
00055     float dutyChangeStep;
00056     
00057     /** Flag of pause
00058      */
00059     bool pause;
00060     
00061     /** Pointer to thread for blinking
00062      */
00063     Thread* thread;
00064 };
00065 
00066 #endif /* BLINKLED_H_ */