diff --git a/platform/msb430/dev/cc1020.c b/platform/msb430/dev/cc1020.c index e8b5a8f43..d7049cd7d 100644 --- a/platform/msb430/dev/cc1020.c +++ b/platform/msb430/dev/cc1020.c @@ -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; diff --git a/platform/msb430/dev/cc1020.h b/platform/msb430/dev/cc1020.h index c33a41a37..98bc75756 100644 --- a/platform/msb430/dev/cc1020.h +++ b/platform/msb430/dev/cc1020.h @@ -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);