Exemple #1
0
void radio_getReceivedFrame(uint8_t* bufRead,
                            uint8_t* lenRead,
                            uint8_t maxBufLen,
                             int8_t* rssi,
                            uint8_t* lqi,
                            uint8_t* crc) {
   // read the received packet from the RXFIFO
   radio_spiReadRxFifo(&radio_vars.radioStatusByte, bufRead, lenRead, maxBufLen);
   
   // On reception, because of PCKTCTRL.APPEND_STATUS enabled,
   // we receive :
   // - [1B] the rssi
   // - [1B] whether CRC checked (bit 7) and LQI (bit 6-0)
   *rssi = *(bufRead+*lenRead-2);
   *crc = ((*(bufRead+*lenRead-1))&0x80)>>7;
   *lqi = (*(bufRead+*lenRead-1))&0x7f;
}
Exemple #2
0
void radio_getReceivedFrame(uint8_t* bufRead,
                            uint8_t* lenRead,
                            uint8_t  maxBufLen,
                             int8_t* rssi,
                            uint8_t* lqi,
                            uint8_t* crc) {
   // read the received packet from the RXFIFO
   radio_spiReadRxFifo(&radio_vars.radioStatusByte, bufRead, lenRead, maxBufLen);
   
   // On reception, when MODEMCTRL0.AUTOCRC is set, the CC2420 replaces the
   // received CRC by:
   // - [1B] the rssi, a signed value. The actual value in dBm is that - 45.
   // - [1B] whether CRC checked (bit 7) and LQI (bit 6-0)
   *rssi  =  *(bufRead+*lenRead-2);
   *rssi -= 45;
   *crc   = ((*(bufRead+*lenRead-1))&0x80)>>7;
   *lqi   =  (*(bufRead+*lenRead-1))&0x7f;
}
Exemple #3
0
void radio_getReceivedFrame(uint8_t* pBufRead,
                            uint8_t* pLenRead,
                            uint8_t  maxBufLen,
                             int8_t* pRssi,
                            uint8_t* pLqi,
                            uint8_t* pCrc) {
   uint8_t temp_reg_value;
   
   //===== crc
   temp_reg_value  = radio_spiReadReg(RG_PHY_RSSI);
   *pCrc           = (temp_reg_value & 0x80)>>7;  // msb is whether packet passed CRC
   
   //===== rssi
   // as per section 8.4.3 of the AT86RF231, the RSSI is calculate as:
   // -91 + ED [dBm]
   temp_reg_value  = radio_spiReadReg(RG_PHY_ED_LEVEL);
   *pRssi          = -91 + temp_reg_value;
   
   //===== packet
   radio_spiReadRxFifo(pBufRead,
                       pLenRead,
                       maxBufLen,
                       pLqi);
}