Push MAX2837 state management into rf_path_set_direction().
This commit is contained in:
@ -82,6 +82,8 @@ void rf_path_set_direction(const rf_path_direction_t direction) {
|
|||||||
} else {
|
} else {
|
||||||
rffc5071_enable();
|
rffc5071_enable();
|
||||||
}
|
}
|
||||||
|
max2837_start();
|
||||||
|
max2837_tx();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RF_PATH_DIRECTION_RX:
|
case RF_PATH_DIRECTION_RX:
|
||||||
@ -96,6 +98,8 @@ void rf_path_set_direction(const rf_path_direction_t direction) {
|
|||||||
} else {
|
} else {
|
||||||
rffc5071_enable();
|
rffc5071_enable();
|
||||||
}
|
}
|
||||||
|
max2837_start();
|
||||||
|
max2837_rx();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RF_PATH_DIRECTION_OFF:
|
case RF_PATH_DIRECTION_OFF:
|
||||||
@ -103,6 +107,7 @@ void rf_path_set_direction(const rf_path_direction_t direction) {
|
|||||||
/* Set RF path to receive direction when "off" */
|
/* Set RF path to receive direction when "off" */
|
||||||
switchctrl &= ~SWITCHCTRL_TX;
|
switchctrl &= ~SWITCHCTRL_TX;
|
||||||
rffc5071_disable();
|
rffc5071_disable();
|
||||||
|
max2837_stop();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,23 +179,16 @@ void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode) {
|
|||||||
gpio_clear(PORT_LED1_3, PIN_LED3);
|
gpio_clear(PORT_LED1_3, PIN_LED3);
|
||||||
gpio_set(PORT_LED1_3, PIN_LED2);
|
gpio_set(PORT_LED1_3, PIN_LED2);
|
||||||
usb_endpoint_init(&usb_endpoint_bulk_in);
|
usb_endpoint_init(&usb_endpoint_bulk_in);
|
||||||
|
|
||||||
rf_path_set_direction(RF_PATH_DIRECTION_RX);
|
rf_path_set_direction(RF_PATH_DIRECTION_RX);
|
||||||
max2837_start();
|
|
||||||
max2837_rx();
|
|
||||||
} else if (transceiver_mode == TRANSCEIVER_MODE_TX) {
|
} else if (transceiver_mode == TRANSCEIVER_MODE_TX) {
|
||||||
gpio_clear(PORT_LED1_3, PIN_LED2);
|
gpio_clear(PORT_LED1_3, PIN_LED2);
|
||||||
gpio_set(PORT_LED1_3, PIN_LED3);
|
gpio_set(PORT_LED1_3, PIN_LED3);
|
||||||
usb_endpoint_init(&usb_endpoint_bulk_out);
|
usb_endpoint_init(&usb_endpoint_bulk_out);
|
||||||
|
|
||||||
rf_path_set_direction(RF_PATH_DIRECTION_TX);
|
rf_path_set_direction(RF_PATH_DIRECTION_TX);
|
||||||
max2837_start();
|
|
||||||
max2837_tx();
|
|
||||||
} else {
|
} else {
|
||||||
gpio_clear(PORT_LED1_3, PIN_LED2);
|
gpio_clear(PORT_LED1_3, PIN_LED2);
|
||||||
gpio_clear(PORT_LED1_3, PIN_LED3);
|
gpio_clear(PORT_LED1_3, PIN_LED3);
|
||||||
rf_path_set_direction(RF_PATH_DIRECTION_OFF);
|
rf_path_set_direction(RF_PATH_DIRECTION_OFF);
|
||||||
max2837_stop();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user