/** * \brief Send logical "1" over RF * \details a one bit be represented by an on-to-off transition * \ of the RF signal at the middle of a clock period. * \ Remenber, the Oregon v2.1 protocol add an inverted bit first */ inline void OSV2::sendOne(void) { SEND_LOW(); delayMicroseconds(TIME); SEND_HIGH(); delayMicroseconds(TWOTIME); SEND_LOW(); delayMicroseconds(TIME); }
void OSV2::send() { // Send the Message over RF sendOregon(); // Send a "pause" SEND_LOW(); delayMicroseconds(TWOTIME*8); // Send a copie of the first message. The v2.1 protocol send the // message two time sendOregon(); SEND_LOW(); }
OSV2::OSV2(byte txPin) { m_txPin = txPin; // digital pin for transmitter pinMode(m_txPin,OUTPUT); SEND_LOW(); }
int hw_sendData( const int REG, const unsigned char data_) { unsigned long int_flags; struct timeval tv1,tv2; unsigned char data = data_; Fin(); if (REG<0 || REG>8) { Ftr(); return -1; } Ftr(" echo %d > %d", data, REG); if (REG == 0) { // 1110 0111 data &= 0xe7; // To disable unstable flags, vendor suggests it. } do_gettimeofday(&tv1); spin_lock_irqsave(&my_lock, int_flags); mHW.reg[REG] = data; gpio_set_value(mHW.CTRL, 1); udelay(20); // TDS: data start. typical 10 us // fill the address. if (REG&0x08) SEND_HIGH(); else SEND_LOW(); if (REG&0x04) SEND_HIGH(); else SEND_LOW(); if (REG&0x02) SEND_HIGH(); else SEND_LOW(); if (REG&0x01) SEND_HIGH(); else SEND_LOW(); // fill the data. if (data&0x80) SEND_HIGH(); else SEND_LOW(); if (data&0x40) SEND_HIGH(); else SEND_LOW(); if (data&0x20) SEND_HIGH(); else SEND_LOW(); if (data&0x10) SEND_HIGH(); else SEND_LOW(); if (data&0x08) SEND_HIGH(); else SEND_LOW(); if (data&0x04) SEND_HIGH(); else SEND_LOW(); if (data&0x02) SEND_HIGH(); else SEND_LOW(); if (data&0x01) SEND_HIGH(); else SEND_LOW(); // fill EOD gpio_set_value(mHW.CTRL,0); udelay(8); //typical val: 2 us gpio_set_value(mHW.CTRL,1); udelay(400); //typical val: 350 us spin_unlock_irqrestore(&my_lock, int_flags); do_gettimeofday(&tv2); Fout("at %d, tv: (%d)us", REG, tv2.tv_usec - tv1.tv_usec); return 1; }