diff --git a/cpu/avr/radio/rf230bb/halbb.c b/cpu/avr/radio/rf230bb/halbb.c index a3c0bc397..7dcfcd7bb 100644 --- a/cpu/avr/radio/rf230bb/halbb.c +++ b/cpu/avr/radio/rf230bb/halbb.c @@ -752,10 +752,14 @@ HAL_RF230_ISR() /*Handle the incomming interrupt. Prioritized.*/ if ((interrupt_source & HAL_RX_START_MASK)){ INTERRUPTDEBUG(10); - /* Save RSSI for this packet if not in extended mode, scaling to 1dB resolution (avoiding multiply) */ + /* Save RSSI for this packet if not in extended mode, scaling to 1dB resolution */ #if !RF230_CONF_AUTOACK +#if 0 // 3-clock shift and add is faster on machines with no hardware multiply rf230_last_rssi = hal_subregister_read(SR_RSSI); rf230_last_rssi = (rf230_last_rssi <<1) + rf230_last_rssi; +#else // Faster with 1-clock multiply. Raven and Jackdaw have 2-clock multiply so same speed while saving 2 bytes of program memory + rf230_last_rssi = 3 * hal_subregister_read(SR_RSSI); +#endif #endif // if(rx_start_callback != NULL){ // /* Read Frame length and call rx_start callback. */ diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index f4053a13c..76eb184cc 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: rf230bb.c,v 1.18 2010/12/14 22:34:18 dak664 Exp $ + * @(#)$Id: rf230bb.c,v 1.19 2010/12/15 14:11:06 dak664 Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -1231,8 +1231,13 @@ rf230_get_raw_rssi(void) if ((state==RX_AACK_ON) || (state==BUSY_RX_AACK)) { rssi = hal_subregister_read(SR_ED_LEVEL); //0-84, resolution 1 dB } else { +#if 0 // 3-clock shift and add is faster on machines with no hardware multiply rssi = hal_subregister_read(SR_RSSI); //0-28, resolution 3 dB - rssi = (rssi << 1) + rssi; //fast multiply by 3 + rssi = (rssi << 1) + rssi; //*3 +#else // Faster with 1-clock multiply. Raven and Jackdaw have 2-clock multiply so same speed while saving 2 bytes of program memory + rssi = 3 * hal_subregister_read(SR_RSSI); +#endif + } if(radio_was_off) {