RFFC tx and rx functions updated for Jawbreaker
This commit is contained in:
@ -367,26 +367,58 @@ void rffc5071_regs_commit(void)
|
||||
}
|
||||
}
|
||||
|
||||
void rffc5071_tx(void) {
|
||||
void rffc5071_tx(uint8_t gpo) {
|
||||
LOG("# rffc5071_tx\n");
|
||||
set_RFFC5071_ENBL(0);
|
||||
set_RFFC5071_FULLD(0);
|
||||
set_RFFC5071_MODE(0); /* mixer 1 only (TX) */
|
||||
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);
|
||||
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);
|
||||
#endif
|
||||
rffc5071_regs_commit();
|
||||
|
||||
rffc5071_enable();
|
||||
#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(void) {
|
||||
void rffc5071_rx(uint8_t gpo) {
|
||||
LOG("# rfc5071_rx\n");
|
||||
set_RFFC5071_ENBL(0);
|
||||
set_RFFC5071_FULLD(0);
|
||||
set_RFFC5071_MODE(1); /* mixer 2 only (RX) */
|
||||
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);
|
||||
if ((gpo & SWITCHCTRL_AMP_BYPASS) == SWITCHCTRL_AMP_BYPASS)
|
||||
gpo |= SWITCHCTRL_NO_RX_AMP_PWR;
|
||||
gpo |= SWITCHCTRL_NO_TX_AMP_PWR;
|
||||
rffc5071_set_gpo(gpo);
|
||||
#endif
|
||||
rffc5071_regs_commit();
|
||||
|
||||
rffc5071_enable();
|
||||
#ifdef JAWBREAKER
|
||||
/* honor SWITCHCTRL_MIX_BYPASS setting from caller */
|
||||
if ((gpo & SWITCHCTRL_MIX_BYPASS) == SWITCHCTRL_MIX_BYPASS)
|
||||
rffc5071_disable();
|
||||
else
|
||||
#endif
|
||||
rffc5071_enable();
|
||||
}
|
||||
|
||||
/*
|
||||
* This function turns on both mixer (full-duplex) on the RFFC5071, but our
|
||||
* current hardware designs do not support full-duplex operation.
|
||||
*/
|
||||
void rffc5071_rxtx(void) {
|
||||
LOG("# rfc5071_rxtx\n");
|
||||
set_RFFC5071_ENBL(0);
|
||||
|
@ -43,6 +43,10 @@ extern uint32_t rffc5071_regs_dirty;
|
||||
#define SWITCHCTRL_HP (1 << 4) /* 1 for high-pass, 0 for low-pass */
|
||||
#define SWITCHCTRL_NO_RX_AMP_PWR (1 << 5) /* 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
|
||||
|
||||
@ -71,8 +75,8 @@ extern uint16_t rffc5071_set_frequency(uint16_t mhz, uint32_t hz);
|
||||
|
||||
/* Set up rx only, tx only, or full duplex. Chip should be disabled
|
||||
* before _tx, _rx, or _rxtx are called. */
|
||||
extern void rffc5071_tx(void);
|
||||
extern void rffc5071_rx(void);
|
||||
extern void rffc5071_tx(uint8_t);
|
||||
extern void rffc5071_rx(uint8_t);
|
||||
extern void rffc5071_rxtx(void);
|
||||
extern void rffc5071_enable(void);
|
||||
extern void rffc5071_disable(void);
|
||||
|
@ -311,6 +311,7 @@ void configure_sgpio_test_rx() {
|
||||
int main(void) {
|
||||
|
||||
const uint32_t freq = 2700000000U;
|
||||
uint8_t switchctrl = 0;
|
||||
|
||||
pin_setup();
|
||||
enable_1v8_power();
|
||||
@ -326,8 +327,11 @@ int main(void) {
|
||||
ssp1_set_mode_max2837();
|
||||
max2837_setup();
|
||||
rffc5071_setup();
|
||||
rffc5071_rx();
|
||||
rffc5071_set_frequency(500, 0); // 500 MHz, 0 Hz (Hz ignored)
|
||||
#ifdef JAWBREAKER
|
||||
switchctrl = (SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_HP);
|
||||
#endif
|
||||
rffc5071_rx(switchctrl);
|
||||
|
||||
max2837_set_frequency(freq);
|
||||
max2837_start();
|
||||
|
Reference in New Issue
Block a user