Skip to content

Commit

Permalink
move hmc5883 i2c address into driver
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Mar 14, 2018
1 parent bb7466c commit f194c54
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 57 deletions.
2 changes: 0 additions & 2 deletions src/drivers/boards/aerofc-v1/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
#define PX4_I2C_BUS_EXPANSION1 2
#define PX4_I2C_BUS_ONBOARD 3

#define PX4_I2C_OBDEV_HMC5883 0x1e

#define GPIO_SPI_CS_MPU6500 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define PX4_SPI_BUS_SENSORS 1
#define PX4_SPIDEV_MPU PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 1)
Expand Down
6 changes: 0 additions & 6 deletions src/drivers/boards/auav-x21/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@
#define PX4_I2C_BUS_EXPANSION 1
#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION

/* Devices not on the onboard bus.
*
* Note that these are unshifted addresses.
*/
#define PX4_I2C_OBDEV_HMC5883 0x1e

/*
* ADC channels
*
Expand Down
7 changes: 0 additions & 7 deletions src/drivers/boards/mindpx-v2/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@
#define PX4_I2C_BUS_EXPANSION 2
#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION

/* Devices on the onboard bus.
*
* Note that these are unshifted addresses.
*/
#define PX4_I2C_OBDEV_HMC5883 0x1e
// #define PX4_I2C_OBDEV_MPU6050 0x68

/*
* ADC channels
*
Expand Down
2 changes: 0 additions & 2 deletions src/drivers/boards/nxphlite-v3/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ __BEGIN_DECLS

#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION

#define PX4_I2C_OBDEV_HMC5883 0x1e

/*
* ADC channels
*
Expand Down
6 changes: 0 additions & 6 deletions src/drivers/boards/px4-same70xplained-v1/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,6 @@ __BEGIN_DECLS
/* No Onboard Sensors #define PX4_I2C_BUS_ONBOARD 0 */
#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION

/* Devices on the onboard bus.
*
* Note that these are unshifted addresses.
*/
#define PX4_I2C_OBDEV_HMC5883 0x1e

/* Define the follwoing to output the clock on J500-1 */
//#define GPIO_PCK1 (GPIO_PERIPHB | GPIO_CFG_DEFAULT | GPIO_PORT_PIOA | GPIO_PIN17)

Expand Down
6 changes: 0 additions & 6 deletions src/drivers/boards/px4fmu-v2/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,6 @@
#define PX4_I2C_BUS_ONBOARD 2
#define PX4_I2C_BUS_LED PX4_I2C_BUS_ONBOARD

/* Devices on the onboard bus.
*
* Note that these are unshifted addresses.
*/
#define PX4_I2C_OBDEV_HMC5883 0x1e

/*----------------------------------------------------------*/
/* FMUv3 Cube SPI chip selects and DRDY */
/*----------------------------------------------------------*/
Expand Down
1 change: 0 additions & 1 deletion src/drivers/boards/px4fmu-v4/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
*
* Note that these are unshifted addresses.
*/
#define PX4_I2C_OBDEV_HMC5883 0x1e
#define PX4_I2C_OBDEV_BMP280 0x76

/*
Expand Down
6 changes: 0 additions & 6 deletions src/drivers/boards/px4fmu-v4pro/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@
#define PX4_I2C_BUS_EXPANSION 2
#define PX4_I2C_BUS_LED PX4_I2C_BUS_ONBOARD

/* Devices on the external bus.
*
* Note that these are unshifted addresses.
*/
#define PX4_I2C_OBDEV_HMC5883 0x1e

/*
* ADC channels
*
Expand Down
7 changes: 0 additions & 7 deletions src/drivers/boards/px4fmu-v5/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,6 @@
#define BOARD_NUMBER_I2C_BUSES 4
#define BOARD_I2C_BUS_CLOCK_INIT {100000, 100000, 100000, 100000}

/* Devices on the external bus.
*
* Note that these are unshifted addresses.
*/

#define PX4_I2C_OBDEV_HMC5883 0x1e

/*
* ADC channels
*
Expand Down
6 changes: 0 additions & 6 deletions src/drivers/boards/px4nucleoF767ZI-v1/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,6 @@ __BEGIN_DECLS
#define PX4_I2C_BUS_EXPANSION 4
#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION

/* Devices on the external bus.
*
* Note that these are unshifted addresses.
*/
#define PX4_I2C_OBDEV_HMC5883 0x1e

/*
* ADC channels
*
Expand Down
2 changes: 0 additions & 2 deletions src/drivers/boards/tap-v1/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
#define PX4_I2C_BUS_SONAR 2
#define PX4_I2C_BUS_EXPANSION 3

#define PX4_I2C_OBDEV_HMC5883 0x1e

#define PX4_I2C_BUS_ONBOARD_HZ 400000
#define PX4_I2C_BUS_SONAR_HZ 400000
#define PX4_I2C_BUS_EXPANSION_HZ 400000
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/imu/mpu6000/mpu6000_i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ MPU6000_I2C::probe()
return (read(MPUREG_WHOAMI, &whoami, 1) > 0 && (whoami == expected)) ? 0 : -EIO;

}
#endif /* PX4_I2C_OBDEV_HMC5883 */
#endif /* USE_I2C */
6 changes: 1 addition & 5 deletions src/drivers/magnetometer/hmc5883/hmc5883_i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@

#include "board_config.h"

#ifdef PX4_I2C_OBDEV_HMC5883

#define HMC5883L_ADDRESS PX4_I2C_OBDEV_HMC5883
#define HMC5883L_ADDRESS 0x1E

device::Device *HMC5883_I2C_interface(int bus);

Expand Down Expand Up @@ -172,5 +170,3 @@ HMC5883_I2C::read(unsigned address, void *data, unsigned count)
uint8_t cmd = address;
return transfer(&cmd, 1, (uint8_t *)data, count);
}

#endif /* PX4_I2C_OBDEV_HMC5883 */

0 comments on commit f194c54

Please sign in to comment.