void cc1100IRQ (void) { if (cc1100_read1(0x3B | READ | BURST) > 0) { RF_getfifo(RFbuf); cc1100_strobe(SIDLE); cc1100_strobe(SFRX); struct cc1100frame_ *RXframe; RXframe = (struct cc1100frame_ *)&RFbuf[0]; if ((RXframe->len == 1) && ((RXframe->destAddr == cc1100Addr) || (RXframe->destAddr == 0x00))) { switch_WOR_RX(); } if(RFstatus & WORenabled) cc1100_strobe(SWOR); else cc1100_strobe(SRX); if (RXframe->len > 3) { setCBIntervall(WORrx_cb,WORrx_time); switch ( RXframe->packetType) { case 0x01: draw_block(0,50,128,10,3,DRAW_ERASE); draw_string(0, 50, (char*)&RFbuf[headerLen], 3, DRAW_PUT); break; case 0x02: if (RXframe->data[0] == 0x01) { RXframe->destAddr = RXframe->srcAddr; RXframe->srcAddr = cc1100Addr; RXframe->data[0] = 0x02; RXframe->len = 0x04; switch_to_idle(); RF_send(RFbuf); } else if (RFbuf[headerLen] == 0x02) { RFstatus |= Received; } break; case 0x03: if ((RXframe->data[0] == 0x01) && (timeInfo & time_accurate)) { send_time(RXframe->srcAddr); } else if (RFbuf[headerLen] == 0x02) { memcpy((unsigned char *)&time,(unsigned char *)&RXframe->data[1],3); memcpy((unsigned char *)&date,(unsigned char *)&RXframe->data[4],4); timeInfo |=0x02; VICSoftInt = INT_EINT2; } } } } waitTX(); EXTINT = 0x01; }
void switch_to_idle_1() { cc1100_strobe(SIDLE); while (cc1100_read1(MARCSTATE) != 01); }
void switch_to_idle() { cc1100_strobe(SIDLE); while (cc1100_read1(0x35 | READ | BURST) != 01); }