generated from leka/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
31 changed files
with
27,564 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MBED_OS_DIR=./lib/mbed-os | ||
TARGET=disco_f769ni | ||
TOOLCHAIN=GCC_ARM | ||
ROOT=. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
### Ignored directories to speed up compilation time | ||
|
||
test/** | ||
# lib/mbed-os/components/** | ||
lib/mbed-os/features/cellular/** | ||
lib/mbed-os/features/cryptocell/** | ||
lib/mbed-os/features/deprecated_warnings/** | ||
|
||
lib/mbed-os/features/FEATURE_BLE/** | ||
lib/mbed-os/features/FEATURE_BOOTLOADER/** | ||
|
||
lib/mbed-os/features/lorawan/** | ||
lib/mbed-os/features/lwipstack/** | ||
|
||
lib/mbed-os/features/nanostack/** | ||
lib/mbed-os/features/netsocket/** | ||
lib/mbed-os/features/nfc/** | ||
lib/mbed-os/features/unsupported/** | ||
|
||
### Needed directories | ||
|
||
# lib/mbed-os/features/device_key/** | ||
# lib/mbed-os/features/frameworks/** | ||
# lib/mbed-os/features/mbedtls/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# LKExp-mbed-sensors | ||
|
||
## Goal | ||
|
||
Clean example to use relevant sensors & test differents drivers | ||
|
||
Requested in [issue #4](https://github.com/leka/LekaOS_Explorations/issues/4) | ||
|
||
## Ressources | ||
|
||
[LKExp-mbed-X\_NUCLEO\_IKS01A2](https://github.com/leka/LekaOS_Explorations/tree/master/LKExp-mbed-x-nucleo-iks01a2) | ||
|
||
LSM6DSOX: | ||
|
||
* mbed by ST : [Link](https://os.mbed.com/teams/ST/code/LSM6DSOX/) (commit [`f27ce43dee4f`](https://os.mbed.com/teams/ST/code/LSM6DSOX/#f27ce43dee4f)) | ||
* github by ST : [Link](https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lsm6dsox_STdC) | ||
* github by stm32duino : [Link](https://github.com/stm32duino/LSM6DSOX) | ||
|
||
LSM303AGR (only magnetic sensor) | ||
|
||
* mbed by ST : [Link](https://os.mbed.com/teams/ST/code/LSM303AGR/) (commit [`6c7e83ae885e`](https://os.mbed.com/teams/ST/code/LSM303AGR/#6c7e83ae885e)) | ||
* github by ST : [Link](https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lsm303agr_STdC) | ||
* github by stm32duino : [Link](https://github.com/stm32duino/LSM303AGR) | ||
|
||
HTS221 | ||
|
||
* mbed by ST : [Link](https://os.mbed.com/teams/ST/code/HTS221/) (commit [`ccf7f36492ae`](https://os.mbed.com/teams/ST/code/HTS221/#ccf7f36492ae)) | ||
* github by ST : [Link](https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/hts221_STdC) | ||
* github by stm32duino : [Link](https://github.com/stm32duino/HTS221) | ||
|
||
## Construction | ||
|
||
* Board set to [BSP\_DISCO\_F769NI](https://os.mbed.com/teams/ST/code/BSP_DISCO_F769NI/) (mbed) but can be changed to any ST board on mbed with Arduino shield connector. | ||
* `DevI2C.h` come from [X\_NUCLEO\_COMMON](https://os.mbed.com/teams/ST/code/X_NUCLEO_COMMON/), it adapts i2c of mbed to i2c to manage i2c devices proposed by ST. | ||
* `Component.h`, `GyroSensor.h`, `HumiditySensor.h`, `MagneticSensor.h`, `MotionSensor.h` and `TempSensor.h` come from [ST\_INTERFACES](https://os.mbed.com/teams/ST/code/ST_INTERFACES/) are abstract classes to build specific drivers. | ||
|
||
## Execution | ||
|
||
* Plug X\_NUCLEO\_IKS01A2 and STEVAL\_MKI197V1 on Arduino conenctors | ||
* If an error occurs, LED1 turns on (after flash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
/** | ||
****************************************************************************** | ||
* @file GyroSensor.h | ||
* @author AST / EST | ||
* @version V0.0.1 | ||
* @date 13-April-2015 | ||
* @brief This file contains the abstract class describing in general | ||
* the interfaces of a gyroscope | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> | ||
* | ||
* 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. | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
|
||
/* Define to prevent from recursive inclusion --------------------------------*/ | ||
|
||
#ifndef __GYRO_SENSOR_CLASS_H | ||
#define __GYRO_SENSOR_CLASS_H | ||
|
||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
|
||
#include <Component.h> | ||
|
||
|
||
/* Classes ------------------------------------------------------------------*/ | ||
|
||
/** | ||
* An abstract class for a Gyroscope | ||
*/ | ||
class GyroSensor : public Component { | ||
public: | ||
|
||
/** | ||
* @brief Get current gyroscope angular rate X/Y/Z-axes values | ||
* in standard data units [mdps] | ||
* @param[out] p_data Pointer to where to store angular rates to. | ||
* p_data must point to an array of (at least) three elements, where: | ||
* p_data[0] corresponds to X-axis, | ||
* p_data[1] corresponds to Y-axis, and | ||
* p_data[2] corresponds to Z-axis. | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_g_axes(int32_t *p_data) = 0; | ||
|
||
/** | ||
* @brief Get current gyroscope raw data X/Y/Z-axes values | ||
* in device sepcific LSB units | ||
* @param[out] p_data Pointer to where to store gyroscope raw data to. | ||
* p_data must point to an array of (at least) three elements, where: | ||
* p_data[0] corresponds to X-axis, | ||
* p_data[1] corresponds to Y-axis, and | ||
* p_data[2] corresponds to Z-axis. | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_g_axes_raw(int16_t *p_data) = 0; | ||
|
||
/** | ||
* @brief Get gyroscope's current sensitivity [mdps/LSB] | ||
* @param[out] pf_data Pointer to where the gyroscope's sensitivity is stored to | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_g_sensitivity(float *pf_data) = 0; | ||
|
||
/** | ||
* @brief Get gyroscope's current output data rate [Hz] | ||
* @param[out] pf_data Pointer to where the gyroscope output data rate is stored to | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_g_odr(float *pf_data) = 0; | ||
|
||
/** | ||
* @brief Set gyroscope's output data rate | ||
* @param[in] odr New value for gyroscope's output data rate in [Hz] | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int set_g_odr(float odr) = 0; | ||
|
||
/** | ||
* @brief Get gyroscope's full scale value | ||
* i.e.\ min/max measurable value [dps] | ||
* @param[out] pf_data Pointer to where the gyroscope full scale value is stored to | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_g_fs(float *pf_data) = 0; | ||
|
||
/** | ||
* @brief Set gyroscope's full scale value | ||
* i.e.\ min/max measurable value | ||
* @param[in] fs New full scale value for gyroscope in [dps] | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int set_g_fs(float fs) = 0; | ||
|
||
/** | ||
* @brief Destructor. | ||
*/ | ||
virtual ~GyroSensor() {}; | ||
}; | ||
|
||
#endif /* __GYRO_SENSOR_CLASS_H */ |
72 changes: 72 additions & 0 deletions
72
LKExp-mbed-sensors/lib/mbed-ST_lib/Device/HumiditySensor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
****************************************************************************** | ||
* @file HumiditySensor.h | ||
* @author AST / EST | ||
* @version V0.0.1 | ||
* @date 13-April-2015 | ||
* @brief This file contains the abstract class describing in general | ||
* the interfaces of a humidity sensor | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> | ||
* | ||
* 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. | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
|
||
/* Define to prevent from recursive inclusion --------------------------------*/ | ||
|
||
#ifndef __HUMIDITY_SENSOR_CLASS_H | ||
#define __HUMIDITY_SENSOR_CLASS_H | ||
|
||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
|
||
#include <Component.h> | ||
|
||
|
||
/* Classes ------------------------------------------------------------------*/ | ||
|
||
/** | ||
* An abstract class for Humidity sensors | ||
*/ | ||
class HumiditySensor : public Component { | ||
public: | ||
|
||
/** | ||
* @brief Get current humidity [%] | ||
* @param[out] pf_data Pointer to where to store humidity to | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_humidity(float *pf_data) = 0; | ||
|
||
/** | ||
* @brief Destructor. | ||
*/ | ||
virtual ~HumiditySensor() {}; | ||
}; | ||
|
||
#endif /* __HUMIDITY_SENSOR_CLASS_H */ |
89 changes: 89 additions & 0 deletions
89
LKExp-mbed-sensors/lib/mbed-ST_lib/Device/MagneticSensor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
****************************************************************************** | ||
* @file MagneticSensor.h | ||
* @author AST / EST | ||
* @version V0.0.1 | ||
* @date 13-April-2015 | ||
* @brief This file contains the abstract class describing in general | ||
* the interfaces of a magnetometer | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> | ||
* | ||
* 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. | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
|
||
/* Define to prevent from recursive inclusion --------------------------------*/ | ||
|
||
#ifndef __MAGNETIC_SENSOR_CLASS_H | ||
#define __MAGNETIC_SENSOR_CLASS_H | ||
|
||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
|
||
#include <Component.h> | ||
|
||
|
||
/* Classes ------------------------------------------------------------------*/ | ||
|
||
/** | ||
* An abstract class for a magnetometer | ||
*/ | ||
class MagneticSensor : public Component { | ||
public: | ||
|
||
/** | ||
* @brief Get current magnetometer magnetic X/Y/Z-axes values | ||
* in standard data units [mgauss] | ||
* @param[out] p_data Pointer to where to store magnetic values to. | ||
* p_data must point to an array of (at least) three elements, where: | ||
* p_data[0] corresponds to X-axis, | ||
* p_data[1] corresponds to Y-axis, and | ||
* p_data[2] corresponds to Z-axis. | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_m_axes(int32_t *p_data) = 0; | ||
|
||
/** | ||
* @brief Get current magnetometer raw data X/Y/Z-axes values | ||
* in device sepcific LSB units | ||
* @param[out] p_data Pointer to where to store magnetometer raw data to. | ||
* p_data must point to an array of (at least) three elements, where: | ||
* p_data[0] corresponds to X-axis, | ||
* p_data[1] corresponds to Y-axis, and | ||
* p_data[2] corresponds to Z-axis. | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int get_m_axes_raw(int16_t *p_data) = 0; | ||
|
||
/** | ||
* @brief Destructor. | ||
*/ | ||
virtual ~MagneticSensor() {}; | ||
}; | ||
|
||
#endif /* __MAGNETIC_SENSOR_CLASS_H */ |
Oops, something went wrong.