Skip to content

Commit 863b962

Browse files
authored
Merge pull request #9 from NoahRosa/master
Implement compatibility with X-NUCLEO-IKS01A3 in example Flight1
2 parents 34ed256 + e0b5011 commit 863b962

File tree

3 files changed

+65
-11
lines changed

3 files changed

+65
-11
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ with X-NUCLEO-IKS01A2 and X-NUCLEO-IHM02A1 Expansion Boards. The application all
2020
stack of boards accordingly; the speed of motor increases when the angle of rotation increases as well.
2121
* BleSensors_SensiBLE: This application provides an example of usage of a SensiBLE board. The application uses BLE along with environmental and motion sensors (humidity, temperature, pressure, accelerometer, gyroscope). The user can connect an Android or IOS device with BlueNRG application to SensiBLE and see sensors data. The data are also printed to the serial port.
2222
* Flight1: This application provides an example of usage of a NUCLEO board (it was tested with NUCLEO-F401RE, NUCLEO-L476RG, NUCLEO-L152RE) with
23-
X-NUCLEO-IKS01A2, X-NUCLEO-IDB05A1 and X-NUCLEO-53L1A1 Expansion Boards. The application gather data from the sensor mounted and then communicates
23+
X-NUCLEO-IKS01A2 or X-NUCLEO-IKS01A3, X-NUCLEO-IDB05A1 and X-NUCLEO-53L1A1 Expansion Boards. The application gather data from the sensor mounted and then communicates
2424
them via bluetooth to a suitable Android app (such as ST BLE Sensor). The data gathered include enviromental data (temperature, pression, humidity),
2525
distance, gesture recognition (tap and directional swipe), acceleration and a gyroscope.
2626

@@ -29,6 +29,8 @@ distance, gesture recognition (tap and directional swipe), acceleration and a gy
2929
The FP_Examples library requires the following STM32duino libraries (link to the source files):
3030

3131
* STM32duino LSM6DSL: https://github.com/stm32duino/LSM6DSL
32+
* STM32duino LSM303AGR: https://github.com/stm32duino/LSM303AGR
33+
* STM32duino LPS22HB: https://github.com/stm32duino/LPS22HB
3234
* STM32duino Proximity_Gesture: https://github.com/stm32duino/Proximity_Gesture
3335
* STM32duino VL6180X: https://github.com/stm32duino/VL6180X
3436
* STM32duino VL53L0X: https://github.com/stm32duino/VL53L0X
@@ -42,12 +44,19 @@ The FP_Examples library requires the following STM32duino libraries (link to the
4244
* STM32duino HTS221: https://github.com/stm32duino/HTS221
4345
* STM32duino LPS25HB: https://github.com/stm32duino/LPS25HB
4446
* STM32duino LSM6DS3: https://github.com/stm32duino/LSM6DS3
47+
* STM32duino LSM6DSO: https://github.com/stm32duino/LSM6DSO
48+
* STM32duino LIS2DW12: https://github.com/stm32duino/LIS2DW12
49+
* STM32duino LIS2MDL: https://github.com/stm32duino/LIS2MDL
50+
* STM32duino LPS22HH: https://github.com/stm32duino/LPS22HH
51+
* STM32duino STTS751: https://github.com/stm32duino/STTS751
4552

4653

4754
## Documentation
4855

4956
The datasheets of the several components are available at
5057
* http://www.st.com/content/st_com/en/products/mems-and-sensors/inemo-inertial-modules/lsm6dsl.html
58+
* http://www.st.com/content/st_com/en/products/mems-and-sensors/e-compasses/lsm303agr.html
59+
* http://www.st.com/content/st_com/en/products/mems-and-sensors/pressure-sensors/lps22hb.html
5160
* http://www.st.com/content/st_com/en/products/imaging-and-photonics-solutions/proximity-sensors/vl6180x.html
5261
* http://www.st.com/content/st_com/en/products/imaging-and-photonics-solutions/proximity-sensors/vl53l0x.html
5362
* http://www.st.com/content/st_com/en/products/imaging-and-photonics-solutions/proximity-sensors/vl53l1x.html
@@ -57,6 +66,11 @@ The datasheets of the several components are available at
5766
* http://www.st.com/content/st_com/en/products/mems-and-sensors/humidity-sensors/hts221.html
5867
* http://www.st.com/content/st_com/en/products/mems-and-sensors/pressure-sensors/lps25hb.html
5968
* http://www.st.com/content/st_com/en/products/mems-and-sensors/inemo-inertial-modules/lsm6ds3.html
69+
* http://www.st.com/content/st_com/en/products/mems-and-sensors/inemo-inertial-modules/lsm6dso.html
70+
* http://www.st.com/content/st_com/en/products/mems-and-sensors/accelerometers/lis2dw12.html
71+
* http://www.st.com/content/st_com/en/products/mems-and-sensors/e-compasses/lis2mdl.html
72+
* http://www.st.com/content/st_com/en/products/mems-and-sensors/pressure-sensors/lps22hh.html
73+
* http://www.st.com/content/st_com/en/products/mems-and-sensors/temperature-sensors/stts751.html
6074

6175

6276

examples/Flight1/Flight1.ino

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* @version V1.0.0
66
* @date 21 December 2018
77
* @brief Arduino demo application for the STMicrolectronics
8-
* X-NUCLEO-IKS01A2, X-NUCLEO-53L1A1 and X-NUCLEO-IDB05A1
8+
* X-NUCLEO-IKS01A2 or X-NUCLEO-IKS01A3, X-NUCLEO-53L1A1
9+
* and X-NUCLEO-IDB05A1
910
******************************************************************************
1011
* @attention
1112
*
@@ -60,11 +61,28 @@
6061
#include <tof_gestures.h>
6162
#include <tof_gestures_DIRSWIPE_1.h>
6263
#include <tof_gestures_TAP_1.h>
64+
65+
66+
//NOTE: In order to use this example with the IKS01A2 board uncomment the
67+
// USE_IKS01A2 define and comment the USE_IKS01A3 define
68+
#define USE_IKS01A3
69+
//#define USE_IKS01A2
70+
71+
72+
#ifdef USE_IKS01A3
73+
#include <HTS221Sensor.h>
74+
#include <LPS22HHSensor.h>
75+
#include <LIS2DW12Sensor.h>
76+
#include <LIS2MDLSensor.h>
77+
#include <LSM6DSOSensor.h>
78+
#include <STTS751Sensor.h>
79+
#elif defined(USE_IKS01A2)
6380
#include <HTS221Sensor.h>
6481
#include <LPS22HBSensor.h>
6582
#include <LSM303AGR_ACC_Sensor.h>
6683
#include <LSM303AGR_MAG_Sensor.h>
6784
#include <LSM6DSLSensor.h>
85+
#endif
6886

6987
#define DEV_I2C Wire
7088
#define SerialPort Serial
@@ -390,7 +408,6 @@ fail:
390408
}
391409

