CCA measurement was always returning busy
This commit is contained in:
parent
b70d2b3163
commit
cdcb2c4744
1 changed files with 9 additions and 7 deletions
|
@ -566,7 +566,7 @@ set_txpower(uint8_t power)
|
||||||
void
|
void
|
||||||
calibrate_rc_osc_32k(void)
|
calibrate_rc_osc_32k(void)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 0
|
||||||
|
|
||||||
/* Calibrate RC Oscillator: The calibration routine is done by clocking TIMER2
|
/* Calibrate RC Oscillator: The calibration routine is done by clocking TIMER2
|
||||||
* from the external 32kHz crystal while running an internal timer simultaneously.
|
* from the external 32kHz crystal while running an internal timer simultaneously.
|
||||||
|
@ -1473,8 +1473,8 @@ rf230_get_raw_rssi(void)
|
||||||
static int
|
static int
|
||||||
rf230_cca(void)
|
rf230_cca(void)
|
||||||
{
|
{
|
||||||
int cca;
|
uint8_t cca=0;
|
||||||
int radio_was_off = 0;
|
uint8_t radio_was_off = 0;
|
||||||
|
|
||||||
/* If the radio is locked by an underlying thread (because we are
|
/* If the radio is locked by an underlying thread (because we are
|
||||||
being invoked through an interrupt), we preted that the coast is
|
being invoked through an interrupt), we preted that the coast is
|
||||||
|
@ -1495,16 +1495,18 @@ rf230_cca(void)
|
||||||
//hal_subregister_write(SR_CCA_MODE,1);
|
//hal_subregister_write(SR_CCA_MODE,1);
|
||||||
|
|
||||||
/* Start the CCA, wait till done, return result */
|
/* Start the CCA, wait till done, return result */
|
||||||
|
/* Note reading the TRX_STATUS register clears both CCA_STATUS and CCA_DONE bits */
|
||||||
hal_subregister_write(SR_CCA_REQUEST,1);
|
hal_subregister_write(SR_CCA_REQUEST,1);
|
||||||
delay_us(TIME_CCA);
|
delay_us(TIME_CCA);
|
||||||
//while ((hal_register_read(RG_TRX_STATUS) & 0x80) == 0 ) {continue;}
|
while ((cca & 0x80) == 0 ) {
|
||||||
while (!hal_subregister_read(SR_CCA_DONE)) {continue;}
|
cca=hal_register_read(RG_TRX_STATUS);
|
||||||
cca=hal_subregister_read(SR_CCA_STATUS);
|
}
|
||||||
|
|
||||||
if(radio_was_off) {
|
if(radio_was_off) {
|
||||||
rf230_off();
|
rf230_off();
|
||||||
}
|
}
|
||||||
return cca;
|
|
||||||
|
if (cca & 0x70) return 1; else return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Reference in a new issue