Browse Source

bug fixed

Cyrille 10 years ago
parent
commit
c0cde45b5f
2 changed files with 5 additions and 12 deletions
  1. 4 10
      emit/emit.c
  2. 1 2
      emit/home_easy.c

+ 4 - 10
emit/emit.c

@@ -1,7 +1,4 @@
 #include <stdio.h>
-#ifdef __arm__
-    #include <wiringPiSPI.h>
-#endif
 #include "home_easy.h"
 #include "buffer.h"
 #include <malloc.h>
@@ -36,8 +33,7 @@ void usage(char** argv)
  */
 int main(int argc, char** argv)
 {
-    //BIT_BUFFER buffer;
-    BYTE_BUFFER command;
+    unsigned long int command;
     BYTE_BUFFER encoded;
     int i;
     char optstring[] = "xvb:d:r:";
@@ -99,17 +95,15 @@ int main(int argc, char** argv)
         printf("Frame to send: %08X\n", command);
 
         printf("Code to emit:\n");
-        encoded = homeEasyEncode(&command);
+        encoded = homeEasyEncode(command);
         printfByteBuffer(encoded);
+        // release the memory
+        destroyByteBuffer(encoded);
     }
 
     // Send the data
     initIO();
     sendHomeEasyCommand(id, section, number, onOff, repeat);
 
-    // release the memory
-    destroyByteBuffer(command);
-    destroyByteBuffer(encoded);
-
     return 0;
 }

+ 1 - 2
emit/home_easy.c

@@ -4,7 +4,7 @@
 #include <string.h>
 
 #ifdef __arm__
-    #include <wiringPiSPI.h>
+    #include <wiringPi.h>
 #else
     #define LOW 0
     #define HIGH 1
@@ -15,7 +15,6 @@
     void delayMicroseconds(unsigned int a) {a=a;}
     void digitalWrite(int a, int b) {a=b;}
     int digitalRead(int a) {return a;}
-    
 #endif
 
 #include "home_easy.h"