Kenji Arai / SoftSerial_IR

Dependents:   TestVirtualisation Bf_SoftSerial_IR

Revision:
13:2b5649a1278a
Parent:
12:79d63607bbb1
Child:
14:dc766032cdd6
--- a/SoftSerial_rx_IR.cpp	Mon Dec 17 03:38:12 2018 +0000
+++ b/SoftSerial_rx_IR.cpp	Thu Dec 20 00:43:12 2018 +0000
@@ -1,6 +1,9 @@
+// Apply for Infrared LED and IR-Detector
+//      Modified by JH1PJL Dec. 19th, 2018
+
 #include "SoftSerial_IR.h"
 
-uint32_t overhead_us_IR = 200 * 1000000 / SystemCoreClock;         //Random estimation of the overhead of mbed libs, makes slow devices like LPC812 @ 12MHz perform better
+//extern DigitalOut  myled;    // Debug
 
 int SoftSerial_IR::_getc( void ) {
     while(!readable());
@@ -14,7 +17,8 @@
 
 //Start receiving byte
 void SoftSerial_IR::rx_gpio_irq_handler(void) {
-    rxticker.prime();
+    //myled = !myled; // Debug
+    rxticker.prime(timestamp_offset);
     rxticker.setNext(bit_period + (bit_period >> 1) - overhead_us_IR);
     rx->fall(NULL);
     rx_bit = 0;
@@ -22,6 +26,7 @@
 };    
 
 void SoftSerial_IR::rx_handler(void) {
+    //myled = !myled; // Debug
     //Receive data
     int val = rx->read();
  
@@ -81,4 +86,3 @@
     rxticker.detach(); 
     rx->fall(this, &SoftSerial_IR::rx_gpio_irq_handler);
 }
-