Change option value on the fly

This commit is contained in:
midelic 2016-08-16 19:20:38 +03:00 committed by GitHub
parent fe84731ad2
commit 5e3c3c00d6

View File

@ -81,7 +81,8 @@ static void __attribute__((unused)) SFHSS_rf_init()
for (uint8_t i = 0; i < 39; ++i) for (uint8_t i = 0; i < 39; ++i)
CC2500_WriteReg(i, pgm_read_byte_near(&SFHSS_init_values[i])); CC2500_WriteReg(i, pgm_read_byte_near(&SFHSS_init_values[i]));
//CC2500_WriteRegisterMulti(CC2500_00_IOCFG2, init_values, sizeof(init_values)); //CC2500_WriteRegisterMulti(CC2500_00_IOCFG2, init_values, sizeof(init_values));
CC2500_WriteReg(CC2500_0C_FSCTRL0, option); prev_option = 0;
//CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
CC2500_SetTxRxMode(TX_EN); CC2500_SetTxRxMode(TX_EN);
CC2500_SetPower(); CC2500_SetPower();
@ -107,8 +108,12 @@ static void __attribute__((unused)) SFHSS_tune_freq() {
// May be we'll need this tuning routine - some receivers are more sensitive to // May be we'll need this tuning routine - some receivers are more sensitive to
// frequency impreciseness, and though CC2500 has a procedure to handle it it // frequency impreciseness, and though CC2500 has a procedure to handle it it
// may not be applied in receivers, so we need to compensate for it on TX // may not be applied in receivers, so we need to compensate for it on TX
CC2500_WriteReg(CC2500_0C_FSCTRL0, option); if ( prev_option != option )
CC2500_WriteReg(CC2500_0F_FREQ0, SFHSS_FREQ0_VAL + SFHSS_COARSE); {
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
CC2500_WriteReg(CC2500_0F_FREQ0, SFHSS_FREQ0_VAL + SFHSS_COARSE);
prev_option = option ;
}
} }
#endif #endif
@ -265,4 +270,4 @@ uint16_t initSFHSS()
return 10000; return 10000;
} }
#endif #endif