#include #include #include #include #ifdef __arm__ #include #else #define LOW 0 #define HIGH 1 #define INPUT 0 #define OUTPUT 1 int wiringPiSetup(void) {return 0;} void pinMode (int a, int b) {a=b;} 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" #include "buffer.h" #include "utils.h" unsigned int portail_timings[3][2] = { {1140, 380}, // bit 0 {380, 1140}, // bit 1 {380, 790}, // start of data }; extern unsigned char homeEasyPinOut; extern unsigned char homeEasyPinIn; unsigned char frame[5]; unsigned int size = 0; /** * Create a complete command according to Chacon protocole * * @param id command id (refer to your remote) * @param section button section ('A' | 'B' | 'C' | 'D' | 'G') * @param nb button number(1, 2, 3, 4) * @param on boolean for on/off * * @return HomeEasy frame */ void createPortailCommand(unsigned long int id, char section) { int btn = 0; if(section == 'B'){ btn = 0x7B; }else if(section == 'A'){ btn = 0x7D; }else if(section == 'C'){ btn = 0x79; }else if(section == 'D'){ btn = 0x7F; } printf(" section :%c btn : %x id: %x \n",section,btn,id); frame[0] = id; frame[1]=0xF7; frame[2]=btn; frame[3]=0xA1; frame[4]=0x00; size = 36; return; } /** * Send n times a data frame * * @param frame the data to send * @param repeat number of repeatition */ void sendPortailFrame(unsigned int repeat) { unsigned int i; // switch to real time cpuMode(REAL_TIME); // repeat the command for(i=0; i= 8) ? 8: (size - i); sendPortailByte(frame[i/8],bits); } }