mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
OP-1477 - Fixes for multi device support of HMC5x driver
This commit is contained in:
parent
bcb30ecbf3
commit
a6fc5c9190
@ -205,10 +205,14 @@ void PIOS_SPI_mag_flash_irq_handler(void)
|
|||||||
#endif /* PIOS_INCLUDE_FLASH */
|
#endif /* PIOS_INCLUDE_FLASH */
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_HMC5X83)
|
#if defined(PIOS_INCLUDE_HMC5X83)
|
||||||
|
pios_hmc5x83_dev_t onboard_mag;
|
||||||
#include "pios_hmc5x83.h"
|
#include "pios_hmc5x83.h"
|
||||||
#ifdef PIOS_HMC5x83_HAS_GPIOS
|
#ifdef PIOS_HMC5x83_HAS_GPIOS
|
||||||
|
bool pios_board_mag_handler(){
|
||||||
|
PIOS_HMC5x83_IRQHandler(onboard_mag);
|
||||||
|
}
|
||||||
static const struct pios_exti_cfg pios_exti_mag_cfg __exti_config = {
|
static const struct pios_exti_cfg pios_exti_mag_cfg __exti_config = {
|
||||||
.vector = PIOS_HMC5x83_IRQHandler,
|
.vector = pios_board_mag_handler,
|
||||||
.line = EXTI_Line7,
|
.line = EXTI_Line7,
|
||||||
.pin = {
|
.pin = {
|
||||||
.gpio = GPIOB,
|
.gpio = GPIOB,
|
||||||
@ -243,7 +247,7 @@ static const struct pios_hmc5x83_cfg pios_mag_cfg = {
|
|||||||
#ifdef PIOS_HMC5x83_HAS_GPIOS
|
#ifdef PIOS_HMC5x83_HAS_GPIOS
|
||||||
.exti_cfg = &pios_exti_mag_cfg,
|
.exti_cfg = &pios_exti_mag_cfg,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75,
|
.M_ODR = PIOS_HMC5x83_ODR_30,
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
|
@ -82,9 +82,8 @@
|
|||||||
// #define PIOS_INCLUDE_MPU6000
|
// #define PIOS_INCLUDE_MPU6000
|
||||||
// #define PIOS_MPU6000_ACCEL
|
// #define PIOS_MPU6000_ACCEL
|
||||||
/* #define PIOS_INCLUDE_HMC5843 */
|
/* #define PIOS_INCLUDE_HMC5843 */
|
||||||
/* #define PIOS_INCLUDE_HMC5883 */
|
|
||||||
#define PIOS_INCLUDE_HMC5X83
|
#define PIOS_INCLUDE_HMC5X83
|
||||||
/* #define PIOS_HMC5883_HAS_GPIOS */
|
#define PIOS_HMC5X83_HAS_GPIOS
|
||||||
/* #define PIOS_INCLUDE_BMP085 */
|
/* #define PIOS_INCLUDE_BMP085 */
|
||||||
/* #define PIOS_INCLUDE_MS5611 */
|
/* #define PIOS_INCLUDE_MS5611 */
|
||||||
/* #define PIOS_INCLUDE_MPXV */
|
/* #define PIOS_INCLUDE_MPXV */
|
||||||
|
@ -75,7 +75,7 @@ void PIOS_Board_Init(void)
|
|||||||
|
|
||||||
#ifdef PIOS_INCLUDE_HMC5X83
|
#ifdef PIOS_INCLUDE_HMC5X83
|
||||||
PIOS_SPI_SetClockSpeed(pios_spi_mag_flash_id, SPI_BaudRatePrescaler_16);
|
PIOS_SPI_SetClockSpeed(pios_spi_mag_flash_id, SPI_BaudRatePrescaler_16);
|
||||||
PIOS_HMC5x83_Init(&pios_mag_cfg, pios_spi_mag_flash_id, 0);
|
onboard_mag = PIOS_HMC5x83_Init(&pios_mag_cfg, pios_spi_mag_flash_id, 0);
|
||||||
if (PIOS_Flash_Jedec_Init(&flash_id, pios_spi_mag_flash_id, 1)) {
|
if (PIOS_Flash_Jedec_Init(&flash_id, pios_spi_mag_flash_id, 1)) {
|
||||||
PIOS_DEBUG_Assert(0);
|
PIOS_DEBUG_Assert(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user