![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First version
Dependencies: mbed EthernetInterface mbed-rto
Diff: LEDDriver.cpp
- Revision:
- 44:ffac07bff0d8
- Parent:
- 42:bb1d9d8a9fe4
- Child:
- 45:2d877f01ca7b
--- a/LEDDriver.cpp Wed May 02 14:03:16 2018 +0000 +++ b/LEDDriver.cpp Wed May 02 15:04:28 2018 +0000 @@ -12,23 +12,30 @@ void LEDDriver::drive(int numberOfLeds) { - poll(numberOfLeds,1) ; - poll(numberOfLeds,2) ; + poll(numberOfLeds,1); + poll(numberOfLeds,2); + sendData(); + + /* Ticker ticker; while(true) { poll(numberOfLeds,1) ;//prep multi //for(int i =0;i<numberOfLeds;i++) //{ - ticker.attach(this,&LEDDriver::sendData,0.000625f); + //ticker.attach(this,&LEDDriver::sendData,0.000625f); //} poll(numberOfLeds,2) ; - } + }*/ } -void LEDDriver::run(int numberOfLeds) +void LEDDriver::run(Ticker* ticker) { - drive(numberOfLeds); + ticker->attach(this,&LEDDriver::drive8leds,1); +} + +void LEDDriver::drive8leds(){ + drive(8); } void LEDDriver::ownWait(uint32_t us) @@ -48,11 +55,11 @@ { for(int i =0;i<(numberOfLeds/2);i++) { - //osEvent event = queue->get(); - //int temp = *((int*)event.value.p); - //if(temp==1||temp==1||temp==2||temp==3) + osEvent event = queue->get(); + int temp = *((int*)event.value.p); + if(temp==1||temp==1||temp==2||temp==3) { - messageList[i]=1; + messageList[i]=temp; } } } @@ -60,11 +67,11 @@ { for(int i =(numberOfLeds/2);i<(numberOfLeds);i++) { - //osEvent event = queue->get(); - //int temp = *((int*)event.value.p); - //if(temp==1||temp==1||temp==2||temp==3) + osEvent event = queue->get(); + int temp = *((int*)event.value.p); + if(temp==1||temp==1||temp==2||temp==3) { - messageList[i]=1; + messageList[i]=temp; } } }