m3pi for proj2
Dependencies: RemoteIR m3pi mbed-rtos mbed
Diff: LightCommunication.cpp
- Revision:
- 5:5d2beac511c1
- Parent:
- 4:9580760cdd1f
- Child:
- 6:02f045d7695d
--- a/LightCommunication.cpp Tue May 09 23:20:12 2017 +0200 +++ b/LightCommunication.cpp Wed May 10 00:01:25 2017 +0200 @@ -19,28 +19,25 @@ } -char * LightCommunication::getSerial() { - char test[3]; +void LightCommunication::getSerial(char * test) { if(device.readable()) { device.scanf("%s",test); } - return test; } -uint8_t * LightCommunication::getIRStyle() { +void LightCommunication::getIRStyle(uint8_t * buf) { RemoteIR::Format format; - uint8_t buf[32]; int bitcount; if (ir_rx.getState() == ReceiverIR::Received) { bitcount = ir_rx.getData(&format, buf, sizeof(buf) * 8); } - return buf; } void LightCommunication::receiveData() { mut.lock(); //uint8_t * data = LightCommunication::getIRStyle(); - char * data = LightCommunication::getSerial(); + char data[3]; + LightCommunication::getSerial(data); printf("%X \n",data[2]); printf("%d \n",data[2]);