Extract knowledge of RF path configurations from the RFFC5071 driver.
Change initial RF path mode to SWITCHCTRL_SAFE. (Previously started at SWITCHCTRL_SAFE and then immediately switched to SWITCHCTRL_AMP_BYPASS.)
This commit is contained in:
@ -145,11 +145,6 @@ void rffc5071_setup(void)
|
||||
* not control pins. */
|
||||
set_RFFC5071_SIPIN(1);
|
||||
|
||||
#ifdef JAWBREAKER
|
||||
/* initial safe switch control settings */
|
||||
rffc5071_set_gpo(SWITCHCTRL_SAFE);
|
||||
#endif
|
||||
|
||||
/* GPOs are active at all times */
|
||||
set_RFFC5071_GATE(1);
|
||||
|
||||
@ -367,56 +362,20 @@ void rffc5071_regs_commit(void)
|
||||
}
|
||||
}
|
||||
|
||||
void rffc5071_tx(uint8_t gpo) {
|
||||
void rffc5071_tx(void) {
|
||||
LOG("# rffc5071_tx\n");
|
||||
set_RFFC5071_ENBL(0);
|
||||
set_RFFC5071_FULLD(0);
|
||||
set_RFFC5071_MODE(1); /* mixer 2 used for both RX and TX */
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_AMP_BYPASS and SWITCHCTRL_HP settings from caller */
|
||||
gpo &= (SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_MIX_BYPASS);
|
||||
if ((gpo & SWITCHCTRL_AMP_BYPASS) == SWITCHCTRL_AMP_BYPASS)
|
||||
gpo |= SWITCHCTRL_NO_TX_AMP_PWR;
|
||||
gpo |= (SWITCHCTRL_TX | SWITCHCTRL_NO_RX_AMP_PWR);
|
||||
rffc5071_set_gpo(gpo);
|
||||
#else
|
||||
(void)gpo;
|
||||
#endif
|
||||
rffc5071_regs_commit();
|
||||
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_MIX_BYPASS setting from caller */
|
||||
if ((gpo & SWITCHCTRL_MIX_BYPASS) == SWITCHCTRL_MIX_BYPASS)
|
||||
rffc5071_disable();
|
||||
else
|
||||
#endif
|
||||
rffc5071_enable();
|
||||
}
|
||||
|
||||
void rffc5071_rx(uint8_t gpo) {
|
||||
void rffc5071_rx(void) {
|
||||
LOG("# rfc5071_rx\n");
|
||||
set_RFFC5071_ENBL(0);
|
||||
set_RFFC5071_FULLD(0);
|
||||
set_RFFC5071_MODE(1); /* mixer 2 used for both RX and TX */
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_AMP_BYPASS and SWITCHCTRL_HP settings from caller */
|
||||
gpo &= (SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_MIX_BYPASS);
|
||||
if ((gpo & SWITCHCTRL_AMP_BYPASS) == SWITCHCTRL_AMP_BYPASS)
|
||||
gpo |= SWITCHCTRL_NO_RX_AMP_PWR;
|
||||
gpo |= SWITCHCTRL_NO_TX_AMP_PWR;
|
||||
rffc5071_set_gpo(gpo);
|
||||
#else
|
||||
(void)gpo;
|
||||
#endif
|
||||
rffc5071_regs_commit();
|
||||
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_MIX_BYPASS setting from caller */
|
||||
if ((gpo & SWITCHCTRL_MIX_BYPASS) == SWITCHCTRL_MIX_BYPASS)
|
||||
rffc5071_disable();
|
||||
else
|
||||
#endif
|
||||
rffc5071_enable();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -31,25 +31,6 @@ extern uint32_t rffc5071_regs_dirty;
|
||||
#define RFFC5071_REG_SET_CLEAN(r) rffc5071_regs_dirty &= ~(1UL<<r)
|
||||
#define RFFC5071_REG_SET_DIRTY(r) rffc5071_regs_dirty |= (1UL<<r)
|
||||
|
||||
#ifdef JAWBREAKER
|
||||
/*
|
||||
* RF switches on Jawbreaker are controlled by General Purpose Outputs (GPO) on
|
||||
* the RFFC5072.
|
||||
*/
|
||||
#define SWITCHCTRL_NO_TX_AMP_PWR (1 << 0) /* GPO1 turn off TX amp power */
|
||||
#define SWITCHCTRL_AMP_BYPASS (1 << 1) /* GPO2 bypass amp section */
|
||||
#define SWITCHCTRL_TX (1 << 2) /* GPO3 1 for TX mode, 0 for RX mode */
|
||||
#define SWITCHCTRL_MIX_BYPASS (1 << 3) /* GPO4 bypass RFFC5072 mixer section */
|
||||
#define SWITCHCTRL_HP (1 << 4) /* GPO5 1 for high-pass, 0 for low-pass */
|
||||
#define SWITCHCTRL_NO_RX_AMP_PWR (1 << 5) /* GPO6 turn off RX amp power */
|
||||
|
||||
/*
|
||||
* Safe (initial) switch settings turn off both amplifiers and enable both amp
|
||||
* bypass and mixer bypass.
|
||||
*/
|
||||
#define SWITCHCTRL_SAFE (SWITCHCTRL_NO_TX_AMP_PWR | SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_TX | SWITCHCTRL_MIX_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_NO_RX_AMP_PWR)
|
||||
#endif
|
||||
|
||||
/* Initialize chip. Call _setup() externally, as it calls _init(). */
|
||||
extern void rffc5071_init(void);
|
||||
extern void rffc5071_setup(void);
|
||||
@ -72,8 +53,8 @@ extern uint32_t rffc5071_set_frequency(uint16_t mhz);
|
||||
|
||||
/* Set up rx only, tx only, or full duplex. Chip should be disabled
|
||||
* before _tx, _rx, or _rxtx are called. */
|
||||
extern void rffc5071_tx(uint8_t);
|
||||
extern void rffc5071_rx(uint8_t);
|
||||
extern void rffc5071_tx(void);
|
||||
extern void rffc5071_rx(void);
|
||||
extern void rffc5071_rxtx(void);
|
||||
extern void rffc5071_enable(void);
|
||||
extern void rffc5071_disable(void);
|
||||
|
@ -74,14 +74,65 @@ typedef struct {
|
||||
|
||||
set_sample_r_params_t set_sample_r_params;
|
||||
|
||||
uint8_t switchctrl = 0;
|
||||
#ifdef JAWBREAKER
|
||||
/*
|
||||
* RF switches on Jawbreaker are controlled by General Purpose Outputs (GPO) on
|
||||
* the RFFC5072.
|
||||
*/
|
||||
#define SWITCHCTRL_NO_TX_AMP_PWR (1 << 0) /* GPO1 turn off TX amp power */
|
||||
#define SWITCHCTRL_AMP_BYPASS (1 << 1) /* GPO2 bypass amp section */
|
||||
#define SWITCHCTRL_TX (1 << 2) /* GPO3 1 for TX mode, 0 for RX mode */
|
||||
#define SWITCHCTRL_MIX_BYPASS (1 << 3) /* GPO4 bypass RFFC5072 mixer section */
|
||||
#define SWITCHCTRL_HP (1 << 4) /* GPO5 1 for high-pass, 0 for low-pass */
|
||||
#define SWITCHCTRL_NO_RX_AMP_PWR (1 << 5) /* GPO6 turn off RX amp power */
|
||||
|
||||
/*
|
||||
* Safe (initial) switch settings turn off both amplifiers and enable both amp
|
||||
* bypass and mixer bypass.
|
||||
*/
|
||||
#define SWITCHCTRL_SAFE (SWITCHCTRL_NO_TX_AMP_PWR | SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_TX | SWITCHCTRL_MIX_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_NO_RX_AMP_PWR)
|
||||
#endif
|
||||
|
||||
uint8_t switchctrl = SWITCHCTRL_SAFE;
|
||||
|
||||
void update_switches(void)
|
||||
{
|
||||
if (transceiver_mode == TRANSCEIVER_MODE_RX) {
|
||||
rffc5071_rx(switchctrl);
|
||||
rffc5071_rx();
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_AMP_BYPASS and SWITCHCTRL_HP settings from caller */
|
||||
switchctrl &= (SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_MIX_BYPASS);
|
||||
if ((switchctrl & SWITCHCTRL_AMP_BYPASS) == SWITCHCTRL_AMP_BYPASS)
|
||||
switchctrl |= SWITCHCTRL_NO_RX_AMP_PWR;
|
||||
switchctrl |= SWITCHCTRL_NO_TX_AMP_PWR;
|
||||
rffc5071_set_gpo(switchctrl);
|
||||
#endif
|
||||
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_MIX_BYPASS setting from caller */
|
||||
if ((switchctrl & SWITCHCTRL_MIX_BYPASS) == SWITCHCTRL_MIX_BYPASS)
|
||||
rffc5071_disable();
|
||||
else
|
||||
#endif
|
||||
rffc5071_enable();
|
||||
} else if (transceiver_mode == TRANSCEIVER_MODE_TX) {
|
||||
rffc5071_tx(switchctrl);
|
||||
rffc5071_tx();
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_AMP_BYPASS and SWITCHCTRL_HP settings from caller */
|
||||
switchctrl &= (SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_HP | SWITCHCTRL_MIX_BYPASS);
|
||||
if ((switchctrl & SWITCHCTRL_AMP_BYPASS) == SWITCHCTRL_AMP_BYPASS)
|
||||
switchctrl |= SWITCHCTRL_NO_TX_AMP_PWR;
|
||||
switchctrl |= (SWITCHCTRL_TX | SWITCHCTRL_NO_RX_AMP_PWR);
|
||||
rffc5071_set_gpo(switchctrl);
|
||||
#endif
|
||||
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_MIX_BYPASS setting from caller */
|
||||
if ((switchctrl & SWITCHCTRL_MIX_BYPASS) == SWITCHCTRL_MIX_BYPASS)
|
||||
rffc5071_disable();
|
||||
else
|
||||
#endif
|
||||
rffc5071_enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1000,9 +1051,9 @@ int main(void) {
|
||||
max2837_set_frequency(ifreq);
|
||||
|
||||
rffc5071_setup();
|
||||
|
||||
#ifdef JAWBREAKER
|
||||
switchctrl = SWITCHCTRL_AMP_BYPASS;
|
||||
/* initial safe switch control settings */
|
||||
rffc5071_set_gpo(switchctrl);
|
||||
#endif
|
||||
|
||||
while(true) {
|
||||
|
Reference in New Issue
Block a user