Added a carrier sensing function.
This commit is contained in:
parent
ee59f1fe34
commit
0e4429068b
2 changed files with 15 additions and 5 deletions
|
@ -203,7 +203,7 @@ cc1020_sending(void)
|
|||
}
|
||||
|
||||
int
|
||||
cc1020_send(const void *buf, unsigned short len)
|
||||
cc1020_send(const void *buf, unsigned len)
|
||||
{
|
||||
if (cc1020_state == CC1020_OFF)
|
||||
return -2;
|
||||
|
@ -235,9 +235,9 @@ cc1020_send(const void *buf, unsigned short len)
|
|||
}
|
||||
|
||||
int
|
||||
cc1020_read(void *buf, unsigned short size)
|
||||
cc1020_read(void *buf, unsigned size)
|
||||
{
|
||||
unsigned short len;
|
||||
unsigned len;
|
||||
|
||||
if (cc1020_rxlen <= HDRSIZE)
|
||||
return 0;
|
||||
|
@ -296,6 +296,14 @@ cc1020_get_rssi(void)
|
|||
return rssi;
|
||||
}
|
||||
|
||||
int
|
||||
cc1020_carrier_sense(void)
|
||||
{
|
||||
int carrier_sense;
|
||||
|
||||
return !!(cc1020_read_reg(CC1020_STATUS) & CARRIER_SENSE);
|
||||
}
|
||||
|
||||
interrupt(UART0RX_VECTOR) cc1020_rxhandler(void)
|
||||
{
|
||||
static signed char syncbs;
|
||||
|
|
|
@ -58,10 +58,12 @@ void cc1020_init(const uint8_t* config);
|
|||
void cc1020_set_rx(void);
|
||||
void cc1020_set_tx(void);
|
||||
void cc1020_set_power(uint8_t pa_power);
|
||||
int cc1020_carrier_sense(void);
|
||||
uint8_t cc1020_get_rssi(void);
|
||||
int cc1020_sending(void);
|
||||
|
||||
int cc1020_send(const void *buf, unsigned short size);
|
||||
int cc1020_read(void *buf, unsigned short size);
|
||||
int cc1020_send(const void *buf, unsigned size);
|
||||
int cc1020_read(void *buf, unsigned size);
|
||||
void cc1020_set_receiver(void (*recv)(const struct radio_driver *));
|
||||
int cc1020_on(void);
|
||||
int cc1020_off(void);
|
||||
|
|
Loading…
Reference in a new issue