From bad813e911061bc9d356b12673739ac1c48f02cb Mon Sep 17 00:00:00 2001
From: Daniel Agar <daniel@agar.ca>
Date: Mon, 15 Jan 2018 15:03:15 -0500
Subject: [PATCH] move all magnetometers to the same folder

---
 cmake/configs/nuttx_aerocore2_default.cmake   |  6 ++-
 cmake/configs/nuttx_aerofc-v1_default.cmake   | 18 +++----
 cmake/configs/nuttx_auav-x21_default.cmake    |  8 +--
 cmake/configs/nuttx_mindpx-v2_default.cmake   | 53 ++++++++++---------
 cmake/configs/nuttx_nxphlite-v3_default.cmake |  8 +--
 .../nuttx_px4-same70xplained-v1_default.cmake |  9 ++--
 cmake/configs/nuttx_px4fmu-v2_default.cmake   |  6 +--
 cmake/configs/nuttx_px4fmu-v3_default.cmake   |  9 ++--
 cmake/configs/nuttx_px4fmu-v4_default.cmake   |  9 ++--
 .../configs/nuttx_px4fmu-v4pro_default.cmake  |  9 ++--
 cmake/configs/nuttx_px4fmu-v5_default.cmake   | 10 ++--
 .../nuttx_px4nucleoF767ZI-v1_default.cmake    |  9 ++--
 cmake/configs/nuttx_tap-v1_default.cmake      | 24 ++++-----
 src/drivers/boards/px4fmu-v4/board_config.h   |  1 -
 src/drivers/magnetometer/CMakeLists.txt       | 37 +++++++++++++
 .../{ => magnetometer}/bmm150/CMakeLists.txt  |  0
 .../{ => magnetometer}/bmm150/bmm150.cpp      |  0
 .../{ => magnetometer}/bmm150/bmm150.hpp      |  2 +-
 .../{ => magnetometer}/hmc5883/CMakeLists.txt |  0
 .../{ => magnetometer}/hmc5883/hmc5883.cpp    |  0
 .../{ => magnetometer}/hmc5883/hmc5883.h      |  0
 .../hmc5883/hmc5883_i2c.cpp                   |  0
 .../hmc5883/hmc5883_spi.cpp                   |  0
 .../{ => magnetometer}/ist8310/CMakeLists.txt |  0
 .../{ => magnetometer}/ist8310/ist8310.cpp    |  0
 .../{ => magnetometer}/lis3mdl/CMakeLists.txt |  0
 .../{ => magnetometer}/lis3mdl/lis3mdl.cpp    |  0
 .../{ => magnetometer}/lis3mdl/lis3mdl.h      |  0
 .../lis3mdl/lis3mdl_i2c.cpp                   |  0
 .../lis3mdl/lis3mdl_spi.cpp                   |  0
 30 files changed, 126 insertions(+), 92 deletions(-)
 create mode 100644 src/drivers/magnetometer/CMakeLists.txt
 rename src/drivers/{ => magnetometer}/bmm150/CMakeLists.txt (100%)
 rename src/drivers/{ => magnetometer}/bmm150/bmm150.cpp (100%)
 rename src/drivers/{ => magnetometer}/bmm150/bmm150.hpp (99%)
 rename src/drivers/{ => magnetometer}/hmc5883/CMakeLists.txt (100%)
 rename src/drivers/{ => magnetometer}/hmc5883/hmc5883.cpp (100%)
 rename src/drivers/{ => magnetometer}/hmc5883/hmc5883.h (100%)
 rename src/drivers/{ => magnetometer}/hmc5883/hmc5883_i2c.cpp (100%)
 rename src/drivers/{ => magnetometer}/hmc5883/hmc5883_spi.cpp (100%)
 rename src/drivers/{ => magnetometer}/ist8310/CMakeLists.txt (100%)
 rename src/drivers/{ => magnetometer}/ist8310/ist8310.cpp (100%)
 rename src/drivers/{ => magnetometer}/lis3mdl/CMakeLists.txt (100%)
 rename src/drivers/{ => magnetometer}/lis3mdl/lis3mdl.cpp (100%)
 rename src/drivers/{ => magnetometer}/lis3mdl/lis3mdl.h (100%)
 rename src/drivers/{ => magnetometer}/lis3mdl/lis3mdl_i2c.cpp (100%)
 rename src/drivers/{ => magnetometer}/lis3mdl/lis3mdl_spi.cpp (100%)