392410

393-
394411
/*Public variables*/
395412
uint8_t set_connectable;
396413
int connected;
@@ -589,11 +606,20 @@ Gesture_TAP_1_Data_t gestureTapData;
589606
uint16_t distance_top, distance_left, distance_right;
590607

591608
//MEMS sensors
609+
#ifdef USE_IKS01A3
610+
HTS221Sensor *HumTemp;
611+
LPS22HHSensor *PressTemp;
612+
LSM6DSOSensor *AccGyr;
613+
LIS2DW12Sensor *Acc2;
614+
LIS2MDLSensor *Mag;
615+
STTS751Sensor *Temp;
616+
#elif defined (USE_IKS01A2)
592617
HTS221Sensor *HumTemp;
593618
LPS22HBSensor *PressTemp;
594619
LSM6DSLSensor *AccGyr;
595620
LSM303AGR_ACC_Sensor *Acc2;
596621
LSM303AGR_MAG_Sensor *Mag;
622+
#endif
597623

598624

599625
/*Setup distance sensors for gesture detection*/
@@ -692,16 +718,27 @@ void setup()
692718
sensor_vl53l1_right->VL53L1X_StartRanging();
693719

694720
//Setup MEMS sensors
721+
#ifdef USE_IKS01A3
722+
HumTemp = new HTS221Sensor (&DEV_I2C);
723+
PressTemp = new LPS22HHSensor (&DEV_I2C);
724+
AccGyr = new LSM6DSOSensor(&DEV_I2C);
725+
Acc2 = new LIS2DW12Sensor(&DEV_I2C);
726+
Mag = new LIS2MDLSensor(&DEV_I2C);
727+
Temp = new STTS751Sensor(&DEV_I2C);
728+
Temp->Enable();
729+
Acc2->Enable_X();
730+
#elif defined (USE_IKS01A2)
695731
HumTemp = new HTS221Sensor (&DEV_I2C);
696-
HumTemp->Enable();
697732
PressTemp = new LPS22HBSensor (&DEV_I2C);
698-
PressTemp->Enable();
699733
AccGyr = new LSM6DSLSensor(&DEV_I2C);
700-
AccGyr->Enable_X();
701-
AccGyr->Enable_G();
702734
Acc2 = new LSM303AGR_ACC_Sensor(&DEV_I2C);
703-
Acc2->Enable();
704735
Mag = new LSM303AGR_MAG_Sensor(&DEV_I2C);
736+
Acc2->Enable();
737+
#endif
738+
HumTemp->Enable();
739+
PressTemp->Enable();
740+
AccGyr->Enable_X();
741+
AccGyr->Enable_G();
705742
Mag->Enable();
706743
}
707744

@@ -728,10 +765,13 @@ void loop()
728765
if(Flight1.connected)
729766
{
730767
//Get enviroment data
731-
float humidity, temperature;
768+
float humidity, temperature, pressure;
732769
HumTemp->GetHumidity(&humidity);
770+
#ifdef USE_IKS01A3
771+
Temp->GetTemperature(&temperature);
772+
#elif defined (USE_IKS01A2)
733773
HumTemp->GetTemperature(&temperature);
734-
float pressure;
774+
#endif
735775
PressTemp->GetPressure(&pressure);
736776
MCR_BLUEMS_F2I_2D(pressure, intPart, decPart);
737777
PressToSend=intPart*100+decPart;

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=STM32duino FP_Examples
2-
version=1.1.2
2+
version=1.2.0
33
author=STMicroelectronics
44
maintainer=stm32duino
55
sentence=Provides several Function Packs that combine the usage of several X-NUCLEO boards

0 commit comments

Comments
 (0)