added get_rssi_packet for getting RSSI from the last packet received
This commit is contained in:
parent
eb08babd4c
commit
bc39f2a86c
2 changed files with 13 additions and 2 deletions
|
@ -347,10 +347,17 @@ cc1020_off(void)
|
||||||
uint8_t
|
uint8_t
|
||||||
cc1020_get_rssi(void)
|
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;
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
cc1020_carrier_sense(void)
|
cc1020_carrier_sense(void)
|
||||||
{
|
{
|
||||||
|
@ -423,7 +430,10 @@ interrupt(UART0RX_VECTOR) cc1020_rxhandler(void)
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Update RSSI.
|
/* Update RSSI.
|
||||||
|
TODO: add sampling/averaging of several RSSI to get
|
||||||
|
more reliable RSSI values
|
||||||
|
*/
|
||||||
rssi = cc1020_read_reg(CC1020_RSS);
|
rssi = cc1020_read_reg(CC1020_RSS);
|
||||||
CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_RECEIVING);
|
CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_RECEIVING);
|
||||||
} else if (cc1020_state & CC1020_RX_RECEIVING) {
|
} else if (cc1020_state & CC1020_RX_RECEIVING) {
|
||||||
|
|
|
@ -60,6 +60,7 @@ void cc1020_set_tx(void);
|
||||||
void cc1020_set_power(uint8_t pa_power);
|
void cc1020_set_power(uint8_t pa_power);
|
||||||
int cc1020_carrier_sense(void);
|
int cc1020_carrier_sense(void);
|
||||||
uint8_t cc1020_get_rssi(void);
|
uint8_t cc1020_get_rssi(void);
|
||||||
|
uint8_t cc1020_get_packet_rssi(void);
|
||||||
int cc1020_sending(void);
|
int cc1020_sending(void);
|
||||||
|
|
||||||
int cc1020_send(const void *buf, unsigned short size);
|
int cc1020_send(const void *buf, unsigned short size);
|
||||||
|
|
Loading…
Reference in a new issue