diff --git a/cmake/configs/nuttx_aerocore2_default.cmake b/cmake/configs/nuttx_aerocore2_default.cmake
index 06749f9cd7..66cea65982 100644
--- a/cmake/configs/nuttx_aerocore2_default.cmake
+++ b/cmake/configs/nuttx_aerocore2_default.cmake
@@ -7,6 +7,10 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	#drivers/magnetometer
+
 	drivers/device
 	drivers/stm32
 	drivers/stm32/adc
@@ -20,8 +24,6 @@ set(config_module_list
 	drivers/gps
 	drivers/pwm_out_sim
 	drivers/airspeed
-	drivers/differential_pressure
-	drivers/distance_sensor
 	#drivers/frsky_telemetry
 	modules/sensors
 	#drivers/pwm_input
diff --git a/cmake/configs/nuttx_aerofc-v1_default.cmake b/cmake/configs/nuttx_aerofc-v1_default.cmake
index b3eee383a8..a85ce27432 100644
--- a/cmake/configs/nuttx_aerofc-v1_default.cmake
+++ b/cmake/configs/nuttx_aerofc-v1_default.cmake
@@ -7,19 +7,19 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/aerofc_adc
+	drivers/boards
 	drivers/device
-	drivers/stm32
+	drivers/distance_sensor
+	drivers/gps
 	drivers/led
-	drivers/px4fmu
-	drivers/boards
-	drivers/tap_esc
+	drivers/magnetometer/hmc5883
+	drivers/magnetometer/ist8310
 	drivers/mpu9250
 	drivers/ms5611
-	drivers/hmc5883
-	drivers/gps
-	drivers/ist8310
-	drivers/distance_sensor
-	drivers/aerofc_adc
+	drivers/px4fmu
+	drivers/stm32
+	drivers/tap_esc
 	modules/sensors
 
 	#
diff --git a/cmake/configs/nuttx_auav-x21_default.cmake b/cmake/configs/nuttx_auav-x21_default.cmake
index 7fd48329cc..3eb03ebf6e 100644
--- a/cmake/configs/nuttx_auav-x21_default.cmake
+++ b/cmake/configs/nuttx_auav-x21_default.cmake
@@ -7,6 +7,10 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	drivers/magnetometer
+
 	drivers/device
 	drivers/stm32
 	drivers/stm32/adc
@@ -18,9 +22,7 @@ set(config_module_list
 	drivers/rgbled
 	drivers/mpu6000
 	drivers/mpu9250
-	drivers/hmc5883
 	drivers/ms5611
-	drivers/distance_sensor
 	drivers/gps
 	drivers/pwm_out_sim
 	drivers/hott
@@ -28,7 +30,6 @@ set(config_module_list
 	drivers/hott/hott_sensors
 	drivers/blinkm
 	drivers/airspeed
-	drivers/differential_pressure
 	drivers/frsky_telemetry
 	modules/sensors
 	drivers/mkblctrl
@@ -38,7 +39,6 @@ set(config_module_list
 	drivers/pwm_input
 	drivers/camera_trigger
 	drivers/bst
-	drivers/lis3mdl
 
 	#
 	# System commands
diff --git a/cmake/configs/nuttx_mindpx-v2_default.cmake b/cmake/configs/nuttx_mindpx-v2_default.cmake
index 59e65cba28..cb92383cb8 100644
--- a/cmake/configs/nuttx_mindpx-v2_default.cmake
+++ b/cmake/configs/nuttx_mindpx-v2_default.cmake
@@ -7,39 +7,40 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+
+	drivers/airspeed
+	drivers/blinkm
+	drivers/boards
+	drivers/bst
+	drivers/camera_trigger
 	drivers/device
-	drivers/stm32
-	drivers/stm32/adc
-	drivers/stm32/tone_alarm
+	drivers/frsky_telemetry
+	drivers/gps
+	#drivers/hott
+	#drivers/hott/hott_sensors
+	#drivers/hott/hott_telemetry
+	drivers/l3gd20
 	drivers/led
-	drivers/px4fmu
-	drivers/boards
-	drivers/rgbled
-	#drivers/rgbled_pwm
+	drivers/lsm303d
+	drivers/magnetometer/hmc5883
+	#drivers/mkblctrl
 	drivers/mpu6000
 	drivers/mpu9250
-	drivers/lsm303d
-	drivers/l3gd20
-	drivers/hmc5883
 	drivers/ms5611
-	drivers/distance_sensor
-	drivers/gps
+	#drivers/oreoled
+	drivers/pwm_input
 	drivers/pwm_out_sim
-	#drivers/hott
-	#drivers/hott/hott_telemetry
-	#drivers/hott/hott_sensors
-	drivers/blinkm
-	drivers/airspeed
-	drivers/differential_pressure
-	drivers/frsky_telemetry
-	modules/sensors
-	#drivers/mkblctrl
 	drivers/px4flow
-	#drivers/oreoled
+	drivers/px4fmu
+	drivers/rgbled
+	#drivers/rgbled_pwm
+	drivers/stm32
+	drivers/stm32/adc
+	drivers/stm32/tone_alarm
 	drivers/vmount
-	drivers/pwm_input
-	drivers/camera_trigger
-	drivers/bst
+	modules/sensors
 
 	#
 	# System commands
@@ -178,4 +179,4 @@ set(config_module_list
 
 	# Hardware test
 	#examples/hwtest
-)
\ No newline at end of file
+)
diff --git a/cmake/configs/nuttx_nxphlite-v3_default.cmake b/cmake/configs/nuttx_nxphlite-v3_default.cmake
index b0d444be40..c9e20f4a2e 100644
--- a/cmake/configs/nuttx_nxphlite-v3_default.cmake
+++ b/cmake/configs/nuttx_nxphlite-v3_default.cmake
@@ -7,6 +7,10 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	drivers/magnetometer
+
 	drivers/airspeed
 	drivers/blinkm
 #NOT Supported	drivers/bma180
@@ -16,12 +20,10 @@ set(config_module_list
 	drivers/bst
 	drivers/camera_trigger
 	drivers/device
-	drivers/differential_pressure
 	drivers/frsky_telemetry
 	drivers/fxos8701cq
 	drivers/fxas21002c
 	drivers/gps
-	drivers/hmc5883
 	drivers/hott
 	drivers/hott/hott_sensors
 	drivers/hott/hott_telemetry
@@ -31,8 +33,6 @@ set(config_module_list
 	drivers/kinetis/tone_alarm
 	drivers/l3gd20
 	drivers/led
-	drivers/lis3mdl
-	drivers/distance_sensor
 	drivers/mkblctrl
 	drivers/mpl3115a2
 	drivers/mpu6000
diff --git a/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake b/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake
index b865a192e5..bac5be85bd 100644
--- a/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake
+++ b/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake
@@ -7,6 +7,10 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	drivers/magnetometer
+
 	drivers/device
 	drivers/samv7
 #WIP 	drivers/samv7/adc
@@ -17,12 +21,9 @@ set(config_module_list
 	drivers/rgbled
 	drivers/mpu6000
 	drivers/mpu9250
-	drivers/differential_pressure
 	drivers/lsm303d
 	drivers/l3gd20
-	drivers/hmc5883
 	drivers/ms5611
-	drivers/distance_sensor
 	drivers/gps
 #WIP 	drivers/pwm_out_sim
 	drivers/hott
@@ -39,8 +40,6 @@ set(config_module_list
 #WIP  	drivers/pwm_input
 #WIP  	drivers/camera_trigger
 	drivers/bst
-	drivers/lis3mdl
-
 
 	#
 	# System commands
diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake
index 93fa930d17..e05b47c015 100644
--- a/cmake/configs/nuttx_px4fmu-v2_default.cmake
+++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake
@@ -8,6 +8,7 @@ set(config_module_list
 	#
 	drivers/differential_pressure
 	drivers/distance_sensor
+	#drivers/magnetometer
 
 	#drivers/adis16448
 	drivers/airspeed
@@ -20,16 +21,15 @@ set(config_module_list
 	drivers/device
 	#drivers/frsky_telemetry
 	drivers/gps
-	drivers/hmc5883
+	drivers/magnetometer/hmc5883
 	#drivers/hott
 	#drivers/hott/hott_sensors
 	#drivers/hott/hott_telemetry
 	#drivers/iridiumsbd
 	#drivers/irlock
-	#drivers/ist8310
 	drivers/l3gd20
 	drivers/led
-	drivers/lis3mdl
+	drivers/magnetometer/lis3mdl
 	drivers/lsm303d
 	#drivers/mb12xx
 	#drivers/mkblctrl
diff --git a/cmake/configs/nuttx_px4fmu-v3_default.cmake b/cmake/configs/nuttx_px4fmu-v3_default.cmake
index fc09849170..901b89bc89 100644
--- a/cmake/configs/nuttx_px4fmu-v3_default.cmake
+++ b/cmake/configs/nuttx_px4fmu-v3_default.cmake
@@ -13,6 +13,10 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	drivers/magnetometer
+
 	drivers/adis16448
 	drivers/airspeed
 	drivers/blinkm
@@ -22,10 +26,8 @@ set(config_module_list
 	drivers/bst
 	drivers/camera_trigger
 	drivers/device
-	drivers/differential_pressure
 	drivers/frsky_telemetry
 	drivers/gps
-	drivers/hmc5883
 	drivers/hott
 	drivers/hott/hott_sensors
 	drivers/hott/hott_telemetry
@@ -33,9 +35,6 @@ set(config_module_list
 	drivers/irlock
 	drivers/l3gd20
 	drivers/led
-	drivers/lis3mdl
-	drivers/distance_sensor
-	drivers/lsm303d
 	drivers/mkblctrl
 	drivers/mpu6000
 	drivers/mpu9250
diff --git a/cmake/configs/nuttx_px4fmu-v4_default.cmake b/cmake/configs/nuttx_px4fmu-v4_default.cmake
index 1f995bcbe6..d352f27a65 100644
--- a/cmake/configs/nuttx_px4fmu-v4_default.cmake
+++ b/cmake/configs/nuttx_px4fmu-v4_default.cmake
@@ -7,29 +7,28 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	drivers/magnetometer
+
 	drivers/airspeed
 	drivers/blinkm
 	drivers/bma180
 	drivers/bmi055
 	drivers/bmi160
-	drivers/bmm150
 	drivers/bmp280
 	drivers/boards
 	drivers/bst
 	drivers/camera_trigger
 	drivers/device
-	drivers/differential_pressure
 	drivers/frsky_telemetry
 	drivers/gps
-	drivers/hmc5883
 	drivers/hott
 	drivers/hott/hott_sensors
 	drivers/hott/hott_telemetry
 	drivers/iridiumsbd
 	drivers/irlock
 	drivers/led
-	drivers/lis3mdl
-	drivers/distance_sensor
 	drivers/mkblctrl
 	drivers/mpu6000
 	drivers/mpu9250
diff --git a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake
index 46c2674663..d02c18f27e 100644
--- a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake
+++ b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake
@@ -7,6 +7,10 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/distance_sensor
+	drivers/differential_pressure
+	drivers/magnetometer
+
 	drivers/airspeed
 	drivers/blinkm
 	drivers/bma180
@@ -18,7 +22,6 @@ set(config_module_list
 	drivers/device
 	drivers/frsky_telemetry
 	drivers/gps
-	drivers/hmc5883
 	drivers/hott
 	drivers/hott/hott_sensors
 	drivers/hott/hott_telemetry
@@ -26,13 +29,9 @@ set(config_module_list
 	drivers/irlock
 	drivers/l3gd20
 	drivers/led
-	drivers/lis3mdl
-	drivers/distance_sensor
-	drivers/lsm303d
 	drivers/mkblctrl
 	drivers/mpu6000
 	drivers/mpu9250
-	drivers/differential_pressure
 	drivers/ms5611
 	drivers/oreoled
 	drivers/pwm_input
diff --git a/cmake/configs/nuttx_px4fmu-v5_default.cmake b/cmake/configs/nuttx_px4fmu-v5_default.cmake
index b64c734765..ee1a63f77c 100644
--- a/cmake/configs/nuttx_px4fmu-v5_default.cmake
+++ b/cmake/configs/nuttx_px4fmu-v5_default.cmake
@@ -7,10 +7,13 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	drivers/magnetometer
+
 	drivers/airspeed
 	drivers/blinkm
 	drivers/bma180
-	drivers/bmi055
 	drivers/bmi160
 	drivers/bmp280
 	drivers/boards
@@ -19,20 +22,15 @@ set(config_module_list
 	drivers/device
 	drivers/frsky_telemetry
 	drivers/gps
-	drivers/hmc5883
 	drivers/hott
 	drivers/hott/hott_sensors
 	drivers/hott/hott_telemetry
 	drivers/iridiumsbd
 	drivers/irlock
-	drivers/ist8310
 	drivers/led
-	drivers/lis3mdl
-	drivers/distance_sensor
 	drivers/mkblctrl
 	drivers/mpu6000
 	drivers/mpu9250
-	drivers/differential_pressure
 	drivers/ms5611
 	drivers/oreoled
 	drivers/pwm_input
diff --git a/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake b/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake
index 0b5e45dc58..7ac6b2fa70 100644
--- a/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake
+++ b/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake
@@ -7,6 +7,11 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/differential_pressure
+	drivers/distance_sensor
+	drivers/magnetometer
+
+	drivers/adis16448
 	drivers/airspeed
 	drivers/blinkm
 	drivers/bma180
@@ -18,17 +23,13 @@ set(config_module_list
 	drivers/device
 	drivers/frsky_telemetry
 	drivers/gps
-	drivers/hmc5883
 	drivers/hott
 	drivers/hott/hott_sensors
 	drivers/hott/hott_telemetry
 	drivers/led
-	drivers/lis3mdl
-	drivers/distance_sensor
 	drivers/mkblctrl
 	drivers/mpu6000
 	drivers/mpu9250
-	drivers/differential_pressure
 	drivers/ms5611
 	drivers/oreoled
 	drivers/pwm_input
diff --git a/cmake/configs/nuttx_tap-v1_default.cmake b/cmake/configs/nuttx_tap-v1_default.cmake
index 706210a0a5..0dfe11c3c8 100644
--- a/cmake/configs/nuttx_tap-v1_default.cmake
+++ b/cmake/configs/nuttx_tap-v1_default.cmake
@@ -7,23 +7,23 @@ set(config_module_list
 	#
 	# Board support modules
 	#
+	drivers/airspeed
+	drivers/boards
 	drivers/device
-	drivers/stm32
-	drivers/stm32/adc
-	drivers/stm32/tone_alarm
+	drivers/differential_pressure
+	drivers/gps
 	drivers/led
+	drivers/magnetometer/hmc5883
+	drivers/mpu6000
+	drivers/ms5611
 	drivers/px4fmu
-	drivers/boards
 	drivers/rgbled_pwm
+	drivers/stm32
+	drivers/stm32/adc
+	drivers/stm32/tone_alarm
 	drivers/tap_esc
-	drivers/mpu6000
-	drivers/ms5611
-	drivers/hmc5883
-	drivers/gps
-	drivers/airspeed
-	drivers/differential_pressure
-	modules/sensors
 	drivers/vmount
+	modules/sensors
 
 	#
 	# System commands
@@ -105,4 +105,4 @@ set(config_module_list
 	# had to add for cmake, not sure why wasn't in original config
 	platforms/common
 	platforms/nuttx/px4_layer
-)
\ No newline at end of file
+)
diff --git a/src/drivers/boards/px4fmu-v4/board_config.h b/src/drivers/boards/px4fmu-v4/board_config.h
index 89904ddaa1..d524375896 100644
--- a/src/drivers/boards/px4fmu-v4/board_config.h
+++ b/src/drivers/boards/px4fmu-v4/board_config.h
@@ -165,7 +165,6 @@
 #define PX4_I2C_OBDEV_LED            0x55
 #define PX4_I2C_OBDEV_HMC5883        0x1e
 #define PX4_I2C_OBDEV_LIS3MDL        0x1e
-#define PX4_I2C_OBDEV_BMM150         0x10
 #define PX4_I2C_OBDEV_BMP280         0x76
 
 /*
diff --git a/src/drivers/magnetometer/CMakeLists.txt b/src/drivers/magnetometer/CMakeLists.txt
new file mode 100644
index 0000000000..88c468c35a
--- /dev/null
+++ b/src/drivers/magnetometer/CMakeLists.txt
@@ -0,0 +1,37 @@
+############################################################################
+#
+#   Copyright (c) 2017 PX4 Development Team. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+# 3. Neither the name PX4 nor the names of its contributors may be
+#    used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+add_subdirectory(bmm150)
+add_subdirectory(hmc5883)
+add_subdirectory(ist8310)
+add_subdirectory(lis3mdl)
diff --git a/src/drivers/bmm150/CMakeLists.txt b/src/drivers/magnetometer/bmm150/CMakeLists.txt
similarity index 100%
rename from src/drivers/bmm150/CMakeLists.txt
rename to src/drivers/magnetometer/bmm150/CMakeLists.txt
diff --git a/src/drivers/bmm150/bmm150.cpp b/src/drivers/magnetometer/bmm150/bmm150.cpp
similarity index 100%
rename from src/drivers/bmm150/bmm150.cpp
rename to src/drivers/magnetometer/bmm150/bmm150.cpp
diff --git a/src/drivers/bmm150/bmm150.hpp b/src/drivers/magnetometer/bmm150/bmm150.hpp
similarity index 99%
rename from src/drivers/bmm150/bmm150.hpp
rename to src/drivers/magnetometer/bmm150/bmm150.hpp
index 14cdb9da46..7dc0f69918 100644
--- a/src/drivers/bmm150/bmm150.hpp
+++ b/src/drivers/magnetometer/bmm150/bmm150.hpp
@@ -42,7 +42,7 @@
 
 #define BMM150_DEVICE_PATH_MAG_EXT          "/dev/bmm150_i2c_ext"
 
-#define BMM150_SLAVE_ADDRESS                 PX4_I2C_OBDEV_BMM150
+#define BMM150_SLAVE_ADDRESS                 0x10
 
 #define BMM150_BUS_SPEED                     1000*100
 
diff --git a/src/drivers/hmc5883/CMakeLists.txt b/src/drivers/magnetometer/hmc5883/CMakeLists.txt
similarity index 100%
rename from src/drivers/hmc5883/CMakeLists.txt
rename to src/drivers/magnetometer/hmc5883/CMakeLists.txt
diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/magnetometer/hmc5883/hmc5883.cpp
similarity index 100%
rename from src/drivers/hmc5883/hmc5883.cpp
rename to src/drivers/magnetometer/hmc5883/hmc5883.cpp
diff --git a/src/drivers/hmc5883/hmc5883.h b/src/drivers/magnetometer/hmc5883/hmc5883.h
similarity index 100%
rename from src/drivers/hmc5883/hmc5883.h
rename to src/drivers/magnetometer/hmc5883/hmc5883.h
diff --git a/src/drivers/hmc5883/hmc5883_i2c.cpp b/src/drivers/magnetometer/hmc5883/hmc5883_i2c.cpp
similarity index 100%
rename from src/drivers/hmc5883/hmc5883_i2c.cpp
rename to src/drivers/magnetometer/hmc5883/hmc5883_i2c.cpp
diff --git a/src/drivers/hmc5883/hmc5883_spi.cpp b/src/drivers/magnetometer/hmc5883/hmc5883_spi.cpp
similarity index 100%
rename from src/drivers/hmc5883/hmc5883_spi.cpp
rename to src/drivers/magnetometer/hmc5883/hmc5883_spi.cpp
diff --git a/src/drivers/ist8310/CMakeLists.txt b/src/drivers/magnetometer/ist8310/CMakeLists.txt
similarity index 100%
rename from src/drivers/ist8310/CMakeLists.txt
rename to src/drivers/magnetometer/ist8310/CMakeLists.txt
diff --git a/src/drivers/ist8310/ist8310.cpp b/src/drivers/magnetometer/ist8310/ist8310.cpp
similarity index 100%
rename from src/drivers/ist8310/ist8310.cpp
rename to src/drivers/magnetometer/ist8310/ist8310.cpp
diff --git a/src/drivers/lis3mdl/CMakeLists.txt b/src/drivers/magnetometer/lis3mdl/CMakeLists.txt
similarity index 100%
rename from src/drivers/lis3mdl/CMakeLists.txt
rename to src/drivers/magnetometer/lis3mdl/CMakeLists.txt
diff --git a/src/drivers/lis3mdl/lis3mdl.cpp b/src/drivers/magnetometer/lis3mdl/lis3mdl.cpp
similarity index 100%
rename from src/drivers/lis3mdl/lis3mdl.cpp
rename to src/drivers/magnetometer/lis3mdl/lis3mdl.cpp
diff --git a/src/drivers/lis3mdl/lis3mdl.h b/src/drivers/magnetometer/lis3mdl/lis3mdl.h
similarity index 100%
rename from src/drivers/lis3mdl/lis3mdl.h
rename to src/drivers/magnetometer/lis3mdl/lis3mdl.h
diff --git a/src/drivers/lis3mdl/lis3mdl_i2c.cpp b/src/drivers/magnetometer/lis3mdl/lis3mdl_i2c.cpp
similarity index 100%
rename from src/drivers/lis3mdl/lis3mdl_i2c.cpp
rename to src/drivers/magnetometer/lis3mdl/lis3mdl_i2c.cpp
diff --git a/src/drivers/lis3mdl/lis3mdl_spi.cpp b/src/drivers/magnetometer/lis3mdl/lis3mdl_spi.cpp
similarity index 100%
rename from src/drivers/lis3mdl/lis3mdl_spi.cpp
rename to src/drivers/magnetometer/lis3mdl/lis3mdl_spi.cpp
-- 
GitLab