Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_IKS01A1 MLX90614 d7a_1x wizzi-utils
Fork of D7A_1x_demo_sensors_OS5 by
Diff: main.cpp
- Revision:
- 11:7938e138cb7a
- Parent:
- 8:01f0225408cf
- Child:
- 12:6a1158950a9e
--- a/main.cpp Fri Feb 03 14:36:58 2017 +0000
+++ b/main.cpp Wed Feb 08 15:51:58 2017 +0000
@@ -99,13 +99,13 @@
// Select the sensors available on the sh2050
// -1 : disable, 0 : simu, 1 : hardware
// -----------------------------------------------
- #define _MAG_EN_ (0)
- #define _ACC_EN_ (0)
- #define _PRE_EN_ (1)
- #define _HUM_EN_ (1)
- #define _TEM1_EN_ (1)
- #define _TEM2_EN_ (1)
- #define _LIGHT_EN_ (1)
+ #define _MAG_EN_ (1)
+ #define _ACC_EN_ (1)
+ #define _PRE_EN_ (-1)
+ #define _HUM_EN_ (-1)
+ #define _TEM1_EN_ (-1)
+ #define _TEM2_EN_ (-1)
+ #define _LIGHT_EN_ (-1)
// -----------------------------------------------
// Hardware I/O
@@ -118,7 +118,7 @@
#endif
// Enable DBG led blinking (ms)
-#define DGB_LED_BLINK_PERIOD (1000)
+#define DGB_LED_BLINK_PERIOD (200)
// Defaults
#ifndef _MAG_EN_
@@ -698,7 +698,7 @@
#if (_HUM_EN_ > 0 || _TEM1_EN_ > 0 || _MAG_EN_ > 0 || _ACC_EN_ > 0 || _GYR_EN_ > 0 || _PRE_EN_ > 0 || _TEM2_EN_ > 0)
// Open I2C and initialise the sensors
- DevI2C ext_i2c(SENSOR_I2C_SDA, SENSOR_I2C_SCL);
+ DevI2C ext_i2c(SENSOR_I2C_SDA, SENSOR_I2C_SCL);
#endif
#if (_HUM_EN_ > 0 || _TEM1_EN_ > 0)
@@ -706,21 +706,33 @@
ASSERT(Init_HTS221(humidity_sensor), "Failed to init HTS221\r\n");
temp_sensor1 = humidity_sensor;
#endif // _TEM_EN_
-#if (_MAG_EN_ > 0)
- magnetometer = new LIS3MDL(ext_i2c);
- ASSERT(Init_LIS3MDL(magnetometer), "Failed to init LIS3MDL\r\n");
-#endif // _MAG_EN_
-#if (_ACC_EN_ > 0 || _GYR_EN_ > 0)
- accelerometer = new LSM6DS0(ext_i2c);
- ASSERT(Init_LSM6DS0(accelerometer), "Failed to init LSM6DS0\r\n");
- gyroscope = accelerometer;
-#endif // _ACC_EN_ || _GYR_EN_
#if (_PRE_EN_ > 0 || _TEM2_EN_ > 0)
pressure_sensor = new LPS25H(ext_i2c);
ASSERT(Init_LPS25H(pressure_sensor), "Failed to init LPS25H\r\n");
temp_sensor2 = pressure_sensor;
#endif // _PRE_EN_
+#if defined(TARGET_STM32L152RE)
+ #if (_MAG_EN_ > 0)
+ magnetometer = new LIS3MDL(ext_i2c);
+ ASSERT(Init_LIS3MDL(magnetometer), "Failed to init LIS3MDL\r\n");
+ #endif // _MAG_EN_
+ #if (_ACC_EN_ > 0 || _GYR_EN_ > 0)
+ accelerometer = new LSM6DS0(ext_i2c);
+ ASSERT(Init_LSM6DS0(accelerometer), "Failed to init LSM6DS0\r\n");
+ gyroscope = accelerometer;
+ #endif // _ACC_EN_ || _GYR_EN_
+#elif defined(TARGET_STM32L432KC)
+ #if (_ACC_EN_ > 0)
+ accelerometer = new LSM303C_ACC_Sensor(ext_i2c);
+ ASSERT(Init_LSM303C_ACC(accelerometer), "Failed to init LSM303C_ACC\r\n");
+ #endif // _ACC_EN_
+ #if (_MAG_EN_ > 0)
+ magnetometer = new LSM303C_MAG_Sensor(ext_i2c);
+ ASSERT(Init_LSM303C_MAG(magnetometer), "Failed to init LSM303C_MAG\r\n");
+ #endif // _MAG_EN_
+#endif
+
osStatus status;
// Start sensors threads
