#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, 375}, // bit 0 {400, 1140}, // bit 1 {790, 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) { frame[0]=0xB6; frame[1]=0xF7; frame[2]=0x7B; 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 sendFrame(BYTE_BUFFER frame, unsigned int repeat) { unsigned int i; // switch to real time cpuMode(REAL_TIME); // repeat the command for(i=0; i0; i>>=1) { sendPortailBit((byte & i) == i); } } /** * Send the content of a buffer to the RF transmitter * * @param buffer the buffer to transmit */ void sendPortailBytes(void) { int i; for(i = 0; i < size; i+=8 ) { register unsigned int bits = (size - i >= 8) ? 8: (size - i); sendPortailByte(frame[i],bits); } }