APP4 S5

Dependencies:   mbed-rtos mbed

Revision:
7:d25bcde7dcf1
Parent:
6:f3f442d43c8f
Child:
8:a878763b0ae3
--- a/radio.cpp	Wed Oct 11 21:23:45 2017 +0000
+++ b/radio.cpp	Wed Oct 11 21:54:27 2017 +0000
@@ -8,7 +8,7 @@
 
 #define MESSAGE_BUFFER_SIZE 16
 
-#define MANCHESTER_SPEED_OUT 250
+#define MANCHESTER_SPEED_OUT 50
     
 #define INPUT_RADIO p18
 #define OUTPUT_RADIO p6
@@ -92,7 +92,8 @@
     // On avance dans le buffer;
     out_message_in++;
     //////////////////////////////////////////////////////   
-    
+    output = 0;
+    wait(1);
     out_timer.start(MANCHESTER_SPEED_OUT);       
 }
 
@@ -167,7 +168,7 @@
                 {
                     current_byte++;
                     current_byte_progress = 0;                 
-                    if (current_byte > message->length)
+                    if (current_byte >= message->length)
                     {
                         current_byte = 0;
                         current_state++;
@@ -194,10 +195,7 @@
                 current_byte = 0;
                 current_byte_progress = 0;
                 break;
-            }
-                
-            
-                
+            }                                         
         }
         
         if (next_value != output)
@@ -216,4 +214,6 @@
         output = !output;
     }
     
+    IsBitTransition = !IsBitTransition;
+    
 }