1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

RM: Make the direction of the TX/RX lines come from the configuration file

This commit is contained in:
James Cotton 2012-09-04 23:22:56 -05:00
parent 844d14e2f5
commit 68fa464ccf
4 changed files with 15 additions and 2 deletions

View File

@ -1970,8 +1970,13 @@ int rfm22_resetModule(uint8_t mode, uint32_t min_frequency_hz, uint32_t max_freq
// choose the 3 GPIO pin functions
rfm22_write(RFM22_io_port_config, RFM22_io_port_default); // GPIO port use default value
if (rfm22b_dev_g->cfg.gpio_direction == GPIO0_TX_GPIO1_RX) {
rfm22_write(RFM22_gpio0_config, RFM22_gpio0_config_drv3 | RFM22_gpio0_config_txstate); // GPIO0 = TX State (to control RF Switch)
rfm22_write(RFM22_gpio1_config, RFM22_gpio1_config_drv3 | RFM22_gpio1_config_rxstate); // GPIO1 = RX State (to control RF Switch)
} else {
rfm22_write(RFM22_gpio0_config, RFM22_gpio0_config_drv3 | RFM22_gpio0_config_rxstate); // GPIO0 = TX State (to control RF Switch)
rfm22_write(RFM22_gpio1_config, RFM22_gpio1_config_drv3 | RFM22_gpio1_config_txstate); // GPIO1 = RX State (to control RF Switch)
}
rfm22_write(RFM22_gpio2_config, RFM22_gpio2_config_drv3 | RFM22_gpio2_config_cca); // GPIO2 = Clear Channel Assessment
// ****************

View File

@ -31,6 +31,8 @@
#ifndef PIOS_RFM22B_H
#define PIOS_RFM22B_H
enum gpio_direction {GPIO0_TX_GPIO1_RX, GPIO0_RX_GPIO1_TX};
/* Global Types */
struct pios_rfm22b_cfg {
const struct pios_spi_cfg * spi_cfg; /* Pointer to SPI interface configuration */
@ -41,6 +43,8 @@ struct pios_rfm22b_cfg {
uint8_t RFXtalCap;
uint32_t maxRFBandwidth;
uint8_t maxTxPower;
uint8_t slave_num;
enum gpio_direction gpio_direction;
};
/* Public Functions */

View File

@ -228,6 +228,8 @@ struct pios_rfm22b_cfg pios_rfm22b_cfg = {
.RFXtalCap = 0x7f,
.maxRFBandwidth = 128000,
.maxTxPower = RFM22_tx_pwr_txpow_7, // +20dBm .. 100mW
.slave_num = 0,
.gpio_direction = GPIO0_TX_GPIO1_RX,
};
#endif /* PIOS_INCLUDE_RFM22B */

View File

@ -359,6 +359,8 @@ struct pios_rfm22b_cfg pios_rfm22b_cfg = {
.RFXtalCap = 0x7f,
.maxRFBandwidth = 128000,
.maxTxPower = RFM22_tx_pwr_txpow_7, // +20dBm .. 100mW
.slave_num = 0,
.gpio_direction = GPIO0_RX_GPIO1_TX,
};
#endif /* PIOS_INCLUDE_RFM22B */