added get_rssi_packet for getting RSSI from the last packet received

This commit is contained in:
joxe 2008-10-29 09:22:39 +00:00
parent eb08babd4c
commit bc39f2a86c
2 changed files with 13 additions and 2 deletions

View File

@ -347,10 +347,17 @@ cc1020_off(void)
uint8_t
cc1020_get_rssi(void)
{
rssi = cc1020_read_reg(CC1020_RSS);
return cc1020_read_reg(CC1020_RSS);
}
uint8_t
cc1020_get_packet_rssi(void)
{
return rssi;
}
int
cc1020_carrier_sense(void)
{
@ -423,7 +430,10 @@ interrupt(UART0RX_VECTOR) cc1020_rxhandler(void)
} else {
return;
}
// Update RSSI.
/* Update RSSI.
TODO: add sampling/averaging of several RSSI to get
more reliable RSSI values
*/
rssi = cc1020_read_reg(CC1020_RSS);
CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_RECEIVING);
} else if (cc1020_state & CC1020_RX_RECEIVING) {

View File

@ -60,6 +60,7 @@ void cc1020_set_tx(void);
void cc1020_set_power(uint8_t pa_power);
int cc1020_carrier_sense(void);
uint8_t cc1020_get_rssi(void);
uint8_t cc1020_get_packet_rssi(void);
int cc1020_sending(void);
int cc1020_send(const void *buf, unsigned short size);