mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
LP-484 Addressed PR review issues.
This commit is contained in:
parent
d49394f8fb
commit
95be5b1f0b
@ -1094,6 +1094,10 @@ void PIOS_OpenLRS_RegisterPPMCallback(uint32_t openlrs_id, PIOS_OpenLRS_PPMRecei
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Order is important in these assignments since openlrs_task uses ppm_callback
|
||||
* field to determine if it's ok to dereference ppm_callback and ppm_context
|
||||
*/
|
||||
openlrs_dev->ppm_context = context;
|
||||
openlrs_dev->ppm_callback = callback;
|
||||
}
|
||||
@ -1148,8 +1152,9 @@ int32_t PIOS_OpenLRS_Init(uint32_t *openlrs_id, uint32_t spi_id,
|
||||
openlrs_dev->tx_out_cb = NULL;
|
||||
|
||||
// Initialize the "PPM" callback.
|
||||
openlrs_dev->ppm_callback = 0;
|
||||
openlrs_dev->ppm_context = 0;
|
||||
openlrs_dev->ppm_callback = 0;
|
||||
|
||||
|
||||
OPLinkSettingsInitialize();
|
||||
OPLinkStatusInitialize();
|
||||
|
@ -407,40 +407,12 @@ int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_nu
|
||||
g_rfm22b_dev = rfm22b_dev;
|
||||
|
||||
// Store the SPI handle
|
||||
rfm22b_dev->slave_num = slave_num;
|
||||
rfm22b_dev->spi_id = spi_id;
|
||||
rfm22b_dev->slave_num = slave_num;
|
||||
rfm22b_dev->spi_id = spi_id;
|
||||
|
||||
// Initialize our configuration parameters
|
||||
rfm22b_dev->datarate = RFM22B_DEFAULT_RX_DATARATE;
|
||||
rfm22b_dev->tx_power = RFM22B_DEFAULT_TX_POWER;
|
||||
rfm22b_dev->coordinator = false;
|
||||
rfm22b_dev->coordinatorID = 0;
|
||||
|
||||
// Initialize the com callbacks.
|
||||
rfm22b_dev->rx_in_cb = NULL;
|
||||
rfm22b_dev->tx_out_cb = NULL;
|
||||
|
||||
rfm22b_dev->aux_rx_in_cb = NULL;
|
||||
rfm22b_dev->aux_tx_out_cb = NULL;
|
||||
// Initialize the PPM callback.
|
||||
rfm22b_dev->ppm_callback = NULL;
|
||||
rfm22b_dev->ppm_context = 0;
|
||||
|
||||
// Initialize the stats.
|
||||
rfm22b_dev->stats.packets_per_sec = 0;
|
||||
rfm22b_dev->stats.rx_good = 0;
|
||||
rfm22b_dev->stats.rx_corrected = 0;
|
||||
rfm22b_dev->stats.rx_error = 0;
|
||||
rfm22b_dev->stats.rx_missed = 0;
|
||||
rfm22b_dev->stats.tx_dropped = 0;
|
||||
rfm22b_dev->stats.resets = 0;
|
||||
rfm22b_dev->stats.timeouts = 0;
|
||||
rfm22b_dev->stats.link_quality = 0;
|
||||
rfm22b_dev->stats.rssi = 0;
|
||||
rfm22b_dev->stats.afc_correction = 0;
|
||||
rfm22b_dev->stats.tx_seq = 0;
|
||||
rfm22b_dev->stats.rx_seq = 0;
|
||||
rfm22b_dev->stats.tx_failure = 0;
|
||||
rfm22b_dev->datarate = RFM22B_DEFAULT_RX_DATARATE;
|
||||
rfm22b_dev->tx_power = RFM22B_DEFAULT_TX_POWER;
|
||||
|
||||
// Set the frequency band
|
||||
switch (band) {
|
||||
@ -1132,6 +1104,10 @@ void PIOS_RFM22B_SetPPMCallback(uint32_t rfm22b_id, PPMReceivedCallback cb, uint
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Order is important in these assignments since rfm22_task uses ppm_callback
|
||||
* field to determine if it's ok to dereference ppm_callback and ppm_context
|
||||
*/
|
||||
rfm22b_dev->ppm_context = cb_context;
|
||||
rfm22b_dev->ppm_callback = cb;
|
||||
}
|
||||
@ -2574,12 +2550,13 @@ static struct pios_rfm22b_dev *pios_rfm22_alloc(void)
|
||||
struct pios_rfm22b_dev *rfm22b_dev;
|
||||
|
||||
rfm22b_dev = (struct pios_rfm22b_dev *)pios_malloc(sizeof(*rfm22b_dev));
|
||||
rfm22b_dev->spi_id = 0;
|
||||
if (!rfm22b_dev) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(rfm22b_dev, 0, sizeof(*rfm22b_dev));
|
||||
rfm22b_dev->magic = PIOS_RFM22B_DEV_MAGIC;
|
||||
|
||||
return rfm22b_dev;
|
||||
}
|
||||
#else
|
||||
@ -2594,6 +2571,8 @@ static struct pios_rfm22b_dev *pios_rfm22_alloc(void)
|
||||
}
|
||||
|
||||
rfm22b_dev = &pios_rfm22b_devs[pios_rfm22b_num_devs++];
|
||||
|
||||
memset(rfm22b_dev, 0, sizeof(*rfm22b_dev));
|
||||
rfm22b_dev->magic = PIOS_RFM22B_DEV_MAGIC;
|
||||
|
||||
return rfm22b_dev;
|
||||
|
@ -386,7 +386,6 @@ void PIOS_Board_Init(void)
|
||||
}
|
||||
|
||||
// Set bank modes
|
||||
|
||||
PIOS_Servo_SetBankMode(0, PIOS_SERVO_BANK_MODE_PWM);
|
||||
PIOS_Servo_SetBankMode(1, PIOS_SERVO_BANK_MODE_PWM);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user