A small library that's provide helpers for programmers

Dependents:   PYRN

Committer:
clemounet
Date:
Tue Apr 14 13:07:53 2015 +0000
Revision:
4:eef83534b19e
Parent:
2:6cc4c56940af
.add CallBack

Who changed what in which revision?

UserRevisionLine numberNew contents of line
clemounet 1:ee7a5f05513d 1
clemounet 1:ee7a5f05513d 2 #include "MyBlinker.h"
clemounet 1:ee7a5f05513d 3
clemounet 2:6cc4c56940af 4 #define BLINKER_THREAD_STACK_SIZE 128
clemounet 2:6cc4c56940af 5
clemounet 2:6cc4c56940af 6 MyBlinker::MyBlinker(PwmOut *o, int32_t d, float hState, float lState): MyThread("MyBlinker",BLINKER_THREAD_STACK_SIZE) {
clemounet 1:ee7a5f05513d 7 led = o;
clemounet 1:ee7a5f05513d 8 delay = d;
clemounet 1:ee7a5f05513d 9 highState = hState;
clemounet 1:ee7a5f05513d 10 lowState = lState;
clemounet 1:ee7a5f05513d 11 }
clemounet 1:ee7a5f05513d 12
clemounet 1:ee7a5f05513d 13 void MyBlinker::setDelay(int32_t d) {
clemounet 1:ee7a5f05513d 14 delay = d;
clemounet 1:ee7a5f05513d 15 }
clemounet 1:ee7a5f05513d 16
clemounet 1:ee7a5f05513d 17 void MyBlinker::setHighState(float hState) {
clemounet 1:ee7a5f05513d 18 highState = hState;
clemounet 1:ee7a5f05513d 19 }
clemounet 1:ee7a5f05513d 20
clemounet 1:ee7a5f05513d 21 void MyBlinker::setLowState(float lState) {
clemounet 1:ee7a5f05513d 22 lowState = lState;
clemounet 1:ee7a5f05513d 23 }
clemounet 1:ee7a5f05513d 24
clemounet 1:ee7a5f05513d 25 void MyBlinker::Main(void) {
clemounet 1:ee7a5f05513d 26 while(running){
clemounet 1:ee7a5f05513d 27 led->write(highState);
clemounet 1:ee7a5f05513d 28 Wait(delay);
clemounet 1:ee7a5f05513d 29 led->write(lowState);
clemounet 1:ee7a5f05513d 30 Wait(delay);
clemounet 1:ee7a5f05513d 31 }
clemounet 2:6cc4c56940af 32 }