/** * \brief Send logical "0" over RF * \details azero bit be represented by an off-to-on 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::sendZero(void) { SEND_HIGH(); delayMicroseconds(TIME); SEND_LOW(); delayMicroseconds(TWOTIME); SEND_HIGH(); delayMicroseconds(TIME); }
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; }