OldRemmote allows you to record IR remotes and upload the IR code to your smartphone to replay it later. Check www.julesthuillier.com for more information
Dependencies: BLE_API mbed nRF51822
Revision 4:688a955562ad, committed 2015-02-09
- Comitter:
- JulesThuillier
- Date:
- Mon Feb 09 16:43:09 2015 +0000
- Parent:
- 3:a491b09cfd3b
- Commit message:
- send OK
Changed in this revision
diff -r a491b09cfd3b -r 688a955562ad main.cpp --- a/main.cpp Mon Feb 09 16:25:56 2015 +0000 +++ b/main.cpp Mon Feb 09 16:43:09 2015 +0000 @@ -57,6 +57,7 @@ uint8_t sendBufferIndex = 0; bool receivingDatas = false; +bool recording = false; // Convertit un tableau de char en int int char_to_int(char *data) @@ -320,6 +321,12 @@ repeat(); } + // Start recording + else if(strncmp(option, "record", split) == 0) + { + + } + else if(receivingDatas) { @@ -331,10 +338,11 @@ sendBufferIndex++; sendBuffer[sendBufferIndex] = duration; - if(sendBufferIndex == sendBuffer[0]-1) + if(sendBufferIndex == sendBuffer[0]) { DEBUG("Reception Over\r\n"); - receivingDatas = false; + receivingDatas = false; + sendIR(sendBuffer); } } else { @@ -355,47 +363,53 @@ void recordFinished() { - timerUp.reset(); - timerDown.reset(); - indexi = 0; - indexj = 0; - DEBUG("Record is over\r\n"); - for(int i=0; i<100; i++) - DEBUG("%d - ",recordBuffers[0][i]); - DEBUG("\r\n"); - for(int i=0; i<100; i++) - DEBUG("%d - ",recordBuffers[1][i]); - DEBUG("\r\n"); + if(recording){ + timerUp.reset(); + timerDown.reset(); + indexi = 0; + indexj = 0; + DEBUG("Record is over\r\n"); + for(int i=0; i<100; i++) + DEBUG("%d - ",recordBuffers[0][i]); + DEBUG("\r\n"); + for(int i=0; i<100; i++) + DEBUG("%d - ",recordBuffers[1][i]); + DEBUG("\r\n"); + } } void irFall() { - // Arrete le timer - timerUp.stop(); - - timerDown.reset(); - timerDown.start(); - - // Demarrage du timer de shutdown; - recordOffTimer.attach_us(&recordFinished, RECORD_OFF_TIMER); - if(indexj<100 && indexi <3) - recordBuffers[indexi][indexj] = timerUp.read_us(); - indexj++; + if(recording){ + // Arrete le timer + timerUp.stop(); + + timerDown.reset(); + timerDown.start(); + + // Demarrage du timer de shutdown; + recordOffTimer.attach_us(&recordFinished, RECORD_OFF_TIMER); + if(indexj<100 && indexi <3) + recordBuffers[indexi][indexj] = timerUp.read_us(); + indexj++; + } } void irRise() { - timerDown.stop(); - - timerUp.reset(); - timerUp.start(); - - // Supprime le shutdown timer - recordOffTimer.detach(); - if(indexj<100 && indexi <3) - recordBuffers[indexi][indexj] = timerDown.read_us(); - indexj++; + if(recording){ + timerDown.stop(); + + timerUp.reset(); + timerUp.start(); + + // Supprime le shutdown timer + recordOffTimer.detach(); + if(indexj<100 && indexi <3) + recordBuffers[indexi][indexj] = timerDown.read_us(); + indexj++; + } }
diff -r a491b09cfd3b -r 688a955562ad mbed-src.lib --- a/mbed-src.lib Mon Feb 09 16:25:56 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed-src/#b90c5392bbcd
diff -r a491b09cfd3b -r 688a955562ad mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 09 16:43:09 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file