From 4cd963688244cdfe22cbc6b42c3159f2f325ec8e Mon Sep 17 00:00:00 2001 From: Carlo Parata Date: Fri, 10 Nov 2017 15:41:20 +0100 Subject: [PATCH] Remove replicated examples --- .../X_NUCLEO_IKS01A2_6DOrientation.ino | 193 -------------- .../X_NUCLEO_IKS01A2_DoubleTap.ino | 108 -------- .../X_NUCLEO_IKS01A2_FreeFall.ino | 104 -------- ...UCLEO_IKS01A2_LSM6DSL_DataLog_Terminal.ino | 99 ------- .../X_NUCLEO_IKS01A2_MultiEvent.ino | 242 ------------------ .../X_NUCLEO_IKS01A2_Pedometer.ino | 125 --------- .../X_NUCLEO_IKS01A2_Tap.ino | 104 -------- .../X_NUCLEO_IKS01A2_Tilt.ino | 104 -------- .../X_NUCLEO_IKS01A2_WakeUp.ino | 104 -------- 9 files changed, 1183 deletions(-) delete mode 100644 examples/X_NUCLEO_IKS01A2_6DOrientation/X_NUCLEO_IKS01A2_6DOrientation.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_DoubleTap/X_NUCLEO_IKS01A2_DoubleTap.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_FreeFall/X_NUCLEO_IKS01A2_FreeFall.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_MultiEvent/X_NUCLEO_IKS01A2_MultiEvent.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_Pedometer/X_NUCLEO_IKS01A2_Pedometer.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_Tap/X_NUCLEO_IKS01A2_Tap.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_Tilt/X_NUCLEO_IKS01A2_Tilt.ino delete mode 100644 examples/X_NUCLEO_IKS01A2_WakeUp/X_NUCLEO_IKS01A2_WakeUp.ino diff --git a/examples/X_NUCLEO_IKS01A2_6DOrientation/X_NUCLEO_IKS01A2_6DOrientation.ino b/examples/X_NUCLEO_IKS01A2_6DOrientation/X_NUCLEO_IKS01A2_6DOrientation.ino deleted file mode 100644 index d117dea..0000000 --- a/examples/X_NUCLEO_IKS01A2_6DOrientation/X_NUCLEO_IKS01A2_6DOrientation.ino +++ /dev/null @@ -1,193 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_6DOrientation.ino - * @author CLab - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects 6D Orientation event through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -char report[256]; - -void INT1Event_cb(); -void sendOrientation(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(4, INT1Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable 6D Orientation. - AccGyr->Enable_6D_Orientation(); -} - -void loop() { - if (mems_event) - { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - if (status.D6DOrientationStatus) - { - // Send 6D Orientation - sendOrientation(); - - // Led blinking. - digitalWrite(13, HIGH); - delay(100); - digitalWrite(13, LOW); - } - } -} - -void INT1Event_cb() -{ - mems_event = 1; -} - -void sendOrientation() -{ - uint8_t xl = 0; - uint8_t xh = 0; - uint8_t yl = 0; - uint8_t yh = 0; - uint8_t zl = 0; - uint8_t zh = 0; - - AccGyr->Get_6D_Orientation_XL(&xl); - AccGyr->Get_6D_Orientation_XH(&xh); - AccGyr->Get_6D_Orientation_YL(&yl); - AccGyr->Get_6D_Orientation_YH(&yh); - AccGyr->Get_6D_Orientation_ZL(&zl); - AccGyr->Get_6D_Orientation_ZH(&zh); - - if ( xl == 0 && yl == 0 && zl == 0 && xh == 0 && yh == 1 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 1 && yl == 0 && zl == 0 && xh == 0 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 0 && zl == 0 && xh == 1 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 1 && zl == 0 && xh == 0 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 0 && zl == 0 && xh == 0 && yh == 0 && zh == 1 ) - { - sprintf( report, "\r\n __*_____________ " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 0 && zl == 1 && xh == 0 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n |________________| " \ - "\r\n * \r\n" ); - } - - else - { - sprintf( report, "None of the 6D orientation axes is set in LSM6DSL - accelerometer.\r\n" ); - } - - SerialPort.print(report); -} diff --git a/examples/X_NUCLEO_IKS01A2_DoubleTap/X_NUCLEO_IKS01A2_DoubleTap.ino b/examples/X_NUCLEO_IKS01A2_DoubleTap/X_NUCLEO_IKS01A2_DoubleTap.ino deleted file mode 100644 index 4aecddc..0000000 --- a/examples/X_NUCLEO_IKS01A2_DoubleTap/X_NUCLEO_IKS01A2_DoubleTap.ino +++ /dev/null @@ -1,108 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_DoubleTap.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects double tap event through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -void INT1Event_cb(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(4, INT1Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable Double Tap Detection. - AccGyr->Enable_Double_Tap_Detection(); -} - -void loop() { - if (mems_event) { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - if (status.DoubleTapStatus) - { - // Led blinking. - digitalWrite(13, HIGH); - delay(100); - digitalWrite(13, LOW); - delay(100); - digitalWrite(13, HIGH); - delay(100); - digitalWrite(13, LOW); - - // Output data. - SerialPort.println("Double Tap Detected!"); - } - } -} - -void INT1Event_cb() -{ - mems_event = 1; -} diff --git a/examples/X_NUCLEO_IKS01A2_FreeFall/X_NUCLEO_IKS01A2_FreeFall.ino b/examples/X_NUCLEO_IKS01A2_FreeFall/X_NUCLEO_IKS01A2_FreeFall.ino deleted file mode 100644 index 7fe8ab7..0000000 --- a/examples/X_NUCLEO_IKS01A2_FreeFall/X_NUCLEO_IKS01A2_FreeFall.ino +++ /dev/null @@ -1,104 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_FreeFall.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects free fall through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -void INT1Event_cb(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(4, INT1Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable Free Fall Detection. - AccGyr->Enable_Free_Fall_Detection(); -} - -void loop() { - if (mems_event) { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - if (status.FreeFallStatus) - { - // Led blinking. - digitalWrite(13, HIGH); - delay(200); - digitalWrite(13, LOW); - - // Output data. - SerialPort.println("Free Fall Detected!"); - } - } -} - -void INT1Event_cb() -{ - mems_event = 1; -} diff --git a/examples/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal.ino b/examples/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal.ino deleted file mode 100644 index 2dcabd3..0000000 --- a/examples/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal/X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal.ino +++ /dev/null @@ -1,99 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_LSM6DSL_DataLog_Terminal.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - // Initlialize component. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - AccGyr->Enable_G(); -} - -void loop() { - // Led blinking. - digitalWrite(13, HIGH); - delay(250); - digitalWrite(13, LOW); - delay(250); - - // Read accelerometer and gyroscope. - int32_t accelerometer[3]; - int32_t gyroscope[3]; - AccGyr->Get_X_Axes(accelerometer); - AccGyr->Get_G_Axes(gyroscope); - - // Output data. - SerialPort.print("| Acc[mg]: "); - SerialPort.print(accelerometer[0]); - SerialPort.print(" "); - SerialPort.print(accelerometer[1]); - SerialPort.print(" "); - SerialPort.print(accelerometer[2]); - SerialPort.print(" | Gyr[mdps]: "); - SerialPort.print(gyroscope[0]); - SerialPort.print(" "); - SerialPort.print(gyroscope[1]); - SerialPort.print(" "); - SerialPort.print(gyroscope[2]); - SerialPort.println(" |"); -} \ No newline at end of file diff --git a/examples/X_NUCLEO_IKS01A2_MultiEvent/X_NUCLEO_IKS01A2_MultiEvent.ino b/examples/X_NUCLEO_IKS01A2_MultiEvent/X_NUCLEO_IKS01A2_MultiEvent.ino deleted file mode 100644 index 3ef1476..0000000 --- a/examples/X_NUCLEO_IKS01A2_MultiEvent/X_NUCLEO_IKS01A2_MultiEvent.ino +++ /dev/null @@ -1,242 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_MultiEvent.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects free fall, tap, double tap, tilt, wake up, - * 6D Orientation and step events through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -uint16_t step_count = 0; -char report[256]; - -void INT1Event_cb(); -void INT2Event_cb(); -void sendOrientation(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(4, INT1Event_cb, RISING); - attachInterrupt(5, INT2Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable all HW events. - AccGyr->Enable_Pedometer(); - AccGyr->Enable_Tilt_Detection(); - AccGyr->Enable_Free_Fall_Detection(); - AccGyr->Enable_Single_Tap_Detection(); - AccGyr->Enable_Double_Tap_Detection(); - AccGyr->Enable_6D_Orientation(); - AccGyr->Enable_Wake_Up_Detection(); -} - -void loop() { - if (mems_event) - { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - - if (status.StepStatus) - { - // New step detected, so print the step counter - AccGyr->Get_Step_Counter(&step_count); - snprintf(report, sizeof(report), "Step counter: %d", step_count); - SerialPort.println(report); - } - - if (status.FreeFallStatus) - { - // Output data. - SerialPort.println("Free Fall Detected!"); - } - - if (status.TapStatus) - { - // Output data. - SerialPort.println("Single Tap Detected!"); - } - - if (status.DoubleTapStatus) - { - // Output data. - SerialPort.println("Double Tap Detected!"); - } - - if (status.TiltStatus) - { - // Output data. - SerialPort.println("Tilt Detected!"); - } - - if (status.D6DOrientationStatus) - { - // Send 6D Orientation - sendOrientation(); - } - - if (status.WakeUpStatus) - { - // Output data. - SerialPort.println("Wake up Detected!"); - } - } -} - -void INT1Event_cb() -{ - mems_event = 1; -} - -void INT2Event_cb() -{ - mems_event = 1; -} - -void sendOrientation() -{ - uint8_t xl = 0; - uint8_t xh = 0; - uint8_t yl = 0; - uint8_t yh = 0; - uint8_t zl = 0; - uint8_t zh = 0; - - AccGyr->Get_6D_Orientation_XL(&xl); - AccGyr->Get_6D_Orientation_XH(&xh); - AccGyr->Get_6D_Orientation_YL(&yl); - AccGyr->Get_6D_Orientation_YH(&yh); - AccGyr->Get_6D_Orientation_ZL(&zl); - AccGyr->Get_6D_Orientation_ZH(&zh); - - if ( xl == 0 && yl == 0 && zl == 0 && xh == 0 && yh == 1 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 1 && yl == 0 && zl == 0 && xh == 0 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 0 && zl == 0 && xh == 1 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 1 && zl == 0 && xh == 0 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | | " \ - "\r\n | * | " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 0 && zl == 0 && xh == 0 && yh == 0 && zh == 1 ) - { - sprintf( report, "\r\n __*_____________ " \ - "\r\n |________________| \r\n" ); - } - - else if ( xl == 0 && yl == 0 && zl == 1 && xh == 0 && yh == 0 && zh == 0 ) - { - sprintf( report, "\r\n ________________ " \ - "\r\n |________________| " \ - "\r\n * \r\n" ); - } - - else - { - sprintf( report, "None of the 6D orientation axes is set in LSM6DSL - accelerometer.\r\n" ); - } - - SerialPort.print(report); -} diff --git a/examples/X_NUCLEO_IKS01A2_Pedometer/X_NUCLEO_IKS01A2_Pedometer.ino b/examples/X_NUCLEO_IKS01A2_Pedometer/X_NUCLEO_IKS01A2_Pedometer.ino deleted file mode 100644 index 21fc83f..0000000 --- a/examples/X_NUCLEO_IKS01A2_Pedometer/X_NUCLEO_IKS01A2_Pedometer.ino +++ /dev/null @@ -1,125 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_Pedometer.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects step event through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -uint32_t previous_tick = 0; -uint32_t current_tick = 0; -uint16_t step_count = 0; -char report[256]; - -void INT1Event_cb(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(4, INT1Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable Pedometer. - AccGyr->Enable_Pedometer(); - - previous_tick = millis(); -} - -void loop() { - if (mems_event) - { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - if (status.StepStatus) - { - // New step detected, so print the step counter - AccGyr->Get_Step_Counter(&step_count); - snprintf(report, sizeof(report), "Step counter: %d", step_count); - SerialPort.println(report); - - // Led blinking. - digitalWrite(13, HIGH); - delay(100); - digitalWrite(13, LOW); - } - } - - // Print the step counter in any case every 3000 ms - current_tick = millis(); - if((current_tick - previous_tick) >= 3000) - { - AccGyr->Get_Step_Counter(&step_count); - snprintf(report, sizeof(report), "Step counter: %d", step_count); - SerialPort.println(report); - previous_tick = millis(); - } - -} - -void INT1Event_cb() -{ - mems_event = 1; -} diff --git a/examples/X_NUCLEO_IKS01A2_Tap/X_NUCLEO_IKS01A2_Tap.ino b/examples/X_NUCLEO_IKS01A2_Tap/X_NUCLEO_IKS01A2_Tap.ino deleted file mode 100644 index 7329d94..0000000 --- a/examples/X_NUCLEO_IKS01A2_Tap/X_NUCLEO_IKS01A2_Tap.ino +++ /dev/null @@ -1,104 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_Tap.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects tap event through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -void INT1Event_cb(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(4, INT1Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable Single Tap Detection. - AccGyr->Enable_Single_Tap_Detection(); -} - -void loop() { - if (mems_event) { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - if (status.TapStatus) - { - // Led blinking. - digitalWrite(13, HIGH); - delay(100); - digitalWrite(13, LOW); - - // Output data. - SerialPort.println("Single Tap Detected!"); - } - } -} - -void INT1Event_cb() -{ - mems_event = 1; -} diff --git a/examples/X_NUCLEO_IKS01A2_Tilt/X_NUCLEO_IKS01A2_Tilt.ino b/examples/X_NUCLEO_IKS01A2_Tilt/X_NUCLEO_IKS01A2_Tilt.ino deleted file mode 100644 index 65c5991..0000000 --- a/examples/X_NUCLEO_IKS01A2_Tilt/X_NUCLEO_IKS01A2_Tilt.ino +++ /dev/null @@ -1,104 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_Tilt.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects tilt event through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -void INT1Event_cb(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(4, INT1Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable Tilt Detection. - AccGyr->Enable_Tilt_Detection(); -} - -void loop() { - if (mems_event) { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - if (status.TiltStatus) - { - // Led blinking. - digitalWrite(13, HIGH); - delay(100); - digitalWrite(13, LOW); - - // Output data. - SerialPort.println("Tilt Detected!"); - } - } -} - -void INT1Event_cb() -{ - mems_event = 1; -} diff --git a/examples/X_NUCLEO_IKS01A2_WakeUp/X_NUCLEO_IKS01A2_WakeUp.ino b/examples/X_NUCLEO_IKS01A2_WakeUp/X_NUCLEO_IKS01A2_WakeUp.ino deleted file mode 100644 index be6da91..0000000 --- a/examples/X_NUCLEO_IKS01A2_WakeUp/X_NUCLEO_IKS01A2_WakeUp.ino +++ /dev/null @@ -1,104 +0,0 @@ -/** - ****************************************************************************** - * @file X_NUCLEO_IKS01A2_WakeUp.ino - * @author AST - * @version V1.0.0 - * @date 7 September 2017 - * @brief Arduino test application for the STMicrolectronics X-NUCLEO-IKS01A2 - * MEMS Inertial and Environmental sensor expansion board. - * This application detects wake up event through the LSM6DSL sensor. - * This application makes use of C++ classes obtained from the C - * components' drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - - -// Includes. -#include - -#if defined(ARDUINO_SAM_DUE) -#define DEV_I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due -#define SerialPort Serial -#else -#define DEV_I2C Wire //Or Wire -#define SerialPort Serial -#endif - -// Components. -LSM6DSLSensor *AccGyr; - -//Interrupts. -volatile int mems_event = 0; - -void INT2Event_cb(); - -void setup() { - // Led. - pinMode(13, OUTPUT); - - // Initialize serial for output. - SerialPort.begin(9600); - - // Initialize I2C bus. - DEV_I2C.begin(); - - //Interrupts. - attachInterrupt(5, INT2Event_cb, RISING); - - // Initlialize Components. - AccGyr = new LSM6DSLSensor(&DEV_I2C); - AccGyr->Enable_X(); - - // Enable Wake Up Detection. - AccGyr->Enable_Wake_Up_Detection(); -} - -void loop() { - if (mems_event) { - mems_event = 0; - LSM6DSL_Event_Status_t status; - AccGyr->Get_Event_Status(&status); - if (status.WakeUpStatus) - { - // Led blinking. - digitalWrite(13, HIGH); - delay(100); - digitalWrite(13, LOW); - - // Output data. - SerialPort.println("Wake up Detected!"); - } - } -} - -void INT2Event_cb() -{ - mems_event = 1; -}