Fixed code style and removed forgotten pritf's

This commit is contained in:
Carlos Pérez Penichet 2018-10-25 11:49:20 +02:00
parent 79a4fe33a6
commit c6770112af
2 changed files with 12 additions and 14 deletions

View File

@ -408,33 +408,31 @@ set_test_mode(uint8_t enable, uint8_t modulated)
radio_value_t mode;
get_value(RADIO_PARAM_POWER_MODE, &mode);
if (enable) {
if (mode == RADIO_POWER_MODE_CARRIER_ON) {
if(enable) {
if(mode == RADIO_POWER_MODE_CARRIER_ON) {
return;
}
was_on = (mode == RADIO_POWER_MODE_ON);
off();
prev_FRMCTRL0 = REG(RFCORE_XREG_FRMCTRL0);
// This constantly transmits random data
printf("FRMCTRL0: %08X\n", (unsigned int)prev_FRMCTRL0);
/* This constantly transmits random data */
REG(RFCORE_XREG_FRMCTRL0) = 0x00000042;
if (!modulated) {
if(!modulated) {
prev_MDMTEST1 = REG(RFCORE_XREG_MDMTEST1);
printf("MDMTEST1: %08X\n", (unsigned int)prev_MDMTEST1);
// ...adding this we send an unmodulated carrier instead
/* ...adding this we send an unmodulated carrier instead */
REG(RFCORE_XREG_MDMTEST1) = 0x00000018;
}
CC2538_RF_CSP_ISTXON();
} else {
if (mode != RADIO_POWER_MODE_CARRIER_ON) {
if(mode != RADIO_POWER_MODE_CARRIER_ON) {
return;
}
CC2538_RF_CSP_ISRFOFF();
REG(RFCORE_XREG_FRMCTRL0) = prev_FRMCTRL0;
if (!modulated) {
if(!modulated) {
REG(RFCORE_XREG_MDMTEST1) = prev_MDMTEST1;
}
if (was_on) {
if(was_on) {
on();
}
}

View File

@ -159,7 +159,7 @@ get_value(radio_param_t param, radio_value_t *value)
}
switch(param) {
case RADIO_PARAM_POWER_MODE:
if ((getreg(CC2420_MDMCTRL1) & TX_MODE) & 0x08) {
if((getreg(CC2420_MDMCTRL1) & TX_MODE) & 0x08) {
*value = RADIO_POWER_MODE_CARRIER_ON;
} else {
*value = receive_on ? RADIO_POWER_MODE_ON : RADIO_POWER_MODE_OFF;
@ -1140,17 +1140,17 @@ static uint16_t prev_MDMCTRL1, prev_DACTST;
static void
set_test_mode(uint8_t enable, uint8_t modulated)
{
if (enable) {
if(enable) {
prev_MDMCTRL1 = getreg(CC2420_MDMCTRL1);
setreg(CC2420_MDMCTRL1, 0x050C);
if (!modulated) {
if(!modulated) {
prev_DACTST = getreg(CC2420_DACTST);
setreg(CC2420_DACTST, 0x1800);
}
/* actually starts the test mode */
strobe(CC2420_STXON);
} else {
if (!modulated) {
if(!modulated) {
setreg(CC2420_DACTST, prev_DACTST);
}
setreg(CC2420_MDMCTRL1, prev_MDMCTRL1);