Library thread Blink Led or other processes use RTOS

Dependents:   LedsThreading

Fork of BlinkLed by Satoshi Togawa

Example

https://developer.mbed.org/users/AVELARDEV/code/LedsThreading/

BlinkLed.h

Committer:
togayan
Date:
2012-12-24
Revision:
2:1d0c09c1a8b4
Parent:
0:a55a3351317d
Child:
3:f317d057edde

File content as of revision 2:1d0c09c1a8b4:

/* BlinkLed.h */
#ifndef BLINKLED_H_
#define BLINKLED_H_

#include "mbed.h"
#include "rtos.h"

/** LED which blinks automatically with RTOS
*/
class BlinkLed
{
public:
    /** Constructor
     */
    BlinkLed(PinName pin, float dutyChangeStep);
    
    /** Destructor
     */
    ~BlinkLed();
    
    /** Start biinking
     */
    void startBlink();
    
    /** Finish biinking
     */
    void finishBlink();
    
    /** Check biinking
     */
    bool isBlinking();
      
private:
    /** Copy constructor
     *  Disable because it is only declaration
     */
    BlinkLed(const BlinkLed&);
    
    /** Copy assignment operators
     *  Disable because it is only declaration
     */
    BlinkLed& operator=(const BlinkLed&);
    
    /** Function for blinking
     *  This function will be bind to new thread
     */
    static void blink(void const *argument);
    
    /** Target Led
     */
    PwmOut led;
    
    /** Duty ratio step of changing every 20ms
     */
    float dutyChangeStep;
    
    /** Flag of pause
     */
    bool pause;
    
    /** Pointer to thread for blinking
     */
    Thread* thread;
};

#endif /* BLINKLED_H_ */