void rf_path_set_direction(const rf_path_direction_t direction) { /* Turn off TX and RX amplifiers, then enable based on direction and bypass state. */ switchctrl |= SWITCHCTRL_NO_TX_AMP_PWR | SWITCHCTRL_NO_RX_AMP_PWR; switch(direction) { case RF_PATH_DIRECTION_TX: switchctrl |= SWITCHCTRL_TX; if( (switchctrl & SWITCHCTRL_AMP_BYPASS) == 0 ) { /* TX amplifier is in path, be sure to enable TX amplifier. */ switchctrl &= ~SWITCHCTRL_NO_TX_AMP_PWR; } rffc5071_tx(); if( switchctrl & SWITCHCTRL_MIX_BYPASS ) { rffc5071_disable(); } else { rffc5071_enable(); } ssp1_set_mode_max5864(); max5864_tx(); ssp1_set_mode_max2837(); max2837_tx(); sgpio_configure(SGPIO_DIRECTION_TX); break; case RF_PATH_DIRECTION_RX: switchctrl &= ~SWITCHCTRL_TX; if( (switchctrl & SWITCHCTRL_AMP_BYPASS) == 0 ) { /* RX amplifier is in path, be sure to enable RX amplifier. */ switchctrl &= ~SWITCHCTRL_NO_RX_AMP_PWR; } rffc5071_rx(); if( switchctrl & SWITCHCTRL_MIX_BYPASS ) { rffc5071_disable(); } else { rffc5071_enable(); } ssp1_set_mode_max5864(); max5864_rx(); ssp1_set_mode_max2837(); max2837_rx(); sgpio_configure(SGPIO_DIRECTION_RX); break; case RF_PATH_DIRECTION_OFF: default: #ifdef HACKRF_ONE rf_path_set_antenna(0); #endif /* Set RF path to receive direction when "off" */ switchctrl &= ~SWITCHCTRL_TX; rffc5071_disable(); ssp1_set_mode_max5864(); max5864_standby(); ssp1_set_mode_max2837(); max2837_set_mode(MAX2837_MODE_STANDBY); sgpio_configure(SGPIO_DIRECTION_RX); break; } switchctrl_set(switchctrl); }
void rf_path_init(void) { ssp1_set_mode_max5864(); max5864_shutdown(); ssp1_set_mode_max2837(); max2837_setup(); max2837_start(); rffc5071_setup(); switchctrl_set(switchctrl); }
void rf_path_init(rf_path_t* const rf_path) { ssp1_set_mode_max5864(); max5864_setup(&max5864); max5864_shutdown(&max5864); ssp1_set_mode_max2837(); max2837_setup(&max2837); max2837_start(&max2837); rffc5071_setup(&rffc5072); switchctrl_set(rf_path, switchctrl); }