Browse Source

clean code

Cyrille Meichel 10 years ago
parent
commit
14614d6df6
3 changed files with 7 additions and 15 deletions
  1. 0 1
      emit/emit.c
  2. 7 9
      emit/home_easy.c
  3. 0 5
      emit/home_easy.h

+ 0 - 1
emit/emit.c

@@ -123,7 +123,6 @@ int main(int argc, char** argv)
 
     initIO();
     sendHomeEasyCommand(idString, section, number, onOff, repeat);
-    closeIO();
 
     destroyByteBuffer(command);
     destroyByteBuffer(encoded);

+ 7 - 9
emit/home_easy.c

@@ -138,13 +138,20 @@ void sendHomeEasyCommand(unsigned char* id, char section, unsigned char nb, unsi
 {
 	BYTE_BUFFER command;
 	unsigned int i;
+    // build the command
 	command = createHomeEasyCommand(id, section, nb, on);
+    // switch to real time
+    scheduler_realtime();
+    // send header
 	sendHomeEasyBit(START_OF_DATA);
 	sendHomeEasyBit(START_OF_FRAME);
+    // repeat the command
 	for(i=0; i<repeat; i++) {
 		sendHomeEasyBytes(command);
 		sendHomeEasyBit(END_OF_FRAME);
 	}
+    // Exit real time mode
+    scheduler_standard();
 }
 
 /**
@@ -200,21 +207,12 @@ int initIO()
         printf("Setting up GPIO\n");
         pinMode(homeEasyPinIn, INPUT);
         pinMode(homeEasyPinOut, OUTPUT);
-        scheduler_realtime();
     } else {
         printf("GPIO setup failed %d\n", status);
     }
     return status;
 }
 
-/**
- * Return to normal mode
- */
-void closeIO()
-{
-    scheduler_standard();
-}
-
 /**
  * Send a bit to the RF transmitter
  * 

+ 0 - 5
emit/home_easy.h

@@ -84,11 +84,6 @@ void setHomeEasyTransmittorPin(unsigned char pinNumber);
  */
 int initIO();
 
-/**
- * Return to normal mode
- */
-void closeIO();
-
 /**
  * read the GPIO output pin
  *