Push MAX2837 state management into rf_path_set_direction().

This commit is contained in:
Jared Boone
2013-09-17 15:27:16 -07:00
parent e02d2f0325
commit 0e8e3c8d53
2 changed files with 5 additions and 7 deletions

View File

@ -82,6 +82,8 @@ void rf_path_set_direction(const rf_path_direction_t direction) {
} else {
rffc5071_enable();
}
max2837_start();
max2837_tx();
break;
case RF_PATH_DIRECTION_RX:
@ -96,6 +98,8 @@ void rf_path_set_direction(const rf_path_direction_t direction) {
} else {
rffc5071_enable();
}
max2837_start();
max2837_rx();
break;
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" */
switchctrl &= ~SWITCHCTRL_TX;
rffc5071_disable();
max2837_stop();
break;
}

View File

@ -179,23 +179,16 @@ void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode) {
gpio_clear(PORT_LED1_3, PIN_LED3);
gpio_set(PORT_LED1_3, PIN_LED2);
usb_endpoint_init(&usb_endpoint_bulk_in);
rf_path_set_direction(RF_PATH_DIRECTION_RX);
max2837_start();
max2837_rx();
} else if (transceiver_mode == TRANSCEIVER_MODE_TX) {
gpio_clear(PORT_LED1_3, PIN_LED2);
gpio_set(PORT_LED1_3, PIN_LED3);
usb_endpoint_init(&usb_endpoint_bulk_out);
rf_path_set_direction(RF_PATH_DIRECTION_TX);
max2837_start();
max2837_tx();
} else {
gpio_clear(PORT_LED1_3, PIN_LED2);
gpio_clear(PORT_LED1_3, PIN_LED3);
rf_path_set_direction(RF_PATH_DIRECTION_OFF);
max2837_stop();
return;
}