diff options
author | Bosch Sensortec <github@bosch-sensortec.com> | 2018-08-29 08:08:53 +0200 |
---|---|---|
committer | Kevin Goveas <kevin.goveas@bosch-sensortec.com> | 2018-08-29 08:10:01 +0200 |
commit | face5924fc6824ec0c3fd907a112d053b433a46b (patch) | |
tree | ff5669204019d53d0bdd794ea53c42d0613ba777 /drivers/input/sensors | |
parent | 30c6929e15b66307dd679e380100028f60bb10b1 (diff) |
added new base source files
Diffstat (limited to 'drivers/input/sensors')
-rw-r--r-- | drivers/input/sensors/smi130/Kconfig | 70 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/Makefile | 11 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/boschclass.c | 2 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/boschclass.h | 102 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/bs_log.c | 104 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/bs_log.h | 102 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/modules.order | 0 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/readme.md | 197 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130.c | 14233 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130.h | 221 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_acc.c | 7507 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_driver.c | 112 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_driver.h | 112 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_gyro.c | 7422 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_gyro.h | 4705 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_gyro_driver.c | 2036 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_i2c.c | 106 | ||||
-rw-r--r-- | drivers/input/sensors/smi130/smi130_spi.c | 238 |
18 files changed, 29736 insertions, 7544 deletions
diff --git a/drivers/input/sensors/smi130/Kconfig b/drivers/input/sensors/smi130/Kconfig index 06e39ddc1159..0dd0b393f893 100644 --- a/drivers/input/sensors/smi130/Kconfig +++ b/drivers/input/sensors/smi130/Kconfig @@ -7,52 +7,58 @@ config BOSCH_DRIVER_LOG_FUNC help If you say yes here, you get support for smart log function in Bosch Sensortec driver. -config SENSORS_BMA2X2 - tristate "BMA2x2 acceleration sensor support" +config SENSORS_SMI_ACC2X2 + tristate "SMI130_ACC acceleration sensor support" depends on I2C help If you say yes here, you get support for Bosch Sensortec's - acceleration sensors BMA255/BMA254/BMA355/BMA250E/BMA222E/BMA280. + acceleration sensors SMI_ACC255/SMI_ACC254/SMI_ACC355/SMI_ACC250E/SMI_ACC222E/SMI_ACC280. -config SENSORS_BMA2X2_ENABLE_INT1 - tristate "BMA2X2 acceleration sensor interrupt INT1 support" - depends on SENSORS_BMA2X2 +config SENSORS_SMI_ACC2X2_ENABLE_INT1 + tristate "SMI_ACC2X2 acceleration sensor interrupt INT1 support" + depends on SENSORS_SMI_ACC2X2 help If you say yes here, you get INT1 support for Bosch Sensortec - acceleration sensors BMA255/BMA250E/BMA222E/BMA280. + acceleration sensors SMI_ACC255/SMI_ACC250E/SMI_ACC222E/SMI_ACC280. Select it will disable interrupt INT2 support -config SENSORS_BMA2X2_ENABLE_INT2 - tristate "BMA2X2 acceleration sensor interrupt INT2 support" - depends on SENSORS_BMA2X2 && !SENSORS_BMA2X2_ENABLE_INT1 +config SENSORS_SMI_ACC2X2_ENABLE_INT2 + tristate "SMI_ACC2X2 acceleration sensor interrupt INT2 support" + depends on SENSORS_SMI_ACC2X2 && !SENSORS_SMI_ACC2X2_ENABLE_INT1 help If you say yes here, you get INT2 support for Bosch Sensortec - acceleration sensors BMA255/BMA250E/BMA222E/BMA280. + acceleration sensors SMI_ACC255/SMI_ACC250E/SMI_ACC222E/SMI_ACC280. Can only open if you do NOT open interrupt INT1 support config SIG_MOTION tristate "support significant motion sensor function" - depends on SENSORS_BMA2X2 && ( SENSORS_BMA2X2_ENABLE_INT1 || SENSORS_BMA2X2_ENABLE_INT2) + depends on SENSORS_SMI_ACC2X2 && ( SENSORS_SMI_ACC2X2_ENABLE_INT1 || SENSORS_SMI_ACC2X2_ENABLE_INT2) help If you say yes here, if you want to support Bosch significant motion sensor function config DOUBLE_TAP tristate "support double tap sensor function" - depends on SENSORS_BMA2X2 && ( SENSORS_BMA2X2_ENABLE_INT1 || SENSORS_BMA2X2_ENABLE_INT2) + depends on SENSORS_SMI_ACC2X2 && ( SENSORS_SMI_ACC2X2_ENABLE_INT1 || SENSORS_SMI_ACC2X2_ENABLE_INT2) help If you say yes here, you get support Bosch double tap sensor function -config SENSORS_BMG +config SENSORS_SMI_GYRO tristate "Bosch Gyroscope Sensor Driver" depends on I2C help If you say yes here, you get support for Bosch Sensortec's - gyroscope sensor drivers of BMG160/SMI055/BMI058 e.t.c. + gyroscope sensor drivers of SMI130_GYRO/SMI055/BMI058 e.t.c. +config SENSORS_SMI_GYRO_FIFO + tristate "Bosch Gyroscope FIFO Support" + depends on SENSORS_SMI_GYRO + help + If you say yes here, you get support for Gyroscope sensor FIFO operations. + Please check whether the chip supports fifo feature to open it. config SENSORS_BMI058 tristate "BMI058 Sensor Support" - depends on (SENSORS_BMG || SENSORS_BMA2X2) + depends on (SENSORS_SMI_GYRO || SENSORS_SMI_ACC2X2) help If you say yes here, you get support for Bosch Sensortec's sensor driver of BMI058. @@ -83,33 +89,33 @@ config SENSORS_AKM09912 help If you say yes here, you get support AKM09912 Sensor support. -config SENSORS_BMA420 - tristate "BMA4XY Sensor Support" +config SENSORS_SMI_ACC420 + tristate "SMI_ACC4XY Sensor Support" depends on I2C || SPI_MASTER help - If you say yes here, you get support for Bosch Sensortec's sensor driver of BMA420. -config SENSORS_BMA421 - tristate "BMA4XY Sensor Support" + If you say yes here, you get support for Bosch Sensortec's sensor driver of SMI_ACC420. +config SENSORS_SMI_ACC421 + tristate "SMI_ACC4XY Sensor Support" depends on I2C || SPI_MASTER help - If you say yes here, you get support for Bosch Sensortec's sensor driver of BMA421. -config SENSORS_BMA422 - tristate "BMA4XY Sensor Support" + If you say yes here, you get support for Bosch Sensortec's sensor driver of SMI_ACC421. +config SENSORS_SMI_ACC422 + tristate "SMI_ACC4XY Sensor Support" depends on I2C || SPI_MASTER help - If you say yes here, you get support for Bosch Sensortec's sensor driver of BMA422. -config SENSORS_BMA455 - tristate "BMA4XY Sensor Support" + If you say yes here, you get support for Bosch Sensortec's sensor driver of SMI_ACC422. +config SENSORS_SMI_ACC455 + tristate "SMI_ACC4XY Sensor Support" depends on I2C || SPI_MASTER help - If you say yes here, you get support for Bosch Sensortec's sensor driver of BMA455. + If you say yes here, you get support for Bosch Sensortec's sensor driver of SMI_ACC455. -config BMA4XY_MAG_INTERFACE_SUPPORT -tristate "BMA4XY Sensor mag interface support" -depends on SENSORS_BMA4XY +config SMI_ACC4XY_MAG_INTERFACE_SUPPORT +tristate "SMI_ACC4XY Sensor mag interface support" +depends on SENSORS_SMI_ACC4XY help If you say yes here, you get support for Bosch Sensortec's - sensor driver of BMA4XY with mag sensor support. + sensor driver of SMI_ACC4XY with mag sensor support. diff --git a/drivers/input/sensors/smi130/Makefile b/drivers/input/sensors/smi130/Makefile index b374e00dc5bc..ad1e5437d652 100644 --- a/drivers/input/sensors/smi130/Makefile +++ b/drivers/input/sensors/smi130/Makefile @@ -8,7 +8,18 @@ ifeq ($(CONFIG_BOSCH_DRIVER_LOG_FUNC),y) EXTRA_CFLAGS += -DBOSCH_DRIVER_LOG_FUNC endif +obj-y += smi130_acc.o +ifeq ($(CONFIG_SENSORS_SMI_ACC2X2_ENABLE_INT1),y) + EXTRA_CFLAGS += -DSMI_ACC2X2_ENABLE_INT1 +endif + +ifeq ($(CONFIG_BOSCH_SMI_ACC2X2_ENABLE_INT2),y) + EXTRA_CFLAGS += -DSMI_ACC2X2_ENABLE_INT2 +endif + +obj-y += smi130_gyro_driver.o smi130_gyro.o +EXTRA_CFLAGS += -DSMI_GYRO_USE_BASIC_I2C_FUNC obj-y += smi130_driver.o smi130.o ifeq ($(CONFIG_SMI130_MAG_INTERFACE_SUPPORT),y) diff --git a/drivers/input/sensors/smi130/boschclass.c b/drivers/input/sensors/smi130/boschclass.c index cf2e496ece27..8c28ab158da4 100644 --- a/drivers/input/sensors/smi130/boschclass.c +++ b/drivers/input/sensors/smi130/boschclass.c @@ -110,7 +110,7 @@ * * @filename boschclass.c * @date 2015/11/17 13:44 - * @Modification Date 2018/06/21 15:03 + * @Modification Date 2018/08/28 18:20 * @id "836294d" * @version 1.5.9 * diff --git a/drivers/input/sensors/smi130/boschclass.h b/drivers/input/sensors/smi130/boschclass.h index 505f1556f717..a89cc5d94e64 100644 --- a/drivers/input/sensors/smi130/boschclass.h +++ b/drivers/input/sensors/smi130/boschclass.h @@ -8,9 +8,109 @@ * Public License (GPL).Version 2,June 1991, * available at http://www.fsf.org/copyleft/gpl.html * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * * @filename boschcalss.h * @date 2015/11/17 13:44 - * @Modification Date 2018/06/21 15:03 + * @Modification Date 2018/08/28 18:20 * @id "836294d" * @version 1.5.9 * diff --git a/drivers/input/sensors/smi130/bs_log.c b/drivers/input/sensors/smi130/bs_log.c index 52db4c80f989..05ddddd96683 100644 --- a/drivers/input/sensors/smi130/bs_log.c +++ b/drivers/input/sensors/smi130/bs_log.c @@ -8,9 +8,109 @@ * Public License (GPL).Version 2,June 1991, * available at http://www.fsf.org/copyleft/gpl.html * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * * @filename bs_log.c * @date "Wed Sep 24 15:27:12 2014 +0800" - * @Modification Date "Thu June 21 15:03 2018 +0100" + * @Modification Date 2018/08/28 18:20 * @id "e416c14" * * @brief @@ -49,5 +149,5 @@ uint8_t get_debug_log_level(void) EXPORT_SYMBOL(set_debug_log_level); EXPORT_SYMBOL(get_debug_log_level); -#endif/*BOSCH_DRIVER_LOG_FUNC*/ +#endif/*BOSCH_DRIVER_LOG_FUNC*/
/*@}*/ diff --git a/drivers/input/sensors/smi130/bs_log.h b/drivers/input/sensors/smi130/bs_log.h index 758ea0b8cbb8..86ef153c5281 100644 --- a/drivers/input/sensors/smi130/bs_log.h +++ b/drivers/input/sensors/smi130/bs_log.h @@ -8,9 +8,109 @@ * Public License (GPL).Version 2,June 1991, * available at http://www.fsf.org/copyleft/gpl.html * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * * @filename bs_log.h * @date "Sat Oct 11 16:12:16 2014 +0800" - * @Modification Date "Thu June 21 15:03 2018 +0100" + * @Modification Date 2018/08/28 18:20 * @id "762cc9e" * * @brief diff --git a/drivers/input/sensors/smi130/modules.order b/drivers/input/sensors/smi130/modules.order new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/drivers/input/sensors/smi130/modules.order diff --git a/drivers/input/sensors/smi130/readme.md b/drivers/input/sensors/smi130/readme.md index 4d499398c671..48b2cc16b134 100644 --- a/drivers/input/sensors/smi130/readme.md +++ b/drivers/input/sensors/smi130/readme.md @@ -1,148 +1,49 @@ -# SMI130 sensor API - -## Introduction - -This package contains the Robert Bosch GmbH's SMI130 sensor driver (sensor API) - -## Version - -File | Version | Date -----------------|---------|--------------- -smi130.h | 2.0.9 | 2018/06/21 -smi130.c | 2.0.9 | 2018/06/21 -smi130_spi.c | 1.3 | 2018/06/21 -smi130_i2c.c | 1.3 | 2018/06/21 -smi130_driver.h | 1.3 | 2018/06/21 -smi130_driver.c | 1.3 | 2018/06/21 -bs_log.h | | 2018/06/21 -bs_log.c | | 2018/06/21 -boschclass.h | 1.5.9 | 2018/06/21 -boschclass.c | 1.5.9 | 2018/06/21 - -## File information - -* smi130.h : The head file of SMI130API -* smi130.c : Sensor Driver for SMI130 sensor -* smi130_spi.c : This file implements moudle function, which add the driver to SPI core. -* smi130_i2c.c : This file implements moudle function, which add the driver to I2C core. -* smi130_driver.h : The head file of SMI130 device driver core code -* smi130_driver.c : This file implements the core code of SMI130 device driver -* bs_log.h : The head file of BOSCH SENSOR LOG -* bs_log.c : The source file of BOSCH SENSOR LOG -* boschclass.h : -* boschclass.c : - -## Supported sensor interface - -* SPI 4-wire -* I2C - -## Copyright - -Copyright (C) 2016 - 2017 Bosch Sensortec GmbH -Modification Copyright (C) 2018 Robert Bosch Kft All Rights Reserved - -This software program is licensed subject to the GNU General -Public License (GPL).Version 2,June 1991, -available at http://www.fsf.org/copyleft/gpl.html - -Special: Description of the Software: - -This software module (hereinafter called "Software") and any -information on application-sheets (hereinafter called "Information") is -provided free of charge for the sole purpose to support your application -work. - -As such, the Software is merely an experimental software, not tested for -safety in the field and only intended for inspiration for further development -and testing. Any usage in a safety-relevant field of use (like automotive, -seafaring, spacefaring, industrial plants etc.) was not intended, so there are -no precautions for such usage incorporated in the Software. - -The Software is specifically designed for the exclusive use for Bosch -Sensortec products by personnel who have special experience and training. Do -not use this Software if you do not have the proper experience or training. - -This Software package is provided as is and without any expressed or -implied warranties, including without limitation, the implied warranties of -merchantability and fitness for a particular purpose. - -Bosch Sensortec and their representatives and agents deny any liability for -the functional impairment of this Software in terms of fitness, performance -and safety. Bosch Sensortec and their representatives and agents shall not be -liable for any direct or indirect damages or injury, except as otherwise -stipulated in mandatory applicable law. -The Information provided is believed to be accurate and reliable. Bosch -Sensortec assumes no responsibility for the consequences of use of such -Information nor for any infringement of patents or other rights of third -parties which may result from its use. - ------------------------------------------------------------------------------- -The following Product Disclaimer does not apply to the Kernel Driver -This software program is licensed subject to the GNU General -Public License (GPL).Version 2,June 1991, -available at http://www.fsf.org/copyleft/gpl.html - -Product Disclaimer - -Common: - -Assessment of Products Returned from Field - -Returned products are considered good if they fulfill the specifications / -test data for 0-mileage and field listed in this document. - -Engineering Samples - -Engineering samples are marked with (e) or (E). Samples may vary from the -valid technical specifications of the series product contained in this -data sheet. Therefore, they are not intended or fit for resale to -third parties or for use in end products. Their sole purpose is internal -client testing. The testing of an engineering sample may in no way replace -the testing of a series product. Bosch assumes no liability for the use -of engineering samples. The purchaser shall indemnify Bosch from all claims -arising from the use of engineering samples. - -Intended use - -Provided that SMI130 is used within the conditions (environment, application, -installation, loads) as described in this TCD and the corresponding -agreed upon documents, Bosch ensures that the product complies with -the agreed properties. Agreements beyond this require -the written approval by Bosch. The product is considered fit for the intended -use when the product successfully has passed the tests -in accordance with the TCD and agreed upon documents. - -It is the responsibility of the customer to ensure the proper application -of the product in the overall system/vehicle. - -Bosch does not assume any responsibility for changes to the environment -of the product that deviate from the TCD and the agreed upon documents -as well as all applications not released by Bosch - -The resale and/or use of products are at the purchaser’s own risk and -responsibility. The examination and testing of the SMI130 -is the sole responsibility of the purchaser. - -The purchaser shall indemnify Bosch from all third party claims -arising from any product use not covered by the parameters of -this product data sheet or not approved by Bosch and reimburse Bosch -for all costs and damages in connection with such claims. - -The purchaser must monitor the market for the purchased products, -particularly with regard to product safety, and inform Bosch without delay -of all security relevant incidents. - -Application Examples and Hints - -With respect to any application examples, advice, normal values -and/or any information regarding the application of the device, -Bosch hereby disclaims any and all warranties and liabilities of any kind, -including without limitation warranties of -non-infringement of intellectual property rights or copyrights -of any third party. -The information given in this document shall in no event be regarded -as a guarantee of conditions or characteristics. They are provided -for illustrative purposes only and no evaluation regarding infringement -of intellectual property rights or copyrights or regarding functionality, -performance or error has been made.
\ No newline at end of file +# SMI130 sensor API
+## Introduction
+This package contains the Robert Bosch GmbH's SMI130 sensor driver (sensor API)
+
+## Version
+File | Version | Date
+---------------------|---------|---------------
+smi130.h | 2.0.9 | 2018/08/28
+smi130.c | 2.0.9 | 2018/08/28
+smi130_spi.c | 1.3 | 2018/08/28
+smi130_i2c.c | 1.3 | 2018/08/28
+smi130_gyro_driver.c | 1.5.9 | 2018/08/28
+smi130_gyro.c | 1.5 | 2018/08/28
+smi130_gyro.h | 1.5 | 2018/08/28
+smi130_driver.h | 1.3 | 2018/08/28
+smi130_driver.c | 1.3 | 2018/08/28
+smi130_acc.c | 2.1.2 | 2018/08/28
+bs_log.h | | 2018/08/28
+bs_log.c | | 2018/08/28
+boschcalss.h | 1.5.9 | 2018/08/28
+boschclass.c | 1.5.9 | 2018/08/28
+
+
+
+## File information
+* smi130.h : The head file of SMI130API
+* smi130.c : Sensor Driver for SMI130 sensor
+* smi130_spi.c : This file implements moudle function, which add the driver to SPI core.
+* smi130_i2c.c : This file implements moudle function, which add the driver to I2C core.
+* smi130_driver.h : The head file of SMI130 device driver core code
+* smi130_driver.c : This file implements the core code of SMI130 device driver
+* bs_log.h : The head file of BOSCH SENSOR LOG
+* bs_log.c : The source file of BOSCH SENSOR LOG
+* boschcalss.h :
+* boschclass.c :
+
+
+## Supported sensor interface
+* SPI 4-wire
+* I2C
+
+## Copyright
+
+Copyright (C) 2016 - 2017 Bosch Sensortec GmbH
+Modification Copyright (C) 2018 Robert Bosch Kft All Rights Reserved
+
+This software program is licensed subject to the GNU General
+Public License (GPL).Version 2,June 1991,
+available at http://www.fsf.org/copyleft/gpl.html
\ No newline at end of file diff --git a/drivers/input/sensors/smi130/smi130.c b/drivers/input/sensors/smi130/smi130.c index 995b7d699da5..33ab0d02ccef 100644 --- a/drivers/input/sensors/smi130/smi130.c +++ b/drivers/input/sensors/smi130/smi130.c @@ -1,142 +1,139 @@ -/* -* @section LICENSE -* (C) Copyright 2011~2018 Bosch Sensortec GmbH All Rights Reserved -* -* (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved -* -* This software program is licensed subject to the GNU General -* Public License (GPL).Version 2,June 1991, -* available at http://www.fsf.org/copyleft/gpl.html - +/*! + * @section LICENSE + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved + * + * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved + * + * This software program is licensed subject to the GNU General + * Public License (GPL).Version 2,June 1991, + * available at http://www.fsf.org/copyleft/gpl.html + * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. * * @filename smi130.c * @Date: 2015/04/02 -* @Modification Date 2018/06/21 15:03 +* @Modification Date 2018/08/28 18:20 * @id 836294d * @Revision: 2.0.9 $ * * Usage: Sensor Driver for SMI130 sensor -* -* Special: Description of the Software: -* -* This software module (hereinafter called "Software") and any -* information on application-sheets (hereinafter called "Information") is -* provided free of charge for the sole purpose to support your application -* work. -* -* As such, the Software is merely an experimental software, not tested for -* safety in the field and only intended for inspiration for further development -* and testing. Any usage in a safety-relevant field of use (like automotive, -* seafaring, spacefaring, industrial plants etc.) was not intended, so there are -* no precautions for such usage incorporated in the Software. -* -* The Software is specifically designed for the exclusive use for Bosch -* Sensortec products by personnel who have special experience and training. Do -* not use this Software if you do not have the proper experience or training. -* -* This Software package is provided as is and without any expressed or -* implied warranties, including without limitation, the implied warranties of -* merchantability and fitness for a particular purpose. -* -* Bosch Sensortec and their representatives and agents deny any liability for -* the functional impairment of this Software in terms of fitness, performance -* and safety. Bosch Sensortec and their representatives and agents shall not be -* liable for any direct or indirect damages or injury, except as otherwise -* stipulated in mandatory applicable law. -* The Information provided is believed to be accurate and reliable. Bosch -* Sensortec assumes no responsibility for the consequences of use of such -* Information nor for any infringement of patents or other rights of third -* parties which may result from its use. -* -*------------------------------------------------------------------------------ -* The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software -* which is licensed under the Apache License, Version 2.0 as stated above. -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Product Disclaimer -* -* Common: -* -* Assessment of Products Returned from Field -* -* Returned products are considered good if they fulfill the specifications / -* test data for 0-mileage and field listed in this document. -* -* Engineering Samples -* -* Engineering samples are marked with (e) or (E). Samples may vary from the -* valid technical specifications of the series product contained in this -* data sheet. Therefore, they are not intended or fit for resale to -* third parties or for use in end products. Their sole purpose is internal -* client testing. The testing of an engineering sample may in no way replace -* the testing of a series product. Bosch assumes no liability for the use -* of engineering samples. The purchaser shall indemnify Bosch from all claims -* arising from the use of engineering samples. -* -* Intended use -* -* Provided that SMI130 is used within the conditions (environment, application, -* installation, loads) as described in this TCD and the corresponding -* agreed upon documents, Bosch ensures that the product complies with -* the agreed properties. Agreements beyond this require -* the written approval by Bosch. The product is considered fit for the intended -* use when the product successfully has passed the tests -* in accordance with the TCD and agreed upon documents. -* -* It is the responsibility of the customer to ensure the proper application -* of the product in the overall system/vehicle. -* -* Bosch does not assume any responsibility for changes to the environment -* of the product that deviate from the TCD and the agreed upon documents -* as well as all applications not released by Bosch -* -* The resale and/or use of products are at the purchaser’s own risk and -* responsibility. The examination and testing of the SMI130 -* is the sole responsibility of the purchaser. -* -* The purchaser shall indemnify Bosch from all third party claims -* arising from any product use not covered by the parameters of -* this product data sheet or not approved by Bosch and reimburse Bosch -* for all costs and damages in connection with such claims. -* -* The purchaser must monitor the market for the purchased products, -* particularly with regard to product safety, and inform Bosch without delay -* of all security relevant incidents. -* -* Application Examples and Hints -* -* With respect to any application examples, advice, normal values -* and/or any information regarding the application of the device, -* Bosch hereby disclaims any and all warranties and liabilities of any kind, -* including without limitation warranties of -* non-infringement of intellectual property rights or copyrights -* of any third party. -* The information given in this document shall in no event be regarded -* as a guarantee of conditions or characteristics. They are provided -* for illustrative purposes only and no evaluation regarding infringement -* of intellectual property rights or copyrights or regarding functionality, -* performance or error has been made. -* -* -**************************************************************************/ -/*! file <SMI130 > - brief <Sensor driver for SMI130>*/ +*/ + + #include "smi130.h" #include <linux/kernel.h> -/* user defined code to be added here ...*/ -struct smi130_t*p_smi130; +/* user defined code to be added here ... */ +struct smi130_t *p_smi130; /* used for reading the mag trim values for compensation*/ struct trim_data_t mag_trim; /* the following variable used for avoiding the selecting of auto mode when it is running in the manual mode of BMM150 mag interface*/ u8 V_bmm150_maual_auto_condition_u8 = SMI130_INIT_VALUE; -/* used for reading the AKM compensating data*/ +/* used for reading the AKM compensating data */ struct bosch_akm_sensitivity_data_t akm_asa_data; -/* Assign the fifo time*/ +/* Assign the fifo time */ u32 V_fifo_time_U32 = SMI130_INIT_VALUE; -/* FIFO data read for 1024 bytes of data*/ +/* FIFO data read for 1024 bytes of data */ u8 v_fifo_data_u8[FIFO_FRAME] = {SMI130_INIT_VALUE}; /* YAMAHA-YAS532*/ /* value of coeff*/ @@ -147,41 +144,41 @@ struct yas532_t yas532_data; /* used for reading the yas537 calibration data*/ struct yas537_t yas537_data; /*! -* @brief -* This function is used for initialize -* bus read and bus write functions -* assign the chip id and device address -* chip id is read in the register 0x00 bit from 0 to 7 -* -* @param smi130 : structure pointer -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* @note -* While changing the parameter of the smi130_t -* consider the following point: -* Changing the reference value of the parameter -* will changes the local copy or local reference -* make sure your changes will not -* affect the reference value of the parameter -* (Better case don't change the reference value of the parameter) -* -*/ -SMI130_RETURN_FUNCTION_TYPE smi130_init(struct smi130_t*smi130) + * @brief + * This function is used for initialize + * bus read and bus write functions + * assign the chip id and device address + * chip id is read in the register 0x00 bit from 0 to 7 + * + * @param smi130 : structure pointer + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * @note + * While changing the parameter of the smi130_t + * consider the following point: + * Changing the reference value of the parameter + * will changes the local copy or local reference + * make sure your changes will not + * affect the reference value of the parameter + * (Better case don't change the reference value of the parameter) + * +*/ +SMI130_RETURN_FUNCTION_TYPE smi130_init(struct smi130_t *smi130) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; u8 v_data_u8 = SMI130_INIT_VALUE; u8 v_pmu_data_u8 = SMI130_INIT_VALUE; - /* assign smi130 ptr*/ + /* assign smi130 ptr */ p_smi130 = smi130; com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_CHIP_ID__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); - /* read Chip Id*/ + /* read Chip Id */ p_smi130->chip_id = v_data_u8; /* To avoid gyro wakeup it is required to write 0x00 to 0x6C*/ com_rslt += smi130_write_reg(SMI130_USER_PMU_TRIGGER_ADDR, @@ -189,24 +186,24 @@ SMI130_RETURN_FUNCTION_TYPE smi130_init(struct smi130_t*smi130) return com_rslt; } /*! -* @brief -* This API write the data to -* the given register -* -* -* @param v_addr_u8 -> Address of the register -* @param v_data_u8 -> The data from the register -* @param v_len_u8 -> no of bytes to read -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief + * This API write the data to + * the given register + * + * + * @param v_addr_u8 -> Address of the register + * @param v_data_u8 -> The data from the register + * @param v_len_u8 -> no of bytes to read + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_write_reg(u8 v_addr_u8, -u8*v_data_u8, u8 v_len_u8) +u8 *v_data_u8, u8 v_len_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -222,24 +219,24 @@ u8*v_data_u8, u8 v_len_u8) return com_rslt; } /*! -* @brief -* This API reads the data from -* the given register -* -* -* @param v_addr_u8 -> Address of the register -* @param v_data_u8 -> The data from the register -* @param v_len_u8 -> no of bytes to read -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief + * This API reads the data from + * the given register + * + * + * @param v_addr_u8 -> Address of the register + * @param v_data_u8 -> The data from the register + * @param v_len_u8 -> no of bytes to read + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_read_reg(u8 v_addr_u8, -u8*v_data_u8, u8 v_len_u8) +u8 *v_data_u8, u8 v_len_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -255,20 +252,20 @@ u8*v_data_u8, u8 v_len_u8) return com_rslt; } /*! -* @brief This API used to reads the fatal error -* from the Register 0x02 bit 0 -* This flag will be reset only by power-on-reset and soft reset -* -* -* @param v_fatal_err_u8 : The status of fatal error -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API used to reads the fatal error + * from the Register 0x02 bit 0 + * This flag will be reset only by power-on-reset and soft reset + * + * + * @param v_fatal_err_u8 : The status of fatal error + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fatal_err(u8 *v_fatal_err_u8) @@ -291,28 +288,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_fatal_err(u8 return com_rslt; } /*! -* @brief This API used to read the error code -* from register 0x02 bit 1 to 4 -* -* -* @param v_err_code_u8 : The status of error codes -* error_code | description -* ------------|--------------- -* 0x00 |no error -* 0x01 |ACC_CONF error (accel ODR and bandwidth not compatible) -* 0x02 |GYR_CONF error (Gyroscope ODR and bandwidth not compatible) -* 0x03 |Under sampling mode and interrupt uses pre filtered data -* 0x04 |reserved -* 0x05 |Selected trigger-readout offset in -* - |MAG_IF greater than selected ODR -* 0x06 |FIFO configuration error for header less mode -* 0x07 |Under sampling mode and pre filtered data as FIFO source -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API used to read the error code + * from register 0x02 bit 1 to 4 + * + * + * @param v_err_code_u8 : The status of error codes + * error_code | description + * ------------|--------------- + * 0x00 |no error + * 0x01 |ACC_CONF error (accel ODR and bandwidth not compatible) + * 0x02 |GYR_CONF error (Gyroscope ODR and bandwidth not compatible) + * 0x03 |Under sampling mode and interrupt uses pre filtered data + * 0x04 |reserved + * 0x05 |Selected trigger-readout offset in + * - |MAG_IF greater than selected ODR + * 0x06 |FIFO configuration error for header less mode + * 0x07 |Under sampling mode and pre filtered data as FIFO source + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_err_code(u8 *v_err_code_u8) @@ -334,19 +331,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_err_code(u8 return com_rslt; } /*! -* @brief This API Reads the i2c error code from the -* Register 0x02 bit 5. -* This error occurred in I2C master detected -* -* @param v_i2c_err_code_u8 : The status of i2c fail error -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API Reads the i2c error code from the + * Register 0x02 bit 5. + * This error occurred in I2C master detected + * + * @param v_i2c_err_code_u8 : The status of i2c fail error + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_i2c_fail_err(u8 *v_i2c_err_code_u8) @@ -368,19 +365,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_i2c_fail_err(u8 return com_rslt; } /*! -* @brief This API Reads the dropped command error -* from the register 0x02 bit 6 -* -* -* @param v_drop_cmd_err_u8 : The status of drop command error -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API Reads the dropped command error + * from the register 0x02 bit 6 + * + * + * @param v_drop_cmd_err_u8 : The status of drop command error + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_drop_cmd_err(u8 *v_drop_cmd_err_u8) @@ -404,25 +401,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_drop_cmd_err(u8 return com_rslt; } /*! -* @brief This API reads the magnetometer data ready -* interrupt not active. -* It reads from the error register 0x0x2 bit 7 -* -* -* -* -* @param v_mag_data_rdy_err_u8 : The status of mag data ready interrupt -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the magnetometer data ready + * interrupt not active. + * It reads from the error register 0x0x2 bit 7 + * + * + * + * + * @param v_mag_data_rdy_err_u8 : The status of mag data ready interrupt + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_dada_rdy_err( -u8*v_mag_data_rdy_err_u8) +u8 *v_mag_data_rdy_err_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -443,26 +440,26 @@ u8*v_mag_data_rdy_err_u8) return com_rslt; } /*! -* @brief This API reads the error status -* from the error register 0x02 bit 0 to 7 -* -* @param v_mag_data_rdy_err_u8 : The status of mag data ready interrupt -* @param v_fatal_er_u8r : The status of fatal error -* @param v_err_code_u8 : The status of error code -* @param v_i2c_fail_err_u8 : The status of I2C fail error -* @param v_drop_cmd_err_u8 : The status of drop command error -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the error status + * from the error register 0x02 bit 0 to 7 + * + * @param v_mag_data_rdy_err_u8 : The status of mag data ready interrupt + * @param v_fatal_er_u8r : The status of fatal error + * @param v_err_code_u8 : The status of error code + * @param v_i2c_fail_err_u8 : The status of I2C fail error + * @param v_drop_cmd_err_u8 : The status of drop command error + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_error_status(u8*v_fatal_er_u8r, -u8*v_err_code_u8, u8*v_i2c_fail_err_u8, -u8*v_drop_cmd_err_u8, u8*v_mag_data_rdy_err_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_error_status(u8 *v_fatal_er_u8r, +u8 *v_err_code_u8, u8 *v_i2c_fail_err_u8, +u8 *v_drop_cmd_err_u8, u8 *v_mag_data_rdy_err_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -501,30 +498,30 @@ u8*v_drop_cmd_err_u8, u8*v_mag_data_rdy_err_u8) return com_rslt; } /*! -* @brief This API reads the magnetometer power mode from -* PMU status register 0x03 bit 0 and 1 -* -* @param v_mag_power_mode_stat_u8 : The value of mag power mode -* mag_powermode | value -* ------------------|---------- -* SUSPEND | 0x00 -* NORMAL | 0x01 -* LOW POWER | 0x02 -* -* -* @note The power mode of mag set by the 0x7E command register -* @note using the function "smi130_set_command_register()" -* value | mode -* ---------|---------------- -* 0x18 | MAG_MODE_SUSPEND -* 0x19 | MAG_MODE_NORMAL -* 0x1A | MAG_MODE_LOWPOWER -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the magnetometer power mode from + * PMU status register 0x03 bit 0 and 1 + * + * @param v_mag_power_mode_stat_u8 : The value of mag power mode + * mag_powermode | value + * ------------------|---------- + * SUSPEND | 0x00 + * NORMAL | 0x01 + * LOW POWER | 0x02 + * + * + * @note The power mode of mag set by the 0x7E command register + * @note using the function "smi130_set_command_register()" + * value | mode + * ---------|---------------- + * 0x18 | MAG_MODE_SUSPEND + * 0x19 | MAG_MODE_NORMAL + * 0x1A | MAG_MODE_LOWPOWER + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_power_mode_stat(u8 *v_mag_power_mode_stat_u8) @@ -547,29 +544,29 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_power_mode_stat(u8 return com_rslt; } /*! -* @brief This API reads the gyroscope power mode from -* PMU status register 0x03 bit 2 and 3 -* -* @param v_gyro_power_mode_stat_u8 : The value of gyro power mode -* gyro_powermode | value -* ------------------|---------- -* SUSPEND | 0x00 -* NORMAL | 0x01 -* FAST POWER UP | 0x03 -* -* @note The power mode of gyro set by the 0x7E command register -* @note using the function "smi130_set_command_register()" -* value | mode -* ---------|---------------- -* 0x14 | GYRO_MODE_SUSPEND -* 0x15 | GYRO_MODE_NORMAL -* 0x17 | GYRO_MODE_FASTSTARTUP -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the gyroscope power mode from + * PMU status register 0x03 bit 2 and 3 + * + * @param v_gyro_power_mode_stat_u8 : The value of gyro power mode + * gyro_powermode | value + * ------------------|---------- + * SUSPEND | 0x00 + * NORMAL | 0x01 + * FAST POWER UP | 0x03 + * + * @note The power mode of gyro set by the 0x7E command register + * @note using the function "smi130_set_command_register()" + * value | mode + * ---------|---------------- + * 0x14 | GYRO_MODE_SUSPEND + * 0x15 | GYRO_MODE_NORMAL + * 0x17 | GYRO_MODE_FASTSTARTUP + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_power_mode_stat(u8 *v_gyro_power_mode_stat_u8) @@ -592,30 +589,30 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_power_mode_stat(u8 return com_rslt; } /*! -* @brief This API reads the accelerometer power mode from -* PMU status register 0x03 bit 4 and 5 -* -* -* @param v_accel_power_mode_stat_u8 : The value of accel power mode -* accel_powermode | value -* ------------------|---------- -* SUSPEND | 0x00 -* NORMAL | 0x01 -* LOW POWER | 0x02 -* -* @note The power mode of accel set by the 0x7E command register -* @note using the function "smi130_set_command_register()" -* value | mode -* ---------|---------------- -* 0x11 | ACCEL_MODE_NORMAL -* 0x12 | ACCEL_LOWPOWER -* 0x10 | ACCEL_SUSPEND -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the accelerometer power mode from + * PMU status register 0x03 bit 4 and 5 + * + * + * @param v_accel_power_mode_stat_u8 : The value of accel power mode + * accel_powermode | value + * ------------------|---------- + * SUSPEND | 0x00 + * NORMAL | 0x01 + * LOW POWER | 0x02 + * + * @note The power mode of accel set by the 0x7E command register + * @note using the function "smi130_set_command_register()" + * value | mode + * ---------|---------------- + * 0x11 | ACCEL_MODE_NORMAL + * 0x12 | ACCEL_LOWPOWER + * 0x10 | ACCEL_SUSPEND + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_power_mode_stat(u8 *v_accel_power_mode_stat_u8) @@ -638,19 +635,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_power_mode_stat(u8 return com_rslt; } /*! -* @brief This API switch mag interface to normal mode -* and confirm whether the mode switching done successfully or not -* -* @return results of bus communication function and current MAG_PMU result -* @retval 0 -> Success -* @retval -1 -> Error + * @brief This API switch mag interface to normal mode + * and confirm whether the mode switching done successfully or not * + * @return results of bus communication function and current MAG_PMU result + * @retval 0 -> Success + * @retval -1 -> Error + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_interface_normal(void) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = SMI130_INIT_VALUE; - /* aim to check the result of switching mag normal*/ + /* aim to check the result of switching mag normal */ u8 v_try_times_u8 = SMI130_MAG_NOAMRL_SWITCH_TIMES; u8 v_mag_pum_status_u8 = SMI130_INIT_VALUE; @@ -672,28 +669,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_interface_normal(void) return com_rslt; } /*! -* @brief This API reads magnetometer data X values -* from the register 0x04 and 0x05 -* @brief The mag sensor data read form auxiliary mag -* -* @param v_mag_x_s16 : The value of mag x -* @param v_sensor_select_u8 : Mag selection value -* value | sensor -* ---------|---------------- -* 0 | BMM150 -* 1 | AKM09911 or AKM09912 -* -* @note For mag data output rate configuration use the following function -* @note smi130_set_mag_output_data_rate() -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* + * @brief This API reads magnetometer data X values + * from the register 0x04 and 0x05 + * @brief The mag sensor data read form auxiliary mag + * + * @param v_mag_x_s16 : The value of mag x + * @param v_sensor_select_u8 : Mag selection value + * value | sensor + * ---------|---------------- + * 0 | BMM150 + * 1 | AKM09911 or AKM09912 + * + * @note For mag data output rate configuration use the following function + * @note smi130_set_mag_output_data_rate() + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_x(s16*v_mag_x_s16, +SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_x(s16 *v_mag_x_s16, u8 v_sensor_select_u8) { /* variable used for return the status of communication result*/ @@ -741,27 +738,27 @@ u8 v_sensor_select_u8) return com_rslt; } /*! -* @brief This API reads magnetometer data Y values -* from the register 0x06 and 0x07 -* @brief The mag sensor data read form auxiliary mag -* -* @param v_mag_y_s16 : The value of mag y -* @param v_sensor_select_u8 : Mag selection value -* value | sensor -* ---------|---------------- -* 0 | BMM150 -* 1 | AKM09911 or AKM09912 -* -* @note For mag data output rate configuration use the following function -* @note smi130_set_mag_output_data_rate() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads magnetometer data Y values + * from the register 0x06 and 0x07 + * @brief The mag sensor data read form auxiliary mag + * + * @param v_mag_y_s16 : The value of mag y + * @param v_sensor_select_u8 : Mag selection value + * value | sensor + * ---------|---------------- + * 0 | BMM150 + * 1 | AKM09911 or AKM09912 + * + * @note For mag data output rate configuration use the following function + * @note smi130_set_mag_output_data_rate() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_y(s16*v_mag_y_s16, +SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_y(s16 *v_mag_y_s16, u8 v_sensor_select_u8) { SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_OUT_OF_RANGE; @@ -809,27 +806,27 @@ u8 v_sensor_select_u8) return com_rslt; } /*! -* @brief This API reads magnetometer data Z values -* from the register 0x08 and 0x09 -* @brief The mag sensor data read form auxiliary mag -* -* @param v_mag_z_s16 : The value of mag z -* @param v_sensor_select_u8 : Mag selection value -* value | sensor -* ---------|---------------- -* 0 | BMM150 -* 1 | AKM09911 or AKM09912 -* -* @note For mag data output rate configuration use the following function -* @note smi130_set_mag_output_data_rate() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads magnetometer data Z values + * from the register 0x08 and 0x09 + * @brief The mag sensor data read form auxiliary mag + * + * @param v_mag_z_s16 : The value of mag z + * @param v_sensor_select_u8 : Mag selection value + * value | sensor + * ---------|---------------- + * 0 | BMM150 + * 1 | AKM09911 or AKM09912 + * + * @note For mag data output rate configuration use the following function + * @note smi130_set_mag_output_data_rate() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_z(s16*v_mag_z_s16, +SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_z(s16 *v_mag_z_s16, u8 v_sensor_select_u8) { /* variable used for return the status of communication result*/ @@ -878,21 +875,21 @@ u8 v_sensor_select_u8) return com_rslt; } /*! -* @brief This API reads magnetometer data RHALL values -* from the register 0x0A and 0x0B -* -* -* @param v_mag_r_s16 : The value of BMM150 r data -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads magnetometer data RHALL values + * from the register 0x0A and 0x0B + * + * + * @param v_mag_r_s16 : The value of BMM150 r data + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_r(s16*v_mag_r_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_r(s16 *v_mag_r_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -921,28 +918,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_r(s16*v_mag_r_s16) return com_rslt; } /*! -* @brief This API reads magnetometer data X,Y,Z values -* from the register 0x04 to 0x09 -* -* @brief The mag sensor data read form auxiliary mag -* -* @param mag : The value of mag xyz data -* @param v_sensor_select_u8 : Mag selection value -* value | sensor -* ---------|---------------- -* 0 | BMM150 -* 1 | AKM09911 or AKM09912 -* -* @note For mag data output rate configuration use the following function -* @note smi130_set_mag_output_data_rate() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error* -* + * @brief This API reads magnetometer data X,Y,Z values + * from the register 0x04 to 0x09 + * + * @brief The mag sensor data read form auxiliary mag + * + * @param mag : The value of mag xyz data + * @param v_sensor_select_u8 : Mag selection value + * value | sensor + * ---------|---------------- + * 0 | BMM150 + * 1 | AKM09911 or AKM09912 + * + * @note For mag data output rate configuration use the following function + * @note smi130_set_mag_output_data_rate() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_xyz( -struct smi130_mag_t*mag, u8 v_sensor_select_u8) +struct smi130_mag_t *mag, u8 v_sensor_select_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -974,13 +971,13 @@ struct smi130_mag_t*mag, u8 v_sensor_select_u8) SMI130_GET_BITSLICE( v_data_u8[SMI130_DATA_FRAME_MAG_X_LSB_BYTE], SMI130_USER_DATA_MAG_X_LSB); - /* Data X*/ + /* Data X */ mag->x = (s16) ((((s32)((s8)v_data_u8[ SMI130_DATA_FRAME_MAG_X_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_05_BITS) | (v_data_u8[SMI130_DATA_FRAME_MAG_X_LSB_BYTE])); - /* Data Y*/ + /* Data Y */ /*Y-axis lsb value shifting*/ v_data_u8[SMI130_DATA_FRAME_MAG_Y_LSB_BYTE] = SMI130_GET_BITSLICE( @@ -992,7 +989,7 @@ struct smi130_mag_t*mag, u8 v_sensor_select_u8) << SMI130_SHIFT_BIT_POSITION_BY_05_BITS) | (v_data_u8[SMI130_DATA_FRAME_MAG_Y_LSB_BYTE])); - /* Data Z*/ + /* Data Z */ /*Z-axis lsb value shifting*/ v_data_u8[SMI130_DATA_FRAME_MAG_Z_LSB_BYTE] = SMI130_GET_BITSLICE( @@ -1009,18 +1006,18 @@ struct smi130_mag_t*mag, u8 v_sensor_select_u8) p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_DATA_0_MAG_X_LSB__REG, v_data_u8, SMI130_MAG_XYZ_DATA_LENGTH); - /* Data X*/ + /* Data X */ mag->x = (s16) ((((s32)((s8)v_data_u8[ SMI130_DATA_FRAME_MAG_X_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_DATA_FRAME_MAG_X_LSB_BYTE])); - /* Data Y*/ + /* Data Y */ mag->y = ((((s32)((s8)v_data_u8[ SMI130_DATA_FRAME_MAG_Y_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_DATA_FRAME_MAG_Y_LSB_BYTE])); - /* Data Z*/ + /* Data Z */ mag->z = (s16) ((((s32)((s8)v_data_u8[ SMI130_DATA_FRAME_MAG_Z_MSB_BYTE])) @@ -1035,24 +1032,24 @@ struct smi130_mag_t*mag, u8 v_sensor_select_u8) return com_rslt; } /*!* -* @brief This API reads magnetometer data X,Y,Z,r -* values from the register 0x04 to 0x0B -* -* @brief The mag sensor data read form auxiliary mag -* -* @param mag : The value of mag-BMM150 xyzr data -* -* @note For mag data output rate configuration use the following function -* @note smi130_set_mag_output_data_rate() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads magnetometer data X,Y,Z,r + * values from the register 0x04 to 0x0B + * + * @brief The mag sensor data read form auxiliary mag + * + * @param mag : The value of mag-BMM150 xyzr data + * + * @note For mag data output rate configuration use the following function + * @note smi130_set_mag_output_data_rate() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_read_mag_xyzr( -struct smi130_mag_xyzr_t*mag) +struct smi130_mag_xyzr_t *mag) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1069,7 +1066,7 @@ struct smi130_mag_xyzr_t*mag) SMI130_USER_DATA_MAG_X_LSB__REG, v_data_u8, SMI130_MAG_XYZR_DATA_LENGTH); - /* Data X*/ + /* Data X */ /*X-axis lsb value shifting*/ v_data_u8[SMI130_DATA_FRAME_MAG_X_LSB_BYTE] = SMI130_GET_BITSLICE( @@ -1080,7 +1077,7 @@ struct smi130_mag_xyzr_t*mag) SMI130_DATA_FRAME_MAG_X_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_05_BITS) | (v_data_u8[SMI130_DATA_FRAME_MAG_X_LSB_BYTE])); - /* Data Y*/ + /* Data Y */ /*Y-axis lsb value shifting*/ v_data_u8[SMI130_DATA_FRAME_MAG_Y_LSB_BYTE] = SMI130_GET_BITSLICE( @@ -1093,7 +1090,7 @@ struct smi130_mag_xyzr_t*mag) | (v_data_u8[ SMI130_DATA_FRAME_MAG_Y_LSB_BYTE])); - /* Data Z*/ + /* Data Z */ /*Z-axis lsb value shifting*/ v_data_u8[SMI130_DATA_FRAME_MAG_Z_LSB_BYTE] = SMI130_GET_BITSLICE( @@ -1105,7 +1102,7 @@ struct smi130_mag_xyzr_t*mag) << SMI130_SHIFT_BIT_POSITION_BY_07_BITS) | (v_data_u8[SMI130_DATA_FRAME_MAG_Z_LSB_BYTE])); - /* RHall*/ + /* RHall */ /*R-axis lsb value shifting*/ v_data_u8[SMI130_DATA_FRAME_MAG_R_LSB_BYTE] = SMI130_GET_BITSLICE( @@ -1120,25 +1117,25 @@ struct smi130_mag_xyzr_t*mag) return com_rslt; } /*! -* @brief This API reads gyro data X values -* form the register 0x0C and 0x0D -* -* -* -* -* @param v_gyro_x_s16 : The value of gyro x data -* -* @note Gyro Configuration use the following function -* @note smi130_set_gyro_output_data_rate() -* @note smi130_set_gyro_bw() -* @note smi130_set_gyro_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* + * @brief This API reads gyro data X values + * form the register 0x0C and 0x0D + * + * + * + * + * @param v_gyro_x_s16 : The value of gyro x data + * + * @note Gyro Configuration use the following function + * @note smi130_set_gyro_output_data_rate() + * @note smi130_set_gyro_bw() + * @note smi130_set_gyro_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_x(s16*v_gyro_x_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_x(s16 *v_gyro_x_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1164,26 +1161,26 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_x(s16*v_gyro_x_s16) return com_rslt; } /*! -* @brief This API reads gyro data Y values -* form the register 0x0E and 0x0F -* -* -* -* -* @param v_gyro_y_s16 : The value of gyro y data -* -* @note Gyro Configuration use the following function -* @note smi130_set_gyro_output_data_rate() -* @note smi130_set_gyro_bw() -* @note smi130_set_gyro_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error result of communication routines -* -* + * @brief This API reads gyro data Y values + * form the register 0x0E and 0x0F + * + * + * + * + * @param v_gyro_y_s16 : The value of gyro y data + * + * @note Gyro Configuration use the following function + * @note smi130_set_gyro_output_data_rate() + * @note smi130_set_gyro_bw() + * @note smi130_set_gyro_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error result of communication routines + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_y(s16*v_gyro_y_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_y(s16 *v_gyro_y_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1210,26 +1207,26 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_y(s16*v_gyro_y_s16) return com_rslt; } /*! -* @brief This API reads gyro data Z values -* form the register 0x10 and 0x11 -* -* -* -* -* @param v_gyro_z_s16 : The value of gyro z data -* -* @note Gyro Configuration use the following function -* @note smi130_set_gyro_output_data_rate() -* @note smi130_set_gyro_bw() -* @note smi130_set_gyro_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads gyro data Z values + * form the register 0x10 and 0x11 + * + * + * + * + * @param v_gyro_z_s16 : The value of gyro z data + * + * @note Gyro Configuration use the following function + * @note smi130_set_gyro_output_data_rate() + * @note smi130_set_gyro_bw() + * @note smi130_set_gyro_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_z(s16*v_gyro_z_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_z(s16 *v_gyro_z_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1242,7 +1239,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_z(s16*v_gyro_z_s16) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read gyro z data*/ + /* read gyro z data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_DATA_12_GYRO_Z_LSB__REG, @@ -1256,26 +1253,26 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_z(s16*v_gyro_z_s16) return com_rslt; } /*! -* @brief This API reads gyro data X,Y,Z values -* from the register 0x0C to 0x11 -* -* -* -* -* @param gyro : The value of gyro xyz -* -* @note Gyro Configuration use the following function -* @note smi130_set_gyro_output_data_rate() -* @note smi130_set_gyro_bw() -* @note smi130_set_gyro_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads gyro data X,Y,Z values + * from the register 0x0C to 0x11 + * + * + * + * + * @param gyro : The value of gyro xyz + * + * @note Gyro Configuration use the following function + * @note smi130_set_gyro_output_data_rate() + * @note smi130_set_gyro_bw() + * @note smi130_set_gyro_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_xyz(struct smi130_gyro_t*gyro) +SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_xyz(struct smi130_gyro_t *gyro) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1301,20 +1298,20 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_xyz(struct smi130_gyro_t*gyro) SMI130_USER_DATA_8_GYRO_X_LSB__REG, v_data_u8, SMI130_GYRO_XYZ_DATA_LENGTH); - /* Data X*/ + /* Data X */ gyro->x = (s16) ((((s32)((s8)v_data_u8[ SMI130_DATA_FRAME_GYRO_X_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_DATA_FRAME_GYRO_X_LSB_BYTE])); - /* Data Y*/ + /* Data Y */ gyro->y = (s16) ((((s32)((s8)v_data_u8[ SMI130_DATA_FRAME_GYRO_Y_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_DATA_FRAME_GYRO_Y_LSB_BYTE])); - /* Data Z*/ + /* Data Z */ gyro->z = (s16) ((((s32)((s8)v_data_u8[ SMI130_DATA_FRAME_GYRO_Z_MSB_BYTE])) @@ -1324,27 +1321,27 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_gyro_xyz(struct smi130_gyro_t*gyro) return com_rslt; } /*! -* @brief This API reads accelerometer data X values -* form the register 0x12 and 0x13 -* -* -* -* -* @param v_accel_x_s16 : The value of accel x -* -* @note For accel configuration use the following functions -* @note smi130_set_accel_output_data_rate() -* @note smi130_set_accel_bw() -* @note smi130_set_accel_under_sampling_parameter() -* @note smi130_set_accel_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads accelerometer data X values + * form the register 0x12 and 0x13 + * + * + * + * + * @param v_accel_x_s16 : The value of accel x + * + * @note For accel configuration use the following functions + * @note smi130_set_accel_output_data_rate() + * @note smi130_set_accel_bw() + * @note smi130_set_accel_under_sampling_parameter() + * @note smi130_set_accel_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_x(s16*v_accel_x_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_x(s16 *v_accel_x_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1370,27 +1367,27 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_x(s16*v_accel_x_s16) return com_rslt; } /*! -* @brief This API reads accelerometer data Y values -* form the register 0x14 and 0x15 -* -* -* -* -* @param v_accel_y_s16 : The value of accel y -* -* @note For accel configuration use the following functions -* @note smi130_set_accel_output_data_rate() -* @note smi130_set_accel_bw() -* @note smi130_set_accel_under_sampling_parameter() -* @note smi130_set_accel_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads accelerometer data Y values + * form the register 0x14 and 0x15 + * + * + * + * + * @param v_accel_y_s16 : The value of accel y + * + * @note For accel configuration use the following functions + * @note smi130_set_accel_output_data_rate() + * @note smi130_set_accel_bw() + * @note smi130_set_accel_under_sampling_parameter() + * @note smi130_set_accel_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_y(s16*v_accel_y_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_y(s16 *v_accel_y_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1416,27 +1413,27 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_y(s16*v_accel_y_s16) return com_rslt; } /*! -* @brief This API reads accelerometer data Z values -* form the register 0x16 and 0x17 -* -* -* -* -* @param v_accel_z_s16 : The value of accel z -* -* @note For accel configuration use the following functions -* @note smi130_set_accel_output_data_rate() -* @note smi130_set_accel_bw() -* @note smi130_set_accel_under_sampling_parameter() -* @note smi130_set_accel_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads accelerometer data Z values + * form the register 0x16 and 0x17 + * + * + * + * + * @param v_accel_z_s16 : The value of accel z + * + * @note For accel configuration use the following functions + * @note smi130_set_accel_output_data_rate() + * @note smi130_set_accel_bw() + * @note smi130_set_accel_under_sampling_parameter() + * @note smi130_set_accel_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_z(s16*v_accel_z_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_z(s16 *v_accel_z_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1462,28 +1459,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_z(s16*v_accel_z_s16) return com_rslt; } /*! -* @brief This API reads accelerometer data X,Y,Z values -* from the register 0x12 to 0x17 -* -* -* -* -* @param accel :The value of accel xyz -* -* @note For accel configuration use the following functions -* @note smi130_set_accel_output_data_rate() -* @note smi130_set_accel_bw() -* @note smi130_set_accel_under_sampling_parameter() -* @note smi130_set_accel_range() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads accelerometer data X,Y,Z values + * from the register 0x12 to 0x17 + * + * + * + * + * @param accel :The value of accel xyz + * + * @note For accel configuration use the following functions + * @note smi130_set_accel_output_data_rate() + * @note smi130_set_accel_bw() + * @note smi130_set_accel_under_sampling_parameter() + * @note smi130_set_accel_range() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_read_accel_xyz( -struct smi130_accel_t*accel) +struct smi130_accel_t *accel) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1508,20 +1505,20 @@ struct smi130_accel_t*accel) SMI130_USER_DATA_14_ACCEL_X_LSB__REG, a_data_u8r, SMI130_ACCEL_XYZ_DATA_LENGTH); - /* Data X*/ + /* Data X */ accel->x = (s16) ((((s32)((s8)a_data_u8r[ SMI130_DATA_FRAME_ACCEL_X_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (a_data_u8r[SMI130_DATA_FRAME_ACCEL_X_LSB_BYTE])); - /* Data Y*/ + /* Data Y */ accel->y = (s16) ((((s32)((s8)a_data_u8r[ SMI130_DATA_FRAME_ACCEL_Y_MSB_BYTE])) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (a_data_u8r[SMI130_DATA_FRAME_ACCEL_Y_LSB_BYTE])); - /* Data Z*/ + /* Data Z */ accel->z = (s16) ((((s32)((s8)a_data_u8r[ SMI130_DATA_FRAME_ACCEL_Z_MSB_BYTE])) @@ -1531,21 +1528,21 @@ struct smi130_accel_t*accel) return com_rslt; } /*! -* @brief This API reads sensor_time from the register -* 0x18 to 0x1A -* -* -* @param v_sensor_time_u32 : The value of sensor time -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads sensor_time from the register + * 0x18 to 0x1A + * + * + * @param v_sensor_time_u32 : The value of sensor time + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_sensor_time(u32*v_sensor_time_u32) +SMI130_RETURN_FUNCTION_TYPE smi130_get_sensor_time(u32 *v_sensor_time_u32) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -1575,22 +1572,22 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_sensor_time(u32*v_sensor_time_u32) return com_rslt; } /*! -* @brief This API reads the Gyroscope self test -* status from the register 0x1B bit 1 -* -* -* @param v_gyro_selftest_u8 : The value of gyro self test status -* value | status -* ---------|---------------- -* 0 | Gyroscope self test is running or failed -* 1 | Gyroscope self test completed successfully -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the Gyroscope self test + * status from the register 0x1B bit 1 + * + * + * @param v_gyro_selftest_u8 : The value of gyro self test status + * value | status + * ---------|---------------- + * 0 | Gyroscope self test is running or failed + * 1 | Gyroscope self test completed successfully + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_selftest(u8 *v_gyro_selftest_u8) @@ -1612,24 +1609,24 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_selftest(u8 return com_rslt; } /*! -* @brief This API reads the status of -* mag manual interface operation form the register 0x1B bit 2 -* -* -* -* @param v_mag_manual_stat_u8 : The value of mag manual operation status -* value | status -* ---------|---------------- -* 0 | Indicates no manual magnetometer -* - | interface operation is ongoing -* 1 | Indicates manual magnetometer -* - | interface operation is ongoing -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of + * mag manual interface operation form the register 0x1B bit 2 + * + * + * + * @param v_mag_manual_stat_u8 : The value of mag manual operation status + * value | status + * ---------|---------------- + * 0 | Indicates no manual magnetometer + * - | interface operation is ongoing + * 1 | Indicates manual magnetometer + * - | interface operation is ongoing + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_manual_operation_stat(u8 *v_mag_manual_stat_u8) @@ -1652,19 +1649,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_manual_operation_stat(u8 return com_rslt; } /*! -* @brief This API reads the fast offset compensation -* status form the register 0x1B bit 3 -* -* -* @param v_foc_rdy_u8 : The status of fast compensation -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the fast offset compensation + * status form the register 0x1B bit 3 + * + * + * @param v_foc_rdy_u8 : The status of fast compensation + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_rdy(u8 *v_foc_rdy_u8) @@ -1687,22 +1684,22 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_rdy(u8 return com_rslt; } /*! -* @brief This API Reads the nvm_rdy status from the -* resister 0x1B bit 4 -* -* -* @param v_nvm_rdy_u8 : The value of NVM ready status -* value | status -* ---------|---------------- -* 0 | NVM write operation in progress -* 1 | NVM is ready to accept a new write trigger -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API Reads the nvm_rdy status from the + * resister 0x1B bit 4 + * + * + * @param v_nvm_rdy_u8 : The value of NVM ready status + * value | status + * ---------|---------------- + * 0 | NVM write operation in progress + * 1 | NVM is ready to accept a new write trigger + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_nvm_rdy(u8 *v_nvm_rdy_u8) @@ -1725,19 +1722,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_nvm_rdy(u8 return com_rslt; } /*! -* @brief This API reads the status of mag data ready -* from the register 0x1B bit 5 -* The status get reset when one mag data register is read out -* -* @param v_data_rdy_u8 : The value of mag data ready status -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of mag data ready + * from the register 0x1B bit 5 + * The status get reset when one mag data register is read out + * + * @param v_data_rdy_u8 : The value of mag data ready status + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_data_rdy_mag(u8 *v_data_rdy_u8) @@ -1759,20 +1756,20 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_data_rdy_mag(u8 return com_rslt; } /*! -* @brief This API reads the status of gyro data ready form the -* register 0x1B bit 6 -* The status get reset when gyro data register read out -* -* -* @param v_data_rdy_u8 : The value of gyro data ready -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of gyro data ready form the + * register 0x1B bit 6 + * The status get reset when gyro data register read out + * + * + * @param v_data_rdy_u8 : The value of gyro data ready + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_data_rdy(u8 *v_data_rdy_u8) @@ -1794,20 +1791,20 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_data_rdy(u8 return com_rslt; } /*! -* @brief This API reads the status of accel data ready form the -* register 0x1B bit 7 -* The status get reset when accel data register read out -* -* -* @param v_data_rdy_u8 : The value of accel data ready status -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of accel data ready form the + * register 0x1B bit 7 + * The status get reset when accel data register read out + * + * + * @param v_data_rdy_u8 : The value of accel data ready status + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_data_rdy(u8 *v_data_rdy_u8) @@ -1830,28 +1827,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_data_rdy(u8 return com_rslt; } /*! -* @brief This API reads the step detector interrupt status -* from the register 0x1C bit 0 -* flag is associated with a specific interrupt function. -* It is set when the single tab interrupt triggers. The -* setting of INT_LATCH controls if the interrupt -* signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_step_intr_u8 : The status of step detector interrupt -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the step detector interrupt status + * from the register 0x1C bit 0 + * flag is associated with a specific interrupt function. + * It is set when the single tab interrupt triggers. The + * setting of INT_LATCH controls if the interrupt + * signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_step_intr_u8 : The status of step detector interrupt + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_step_intr(u8 *v_step_intr_u8) @@ -1873,31 +1870,31 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_step_intr(u8 return com_rslt; } /*! -* @brief This API reads the -* significant motion interrupt status -* from the register 0x1C bit 1 -* flag is associated with a specific interrupt function. -* It is set when the single tab interrupt triggers. The -* setting of INT_LATCH controls if the interrupt -* signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* -* @param v_significant_intr_u8 : The status of step -* motion interrupt -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the + * significant motion interrupt status + * from the register 0x1C bit 1 + * flag is associated with a specific interrupt function. + * It is set when the single tab interrupt triggers. The + * setting of INT_LATCH controls if the interrupt + * signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * + * @param v_significant_intr_u8 : The status of step + * motion interrupt + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_significant_intr(u8 *v_significant_intr_u8) @@ -1919,27 +1916,27 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_significant_intr(u8 return com_rslt; } /*! -* @brief This API reads the any motion interrupt status -* from the register 0x1C bit 2 -* flag is associated with a specific interrupt function. -* It is set when the single tab interrupt triggers. The -* setting of INT_LATCH controls if the interrupt -* signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* @param v_any_motion_intr_u8 : The status of any-motion interrupt -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the any motion interrupt status + * from the register 0x1C bit 2 + * flag is associated with a specific interrupt function. + * It is set when the single tab interrupt triggers. The + * setting of INT_LATCH controls if the interrupt + * signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * @param v_any_motion_intr_u8 : The status of any-motion interrupt + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_any_motion_intr(u8 *v_any_motion_intr_u8) @@ -1961,29 +1958,29 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_any_motion_intr(u8 return com_rslt; } /*! -* @brief This API reads the power mode trigger interrupt status -* from the register 0x1C bit 3 -* flag is associated with a specific interrupt function. -* It is set when the single tab interrupt triggers. The -* setting of INT_LATCH controls if the interrupt -* signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* -* @param v_pmu_trigger_intr_u8 : The status of power mode trigger interrupt -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the power mode trigger interrupt status + * from the register 0x1C bit 3 + * flag is associated with a specific interrupt function. + * It is set when the single tab interrupt triggers. The + * setting of INT_LATCH controls if the interrupt + * signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * + * @param v_pmu_trigger_intr_u8 : The status of power mode trigger interrupt + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_pmu_trigger_intr(u8 *v_pmu_trigger_intr_u8) @@ -2005,44 +2002,44 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_pmu_trigger_intr(u8 return com_rslt; } /*! -* @brief This API reads the double tab status -* from the register 0x1C bit 4 -* flag is associated with a specific interrupt function. -* It is set when the single tab interrupt triggers. The -* setting of INT_LATCH controls if the interrupt -* signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_double_tap_intr_u8 :The status of double tab interrupt -* -* @note Double tap interrupt can be configured by the following functions -* @note INTERRUPT MAPPING -* @note smi130_set_intr_double_tap() -* @note AXIS MAPPING -* @note smi130_get_stat2_tap_first_x() -* @note smi130_get_stat2_tap_first_y() -* @note smi130_get_stat2_tap_first_z() -* @note DURATION -* @note smi130_set_intr_tap_durn() -* @note THRESHOLD -* @note smi130_set_intr_tap_thres() -* @note TAP QUIET -* @note smi130_set_intr_tap_quiet() -* @note TAP SHOCK -* @note smi130_set_intr_tap_shock() -* @note TAP SOURCE -* @note smi130_set_intr_tap_source() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the double tab status + * from the register 0x1C bit 4 + * flag is associated with a specific interrupt function. + * It is set when the single tab interrupt triggers. The + * setting of INT_LATCH controls if the interrupt + * signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_double_tap_intr_u8 :The status of double tab interrupt + * + * @note Double tap interrupt can be configured by the following functions + * @note INTERRUPT MAPPING + * @note smi130_set_intr_double_tap() + * @note AXIS MAPPING + * @note smi130_get_stat2_tap_first_x() + * @note smi130_get_stat2_tap_first_y() + * @note smi130_get_stat2_tap_first_z() + * @note DURATION + * @note smi130_set_intr_tap_durn() + * @note THRESHOLD + * @note smi130_set_intr_tap_thres() + * @note TAP QUIET + * @note smi130_set_intr_tap_quiet() + * @note TAP SHOCK + * @note smi130_set_intr_tap_shock() + * @note TAP SOURCE + * @note smi130_set_intr_tap_source() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_double_tap_intr(u8 *v_double_tap_intr_u8) @@ -2064,44 +2061,44 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_double_tap_intr(u8 return com_rslt; } /*! -* @brief This API reads the single tab status -* from the register 0x1C bit 5 -* flag is associated with a specific interrupt function. -* It is set when the single tab interrupt triggers. The -* setting of INT_LATCH controls if the interrupt -* signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_single_tap_intr_u8 :The status of single tap interrupt -* -* @note Single tap interrupt can be configured by the following functions -* @note INTERRUPT MAPPING -* @note smi130_set_intr_single_tap() -* @note AXIS MAPPING -* @note smi130_get_stat2_tap_first_x() -* @note smi130_get_stat2_tap_first_y() -* @note smi130_get_stat2_tap_first_z() -* @note DURATION -* @note smi130_set_intr_tap_durn() -* @note THRESHOLD -* @note smi130_set_intr_tap_thres() -* @note TAP QUIET -* @note smi130_set_intr_tap_quiet() -* @note TAP SHOCK -* @note smi130_set_intr_tap_shock() -* @note TAP SOURCE -* @note smi130_set_intr_tap_source() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the single tab status + * from the register 0x1C bit 5 + * flag is associated with a specific interrupt function. + * It is set when the single tab interrupt triggers. The + * setting of INT_LATCH controls if the interrupt + * signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_single_tap_intr_u8 :The status of single tap interrupt + * + * @note Single tap interrupt can be configured by the following functions + * @note INTERRUPT MAPPING + * @note smi130_set_intr_single_tap() + * @note AXIS MAPPING + * @note smi130_get_stat2_tap_first_x() + * @note smi130_get_stat2_tap_first_y() + * @note smi130_get_stat2_tap_first_z() + * @note DURATION + * @note smi130_set_intr_tap_durn() + * @note THRESHOLD + * @note smi130_set_intr_tap_thres() + * @note TAP QUIET + * @note smi130_set_intr_tap_quiet() + * @note TAP SHOCK + * @note smi130_set_intr_tap_shock() + * @note TAP SOURCE + * @note smi130_set_intr_tap_source() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 *v_single_tap_intr_u8) @@ -2124,46 +2121,46 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 return com_rslt; } /*! -* @brief This API reads the orient status -* from the register 0x1C bit 6 -* flag is associated with a specific interrupt function. -* It is set when the orient interrupt triggers. The -* setting of INT_LATCH controls if the -* interrupt signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_orient_intr_u8 : The status of orient interrupt -* -* @note For orient interrupt configuration use the following functions -* @note STATUS -* @note smi130_get_stat0_orient_intr() -* @note AXIS MAPPING -* @note smi130_get_stat3_orient_xy() -* @note smi130_get_stat3_orient_z() -* @note smi130_set_intr_orient_axes_enable() -* @note INTERRUPT MAPPING -* @note smi130_set_intr_orient() -* @note INTERRUPT OUTPUT -* @note smi130_set_intr_orient_ud_enable() -* @note THETA -* @note smi130_set_intr_orient_theta() -* @note HYSTERESIS -* @note smi130_set_intr_orient_hyst() -* @note BLOCKING -* @note smi130_set_intr_orient_blocking() -* @note MODE -* @note smi130_set_intr_orient_mode() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the orient status + * from the register 0x1C bit 6 + * flag is associated with a specific interrupt function. + * It is set when the orient interrupt triggers. The + * setting of INT_LATCH controls if the + * interrupt signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_orient_intr_u8 : The status of orient interrupt + * + * @note For orient interrupt configuration use the following functions + * @note STATUS + * @note smi130_get_stat0_orient_intr() + * @note AXIS MAPPING + * @note smi130_get_stat3_orient_xy() + * @note smi130_get_stat3_orient_z() + * @note smi130_set_intr_orient_axes_enable() + * @note INTERRUPT MAPPING + * @note smi130_set_intr_orient() + * @note INTERRUPT OUTPUT + * @note smi130_set_intr_orient_ud_enable() + * @note THETA + * @note smi130_set_intr_orient_theta() + * @note HYSTERESIS + * @note smi130_set_intr_orient_hyst() + * @note BLOCKING + * @note smi130_set_intr_orient_blocking() + * @note MODE + * @note smi130_set_intr_orient_mode() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_orient_intr(u8 *v_orient_intr_u8) @@ -2186,39 +2183,39 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_orient_intr(u8 return com_rslt; } /*! -* @brief This API reads the flat interrupt status -* from the register 0x1C bit 7 -* flag is associated with a specific interrupt function. -* It is set when the flat interrupt triggers. The -* setting of INT_LATCH controls if the -* interrupt signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_flat_intr_u8 : The status of flat interrupt -* -* @note For flat configuration use the following functions -* @note STATS -* @note smi130_get_stat0_flat_intr() -* @note smi130_get_stat3_flat() -* @note INTERRUPT MAPPING -* @note smi130_set_intr_flat() -* @note THETA -* @note smi130_set_intr_flat_theta() -* @note HOLD TIME -* @note smi130_set_intr_flat_hold() -* @note HYSTERESIS -* @note smi130_set_intr_flat_hyst() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the flat interrupt status + * from the register 0x1C bit 7 + * flag is associated with a specific interrupt function. + * It is set when the flat interrupt triggers. The + * setting of INT_LATCH controls if the + * interrupt signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_flat_intr_u8 : The status of flat interrupt + * + * @note For flat configuration use the following functions + * @note STATS + * @note smi130_get_stat0_flat_intr() + * @note smi130_get_stat3_flat() + * @note INTERRUPT MAPPING + * @note smi130_set_intr_flat() + * @note THETA + * @note smi130_set_intr_flat_theta() + * @note HOLD TIME + * @note smi130_set_intr_flat_hold() + * @note HYSTERESIS + * @note smi130_set_intr_flat_hyst() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_flat_intr(u8 *v_flat_intr_u8) @@ -2241,44 +2238,44 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_flat_intr(u8 return com_rslt; } /*! -* @brief This API reads the high_g interrupt status -* from the register 0x1D bit 2 -* flag is associated with a specific interrupt function. -* It is set when the high g interrupt triggers. The -* setting of INT_LATCH controls if the interrupt signal and hence the -* respective interrupt flag will be permanently -* latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_high_g_intr_u8 : The status of high_g interrupt -* -* @note High_g interrupt configured by following functions -* @note STATUS -* @note smi130_get_stat1_high_g_intr() -* @note AXIS MAPPING -* @note smi130_get_stat3_high_g_first_x() -* @note smi130_get_stat3_high_g_first_y() -* @note smi130_get_stat3_high_g_first_z() -* @note SIGN MAPPING -* @note smi130_get_stat3_high_g_first_sign() -* @note INTERRUPT MAPPING -* @note smi130_set_intr_high_g() - * @note HYSTERESIS -* @note smi130_set_intr_high_g_hyst() -* @note DURATION -* @note smi130_set_intr_high_g_durn() -* @note THRESHOLD -* @note smi130_set_intr_high_g_thres() -* @note SOURCE -* @note smi130_set_intr_low_high_source() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* + * @brief This API reads the high_g interrupt status + * from the register 0x1D bit 2 + * flag is associated with a specific interrupt function. + * It is set when the high g interrupt triggers. The + * setting of INT_LATCH controls if the interrupt signal and hence the + * respective interrupt flag will be permanently + * latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_high_g_intr_u8 : The status of high_g interrupt + * + * @note High_g interrupt configured by following functions + * @note STATUS + * @note smi130_get_stat1_high_g_intr() + * @note AXIS MAPPING + * @note smi130_get_stat3_high_g_first_x() + * @note smi130_get_stat3_high_g_first_y() + * @note smi130_get_stat3_high_g_first_z() + * @note SIGN MAPPING + * @note smi130_get_stat3_high_g_first_sign() + * @note INTERRUPT MAPPING + * @note smi130_set_intr_high_g() + * @note HYSTERESIS + * @note smi130_set_intr_high_g_hyst() + * @note DURATION + * @note smi130_set_intr_high_g_durn() + * @note THRESHOLD + * @note smi130_set_intr_high_g_thres() + * @note SOURCE + * @note smi130_set_intr_low_high_source() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_high_g_intr(u8 *v_high_g_intr_u8) @@ -2301,41 +2298,41 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_high_g_intr(u8 return com_rslt; } /*! -* @brief This API reads the low g interrupt status -* from the register 0x1D bit 3 -* flag is associated with a specific interrupt function. -* It is set when the low g interrupt triggers. The -* setting of INT_LATCH controls if the interrupt signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_low_g_intr_u8 : The status of low_g interrupt -* -* @note Low_g interrupt configured by following functions -* @note STATUS -* @note smi130_get_stat1_low_g_intr() -* @note INTERRUPT MAPPING -* @note smi130_set_intr_low_g() -* @note SOURCE -* @note smi130_set_intr_low_high_source() -* @note DURATION -* @note smi130_set_intr_low_g_durn() -* @note THRESHOLD -* @note smi130_set_intr_low_g_thres() -* @note HYSTERESIS -* @note smi130_set_intr_low_g_hyst() -* @note MODE -* @note smi130_set_intr_low_g_mode() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the low g interrupt status + * from the register 0x1D bit 3 + * flag is associated with a specific interrupt function. + * It is set when the low g interrupt triggers. The + * setting of INT_LATCH controls if the interrupt signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_low_g_intr_u8 : The status of low_g interrupt + * + * @note Low_g interrupt configured by following functions + * @note STATUS + * @note smi130_get_stat1_low_g_intr() + * @note INTERRUPT MAPPING + * @note smi130_set_intr_low_g() + * @note SOURCE + * @note smi130_set_intr_low_high_source() + * @note DURATION + * @note smi130_set_intr_low_g_durn() + * @note THRESHOLD + * @note smi130_set_intr_low_g_thres() + * @note HYSTERESIS + * @note smi130_set_intr_low_g_hyst() + * @note MODE + * @note smi130_set_intr_low_g_mode() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_low_g_intr(u8 *v_low_g_intr_u8) @@ -2358,31 +2355,31 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_low_g_intr(u8 return com_rslt; } /*! -* @brief This API reads data ready interrupt status -* from the register 0x1D bit 4 -* flag is associated with a specific interrupt function. -* It is set when the data ready interrupt triggers. The -* setting of INT_LATCH controls if the interrupt signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_data_rdy_intr_u8 : The status of data ready interrupt -* -* @note Data ready interrupt configured by following functions -* @note STATUS -* @note smi130_get_stat1_data_rdy_intr() -* @note INTERRUPT MAPPING -* @note smi130_set_intr_data_rdy() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads data ready interrupt status + * from the register 0x1D bit 4 + * flag is associated with a specific interrupt function. + * It is set when the data ready interrupt triggers. The + * setting of INT_LATCH controls if the interrupt signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_data_rdy_intr_u8 : The status of data ready interrupt + * + * @note Data ready interrupt configured by following functions + * @note STATUS + * @note smi130_get_stat1_data_rdy_intr() + * @note INTERRUPT MAPPING + * @note smi130_set_intr_data_rdy() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_data_rdy_intr(u8 *v_data_rdy_intr_u8) @@ -2404,29 +2401,29 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_data_rdy_intr(u8 return com_rslt; } /*! -* @brief This API reads data ready FIFO full interrupt status -* from the register 0x1D bit 5 -* flag is associated with a specific interrupt function. -* It is set when the FIFO full interrupt triggers. The -* setting of INT_LATCH controls if the -* interrupt signal and hence the -* respective interrupt flag will -* be permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_fifo_full_intr_u8 : The status of fifo full interrupt -* -* @note FIFO full interrupt can be configured by following functions -* @note smi130_set_intr_fifo_full() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads data ready FIFO full interrupt status + * from the register 0x1D bit 5 + * flag is associated with a specific interrupt function. + * It is set when the FIFO full interrupt triggers. The + * setting of INT_LATCH controls if the + * interrupt signal and hence the + * respective interrupt flag will + * be permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_fifo_full_intr_u8 : The status of fifo full interrupt + * + * @note FIFO full interrupt can be configured by following functions + * @note smi130_set_intr_fifo_full() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_fifo_full_intr(u8 *v_fifo_full_intr_u8) @@ -2449,30 +2446,30 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_fifo_full_intr(u8 return com_rslt; } /*! -* @brief This API reads data -* ready FIFO watermark interrupt status -* from the register 0x1D bit 6 -* flag is associated with a specific interrupt function. -* It is set when the FIFO watermark interrupt triggers. The -* setting of INT_LATCH controls if the -* interrupt signal and hence the -* respective interrupt flag will be -* permanently latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_fifo_wm_intr_u8 : The status of fifo water mark interrupt -* -* @note FIFO full interrupt can be configured by following functions -* @note smi130_set_intr_fifo_wm() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads data + * ready FIFO watermark interrupt status + * from the register 0x1D bit 6 + * flag is associated with a specific interrupt function. + * It is set when the FIFO watermark interrupt triggers. The + * setting of INT_LATCH controls if the + * interrupt signal and hence the + * respective interrupt flag will be + * permanently latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_fifo_wm_intr_u8 : The status of fifo water mark interrupt + * + * @note FIFO full interrupt can be configured by following functions + * @note smi130_set_intr_fifo_wm() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_fifo_wm_intr(u8 *v_fifo_wm_intr_u8) @@ -2495,37 +2492,37 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_fifo_wm_intr(u8 return com_rslt; } /*! -* @brief This API reads data ready no motion interrupt status -* from the register 0x1D bit 7 -* flag is associated with a specific interrupt function. -* It is set when the no motion interrupt triggers. The -* setting of INT_LATCH controls if the interrupt signal and hence the -* respective interrupt flag will be permanently -* latched, temporarily latched -* or not latched. -* -* -* -* -* @param v_nomotion_intr_u8 : The status of no motion interrupt -* -* @note No motion interrupt can be configured by following function -* @note STATUS -* @note smi130_get_stat1_nomotion_intr() -* @note INTERRUPT MAPPING -* @note smi130_set_intr_nomotion() -* @note DURATION -* @note smi130_set_intr_slow_no_motion_durn() -* @note THRESHOLD -* @note smi130_set_intr_slow_no_motion_thres() -* @note SLOW/NO MOTION SELECT -* @note smi130_set_intr_slow_no_motion_select() -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads data ready no motion interrupt status + * from the register 0x1D bit 7 + * flag is associated with a specific interrupt function. + * It is set when the no motion interrupt triggers. The + * setting of INT_LATCH controls if the interrupt signal and hence the + * respective interrupt flag will be permanently + * latched, temporarily latched + * or not latched. + * + * + * + * + * @param v_nomotion_intr_u8 : The status of no motion interrupt + * + * @note No motion interrupt can be configured by following function + * @note STATUS + * @note smi130_get_stat1_nomotion_intr() + * @note INTERRUPT MAPPING + * @note smi130_set_intr_nomotion() + * @note DURATION + * @note smi130_set_intr_slow_no_motion_durn() + * @note THRESHOLD + * @note smi130_set_intr_slow_no_motion_thres() + * @note SLOW/NO MOTION SELECT + * @note smi130_set_intr_slow_no_motion_select() + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_nomotion_intr(u8 *v_nomotion_intr_u8) @@ -2549,21 +2546,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat1_nomotion_intr(u8 return com_rslt; } /*! -*@brief This API reads the status of any motion first x -* from the register 0x1E bit 0 -* -* -*@param v_anymotion_first_x_u8 : The status of any motion first x interrupt -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by x axis -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + *@brief This API reads the status of any motion first x + * from the register 0x1E bit 0 + * + * + *@param v_anymotion_first_x_u8 : The status of any motion first x interrupt + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by x axis + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_first_x(u8 *v_anymotion_first_x_u8) @@ -2587,24 +2584,24 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_first_x(u8 return com_rslt; } /*! -* @brief This API reads the status of any motion first y interrupt -* from the register 0x1E bit 1 -* -* -* -*@param v_any_motion_first_y_u8 : The status of any motion first y interrupt -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of any motion first y interrupt + * from the register 0x1E bit 1 + * + * + * + *@param v_any_motion_first_y_u8 : The status of any motion first y interrupt + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_first_y(u8 *v_any_motion_first_y_u8) @@ -2628,25 +2625,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_first_y(u8 return com_rslt; } /*! -* @brief This API reads the status of any motion first z interrupt -* from the register 0x1E bit 2 -* -* -* -* -*@param v_any_motion_first_z_u8 : The status of any motion first z interrupt -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of any motion first z interrupt + * from the register 0x1E bit 2 + * + * + * + * + *@param v_any_motion_first_z_u8 : The status of any motion first z interrupt + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_first_z(u8 *v_any_motion_first_z_u8) @@ -2670,24 +2667,24 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_first_z(u8 return com_rslt; } /*! -* @brief This API reads the any motion sign status from the -* register 0x1E bit 3 -* -* -* -* -* @param v_anymotion_sign_u8 : The status of any motion sign -* value | sign -* -----------|------------- -* 0 | positive -* 1 | negative -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the any motion sign status from the + * register 0x1E bit 3 + * + * + * + * + * @param v_anymotion_sign_u8 : The status of any motion sign + * value | sign + * -----------|------------- + * 0 | positive + * 1 | negative + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_sign(u8 *v_anymotion_sign_u8) @@ -2699,7 +2696,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_sign(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read any motion sign interrupt status*/ + /* read any motion sign interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_2_ANY_MOTION_SIGN__REG, @@ -2711,23 +2708,23 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_any_motion_sign(u8 return com_rslt; } /*! -* @brief This API reads the any motion tap first x status from the -* register 0x1E bit 4 -* -* -* -* -* @param v_tap_first_x_u8 :The status of any motion tap first x -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by x axis -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the any motion tap first x status from the + * register 0x1E bit 4 + * + * + * + * + * @param v_tap_first_x_u8 :The status of any motion tap first x + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by x axis + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_x(u8 *v_tap_first_x_u8) @@ -2739,7 +2736,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_x(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read tap first x interrupt status*/ + /* read tap first x interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_2_TAP_FIRST_X__REG, @@ -2751,25 +2748,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_x(u8 return com_rslt; } /*! -* @brief This API reads the tap first y interrupt status from the -* register 0x1E bit 5 -* -* -* -* -* @param v_tap_first_y_u8 :The status of tap first y interrupt -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the tap first y interrupt status from the + * register 0x1E bit 5 + * + * + * + * + * @param v_tap_first_y_u8 :The status of tap first y interrupt + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_y(u8 *v_tap_first_y_u8) @@ -2781,7 +2778,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_y(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read tap first y interrupt status*/ + /* read tap first y interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_2_TAP_FIRST_Y__REG, @@ -2793,25 +2790,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_y(u8 return com_rslt; } /*! -* @brief This API reads the tap first z interrupt status from the -* register 0x1E bit 6 -* -* -* -* -* @param v_tap_first_z_u8 :The status of tap first z interrupt -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by z axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the tap first z interrupt status from the + * register 0x1E bit 6 + * + * + * + * + * @param v_tap_first_z_u8 :The status of tap first z interrupt + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by z axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_z(u8 *v_tap_first_z_u8) @@ -2823,7 +2820,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_z(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read tap first z interrupt status*/ + /* read tap first z interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_2_TAP_FIRST_Z__REG, @@ -2835,24 +2832,24 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_first_z(u8 return com_rslt; } /*! -* @brief This API reads the tap sign status from the -* register 0x1E bit 7 -* -* -* -* -* @param v_tap_sign_u8 : The status of tap sign -* value | sign -* -----------|------------- -* 0 | positive -* 1 | negative -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the tap sign status from the + * register 0x1E bit 7 + * + * + * + * + * @param v_tap_sign_u8 : The status of tap sign + * value | sign + * -----------|------------- + * 0 | positive + * 1 | negative + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_sign(u8 *v_tap_sign_u8) @@ -2864,7 +2861,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_sign(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read tap_sign interrupt status*/ + /* read tap_sign interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_2_TAP_SIGN__REG, &v_data_u8, @@ -2876,25 +2873,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat2_tap_sign(u8 return com_rslt; } /*! -* @brief This API reads the high_g first x status from the -* register 0x1F bit 0 -* -* -* -* -* @param v_high_g_first_x_u8 :The status of high_g first x -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by x axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the high_g first x status from the + * register 0x1F bit 0 + * + * + * + * + * @param v_high_g_first_x_u8 :The status of high_g first x + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by x axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_x(u8 *v_high_g_first_x_u8) @@ -2906,7 +2903,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_x(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read highg_x interrupt status*/ + /* read highg_x interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_3_HIGH_G_FIRST_X__REG, @@ -2918,25 +2915,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_x(u8 return com_rslt; } /*! -* @brief This API reads the high_g first y status from the -* register 0x1F bit 1 -* -* -* -* -* @param v_high_g_first_y_u8 : The status of high_g first y -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the high_g first y status from the + * register 0x1F bit 1 + * + * + * + * + * @param v_high_g_first_y_u8 : The status of high_g first y + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_y(u8 *v_high_g_first_y_u8) @@ -2948,7 +2945,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_y(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read highg_y interrupt status*/ + /* read highg_y interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_3_HIGH_G_FIRST_Y__REG, @@ -2960,25 +2957,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_y(u8 return com_rslt; } /*! -* @brief This API reads the high_g first z status from the -* register 0x1F bit 3 -* -* -* -* -* @param v_high_g_first_z_u8 : The status of high_g first z -* value | status -* -----------|------------- -* 0 | not triggered -* 1 | triggered by z axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the high_g first z status from the + * register 0x1F bit 3 + * + * + * + * + * @param v_high_g_first_z_u8 : The status of high_g first z + * value | status + * -----------|------------- + * 0 | not triggered + * 1 | triggered by z axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_z(u8 *v_high_g_first_z_u8) @@ -2990,7 +2987,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_z(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read highg_z interrupt status*/ + /* read highg_z interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_3_HIGH_G_FIRST_Z__REG, @@ -3002,25 +2999,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_first_z(u8 return com_rslt; } /*! -* @brief This API reads the high sign status from the -* register 0x1F bit 3 -* -* -* -* -* @param v_high_g_sign_u8 :The status of high sign -* value | sign -* -----------|------------- -* 0 | positive -* 1 | negative -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the high sign status from the + * register 0x1F bit 3 + * + * + * + * + * @param v_high_g_sign_u8 :The status of high sign + * value | sign + * -----------|------------- + * 0 | positive + * 1 | negative + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_sign(u8 *v_high_g_sign_u8) @@ -3032,7 +3029,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_sign(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read highg_sign interrupt status*/ + /* read highg_sign interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_3_HIGH_G_SIGN__REG, @@ -3044,24 +3041,24 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_sign(u8 return com_rslt; } /*! -* @brief This API reads the status of orient_xy plane -* from the register 0x1F bit 4 and 5 -* -* -* @param v_orient_xy_u8 :The status of orient_xy plane -* value | status -* -----------|------------- -* 0x00 | portrait upright -* 0x01 | portrait upside down -* 0x02 | landscape left -* 0x03 | landscape right -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of orient_xy plane + * from the register 0x1F bit 4 and 5 + * + * + * @param v_orient_xy_u8 :The status of orient_xy plane + * value | status + * -----------|------------- + * 0x00 | portrait upright + * 0x01 | portrait upside down + * 0x02 | landscape left + * 0x03 | landscape right + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_xy(u8 *v_orient_xy_u8) @@ -3073,7 +3070,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_xy(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read orient plane xy interrupt status*/ + /* read orient plane xy interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_3_ORIENT_XY__REG, @@ -3085,21 +3082,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_xy(u8 return com_rslt; } /*! -* @brief This API reads the status of orient z plane -* from the register 0x1F bit 6 -* -* -* @param v_orient_z_u8 :The status of orient z -* value | status -* -----------|------------- -* 0x00 | upward looking -* 0x01 | downward looking -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the status of orient z plane + * from the register 0x1F bit 6 + * + * + * @param v_orient_z_u8 :The status of orient z + * value | status + * -----------|------------- + * 0x00 | upward looking + * 0x01 | downward looking + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_z(u8 *v_orient_z_u8) @@ -3111,7 +3108,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_z(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read orient z plane interrupt status*/ + /* read orient z plane interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_3_ORIENT_Z__REG, &v_data_u8, @@ -3123,22 +3120,22 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_z(u8 return com_rslt; } /*! -* @brief This API reads the flat status from the register -* 0x1F bit 7 -* -* -* @param v_flat_u8 : The status of flat interrupt -* value | status -* -----------|------------- -* 0x00 | non flat -* 0x01 | flat position -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the flat status from the register + * 0x1F bit 7 + * + * + * @param v_flat_u8 : The status of flat interrupt + * value | status + * -----------|------------- + * 0x00 | non flat + * 0x01 | flat position + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_flat(u8 *v_flat_u8) @@ -3150,7 +3147,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_flat(u8 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read flat interrupt status*/ + /* read flat interrupt status */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_INTR_STAT_3_FLAT__REG, &v_data_u8, @@ -3161,20 +3158,20 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_flat(u8 return com_rslt; } /*! -* @brief This API reads the temperature of the sensor -* from the register 0x21 bit 0 to 7 -* -* -* -* @param v_temp_s16 : The value of temperature -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the temperature of the sensor + * from the register 0x21 bit 0 to 7 + * + * + * + * @param v_temp_s16 : The value of temperature + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_temp(s16 *v_temp_s16) @@ -3190,7 +3187,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_temp(s16 if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read temperature data*/ + /* read temperature data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_TEMP_LSB_VALUE__REG, v_data_u8, @@ -3203,22 +3200,22 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_temp(s16 return com_rslt; } /*! -* @brief This API reads the of the sensor -* form the register 0x23 and 0x24 bit 0 to 7 and 0 to 2 -* @brief this byte counter is updated each time a complete frame -* was read or writtern -* -* -* @param v_fifo_length_u32 : The value of fifo byte counter -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the of the sensor + * form the register 0x23 and 0x24 bit 0 to 7 and 0 to 2 + * @brief this byte counter is updated each time a complete frame + * was read or writtern + * + * + * @param v_fifo_length_u32 : The value of fifo byte counter + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_fifo_length(u32*v_fifo_length_u32) +SMI130_RETURN_FUNCTION_TYPE smi130_fifo_length(u32 *v_fifo_length_u32) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3251,26 +3248,26 @@ SMI130_RETURN_FUNCTION_TYPE smi130_fifo_length(u32*v_fifo_length_u32) return com_rslt; } /*! -* @brief This API reads the fifo data of the sensor -* from the register 0x24 -* @brief Data format depends on the setting of register FIFO_CONFIG -* -* -* -* @param v_fifodata_u8 : Pointer holding the fifo data -* @param fifo_length_u16 : The value of fifo length maximum -* 1024 -* -* @note For reading FIFO data use the following functions -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the fifo data of the sensor + * from the register 0x24 + * @brief Data format depends on the setting of register FIFO_CONFIG + * + * + * + * @param v_fifodata_u8 : Pointer holding the fifo data + * @param fifo_length_u16 : The value of fifo length maximum + * 1024 + * + * @note For reading FIFO data use the following functions + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_fifo_data( -u8*v_fifodata_u8, u16 v_fifo_length_u16) +u8 *v_fifodata_u8, u16 v_fifo_length_u16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3288,36 +3285,36 @@ u8*v_fifodata_u8, u16 v_fifo_length_u16) return com_rslt; } /*! -* @brief This API is used to get the -* accel output date rate form the register 0x40 bit 0 to 3 -* -* -* @param v_output_data_rate_u8 :The value of accel output date rate -* value | output data rate -* -------|-------------------------- -* 0 | SMI130_ACCEL_OUTPUT_DATA_RATE_RESERVED -* 1 | SMI130_ACCEL_OUTPUT_DATA_RATE_0_78HZ -* 2 | SMI130_ACCEL_OUTPUT_DATA_RATE_1_56HZ -* 3 | SMI130_ACCEL_OUTPUT_DATA_RATE_3_12HZ -* 4 | SMI130_ACCEL_OUTPUT_DATA_RATE_6_25HZ -* 5 | SMI130_ACCEL_OUTPUT_DATA_RATE_12_5HZ -* 6 | SMI130_ACCEL_OUTPUT_DATA_RATE_25HZ -* 7 | SMI130_ACCEL_OUTPUT_DATA_RATE_50HZ -* 8 | SMI130_ACCEL_OUTPUT_DATA_RATE_100HZ -* 9 | SMI130_ACCEL_OUTPUT_DATA_RATE_200HZ -* 10 | SMI130_ACCEL_OUTPUT_DATA_RATE_400HZ -* 11 | SMI130_ACCEL_OUTPUT_DATA_RATE_800HZ -* 12 | SMI130_ACCEL_OUTPUT_DATA_RATE_1600HZ -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the + * accel output date rate form the register 0x40 bit 0 to 3 + * + * + * @param v_output_data_rate_u8 :The value of accel output date rate + * value | output data rate + * -------|-------------------------- + * 0 | SMI130_ACCEL_OUTPUT_DATA_RATE_RESERVED + * 1 | SMI130_ACCEL_OUTPUT_DATA_RATE_0_78HZ + * 2 | SMI130_ACCEL_OUTPUT_DATA_RATE_1_56HZ + * 3 | SMI130_ACCEL_OUTPUT_DATA_RATE_3_12HZ + * 4 | SMI130_ACCEL_OUTPUT_DATA_RATE_6_25HZ + * 5 | SMI130_ACCEL_OUTPUT_DATA_RATE_12_5HZ + * 6 | SMI130_ACCEL_OUTPUT_DATA_RATE_25HZ + * 7 | SMI130_ACCEL_OUTPUT_DATA_RATE_50HZ + * 8 | SMI130_ACCEL_OUTPUT_DATA_RATE_100HZ + * 9 | SMI130_ACCEL_OUTPUT_DATA_RATE_200HZ + * 10 | SMI130_ACCEL_OUTPUT_DATA_RATE_400HZ + * 11 | SMI130_ACCEL_OUTPUT_DATA_RATE_800HZ + * 12 | SMI130_ACCEL_OUTPUT_DATA_RATE_1600HZ + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_output_data_rate( -u8*v_output_data_rate_u8) +u8 *v_output_data_rate_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3337,33 +3334,33 @@ u8*v_output_data_rate_u8) return com_rslt; } /*! -* @brief This API is used to set the -* accel output date rate form the register 0x40 bit 0 to 3 -* -* -* @param v_output_data_rate_u8 :The value of accel output date rate -* value | output data rate -* -------|-------------------------- -* 0 | SMI130_ACCEL_OUTPUT_DATA_RATE_RESERVED -* 1 | SMI130_ACCEL_OUTPUT_DATA_RATE_0_78HZ -* 2 | SMI130_ACCEL_OUTPUT_DATA_RATE_1_56HZ -* 3 | SMI130_ACCEL_OUTPUT_DATA_RATE_3_12HZ -* 4 | SMI130_ACCEL_OUTPUT_DATA_RATE_6_25HZ -* 5 | SMI130_ACCEL_OUTPUT_DATA_RATE_12_5HZ -* 6 | SMI130_ACCEL_OUTPUT_DATA_RATE_25HZ -* 7 | SMI130_ACCEL_OUTPUT_DATA_RATE_50HZ -* 8 | SMI130_ACCEL_OUTPUT_DATA_RATE_100HZ -* 9 | SMI130_ACCEL_OUTPUT_DATA_RATE_200HZ -* 10 | SMI130_ACCEL_OUTPUT_DATA_RATE_400HZ -* 11 | SMI130_ACCEL_OUTPUT_DATA_RATE_800HZ -* 12 | SMI130_ACCEL_OUTPUT_DATA_RATE_1600HZ -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set the + * accel output date rate form the register 0x40 bit 0 to 3 + * + * + * @param v_output_data_rate_u8 :The value of accel output date rate + * value | output data rate + * -------|-------------------------- + * 0 | SMI130_ACCEL_OUTPUT_DATA_RATE_RESERVED + * 1 | SMI130_ACCEL_OUTPUT_DATA_RATE_0_78HZ + * 2 | SMI130_ACCEL_OUTPUT_DATA_RATE_1_56HZ + * 3 | SMI130_ACCEL_OUTPUT_DATA_RATE_3_12HZ + * 4 | SMI130_ACCEL_OUTPUT_DATA_RATE_6_25HZ + * 5 | SMI130_ACCEL_OUTPUT_DATA_RATE_12_5HZ + * 6 | SMI130_ACCEL_OUTPUT_DATA_RATE_25HZ + * 7 | SMI130_ACCEL_OUTPUT_DATA_RATE_50HZ + * 8 | SMI130_ACCEL_OUTPUT_DATA_RATE_100HZ + * 9 | SMI130_ACCEL_OUTPUT_DATA_RATE_200HZ + * 10 | SMI130_ACCEL_OUTPUT_DATA_RATE_400HZ + * 11 | SMI130_ACCEL_OUTPUT_DATA_RATE_800HZ + * 12 | SMI130_ACCEL_OUTPUT_DATA_RATE_1600HZ + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_output_data_rate( u8 v_output_data_rate_u8) @@ -3375,10 +3372,10 @@ u8 v_output_data_rate_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* accel output data rate selection*/ + /* accel output data rate selection */ if ((v_output_data_rate_u8 != SMI130_INIT_VALUE) && (v_output_data_rate_u8 <= SMI130_MAX_ACCEL_OUTPUT_DATA_RATE)) { - /* write accel output data rate*/ + /* write accel output data rate */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__REG, @@ -3400,51 +3397,51 @@ u8 v_output_data_rate_u8) return com_rslt; } /*! -* @brief This API is used to get the -* accel bandwidth from the register 0x40 bit 4 to 6 -* @brief bandwidth parameter determines filter configuration(acc_us=0) -* and averaging for under sampling mode(acc_us=1) -* -* -* @param v_bw_u8 : The value of accel bandwidth -* -* @note accel bandwidth depends on under sampling parameter -* @note under sampling parameter cab be set by the function -* "SMI130_SET_ACCEL_UNDER_SAMPLING_PARAMETER" -* -* @note Filter configuration -* accel_us | Filter configuration -* -----------|--------------------- -* 0x00 | OSR4 mode -* 0x01 | OSR2 mode -* 0x02 | normal mode -* 0x03 | CIC mode -* 0x04 | Reserved -* 0x05 | Reserved -* 0x06 | Reserved -* 0x07 | Reserved -* -* @note accel under sampling mode -* accel_us | Under sampling mode -* -----------|--------------------- -* 0x00 | no averaging -* 0x01 | average 2 samples -* 0x02 | average 4 samples -* 0x03 | average 8 samples -* 0x04 | average 16 samples -* 0x05 | average 32 samples -* 0x06 | average 64 samples -* 0x07 | average 128 samples -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the + * accel bandwidth from the register 0x40 bit 4 to 6 + * @brief bandwidth parameter determines filter configuration(acc_us=0) + * and averaging for under sampling mode(acc_us=1) + * + * + * @param v_bw_u8 : The value of accel bandwidth + * + * @note accel bandwidth depends on under sampling parameter + * @note under sampling parameter cab be set by the function + * "SMI130_SET_ACCEL_UNDER_SAMPLING_PARAMETER" + * + * @note Filter configuration + * accel_us | Filter configuration + * -----------|--------------------- + * 0x00 | OSR4 mode + * 0x01 | OSR2 mode + * 0x02 | normal mode + * 0x03 | CIC mode + * 0x04 | Reserved + * 0x05 | Reserved + * 0x06 | Reserved + * 0x07 | Reserved + * + * @note accel under sampling mode + * accel_us | Under sampling mode + * -----------|--------------------- + * 0x00 | no averaging + * 0x01 | average 2 samples + * 0x02 | average 4 samples + * 0x03 | average 8 samples + * 0x04 | average 16 samples + * 0x05 | average 32 samples + * 0x06 | average 64 samples + * 0x07 | average 128 samples + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_bw(u8*v_bw_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_bw(u8 *v_bw_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3453,7 +3450,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_bw(u8*v_bw_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the accel bandwidth*/ + /* read the accel bandwidth */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_ACCEL_CONFIG_ACCEL_BW__REG, &v_data_u8, @@ -3464,49 +3461,49 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_bw(u8*v_bw_u8) return com_rslt; } /*! -* @brief This API is used to set the -* accel bandwidth from the register 0x40 bit 4 to 6 -* @brief bandwidth parameter determines filter configuration(acc_us=0) -* and averaging for under sampling mode(acc_us=1) -* -* -* @param v_bw_u8 : The value of accel bandwidth -* -* @note accel bandwidth depends on under sampling parameter -* @note under sampling parameter cab be set by the function -* "SMI130_SET_ACCEL_UNDER_SAMPLING_PARAMETER" -* -* @note Filter configuration -* accel_us | Filter configuration -* -----------|--------------------- -* 0x00 | OSR4 mode -* 0x01 | OSR2 mode -* 0x02 | normal mode -* 0x03 | CIC mode -* 0x04 | Reserved -* 0x05 | Reserved -* 0x06 | Reserved -* 0x07 | Reserved -* -* @note accel under sampling mode -* accel_us | Under sampling mode -* -----------|--------------------- -* 0x00 | no averaging -* 0x01 | average 2 samples -* 0x02 | average 4 samples -* 0x03 | average 8 samples -* 0x04 | average 16 samples -* 0x05 | average 32 samples -* 0x06 | average 64 samples -* 0x07 | average 128 samples -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set the + * accel bandwidth from the register 0x40 bit 4 to 6 + * @brief bandwidth parameter determines filter configuration(acc_us=0) + * and averaging for under sampling mode(acc_us=1) + * + * + * @param v_bw_u8 : The value of accel bandwidth + * + * @note accel bandwidth depends on under sampling parameter + * @note under sampling parameter cab be set by the function + * "SMI130_SET_ACCEL_UNDER_SAMPLING_PARAMETER" + * + * @note Filter configuration + * accel_us | Filter configuration + * -----------|--------------------- + * 0x00 | OSR4 mode + * 0x01 | OSR2 mode + * 0x02 | normal mode + * 0x03 | CIC mode + * 0x04 | Reserved + * 0x05 | Reserved + * 0x06 | Reserved + * 0x07 | Reserved + * + * @note accel under sampling mode + * accel_us | Under sampling mode + * -----------|--------------------- + * 0x00 | no averaging + * 0x01 | average 2 samples + * 0x02 | average 4 samples + * 0x03 | average 8 samples + * 0x04 | average 16 samples + * 0x05 | average 32 samples + * 0x06 | average 64 samples + * 0x07 | average 128 samples + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_bw(u8 v_bw_u8) { @@ -3541,28 +3538,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_bw(u8 v_bw_u8) return com_rslt; } /*! -* @brief This API is used to get the accel -* under sampling parameter form the register 0x40 bit 7 -* -* -* -* -* @param v_accel_under_sampling_u8 : The value of accel under sampling -* value | under_sampling -* ----------|--------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the accel + * under sampling parameter form the register 0x40 bit 7 + * + * + * + * + * @param v_accel_under_sampling_u8 : The value of accel under sampling + * value | under_sampling + * ----------|--------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_under_sampling_parameter( -u8*v_accel_under_sampling_u8) +u8 *v_accel_under_sampling_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3571,7 +3568,7 @@ u8*v_accel_under_sampling_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the accel under sampling parameter*/ + /* read the accel under sampling parameter */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__REG, @@ -3583,25 +3580,25 @@ u8*v_accel_under_sampling_u8) return com_rslt; } /*! -* @brief This API is used to set the accel -* under sampling parameter form the register 0x40 bit 7 -* -* -* -* -* @param v_accel_under_sampling_u8 : The value of accel under sampling -* value | under_sampling -* ----------|--------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set the accel + * under sampling parameter form the register 0x40 bit 7 + * + * + * + * + * @param v_accel_under_sampling_u8 : The value of accel under sampling + * value | under_sampling + * ----------|--------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_under_sampling_parameter( u8 v_accel_under_sampling_u8) @@ -3619,7 +3616,7 @@ if (p_smi130 == SMI130_NULL) { SMI130_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); if (com_rslt == SUCCESS) { - /* write the accel under sampling parameter*/ + /* write the accel under sampling parameter */ v_data_u8 = SMI130_SET_BITSLICE(v_data_u8, SMI130_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING, v_accel_under_sampling_u8); @@ -3636,30 +3633,30 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to get the ranges -* (g values) of the accel from the register 0x41 bit 0 to 3 -* -* -* -* -* @param v_range_u8 : The value of accel g range -* value | g_range -* ----------|----------- -* 0x03 | SMI130_ACCEL_RANGE_2G -* 0x05 | SMI130_ACCEL_RANGE_4G -* 0x08 | SMI130_ACCEL_RANGE_8G -* 0x0C | SMI130_ACCEL_RANGE_16G -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the ranges + * (g values) of the accel from the register 0x41 bit 0 to 3 + * + * + * + * + * @param v_range_u8 : The value of accel g range + * value | g_range + * ----------|----------- + * 0x03 | SMI130_ACCEL_RANGE_2G + * 0x05 | SMI130_ACCEL_RANGE_4G + * 0x08 | SMI130_ACCEL_RANGE_8G + * 0x0C | SMI130_ACCEL_RANGE_16G + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_range( -u8*v_range_u8) +u8 *v_range_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3679,27 +3676,27 @@ u8*v_range_u8) return com_rslt; } /*! -* @brief This API is used to set the ranges -* (g values) of the accel from the register 0x41 bit 0 to 3 -* -* -* -* -* @param v_range_u8 : The value of accel g range -* value | g_range -* ----------|----------- -* 0x03 | SMI130_ACCEL_RANGE_2G -* 0x05 | SMI130_ACCEL_RANGE_4G -* 0x08 | SMI130_ACCEL_RANGE_8G -* 0x0C | SMI130_ACCEL_RANGE_16G -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set the ranges + * (g values) of the accel from the register 0x41 bit 0 to 3 + * + * + * + * + * @param v_range_u8 : The value of accel g range + * value | g_range + * ----------|----------- + * 0x03 | SMI130_ACCEL_RANGE_2G + * 0x05 | SMI130_ACCEL_RANGE_4G + * 0x08 | SMI130_ACCEL_RANGE_8G + * 0x0C | SMI130_ACCEL_RANGE_16G + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_range(u8 v_range_u8) { @@ -3736,40 +3733,40 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_range(u8 v_range_u8) return com_rslt; } /*! -* @brief This API is used to get the -* gyroscope output data rate from the register 0x42 bit 0 to 3 -* -* -* -* -* @param v_output_data_rate_u8 :The value of gyro output data rate -* value | gyro output data rate -* -----------|----------------------------- -* 0x00 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x01 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x02 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x03 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x04 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x05 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x06 | SMI130_GYRO_OUTPUT_DATA_RATE_25HZ -* 0x07 | SMI130_GYRO_OUTPUT_DATA_RATE_50HZ -* 0x08 | SMI130_GYRO_OUTPUT_DATA_RATE_100HZ -* 0x09 | SMI130_GYRO_OUTPUT_DATA_RATE_200HZ -* 0x0A | SMI130_GYRO_OUTPUT_DATA_RATE_400HZ -* 0x0B | SMI130_GYRO_OUTPUT_DATA_RATE_800HZ -* 0x0C | SMI130_GYRO_OUTPUT_DATA_RATE_1600HZ -* 0x0D | SMI130_GYRO_OUTPUT_DATA_RATE_3200HZ -* 0x0E | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x0F | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the + * gyroscope output data rate from the register 0x42 bit 0 to 3 + * + * + * + * + * @param v_output_data_rate_u8 :The value of gyro output data rate + * value | gyro output data rate + * -----------|----------------------------- + * 0x00 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x01 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x02 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x03 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x04 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x05 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x06 | SMI130_GYRO_OUTPUT_DATA_RATE_25HZ + * 0x07 | SMI130_GYRO_OUTPUT_DATA_RATE_50HZ + * 0x08 | SMI130_GYRO_OUTPUT_DATA_RATE_100HZ + * 0x09 | SMI130_GYRO_OUTPUT_DATA_RATE_200HZ + * 0x0A | SMI130_GYRO_OUTPUT_DATA_RATE_400HZ + * 0x0B | SMI130_GYRO_OUTPUT_DATA_RATE_800HZ + * 0x0C | SMI130_GYRO_OUTPUT_DATA_RATE_1600HZ + * 0x0D | SMI130_GYRO_OUTPUT_DATA_RATE_3200HZ + * 0x0E | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x0F | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_output_data_rate( -u8*v_output_data_rate_u8) +u8 *v_output_data_rate_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3789,37 +3786,37 @@ u8*v_output_data_rate_u8) return com_rslt; } /*! -* @brief This API is used to set the -* gyroscope output data rate from the register 0x42 bit 0 to 3 -* -* -* -* -* @param v_output_data_rate_u8 :The value of gyro output data rate -* value | gyro output data rate -* -----------|----------------------------- -* 0x00 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x01 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x02 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x03 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x04 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x05 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x06 | SMI130_GYRO_OUTPUT_DATA_RATE_25HZ -* 0x07 | SMI130_GYRO_OUTPUT_DATA_RATE_50HZ -* 0x08 | SMI130_GYRO_OUTPUT_DATA_RATE_100HZ -* 0x09 | SMI130_GYRO_OUTPUT_DATA_RATE_200HZ -* 0x0A | SMI130_GYRO_OUTPUT_DATA_RATE_400HZ -* 0x0B | SMI130_GYRO_OUTPUT_DATA_RATE_800HZ -* 0x0C | SMI130_GYRO_OUTPUT_DATA_RATE_1600HZ -* 0x0D | SMI130_GYRO_OUTPUT_DATA_RATE_3200HZ -* 0x0E | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* 0x0F | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set the + * gyroscope output data rate from the register 0x42 bit 0 to 3 + * + * + * + * + * @param v_output_data_rate_u8 :The value of gyro output data rate + * value | gyro output data rate + * -----------|----------------------------- + * 0x00 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x01 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x02 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x03 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x04 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x05 | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x06 | SMI130_GYRO_OUTPUT_DATA_RATE_25HZ + * 0x07 | SMI130_GYRO_OUTPUT_DATA_RATE_50HZ + * 0x08 | SMI130_GYRO_OUTPUT_DATA_RATE_100HZ + * 0x09 | SMI130_GYRO_OUTPUT_DATA_RATE_200HZ + * 0x0A | SMI130_GYRO_OUTPUT_DATA_RATE_400HZ + * 0x0B | SMI130_GYRO_OUTPUT_DATA_RATE_800HZ + * 0x0C | SMI130_GYRO_OUTPUT_DATA_RATE_1600HZ + * 0x0D | SMI130_GYRO_OUTPUT_DATA_RATE_3200HZ + * 0x0E | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * 0x0F | SMI130_GYRO_OUTPUT_DATA_RATE_RESERVED + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_output_data_rate( u8 v_output_data_rate_u8) @@ -3841,7 +3838,7 @@ u8 v_output_data_rate_u8) && (v_output_data_rate_u8 != SMI130_OUTPUT_DATA_RATE5) && (v_output_data_rate_u8 != SMI130_OUTPUT_DATA_RATE6) && (v_output_data_rate_u8 != SMI130_OUTPUT_DATA_RATE7)) { - /* write the gyro output data rate*/ + /* write the gyro output data rate */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__REG, @@ -3862,28 +3859,28 @@ u8 v_output_data_rate_u8) return com_rslt; } /*! -* @brief This API is used to get the -* data of gyro from the register 0x42 bit 4 to 5 -* -* -* -* -* @param v_bw_u8 : The value of gyro bandwidth -* value | gyro bandwidth -* ----------|---------------- -* 0x00 | SMI130_GYRO_OSR4_MODE -* 0x01 | SMI130_GYRO_OSR2_MODE -* 0x02 | SMI130_GYRO_NORMAL_MODE -* 0x03 | SMI130_GYRO_CIC_MODE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the + * data of gyro from the register 0x42 bit 4 to 5 + * + * + * + * + * @param v_bw_u8 : The value of gyro bandwidth + * value | gyro bandwidth + * ----------|---------------- + * 0x00 | SMI130_GYRO_OSR4_MODE + * 0x01 | SMI130_GYRO_OSR2_MODE + * 0x02 | SMI130_GYRO_NORMAL_MODE + * 0x03 | SMI130_GYRO_CIC_MODE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_bw(u8*v_bw_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_bw(u8 *v_bw_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3903,26 +3900,26 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_bw(u8*v_bw_u8) return com_rslt; } /*! -* @brief This API is used to set the -* data of gyro from the register 0x42 bit 4 to 5 -* -* -* -* -* @param v_bw_u8 : The value of gyro bandwidth -* value | gyro bandwidth -* ----------|---------------- -* 0x00 | SMI130_GYRO_OSR4_MODE -* 0x01 | SMI130_GYRO_OSR2_MODE -* 0x02 | SMI130_GYRO_NORMAL_MODE -* 0x03 | SMI130_GYRO_CIC_MODE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set the + * data of gyro from the register 0x42 bit 4 to 5 + * + * + * + * + * @param v_bw_u8 : The value of gyro bandwidth + * value | gyro bandwidth + * ----------|---------------- + * 0x00 | SMI130_GYRO_OSR4_MODE + * 0x01 | SMI130_GYRO_OSR2_MODE + * 0x02 | SMI130_GYRO_NORMAL_MODE + * 0x03 | SMI130_GYRO_CIC_MODE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_bw(u8 v_bw_u8) { @@ -3955,25 +3952,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_bw(u8 v_bw_u8) return com_rslt; } /*! -* @brief This API reads the range -* of gyro from the register 0x43 bit 0 to 2 -* -* @param v_range_u8 : The value of gyro range -* value | range -* ----------|------------------------------- -* 0x00 | SMI130_GYRO_RANGE_2000_DEG_SEC -* 0x01 | SMI130_GYRO_RANGE_1000_DEG_SEC -* 0x02 | SMI130_GYRO_RANGE_500_DEG_SEC -* 0x03 | SMI130_GYRO_RANGE_250_DEG_SEC -* 0x04 | SMI130_GYRO_RANGE_125_DEG_SEC -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads the range + * of gyro from the register 0x43 bit 0 to 2 + * + * @param v_range_u8 : The value of gyro range + * value | range + * ----------|------------------------------- + * 0x00 | SMI130_GYRO_RANGE_2000_DEG_SEC + * 0x01 | SMI130_GYRO_RANGE_1000_DEG_SEC + * 0x02 | SMI130_GYRO_RANGE_500_DEG_SEC + * 0x03 | SMI130_GYRO_RANGE_250_DEG_SEC + * 0x04 | SMI130_GYRO_RANGE_125_DEG_SEC + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_range(u8*v_range_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_range(u8 *v_range_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -3982,7 +3979,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_range(u8*v_range_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the gyro range*/ + /* read the gyro range */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_GYRO_RANGE__REG, @@ -3994,23 +3991,23 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_range(u8*v_range_u8) return com_rslt; } /*! -* @brief This API set the range -* of gyro from the register 0x43 bit 0 to 2 -* -* @param v_range_u8 : The value of gyro range -* value | range -* ----------|------------------------------- -* 0x00 | SMI130_GYRO_RANGE_2000_DEG_SEC -* 0x01 | SMI130_GYRO_RANGE_1000_DEG_SEC -* 0x02 | SMI130_GYRO_RANGE_500_DEG_SEC -* 0x03 | SMI130_GYRO_RANGE_250_DEG_SEC -* 0x04 | SMI130_GYRO_RANGE_125_DEG_SEC -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API set the range + * of gyro from the register 0x43 bit 0 to 2 + * + * @param v_range_u8 : The value of gyro range + * value | range + * ----------|------------------------------- + * 0x00 | SMI130_GYRO_RANGE_2000_DEG_SEC + * 0x01 | SMI130_GYRO_RANGE_1000_DEG_SEC + * 0x02 | SMI130_GYRO_RANGE_500_DEG_SEC + * 0x03 | SMI130_GYRO_RANGE_250_DEG_SEC + * 0x04 | SMI130_GYRO_RANGE_125_DEG_SEC + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_range(u8 v_range_u8) { @@ -4022,7 +4019,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_range(u8 v_range_u8) return E_SMI130_NULL_PTR; } else { if (v_range_u8 <= SMI130_MAX_GYRO_RANGE) { - /* write the gyro range value*/ + /* write the gyro range value */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_GYRO_RANGE__REG, @@ -4043,42 +4040,42 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_range(u8 v_range_u8) return com_rslt; } /*! -* @brief This API is used to get the -* output data rate of magnetometer from the register 0x44 bit 0 to 3 -* -* -* -* -* @param v_output_data_rat_u8e : The value of mag output data rate -* value | mag output data rate -* ---------|--------------------------- -* 0x00 |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED -* 0x01 |SMI130_MAG_OUTPUT_DATA_RATE_0_78HZ -* 0x02 |SMI130_MAG_OUTPUT_DATA_RATE_1_56HZ -* 0x03 |SMI130_MAG_OUTPUT_DATA_RATE_3_12HZ -* 0x04 |SMI130_MAG_OUTPUT_DATA_RATE_6_25HZ -* 0x05 |SMI130_MAG_OUTPUT_DATA_RATE_12_5HZ -* 0x06 |SMI130_MAG_OUTPUT_DATA_RATE_25HZ -* 0x07 |SMI130_MAG_OUTPUT_DATA_RATE_50HZ -* 0x08 |SMI130_MAG_OUTPUT_DATA_RATE_100HZ -* 0x09 |SMI130_MAG_OUTPUT_DATA_RATE_200HZ -* 0x0A |SMI130_MAG_OUTPUT_DATA_RATE_400HZ -* 0x0B |SMI130_MAG_OUTPUT_DATA_RATE_800HZ -* 0x0C |SMI130_MAG_OUTPUT_DATA_RATE_1600HZ -* 0x0D |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED0 -* 0x0E |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED1 -* 0x0F |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED2 -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the + * output data rate of magnetometer from the register 0x44 bit 0 to 3 + * + * + * + * + * @param v_output_data_rat_u8e : The value of mag output data rate + * value | mag output data rate + * ---------|--------------------------- + * 0x00 |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED + * 0x01 |SMI130_MAG_OUTPUT_DATA_RATE_0_78HZ + * 0x02 |SMI130_MAG_OUTPUT_DATA_RATE_1_56HZ + * 0x03 |SMI130_MAG_OUTPUT_DATA_RATE_3_12HZ + * 0x04 |SMI130_MAG_OUTPUT_DATA_RATE_6_25HZ + * 0x05 |SMI130_MAG_OUTPUT_DATA_RATE_12_5HZ + * 0x06 |SMI130_MAG_OUTPUT_DATA_RATE_25HZ + * 0x07 |SMI130_MAG_OUTPUT_DATA_RATE_50HZ + * 0x08 |SMI130_MAG_OUTPUT_DATA_RATE_100HZ + * 0x09 |SMI130_MAG_OUTPUT_DATA_RATE_200HZ + * 0x0A |SMI130_MAG_OUTPUT_DATA_RATE_400HZ + * 0x0B |SMI130_MAG_OUTPUT_DATA_RATE_800HZ + * 0x0C |SMI130_MAG_OUTPUT_DATA_RATE_1600HZ + * 0x0D |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED0 + * 0x0E |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED1 + * 0x0F |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED2 + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_output_data_rate( -u8*v_output_data_rat_u8e) +u8 *v_output_data_rat_u8e) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4098,39 +4095,39 @@ u8*v_output_data_rat_u8e) return com_rslt; } /*! -* @brief This API is used to set the -* output data rate of magnetometer from the register 0x44 bit 0 to 3 -* -* -* -* -* @param v_output_data_rat_u8e : The value of mag output data rate -* value | mag output data rate -* ---------|--------------------------- -* 0x00 |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED -* 0x01 |SMI130_MAG_OUTPUT_DATA_RATE_0_78HZ -* 0x02 |SMI130_MAG_OUTPUT_DATA_RATE_1_56HZ -* 0x03 |SMI130_MAG_OUTPUT_DATA_RATE_3_12HZ -* 0x04 |SMI130_MAG_OUTPUT_DATA_RATE_6_25HZ -* 0x05 |SMI130_MAG_OUTPUT_DATA_RATE_12_5HZ -* 0x06 |SMI130_MAG_OUTPUT_DATA_RATE_25HZ -* 0x07 |SMI130_MAG_OUTPUT_DATA_RATE_50HZ -* 0x08 |SMI130_MAG_OUTPUT_DATA_RATE_100HZ -* 0x09 |SMI130_MAG_OUTPUT_DATA_RATE_200HZ -* 0x0A |SMI130_MAG_OUTPUT_DATA_RATE_400HZ -* 0x0B |SMI130_MAG_OUTPUT_DATA_RATE_800HZ -* 0x0C |SMI130_MAG_OUTPUT_DATA_RATE_1600HZ -* 0x0D |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED0 -* 0x0E |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED1 -* 0x0F |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED2 -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set the + * output data rate of magnetometer from the register 0x44 bit 0 to 3 + * + * + * + * + * @param v_output_data_rat_u8e : The value of mag output data rate + * value | mag output data rate + * ---------|--------------------------- + * 0x00 |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED + * 0x01 |SMI130_MAG_OUTPUT_DATA_RATE_0_78HZ + * 0x02 |SMI130_MAG_OUTPUT_DATA_RATE_1_56HZ + * 0x03 |SMI130_MAG_OUTPUT_DATA_RATE_3_12HZ + * 0x04 |SMI130_MAG_OUTPUT_DATA_RATE_6_25HZ + * 0x05 |SMI130_MAG_OUTPUT_DATA_RATE_12_5HZ + * 0x06 |SMI130_MAG_OUTPUT_DATA_RATE_25HZ + * 0x07 |SMI130_MAG_OUTPUT_DATA_RATE_50HZ + * 0x08 |SMI130_MAG_OUTPUT_DATA_RATE_100HZ + * 0x09 |SMI130_MAG_OUTPUT_DATA_RATE_200HZ + * 0x0A |SMI130_MAG_OUTPUT_DATA_RATE_400HZ + * 0x0B |SMI130_MAG_OUTPUT_DATA_RATE_800HZ + * 0x0C |SMI130_MAG_OUTPUT_DATA_RATE_1600HZ + * 0x0D |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED0 + * 0x0E |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED1 + * 0x0F |SMI130_MAG_OUTPUT_DATA_RATE_RESERVED2 + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_output_data_rate( u8 v_output_data_rat_u8e) @@ -4173,23 +4170,23 @@ u8 v_output_data_rat_u8e) return com_rslt; } /*! -* @brief This API is used to read Down sampling -* for gyro (2**downs_gyro) in the register 0x45 bit 0 to 2 -* -* -* -* -* @param v_fifo_down_gyro_u8 :The value of gyro fifo down -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read Down sampling + * for gyro (2**downs_gyro) in the register 0x45 bit 0 to 2 + * + * + * + * + * @param v_fifo_down_gyro_u8 :The value of gyro fifo down + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_down_gyro( -u8*v_fifo_down_gyro_u8) +u8 *v_fifo_down_gyro_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4209,20 +4206,20 @@ u8*v_fifo_down_gyro_u8) return com_rslt; } /*! -* @brief This API is used to set Down sampling -* for gyro (2**downs_gyro) in the register 0x45 bit 0 to 2 -* -* -* -* -* @param v_fifo_down_gyro_u8 :The value of gyro fifo down -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set Down sampling + * for gyro (2**downs_gyro) in the register 0x45 bit 0 to 2 + * + * + * + * + * @param v_fifo_down_gyro_u8 :The value of gyro fifo down + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_down_gyro( u8 v_fifo_down_gyro_u8) @@ -4254,25 +4251,25 @@ u8 v_fifo_down_gyro_u8) return com_rslt; } /*! -* @brief This API is used to read gyro fifo filter data -* from the register 0x45 bit 3 -* -* -* -* @param v_gyro_fifo_filter_data_u8 :The value of gyro filter data -* value | gyro_fifo_filter_data -* ------------|------------------------- -* 0x00 | Unfiltered data -* 0x01 | Filtered data -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read gyro fifo filter data + * from the register 0x45 bit 3 + * + * + * + * @param v_gyro_fifo_filter_data_u8 :The value of gyro filter data + * value | gyro_fifo_filter_data + * ------------|------------------------- + * 0x00 | Unfiltered data + * 0x01 | Filtered data + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_fifo_filter_data( -u8*v_gyro_fifo_filter_data_u8) +u8 *v_gyro_fifo_filter_data_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4281,7 +4278,7 @@ u8*v_gyro_fifo_filter_data_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the gyro fifo filter data*/ + /* read the gyro fifo filter data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_FILTER_GYRO__REG, &v_data_u8, @@ -4293,22 +4290,22 @@ u8*v_gyro_fifo_filter_data_u8) return com_rslt; } /*! -* @brief This API is used to set gyro fifo filter data -* from the register 0x45 bit 3 -* -* -* -* @param v_gyro_fifo_filter_data_u8 :The value of gyro filter data -* value | gyro_fifo_filter_data -* ------------|------------------------- -* 0x00 | Unfiltered data -* 0x01 | Filtered data -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set gyro fifo filter data + * from the register 0x45 bit 3 + * + * + * + * @param v_gyro_fifo_filter_data_u8 :The value of gyro filter data + * value | gyro_fifo_filter_data + * ------------|------------------------- + * 0x00 | Unfiltered data + * 0x01 | Filtered data + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_fifo_filter_data( u8 v_gyro_fifo_filter_data_u8) @@ -4322,7 +4319,7 @@ u8 v_gyro_fifo_filter_data_u8) } else { if (v_gyro_fifo_filter_data_u8 <= SMI130_MAX_VALUE_FIFO_FILTER) { - /* write the gyro fifo filter data*/ + /* write the gyro fifo filter data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_FILTER_GYRO__REG, @@ -4345,24 +4342,24 @@ u8 v_gyro_fifo_filter_data_u8) return com_rslt; } /*! -* @brief This API is used to read Down sampling -* for accel (2*downs_accel) from the register 0x45 bit 4 to 6 -* -* -* -* -* @param v_fifo_down_u8 :The value of accel fifo down -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read Down sampling + * for accel (2*downs_accel) from the register 0x45 bit 4 to 6 + * + * + * + * + * @param v_fifo_down_u8 :The value of accel fifo down + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_down_accel( -u8*v_fifo_down_u8) +u8 *v_fifo_down_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4371,7 +4368,7 @@ u8*v_fifo_down_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the accel fifo down data*/ + /* read the accel fifo down data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_DOWN_ACCEL__REG, &v_data_u8, @@ -4382,21 +4379,21 @@ u8*v_fifo_down_u8) return com_rslt; } /*! -* @brief This API is used to set Down sampling -* for accel (2*downs_accel) from the register 0x45 bit 4 to 6 -* -* -* -* -* @param v_fifo_down_u8 :The value of accel fifo down -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set Down sampling + * for accel (2*downs_accel) from the register 0x45 bit 4 to 6 + * + * + * + * + * @param v_fifo_down_u8 :The value of accel fifo down + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_down_accel( u8 v_fifo_down_u8) @@ -4408,7 +4405,7 @@ u8 v_fifo_down_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* write the accel fifo down data*/ + /* write the accel fifo down data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_DOWN_ACCEL__REG, &v_data_u8, @@ -4426,26 +4423,26 @@ u8 v_fifo_down_u8) return com_rslt; } /*! -* @brief This API is used to read accel fifo filter data -* from the register 0x45 bit 7 -* -* -* -* @param v_accel_fifo_filter_u8 :The value of accel filter data -* value | accel_fifo_filter_data -* ------------|------------------------- -* 0x00 | Unfiltered data -* 0x01 | Filtered data -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read accel fifo filter data + * from the register 0x45 bit 7 + * + * + * + * @param v_accel_fifo_filter_u8 :The value of accel filter data + * value | accel_fifo_filter_data + * ------------|------------------------- + * 0x00 | Unfiltered data + * 0x01 | Filtered data + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_fifo_filter_data( -u8*v_accel_fifo_filter_u8) +u8 *v_accel_fifo_filter_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4454,7 +4451,7 @@ u8*v_accel_fifo_filter_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the accel fifo filter data*/ + /* read the accel fifo filter data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_FILTER_ACCEL__REG, &v_data_u8, @@ -4465,23 +4462,23 @@ u8*v_accel_fifo_filter_u8) return com_rslt; } /*! -* @brief This API is used to set accel fifo filter data -* from the register 0x45 bit 7 -* -* -* -* @param v_accel_fifo_filter_u8 :The value of accel filter data -* value | accel_fifo_filter_data -* ------------|------------------------- -* 0x00 | Unfiltered data -* 0x01 | Filtered data -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set accel fifo filter data + * from the register 0x45 bit 7 + * + * + * + * @param v_accel_fifo_filter_u8 :The value of accel filter data + * value | accel_fifo_filter_data + * ------------|------------------------- + * 0x00 | Unfiltered data + * 0x01 | Filtered data + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_fifo_filter_data( u8 v_accel_fifo_filter_u8) @@ -4499,7 +4496,7 @@ u8 v_accel_fifo_filter_u8) SMI130_USER_FIFO_FILTER_ACCEL__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); if (com_rslt == SUCCESS) { - /* write accel fifo filter data*/ + /* write accel fifo filter data */ v_data_u8 = SMI130_SET_BITSLICE(v_data_u8, SMI130_USER_FIFO_FILTER_ACCEL, v_accel_fifo_filter_u8); @@ -4516,23 +4513,23 @@ u8 v_accel_fifo_filter_u8) return com_rslt; } /*! -* @brief This API is used to Trigger an interrupt -* when FIFO contains water mark level from the register 0x46 bit 0 to 7 -* -* -* -* @param v_fifo_wm_u8 : The value of fifo water mark level -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to Trigger an interrupt + * when FIFO contains water mark level from the register 0x46 bit 0 to 7 + * + * + * + * @param v_fifo_wm_u8 : The value of fifo water mark level + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_wm( -u8*v_fifo_wm_u8) +u8 *v_fifo_wm_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4552,20 +4549,20 @@ u8*v_fifo_wm_u8) return com_rslt; } /*! -* @brief This API is used to Trigger an interrupt -* when FIFO contains water mark level from the register 0x46 bit 0 to 7 -* -* -* -* @param v_fifo_wm_u8 : The value of fifo water mark level -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to Trigger an interrupt + * when FIFO contains water mark level from the register 0x46 bit 0 to 7 + * + * + * + * @param v_fifo_wm_u8 : The value of fifo water mark level + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_wm( u8 v_fifo_wm_u8) @@ -4585,26 +4582,26 @@ u8 v_fifo_wm_u8) return com_rslt; } /*! -* @brief This API reads fifo sensor time -* frame after the last valid data frame form the register 0x47 bit 1 -* -* -* -* -* @param v_fifo_time_enable_u8 : The value of sensor time -* value | fifo sensor time -* ------------|------------------------- -* 0x00 | do not return sensortime frame -* 0x01 | return sensortime frame -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API reads fifo sensor time + * frame after the last valid data frame form the register 0x47 bit 1 + * + * + * + * + * @param v_fifo_time_enable_u8 : The value of sensor time + * value | fifo sensor time + * ------------|------------------------- + * 0x00 | do not return sensortime frame + * 0x01 | return sensortime frame + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_time_enable( -u8*v_fifo_time_enable_u8) +u8 *v_fifo_time_enable_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4624,24 +4621,24 @@ u8*v_fifo_time_enable_u8) return com_rslt; } /*! -* @brief This API set fifo sensor time -* frame after the last valid data frame form the register 0x47 bit 1 -* -* -* -* -* @param v_fifo_time_enable_u8 : The value of sensor time -* value | fifo sensor time -* ------------|------------------------- -* 0x00 | do not return sensortime frame -* 0x01 | return sensortime frame -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API set fifo sensor time + * frame after the last valid data frame form the register 0x47 bit 1 + * + * + * + * + * @param v_fifo_time_enable_u8 : The value of sensor time + * value | fifo sensor time + * ------------|------------------------- + * 0x00 | do not return sensortime frame + * 0x01 | return sensortime frame + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_time_enable( u8 v_fifo_time_enable_u8) { @@ -4675,26 +4672,26 @@ u8 v_fifo_time_enable_u8) return com_rslt; } /*! -* @brief This API reads FIFO tag interrupt2 enable status -* from the resister 0x47 bit 2 -* -* @param v_fifo_tag_intr2_u8 : The value of fifo tag interrupt -* value | fifo tag interrupt -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads FIFO tag interrupt2 enable status + * from the resister 0x47 bit 2 + * + * @param v_fifo_tag_intr2_u8 : The value of fifo tag interrupt + * value | fifo tag interrupt + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_tag_intr2_enable( -u8*v_fifo_tag_intr2_u8) +u8 *v_fifo_tag_intr2_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4714,23 +4711,23 @@ u8*v_fifo_tag_intr2_u8) return com_rslt; } /*! -* @brief This API set FIFO tag interrupt2 enable status -* from the resister 0x47 bit 2 -* -* @param v_fifo_tag_intr2_u8 : The value of fifo tag interrupt -* value | fifo tag interrupt -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API set FIFO tag interrupt2 enable status + * from the resister 0x47 bit 2 + * + * @param v_fifo_tag_intr2_u8 : The value of fifo tag interrupt + * value | fifo tag interrupt + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_tag_intr2_enable( u8 v_fifo_tag_intr2_u8) @@ -4767,23 +4764,23 @@ u8 v_fifo_tag_intr2_u8) return com_rslt; } /*! -* @brief This API get FIFO tag interrupt1 enable status -* from the resister 0x47 bit 3 -* -* @param v_fifo_tag_intr1_u8 :The value of fifo tag interrupt1 -* value | fifo tag interrupt -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API get FIFO tag interrupt1 enable status + * from the resister 0x47 bit 3 + * + * @param v_fifo_tag_intr1_u8 :The value of fifo tag interrupt1 + * value | fifo tag interrupt + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_tag_intr1_enable( -u8*v_fifo_tag_intr1_u8) +u8 *v_fifo_tag_intr1_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4803,20 +4800,20 @@ u8*v_fifo_tag_intr1_u8) return com_rslt; } /*! -* @brief This API set FIFO tag interrupt1 enable status -* from the resister 0x47 bit 3 -* -* @param v_fifo_tag_intr1_u8 :The value of fifo tag interrupt1 -* value | fifo tag interrupt -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API set FIFO tag interrupt1 enable status + * from the resister 0x47 bit 3 + * + * @param v_fifo_tag_intr1_u8 :The value of fifo tag interrupt1 + * value | fifo tag interrupt + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_tag_intr1_enable( u8 v_fifo_tag_intr1_u8) @@ -4853,23 +4850,23 @@ u8 v_fifo_tag_intr1_u8) return com_rslt; } /*! -* @brief This API reads FIFO frame -* header enable from the register 0x47 bit 4 -* -* @param v_fifo_header_u8 :The value of fifo header -* value | fifo header -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads FIFO frame + * header enable from the register 0x47 bit 4 + * + * @param v_fifo_header_u8 :The value of fifo header + * value | fifo header + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_header_enable( -u8*v_fifo_header_u8) +u8 *v_fifo_header_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4878,7 +4875,7 @@ u8*v_fifo_header_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read fifo header*/ + /* read fifo header */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_HEADER_ENABLE__REG, &v_data_u8, @@ -4889,20 +4886,20 @@ u8*v_fifo_header_u8) return com_rslt; } /*! -* @brief This API set FIFO frame -* header enable from the register 0x47 bit 4 -* -* @param v_fifo_header_u8 :The value of fifo header -* value | fifo header -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API set FIFO frame + * header enable from the register 0x47 bit 4 + * + * @param v_fifo_header_u8 :The value of fifo header + * value | fifo header + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_header_enable( u8 v_fifo_header_u8) @@ -4915,7 +4912,7 @@ u8 v_fifo_header_u8) return E_SMI130_NULL_PTR; } else { if (v_fifo_header_u8 <= SMI130_MAX_VALUE_FIFO_HEADER) { - /* write the fifo header*/ + /* write the fifo header */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_HEADER_ENABLE__REG, &v_data_u8, @@ -4937,23 +4934,23 @@ u8 v_fifo_header_u8) return com_rslt; } /*! -* @brief This API is used to read stored -* magnetometer data in FIFO (all 3 axes) from the register 0x47 bit 5 -* -* @param v_fifo_mag_u8 : The value of fifo mag enble -* value | fifo mag -* ----------|------------------- -* 0x00 | no magnetometer data is stored -* 0x01 | magnetometer data is stored -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read stored + * magnetometer data in FIFO (all 3 axes) from the register 0x47 bit 5 + * + * @param v_fifo_mag_u8 : The value of fifo mag enble + * value | fifo mag + * ----------|------------------- + * 0x00 | no magnetometer data is stored + * 0x01 | magnetometer data is stored + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_mag_enable( -u8*v_fifo_mag_u8) +u8 *v_fifo_mag_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -4973,20 +4970,20 @@ u8*v_fifo_mag_u8) return com_rslt; } /*! -* @brief This API is used to set stored -* magnetometer data in FIFO (all 3 axes) from the register 0x47 bit 5 -* -* @param v_fifo_mag_u8 : The value of fifo mag enble -* value | fifo mag -* ----------|------------------- -* 0x00 | no magnetometer data is stored -* 0x01 | magnetometer data is stored -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set stored + * magnetometer data in FIFO (all 3 axes) from the register 0x47 bit 5 + * + * @param v_fifo_mag_u8 : The value of fifo mag enble + * value | fifo mag + * ----------|------------------- + * 0x00 | no magnetometer data is stored + * 0x01 | magnetometer data is stored + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_mag_enable( u8 v_fifo_mag_u8) @@ -5024,25 +5021,25 @@ u8 v_fifo_mag_u8) return com_rslt; } /*! -* @brief This API is used to read stored -* accel data in FIFO (all 3 axes) from the register 0x47 bit 6 -* -* @param v_fifo_accel_u8 : The value of fifo accel enble -* value | fifo accel -* ----------|------------------- -* 0x00 | no accel data is stored -* 0x01 | accel data is stored -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read stored + * accel data in FIFO (all 3 axes) from the register 0x47 bit 6 + * + * @param v_fifo_accel_u8 : The value of fifo accel enble + * value | fifo accel + * ----------|------------------- + * 0x00 | no accel data is stored + * 0x01 | accel data is stored + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_accel_enable( -u8*v_fifo_accel_u8) +u8 *v_fifo_accel_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5063,22 +5060,22 @@ u8*v_fifo_accel_u8) return com_rslt; } /*! -* @brief This API is used to set stored -* accel data in FIFO (all 3 axes) from the register 0x47 bit 6 -* -* @param v_fifo_accel_u8 : The value of fifo accel enble -* value | fifo accel -* ----------|------------------- -* 0x00 | no accel data is stored -* 0x01 | accel data is stored -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set stored + * accel data in FIFO (all 3 axes) from the register 0x47 bit 6 + * + * @param v_fifo_accel_u8 : The value of fifo accel enble + * value | fifo accel + * ----------|------------------- + * 0x00 | no accel data is stored + * 0x01 | accel data is stored + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_accel_enable( u8 v_fifo_accel_u8) @@ -5112,25 +5109,25 @@ u8 v_fifo_accel_u8) return com_rslt; } /*! -* @brief This API is used to read stored -* gyro data in FIFO (all 3 axes) from the resister 0x47 bit 7 -* -* -* @param v_fifo_gyro_u8 : The value of fifo gyro enble -* value | fifo gyro -* ----------|------------------- -* 0x00 | no gyro data is stored -* 0x01 | gyro data is stored -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read stored + * gyro data in FIFO (all 3 axes) from the resister 0x47 bit 7 + * + * + * @param v_fifo_gyro_u8 : The value of fifo gyro enble + * value | fifo gyro + * ----------|------------------- + * 0x00 | no gyro data is stored + * 0x01 | gyro data is stored + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_fifo_gyro_enable( -u8*v_fifo_gyro_u8) +u8 *v_fifo_gyro_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5139,7 +5136,7 @@ u8*v_fifo_gyro_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read fifo gyro enable*/ + /* read fifo gyro enable */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_FIFO_GYRO_ENABLE__REG, &v_data_u8, @@ -5150,22 +5147,22 @@ u8*v_fifo_gyro_u8) return com_rslt; } /*! -* @brief This API is used to set stored -* gyro data in FIFO (all 3 axes) from the resister 0x47 bit 7 -* -* -* @param v_fifo_gyro_u8 : The value of fifo gyro enble -* value | fifo gyro -* ----------|------------------- -* 0x00 | no gyro data is stored -* 0x01 | gyro data is stored -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set stored + * gyro data in FIFO (all 3 axes) from the resister 0x47 bit 7 + * + * + * @param v_fifo_gyro_u8 : The value of fifo gyro enble + * value | fifo gyro + * ----------|------------------- + * 0x00 | no gyro data is stored + * 0x01 | gyro data is stored + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_fifo_gyro_enable( u8 v_fifo_gyro_u8) @@ -5199,23 +5196,23 @@ u8 v_fifo_gyro_u8) return com_rslt; } /*! -* @brief This API is used to read -* I2C device address of auxiliary mag from the register 0x4B bit 1 to 7 -* -* -* -* -* @param v_i2c_device_addr_u8 : The value of mag I2C device address -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read + * I2C device address of auxiliary mag from the register 0x4B bit 1 to 7 + * + * + * + * + * @param v_i2c_device_addr_u8 : The value of mag I2C device address + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_i2c_device_addr( -u8*v_i2c_device_addr_u8) +u8 *v_i2c_device_addr_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5235,20 +5232,20 @@ u8*v_i2c_device_addr_u8) return com_rslt; } /*! -* @brief This API is used to set -* I2C device address of auxiliary mag from the register 0x4B bit 1 to 7 -* -* -* -* -* @param v_i2c_device_addr_u8 : The value of mag I2C device address -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set + * I2C device address of auxiliary mag from the register 0x4B bit 1 to 7 + * + * + * + * + * @param v_i2c_device_addr_u8 : The value of mag I2C device address + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_i2c_device_addr( u8 v_i2c_device_addr_u8) @@ -5279,24 +5276,24 @@ u8 v_i2c_device_addr_u8) return com_rslt; } /*! -* @brief This API is used to read -* Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1 -* -* -* -* -* @param v_mag_burst_u8 : The data of mag burst read lenth -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read + * Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1 + * + * + * + * + * @param v_mag_burst_u8 : The data of mag burst read lenth + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_burst( -u8*v_mag_burst_u8) +u8 *v_mag_burst_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5316,21 +5313,21 @@ u8*v_mag_burst_u8) return com_rslt; } /*! -* @brief This API is used to set -* Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1 -* -* -* -* -* @param v_mag_burst_u8 : The data of mag burst read lenth -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set + * Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1 + * + * + * + * + * @param v_mag_burst_u8 : The data of mag burst read lenth + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_burst( u8 v_mag_burst_u8) @@ -5361,26 +5358,26 @@ u8 v_mag_burst_u8) return com_rslt; } /*! -* @brief This API is used to read -* trigger-readout offset in units of 2.5 ms. If set to zero, -* the offset is maximum, i.e. after readout a trigger -* is issued immediately. from the register 0x4C bit 2 to 5 -* -* -* -* -* @param v_mag_offset_u8 : The value of mag offset -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read + * trigger-readout offset in units of 2.5 ms. If set to zero, + * the offset is maximum, i.e. after readout a trigger + * is issued immediately. from the register 0x4C bit 2 to 5 + * + * + * + * + * @param v_mag_offset_u8 : The value of mag offset + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_offset( -u8*v_mag_offset_u8) +u8 *v_mag_offset_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5400,23 +5397,23 @@ u8*v_mag_offset_u8) return com_rslt; } /*! -* @brief This API is used to set -* trigger-readout offset in units of 2.5 ms. If set to zero, -* the offset is maximum, i.e. after readout a trigger -* is issued immediately. from the register 0x4C bit 2 to 5 -* -* -* -* -* @param v_mag_offset_u8 : The value of mag offset -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set + * trigger-readout offset in units of 2.5 ms. If set to zero, + * the offset is maximum, i.e. after readout a trigger + * is issued immediately. from the register 0x4C bit 2 to 5 + * + * + * + * + * @param v_mag_offset_u8 : The value of mag offset + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_offset( u8 v_mag_offset_u8) @@ -5445,31 +5442,31 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read -* Enable register access on MAG_IF[2] or MAG_IF[3] writes. -* This implies that the DATA registers are not updated with -* magnetometer values. Accessing magnetometer requires -* the magnetometer in normal mode in PMU_STATUS. -* from the register 0x4C bit 7 -* -* -* -* @param v_mag_manual_u8 : The value of mag manual enable -* value | mag manual -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read + * Enable register access on MAG_IF[2] or MAG_IF[3] writes. + * This implies that the DATA registers are not updated with + * magnetometer values. Accessing magnetometer requires + * the magnetometer in normal mode in PMU_STATUS. + * from the register 0x4C bit 7 + * + * + * + * @param v_mag_manual_u8 : The value of mag manual enable + * value | mag manual + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_manual_enable( -u8*v_mag_manual_u8) +u8 *v_mag_manual_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5478,7 +5475,7 @@ u8*v_mag_manual_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read mag manual*/ + /* read mag manual */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_MAG_MANUAL_ENABLE__REG, &v_data_u8, @@ -5490,28 +5487,28 @@ u8*v_mag_manual_u8) return com_rslt; } /*! -* @brief This API is used to set -* Enable register access on MAG_IF[2] or MAG_IF[3] writes. -* This implies that the DATA registers are not updated with -* magnetometer values. Accessing magnetometer requires -* the magnetometer in normal mode in PMU_STATUS. -* from the register 0x4C bit 7 -* -* -* -* @param v_mag_manual_u8 : The value of mag manual enable -* value | mag manual -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set + * Enable register access on MAG_IF[2] or MAG_IF[3] writes. + * This implies that the DATA registers are not updated with + * magnetometer values. Accessing magnetometer requires + * the magnetometer in normal mode in PMU_STATUS. + * from the register 0x4C bit 7 + * + * + * + * @param v_mag_manual_u8 : The value of mag manual enable + * value | mag manual + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_manual_enable( u8 v_mag_manual_u8) @@ -5547,25 +5544,25 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read data -* magnetometer address to read from the register 0x4D bit 0 to 7 -* @brief It used to provide mag read address of auxiliary mag -* -* -* -* -* @param v_mag_read_addr_u8 : The value of address need to be read -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read data + * magnetometer address to read from the register 0x4D bit 0 to 7 + * @brief It used to provide mag read address of auxiliary mag + * + * + * + * + * @param v_mag_read_addr_u8 : The value of address need to be read + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_read_addr( -u8*v_mag_read_addr_u8) +u8 *v_mag_read_addr_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5586,22 +5583,22 @@ u8*v_mag_read_addr_u8) return com_rslt; } /*! -* @brief This API is used to set -* magnetometer write address from the register 0x4D bit 0 to 7 -* @brief mag write address writes the address of auxiliary mag to write -* -* -* -* @param v_mag_read_addr_u8: -* The data of auxiliary mag address to write data -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to set + * magnetometer write address from the register 0x4D bit 0 to 7 + * @brief mag write address writes the address of auxiliary mag to write + * + * + * + * @param v_mag_read_addr_u8: + * The data of auxiliary mag address to write data + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_read_addr( u8 v_mag_read_addr_u8) { @@ -5620,24 +5617,24 @@ u8 v_mag_read_addr_u8) return com_rslt; } /*! -* @brief This API is used to read -* magnetometer write address from the register 0x4E bit 0 to 7 -* @brief mag write address writes the address of auxiliary mag to write -* -* -* -* @param v_mag_write_addr_u8: -* The data of auxiliary mag address to write data -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to read + * magnetometer write address from the register 0x4E bit 0 to 7 + * @brief mag write address writes the address of auxiliary mag to write + * + * + * + * @param v_mag_write_addr_u8: + * The data of auxiliary mag address to write data + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_write_addr( -u8*v_mag_write_addr_u8) +u8 *v_mag_write_addr_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5646,7 +5643,7 @@ u8*v_mag_write_addr_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the address of last written*/ + /* read the address of last written */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_WRITE_ADDR__REG, @@ -5658,22 +5655,22 @@ u8*v_mag_write_addr_u8) return com_rslt; } /*! -* @brief This API is used to set -* magnetometer write address from the register 0x4E bit 0 to 7 -* @brief mag write address writes the address of auxiliary mag to write -* -* -* -* @param v_mag_write_addr_u8: -* The data of auxiliary mag address to write data -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to set + * magnetometer write address from the register 0x4E bit 0 to 7 + * @brief mag write address writes the address of auxiliary mag to write + * + * + * + * @param v_mag_write_addr_u8: + * The data of auxiliary mag address to write data + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_write_addr( u8 v_mag_write_addr_u8) { @@ -5683,7 +5680,7 @@ u8 v_mag_write_addr_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* write the data of mag address to write data*/ + /* write the data of mag address to write data */ com_rslt = p_smi130->SMI130_BUS_WRITE_FUNC(p_smi130->dev_addr, SMI130_USER_WRITE_ADDR__REG, &v_mag_write_addr_u8, @@ -5692,24 +5689,24 @@ u8 v_mag_write_addr_u8) return com_rslt; } /*! -* @brief This API is used to read magnetometer write data -* form the resister 0x4F bit 0 to 7 -* @brief This writes the data will be wrote to mag -* -* -* -* @param v_mag_write_data_u8: The value of mag data -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read magnetometer write data + * form the resister 0x4F bit 0 to 7 + * @brief This writes the data will be wrote to mag + * + * + * + * @param v_mag_write_data_u8: The value of mag data + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_mag_write_data( -u8*v_mag_write_data_u8) +u8 *v_mag_write_data_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5729,21 +5726,21 @@ u8*v_mag_write_data_u8) return com_rslt; } /*! -* @brief This API is used to set magnetometer write data -* form the resister 0x4F bit 0 to 7 -* @brief This writes the data will be wrote to mag -* -* -* -* @param v_mag_write_data_u8: The value of mag data -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to set magnetometer write data + * form the resister 0x4F bit 0 to 7 + * @brief This writes the data will be wrote to mag + * + * + * + * @param v_mag_write_data_u8: The value of mag data + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_mag_write_data( u8 v_mag_write_data_u8) @@ -5762,39 +5759,39 @@ u8 v_mag_write_data_u8) return com_rslt; } /*! -* @brief This API is used to read -* interrupt enable from the register 0x50 bit 0 to 7 -* -* -* -* -* @param v_enable_u8 : Value to decided to select interrupt -* v_enable_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_ANY_MOTION_X_ENABLE -* 1 | SMI130_ANY_MOTION_Y_ENABLE -* 2 | SMI130_ANY_MOTION_Z_ENABLE -* 3 | SMI130_DOUBLE_TAP_ENABLE -* 4 | SMI130_SINGLE_TAP_ENABLE -* 5 | SMI130_ORIENT_ENABLE -* 6 | SMI130_FLAT_ENABLE -* -* @param v_intr_enable_zero_u8 : The interrupt enable value -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to read + * interrupt enable from the register 0x50 bit 0 to 7 + * + * + * + * + * @param v_enable_u8 : Value to decided to select interrupt + * v_enable_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_ANY_MOTION_X_ENABLE + * 1 | SMI130_ANY_MOTION_Y_ENABLE + * 2 | SMI130_ANY_MOTION_Z_ENABLE + * 3 | SMI130_DOUBLE_TAP_ENABLE + * 4 | SMI130_SINGLE_TAP_ENABLE + * 5 | SMI130_ORIENT_ENABLE + * 6 | SMI130_FLAT_ENABLE + * + * @param v_intr_enable_zero_u8 : The interrupt enable value + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_enable_0( -u8 v_enable_u8, u8*v_intr_enable_zero_u8) +u8 v_enable_u8, u8 *v_intr_enable_zero_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -5806,7 +5803,7 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) /* select interrupt to read*/ switch (v_enable_u8) { case SMI130_ANY_MOTION_X_ENABLE: - /* read the any motion interrupt x data*/ + /* read the any motion interrupt x data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, @@ -5817,7 +5814,7 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) SMI130_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE); break; case SMI130_ANY_MOTION_Y_ENABLE: - /* read the any motion interrupt y data*/ + /* read the any motion interrupt y data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, @@ -5828,7 +5825,7 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) SMI130_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE); break; case SMI130_ANY_MOTION_Z_ENABLE: - /* read the any motion interrupt z data*/ + /* read the any motion interrupt z data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, @@ -5839,7 +5836,7 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) SMI130_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE); break; case SMI130_DOUBLE_TAP_ENABLE: - /* read the double tap interrupt data*/ + /* read the double tap interrupt data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, @@ -5850,7 +5847,7 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) SMI130_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE); break; case SMI130_SINGLE_TAP_ENABLE: - /* read the single tap interrupt data*/ + /* read the single tap interrupt data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, @@ -5861,7 +5858,7 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) SMI130_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE); break; case SMI130_ORIENT_ENABLE: - /* read the orient interrupt data*/ + /* read the orient interrupt data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_0_ORIENT_ENABLE__REG, @@ -5871,7 +5868,7 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) SMI130_USER_INTR_ENABLE_0_ORIENT_ENABLE); break; case SMI130_FLAT_ENABLE: - /* read the flat interrupt data*/ + /* read the flat interrupt data */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_0_FLAT_ENABLE__REG, @@ -5888,37 +5885,37 @@ u8 v_enable_u8, u8*v_intr_enable_zero_u8) return com_rslt; } /*! -* @brief This API is used to set -* interrupt enable from the register 0x50 bit 0 to 7 -* -* -* -* -* @param v_enable_u8 : Value to decided to select interrupt -* v_enable_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_ANY_MOTION_X_ENABLE -* 1 | SMI130_ANY_MOTION_Y_ENABLE -* 2 | SMI130_ANY_MOTION_Z_ENABLE -* 3 | SMI130_DOUBLE_TAP_ENABLE -* 4 | SMI130_SINGLE_TAP_ENABLE -* 5 | SMI130_ORIENT_ENABLE -* 6 | SMI130_FLAT_ENABLE -* -* @param v_intr_enable_zero_u8 : The interrupt enable value -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to set + * interrupt enable from the register 0x50 bit 0 to 7 + * + * + * + * + * @param v_enable_u8 : Value to decided to select interrupt + * v_enable_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_ANY_MOTION_X_ENABLE + * 1 | SMI130_ANY_MOTION_Y_ENABLE + * 2 | SMI130_ANY_MOTION_Z_ENABLE + * 3 | SMI130_DOUBLE_TAP_ENABLE + * 4 | SMI130_SINGLE_TAP_ENABLE + * 5 | SMI130_ORIENT_ENABLE + * 6 | SMI130_FLAT_ENABLE + * + * @param v_intr_enable_zero_u8 : The interrupt enable value + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_enable_0( u8 v_enable_u8, u8 v_intr_enable_zero_u8) { @@ -5995,7 +5992,7 @@ if (p_smi130 == SMI130_NULL) { } break; case SMI130_SINGLE_TAP_ENABLE: - /* write single tap*/ + /* write single tap */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -6050,41 +6047,41 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read -* interrupt enable byte1 from the register 0x51 bit 0 to 6 -* @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable -* data ready, fifo full and fifo water mark. -* -* -* -* @param v_enable_u8 : The value of interrupt enable -* @param v_enable_u8 : Value to decided to select interrupt -* v_enable_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_HIGH_G_X_ENABLE -* 1 | SMI130_HIGH_G_Y_ENABLE -* 2 | SMI130_HIGH_G_Z_ENABLE -* 3 | SMI130_LOW_G_ENABLE -* 4 | SMI130_DATA_RDY_ENABLE -* 5 | SMI130_FIFO_FULL_ENABLE -* 6 | SMI130_FIFO_WM_ENABLE -* -* @param v_intr_enable_1_u8 : The interrupt enable value -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to read + * interrupt enable byte1 from the register 0x51 bit 0 to 6 + * @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable + * data ready, fifo full and fifo water mark. + * + * + * + * @param v_enable_u8 : The value of interrupt enable + * @param v_enable_u8 : Value to decided to select interrupt + * v_enable_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_HIGH_G_X_ENABLE + * 1 | SMI130_HIGH_G_Y_ENABLE + * 2 | SMI130_HIGH_G_Z_ENABLE + * 3 | SMI130_LOW_G_ENABLE + * 4 | SMI130_DATA_RDY_ENABLE + * 5 | SMI130_FIFO_FULL_ENABLE + * 6 | SMI130_FIFO_WM_ENABLE + * + * @param v_intr_enable_1_u8 : The interrupt enable value + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_enable_1( -u8 v_enable_u8, u8*v_intr_enable_1_u8) +u8 v_enable_u8, u8 *v_intr_enable_1_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -6122,7 +6119,7 @@ u8 v_enable_u8, u8*v_intr_enable_1_u8) SMI130_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE); break; case SMI130_LOW_G_ENABLE: - /* read low_g interrupt*/ + /* read low_g interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_1_LOW_G_ENABLE__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -6130,7 +6127,7 @@ u8 v_enable_u8, u8*v_intr_enable_1_u8) SMI130_USER_INTR_ENABLE_1_LOW_G_ENABLE); break; case SMI130_DATA_RDY_ENABLE: - /* read data ready interrupt*/ + /* read data ready interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__REG, @@ -6139,7 +6136,7 @@ u8 v_enable_u8, u8*v_intr_enable_1_u8) SMI130_USER_INTR_ENABLE_1_DATA_RDY_ENABLE); break; case SMI130_FIFO_FULL_ENABLE: - /* read fifo full interrupt*/ + /* read fifo full interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__REG, @@ -6148,7 +6145,7 @@ u8 v_enable_u8, u8*v_intr_enable_1_u8) SMI130_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE); break; case SMI130_FIFO_WM_ENABLE: - /* read fifo water mark interrupt*/ + /* read fifo water mark interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__REG, @@ -6164,39 +6161,39 @@ u8 v_enable_u8, u8*v_intr_enable_1_u8) return com_rslt; } /*! -* @brief This API is used to set -* interrupt enable byte1 from the register 0x51 bit 0 to 6 -* @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable -* data ready, fifo full and fifo water mark. -* -* -* -* @param v_enable_u8 : The value of interrupt enable -* @param v_enable_u8 : Value to decided to select interrupt -* v_enable_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_HIGH_G_X_ENABLE -* 1 | SMI130_HIGH_G_Y_ENABLE -* 2 | SMI130_HIGH_G_Z_ENABLE -* 3 | SMI130_LOW_G_ENABLE -* 4 | SMI130_DATA_RDY_ENABLE -* 5 | SMI130_FIFO_FULL_ENABLE -* 6 | SMI130_FIFO_WM_ENABLE -* -* @param v_intr_enable_1_u8 : The interrupt enable value -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to set + * interrupt enable byte1 from the register 0x51 bit 0 to 6 + * @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable + * data ready, fifo full and fifo water mark. + * + * + * + * @param v_enable_u8 : The value of interrupt enable + * @param v_enable_u8 : Value to decided to select interrupt + * v_enable_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_HIGH_G_X_ENABLE + * 1 | SMI130_HIGH_G_Y_ENABLE + * 2 | SMI130_HIGH_G_Z_ENABLE + * 3 | SMI130_LOW_G_ENABLE + * 4 | SMI130_DATA_RDY_ENABLE + * 5 | SMI130_FIFO_FULL_ENABLE + * 6 | SMI130_FIFO_WM_ENABLE + * + * @param v_intr_enable_1_u8 : The interrupt enable value + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_enable_1( u8 v_enable_u8, u8 v_intr_enable_1_u8) { @@ -6334,35 +6331,35 @@ u8 v_enable_u8, u8 v_intr_enable_1_u8) return com_rslt; } /*! -* @brief This API is used to read -* interrupt enable byte2 from the register bit 0x52 bit 0 to 3 -* @brief It reads no motion x,y and z -* -* -* -* @param v_enable_u8: The value of interrupt enable -* v_enable_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_NOMOTION_X_ENABLE -* 1 | SMI130_NOMOTION_Y_ENABLE -* 2 | SMI130_NOMOTION_Z_ENABLE -* -* @param v_intr_enable_2_u8 : The interrupt enable value -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to read + * interrupt enable byte2 from the register bit 0x52 bit 0 to 3 + * @brief It reads no motion x,y and z + * + * + * + * @param v_enable_u8: The value of interrupt enable + * v_enable_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_NOMOTION_X_ENABLE + * 1 | SMI130_NOMOTION_Y_ENABLE + * 2 | SMI130_NOMOTION_Z_ENABLE + * + * @param v_intr_enable_2_u8 : The interrupt enable value + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_enable_2( -u8 v_enable_u8, u8*v_intr_enable_2_u8) +u8 v_enable_u8, u8 *v_intr_enable_2_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -6373,7 +6370,7 @@ u8 v_enable_u8, u8*v_intr_enable_2_u8) } else { switch (v_enable_u8) { case SMI130_NOMOTION_X_ENABLE: - /* read no motion x*/ + /* read no motion x */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__REG, @@ -6382,7 +6379,7 @@ u8 v_enable_u8, u8*v_intr_enable_2_u8) SMI130_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE); break; case SMI130_NOMOTION_Y_ENABLE: - /* read no motion y*/ + /* read no motion y */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, @@ -6392,7 +6389,7 @@ u8 v_enable_u8, u8*v_intr_enable_2_u8) SMI130_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE); break; case SMI130_NOMOTION_Z_ENABLE: - /* read no motion z*/ + /* read no motion z */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__REG, @@ -6408,33 +6405,33 @@ u8 v_enable_u8, u8*v_intr_enable_2_u8) return com_rslt; } /*! -* @brief This API is used to set -* interrupt enable byte2 from the register bit 0x52 bit 0 to 3 -* @brief It reads no motion x,y and z -* -* -* -* @param v_enable_u8: The value of interrupt enable -* v_enable_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_NOMOTION_X_ENABLE -* 1 | SMI130_NOMOTION_Y_ENABLE -* 2 | SMI130_NOMOTION_Z_ENABLE -* -* @param v_intr_enable_2_u8 : The interrupt enable value -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to set + * interrupt enable byte2 from the register bit 0x52 bit 0 to 3 + * @brief It reads no motion x,y and z + * + * + * + * @param v_enable_u8: The value of interrupt enable + * v_enable_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_NOMOTION_X_ENABLE + * 1 | SMI130_NOMOTION_Y_ENABLE + * 2 | SMI130_NOMOTION_Z_ENABLE + * + * @param v_intr_enable_2_u8 : The interrupt enable value + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_enable_2( u8 v_enable_u8, u8 v_intr_enable_2_u8) { @@ -6447,7 +6444,7 @@ if (p_smi130 == SMI130_NULL) { } else { switch (v_enable_u8) { case SMI130_NOMOTION_X_ENABLE: - /* write no motion x*/ + /* write no motion x */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__REG, @@ -6464,7 +6461,7 @@ if (p_smi130 == SMI130_NULL) { } break; case SMI130_NOMOTION_Y_ENABLE: - /* write no motion y*/ + /* write no motion y */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__REG, @@ -6481,7 +6478,7 @@ if (p_smi130 == SMI130_NULL) { } break; case SMI130_NOMOTION_Z_ENABLE: - /* write no motion z*/ + /* write no motion z */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__REG, @@ -6505,25 +6502,25 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read -* interrupt enable step detector interrupt from -* the register bit 0x52 bit 3 -* -* -* -* -* @param v_step_intr_u8 : The value of step detector interrupt enable -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to read + * interrupt enable step detector interrupt from + * the register bit 0x52 bit 3 + * + * + * + * + * @param v_step_intr_u8 : The value of step detector interrupt enable + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_step_detector_enable( -u8*v_step_intr_u8) +u8 *v_step_intr_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -6543,23 +6540,23 @@ u8*v_step_intr_u8) return com_rslt; } /*! -* @brief This API is used to set -* interrupt enable step detector interrupt from -* the register bit 0x52 bit 3 -* -* -* -* -* @param v_step_intr_u8 : The value of step detector interrupt enable -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API is used to set + * interrupt enable step detector interrupt from + * the register bit 0x52 bit 3 + * + * + * + * + * @param v_step_intr_u8 : The value of step detector interrupt enable + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_step_detector_enable( u8 v_step_intr_u8) { @@ -6588,31 +6585,31 @@ u8 v_step_intr_u8) return com_rslt; } /*! -* @brief Configure trigger condition of interrupt1 -* and interrupt2 pin from the register 0x53 -* @brief interrupt1 - bit 0 -* @brief interrupt2 - bit 4 -* -* @param v_channel_u8: The value of edge trigger selection -* v_channel_u8 | Edge trigger -* ---------------|--------------- -* 0 | SMI130_INTR1_EDGE_CTRL -* 1 | SMI130_INTR2_EDGE_CTRL -* -* @param v_intr_edge_ctrl_u8 : The value of edge trigger enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_EDGE -* 0x00 | SMI130_LEVEL -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Configure trigger condition of interrupt1 + * and interrupt2 pin from the register 0x53 + * @brief interrupt1 - bit 0 + * @brief interrupt2 - bit 4 + * + * @param v_channel_u8: The value of edge trigger selection + * v_channel_u8 | Edge trigger + * ---------------|--------------- + * 0 | SMI130_INTR1_EDGE_CTRL + * 1 | SMI130_INTR2_EDGE_CTRL + * + * @param v_intr_edge_ctrl_u8 : The value of edge trigger enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_EDGE + * 0x00 | SMI130_LEVEL + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_edge_ctrl( -u8 v_channel_u8, u8*v_intr_edge_ctrl_u8) +u8 v_channel_u8, u8 *v_intr_edge_ctrl_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -6646,28 +6643,28 @@ u8 v_channel_u8, u8*v_intr_edge_ctrl_u8) return com_rslt; } /*! -* @brief Configure trigger condition of interrupt1 -* and interrupt2 pin from the register 0x53 -* @brief interrupt1 - bit 0 -* @brief interrupt2 - bit 4 -* -* @param v_channel_u8: The value of edge trigger selection -* v_channel_u8 | Edge trigger -* ---------------|--------------- -* 0 | SMI130_INTR1_EDGE_CTRL -* 1 | SMI130_INTR2_EDGE_CTRL -* -* @param v_intr_edge_ctrl_u8 : The value of edge trigger enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_EDGE -* 0x00 | SMI130_LEVEL -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Configure trigger condition of interrupt1 + * and interrupt2 pin from the register 0x53 + * @brief interrupt1 - bit 0 + * @brief interrupt2 - bit 4 + * + * @param v_channel_u8: The value of edge trigger selection + * v_channel_u8 | Edge trigger + * ---------------|--------------- + * 0 | SMI130_INTR1_EDGE_CTRL + * 1 | SMI130_INTR2_EDGE_CTRL + * + * @param v_intr_edge_ctrl_u8 : The value of edge trigger enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_EDGE + * 0x00 | SMI130_LEVEL + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_edge_ctrl( u8 v_channel_u8, u8 v_intr_edge_ctrl_u8) @@ -6718,31 +6715,31 @@ u8 v_channel_u8, u8 v_intr_edge_ctrl_u8) return com_rslt; } /*! -* @brief API used for get the Configure level condition of interrupt1 -* and interrupt2 pin form the register 0x53 -* @brief interrupt1 - bit 1 -* @brief interrupt2 - bit 5 -* -* @param v_channel_u8: The value of level condition selection -* v_channel_u8 | level selection -* ---------------|--------------- -* 0 | SMI130_INTR1_LEVEL -* 1 | SMI130_INTR2_LEVEL -* -* @param v_intr_level_u8 : The value of level of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_LEVEL_HIGH -* 0x00 | SMI130_LEVEL_LOW -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used for get the Configure level condition of interrupt1 + * and interrupt2 pin form the register 0x53 + * @brief interrupt1 - bit 1 + * @brief interrupt2 - bit 5 + * + * @param v_channel_u8: The value of level condition selection + * v_channel_u8 | level selection + * ---------------|--------------- + * 0 | SMI130_INTR1_LEVEL + * 1 | SMI130_INTR2_LEVEL + * + * @param v_intr_level_u8 : The value of level of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_LEVEL_HIGH + * 0x00 | SMI130_LEVEL_LOW + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_level( -u8 v_channel_u8, u8*v_intr_level_u8) +u8 v_channel_u8, u8 *v_intr_level_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -6776,28 +6773,28 @@ u8 v_channel_u8, u8*v_intr_level_u8) return com_rslt; } /*! -* @brief API used for set the Configure level condition of interrupt1 -* and interrupt2 pin form the register 0x53 -* @brief interrupt1 - bit 1 -* @brief interrupt2 - bit 5 -* -* @param v_channel_u8: The value of level condition selection -* v_channel_u8 | level selection -* ---------------|--------------- -* 0 | SMI130_INTR1_LEVEL -* 1 | SMI130_INTR2_LEVEL -* -* @param v_intr_level_u8 : The value of level of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_LEVEL_HIGH -* 0x00 | SMI130_LEVEL_LOW -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used for set the Configure level condition of interrupt1 + * and interrupt2 pin form the register 0x53 + * @brief interrupt1 - bit 1 + * @brief interrupt2 - bit 5 + * + * @param v_channel_u8: The value of level condition selection + * v_channel_u8 | level selection + * ---------------|--------------- + * 0 | SMI130_INTR1_LEVEL + * 1 | SMI130_INTR2_LEVEL + * + * @param v_intr_level_u8 : The value of level of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_LEVEL_HIGH + * 0x00 | SMI130_LEVEL_LOW + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_level( u8 v_channel_u8, u8 v_intr_level_u8) @@ -6846,34 +6843,34 @@ u8 v_channel_u8, u8 v_intr_level_u8) return com_rslt; } /*! -* @brief API used to get configured output enable of interrupt1 -* and interrupt2 from the register 0x53 -* @brief interrupt1 - bit 2 -* @brief interrupt2 - bit 6 -* -* -* @param v_channel_u8: The value of output type enable selection -* v_channel_u8 | level selection -* ---------------|--------------- -* 0 | SMI130_INTR1_OUTPUT_TYPE -* 1 | SMI130_INTR2_OUTPUT_TYPE -* -* @param v_intr_output_type_u8 : -* The value of output type of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_OPEN_DRAIN -* 0x00 | SMI130_PUSH_PULL -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used to get configured output enable of interrupt1 + * and interrupt2 from the register 0x53 + * @brief interrupt1 - bit 2 + * @brief interrupt2 - bit 6 + * + * + * @param v_channel_u8: The value of output type enable selection + * v_channel_u8 | level selection + * ---------------|--------------- + * 0 | SMI130_INTR1_OUTPUT_TYPE + * 1 | SMI130_INTR2_OUTPUT_TYPE + * + * @param v_intr_output_type_u8 : + * The value of output type of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_OPEN_DRAIN + * 0x00 | SMI130_PUSH_PULL + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_output_type( -u8 v_channel_u8, u8*v_intr_output_type_u8) +u8 v_channel_u8, u8 *v_intr_output_type_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -6907,31 +6904,31 @@ u8 v_channel_u8, u8*v_intr_output_type_u8) return com_rslt; } /*! -* @brief API used to set output enable of interrupt1 -* and interrupt2 from the register 0x53 -* @brief interrupt1 - bit 2 -* @brief interrupt2 - bit 6 -* -* -* @param v_channel_u8: The value of output type enable selection -* v_channel_u8 | level selection -* ---------------|--------------- -* 0 | SMI130_INTR1_OUTPUT_TYPE -* 1 | SMI130_INTR2_OUTPUT_TYPE -* -* @param v_intr_output_type_u8 : -* The value of output type of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_OPEN_DRAIN -* 0x00 | SMI130_PUSH_PULL -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used to set output enable of interrupt1 + * and interrupt2 from the register 0x53 + * @brief interrupt1 - bit 2 + * @brief interrupt2 - bit 6 + * + * + * @param v_channel_u8: The value of output type enable selection + * v_channel_u8 | level selection + * ---------------|--------------- + * 0 | SMI130_INTR1_OUTPUT_TYPE + * 1 | SMI130_INTR2_OUTPUT_TYPE + * + * @param v_intr_output_type_u8 : + * The value of output type of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_OPEN_DRAIN + * 0x00 | SMI130_PUSH_PULL + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_output_type( u8 v_channel_u8, u8 v_intr_output_type_u8) @@ -6982,34 +6979,34 @@ u8 v_channel_u8, u8 v_intr_output_type_u8) return com_rslt; } /*! -* @brief API used to get the Output enable for interrupt1 -* and interrupt1 pin from the register 0x53 -* @brief interrupt1 - bit 3 -* @brief interrupt2 - bit 7 -* -* @param v_channel_u8: The value of output enable selection -* v_channel_u8 | level selection -* ---------------|--------------- -* 0 | SMI130_INTR1_OUTPUT_TYPE -* 1 | SMI130_INTR2_OUTPUT_TYPE -* -* @param v_output_enable_u8 : -* The value of output enable of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_INPUT -* 0x00 | SMI130_OUTPUT -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used to get the Output enable for interrupt1 + * and interrupt1 pin from the register 0x53 + * @brief interrupt1 - bit 3 + * @brief interrupt2 - bit 7 + * + * @param v_channel_u8: The value of output enable selection + * v_channel_u8 | level selection + * ---------------|--------------- + * 0 | SMI130_INTR1_OUTPUT_TYPE + * 1 | SMI130_INTR2_OUTPUT_TYPE + * + * @param v_output_enable_u8 : + * The value of output enable of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_INPUT + * 0x00 | SMI130_OUTPUT + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_output_enable( -u8 v_channel_u8, u8*v_output_enable_u8) +u8 v_channel_u8, u8 *v_output_enable_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7043,31 +7040,31 @@ u8 v_channel_u8, u8*v_output_enable_u8) return com_rslt; } /*! -* @brief API used to set the Output enable for interrupt1 -* and interrupt1 pin from the register 0x53 -* @brief interrupt1 - bit 3 -* @brief interrupt2 - bit 7 -* -* @param v_channel_u8: The value of output enable selection -* v_channel_u8 | level selection -* ---------------|--------------- -* 0 | SMI130_INTR1_OUTPUT_TYPE -* 1 | SMI130_INTR2_OUTPUT_TYPE -* -* @param v_output_enable_u8 : -* The value of output enable of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_INPUT -* 0x00 | SMI130_OUTPUT -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used to set the Output enable for interrupt1 + * and interrupt1 pin from the register 0x53 + * @brief interrupt1 - bit 3 + * @brief interrupt2 - bit 7 + * + * @param v_channel_u8: The value of output enable selection + * v_channel_u8 | level selection + * ---------------|--------------- + * 0 | SMI130_INTR1_OUTPUT_TYPE + * 1 | SMI130_INTR2_OUTPUT_TYPE + * + * @param v_output_enable_u8 : + * The value of output enable of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_INPUT + * 0x00 | SMI130_OUTPUT + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_output_enable( u8 v_channel_u8, u8 v_output_enable_u8) @@ -7154,7 +7151,7 @@ u8 v_channel_u8, u8 v_output_enable_u8) * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_latch_intr( -u8*v_latch_intr_u8) +u8 *v_latch_intr_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7163,7 +7160,7 @@ u8*v_latch_intr_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the latch duration value*/ + /* read the latch duration value */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_LATCH__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -7202,9 +7199,9 @@ u8*v_latch_intr_u8) * * * -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error * * */ @@ -7218,7 +7215,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_latch_intr(u8 v_latch_intr_u8) return E_SMI130_NULL_PTR; } else { if (v_latch_intr_u8 <= SMI130_MAX_LATCH_INTR) { - /* write the latch duration value*/ + /* write the latch duration value */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_LATCH__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -7237,34 +7234,34 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_latch_intr(u8 v_latch_intr_u8) return com_rslt; } /*! -* @brief API used to get input enable for interrupt1 -* and interrupt2 pin from the register 0x54 -* @brief interrupt1 - bit 4 -* @brief interrupt2 - bit 5 -* -* @param v_channel_u8: The value of input enable selection -* v_channel_u8 | input selection -* ---------------|--------------- -* 0 | SMI130_INTR1_INPUT_ENABLE -* 1 | SMI130_INTR2_INPUT_ENABLE -* -* @param v_input_en_u8 : -* The value of input enable of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_INPUT -* 0x00 | SMI130_OUTPUT -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used to get input enable for interrupt1 + * and interrupt2 pin from the register 0x54 + * @brief interrupt1 - bit 4 + * @brief interrupt2 - bit 5 + * + * @param v_channel_u8: The value of input enable selection + * v_channel_u8 | input selection + * ---------------|--------------- + * 0 | SMI130_INTR1_INPUT_ENABLE + * 1 | SMI130_INTR2_INPUT_ENABLE + * + * @param v_input_en_u8 : + * The value of input enable of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_INPUT + * 0x00 | SMI130_OUTPUT + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_input_enable( -u8 v_channel_u8, u8*v_input_en_u8) +u8 v_channel_u8, u8 *v_input_en_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7297,31 +7294,31 @@ u8 v_channel_u8, u8*v_input_en_u8) return com_rslt; } /*! -* @brief API used to set input enable for interrupt1 -* and interrupt2 pin from the register 0x54 -* @brief interrupt1 - bit 4 -* @brief interrupt2 - bit 5 -* -* @param v_channel_u8: The value of input enable selection -* v_channel_u8 | input selection -* ---------------|--------------- -* 0 | SMI130_INTR1_INPUT_ENABLE -* 1 | SMI130_INTR2_INPUT_ENABLE -* -* @param v_input_en_u8 : -* The value of input enable of interrupt enable -* value | Behaviour -* ----------|------------------- -* 0x01 | SMI130_INPUT -* 0x00 | SMI130_OUTPUT -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief API used to set input enable for interrupt1 + * and interrupt2 pin from the register 0x54 + * @brief interrupt1 - bit 4 + * @brief interrupt2 - bit 5 + * + * @param v_channel_u8: The value of input enable selection + * v_channel_u8 | input selection + * ---------------|--------------- + * 0 | SMI130_INTR1_INPUT_ENABLE + * 1 | SMI130_INTR2_INPUT_ENABLE + * + * @param v_input_en_u8 : + * The value of input enable of interrupt enable + * value | Behaviour + * ----------|------------------- + * 0x01 | SMI130_INPUT + * 0x00 | SMI130_OUTPUT + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_input_enable( u8 v_channel_u8, u8 v_input_en_u8) @@ -7367,34 +7364,34 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief reads the Low g interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 0 in the register 0x55 -* @brief interrupt2 bit 0 in the register 0x57 -* -* -* @param v_channel_u8: The value of low_g selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_LOW_G -* 1 | SMI130_INTR2_MAP_LOW_G -* -* @param v_intr_low_g_u8 : The value of low_g enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief reads the Low g interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 0 in the register 0x55 + * @brief interrupt2 bit 0 in the register 0x57 + * + * + * @param v_channel_u8: The value of low_g selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_LOW_G + * 1 | SMI130_INTR2_MAP_LOW_G + * + * @param v_intr_low_g_u8 : The value of low_g enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_g( -u8 v_channel_u8, u8*v_intr_low_g_u8) +u8 v_channel_u8, u8 *v_intr_low_g_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7404,7 +7401,7 @@ u8 v_channel_u8, u8*v_intr_low_g_u8) return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* read the low_g interrupt*/ + /* read the low_g interrupt */ case SMI130_INTR1_MAP_LOW_G: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_MAP_0_INTR1_LOW_G__REG, @@ -7427,31 +7424,31 @@ u8 v_channel_u8, u8*v_intr_low_g_u8) return com_rslt; } /*! -* @brief set the Low g interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 0 in the register 0x55 -* @brief interrupt2 bit 0 in the register 0x57 -* -* -* @param v_channel_u8: The value of low_g selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_LOW_G -* 1 | SMI130_INTR2_MAP_LOW_G -* -* @param v_intr_low_g_u8 : The value of low_g enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief set the Low g interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 0 in the register 0x55 + * @brief interrupt2 bit 0 in the register 0x57 + * + * + * @param v_channel_u8: The value of low_g selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_LOW_G + * 1 | SMI130_INTR2_MAP_LOW_G + * + * @param v_intr_low_g_u8 : The value of low_g enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_g( u8 v_channel_u8, u8 v_intr_low_g_u8) @@ -7468,12 +7465,12 @@ if (p_smi130 == SMI130_NULL) { } else { /* check the step detector interrupt enable status*/ com_rslt = smi130_get_step_detector_enable(&v_step_det_stat_u8); - /* disable the step detector interrupt*/ + /* disable the step detector interrupt */ if (v_step_det_stat_u8 != SMI130_INIT_VALUE) com_rslt += smi130_set_step_detector_enable(SMI130_INIT_VALUE); /* check the step counter interrupt enable status*/ com_rslt += smi130_get_step_counter_enable(&v_step_cnt_stat_u8); - /* disable the step counter interrupt*/ + /* disable the step counter interrupt */ if (v_step_cnt_stat_u8 != SMI130_INIT_VALUE) com_rslt += smi130_set_step_counter_enable( SMI130_INIT_VALUE); @@ -7511,35 +7508,35 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads the HIGH g interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 1 in the register 0x55 -* @brief interrupt2 bit 1 in the register 0x57 -* -* -* @param v_channel_u8: The value of high_g selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_HIGH_G -* 1 | SMI130_INTR2_MAP_HIGH_G -* -* @param v_intr_high_g_u8 : The value of high_g enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads the HIGH g interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 1 in the register 0x55 + * @brief interrupt2 bit 1 in the register 0x57 + * + * + * @param v_channel_u8: The value of high_g selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_HIGH_G + * 1 | SMI130_INTR2_MAP_HIGH_G + * + * @param v_intr_high_g_u8 : The value of high_g enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_high_g( -u8 v_channel_u8, u8*v_intr_high_g_u8) +u8 v_channel_u8, u8 *v_intr_high_g_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7572,32 +7569,32 @@ u8 v_channel_u8, u8*v_intr_high_g_u8) return com_rslt; } /*! -* @brief Write the HIGH g interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 1 in the register 0x55 -* @brief interrupt2 bit 1 in the register 0x57 -* -* -* @param v_channel_u8: The value of high_g selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_HIGH_G -* 1 | SMI130_INTR2_MAP_HIGH_G -* -* @param v_intr_high_g_u8 : The value of high_g enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write the HIGH g interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 1 in the register 0x55 + * @brief interrupt2 bit 1 in the register 0x57 + * + * + * @param v_channel_u8: The value of high_g selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_HIGH_G + * 1 | SMI130_INTR2_MAP_HIGH_G + * + * @param v_intr_high_g_u8 : The value of high_g enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_high_g( u8 v_channel_u8, u8 v_intr_high_g_u8) @@ -7643,35 +7640,35 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads the Any motion interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 2 in the register 0x55 -* @brief interrupt2 bit 2 in the register 0x57 -* -* -* @param v_channel_u8: The value of any motion selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_ANY_MOTION -* 1 | SMI130_INTR2_MAP_ANY_MOTION -* -* @param v_intr_any_motion_u8 : The value of any motion enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads the Any motion interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 2 in the register 0x55 + * @brief interrupt2 bit 2 in the register 0x57 + * + * + * @param v_channel_u8: The value of any motion selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_ANY_MOTION + * 1 | SMI130_INTR2_MAP_ANY_MOTION + * + * @param v_intr_any_motion_u8 : The value of any motion enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_any_motion( -u8 v_channel_u8, u8*v_intr_any_motion_u8) +u8 v_channel_u8, u8 *v_intr_any_motion_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7681,7 +7678,7 @@ u8 v_channel_u8, u8*v_intr_any_motion_u8) return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* read the any motion interrupt*/ + /* read the any motion interrupt */ case SMI130_INTR1_MAP_ANY_MOTION: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_MAP_0_INTR1_ANY_MOTION__REG, @@ -7704,32 +7701,32 @@ u8 v_channel_u8, u8*v_intr_any_motion_u8) return com_rslt; } /*! -* @brief Write the Any motion interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 2 in the register 0x55 -* @brief interrupt2 bit 2 in the register 0x57 -* -* -* @param v_channel_u8: The value of any motion selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_ANY_MOTION -* 1 | SMI130_INTR2_MAP_ANY_MOTION -* -* @param v_intr_any_motion_u8 : The value of any motion enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write the Any motion interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 2 in the register 0x55 + * @brief interrupt2 bit 2 in the register 0x57 + * + * + * @param v_channel_u8: The value of any motion selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_ANY_MOTION + * 1 | SMI130_INTR2_MAP_ANY_MOTION + * + * @param v_intr_any_motion_u8 : The value of any motion enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_any_motion( u8 v_channel_u8, u8 v_intr_any_motion_u8) @@ -7742,14 +7739,14 @@ u8 sig_mot_stat = SMI130_INIT_VALUE; if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the status of significant motion interrupt*/ + /* read the status of significant motion interrupt */ com_rslt = smi130_get_intr_significant_motion_select(&sig_mot_stat); - /* disable the significant motion interrupt*/ + /* disable the significant motion interrupt */ if (sig_mot_stat != SMI130_INIT_VALUE) com_rslt += smi130_set_intr_significant_motion_select( SMI130_INIT_VALUE); switch (v_channel_u8) { - /* write the any motion interrupt*/ + /* write the any motion interrupt */ case SMI130_INTR1_MAP_ANY_MOTION: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_MAP_0_INTR1_ANY_MOTION__REG, @@ -7784,34 +7781,34 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads the No motion interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 3 in the register 0x55 -* @brief interrupt2 bit 3 in the register 0x57 -* -* -* @param v_channel_u8: The value of no motion selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_NOMO -* 1 | SMI130_INTR2_MAP_NOMO -* -* @param v_intr_nomotion_u8 : The value of no motion enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads the No motion interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 3 in the register 0x55 + * @brief interrupt2 bit 3 in the register 0x57 + * + * + * @param v_channel_u8: The value of no motion selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_NOMO + * 1 | SMI130_INTR2_MAP_NOMO + * + * @param v_intr_nomotion_u8 : The value of no motion enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_nomotion( -u8 v_channel_u8, u8*v_intr_nomotion_u8) +u8 v_channel_u8, u8 *v_intr_nomotion_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7844,31 +7841,31 @@ u8 v_channel_u8, u8*v_intr_nomotion_u8) return com_rslt; } /*! -* @brief Write the No motion interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 3 in the register 0x55 -* @brief interrupt2 bit 3 in the register 0x57 -* -* -* @param v_channel_u8: The value of no motion selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_NOMO -* 1 | SMI130_INTR2_MAP_NOMO -* -* @param v_intr_nomotion_u8 : The value of no motion enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write the No motion interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 3 in the register 0x55 + * @brief interrupt2 bit 3 in the register 0x57 + * + * + * @param v_channel_u8: The value of no motion selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_NOMO + * 1 | SMI130_INTR2_MAP_NOMO + * + * @param v_intr_nomotion_u8 : The value of no motion enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_nomotion( u8 v_channel_u8, u8 v_intr_nomotion_u8) @@ -7916,33 +7913,33 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads the Double Tap interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 4 in the register 0x55 -* @brief interrupt2 bit 4 in the register 0x57 -* -* -* @param v_channel_u8: The value of double tap interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_DOUBLE_TAP -* 1 | SMI130_INTR2_MAP_DOUBLE_TAP -* -* @param v_intr_double_tap_u8 : The value of double tap enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads the Double Tap interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 4 in the register 0x55 + * @brief interrupt2 bit 4 in the register 0x57 + * + * + * @param v_channel_u8: The value of double tap interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_DOUBLE_TAP + * 1 | SMI130_INTR2_MAP_DOUBLE_TAP + * + * @param v_intr_double_tap_u8 : The value of double tap enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_double_tap( -u8 v_channel_u8, u8*v_intr_double_tap_u8) +u8 v_channel_u8, u8 *v_intr_double_tap_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -7974,30 +7971,30 @@ u8 v_channel_u8, u8*v_intr_double_tap_u8) return com_rslt; } /*! -* @brief Write the Double Tap interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 4 in the register 0x55 -* @brief interrupt2 bit 4 in the register 0x57 -* -* -* @param v_channel_u8: The value of double tap interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_DOUBLE_TAP -* 1 | SMI130_INTR2_MAP_DOUBLE_TAP -* -* @param v_intr_double_tap_u8 : The value of double tap enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write the Double Tap interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 4 in the register 0x55 + * @brief interrupt2 bit 4 in the register 0x57 + * + * + * @param v_channel_u8: The value of double tap interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_DOUBLE_TAP + * 1 | SMI130_INTR2_MAP_DOUBLE_TAP + * + * @param v_intr_double_tap_u8 : The value of double tap enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_double_tap( u8 v_channel_u8, u8 v_intr_double_tap_u8) @@ -8010,7 +8007,7 @@ if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* set the double tap interrupt*/ + /* set the double tap interrupt */ case SMI130_INTR1_MAP_DOUBLE_TAP: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__REG, @@ -8045,34 +8042,34 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads the Single Tap interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 5 in the register 0x55 -* @brief interrupt2 bit 5 in the register 0x57 -* -* -* @param v_channel_u8: The value of single tap interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_SINGLE_TAP -* 1 | SMI130_INTR2_MAP_SINGLE_TAP -* -* @param v_intr_single_tap_u8 : The value of single tap enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads the Single Tap interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 5 in the register 0x55 + * @brief interrupt2 bit 5 in the register 0x57 + * + * + * @param v_channel_u8: The value of single tap interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_SINGLE_TAP + * 1 | SMI130_INTR2_MAP_SINGLE_TAP + * + * @param v_intr_single_tap_u8 : The value of single tap enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_single_tap( -u8 v_channel_u8, u8*v_intr_single_tap_u8) +u8 v_channel_u8, u8 *v_intr_single_tap_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -8105,31 +8102,31 @@ u8 v_channel_u8, u8*v_intr_single_tap_u8) return com_rslt; } /*! -* @brief Write the Single Tap interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 5 in the register 0x55 -* @brief interrupt2 bit 5 in the register 0x57 -* -* -* @param v_channel_u8: The value of single tap interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_SINGLE_TAP -* 1 | SMI130_INTR2_MAP_SINGLE_TAP -* -* @param v_intr_single_tap_u8 : The value of single tap enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write the Single Tap interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 5 in the register 0x55 + * @brief interrupt2 bit 5 in the register 0x57 + * + * + * @param v_channel_u8: The value of single tap interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_SINGLE_TAP + * 1 | SMI130_INTR2_MAP_SINGLE_TAP + * + * @param v_intr_single_tap_u8 : The value of single tap enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_single_tap( u8 v_channel_u8, u8 v_intr_single_tap_u8) @@ -8142,7 +8139,7 @@ if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* write the single tap interrupt*/ + /* write the single tap interrupt */ case SMI130_INTR1_MAP_SINGLE_TAP: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> dev_addr, SMI130_USER_INTR_MAP_0_INTR1_SINGLE_TAP__REG, @@ -8177,35 +8174,35 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads the Orient interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 6 in the register 0x55 -* @brief interrupt2 bit 6 in the register 0x57 -* -* -* @param v_channel_u8: The value of orient interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_ORIENT -* 1 | SMI130_INTR2_MAP_ORIENT -* -* @param v_intr_orient_u8 : The value of orient enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads the Orient interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 6 in the register 0x55 + * @brief interrupt2 bit 6 in the register 0x57 + * + * + * @param v_channel_u8: The value of orient interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_ORIENT + * 1 | SMI130_INTR2_MAP_ORIENT + * + * @param v_intr_orient_u8 : The value of orient enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient( -u8 v_channel_u8, u8*v_intr_orient_u8) +u8 v_channel_u8, u8 *v_intr_orient_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -8238,32 +8235,32 @@ u8 v_channel_u8, u8*v_intr_orient_u8) return com_rslt; } /*! -* @brief Write the Orient interrupt -* interrupt mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 6 in the register 0x55 -* @brief interrupt2 bit 6 in the register 0x57 -* -* -* @param v_channel_u8: The value of orient interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_ORIENT -* 1 | SMI130_INTR2_MAP_ORIENT -* -* @param v_intr_orient_u8 : The value of orient enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write the Orient interrupt + * interrupt mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 6 in the register 0x55 + * @brief interrupt2 bit 6 in the register 0x57 + * + * + * @param v_channel_u8: The value of orient interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_ORIENT + * 1 | SMI130_INTR2_MAP_ORIENT + * + * @param v_intr_orient_u8 : The value of orient enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient( u8 v_channel_u8, u8 v_intr_orient_u8) @@ -8314,34 +8311,34 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads the Flat interrupt -* mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 7 in the register 0x55 -* @brief interrupt2 bit 7 in the register 0x57 -* -* -* @param v_channel_u8: The value of flat interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_FLAT -* 1 | SMI130_INTR2_MAP_FLAT -* -* @param v_intr_flat_u8 : The value of flat enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads the Flat interrupt + * mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 7 in the register 0x55 + * @brief interrupt2 bit 7 in the register 0x57 + * + * + * @param v_channel_u8: The value of flat interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_FLAT + * 1 | SMI130_INTR2_MAP_FLAT + * + * @param v_intr_flat_u8 : The value of flat enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_flat( -u8 v_channel_u8, u8*v_intr_flat_u8) +u8 v_channel_u8, u8 *v_intr_flat_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -8378,31 +8375,31 @@ u8 v_channel_u8, u8*v_intr_flat_u8) return com_rslt; } /*! -* @brief Write the Flat interrupt -* mapped to interrupt1 -* and interrupt2 from the register 0x55 and 0x57 -* @brief interrupt1 bit 7 in the register 0x55 -* @brief interrupt2 bit 7 in the register 0x57 -* -* -* @param v_channel_u8: The value of flat interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_FLAT -* 1 | SMI130_INTR2_MAP_FLAT -* -* @param v_intr_flat_u8 : The value of flat enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write the Flat interrupt + * mapped to interrupt1 + * and interrupt2 from the register 0x55 and 0x57 + * @brief interrupt1 bit 7 in the register 0x55 + * @brief interrupt2 bit 7 in the register 0x57 + * + * + * @param v_channel_u8: The value of flat interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_FLAT + * 1 | SMI130_INTR2_MAP_FLAT + * + * @param v_intr_flat_u8 : The value of flat enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_flat( u8 v_channel_u8, u8 v_intr_flat_u8) @@ -8415,7 +8412,7 @@ u8 v_channel_u8, u8 v_intr_flat_u8) return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* write the flat interrupt*/ + /* write the flat interrupt */ case SMI130_INTR1_MAP_FLAT: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> @@ -8457,33 +8454,33 @@ u8 v_channel_u8, u8 v_intr_flat_u8) return com_rslt; } /*! -* @brief Reads PMU trigger interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 bit 0 and 4 -* @brief interrupt1 bit 0 in the register 0x56 -* @brief interrupt2 bit 4 in the register 0x56 -* -* -* @param v_channel_u8: The value of pmu trigger selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_PMUTRIG -* 1 | SMI130_INTR2_MAP_PMUTRIG -* -* @param v_intr_pmu_trig_u8 : The value of pmu trigger enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads PMU trigger interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 bit 0 and 4 + * @brief interrupt1 bit 0 in the register 0x56 + * @brief interrupt2 bit 4 in the register 0x56 + * + * + * @param v_channel_u8: The value of pmu trigger selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_PMUTRIG + * 1 | SMI130_INTR2_MAP_PMUTRIG + * + * @param v_intr_pmu_trig_u8 : The value of pmu trigger enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_pmu_trig( -u8 v_channel_u8, u8*v_intr_pmu_trig_u8) +u8 v_channel_u8, u8 *v_intr_pmu_trig_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -8520,30 +8517,30 @@ u8 v_channel_u8, u8*v_intr_pmu_trig_u8) return com_rslt; } /*! -* @brief Write PMU trigger interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 bit 0 and 4 -* @brief interrupt1 bit 0 in the register 0x56 -* @brief interrupt2 bit 4 in the register 0x56 -* -* -* @param v_channel_u8: The value of pmu trigger selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_PMUTRIG -* 1 | SMI130_INTR2_MAP_PMUTRIG -* -* @param v_intr_pmu_trig_u8 : The value of pmu trigger enable -* value | trigger enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write PMU trigger interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 bit 0 and 4 + * @brief interrupt1 bit 0 in the register 0x56 + * @brief interrupt2 bit 4 in the register 0x56 + * + * + * @param v_channel_u8: The value of pmu trigger selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_PMUTRIG + * 1 | SMI130_INTR2_MAP_PMUTRIG + * + * @param v_intr_pmu_trig_u8 : The value of pmu trigger enable + * value | trigger enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_pmu_trig( u8 v_channel_u8, u8 v_intr_pmu_trig_u8) @@ -8556,7 +8553,7 @@ if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* write the pmu trigger interrupt*/ + /* write the pmu trigger interrupt */ case SMI130_INTR1_MAP_PMUTRIG: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> @@ -8597,34 +8594,34 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief Reads FIFO Full interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 bit 5 and 1 -* @brief interrupt1 bit 5 in the register 0x56 -* @brief interrupt2 bit 1 in the register 0x56 -* -* -* @param v_channel_u8: The value of fifo full interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_FIFO_FULL -* 1 | SMI130_INTR2_MAP_FIFO_FULL -* -* @param v_intr_fifo_full_u8 : The value of fifo full interrupt enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads FIFO Full interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 bit 5 and 1 + * @brief interrupt1 bit 5 in the register 0x56 + * @brief interrupt2 bit 1 in the register 0x56 + * + * + * @param v_channel_u8: The value of fifo full interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_FIFO_FULL + * 1 | SMI130_INTR2_MAP_FIFO_FULL + * + * @param v_intr_fifo_full_u8 : The value of fifo full interrupt enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_fifo_full( -u8 v_channel_u8, u8*v_intr_fifo_full_u8) +u8 v_channel_u8, u8 *v_intr_fifo_full_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -8634,7 +8631,7 @@ u8 v_channel_u8, u8*v_intr_fifo_full_u8) return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* read the fifo full interrupt*/ + /* read the fifo full interrupt */ case SMI130_INTR1_MAP_FIFO_FULL: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> @@ -8661,31 +8658,31 @@ u8 v_channel_u8, u8*v_intr_fifo_full_u8) return com_rslt; } /*! -* @brief Write FIFO Full interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 bit 5 and 1 -* @brief interrupt1 bit 5 in the register 0x56 -* @brief interrupt2 bit 1 in the register 0x56 -* -* -* @param v_channel_u8: The value of fifo full interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_FIFO_FULL -* 1 | SMI130_INTR2_MAP_FIFO_FULL -* -* @param v_intr_fifo_full_u8 : The value of fifo full interrupt enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write FIFO Full interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 bit 5 and 1 + * @brief interrupt1 bit 5 in the register 0x56 + * @brief interrupt2 bit 1 in the register 0x56 + * + * + * @param v_channel_u8: The value of fifo full interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_FIFO_FULL + * 1 | SMI130_INTR2_MAP_FIFO_FULL + * + * @param v_intr_fifo_full_u8 : The value of fifo full interrupt enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_fifo_full( u8 v_channel_u8, u8 v_intr_fifo_full_u8) @@ -8698,7 +8695,7 @@ u8 v_channel_u8, u8 v_intr_fifo_full_u8) return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* write the fifo full interrupt*/ + /* write the fifo full interrupt */ case SMI130_INTR1_MAP_FIFO_FULL: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> @@ -8741,35 +8738,35 @@ u8 v_channel_u8, u8 v_intr_fifo_full_u8) return com_rslt; } /*! -* @brief Reads FIFO Watermark interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 bit 6 and 2 -* @brief interrupt1 bit 6 in the register 0x56 -* @brief interrupt2 bit 2 in the register 0x56 -* -* -* @param v_channel_u8: The value of fifo Watermark interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_FIFO_WM -* 1 | SMI130_INTR2_MAP_FIFO_WM -* -* @param v_intr_fifo_wm_u8 : The value of fifo Watermark interrupt enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads FIFO Watermark interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 bit 6 and 2 + * @brief interrupt1 bit 6 in the register 0x56 + * @brief interrupt2 bit 2 in the register 0x56 + * + * + * @param v_channel_u8: The value of fifo Watermark interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_FIFO_WM + * 1 | SMI130_INTR2_MAP_FIFO_WM + * + * @param v_intr_fifo_wm_u8 : The value of fifo Watermark interrupt enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_fifo_wm( -u8 v_channel_u8, u8*v_intr_fifo_wm_u8) +u8 v_channel_u8, u8 *v_intr_fifo_wm_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -8779,7 +8776,7 @@ u8 v_channel_u8, u8*v_intr_fifo_wm_u8) return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* read the fifo water mark interrupt*/ + /* read the fifo water mark interrupt */ case SMI130_INTR1_MAP_FIFO_WM: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> @@ -8806,32 +8803,32 @@ u8 v_channel_u8, u8*v_intr_fifo_wm_u8) return com_rslt; } /*! -* @brief Write FIFO Watermark interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 bit 6 and 2 -* @brief interrupt1 bit 6 in the register 0x56 -* @brief interrupt2 bit 2 in the register 0x56 -* -* -* @param v_channel_u8: The value of fifo Watermark interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_FIFO_WM -* 1 | SMI130_INTR2_MAP_FIFO_WM -* -* @param v_intr_fifo_wm_u8 : The value of fifo Watermark interrupt enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write FIFO Watermark interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 bit 6 and 2 + * @brief interrupt1 bit 6 in the register 0x56 + * @brief interrupt2 bit 2 in the register 0x56 + * + * + * @param v_channel_u8: The value of fifo Watermark interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_FIFO_WM + * 1 | SMI130_INTR2_MAP_FIFO_WM + * + * @param v_intr_fifo_wm_u8 : The value of fifo Watermark interrupt enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_fifo_wm( u8 v_channel_u8, u8 v_intr_fifo_wm_u8) @@ -8844,7 +8841,7 @@ u8 v_data_u8 = SMI130_INIT_VALUE; return E_SMI130_NULL_PTR; } else { switch (v_channel_u8) { - /* write the fifo water mark interrupt*/ + /* write the fifo water mark interrupt */ case SMI130_INTR1_MAP_FIFO_WM: com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130-> @@ -8885,34 +8882,34 @@ u8 v_data_u8 = SMI130_INIT_VALUE; return com_rslt; } /*! -* @brief Reads Data Ready interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 -* @brief interrupt1 bit 7 in the register 0x56 -* @brief interrupt2 bit 3 in the register 0x56 -* -* -* @param v_channel_u8: The value of data ready interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_DATA_RDY -* 1 | SMI130_INTR2_MAP_DATA_RDY -* -* @param v_intr_data_rdy_u8 : The value of data ready interrupt enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Reads Data Ready interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 + * @brief interrupt1 bit 7 in the register 0x56 + * @brief interrupt2 bit 3 in the register 0x56 + * + * + * @param v_channel_u8: The value of data ready interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_DATA_RDY + * 1 | SMI130_INTR2_MAP_DATA_RDY + * + * @param v_intr_data_rdy_u8 : The value of data ready interrupt enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_data_rdy( -u8 v_channel_u8, u8*v_intr_data_rdy_u8) +u8 v_channel_u8, u8 *v_intr_data_rdy_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -8945,31 +8942,31 @@ u8 v_channel_u8, u8*v_intr_data_rdy_u8) return com_rslt; } /*! -* @brief Write Data Ready interrupt mapped to interrupt1 -* and interrupt2 form the register 0x56 -* @brief interrupt1 bit 7 in the register 0x56 -* @brief interrupt2 bit 3 in the register 0x56 -* -* -* @param v_channel_u8: The value of data ready interrupt selection -* v_channel_u8 | interrupt -* ---------------|--------------- -* 0 | SMI130_INTR1_MAP_DATA_RDY -* 1 | SMI130_INTR2_MAP_DATA_RDY -* -* @param v_intr_data_rdy_u8 : The value of data ready interrupt enable -* value | interrupt enable -* ----------|------------------- -* 0x01 | SMI130_ENABLE -* 0x00 | SMI130_DISABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief Write Data Ready interrupt mapped to interrupt1 + * and interrupt2 form the register 0x56 + * @brief interrupt1 bit 7 in the register 0x56 + * @brief interrupt2 bit 3 in the register 0x56 + * + * + * @param v_channel_u8: The value of data ready interrupt selection + * v_channel_u8 | interrupt + * ---------------|--------------- + * 0 | SMI130_INTR1_MAP_DATA_RDY + * 1 | SMI130_INTR2_MAP_DATA_RDY + * + * @param v_intr_data_rdy_u8 : The value of data ready interrupt enable + * value | interrupt enable + * ----------|------------------- + * 0x01 | SMI130_ENABLE + * 0x00 | SMI130_DISABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_data_rdy( u8 v_channel_u8, u8 v_intr_data_rdy_u8) @@ -9021,25 +9018,25 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API reads data source for the interrupt -* engine for the single and double tap interrupts from the register -* 0x58 bit 3 -* -* -* @param v_tap_source_u8 : The value of the tap source -* value | Description -* ----------|------------------- -* 0x01 | UNFILTER_DATA -* 0x00 | FILTER_DATA -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads data source for the interrupt + * engine for the single and double tap interrupts from the register + * 0x58 bit 3 + * + * + * @param v_tap_source_u8 : The value of the tap source + * value | Description + * ----------|------------------- + * 0x01 | UNFILTER_DATA + * 0x00 | FILTER_DATA + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_source(u8*v_tap_source_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_source(u8 *v_tap_source_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9048,7 +9045,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_source(u8*v_tap_source_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the tap source interrupt*/ + /* read the tap source interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_DATA_0_INTR_TAP_SOURCE__REG, @@ -9059,23 +9056,23 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_source(u8*v_tap_source_u8) return com_rslt; } /*! -* @brief This API write data source for the interrupt -* engine for the single and double tap interrupts from the register -* 0x58 bit 3 -* -* -* @param v_tap_source_u8 : The value of the tap source -* value | Description -* ----------|------------------- -* 0x01 | UNFILTER_DATA -* 0x00 | FILTER_DATA -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write data source for the interrupt + * engine for the single and double tap interrupts from the register + * 0x58 bit 3 + * + * + * @param v_tap_source_u8 : The value of the tap source + * value | Description + * ----------|------------------- + * 0x01 | UNFILTER_DATA + * 0x00 | FILTER_DATA + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_tap_source( u8 v_tap_source_u8) @@ -9088,7 +9085,7 @@ u8 v_tap_source_u8) return E_SMI130_NULL_PTR; } else { if (v_tap_source_u8 <= SMI130_MAX_VALUE_SOURCE_INTR) { - /* write the tap source interrupt*/ + /* write the tap source interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_INTR_DATA_0_INTR_TAP_SOURCE__REG, @@ -9109,25 +9106,25 @@ u8 v_tap_source_u8) return com_rslt; } /*! -* @brief This API Reads Data source for the -* interrupt engine for the low and high g interrupts -* from the register 0x58 bit 7 -* -* @param v_low_high_source_u8 : The value of the tap source -* value | Description -* ----------|------------------- -* 0x01 | UNFILTER_DATA -* 0x00 | FILTER_DATA -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API Reads Data source for the + * interrupt engine for the low and high g interrupts + * from the register 0x58 bit 7 + * + * @param v_low_high_source_u8 : The value of the tap source + * value | Description + * ----------|------------------- + * 0x01 | UNFILTER_DATA + * 0x00 | FILTER_DATA + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_high_source( -u8*v_low_high_source_u8) +u8 *v_low_high_source_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9136,7 +9133,7 @@ u8*v_low_high_source_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the high_low_g source interrupt*/ + /* read the high_low_g source interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__REG, @@ -9147,22 +9144,22 @@ u8*v_low_high_source_u8) return com_rslt; } /*! -* @brief This API write Data source for the -* interrupt engine for the low and high g interrupts -* from the register 0x58 bit 7 -* -* @param v_low_high_source_u8 : The value of the tap source -* value | Description -* ----------|------------------- -* 0x01 | UNFILTER_DATA -* 0x00 | FILTER_DATA -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Data source for the + * interrupt engine for the low and high g interrupts + * from the register 0x58 bit 7 + * + * @param v_low_high_source_u8 : The value of the tap source + * value | Description + * ----------|------------------- + * 0x01 | UNFILTER_DATA + * 0x00 | FILTER_DATA + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_high_source( u8 v_low_high_source_u8) @@ -9175,7 +9172,7 @@ if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { if (v_low_high_source_u8 <= SMI130_MAX_VALUE_SOURCE_INTR) { - /* write the high_low_g source interrupt*/ + /* write the high_low_g source interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__REG, @@ -9196,25 +9193,25 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API reads Data source for the -* interrupt engine for the nomotion and anymotion interrupts -* from the register 0x59 bit 7 -* -* @param v_motion_source_u8 : -* The value of the any/no motion interrupt source -* value | Description -* ----------|------------------- -* 0x01 | UNFILTER_DATA -* 0x00 | FILTER_DATA -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads Data source for the + * interrupt engine for the nomotion and anymotion interrupts + * from the register 0x59 bit 7 + * + * @param v_motion_source_u8 : + * The value of the any/no motion interrupt source + * value | Description + * ----------|------------------- + * 0x01 | UNFILTER_DATA + * 0x00 | FILTER_DATA + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_motion_source( -u8*v_motion_source_u8) +u8 *v_motion_source_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9223,7 +9220,7 @@ u8*v_motion_source_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the any/no motion interrupt */ + /* read the any/no motion interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_DATA_1_INTR_MOTION_SOURCE__REG, @@ -9234,22 +9231,22 @@ u8*v_motion_source_u8) return com_rslt; } /*! -* @brief This API write Data source for the -* interrupt engine for the nomotion and anymotion interrupts -* from the register 0x59 bit 7 -* -* @param v_motion_source_u8 : -* The value of the any/no motion interrupt source -* value | Description -* ----------|------------------- -* 0x01 | UNFILTER_DATA -* 0x00 | FILTER_DATA -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Data source for the + * interrupt engine for the nomotion and anymotion interrupts + * from the register 0x59 bit 7 + * + * @param v_motion_source_u8 : + * The value of the any/no motion interrupt source + * value | Description + * ----------|------------------- + * 0x01 | UNFILTER_DATA + * 0x00 | FILTER_DATA + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_motion_source( u8 v_motion_source_u8) @@ -9262,7 +9259,7 @@ u8 v_motion_source_u8) return E_SMI130_NULL_PTR; } else { if (v_motion_source_u8 <= SMI130_MAX_VALUE_SOURCE_INTR) { - /* write the any/no motion interrupt */ + /* write the any/no motion interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_DATA_1_INTR_MOTION_SOURCE__REG, @@ -9283,28 +9280,28 @@ u8 v_motion_source_u8) return com_rslt; } /*! -* @brief This API is used to read the low_g duration from register -* 0x5A bit 0 to 7 -* -* -* -* -* @param v_low_g_durn_u8 : The value of low_g duration -* -* @note Low_g duration trigger trigger delay according to -* "(v_low_g_durn_u8* 2.5)ms" in a range from 2.5ms to 640ms. -* the default corresponds delay is 20ms -* @note When low_g data source of interrupt is unfiltered -* the sensor must not be in low power mode -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read the low_g duration from register + * 0x5A bit 0 to 7 + * + * + * + * + * @param v_low_g_durn_u8 : The value of low_g duration + * + * @note Low_g duration trigger trigger delay according to + * "(v_low_g_durn_u8 * 2.5)ms" in a range from 2.5ms to 640ms. + * the default corresponds delay is 20ms + * @note When low_g data source of interrupt is unfiltered + * the sensor must not be in low power mode + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_g_durn( -u8*v_low_g_durn_u8) +u8 *v_low_g_durn_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9313,7 +9310,7 @@ u8*v_low_g_durn_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the low_g interrupt*/ + /* read the low_g interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__REG, @@ -9325,25 +9322,25 @@ u8*v_low_g_durn_u8) return com_rslt; } /*! -* @brief This API is used to write the low_g duration from register -* 0x5A bit 0 to 7 -* -* -* -* -* @param v_low_g_durn_u8 : The value of low_g duration -* -* @note Low_g duration trigger trigger delay according to -* "(v_low_g_durn_u8* 2.5)ms" in a range from 2.5ms to 640ms. -* the default corresponds delay is 20ms -* @note When low_g data source of interrupt is unfiltered -* the sensor must not be in low power mode -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write the low_g duration from register + * 0x5A bit 0 to 7 + * + * + * + * + * @param v_low_g_durn_u8 : The value of low_g duration + * + * @note Low_g duration trigger trigger delay according to + * "(v_low_g_durn_u8 * 2.5)ms" in a range from 2.5ms to 640ms. + * the default corresponds delay is 20ms + * @note When low_g data source of interrupt is unfiltered + * the sensor must not be in low power mode + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_g_durn(u8 v_low_g_durn_u8) { @@ -9353,7 +9350,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_g_durn(u8 v_low_g_durn_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* write the low_g interrupt*/ + /* write the low_g interrupt */ com_rslt = p_smi130->SMI130_BUS_WRITE_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__REG, @@ -9362,28 +9359,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_g_durn(u8 v_low_g_durn_u8) return com_rslt; } /*! -* @brief This API is used to read Threshold -* definition for the low-g interrupt from the register 0x5B bit 0 to 7 -* -* -* -* -* @param v_low_g_thres_u8 : The value of low_g threshold -* -* @note Low_g interrupt trigger threshold according to -* (v_low_g_thres_u8* 7.81)mg for v_low_g_thres_u8 > 0 -* 3.91 mg for v_low_g_thres_u8 = 0 -* The threshold range is form 3.91mg to 2.000mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read Threshold + * definition for the low-g interrupt from the register 0x5B bit 0 to 7 + * + * + * + * + * @param v_low_g_thres_u8 : The value of low_g threshold + * + * @note Low_g interrupt trigger threshold according to + * (v_low_g_thres_u8 * 7.81)mg for v_low_g_thres_u8 > 0 + * 3.91 mg for v_low_g_thres_u8 = 0 + * The threshold range is form 3.91mg to 2.000mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_g_thres( -u8*v_low_g_thres_u8) +u8 *v_low_g_thres_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9392,7 +9389,7 @@ u8*v_low_g_thres_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read low_g threshold*/ + /* read low_g threshold */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__REG, @@ -9404,25 +9401,25 @@ u8*v_low_g_thres_u8) return com_rslt; } /*! -* @brief This API is used to write Threshold -* definition for the low-g interrupt from the register 0x5B bit 0 to 7 -* -* -* -* -* @param v_low_g_thres_u8 : The value of low_g threshold -* -* @note Low_g interrupt trigger threshold according to -* (v_low_g_thres_u8* 7.81)mg for v_low_g_thres_u8 > 0 -* 3.91 mg for v_low_g_thres_u8 = 0 -* The threshold range is form 3.91mg to 2.000mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write Threshold + * definition for the low-g interrupt from the register 0x5B bit 0 to 7 + * + * + * + * + * @param v_low_g_thres_u8 : The value of low_g threshold + * + * @note Low_g interrupt trigger threshold according to + * (v_low_g_thres_u8 * 7.81)mg for v_low_g_thres_u8 > 0 + * 3.91 mg for v_low_g_thres_u8 = 0 + * The threshold range is form 3.91mg to 2.000mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_g_thres( u8 v_low_g_thres_u8) @@ -9433,7 +9430,7 @@ u8 v_low_g_thres_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* write low_g threshold*/ + /* write low_g threshold */ com_rslt = p_smi130->SMI130_BUS_WRITE_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__REG, @@ -9442,21 +9439,21 @@ u8 v_low_g_thres_u8) return com_rslt; } /*! -* @brief This API Reads Low-g interrupt hysteresis -* from the register 0x5C bit 0 to 1 -* -* @param v_low_hyst_u8 :The value of low_g hysteresis -* -* @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API Reads Low-g interrupt hysteresis + * from the register 0x5C bit 0 to 1 + * + * @param v_low_hyst_u8 :The value of low_g hysteresis + * + * @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_g_hyst( -u8*v_low_hyst_u8) +u8 *v_low_hyst_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9477,18 +9474,18 @@ u8*v_low_hyst_u8) return com_rslt; } /*! -* @brief This API write Low-g interrupt hysteresis -* from the register 0x5C bit 0 to 1 -* -* @param v_low_hyst_u8 :The value of low_g hysteresis -* -* @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Low-g interrupt hysteresis + * from the register 0x5C bit 0 to 1 + * + * @param v_low_hyst_u8 :The value of low_g hysteresis + * + * @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_g_hyst( u8 v_low_hyst_u8) @@ -9518,23 +9515,23 @@ u8 v_low_hyst_u8) return com_rslt; } /*! -* @brief This API reads Low-g interrupt mode -* from the register 0x5C bit 2 -* -* @param v_low_g_mode_u8 : The value of low_g mode -* Value | Description -* ----------|----------------- -* 0 | single-axis -* 1 | axis-summing -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads Low-g interrupt mode + * from the register 0x5C bit 2 + * + * @param v_low_g_mode_u8 : The value of low_g mode + * Value | Description + * ----------|----------------- + * 0 | single-axis + * 1 | axis-summing + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_g_mode(u8*v_low_g_mode_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_g_mode(u8 *v_low_g_mode_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9554,21 +9551,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_low_g_mode(u8*v_low_g_mode_u8) return com_rslt; } /*! -* @brief This API write Low-g interrupt mode -* from the register 0x5C bit 2 -* -* @param v_low_g_mode_u8 : The value of low_g mode -* Value | Description -* ----------|----------------- -* 0 | single-axis -* 1 | axis-summing -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Low-g interrupt mode + * from the register 0x5C bit 2 + * + * @param v_low_g_mode_u8 : The value of low_g mode + * Value | Description + * ----------|----------------- + * 0 | single-axis + * 1 | axis-summing + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_low_g_mode( u8 v_low_g_mode_u8) @@ -9602,28 +9599,28 @@ u8 v_low_g_mode_u8) return com_rslt; } /*! -* @brief This API reads High-g interrupt hysteresis -* from the register 0x5C bit 6 and 7 -* -* @param v_high_g_hyst_u8 : The value of high hysteresis -* -* @note High_g hysteresis changes according to accel g range -* accel g range can be set by the function "" -* accel_range | high_g hysteresis -* ----------------|--------------------- -* 2g | high_hy*125 mg -* 4g | high_hy*250 mg -* 8g | high_hy*500 mg -* 16g | high_hy*1000 mg -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads High-g interrupt hysteresis + * from the register 0x5C bit 6 and 7 + * + * @param v_high_g_hyst_u8 : The value of high hysteresis + * + * @note High_g hysteresis changes according to accel g range + * accel g range can be set by the function "" + * accel_range | high_g hysteresis + * ----------------|--------------------- + * 2g | high_hy*125 mg + * 4g | high_hy*250 mg + * 8g | high_hy*500 mg + * 16g | high_hy*1000 mg + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_high_g_hyst( -u8*v_high_g_hyst_u8) +u8 *v_high_g_hyst_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9643,25 +9640,25 @@ u8*v_high_g_hyst_u8) return com_rslt; } /*! -* @brief This API write High-g interrupt hysteresis -* from the register 0x5C bit 6 and 7 -* -* @param v_high_g_hyst_u8 : The value of high hysteresis -* -* @note High_g hysteresis changes according to accel g range -* accel g range can be set by the function "" -* accel_range | high_g hysteresis -* ----------------|--------------------- -* 2g | high_hy*125 mg -* 4g | high_hy*250 mg -* 8g | high_hy*500 mg -* 16g | high_hy*1000 mg -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write High-g interrupt hysteresis + * from the register 0x5C bit 6 and 7 + * + * @param v_high_g_hyst_u8 : The value of high hysteresis + * + * @note High_g hysteresis changes according to accel g range + * accel g range can be set by the function "" + * accel_range | high_g hysteresis + * ----------------|--------------------- + * 2g | high_hy*125 mg + * 4g | high_hy*250 mg + * 8g | high_hy*500 mg + * 16g | high_hy*1000 mg + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_high_g_hyst( u8 v_high_g_hyst_u8) @@ -9691,25 +9688,25 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read Delay -* time definition for the high-g interrupt from the register -* 0x5D bit 0 to 7 -* -* -* -* @param v_high_g_durn_u8 : The value of high duration -* -* @note High_g interrupt delay triggered according to -* v_high_g_durn_u8* 2.5ms in a range from 2.5ms to 640ms -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read Delay + * time definition for the high-g interrupt from the register + * 0x5D bit 0 to 7 + * + * + * + * @param v_high_g_durn_u8 : The value of high duration + * + * @note High_g interrupt delay triggered according to + * v_high_g_durn_u8 * 2.5ms in a range from 2.5ms to 640ms + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_high_g_durn( -u8*v_high_g_durn_u8) +u8 *v_high_g_durn_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9730,22 +9727,22 @@ u8*v_high_g_durn_u8) return com_rslt; } /*! -* @brief This API is used to write Delay -* time definition for the high-g interrupt from the register -* 0x5D bit 0 to 7 -* -* -* -* @param v_high_g_durn_u8 : The value of high duration -* -* @note High_g interrupt delay triggered according to -* v_high_g_durn_u8* 2.5ms in a range from 2.5ms to 640ms -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write Delay + * time definition for the high-g interrupt from the register + * 0x5D bit 0 to 7 + * + * + * + * @param v_high_g_durn_u8 : The value of high duration + * + * @note High_g interrupt delay triggered according to + * v_high_g_durn_u8 * 2.5ms in a range from 2.5ms to 640ms + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_high_g_durn( u8 v_high_g_durn_u8) @@ -9765,38 +9762,38 @@ u8 v_high_g_durn_u8) return com_rslt; } /*! -* @brief This API is used to read Threshold -* definition for the high-g interrupt from the register 0x5E 0 to 7 -* -* -* -* -* @param v_high_g_thres_u8 : Pointer holding the value of Threshold -* @note High_g threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | high_g threshold -* ----------------|--------------------- -* 2g | v_high_g_thres_u8*7.81 mg -* 4g | v_high_g_thres_u8*15.63 mg -* 8g | v_high_g_thres_u8*31.25 mg -* 16g | v_high_g_thres_u8*62.5 mg -* @note when v_high_g_thres_u8 = 0 -* accel_range | high_g threshold -* ----------------|--------------------- -* 2g | 3.91 mg -* 4g | 7.81 mg -* 8g | 15.63 mg -* 16g | 31.25 mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read Threshold + * definition for the high-g interrupt from the register 0x5E 0 to 7 + * + * + * + * + * @param v_high_g_thres_u8 : Pointer holding the value of Threshold + * @note High_g threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | high_g threshold + * ----------------|--------------------- + * 2g | v_high_g_thres_u8*7.81 mg + * 4g | v_high_g_thres_u8*15.63 mg + * 8g | v_high_g_thres_u8*31.25 mg + * 16g | v_high_g_thres_u8*62.5 mg + * @note when v_high_g_thres_u8 = 0 + * accel_range | high_g threshold + * ----------------|--------------------- + * 2g | 3.91 mg + * 4g | 7.81 mg + * 8g | 15.63 mg + * 16g | 31.25 mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_high_g_thres( -u8*v_high_g_thres_u8) +u8 *v_high_g_thres_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9816,35 +9813,35 @@ u8*v_high_g_thres_u8) return com_rslt; } /*! -* @brief This API is used to write Threshold -* definition for the high-g interrupt from the register 0x5E 0 to 7 -* -* -* -* -* @param v_high_g_thres_u8 : Pointer holding the value of Threshold -* @note High_g threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | high_g threshold -* ----------------|--------------------- -* 2g | v_high_g_thres_u8*7.81 mg -* 4g | v_high_g_thres_u8*15.63 mg -* 8g | v_high_g_thres_u8*31.25 mg -* 16g | v_high_g_thres_u8*62.5 mg -* @note when v_high_g_thres_u8 = 0 -* accel_range | high_g threshold -* ----------------|--------------------- -* 2g | 3.91 mg -* 4g | 7.81 mg -* 8g | 15.63 mg -* 16g | 31.25 mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write Threshold + * definition for the high-g interrupt from the register 0x5E 0 to 7 + * + * + * + * + * @param v_high_g_thres_u8 : Pointer holding the value of Threshold + * @note High_g threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | high_g threshold + * ----------------|--------------------- + * 2g | v_high_g_thres_u8*7.81 mg + * 4g | v_high_g_thres_u8*15.63 mg + * 8g | v_high_g_thres_u8*31.25 mg + * 16g | v_high_g_thres_u8*62.5 mg + * @note when v_high_g_thres_u8 = 0 + * accel_range | high_g threshold + * ----------------|--------------------- + * 2g | 3.91 mg + * 4g | 7.81 mg + * 8g | 15.63 mg + * 16g | 31.25 mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_high_g_thres( u8 v_high_g_thres_u8) @@ -9863,21 +9860,21 @@ u8 v_high_g_thres_u8) return com_rslt; } /*! -* @brief This API reads any motion duration -* from the register 0x5F bit 0 and 1 -* -* @param v_any_motion_durn_u8 : The value of any motion duration -* -* @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1" -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads any motion duration + * from the register 0x5F bit 0 and 1 + * + * @param v_any_motion_durn_u8 : The value of any motion duration + * + * @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1" + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_any_motion_durn( -u8*v_any_motion_durn_u8) +u8 *v_any_motion_durn_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9898,18 +9895,18 @@ u8*v_any_motion_durn_u8) return com_rslt; } /*! -* @brief This API write any motion duration -* from the register 0x5F bit 0 and 1 -* -* @param v_any_motion_durn_u8 : The value of any motion duration -* -* @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1" -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write any motion duration + * from the register 0x5F bit 0 and 1 + * + * @param v_any_motion_durn_u8 : The value of any motion duration + * + * @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1" + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_any_motion_durn( u8 v_any_motion_durn_u8) @@ -9939,28 +9936,28 @@ u8 v_any_motion_durn_u8) return com_rslt; } /*! -* @brief This API read Slow/no-motion -* interrupt trigger delay duration from the register 0x5F bit 2 to 7 -* -* @param v_slow_no_motion_u8 :The value of slow no motion duration -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* @note -* @note v_slow_no_motion_u8(5:4)=0b00 -> -* [v_slow_no_motion_u8(3:0) + 1]* 1.28s (1.28s-20.48s) -* @note v_slow_no_motion_u8(5:4)=1 -> -* [v_slow_no_motion_u8(3:0)+5]* 5.12s (25.6s-102.4s) -* @note v_slow_no_motion_u8(5)='1' -> -* [(v_slow_no_motion_u8:0)+11]* 10.24s (112.64s-430.08s); -* -*/ + * @brief This API read Slow/no-motion + * interrupt trigger delay duration from the register 0x5F bit 2 to 7 + * + * @param v_slow_no_motion_u8 :The value of slow no motion duration + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * @note + * @note v_slow_no_motion_u8(5:4)=0b00 -> + * [v_slow_no_motion_u8(3:0) + 1] * 1.28s (1.28s-20.48s) + * @note v_slow_no_motion_u8(5:4)=1 -> + * [v_slow_no_motion_u8(3:0)+5] * 5.12s (25.6s-102.4s) + * @note v_slow_no_motion_u8(5)='1' -> + * [(v_slow_no_motion_u8:0)+11] * 10.24s (112.64s-430.08s); + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_slow_no_motion_durn( -u8*v_slow_no_motion_u8) +u8 *v_slow_no_motion_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -9981,26 +9978,26 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API write Slow/no-motion -* interrupt trigger delay duration from the register 0x5F bit 2 to 7 -* -* @param v_slow_no_motion_u8 :The value of slow no motion duration -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* @note -* @note v_slow_no_motion_u8(5:4)=0b00 -> -* [v_slow_no_motion_u8(3:0) + 1]* 1.28s (1.28s-20.48s) -* @note v_slow_no_motion_u8(5:4)=1 -> -* [v_slow_no_motion_u8(3:0)+5]* 5.12s (25.6s-102.4s) -* @note v_slow_no_motion_u8(5)='1' -> -* [(v_slow_no_motion_u8:0)+11]* 10.24s (112.64s-430.08s); -* -*/ + * @brief This API write Slow/no-motion + * interrupt trigger delay duration from the register 0x5F bit 2 to 7 + * + * @param v_slow_no_motion_u8 :The value of slow no motion duration + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * @note + * @note v_slow_no_motion_u8(5:4)=0b00 -> + * [v_slow_no_motion_u8(3:0) + 1] * 1.28s (1.28s-20.48s) + * @note v_slow_no_motion_u8(5:4)=1 -> + * [v_slow_no_motion_u8(3:0)+5] * 5.12s (25.6s-102.4s) + * @note v_slow_no_motion_u8(5)='1' -> + * [(v_slow_no_motion_u8:0)+11] * 10.24s (112.64s-430.08s); + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_slow_no_motion_durn( u8 v_slow_no_motion_u8) { @@ -10030,38 +10027,38 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read threshold -* definition for the any-motion interrupt -* from the register 0x60 bit 0 to 7 -* -* -* @param v_any_motion_thres_u8 : The value of any motion threshold -* -* @note any motion threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | any motion threshold -* ----------------|--------------------- -* 2g | v_any_motion_thres_u8*3.91 mg -* 4g | v_any_motion_thres_u8*7.81 mg -* 8g | v_any_motion_thres_u8*15.63 mg -* 16g | v_any_motion_thres_u8*31.25 mg -* @note when v_any_motion_thres_u8 = 0 -* accel_range | any motion threshold -* ----------------|--------------------- -* 2g | 1.95 mg -* 4g | 3.91 mg -* 8g | 7.81 mg -* 16g | 15.63 mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read threshold + * definition for the any-motion interrupt + * from the register 0x60 bit 0 to 7 + * + * + * @param v_any_motion_thres_u8 : The value of any motion threshold + * + * @note any motion threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | any motion threshold + * ----------------|--------------------- + * 2g | v_any_motion_thres_u8*3.91 mg + * 4g | v_any_motion_thres_u8*7.81 mg + * 8g | v_any_motion_thres_u8*15.63 mg + * 16g | v_any_motion_thres_u8*31.25 mg + * @note when v_any_motion_thres_u8 = 0 + * accel_range | any motion threshold + * ----------------|--------------------- + * 2g | 1.95 mg + * 4g | 3.91 mg + * 8g | 7.81 mg + * 16g | 15.63 mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_any_motion_thres( -u8*v_any_motion_thres_u8) +u8 *v_any_motion_thres_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -10082,35 +10079,35 @@ u8*v_any_motion_thres_u8) return com_rslt; } /*! -* @brief This API is used to write threshold -* definition for the any-motion interrupt -* from the register 0x60 bit 0 to 7 -* -* -* @param v_any_motion_thres_u8 : The value of any motion threshold -* -* @note any motion threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | any motion threshold -* ----------------|--------------------- -* 2g | v_any_motion_thres_u8*3.91 mg -* 4g | v_any_motion_thres_u8*7.81 mg -* 8g | v_any_motion_thres_u8*15.63 mg -* 16g | v_any_motion_thres_u8*31.25 mg -* @note when v_any_motion_thres_u8 = 0 -* accel_range | any motion threshold -* ----------------|--------------------- -* 2g | 1.95 mg -* 4g | 3.91 mg -* 8g | 7.81 mg -* 16g | 15.63 mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write threshold + * definition for the any-motion interrupt + * from the register 0x60 bit 0 to 7 + * + * + * @param v_any_motion_thres_u8 : The value of any motion threshold + * + * @note any motion threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | any motion threshold + * ----------------|--------------------- + * 2g | v_any_motion_thres_u8*3.91 mg + * 4g | v_any_motion_thres_u8*7.81 mg + * 8g | v_any_motion_thres_u8*15.63 mg + * 16g | v_any_motion_thres_u8*31.25 mg + * @note when v_any_motion_thres_u8 = 0 + * accel_range | any motion threshold + * ----------------|--------------------- + * 2g | 1.95 mg + * 4g | 3.91 mg + * 8g | 7.81 mg + * 16g | 15.63 mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_any_motion_thres( u8 v_any_motion_thres_u8) @@ -10130,39 +10127,39 @@ u8 v_any_motion_thres_u8) return com_rslt; } /*! -* @brief This API is used to read threshold -* for the slow/no-motion interrupt -* from the register 0x61 bit 0 to 7 -* -* -* -* -* @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold -* @note slow no motion threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | slow no motion threshold -* ----------------|--------------------- -* 2g | v_slow_no_motion_thres_u8*3.91 mg -* 4g | v_slow_no_motion_thres_u8*7.81 mg -* 8g | v_slow_no_motion_thres_u8*15.63 mg -* 16g | v_slow_no_motion_thres_u8*31.25 mg -* @note when v_slow_no_motion_thres_u8 = 0 -* accel_range | slow no motion threshold -* ----------------|--------------------- -* 2g | 1.95 mg -* 4g | 3.91 mg -* 8g | 7.81 mg -* 16g | 15.63 mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read threshold + * for the slow/no-motion interrupt + * from the register 0x61 bit 0 to 7 + * + * + * + * + * @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold + * @note slow no motion threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | slow no motion threshold + * ----------------|--------------------- + * 2g | v_slow_no_motion_thres_u8*3.91 mg + * 4g | v_slow_no_motion_thres_u8*7.81 mg + * 8g | v_slow_no_motion_thres_u8*15.63 mg + * 16g | v_slow_no_motion_thres_u8*31.25 mg + * @note when v_slow_no_motion_thres_u8 = 0 + * accel_range | slow no motion threshold + * ----------------|--------------------- + * 2g | 1.95 mg + * 4g | 3.91 mg + * 8g | 7.81 mg + * 16g | 15.63 mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_slow_no_motion_thres( -u8*v_slow_no_motion_thres_u8) +u8 *v_slow_no_motion_thres_u8) { SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; u8 v_data_u8 = SMI130_INIT_VALUE; @@ -10182,36 +10179,36 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to write threshold -* for the slow/no-motion interrupt -* from the register 0x61 bit 0 to 7 -* -* -* -* -* @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold -* @note slow no motion threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | slow no motion threshold -* ----------------|--------------------- -* 2g | v_slow_no_motion_thres_u8*3.91 mg -* 4g | v_slow_no_motion_thres_u8*7.81 mg -* 8g | v_slow_no_motion_thres_u8*15.63 mg -* 16g | v_slow_no_motion_thres_u8*31.25 mg -* @note when v_slow_no_motion_thres_u8 = 0 -* accel_range | slow no motion threshold -* ----------------|--------------------- -* 2g | 1.95 mg -* 4g | 3.91 mg -* 8g | 7.81 mg -* 16g | 15.63 mg -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write threshold + * for the slow/no-motion interrupt + * from the register 0x61 bit 0 to 7 + * + * + * + * + * @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold + * @note slow no motion threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | slow no motion threshold + * ----------------|--------------------- + * 2g | v_slow_no_motion_thres_u8*3.91 mg + * 4g | v_slow_no_motion_thres_u8*7.81 mg + * 8g | v_slow_no_motion_thres_u8*15.63 mg + * 16g | v_slow_no_motion_thres_u8*31.25 mg + * @note when v_slow_no_motion_thres_u8 = 0 + * accel_range | slow no motion threshold + * ----------------|--------------------- + * 2g | 1.95 mg + * 4g | 3.91 mg + * 8g | 7.81 mg + * 16g | 15.63 mg + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_slow_no_motion_thres( u8 v_slow_no_motion_thres_u8) @@ -10230,28 +10227,28 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read -* the slow/no-motion selection from the register 0x62 bit 0 -* -* -* -* -* @param v_intr_slow_no_motion_select_u8 : -* The value of slow/no-motion select -* value | Behaviour -* ----------|------------------- -* 0x00 | SLOW_MOTION -* 0x01 | NO_MOTION -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read + * the slow/no-motion selection from the register 0x62 bit 0 + * + * + * + * + * @param v_intr_slow_no_motion_select_u8 : + * The value of slow/no-motion select + * value | Behaviour + * ----------|------------------- + * 0x00 | SLOW_MOTION + * 0x01 | NO_MOTION + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_slow_no_motion_select( -u8*v_intr_slow_no_motion_select_u8) +u8 *v_intr_slow_no_motion_select_u8) { SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; u8 v_data_u8 = SMI130_INIT_VALUE; @@ -10271,25 +10268,25 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to write -* the slow/no-motion selection from the register 0x62 bit 0 -* -* -* -* -* @param v_intr_slow_no_motion_select_u8 : -* The value of slow/no-motion select -* value | Behaviour -* ----------|------------------- -* 0x00 | SLOW_MOTION -* 0x01 | NO_MOTION -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write + * the slow/no-motion selection from the register 0x62 bit 0 + * + * + * + * + * @param v_intr_slow_no_motion_select_u8 : + * The value of slow/no-motion select + * value | Behaviour + * ----------|------------------- + * 0x00 | SLOW_MOTION + * 0x01 | NO_MOTION + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_slow_no_motion_select( u8 v_intr_slow_no_motion_select_u8) @@ -10323,28 +10320,28 @@ com_rslt = E_SMI130_OUT_OF_RANGE; return com_rslt; } /*! -* @brief This API is used to select -* the significant or any motion interrupt from the register 0x62 bit 1 -* -* -* -* -* @param v_intr_significant_motion_select_u8 : -* the value of significant or any motion interrupt selection -* value | Behaviour -* ----------|------------------- -* 0x00 | ANY_MOTION -* 0x01 | SIGNIFICANT_MOTION -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to select + * the significant or any motion interrupt from the register 0x62 bit 1 + * + * + * + * + * @param v_intr_significant_motion_select_u8 : + * the value of significant or any motion interrupt selection + * value | Behaviour + * ----------|------------------- + * 0x00 | ANY_MOTION + * 0x01 | SIGNIFICANT_MOTION + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_significant_motion_select( -u8*v_intr_significant_motion_select_u8) +u8 *v_intr_significant_motion_select_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -10365,25 +10362,25 @@ u8*v_intr_significant_motion_select_u8) return com_rslt; } /*! -* @brief This API is used to write, select -* the significant or any motion interrupt from the register 0x62 bit 1 -* -* -* -* -* @param v_intr_significant_motion_select_u8 : -* the value of significant or any motion interrupt selection -* value | Behaviour -* ----------|------------------- -* 0x00 | ANY_MOTION -* 0x01 | SIGNIFICANT_MOTION -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write, select + * the significant or any motion interrupt from the register 0x62 bit 1 + * + * + * + * + * @param v_intr_significant_motion_select_u8 : + * the value of significant or any motion interrupt selection + * value | Behaviour + * ----------|------------------- + * 0x00 | ANY_MOTION + * 0x01 | SIGNIFICANT_MOTION + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_significant_motion_select( u8 v_intr_significant_motion_select_u8) @@ -10418,29 +10415,29 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API is used to read -* the significant skip time from the register 0x62 bit 2 and 3 -* -* -* -* -* @param v_int_sig_mot_skip_u8 : the value of significant skip time -* value | Behaviour -* ----------|------------------- -* 0x00 | skip time 1.5 seconds -* 0x01 | skip time 3 seconds -* 0x02 | skip time 6 seconds -* 0x03 | skip time 12 seconds -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read + * the significant skip time from the register 0x62 bit 2 and 3 + * + * + * + * + * @param v_int_sig_mot_skip_u8 : the value of significant skip time + * value | Behaviour + * ----------|------------------- + * 0x00 | skip time 1.5 seconds + * 0x01 | skip time 3 seconds + * 0x02 | skip time 6 seconds + * 0x03 | skip time 12 seconds + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_significant_motion_skip( -u8*v_int_sig_mot_skip_u8) +u8 *v_int_sig_mot_skip_u8) { SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; u8 v_data_u8 = SMI130_INIT_VALUE; @@ -10460,26 +10457,26 @@ u8*v_int_sig_mot_skip_u8) return com_rslt; } /*! -* @brief This API is used to write -* the significant skip time from the register 0x62 bit 2 and 3 -* -* -* -* -* @param v_int_sig_mot_skip_u8 : the value of significant skip time -* value | Behaviour -* ----------|------------------- -* 0x00 | skip time 1.5 seconds -* 0x01 | skip time 3 seconds -* 0x02 | skip time 6 seconds -* 0x03 | skip time 12 seconds -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write + * the significant skip time from the register 0x62 bit 2 and 3 + * + * + * + * + * @param v_int_sig_mot_skip_u8 : the value of significant skip time + * value | Behaviour + * ----------|------------------- + * 0x00 | skip time 1.5 seconds + * 0x01 | skip time 3 seconds + * 0x02 | skip time 6 seconds + * 0x03 | skip time 12 seconds + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_significant_motion_skip( u8 v_int_sig_mot_skip_u8) @@ -10513,30 +10510,30 @@ u8 v_int_sig_mot_skip_u8) return com_rslt; } /*! -* @brief This API is used to read -* the significant proof time from the register 0x62 bit 4 and 5 -* -* -* -* -* @param v_significant_motion_proof_u8 : -* the value of significant proof time -* value | Behaviour -* ----------|------------------- -* 0x00 | proof time 0.25 seconds -* 0x01 | proof time 0.5 seconds -* 0x02 | proof time 1 seconds -* 0x03 | proof time 2 seconds -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to read + * the significant proof time from the register 0x62 bit 4 and 5 + * + * + * + * + * @param v_significant_motion_proof_u8 : + * the value of significant proof time + * value | Behaviour + * ----------|------------------- + * 0x00 | proof time 0.25 seconds + * 0x01 | proof time 0.5 seconds + * 0x02 | proof time 1 seconds + * 0x03 | proof time 2 seconds + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_significant_motion_proof( -u8*v_significant_motion_proof_u8) +u8 *v_significant_motion_proof_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -10545,7 +10542,7 @@ u8*v_significant_motion_proof_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read significant proof time*/ + /* read significant proof time */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_INTR_SIGNIFICANT_MOTION_PROOF__REG, @@ -10557,27 +10554,27 @@ u8*v_significant_motion_proof_u8) return com_rslt; } /*! -* @brief This API is used to write -* the significant proof time from the register 0x62 bit 4 and 5 -* -* -* -* -* @param v_significant_motion_proof_u8 : -* the value of significant proof time -* value | Behaviour -* ----------|------------------- -* 0x00 | proof time 0.25 seconds -* 0x01 | proof time 0.5 seconds -* 0x02 | proof time 1 seconds -* 0x03 | proof time 2 seconds -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write + * the significant proof time from the register 0x62 bit 4 and 5 + * + * + * + * + * @param v_significant_motion_proof_u8 : + * the value of significant proof time + * value | Behaviour + * ----------|------------------- + * 0x00 | proof time 0.25 seconds + * 0x01 | proof time 0.5 seconds + * 0x02 | proof time 1 seconds + * 0x03 | proof time 2 seconds + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_significant_motion_proof( u8 v_significant_motion_proof_u8) @@ -10591,7 +10588,7 @@ u8 v_significant_motion_proof_u8) } else { if (v_significant_motion_proof_u8 <= SMI130_MAX_UNDER_SIG_MOTION) { - /* write significant proof time*/ + /* write significant proof time */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_INTR_SIGNIFICANT_MOTION_PROOF__REG, @@ -10612,32 +10609,32 @@ u8 v_significant_motion_proof_u8) return com_rslt; } /*! -* @brief This API is used to get the tap duration -* from the register 0x63 bit 0 to 2 -* -* -* -* @param v_tap_durn_u8 : The value of tap duration -* value | Behaviour -* ----------|------------------- -* 0x00 | SMI130_TAP_DURN_50MS -* 0x01 | SMI130_TAP_DURN_100MS -* 0x03 | SMI130_TAP_DURN_150MS -* 0x04 | SMI130_TAP_DURN_200MS -* 0x05 | SMI130_TAP_DURN_250MS -* 0x06 | SMI130_TAP_DURN_375MS -* 0x07 | SMI130_TAP_DURN_700MS -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to get the tap duration + * from the register 0x63 bit 0 to 2 + * + * + * + * @param v_tap_durn_u8 : The value of tap duration + * value | Behaviour + * ----------|------------------- + * 0x00 | SMI130_TAP_DURN_50MS + * 0x01 | SMI130_TAP_DURN_100MS + * 0x03 | SMI130_TAP_DURN_150MS + * 0x04 | SMI130_TAP_DURN_200MS + * 0x05 | SMI130_TAP_DURN_250MS + * 0x06 | SMI130_TAP_DURN_375MS + * 0x07 | SMI130_TAP_DURN_700MS + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_durn( -u8*v_tap_durn_u8) +u8 *v_tap_durn_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -10658,29 +10655,29 @@ u8*v_tap_durn_u8) return com_rslt; } /*! -* @brief This API is used to write the tap duration -* from the register 0x63 bit 0 to 2 -* -* -* -* @param v_tap_durn_u8 : The value of tap duration -* value | Behaviour -* ----------|------------------- -* 0x00 | SMI130_TAP_DURN_50MS -* 0x01 | SMI130_TAP_DURN_100MS -* 0x03 | SMI130_TAP_DURN_150MS -* 0x04 | SMI130_TAP_DURN_200MS -* 0x05 | SMI130_TAP_DURN_250MS -* 0x06 | SMI130_TAP_DURN_375MS -* 0x07 | SMI130_TAP_DURN_700MS -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API is used to write the tap duration + * from the register 0x63 bit 0 to 2 + * + * + * + * @param v_tap_durn_u8 : The value of tap duration + * value | Behaviour + * ----------|------------------- + * 0x00 | SMI130_TAP_DURN_50MS + * 0x01 | SMI130_TAP_DURN_100MS + * 0x03 | SMI130_TAP_DURN_150MS + * 0x04 | SMI130_TAP_DURN_200MS + * 0x05 | SMI130_TAP_DURN_250MS + * 0x06 | SMI130_TAP_DURN_375MS + * 0x07 | SMI130_TAP_DURN_700MS + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_tap_durn( u8 v_tap_durn_u8) @@ -10743,24 +10740,24 @@ u8 v_tap_durn_u8) return com_rslt; } /*! -* @brief This API read the -* tap shock duration from the register 0x63 bit 2 -* -* @param v_tap_shock_u8 :The value of tap shock -* value | Behaviour -* ----------|------------------- -* 0x00 | SMI130_TAP_SHOCK_50MS -* 0x01 | SMI130_TAP_SHOCK_75MS -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read the + * tap shock duration from the register 0x63 bit 2 + * + * @param v_tap_shock_u8 :The value of tap shock + * value | Behaviour + * ----------|------------------- + * 0x00 | SMI130_TAP_SHOCK_50MS + * 0x01 | SMI130_TAP_SHOCK_75MS + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_shock( -u8*v_tap_shock_u8) +u8 *v_tap_shock_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -10780,21 +10777,21 @@ u8*v_tap_shock_u8) return com_rslt; } /*! -* @brief This API write the -* tap shock duration from the register 0x63 bit 2 -* -* @param v_tap_shock_u8 :The value of tap shock -* value | Behaviour -* ----------|------------------- -* 0x00 | SMI130_TAP_SHOCK_50MS -* 0x01 | SMI130_TAP_SHOCK_75MS -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write the + * tap shock duration from the register 0x63 bit 2 + * + * @param v_tap_shock_u8 :The value of tap shock + * value | Behaviour + * ----------|------------------- + * 0x00 | SMI130_TAP_SHOCK_50MS + * 0x01 | SMI130_TAP_SHOCK_75MS + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_tap_shock(u8 v_tap_shock_u8) { @@ -10827,25 +10824,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_tap_shock(u8 v_tap_shock_u8) return com_rslt; } /*! -* @brief This API read -* tap quiet duration from the register 0x63 bit 7 -* -* -* @param v_tap_quiet_u8 : The value of tap quiet -* value | Behaviour -* ----------|------------------- -* 0x00 | SMI130_TAP_QUIET_30MS -* 0x01 | SMI130_TAP_QUIET_20MS -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API read + * tap quiet duration from the register 0x63 bit 7 + * + * + * @param v_tap_quiet_u8 : The value of tap quiet + * value | Behaviour + * ----------|------------------- + * 0x00 | SMI130_TAP_QUIET_30MS + * 0x01 | SMI130_TAP_QUIET_20MS + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_quiet( -u8*v_tap_quiet_u8) +u8 *v_tap_quiet_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -10866,23 +10863,23 @@ u8*v_tap_quiet_u8) return com_rslt; } /*! -* @brief This API write -* tap quiet duration from the register 0x63 bit 7 -* -* -* @param v_tap_quiet_u8 : The value of tap quiet -* value | Behaviour -* ----------|------------------- -* 0x00 | SMI130_TAP_QUIET_30MS -* 0x01 | SMI130_TAP_QUIET_20MS -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API write + * tap quiet duration from the register 0x63 bit 7 + * + * + * @param v_tap_quiet_u8 : The value of tap quiet + * value | Behaviour + * ----------|------------------- + * 0x00 | SMI130_TAP_QUIET_30MS + * 0x01 | SMI130_TAP_QUIET_20MS + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_tap_quiet(u8 v_tap_quiet_u8) { /* variable used for return the status of communication result*/ @@ -10914,29 +10911,29 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_tap_quiet(u8 v_tap_quiet_u8) return com_rslt; } /*! -* @brief This API read Threshold of the -* single/double tap interrupt from the register 0x64 bit 0 to 4 -* -* -* @param v_tap_thres_u8 : The value of single/double tap threshold -* -* @note single/double tap threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | single/double tap threshold -* ----------------|--------------------- -* 2g | ((v_tap_thres_u8 + 1)* 62.5)mg -* 4g | ((v_tap_thres_u8 + 1)* 125)mg -* 8g | ((v_tap_thres_u8 + 1)* 250)mg -* 16g | ((v_tap_thres_u8 + 1)* 500)mg -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read Threshold of the + * single/double tap interrupt from the register 0x64 bit 0 to 4 + * + * + * @param v_tap_thres_u8 : The value of single/double tap threshold + * + * @note single/double tap threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | single/double tap threshold + * ----------------|--------------------- + * 2g | ((v_tap_thres_u8 + 1) * 62.5)mg + * 4g | ((v_tap_thres_u8 + 1) * 125)mg + * 8g | ((v_tap_thres_u8 + 1) * 250)mg + * 16g | ((v_tap_thres_u8 + 1) * 500)mg + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_tap_thres( -u8*v_tap_thres_u8) +u8 *v_tap_thres_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -10957,26 +10954,26 @@ u8*v_tap_thres_u8) return com_rslt; } /*! -* @brief This API write Threshold of the -* single/double tap interrupt from the register 0x64 bit 0 to 4 -* -* -* @param v_tap_thres_u8 : The value of single/double tap threshold -* -* @note single/double tap threshold changes according to accel g range -* accel g range can be set by the function "" -* accel_range | single/double tap threshold -* ----------------|--------------------- -* 2g | ((v_tap_thres_u8 + 1)* 62.5)mg -* 4g | ((v_tap_thres_u8 + 1)* 125)mg -* 8g | ((v_tap_thres_u8 + 1)* 250)mg -* 16g | ((v_tap_thres_u8 + 1)* 500)mg -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Threshold of the + * single/double tap interrupt from the register 0x64 bit 0 to 4 + * + * + * @param v_tap_thres_u8 : The value of single/double tap threshold + * + * @note single/double tap threshold changes according to accel g range + * accel g range can be set by the function "" + * accel_range | single/double tap threshold + * ----------------|--------------------- + * 2g | ((v_tap_thres_u8 + 1) * 62.5)mg + * 4g | ((v_tap_thres_u8 + 1) * 125)mg + * 8g | ((v_tap_thres_u8 + 1) * 250)mg + * 16g | ((v_tap_thres_u8 + 1) * 500)mg + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_tap_thres( u8 v_tap_thres_u8) @@ -11006,27 +11003,27 @@ u8 v_tap_thres_u8) return com_rslt; } /*! -* @brief This API read the threshold for orientation interrupt -* from the register 0x65 bit 0 and 1 -* -* @param v_orient_mode_u8 : The value of threshold for orientation -* value | Behaviour -* ----------|------------------- -* 0x00 | symmetrical -* 0x01 | high-asymmetrical -* 0x02 | low-asymmetrical -* 0x03 | symmetrical -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read the threshold for orientation interrupt + * from the register 0x65 bit 0 and 1 + * + * @param v_orient_mode_u8 : The value of threshold for orientation + * value | Behaviour + * ----------|------------------- + * 0x00 | symmetrical + * 0x01 | high-asymmetrical + * 0x02 | low-asymmetrical + * 0x03 | symmetrical + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mode( -u8*v_orient_mode_u8) +u8 *v_orient_mode_u8) { SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; u8 v_data_u8 = SMI130_INIT_VALUE; @@ -11046,24 +11043,24 @@ u8*v_orient_mode_u8) return com_rslt; } /*! -* @brief This API write the threshold for orientation interrupt -* from the register 0x65 bit 0 and 1 -* -* @param v_orient_mode_u8 : The value of threshold for orientation -* value | Behaviour -* ----------|------------------- -* 0x00 | symmetrical -* 0x01 | high-asymmetrical -* 0x02 | low-asymmetrical -* 0x03 | symmetrical -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write the threshold for orientation interrupt + * from the register 0x65 bit 0 and 1 + * + * @param v_orient_mode_u8 : The value of threshold for orientation + * value | Behaviour + * ----------|------------------- + * 0x00 | symmetrical + * 0x01 | high-asymmetrical + * 0x02 | low-asymmetrical + * 0x03 | symmetrical + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mode( u8 v_orient_mode_u8) @@ -11097,32 +11094,32 @@ u8 v_orient_mode_u8) return com_rslt; } /*! -* @brief This API read the orient blocking mode -* that is used for the generation of the orientation interrupt. -* from the register 0x65 bit 2 and 3 -* -* @param v_orient_blocking_u8 : The value of orient blocking mode -* value | Behaviour -* ----------|------------------- -* 0x00 | No blocking -* 0x01 | Theta blocking or acceleration in any axis > 1.5g -* 0x02 | Theta blocking or acceleration slope in any axis > -* - | 0.2g or acceleration in any axis > 1.5g -* 0x03 | Theta blocking or acceleration slope in any axis > -* - | 0.4g or acceleration in any axis > -* - | 1.5g and value of orient is not stable -* - | for at least 100 ms -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read the orient blocking mode + * that is used for the generation of the orientation interrupt. + * from the register 0x65 bit 2 and 3 + * + * @param v_orient_blocking_u8 : The value of orient blocking mode + * value | Behaviour + * ----------|------------------- + * 0x00 | No blocking + * 0x01 | Theta blocking or acceleration in any axis > 1.5g + * 0x02 | Theta blocking or acceleration slope in any axis > + * - | 0.2g or acceleration in any axis > 1.5g + * 0x03 | Theta blocking or acceleration slope in any axis > + * - | 0.4g or acceleration in any axis > + * - | 1.5g and value of orient is not stable + * - | for at least 100 ms + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_blocking( -u8*v_orient_blocking_u8) +u8 *v_orient_blocking_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11143,29 +11140,29 @@ u8*v_orient_blocking_u8) return com_rslt; } /*! -* @brief This API write the orient blocking mode -* that is used for the generation of the orientation interrupt. -* from the register 0x65 bit 2 and 3 -* -* @param v_orient_blocking_u8 : The value of orient blocking mode -* value | Behaviour -* ----------|------------------- -* 0x00 | No blocking -* 0x01 | Theta blocking or acceleration in any axis > 1.5g -* 0x02 | Theta blocking or acceleration slope in any axis > -* - | 0.2g or acceleration in any axis > 1.5g -* 0x03 | Theta blocking or acceleration slope in any axis > -* - | 0.4g or acceleration in any axis > -* - | 1.5g and value of orient is not stable -* - | for at least 100 ms -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write the orient blocking mode + * that is used for the generation of the orientation interrupt. + * from the register 0x65 bit 2 and 3 + * + * @param v_orient_blocking_u8 : The value of orient blocking mode + * value | Behaviour + * ----------|------------------- + * 0x00 | No blocking + * 0x01 | Theta blocking or acceleration in any axis > 1.5g + * 0x02 | Theta blocking or acceleration slope in any axis > + * - | 0.2g or acceleration in any axis > 1.5g + * 0x03 | Theta blocking or acceleration slope in any axis > + * - | 0.4g or acceleration in any axis > + * - | 1.5g and value of orient is not stable + * - | for at least 100 ms + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_blocking( u8 v_orient_blocking_u8) @@ -11199,25 +11196,25 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read Orient interrupt -* hysteresis, from the register 0x64 bit 4 to 7 -* -* -* -* @param v_orient_hyst_u8 : The value of orient hysteresis -* -* @note 1 LSB corresponds to 62.5 mg, -* irrespective of the selected accel range -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read Orient interrupt + * hysteresis, from the register 0x64 bit 4 to 7 + * + * + * + * @param v_orient_hyst_u8 : The value of orient hysteresis + * + * @note 1 LSB corresponds to 62.5 mg, + * irrespective of the selected accel range + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_hyst( -u8*v_orient_hyst_u8) +u8 *v_orient_hyst_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11238,22 +11235,22 @@ u8*v_orient_hyst_u8) return com_rslt; } /*! -* @brief This API write Orient interrupt -* hysteresis, from the register 0x64 bit 4 to 7 -* -* -* -* @param v_orient_hyst_u8 : The value of orient hysteresis -* -* @note 1 LSB corresponds to 62.5 mg, -* irrespective of the selected accel range -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Orient interrupt + * hysteresis, from the register 0x64 bit 4 to 7 + * + * + * + * @param v_orient_hyst_u8 : The value of orient hysteresis + * + * @note 1 LSB corresponds to 62.5 mg, + * irrespective of the selected accel range + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_hyst( u8 v_orient_hyst_u8) @@ -11283,21 +11280,21 @@ u8 v_orient_hyst_u8) return com_rslt; } /*! -* @brief This API read Orient -* blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 -* -* @param v_orient_theta_u8 : The value of Orient blocking angle -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read Orient + * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 + * + * @param v_orient_theta_u8 : The value of Orient blocking angle + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_theta( -u8*v_orient_theta_u8) +u8 *v_orient_theta_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11318,18 +11315,18 @@ u8*v_orient_theta_u8) return com_rslt; } /*! -* @brief This API write Orient -* blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 -* -* @param v_orient_theta_u8 : The value of Orient blocking angle -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Orient + * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 + * + * @param v_orient_theta_u8 : The value of Orient blocking angle + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_theta( u8 v_orient_theta_u8) @@ -11363,24 +11360,24 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read orient change -* of up/down bit from the register 0x66 bit 6 -* -* @param v_orient_ud_u8 : The value of orient change of up/down -* value | Behaviour -* ----------|------------------- -* 0x00 | Is ignored -* 0x01 | Generates orientation interrupt -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read orient change + * of up/down bit from the register 0x66 bit 6 + * + * @param v_orient_ud_u8 : The value of orient change of up/down + * value | Behaviour + * ----------|------------------- + * 0x00 | Is ignored + * 0x01 | Generates orientation interrupt + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_ud_enable( -u8*v_orient_ud_u8) +u8 *v_orient_ud_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11401,21 +11398,21 @@ u8*v_orient_ud_u8) return com_rslt; } /*! -* @brief This API write orient change -* of up/down bit from the register 0x66 bit 6 -* -* @param v_orient_ud_u8 : The value of orient change of up/down -* value | Behaviour -* ----------|------------------- -* 0x00 | Is ignored -* 0x01 | Generates orientation interrupt -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write orient change + * of up/down bit from the register 0x66 bit 6 + * + * @param v_orient_ud_u8 : The value of orient change of up/down + * value | Behaviour + * ----------|------------------- + * 0x00 | Is ignored + * 0x01 | Generates orientation interrupt + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_ud_enable( u8 v_orient_ud_u8) @@ -11428,7 +11425,7 @@ if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { if (v_orient_ud_u8 <= SMI130_MAX_VALUE_ORIENT_UD) { - /* write orient up/down enable*/ + /* write orient up/down enable */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__REG, @@ -11449,24 +11446,24 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read orientation axes changes -* from the register 0x66 bit 7 -* -* @param v_orient_axes_u8 : The value of orient axes assignment -* value | Behaviour | Name -* ----------|--------------------|------ -* 0x00 | x = x, y = y, z = z|orient_ax_noex -* 0x01 | x = y, y = z, z = x|orient_ax_ex -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API read orientation axes changes + * from the register 0x66 bit 7 + * + * @param v_orient_axes_u8 : The value of orient axes assignment + * value | Behaviour | Name + * ----------|--------------------|------ + * 0x00 | x = x, y = y, z = z|orient_ax_noex + * 0x01 | x = y, y = z, z = x|orient_ax_ex + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_axes_enable( -u8*v_orient_axes_u8) +u8 *v_orient_axes_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11475,7 +11472,7 @@ u8*v_orient_axes_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read orientation axes changes */ + /* read orientation axes changes */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__REG, @@ -11487,22 +11484,22 @@ u8*v_orient_axes_u8) return com_rslt; } /*! -* @brief This API write orientation axes changes -* from the register 0x66 bit 7 -* -* @param v_orient_axes_u8 : The value of orient axes assignment -* value | Behaviour | Name -* ----------|--------------------|------ -* 0x00 | x = x, y = y, z = z|orient_ax_noex -* 0x01 | x = y, y = z, z = x|orient_ax_ex -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API write orientation axes changes + * from the register 0x66 bit 7 + * + * @param v_orient_axes_u8 : The value of orient axes assignment + * value | Behaviour | Name + * ----------|--------------------|------ + * 0x00 | x = x, y = y, z = z|orient_ax_noex + * 0x01 | x = y, y = z, z = x|orient_ax_ex + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_axes_enable( u8 v_orient_axes_u8) { @@ -11514,7 +11511,7 @@ if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { if (v_orient_axes_u8 <= SMI130_MAX_VALUE_ORIENT_AXES) { - /*write orientation axes changes */ + /*write orientation axes changes */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__REG, @@ -11535,21 +11532,21 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read Flat angle (0 to 44.8) for flat interrupt -* from the register 0x67 bit 0 to 5 -* -* @param v_flat_theta_u8 : The value of flat angle -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read Flat angle (0 to 44.8) for flat interrupt + * from the register 0x67 bit 0 to 5 + * + * @param v_flat_theta_u8 : The value of flat angle + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_flat_theta( -u8*v_flat_theta_u8) +u8 *v_flat_theta_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11569,18 +11566,18 @@ u8*v_flat_theta_u8) return com_rslt; } /*! -* @brief This API write Flat angle (0 to 44.8) for flat interrupt -* from the register 0x67 bit 0 to 5 -* -* @param v_flat_theta_u8 : The value of flat angle -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Flat angle (0 to 44.8) for flat interrupt + * from the register 0x67 bit 0 to 5 + * + * @param v_flat_theta_u8 : The value of flat angle + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_flat_theta( u8 v_flat_theta_u8) @@ -11593,7 +11590,7 @@ u8 v_flat_theta_u8) return E_SMI130_NULL_PTR; } else { if (v_flat_theta_u8 <= SMI130_MAX_FLAT_THETA) { - /* write Flat angle*/ + /* write Flat angle */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_INTR_FLAT_0_INTR_FLAT_THETA__REG, @@ -11614,26 +11611,26 @@ u8 v_flat_theta_u8) return com_rslt; } /*! -* @brief This API read Flat interrupt hold time; -* from the register 0x68 bit 4 and 5 -* -* @param v_flat_hold_u8 : The value of flat hold time -* value | Behaviour -* ----------|------------------- -* 0x00 | 0ms -* 0x01 | 512ms -* 0x01 | 1024ms -* 0x01 | 2048ms -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read Flat interrupt hold time; + * from the register 0x68 bit 4 and 5 + * + * @param v_flat_hold_u8 : The value of flat hold time + * value | Behaviour + * ----------|------------------- + * 0x00 | 0ms + * 0x01 | 512ms + * 0x01 | 1024ms + * 0x01 | 2048ms + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_flat_hold( -u8*v_flat_hold_u8) +u8 *v_flat_hold_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11653,23 +11650,23 @@ u8*v_flat_hold_u8) return com_rslt; } /*! -* @brief This API write Flat interrupt hold time; -* from the register 0x68 bit 4 and 5 -* -* @param v_flat_hold_u8 : The value of flat hold time -* value | Behaviour -* ----------|------------------- -* 0x00 | 0ms -* 0x01 | 512ms -* 0x01 | 1024ms -* 0x01 | 2048ms -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Flat interrupt hold time; + * from the register 0x68 bit 4 and 5 + * + * @param v_flat_hold_u8 : The value of flat hold time + * value | Behaviour + * ----------|------------------- + * 0x00 | 0ms + * 0x01 | 512ms + * 0x01 | 1024ms + * 0x01 | 2048ms + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_flat_hold( u8 v_flat_hold_u8) @@ -11703,21 +11700,21 @@ u8 v_flat_hold_u8) return com_rslt; } /*! -* @brief This API read flat interrupt hysteresis -* from the register 0x68 bit 0 to 3 -* -* @param v_flat_hyst_u8 : The value of flat hysteresis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read flat interrupt hysteresis + * from the register 0x68 bit 0 to 3 + * + * @param v_flat_hyst_u8 : The value of flat hysteresis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_flat_hyst( -u8*v_flat_hyst_u8) +u8 *v_flat_hyst_u8) { /* variable used to return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11738,18 +11735,18 @@ u8*v_flat_hyst_u8) return com_rslt; } /*! -* @brief This API write flat interrupt hysteresis -* from the register 0x68 bit 0 to 3 -* -* @param v_flat_hyst_u8 : The value of flat hysteresis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write flat interrupt hysteresis + * from the register 0x68 bit 0 to 3 + * + * @param v_flat_hyst_u8 : The value of flat hysteresis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_flat_hyst( u8 v_flat_hyst_u8) @@ -11783,24 +11780,24 @@ u8 v_flat_hyst_u8) return com_rslt; } /*! -* @brief This API read accel offset compensation -* target value for z-axis from the register 0x69 bit 0 and 1 -* -* @param v_foc_accel_z_u8 : the value of accel offset compensation z axis -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel offset compensation + * target value for z-axis from the register 0x69 bit 0 and 1 + * + * @param v_foc_accel_z_u8 : the value of accel offset compensation z axis + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_z(u8*v_foc_accel_z_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_z(u8 *v_foc_accel_z_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11820,22 +11817,22 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_z(u8*v_foc_accel_z_u8) return com_rslt; } /*! -* @brief This API write accel offset compensation -* target value for z-axis from the register 0x69 bit 0 and 1 -* -* @param v_foc_accel_z_u8 : the value of accel offset compensation z axis -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel offset compensation + * target value for z-axis from the register 0x69 bit 0 and 1 + * + * @param v_foc_accel_z_u8 : the value of accel offset compensation z axis + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_foc_accel_z( u8 v_foc_accel_z_u8) @@ -11865,27 +11862,27 @@ u8 v_foc_accel_z_u8) return com_rslt; } /*! -* @brief This API read accel offset compensation -* target value for y-axis -* from the register 0x69 bit 2 and 3 -* -* @param v_foc_accel_y_u8 : the value of accel offset compensation y axis -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel offset compensation + * target value for y-axis + * from the register 0x69 bit 2 and 3 + * + * @param v_foc_accel_y_u8 : the value of accel offset compensation y axis + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_y(u8*v_foc_accel_y_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_y(u8 *v_foc_accel_y_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11905,25 +11902,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_y(u8*v_foc_accel_y_u8) return com_rslt; } /*! -* @brief This API write accel offset compensation -* target value for y-axis -* from the register 0x69 bit 2 and 3 -* -* @param v_foc_accel_y_u8 : the value of accel offset compensation y axis -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x02 | -1g -* 0x03 | 0g -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel offset compensation + * target value for y-axis + * from the register 0x69 bit 2 and 3 + * + * @param v_foc_accel_y_u8 : the value of accel offset compensation y axis + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x02 | -1g + * 0x03 | 0g + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_foc_accel_y(u8 v_foc_accel_y_u8) { @@ -11956,27 +11953,27 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_foc_accel_y(u8 v_foc_accel_y_u8) return com_rslt; } /*! -* @brief This API read accel offset compensation -* target value for x-axis is -* from the register 0x69 bit 4 and 5 -* -* @param v_foc_accel_x_u8 : the value of accel offset compensation x axis -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x02 | -1g -* 0x03 | 0g -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel offset compensation + * target value for x-axis is + * from the register 0x69 bit 4 and 5 + * + * @param v_foc_accel_x_u8 : the value of accel offset compensation x axis + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x02 | -1g + * 0x03 | 0g + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_x(u8*v_foc_accel_x_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_x(u8 *v_foc_accel_x_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -11996,25 +11993,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_accel_x(u8*v_foc_accel_x_u8) return com_rslt; } /*! -* @brief This API write accel offset compensation -* target value for x-axis is -* from the register 0x69 bit 4 and 5 -* -* @param v_foc_accel_x_u8 : the value of accel offset compensation x axis -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel offset compensation + * target value for x-axis is + * from the register 0x69 bit 4 and 5 + * + * @param v_foc_accel_x_u8 : the value of accel offset compensation x axis + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_foc_accel_x(u8 v_foc_accel_x_u8) { @@ -12047,38 +12044,38 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_foc_accel_x(u8 v_foc_accel_x_u8) return com_rslt; } /*! -* @brief This API writes accel fast offset compensation -* from the register 0x69 bit 0 to 5 -* @brief This API writes each axis individually -* FOC_X_AXIS - bit 4 and 5 -* FOC_Y_AXIS - bit 2 and 3 -* FOC_Z_AXIS - bit 0 and 1 -* -* @param v_foc_accel_u8: The value of accel offset compensation -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* @param v_axis_u8: The value of accel offset axis selection - * value | axis -* ----------|------------------- -* 0 | FOC_X_AXIS -* 1 | FOC_Y_AXIS -* 2 | FOC_Z_AXIS -* -* @param v_accel_offset_s8: The accel offset value -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API writes accel fast offset compensation + * from the register 0x69 bit 0 to 5 + * @brief This API writes each axis individually + * FOC_X_AXIS - bit 4 and 5 + * FOC_Y_AXIS - bit 2 and 3 + * FOC_Z_AXIS - bit 0 and 1 + * + * @param v_foc_accel_u8: The value of accel offset compensation + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * @param v_axis_u8: The value of accel offset axis selection + * value | axis + * ----------|------------------- + * 0 | FOC_X_AXIS + * 1 | FOC_Y_AXIS + * 2 | FOC_Z_AXIS + * + * @param v_accel_offset_s8: The accel offset value + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_foc_trigger(u8 v_axis_u8, -u8 v_foc_accel_u8, s8*v_accel_offset_s8) +u8 v_foc_accel_u8, s8 *v_accel_offset_s8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12253,49 +12250,49 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API write fast accel offset compensation -* it writes all axis together.To the register 0x69 bit 0 to 5 -* FOC_X_AXIS - bit 4 and 5 -* FOC_Y_AXIS - bit 2 and 3 -* FOC_Z_AXIS - bit 0 and 1 -* -* @param v_foc_accel_x_u8: The value of accel offset x compensation -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* @param v_foc_accel_y_u8: The value of accel offset y compensation -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* @param v_foc_accel_z_u8: The value of accel offset z compensation -* value | Behaviour -* ----------|------------------- -* 0x00 | disable -* 0x01 | +1g -* 0x01 | -1g -* 0x01 | 0g -* -* @param v_accel_off_x_s8: The value of accel offset x axis -* @param v_accel_off_y_s8: The value of accel offset y axis -* @param v_accel_off_z_s8: The value of accel offset z axis -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* + * @brief This API write fast accel offset compensation + * it writes all axis together.To the register 0x69 bit 0 to 5 + * FOC_X_AXIS - bit 4 and 5 + * FOC_Y_AXIS - bit 2 and 3 + * FOC_Z_AXIS - bit 0 and 1 + * + * @param v_foc_accel_x_u8: The value of accel offset x compensation + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * @param v_foc_accel_y_u8: The value of accel offset y compensation + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * @param v_foc_accel_z_u8: The value of accel offset z compensation + * value | Behaviour + * ----------|------------------- + * 0x00 | disable + * 0x01 | +1g + * 0x01 | -1g + * 0x01 | 0g + * + * @param v_accel_off_x_s8: The value of accel offset x axis + * @param v_accel_off_y_s8: The value of accel offset y axis + * @param v_accel_off_z_s8: The value of accel offset z axis + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * */ SMI130_RETURN_FUNCTION_TYPE smi130_accel_foc_trigger_xyz(u8 v_foc_accel_x_u8, -u8 v_foc_accel_y_u8, u8 v_foc_accel_z_u8, s8*v_accel_off_x_s8, -s8*v_accel_off_y_s8, s8*v_accel_off_z_s8) +u8 v_foc_accel_y_u8, u8 v_foc_accel_z_u8, s8 *v_accel_off_x_s8, +s8 *v_accel_off_y_s8, s8 *v_accel_off_z_s8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12411,27 +12408,27 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read gyro fast offset enable -* from the register 0x69 bit 6 -* -* @param v_foc_gyro_u8 : The value of gyro fast offset enable -* value | Description -* ----------|------------- -* 0 | fast offset compensation disabled -* 1 | fast offset compensation enabled -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro fast offset enable + * from the register 0x69 bit 6 + * + * @param v_foc_gyro_u8 : The value of gyro fast offset enable + * value | Description + * ----------|------------- + * 0 | fast offset compensation disabled + * 1 | fast offset compensation enabled + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_foc_gyro_enable( -u8*v_foc_gyro_u8) +u8 *v_foc_gyro_u8) { - /* used for return the status of bus communication*/ + /* used for return the status of bus communication */ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; u8 v_data_u8 = SMI130_INIT_VALUE; /* check the p_smi130 structure as NULL*/ @@ -12449,28 +12446,28 @@ u8*v_foc_gyro_u8) return com_rslt; } /*! -* @brief This API write gyro fast offset enable -* from the register 0x69 bit 6 -* -* @param v_foc_gyro_u8 : The value of gyro fast offset enable -* value | Description -* ----------|------------- -* 0 | fast offset compensation disabled -* 1 | fast offset compensation enabled -* -* @param v_gyro_off_x_s16 : The value of gyro fast offset x axis data -* @param v_gyro_off_y_s16 : The value of gyro fast offset y axis data -* @param v_gyro_off_z_s16 : The value of gyro fast offset z axis data -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro fast offset enable + * from the register 0x69 bit 6 + * + * @param v_foc_gyro_u8 : The value of gyro fast offset enable + * value | Description + * ----------|------------- + * 0 | fast offset compensation disabled + * 1 | fast offset compensation enabled + * + * @param v_gyro_off_x_s16 : The value of gyro fast offset x axis data + * @param v_gyro_off_y_s16 : The value of gyro fast offset y axis data + * @param v_gyro_off_z_s16 : The value of gyro fast offset z axis data + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_foc_gyro_enable( -u8 v_foc_gyro_u8, s16*v_gyro_off_x_s16, -s16*v_gyro_off_y_s16, s16*v_gyro_off_z_s16) +u8 v_foc_gyro_u8, s16 *v_gyro_off_x_s16, +s16 *v_gyro_off_y_s16, s16 *v_gyro_off_z_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12548,23 +12545,23 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read NVM program enable -* from the register 0x6A bit 1 -* -* @param v_nvm_prog_u8 : The value of NVM program enable -* Value | Description -* --------|------------- -* 0 | DISABLE -* 1 | ENABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read NVM program enable + * from the register 0x6A bit 1 + * + * @param v_nvm_prog_u8 : The value of NVM program enable + * Value | Description + * --------|------------- + * 0 | DISABLE + * 1 | ENABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_nvm_prog_enable( -u8*v_nvm_prog_u8) +u8 *v_nvm_prog_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12584,20 +12581,20 @@ u8*v_nvm_prog_u8) return com_rslt; } /*! -* @brief This API write NVM program enable -* from the register 0x6A bit 1 -* -* @param v_nvm_prog_u8 : The value of NVM program enable -* Value | Description -* --------|------------- -* 0 | DISABLE -* 1 | ENABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write NVM program enable + * from the register 0x6A bit 1 + * + * @param v_nvm_prog_u8 : The value of NVM program enable + * Value | Description + * --------|------------- + * 0 | DISABLE + * 1 | ENABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_nvm_prog_enable( u8 v_nvm_prog_u8) @@ -12631,25 +12628,25 @@ u8 v_nvm_prog_u8) return com_rslt; } /*! -* @brief This API read to configure SPI -* Interface Mode for primary and OIS interface -* from the register 0x6B bit 0 -* -* @param v_spi3_u8 : The value of SPI mode selection -* Value | Description -* --------|------------- -* 0 | SPI 4-wire mode -* 1 | SPI 3-wire mode -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API read to configure SPI + * Interface Mode for primary and OIS interface + * from the register 0x6B bit 0 + * + * @param v_spi3_u8 : The value of SPI mode selection + * Value | Description + * --------|------------- + * 0 | SPI 4-wire mode + * 1 | SPI 3-wire mode + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_get_spi3( -u8*v_spi3_u8) +u8 *v_spi3_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12669,23 +12666,23 @@ u8*v_spi3_u8) return com_rslt; } /*! -* @brief This API write to configure SPI -* Interface Mode for primary and OIS interface -* from the register 0x6B bit 0 -* -* @param v_spi3_u8 : The value of SPI mode selection -* Value | Description -* --------|------------- -* 0 | SPI 4-wire mode -* 1 | SPI 3-wire mode -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API write to configure SPI + * Interface Mode for primary and OIS interface + * from the register 0x6B bit 0 + * + * @param v_spi3_u8 : The value of SPI mode selection + * Value | Description + * --------|------------- + * 0 | SPI 4-wire mode + * 1 | SPI 3-wire mode + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_spi3( u8 v_spi3_u8) { @@ -12718,24 +12715,24 @@ u8 v_spi3_u8) return com_rslt; } /*! -* @brief This API read I2C Watchdog timer -* from the register 0x70 bit 1 -* -* @param v_i2c_wdt_u8 : The value of I2C watch dog timer -* Value | Description -* --------|------------- -* 0 | I2C watchdog v_timeout_u8 after 1 ms -* 1 | I2C watchdog v_timeout_u8 after 50 ms -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read I2C Watchdog timer + * from the register 0x70 bit 1 + * + * @param v_i2c_wdt_u8 : The value of I2C watch dog timer + * Value | Description + * --------|------------- + * 0 | I2C watchdog v_timeout_u8 after 1 ms + * 1 | I2C watchdog v_timeout_u8 after 50 ms + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_i2c_wdt_select( -u8*v_i2c_wdt_u8) +u8 *v_i2c_wdt_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12744,7 +12741,7 @@ u8*v_i2c_wdt_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read I2C watch dog timer*/ + /* read I2C watch dog timer */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_IF_CONFIG_I2C_WDT_SELECT__REG, @@ -12755,21 +12752,21 @@ u8*v_i2c_wdt_u8) return com_rslt; } /*! -* @brief This API write I2C Watchdog timer -* from the register 0x70 bit 1 -* -* @param v_i2c_wdt_u8 : The value of I2C watch dog timer -* Value | Description -* --------|------------- -* 0 | I2C watchdog v_timeout_u8 after 1 ms -* 1 | I2C watchdog v_timeout_u8 after 50 ms -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write I2C Watchdog timer + * from the register 0x70 bit 1 + * + * @param v_i2c_wdt_u8 : The value of I2C watch dog timer + * Value | Description + * --------|------------- + * 0 | I2C watchdog v_timeout_u8 after 1 ms + * 1 | I2C watchdog v_timeout_u8 after 50 ms + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_i2c_wdt_select( u8 v_i2c_wdt_u8) @@ -12782,7 +12779,7 @@ u8 v_i2c_wdt_u8) return E_SMI130_NULL_PTR; } else { if (v_i2c_wdt_u8 <= SMI130_MAX_VALUE_I2C_WDT) { - /* write I2C watch dog timer*/ + /* write I2C watch dog timer */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_IF_CONFIG_I2C_WDT_SELECT__REG, @@ -12803,23 +12800,23 @@ u8 v_i2c_wdt_u8) return com_rslt; } /*! -* @brief This API read I2C watchdog enable -* from the register 0x70 bit 2 -* -* @param v_i2c_wdt_u8 : The value of I2C watchdog enable -* Value | Description -* --------|------------- -* 0 | DISABLE -* 1 | ENABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read I2C watchdog enable + * from the register 0x70 bit 2 + * + * @param v_i2c_wdt_u8 : The value of I2C watchdog enable + * Value | Description + * --------|------------- + * 0 | DISABLE + * 1 | ENABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_i2c_wdt_enable( -u8*v_i2c_wdt_u8) +u8 *v_i2c_wdt_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12828,7 +12825,7 @@ u8*v_i2c_wdt_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read i2c watch dog eneble*/ + /* read i2c watch dog eneble */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_IF_CONFIG_I2C_WDT_ENABLE__REG, @@ -12839,20 +12836,20 @@ u8*v_i2c_wdt_u8) return com_rslt; } /*! -* @brief This API write I2C watchdog enable -* from the register 0x70 bit 2 -* -* @param v_i2c_wdt_u8 : The value of I2C watchdog enable -* Value | Description -* --------|------------- -* 0 | DISABLE -* 1 | ENABLE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write I2C watchdog enable + * from the register 0x70 bit 2 + * + * @param v_i2c_wdt_u8 : The value of I2C watchdog enable + * Value | Description + * --------|------------- + * 0 | DISABLE + * 1 | ENABLE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_i2c_wdt_enable( u8 v_i2c_wdt_u8) @@ -12865,7 +12862,7 @@ u8 v_i2c_wdt_u8) return E_SMI130_NULL_PTR; } else { if (v_i2c_wdt_u8 <= SMI130_MAX_VALUE_I2C_WDT) { - /* write i2c watch dog eneble*/ + /* write i2c watch dog eneble */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_IF_CONFIG_I2C_WDT_ENABLE__REG, @@ -12886,26 +12883,26 @@ u8 v_i2c_wdt_u8) return com_rslt; } /*! -* @brief This API read I2C interface configuration(if) moe -* from the register 0x6B bit 4 and 5 -* -* @param v_if_mode_u8 : The value of interface configuration mode -* Value | Description -* --------|------------- -* 0x00 | Primary interface:autoconfig / secondary interface:off -* 0x01 | Primary interface:I2C / secondary interface:OIS -* 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer -* 0x03 | Reserved -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read I2C interface configuration(if) moe + * from the register 0x6B bit 4 and 5 + * + * @param v_if_mode_u8 : The value of interface configuration mode + * Value | Description + * --------|------------- + * 0x00 | Primary interface:autoconfig / secondary interface:off + * 0x01 | Primary interface:I2C / secondary interface:OIS + * 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer + * 0x03 | Reserved + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_if_mode( -u8*v_if_mode_u8) +u8 *v_if_mode_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -12925,23 +12922,23 @@ u8*v_if_mode_u8) return com_rslt; } /*! -* @brief This API write I2C interface configuration(if) moe -* from the register 0x6B bit 4 and 5 -* -* @param v_if_mode_u8 : The value of interface configuration mode -* Value | Description -* --------|------------- -* 0x00 | Primary interface:autoconfig / secondary interface:off -* 0x01 | Primary interface:I2C / secondary interface:OIS -* 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer -* 0x03 | Reserved -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write I2C interface configuration(if) moe + * from the register 0x6B bit 4 and 5 + * + * @param v_if_mode_u8 : The value of interface configuration mode + * Value | Description + * --------|------------- + * 0x00 | Primary interface:autoconfig / secondary interface:off + * 0x01 | Primary interface:I2C / secondary interface:OIS + * 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer + * 0x03 | Reserved + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_if_mode( u8 v_if_mode_u8) @@ -12975,31 +12972,31 @@ u8 v_if_mode_u8) return com_rslt; } /*! -* @brief This API read gyro sleep trigger -* from the register 0x6C bit 0 to 2 -* -* @param v_gyro_sleep_trigger_u8 : The value of gyro sleep trigger -* Value | Description -* --------|------------- -* 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no -* 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes -* 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no -* 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes -* 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no -* 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes -* 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no -* 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro sleep trigger + * from the register 0x6C bit 0 to 2 + * + * @param v_gyro_sleep_trigger_u8 : The value of gyro sleep trigger + * Value | Description + * --------|------------- + * 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no + * 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes + * 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no + * 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes + * 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no + * 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes + * 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no + * 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_sleep_trigger( -u8*v_gyro_sleep_trigger_u8) +u8 *v_gyro_sleep_trigger_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13008,7 +13005,7 @@ u8*v_gyro_sleep_trigger_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read gyro sleep trigger*/ + /* read gyro sleep trigger */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_SLEEP_TRIGGER__REG, @@ -13020,28 +13017,28 @@ u8*v_gyro_sleep_trigger_u8) return com_rslt; } /*! -* @brief This API write gyro sleep trigger -* from the register 0x6C bit 0 to 2 -* -* @param v_gyro_sleep_trigger_u8 : The value of gyro sleep trigger -* Value | Description -* --------|------------- -* 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no -* 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes -* 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no -* 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes -* 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no -* 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes -* 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no -* 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro sleep trigger + * from the register 0x6C bit 0 to 2 + * + * @param v_gyro_sleep_trigger_u8 : The value of gyro sleep trigger + * Value | Description + * --------|------------- + * 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no + * 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes + * 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no + * 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes + * 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no + * 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes + * 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no + * 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_sleep_trigger( u8 v_gyro_sleep_trigger_u8) @@ -13054,7 +13051,7 @@ u8 v_gyro_sleep_trigger_u8) return E_SMI130_NULL_PTR; } else { if (v_gyro_sleep_trigger_u8 <= SMI130_MAX_GYRO_SLEEP_TIGGER) { - /* write gyro sleep trigger*/ + /* write gyro sleep trigger */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_SLEEP_TRIGGER__REG, @@ -13075,26 +13072,26 @@ u8 v_gyro_sleep_trigger_u8) return com_rslt; } /*! -* @brief This API read gyro wakeup trigger -* from the register 0x6C bit 3 and 4 -* -* @param v_gyro_wakeup_trigger_u8 : The value of gyro wakeup trigger -* Value | Description -* --------|------------- -* 0x00 | anymotion: no / INT1 pin: no -* 0x01 | anymotion: no / INT1 pin: yes -* 0x02 | anymotion: yes / INT1 pin: no -* 0x03 | anymotion: yes / INT1 pin: yes -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro wakeup trigger + * from the register 0x6C bit 3 and 4 + * + * @param v_gyro_wakeup_trigger_u8 : The value of gyro wakeup trigger + * Value | Description + * --------|------------- + * 0x00 | anymotion: no / INT1 pin: no + * 0x01 | anymotion: no / INT1 pin: yes + * 0x02 | anymotion: yes / INT1 pin: no + * 0x03 | anymotion: yes / INT1 pin: yes + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_wakeup_trigger( -u8*v_gyro_wakeup_trigger_u8) +u8 *v_gyro_wakeup_trigger_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13103,7 +13100,7 @@ u8*v_gyro_wakeup_trigger_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read gyro wakeup trigger*/ + /* read gyro wakeup trigger */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_WAKEUP_TRIGGER__REG, @@ -13115,23 +13112,23 @@ u8*v_gyro_wakeup_trigger_u8) return com_rslt; } /*! -* @brief This API write gyro wakeup trigger -* from the register 0x6C bit 3 and 4 -* -* @param v_gyro_wakeup_trigger_u8 : The value of gyro wakeup trigger -* Value | Description -* --------|------------- -* 0x00 | anymotion: no / INT1 pin: no -* 0x01 | anymotion: no / INT1 pin: yes -* 0x02 | anymotion: yes / INT1 pin: no -* 0x03 | anymotion: yes / INT1 pin: yes -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro wakeup trigger + * from the register 0x6C bit 3 and 4 + * + * @param v_gyro_wakeup_trigger_u8 : The value of gyro wakeup trigger + * Value | Description + * --------|------------- + * 0x00 | anymotion: no / INT1 pin: no + * 0x01 | anymotion: no / INT1 pin: yes + * 0x02 | anymotion: yes / INT1 pin: no + * 0x03 | anymotion: yes / INT1 pin: yes + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_wakeup_trigger( u8 v_gyro_wakeup_trigger_u8) @@ -13145,7 +13142,7 @@ u8 v_gyro_wakeup_trigger_u8) } else { if (v_gyro_wakeup_trigger_u8 <= SMI130_MAX_GYRO_WAKEUP_TRIGGER) { - /* write gyro wakeup trigger*/ + /* write gyro wakeup trigger */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_WAKEUP_TRIGGER__REG, @@ -13166,24 +13163,24 @@ u8 v_gyro_wakeup_trigger_u8) return com_rslt; } /*! -* @brief This API read Target state for gyro sleep mode -* from the register 0x6C bit 5 -* -* @param v_gyro_sleep_state_u8 : The value of gyro sleep mode -* Value | Description -* --------|------------- -* 0x00 | Sleep transition to fast wake up state -* 0x01 | Sleep transition to suspend state -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read Target state for gyro sleep mode + * from the register 0x6C bit 5 + * + * @param v_gyro_sleep_state_u8 : The value of gyro sleep mode + * Value | Description + * --------|------------- + * 0x00 | Sleep transition to fast wake up state + * 0x01 | Sleep transition to suspend state + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_sleep_state( -u8*v_gyro_sleep_state_u8) +u8 *v_gyro_sleep_state_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13204,21 +13201,21 @@ u8*v_gyro_sleep_state_u8) return com_rslt; } /*! -* @brief This API write Target state for gyro sleep mode -* from the register 0x6C bit 5 -* -* @param v_gyro_sleep_state_u8 : The value of gyro sleep mode -* Value | Description -* --------|------------- -* 0x00 | Sleep transition to fast wake up state -* 0x01 | Sleep transition to suspend state -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write Target state for gyro sleep mode + * from the register 0x6C bit 5 + * + * @param v_gyro_sleep_state_u8 : The value of gyro sleep mode + * Value | Description + * --------|------------- + * 0x00 | Sleep transition to fast wake up state + * 0x01 | Sleep transition to suspend state + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_sleep_state( u8 v_gyro_sleep_state_u8) @@ -13252,24 +13249,24 @@ u8 v_gyro_sleep_state_u8) return com_rslt; } /*! -* @brief This API read gyro wakeup interrupt -* from the register 0x6C bit 6 -* -* @param v_gyro_wakeup_intr_u8 : The valeu of gyro wakeup interrupt -* Value | Description -* --------|------------- -* 0x00 | DISABLE -* 0x01 | ENABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro wakeup interrupt + * from the register 0x6C bit 6 + * + * @param v_gyro_wakeup_intr_u8 : The valeu of gyro wakeup interrupt + * Value | Description + * --------|------------- + * 0x00 | DISABLE + * 0x01 | ENABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_wakeup_intr( -u8*v_gyro_wakeup_intr_u8) +u8 *v_gyro_wakeup_intr_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13278,7 +13275,7 @@ u8*v_gyro_wakeup_intr_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read gyro wakeup interrupt*/ + /* read gyro wakeup interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_WAKEUP_INTR__REG, @@ -13290,21 +13287,21 @@ u8*v_gyro_wakeup_intr_u8) return com_rslt; } /*! -* @brief This API write gyro wakeup interrupt -* from the register 0x6C bit 6 -* -* @param v_gyro_wakeup_intr_u8 : The valeu of gyro wakeup interrupt -* Value | Description -* --------|------------- -* 0x00 | DISABLE -* 0x01 | ENABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro wakeup interrupt + * from the register 0x6C bit 6 + * + * @param v_gyro_wakeup_intr_u8 : The valeu of gyro wakeup interrupt + * Value | Description + * --------|------------- + * 0x00 | DISABLE + * 0x01 | ENABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_wakeup_intr( u8 v_gyro_wakeup_intr_u8) @@ -13317,7 +13314,7 @@ u8 v_gyro_wakeup_intr_u8) return E_SMI130_NULL_PTR; } else { if (v_gyro_wakeup_intr_u8 <= SMI130_MAX_VALUE_WAKEUP_INTR) { - /* write gyro wakeup interrupt*/ + /* write gyro wakeup interrupt */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_WAKEUP_INTR__REG, @@ -13338,26 +13335,26 @@ u8 v_gyro_wakeup_intr_u8) return com_rslt; } /*! -* @brief This API read accel select axis to be self-test -* -* @param v_accel_selftest_axis_u8 : -* The value of accel self test axis selection -* Value | Description -* --------|------------- -* 0x00 | disabled -* 0x01 | x-axis -* 0x02 | y-axis -* 0x03 | z-axis -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel select axis to be self-test + * + * @param v_accel_selftest_axis_u8 : + * The value of accel self test axis selection + * Value | Description + * --------|------------- + * 0x00 | disabled + * 0x01 | x-axis + * 0x02 | y-axis + * 0x03 | z-axis + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_selftest_axis( -u8*v_accel_selftest_axis_u8) +u8 *v_accel_selftest_axis_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13378,23 +13375,23 @@ u8*v_accel_selftest_axis_u8) return com_rslt; } /*! -* @brief This API write accel select axis to be self-test -* -* @param v_accel_selftest_axis_u8 : -* The value of accel self test axis selection -* Value | Description -* --------|------------- -* 0x00 | disabled -* 0x01 | x-axis -* 0x02 | y-axis -* 0x03 | z-axis -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel select axis to be self-test + * + * @param v_accel_selftest_axis_u8 : + * The value of accel self test axis selection + * Value | Description + * --------|------------- + * 0x00 | disabled + * 0x01 | x-axis + * 0x02 | y-axis + * 0x03 | z-axis + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_selftest_axis( u8 v_accel_selftest_axis_u8) @@ -13429,24 +13426,24 @@ u8 v_accel_selftest_axis_u8) return com_rslt; } /*! -* @brief This API read accel self test axis sign -* from the register 0x6D bit 2 -* -* @param v_accel_selftest_sign_u8: The value of accel self test axis sign -* Value | Description -* --------|------------- -* 0x00 | negative -* 0x01 | positive -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel self test axis sign + * from the register 0x6D bit 2 + * + * @param v_accel_selftest_sign_u8: The value of accel self test axis sign + * Value | Description + * --------|------------- + * 0x00 | negative + * 0x01 | positive + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_selftest_sign( -u8*v_accel_selftest_sign_u8) +u8 *v_accel_selftest_sign_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13467,21 +13464,21 @@ u8*v_accel_selftest_sign_u8) return com_rslt; } /*! -* @brief This API write accel self test axis sign -* from the register 0x6D bit 2 -* -* @param v_accel_selftest_sign_u8: The value of accel self test axis sign -* Value | Description -* --------|------------- -* 0x00 | negative -* 0x01 | positive -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel self test axis sign + * from the register 0x6D bit 2 + * + * @param v_accel_selftest_sign_u8: The value of accel self test axis sign + * Value | Description + * --------|------------- + * 0x00 | negative + * 0x01 | positive + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_selftest_sign( u8 v_accel_selftest_sign_u8) @@ -13516,25 +13513,25 @@ u8 v_accel_selftest_sign_u8) return com_rslt; } /*! -* @brief This API read accel self test amplitude -* from the register 0x6D bit 3 -* select amplitude of the selftest deflection: -* -* @param v_accel_selftest_amp_u8 : The value of accel self test amplitude -* Value | Description -* --------|------------- -* 0x00 | LOW -* 0x01 | HIGH -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel self test amplitude + * from the register 0x6D bit 3 + * select amplitude of the selftest deflection: + * + * @param v_accel_selftest_amp_u8 : The value of accel self test amplitude + * Value | Description + * --------|------------- + * 0x00 | LOW + * 0x01 | HIGH + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_selftest_amp( -u8*v_accel_selftest_amp_u8) +u8 *v_accel_selftest_amp_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13555,22 +13552,22 @@ u8*v_accel_selftest_amp_u8) return com_rslt; } /*! -* @brief This API write accel self test amplitude -* from the register 0x6D bit 3 -* select amplitude of the selftest deflection: -* -* @param v_accel_selftest_amp_u8 : The value of accel self test amplitude -* Value | Description -* --------|------------- -* 0x00 | LOW -* 0x01 | HIGH -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel self test amplitude + * from the register 0x6D bit 3 + * select amplitude of the selftest deflection: + * + * @param v_accel_selftest_amp_u8 : The value of accel self test amplitude + * Value | Description + * --------|------------- + * 0x00 | LOW + * 0x01 | HIGH + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_selftest_amp( u8 v_accel_selftest_amp_u8) @@ -13605,18 +13602,18 @@ u8 v_accel_selftest_amp_u8) return com_rslt; } /*! -* @brief This API read gyro self test trigger -* -* @param v_gyro_selftest_start_u8: The value of gyro self test start -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro self test trigger + * + * @param v_gyro_selftest_start_u8: The value of gyro self test start + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_selftest_start( -u8*v_gyro_selftest_start_u8) +u8 *v_gyro_selftest_start_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13625,7 +13622,7 @@ u8*v_gyro_selftest_start_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read gyro self test start*/ + /* read gyro self test start */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_SELFTEST_START__REG, @@ -13637,15 +13634,15 @@ u8*v_gyro_selftest_start_u8) return com_rslt; } /*! -* @brief This API write gyro self test trigger -* -* @param v_gyro_selftest_start_u8: The value of gyro self test start -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro self test trigger + * + * @param v_gyro_selftest_start_u8: The value of gyro self test start + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_selftest_start( u8 v_gyro_selftest_start_u8) @@ -13659,7 +13656,7 @@ u8 v_gyro_selftest_start_u8) } else { if (v_gyro_selftest_start_u8 <= SMI130_MAX_VALUE_SELFTEST_START) { - /* write gyro self test start*/ + /* write gyro self test start */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_GYRO_SELFTEST_START__REG, @@ -13680,23 +13677,23 @@ u8 v_gyro_selftest_start_u8) return com_rslt; } /*! -* @brief This API read primary interface selection I2C or SPI -* from the register 0x70 bit 0 -* -* @param v_spi_enable_u8: The value of Interface selection -* Value | Description -* --------|------------- -* 0x00 | I2C Enable -* 0x01 | I2C DISBALE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read primary interface selection I2C or SPI + * from the register 0x70 bit 0 + * + * @param v_spi_enable_u8: The value of Interface selection + * Value | Description + * --------|------------- + * 0x00 | I2C Enable + * 0x01 | I2C DISBALE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_spi_enable(u8*v_spi_enable_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_spi_enable(u8 *v_spi_enable_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13716,21 +13713,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_spi_enable(u8*v_spi_enable_u8) return com_rslt; } /*! -* @brief This API write primary interface selection I2C or SPI -* from the register 0x70 bit 0 -* -* @param v_spi_enable_u8: The value of Interface selection -* Value | Description -* --------|------------- -* 0x00 | I2C Enable -* 0x01 | I2C DISBALE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write primary interface selection I2C or SPI + * from the register 0x70 bit 0 + * + * @param v_spi_enable_u8: The value of Interface selection + * Value | Description + * --------|------------- + * 0x00 | I2C Enable + * 0x01 | I2C DISBALE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_spi_enable(u8 v_spi_enable_u8) { @@ -13759,21 +13756,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_spi_enable(u8 v_spi_enable_u8) return com_rslt; } /*! -* @brief This API read the spare zero -* form register 0x70 bit 3 -* -* -* @param v_spare0_trim_u8: The value of spare zero -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read the spare zero + * form register 0x70 bit 3 + * + * + * @param v_spare0_trim_u8: The value of spare zero + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_spare0_trim(u8*v_spare0_trim_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_spare0_trim(u8 *v_spare0_trim_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13793,19 +13790,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_spare0_trim(u8*v_spare0_trim_u8) return com_rslt; } /*! -* @brief This API write the spare zero -* form register 0x70 bit 3 -* -* -* @param v_spare0_trim_u8: The value of spare zero -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write the spare zero + * form register 0x70 bit 3 + * + * + * @param v_spare0_trim_u8: The value of spare zero + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_spare0_trim(u8 v_spare0_trim_u8) { @@ -13834,21 +13831,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_spare0_trim(u8 v_spare0_trim_u8) return com_rslt; } /*! -* @brief This API read the NVM counter -* form register 0x70 bit 4 to 7 -* -* -* @param v_nvm_counter_u8: The value of NVM counter -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read the NVM counter + * form register 0x70 bit 4 to 7 + * + * + * @param v_nvm_counter_u8: The value of NVM counter + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_nvm_counter(u8*v_nvm_counter_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_nvm_counter(u8 *v_nvm_counter_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13868,19 +13865,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_nvm_counter(u8*v_nvm_counter_u8) return com_rslt; } /*! -* @brief This API write the NVM counter -* form register 0x70 bit 4 to 7 -* -* -* @param v_nvm_counter_u8: The value of NVM counter -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write the NVM counter + * form register 0x70 bit 4 to 7 + * + * + * @param v_nvm_counter_u8: The value of NVM counter + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_nvm_counter( u8 v_nvm_counter_u8) @@ -13910,24 +13907,24 @@ u8 v_nvm_counter_u8) return com_rslt; } /*! -* @brief This API read accel manual offset compensation of x axis -* from the register 0x71 bit 0 to 7 -* -* -* -* @param v_accel_off_x_s8: -* The value of accel manual offset compensation of x axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel manual offset compensation of x axis + * from the register 0x71 bit 0 to 7 + * + * + * + * @param v_accel_off_x_s8: + * The value of accel manual offset compensation of x axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_offset_compensation_xaxis( -s8*v_accel_off_x_s8) +s8 *v_accel_off_x_s8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -13947,21 +13944,21 @@ s8*v_accel_off_x_s8) return com_rslt; } /*! -* @brief This API write accel manual offset compensation of x axis -* from the register 0x71 bit 0 to 7 -* -* -* -* @param v_accel_off_x_s8: -* The value of accel manual offset compensation of x axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel manual offset compensation of x axis + * from the register 0x71 bit 0 to 7 + * + * + * + * @param v_accel_off_x_s8: + * The value of accel manual offset compensation of x axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_offset_compensation_xaxis( s8 v_accel_off_x_s8) @@ -13974,7 +13971,7 @@ u8 v_status_s8 = SUCCESS; if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* enable accel offset*/ + /* enable accel offset */ v_status_s8 = smi130_set_accel_offset_enable( ACCEL_OFFSET_ENABLE); if (v_status_s8 == SUCCESS) { @@ -14003,24 +14000,24 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read accel manual offset compensation of y axis -* from the register 0x72 bit 0 to 7 -* -* -* -* @param v_accel_off_y_s8: -* The value of accel manual offset compensation of y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel manual offset compensation of y axis + * from the register 0x72 bit 0 to 7 + * + * + * + * @param v_accel_off_y_s8: + * The value of accel manual offset compensation of y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_offset_compensation_yaxis( -s8*v_accel_off_y_s8) +s8 *v_accel_off_y_s8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14040,21 +14037,21 @@ s8*v_accel_off_y_s8) return com_rslt; } /*! -* @brief This API write accel manual offset compensation of y axis -* from the register 0x72 bit 0 to 7 -* -* -* -* @param v_accel_off_y_s8: -* The value of accel manual offset compensation of y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel manual offset compensation of y axis + * from the register 0x72 bit 0 to 7 + * + * + * + * @param v_accel_off_y_s8: + * The value of accel manual offset compensation of y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_offset_compensation_yaxis( s8 v_accel_off_y_s8) @@ -14067,7 +14064,7 @@ u8 v_status_s8 = SUCCESS; if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* enable accel offset*/ + /* enable accel offset */ v_status_s8 = smi130_set_accel_offset_enable( ACCEL_OFFSET_ENABLE); if (v_status_s8 == SUCCESS) { @@ -14096,24 +14093,24 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read accel manual offset compensation of z axis -* from the register 0x73 bit 0 to 7 -* -* -* -* @param v_accel_off_z_s8: -* The value of accel manual offset compensation of z axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read accel manual offset compensation of z axis + * from the register 0x73 bit 0 to 7 + * + * + * + * @param v_accel_off_z_s8: + * The value of accel manual offset compensation of z axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_offset_compensation_zaxis( -s8*v_accel_off_z_s8) +s8 *v_accel_off_z_s8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14133,21 +14130,21 @@ s8*v_accel_off_z_s8) return com_rslt; } /*! -* @brief This API write accel manual offset compensation of z axis -* from the register 0x73 bit 0 to 7 -* -* -* -* @param v_accel_off_z_s8: -* The value of accel manual offset compensation of z axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write accel manual offset compensation of z axis + * from the register 0x73 bit 0 to 7 + * + * + * + * @param v_accel_off_z_s8: + * The value of accel manual offset compensation of z axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_offset_compensation_zaxis( s8 v_accel_off_z_s8) @@ -14160,7 +14157,7 @@ s8 v_accel_off_z_s8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* enable accel offset*/ + /* enable accel offset */ v_status_s8 = smi130_set_accel_offset_enable( ACCEL_OFFSET_ENABLE); if (v_status_s8 == SUCCESS) { @@ -14191,24 +14188,24 @@ s8 v_accel_off_z_s8) return com_rslt; } /*! -* @brief This API read gyro manual offset compensation of x axis -* from the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1 -* -* -* -* @param v_gyro_off_x_s16: -* The value of gyro manual offset compensation of x axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro manual offset compensation of x axis + * from the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1 + * + * + * + * @param v_gyro_off_x_s16: + * The value of gyro manual offset compensation of x axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_offset_compensation_xaxis( -s16*v_gyro_off_x_s16) +s16 *v_gyro_off_x_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14243,21 +14240,21 @@ s16*v_gyro_off_x_s16) return com_rslt; } /*! -* @brief This API write gyro manual offset compensation of x axis -* from the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1 -* -* -* -* @param v_gyro_off_x_s16: -* The value of gyro manual offset compensation of x axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro manual offset compensation of x axis + * from the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1 + * + * + * + * @param v_gyro_off_x_s16: + * The value of gyro manual offset compensation of x axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_offset_compensation_xaxis( s16 v_gyro_off_x_s16) @@ -14325,24 +14322,24 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read gyro manual offset compensation of y axis -* from the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3 -* -* -* -* @param v_gyro_off_y_s16: -* The value of gyro manual offset compensation of y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro manual offset compensation of y axis + * from the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3 + * + * + * + * @param v_gyro_off_y_s16: + * The value of gyro manual offset compensation of y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_offset_compensation_yaxis( -s16*v_gyro_off_y_s16) +s16 *v_gyro_off_y_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14377,21 +14374,21 @@ s16*v_gyro_off_y_s16) return com_rslt; } /*! -* @brief This API write gyro manual offset compensation of y axis -* from the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3 -* -* -* -* @param v_gyro_off_y_s16: -* The value of gyro manual offset compensation of y axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro manual offset compensation of y axis + * from the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3 + * + * + * + * @param v_gyro_off_y_s16: + * The value of gyro manual offset compensation of y axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_offset_compensation_yaxis( s16 v_gyro_off_y_s16) @@ -14405,7 +14402,7 @@ u8 v_status_s8 = SUCCESS; if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* enable gyro offset bit*/ + /* enable gyro offset bit */ v_status_s8 = smi130_set_gyro_offset_enable( GYRO_OFFSET_ENABLE); /* write gyro offset y*/ @@ -14460,24 +14457,24 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read gyro manual offset compensation of z axis -* from the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5 -* -* -* -* @param v_gyro_off_z_s16: -* The value of gyro manual offset compensation of z axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read gyro manual offset compensation of z axis + * from the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5 + * + * + * + * @param v_gyro_off_z_s16: + * The value of gyro manual offset compensation of z axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_offset_compensation_zaxis( -s16*v_gyro_off_z_s16) +s16 *v_gyro_off_z_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14515,21 +14512,21 @@ s16*v_gyro_off_z_s16) return com_rslt; } /*! -* @brief This API write gyro manual offset compensation of z axis -* from the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5 -* -* -* -* @param v_gyro_off_z_s16: -* The value of gyro manual offset compensation of z axis -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write gyro manual offset compensation of z axis + * from the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5 + * + * + * + * @param v_gyro_off_z_s16: + * The value of gyro manual offset compensation of z axis + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_offset_compensation_zaxis( s16 v_gyro_off_z_s16) @@ -14598,26 +14595,26 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API read the accel offset enable bit -* from the register 0x77 bit 6 -* -* -* -* @param v_accel_off_enable_u8: The value of accel offset enable -* value | Description -* ----------|-------------- -* 0x01 | ENABLE -* 0x00 | DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read the accel offset enable bit + * from the register 0x77 bit 6 + * + * + * + * @param v_accel_off_enable_u8: The value of accel offset enable + * value | Description + * ----------|-------------- + * 0x01 | ENABLE + * 0x00 | DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_accel_offset_enable( -u8*v_accel_off_enable_u8) +u8 *v_accel_off_enable_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14626,7 +14623,7 @@ u8*v_accel_off_enable_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read accel offset enable*/ + /* read accel offset enable */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_OFFSET_6_ACCEL_OFF_ENABLE__REG, @@ -14637,23 +14634,23 @@ u8*v_accel_off_enable_u8) return com_rslt; } /*! -* @brief This API write the accel offset enable bit -* from the register 0x77 bit 6 -* -* -* -* @param v_accel_off_enable_u8: The value of accel offset enable -* value | Description -* ----------|-------------- -* 0x01 | ENABLE -* 0x00 | DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write the accel offset enable bit + * from the register 0x77 bit 6 + * + * + * + * @param v_accel_off_enable_u8: The value of accel offset enable + * value | Description + * ----------|-------------- + * 0x01 | ENABLE + * 0x00 | DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_accel_offset_enable( u8 v_accel_off_enable_u8) @@ -14665,7 +14662,7 @@ u8 v_accel_off_enable_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* write accel offset enable*/ + /* write accel offset enable */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_OFFSET_6_ACCEL_OFF_ENABLE__REG, @@ -14683,26 +14680,26 @@ u8 v_accel_off_enable_u8) return com_rslt; } /*! -* @brief This API read the accel offset enable bit -* from the register 0x77 bit 7 -* -* -* -* @param v_gyro_off_enable_u8: The value of gyro offset enable -* value | Description -* ----------|-------------- -* 0x01 | ENABLE -* 0x00 | DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read the accel offset enable bit + * from the register 0x77 bit 7 + * + * + * + * @param v_gyro_off_enable_u8: The value of gyro offset enable + * value | Description + * ----------|-------------- + * 0x01 | ENABLE + * 0x00 | DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_gyro_offset_enable( -u8*v_gyro_off_enable_u8) +u8 *v_gyro_off_enable_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14722,23 +14719,23 @@ u8*v_gyro_off_enable_u8) return com_rslt; } /*! -* @brief This API write the accel offset enable bit -* from the register 0x77 bit 7 -* -* -* -* @param v_gyro_off_enable_u8: The value of gyro offset enable -* value | Description -* ----------|-------------- -* 0x01 | ENABLE -* 0x00 | DISABLE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write the accel offset enable bit + * from the register 0x77 bit 7 + * + * + * + * @param v_gyro_off_enable_u8: The value of gyro offset enable + * value | Description + * ----------|-------------- + * 0x01 | ENABLE + * 0x00 | DISABLE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_gyro_offset_enable( u8 v_gyro_off_enable_u8) @@ -14768,23 +14765,23 @@ u8 v_gyro_off_enable_u8) return com_rslt; } /*! -* @brief This API reads step counter value -* form the register 0x78 and 0x79 -* -* -* -* -* @param v_step_cnt_s16 : The value of step counter -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API reads step counter value + * form the register 0x78 and 0x79 + * + * + * + * + * @param v_step_cnt_s16 : The value of step counter + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_read_step_count(u16*v_step_cnt_s16) +SMI130_RETURN_FUNCTION_TYPE smi130_read_step_count(u16 *v_step_cnt_s16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14797,7 +14794,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_step_count(u16*v_step_cnt_s16) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read step counter*/ + /* read step counter */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC(p_smi130->dev_addr, SMI130_USER_STEP_COUNT_LSB__REG, @@ -14811,22 +14808,22 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_step_count(u16*v_step_cnt_s16) return com_rslt; } /*! -* @brief This API Reads -* step counter configuration -* from the register 0x7A bit 0 to 7 -* and from the register 0x7B bit 0 to 2 and 4 to 7 -* -* -* @param v_step_config_u16 : The value of step configuration -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API Reads + * step counter configuration + * from the register 0x7A bit 0 to 7 + * and from the register 0x7B bit 0 to 2 and 4 to 7 + * + * + * @param v_step_config_u16 : The value of step configuration + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_step_config( -u16*v_step_config_u16) +u16 *v_step_config_u16) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14862,20 +14859,20 @@ u16*v_step_config_u16) return com_rslt; } /*! -* @brief This API write -* step counter configuration -* from the register 0x7A bit 0 to 7 -* and from the register 0x7B bit 0 to 2 and 4 to 7 -* -* -* @param v_step_config_u16 : -* the value of Enable step configuration -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write + * step counter configuration + * from the register 0x7A bit 0 to 7 + * and from the register 0x7B bit 0 to 2 and 4 to 7 + * + * + * @param v_step_config_u16 : + * the value of Enable step configuration + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_step_config( u16 v_step_config_u16) @@ -14931,20 +14928,20 @@ u16 v_step_config_u16) return com_rslt; } /*! -* @brief This API read enable step counter -* from the register 0x7B bit 3 -* -* -* @param v_step_counter_u8 : The value of step counter enable -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read enable step counter + * from the register 0x7B bit 3 + * + * + * @param v_step_counter_u8 : The value of step counter enable + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_step_counter_enable( -u8*v_step_counter_u8) +u8 *v_step_counter_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -14953,7 +14950,7 @@ u8*v_step_counter_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the step counter*/ + /* read the step counter */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__REG, @@ -14964,17 +14961,17 @@ u8*v_step_counter_u8) return com_rslt; } /*! -* @brief This API write enable step counter -* from the register 0x7B bit 3 -* -* -* @param v_step_counter_u8 : The value of step counter enable -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write enable step counter + * from the register 0x7B bit 3 + * + * + * @param v_step_counter_u8 : The value of step counter enable + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_step_counter_enable(u8 v_step_counter_u8) { @@ -14986,7 +14983,7 @@ if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { if (v_step_counter_u8 <= SMI130_MAX_GYRO_STEP_COUNTER) { - /* write the step counter*/ + /* write the step counter */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__REG, @@ -15009,22 +15006,22 @@ if (p_smi130 == SMI130_NULL) { return com_rslt; } /*! -* @brief This API set Step counter modes -* -* -* @param v_step_mode_u8 : The value of step counter mode -* value | mode -* ----------|----------- -* 0 | SMI130_STEP_NORMAL_MODE -* 1 | SMI130_STEP_SENSITIVE_MODE -* 2 | SMI130_STEP_ROBUST_MODE -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This API set Step counter modes + * + * + * @param v_step_mode_u8 : The value of step counter mode + * value | mode + * ----------|----------- + * 0 | SMI130_STEP_NORMAL_MODE + * 1 | SMI130_STEP_SENSITIVE_MODE + * 2 | SMI130_STEP_ROBUST_MODE + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_step_mode(u8 v_step_mode_u8) { /* variable used for return the status of communication result*/ @@ -15054,21 +15051,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_step_mode(u8 v_step_mode_u8) return com_rslt; } /*! -* @brief This API used to trigger the signification motion -* interrupt -* -* -* @param v_significant_u8 : The value of interrupt selection -* value | interrupt -* ----------|----------- -* 0 | SMI130_MAP_INTR1 -* 1 | SMI130_MAP_INTR2 -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API used to trigger the signification motion + * interrupt + * + * + * @param v_significant_u8 : The value of interrupt selection + * value | interrupt + * ----------|----------- + * 0 | SMI130_MAP_INTR1 + * 1 | SMI130_MAP_INTR2 + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_map_significant_motion_intr( u8 v_significant_u8) @@ -15080,14 +15077,14 @@ u8 v_significant_u8) u8 v_any_motion_intr1_stat_u8 = SMI130_ENABLE_ANY_MOTION_INTR1; u8 v_any_motion_intr2_stat_u8 = SMI130_ENABLE_ANY_MOTION_INTR2; u8 v_any_motion_axis_stat_u8 = SMI130_ENABLE_ANY_MOTION_AXIS; - /* enable the significant motion interrupt*/ + /* enable the significant motion interrupt */ com_rslt = smi130_get_intr_significant_motion_select(&v_sig_motion_u8); if (v_sig_motion_u8 != SMI130_SIG_MOTION_STAT_HIGH) com_rslt += smi130_set_intr_significant_motion_select( SMI130_SIG_MOTION_INTR_ENABLE); switch (v_significant_u8) { case SMI130_MAP_INTR1: - /* interrupt*/ + /* interrupt */ com_rslt += smi130_read_reg( SMI130_USER_INTR_MAP_0_INTR1_ANY_MOTION__REG, &v_data_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -15135,21 +15132,21 @@ u8 v_significant_u8) return com_rslt; } /*! -* @brief This API used to trigger the step detector -* interrupt -* -* -* @param v_step_detector_u8 : The value of interrupt selection -* value | interrupt -* ----------|----------- -* 0 | SMI130_MAP_INTR1 -* 1 | SMI130_MAP_INTR2 -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API used to trigger the step detector + * interrupt + * + * + * @param v_step_detector_u8 : The value of interrupt selection + * value | interrupt + * ----------|----------- + * 0 | SMI130_MAP_INTR1 + * 1 | SMI130_MAP_INTR2 + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_map_step_detector_intr( u8 v_step_detector_u8) @@ -15218,18 +15215,18 @@ u8 v_step_detector_u8) return com_rslt; } /*! -* @brief This API used to clear the step counter interrupt -* interrupt -* -* -* @param : None -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API used to clear the step counter interrupt + * interrupt + * + * + * @param : None + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_clear_step_counter(void) { @@ -15243,42 +15240,42 @@ SMI130_RETURN_FUNCTION_TYPE smi130_clear_step_counter(void) } /*! -* @brief This API writes value to the register 0x7E bit 0 to 7 -* -* -* @param v_command_reg_u8 : The value to write command register -* value | Description -* ---------|-------------------------------------------------------- -* 0x00 | Reserved -* 0x03 | Starts fast offset calibration for the accel and gyro -* 0x10 | Sets the PMU mode for the Accelerometer to suspend -* 0x11 | Sets the PMU mode for the Accelerometer to normal -* 0x12 | Sets the PMU mode for the Accelerometer Lowpower -* 0x14 | Sets the PMU mode for the Gyroscope to suspend -* 0x15 | Sets the PMU mode for the Gyroscope to normal -* 0x16 | Reserved -* 0x17 | Sets the PMU mode for the Gyroscope to fast start-up -* 0x18 | Sets the PMU mode for the Magnetometer to suspend -* 0x19 | Sets the PMU mode for the Magnetometer to normal -* 0x1A | Sets the PMU mode for the Magnetometer to Lowpower -* 0xB0 | Clears all data in the FIFO -* 0xB1 | Resets the interrupt engine -* 0xB2 | step_cnt_clr Clears the step counter -* 0xB6 | Triggers a reset -* 0x37 | See extmode_en_last -* 0x9A | See extmode_en_last -* 0xC0 | Enable the extended mode -* 0xC4 | Erase NVM cell -* 0xC8 | Load NVM cell -* 0xF0 | Reset acceleration data path -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API writes value to the register 0x7E bit 0 to 7 + * + * + * @param v_command_reg_u8 : The value to write command register + * value | Description + * ---------|-------------------------------------------------------- + * 0x00 | Reserved + * 0x03 | Starts fast offset calibration for the accel and gyro + * 0x10 | Sets the PMU mode for the Accelerometer to suspend + * 0x11 | Sets the PMU mode for the Accelerometer to normal + * 0x12 | Sets the PMU mode for the Accelerometer Lowpower + * 0x14 | Sets the PMU mode for the Gyroscope to suspend + * 0x15 | Sets the PMU mode for the Gyroscope to normal + * 0x16 | Reserved + * 0x17 | Sets the PMU mode for the Gyroscope to fast start-up + * 0x18 | Sets the PMU mode for the Magnetometer to suspend + * 0x19 | Sets the PMU mode for the Magnetometer to normal + * 0x1A | Sets the PMU mode for the Magnetometer to Lowpower + * 0xB0 | Clears all data in the FIFO + * 0xB1 | Resets the interrupt engine + * 0xB2 | step_cnt_clr Clears the step counter + * 0xB6 | Triggers a reset + * 0x37 | See extmode_en_last + * 0x9A | See extmode_en_last + * 0xC0 | Enable the extended mode + * 0xC4 | Erase NVM cell + * 0xC8 | Load NVM cell + * 0xF0 | Reset acceleration data path + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_command_register(u8 v_command_reg_u8) { @@ -15287,7 +15284,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_command_register(u8 v_command_reg_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* write command register*/ + /* write command register */ com_rslt = p_smi130->SMI130_BUS_WRITE_FUNC( p_smi130->dev_addr, SMI130_CMD_COMMANDS__REG, @@ -15296,21 +15293,21 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_command_register(u8 v_command_reg_u8) return com_rslt; } /*! -* @brief This API read target page from the register 0x7F bit 4 and 5 -* -* @param v_target_page_u8: The value of target page -* value | page -* ---------|----------- -* 0 | User data/configure page -* 1 | Chip level trim/test page -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read target page from the register 0x7F bit 4 and 5 + * + * @param v_target_page_u8: The value of target page + * value | page + * ---------|----------- + * 0 | User data/configure page + * 1 | Chip level trim/test page + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_target_page(u8*v_target_page_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_target_page(u8 *v_target_page_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -15330,19 +15327,19 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_target_page(u8*v_target_page_u8) return com_rslt; } /*! -* @brief This API write target page from the register 0x7F bit 4 and 5 -* -* @param v_target_page_u8: The value of target page -* value | page -* ---------|----------- -* 0 | User data/configure page -* 1 | Chip level trim/test page -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write target page from the register 0x7F bit 4 and 5 + * + * @param v_target_page_u8: The value of target page + * value | page + * ---------|----------- + * 0 | User data/configure page + * 1 | Chip level trim/test page + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_target_page(u8 v_target_page_u8) { @@ -15377,25 +15374,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_target_page(u8 v_target_page_u8) return com_rslt; } /*! -* @brief This API read page enable from the register 0x7F bit 7 -* -* -* -* @param v_page_enable_u8: The value of page enable -* value | page -* ---------|----------- -* 0 | DISABLE -* 1 | ENABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read page enable from the register 0x7F bit 7 + * + * + * + * @param v_page_enable_u8: The value of page enable + * value | page + * ---------|----------- + * 0 | DISABLE + * 1 | ENABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ -SMI130_RETURN_FUNCTION_TYPE smi130_get_paging_enable(u8*v_page_enable_u8) +SMI130_RETURN_FUNCTION_TYPE smi130_get_paging_enable(u8 *v_page_enable_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -15404,7 +15401,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_paging_enable(u8*v_page_enable_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the page enable*/ + /* read the page enable */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_CMD_PAGING_EN__REG, @@ -15415,23 +15412,23 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_paging_enable(u8*v_page_enable_u8) return com_rslt; } /*! -* @brief This API write page enable from the register 0x7F bit 7 -* -* -* -* @param v_page_enable_u8: The value of page enable -* value | page -* ---------|----------- -* 0 | DISABLE -* 1 | ENABLE -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write page enable from the register 0x7F bit 7 + * + * + * + * @param v_page_enable_u8: The value of page enable + * value | page + * ---------|----------- + * 0 | DISABLE + * 1 | ENABLE + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_paging_enable( u8 v_page_enable_u8) @@ -15444,7 +15441,7 @@ u8 v_page_enable_u8) return E_SMI130_NULL_PTR; } else { if (v_page_enable_u8 <= SMI130_MAX_VALUE_PAGE) { - /* write the page enable*/ + /* write the page enable */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_CMD_PAGING_EN__REG, @@ -15467,23 +15464,23 @@ u8 v_page_enable_u8) return com_rslt; } /*! -* @brief This API read -* pull up configuration from the register 0X85 bit 4 an 5 -* -* -* -* @param v_control_pullup_u8: The value of pull up register -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API read + * pull up configuration from the register 0X85 bit 4 an 5 + * + * + * + * @param v_control_pullup_u8: The value of pull up register + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_pullup_configuration( -u8*v_control_pullup_u8) +u8 *v_control_pullup_u8) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -15492,7 +15489,7 @@ u8*v_control_pullup_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read pull up value*/ + /* read pull up value */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC( p_smi130->dev_addr, SMI130_COM_C_TRIM_FIVE__REG, @@ -15504,20 +15501,20 @@ u8*v_control_pullup_u8) } /*! -* @brief This API write -* pull up configuration from the register 0X85 bit 4 an 5 -* -* -* -* @param v_control_pullup_u8: The value of pull up register -* -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This API write + * pull up configuration from the register 0X85 bit 4 an 5 + * + * + * + * @param v_control_pullup_u8: The value of pull up register + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_pullup_configuration( u8 v_control_pullup_u8) @@ -15529,7 +15526,7 @@ u8 v_control_pullup_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* write pull up value*/ + /* write pull up value */ com_rslt = p_smi130->SMI130_BUS_READ_FUNC (p_smi130->dev_addr, SMI130_COM_C_TRIM_FIVE__REG, @@ -15550,30 +15547,30 @@ u8 v_control_pullup_u8) } /*! -* @brief This function used for read the compensated value of mag -* Before start reading the mag compensated data's -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for read the compensated value of mag + * Before start reading the mag compensated data's + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_compensate_xyz( -struct smi130_mag_xyz_s32_t*mag_comp_xyz) +struct smi130_mag_xyz_s32_t *mag_comp_xyz) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -15581,15 +15578,15 @@ struct smi130_mag_xyz_s32_t*mag_comp_xyz) com_rslt = smi130_read_mag_xyzr(&mag_xyzr); if (com_rslt) return com_rslt; - /* Compensation for X axis*/ + /* Compensation for X axis */ mag_comp_xyz->x = smi130_bmm150_mag_compensate_X( mag_xyzr.x, mag_xyzr.r); - /* Compensation for Y axis*/ + /* Compensation for Y axis */ mag_comp_xyz->y = smi130_bmm150_mag_compensate_Y( mag_xyzr.y, mag_xyzr.r); - /* Compensation for Z axis*/ + /* Compensation for Z axis */ mag_comp_xyz->z = smi130_bmm150_mag_compensate_Z( mag_xyzr.z, mag_xyzr.r); @@ -15597,78 +15594,78 @@ struct smi130_mag_xyz_s32_t*mag_comp_xyz) } /*! -* @brief This function used for read the compensated value of mag -* Before start reading the mag compensated data's -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for read the compensated value of mag + * Before start reading the mag compensated data's + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_compensate_xyz_raw( -struct smi130_mag_xyz_s32_t*mag_comp_xyz, struct smi130_mag_xyzr_t mag_xyzr) +struct smi130_mag_xyz_s32_t *mag_comp_xyz, struct smi130_mag_xyzr_t mag_xyzr) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; - /* Compensation for X axis*/ + /* Compensation for X axis */ mag_comp_xyz->x = smi130_bmm150_mag_compensate_X( mag_xyzr.x, mag_xyzr.r); - /* Compensation for Y axis*/ + /* Compensation for Y axis */ mag_comp_xyz->y = smi130_bmm150_mag_compensate_Y( mag_xyzr.y, mag_xyzr.r); - /* Compensation for Z axis*/ + /* Compensation for Z axis */ mag_comp_xyz->z = smi130_bmm150_mag_compensate_Z( mag_xyzr.z, mag_xyzr.r); return com_rslt; } /*! -* @brief This API used to get the compensated BMM150-X data -* the out put of X as s32 -* Before start reading the mag compensated X data -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* -* @param v_mag_data_x_s16 : The value of mag raw X data -* @param v_data_r_u16 : The value of mag R data -* -* @return results of compensated X data value output as s32 -* -*/ + * @brief This API used to get the compensated BMM150-X data + * the out put of X as s32 + * Before start reading the mag compensated X data + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * + * @param v_mag_data_x_s16 : The value of mag raw X data + * @param v_data_r_u16 : The value of mag R data + * + * @return results of compensated X data value output as s32 + * + */ s32 smi130_bmm150_mag_compensate_X(s16 v_mag_data_x_s16, u16 v_data_r_u16) { s32 inter_retval = SMI130_INIT_VALUE; -/* no overflow*/ +/* no overflow */ if (v_mag_data_x_s16 != SMI130_MAG_FLIP_OVERFLOW_ADCVAL) { if ((v_data_r_u16 != 0) && (mag_trim.dig_xyz1 != 0)) { @@ -15682,60 +15679,60 @@ if (v_mag_data_x_s16 != SMI130_MAG_FLIP_OVERFLOW_ADCVAL) { inter_retval = SMI130_MAG_OVERFLOW_OUTPUT; return inter_retval; } - inter_retval = ((s32)((((s32)v_mag_data_x_s16)* - ((((((((s32)mag_trim.dig_xy2)* - ((((s32)inter_retval)* + inter_retval = ((s32)((((s32)v_mag_data_x_s16) * + ((((((((s32)mag_trim.dig_xy2) * + ((((s32)inter_retval) * ((s32)inter_retval)) >> SMI130_SHIFT_BIT_POSITION_BY_07_BITS)) + - (((s32)inter_retval)* + (((s32)inter_retval) * ((s32)(((s16)mag_trim.dig_xy1) << SMI130_SHIFT_BIT_POSITION_BY_07_BITS)))) >> SMI130_SHIFT_BIT_POSITION_BY_09_BITS) + - ((s32)0x100000))* + ((s32)0x100000)) * ((s32)(((s16)mag_trim.dig_x2) + ((s16)0xA0)))) >> SMI130_SHIFT_BIT_POSITION_BY_12_BITS)) >> SMI130_SHIFT_BIT_POSITION_BY_13_BITS)) + (((s16)mag_trim.dig_x1) << SMI130_SHIFT_BIT_POSITION_BY_03_BITS); - /* check the overflow output*/ + /* check the overflow output */ if (inter_retval == (s32)SMI130_MAG_OVERFLOW_OUTPUT) inter_retval = SMI130_MAG_OVERFLOW_OUTPUT_S32; } else { - /* overflow*/ + /* overflow */ inter_retval = SMI130_MAG_OVERFLOW_OUTPUT; } return inter_retval; } /*! -* @brief This API used to get the compensated BMM150-Y data -* the out put of Y as s32 -* Before start reading the mag compensated Y data -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* -* @param v_mag_data_y_s16 : The value of mag raw Y data -* @param v_data_r_u16 : The value of mag R data -* -* @return results of compensated Y data value output as s32 -*/ + * @brief This API used to get the compensated BMM150-Y data + * the out put of Y as s32 + * Before start reading the mag compensated Y data + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * + * @param v_mag_data_y_s16 : The value of mag raw Y data + * @param v_data_r_u16 : The value of mag R data + * + * @return results of compensated Y data value output as s32 + */ s32 smi130_bmm150_mag_compensate_Y(s16 v_mag_data_y_s16, u16 v_data_r_u16) { s32 inter_retval = SMI130_INIT_VALUE; -/* no overflow*/ +/* no overflow */ if (v_mag_data_y_s16 != SMI130_MAG_FLIP_OVERFLOW_ADCVAL) { if ((v_data_r_u16 != 0) && (mag_trim.dig_xyz1 != 0)) { @@ -15749,10 +15746,10 @@ if (v_mag_data_y_s16 != SMI130_MAG_FLIP_OVERFLOW_ADCVAL) { inter_retval = SMI130_MAG_OVERFLOW_OUTPUT; return inter_retval; } - inter_retval = ((s32)((((s32)v_mag_data_y_s16)* ((((((((s32) - mag_trim.dig_xy2)* ((((s32) inter_retval)* + inter_retval = ((s32)((((s32)v_mag_data_y_s16) * ((((((((s32) + mag_trim.dig_xy2) * ((((s32) inter_retval) * ((s32)inter_retval)) >> SMI130_SHIFT_BIT_POSITION_BY_07_BITS)) - + (((s32)inter_retval)* + + (((s32)inter_retval) * ((s32)(((s16)mag_trim.dig_xy1) << SMI130_SHIFT_BIT_POSITION_BY_07_BITS)))) >> SMI130_SHIFT_BIT_POSITION_BY_09_BITS) + @@ -15763,40 +15760,40 @@ if (v_mag_data_y_s16 != SMI130_MAG_FLIP_OVERFLOW_ADCVAL) { >> SMI130_SHIFT_BIT_POSITION_BY_13_BITS)) + (((s16)mag_trim.dig_y1) << SMI130_SHIFT_BIT_POSITION_BY_03_BITS); - /* check the overflow output*/ + /* check the overflow output */ if (inter_retval == (s32)SMI130_MAG_OVERFLOW_OUTPUT) inter_retval = SMI130_MAG_OVERFLOW_OUTPUT_S32; } else { - /* overflow*/ + /* overflow */ inter_retval = SMI130_MAG_OVERFLOW_OUTPUT; } return inter_retval; } /*! -* @brief This API used to get the compensated BMM150-Z data -* the out put of Z as s32 -* Before start reading the mag compensated Z data -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* -* @param v_mag_data_z_s16 : The value of mag raw Z data -* @param v_data_r_u16 : The value of mag R data -* -* @return results of compensated Z data value output as s32 -*/ + * @brief This API used to get the compensated BMM150-Z data + * the out put of Z as s32 + * Before start reading the mag compensated Z data + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * + * @param v_mag_data_z_s16 : The value of mag raw Z data + * @param v_data_r_u16 : The value of mag R data + * + * @return results of compensated Z data value output as s32 + */ s32 smi130_bmm150_mag_compensate_Z(s16 v_mag_data_z_s16, u16 v_data_r_u16) { s32 retval = SMI130_INIT_VALUE; @@ -15809,12 +15806,12 @@ s32 smi130_bmm150_mag_compensate_Z(s16 v_mag_data_z_s16, u16 v_data_r_u16) && (mag_trim.dig_xyz1 != 0)) { retval = (((((s32)(v_mag_data_z_s16 - mag_trim.dig_z4)) << SMI130_SHIFT_BIT_POSITION_BY_15_BITS) - - ((((s32)mag_trim.dig_z3)* + ((((s32)mag_trim.dig_z3) * ((s32)(((s16)v_data_r_u16) - ((s16)mag_trim.dig_xyz1)))) >> SMI130_SHIFT_BIT_POSITION_BY_02_BITS))/ (mag_trim.dig_z2 + - ((s16)(((((s32)mag_trim.dig_z1)* + ((s16)(((((s32)mag_trim.dig_z1) * ((((s16)v_data_r_u16) << SMI130_SHIFT_BIT_POSITION_BY_01_BIT))) + (1 << SMI130_SHIFT_BIT_POSITION_BY_15_BITS)) @@ -15826,14 +15823,14 @@ s32 smi130_bmm150_mag_compensate_Z(s16 v_mag_data_z_s16, u16 v_data_r_u16) return retval; } /*! -* @brief This function used for initialize the bmm150 sensor -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for initialize the bmm150 sensor + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_interface_init(void) { @@ -15881,7 +15878,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_interface_init(void) com_rslt += smi130_set_mag_manual_enable(SMI130_MANUAL_ENABLE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_mag_manual_enable(&v_data_u8); - /*Enable the MAG interface*/ + /*Enable the MAG interface */ com_rslt += smi130_set_if_mode(SMI130_ENABLE_MAG_IF_MODE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_if_mode(&v_data_u8); @@ -15919,7 +15916,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_interface_init(void) V_bmm150_maual_auto_condition_u8 = SMI130_MANUAL_DISABLE; /* Set the power mode of mag as force mode*/ /* The data have to write for the register - It write the value in the register 0x4F*/ + It write the value in the register 0x4F */ com_rslt += smi130_set_mag_write_data(SMI130_BMM150_FORCE_MODE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); printk(KERN_INFO "com_rslt:%d, <%s><%d>\n", @@ -15946,15 +15943,15 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_interface_init(void) return com_rslt; } /*! -* @brief This function used for set the mag power control -* bit enable -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for set the mag power control + * bit enable + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_wakeup(void) { @@ -15973,7 +15970,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_wakeup(void) p_smi130->delay_msec(SMI130_BMM150_WAKEUP_DELAY2); com_rslt += smi130_set_mag_read_addr( SMI130_BMM150_POWE_CONTROL_REG); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ p_smi130->delay_msec(SMI130_BMM150_WAKEUP_DELAY3); com_rslt += smi130_read_reg(SMI130_USER_DATA_0_ADDR, &v_power_control_bit_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -15987,28 +15984,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_wakeup(void) return com_rslt; } /*! -* @brief This function used for set the magnetometer -* power mode. -* @note -* Before set the mag power mode -* make sure the following two point is addressed -* Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* -* @param v_mag_sec_if_pow_mode_u8 : The value of mag power mode -* value | mode -* ----------|------------ -* 0 | SMI130_MAG_FORCE_MODE -* 1 | SMI130_MAG_SUSPEND_MODE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for set the magnetometer + * power mode. + * @note + * Before set the mag power mode + * make sure the following two point is addressed + * Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * + * @param v_mag_sec_if_pow_mode_u8 : The value of mag power mode + * value | mode + * ----------|------------ + * 0 | SMI130_MAG_FORCE_MODE + * 1 | SMI130_MAG_SUSPEND_MODE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_bmm150_mag_and_secondary_if_power_mode( u8 v_mag_sec_if_pow_mode_u8) @@ -16070,36 +16067,36 @@ u8 v_mag_sec_if_pow_mode_u8) return com_rslt; } /*! -* @brief This function used for set the magnetometer -* power mode. -* @note -* Before set the mag power mode -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* @param v_mag_pow_mode_u8 : The value of mag power mode -* value | mode -* ----------|------------ -* 0 | FORCE_MODE -* 1 | SUSPEND_MODE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for set the magnetometer + * power mode. + * @note + * Before set the mag power mode + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * @param v_mag_pow_mode_u8 : The value of mag power mode + * value | mode + * ----------|------------ + * 0 | FORCE_MODE + * 1 | SUSPEND_MODE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_set_power_mode( u8 v_mag_pow_mode_u8) @@ -16122,7 +16119,7 @@ u8 v_mag_pow_mode_u8) switch (v_mag_pow_mode_u8) { case FORCE_MODE: - /* Set the power control bit enabled*/ + /* Set the power control bit enabled */ com_rslt = smi130_bmm150_mag_wakeup(); /* write the mag power mode as FORCE mode*/ com_rslt += smi130_set_mag_write_data( @@ -16134,7 +16131,7 @@ u8 v_mag_pow_mode_u8) /* To avoid the auto mode enable when manual mode operation running*/ V_bmm150_maual_auto_condition_u8 = SMI130_MANUAL_ENABLE; - /* set the preset mode*/ + /* set the preset mode */ com_rslt += smi130_set_bmm150_mag_presetmode( SMI130_MAG_PRESETMODE_REGULAR); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); @@ -16180,39 +16177,39 @@ u8 v_mag_pow_mode_u8) return com_rslt; } /*! -* @brief This API used to set the pre-set modes of bmm150 -* The pre-set mode setting is depend on data rate and xy and z repetitions -* -* @note -* Before set the mag preset mode -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* @param v_mode_u8: The value of pre-set mode selection value -* value | pre_set mode -* ----------|------------ -* 1 | SMI130_MAG_PRESETMODE_LOWPOWER -* 2 | SMI130_MAG_PRESETMODE_REGULAR -* 3 | SMI130_MAG_PRESETMODE_HIGHACCURACY -* 4 | SMI130_MAG_PRESETMODE_ENHANCED -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -*/ + * @brief This API used to set the pre-set modes of bmm150 + * The pre-set mode setting is depend on data rate and xy and z repetitions + * + * @note + * Before set the mag preset mode + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * @param v_mode_u8: The value of pre-set mode selection value + * value | pre_set mode + * ----------|------------ + * 1 | SMI130_MAG_PRESETMODE_LOWPOWER + * 2 | SMI130_MAG_PRESETMODE_REGULAR + * 3 | SMI130_MAG_PRESETMODE_HIGHACCURACY + * 4 | SMI130_MAG_PRESETMODE_ENHANCED + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_set_bmm150_mag_presetmode(u8 v_mode_u8) { /* variable used for return the status of communication result*/ @@ -16334,29 +16331,29 @@ SMI130_RETURN_FUNCTION_TYPE smi130_set_bmm150_mag_presetmode(u8 v_mode_u8) return com_rslt; } /*! -* @brief This function used for read the trim values of magnetometer -* -* @note -* Before reading the mag trimming values -* make sure the following two points are addressed -* @note -* 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note -* 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for read the trim values of magnetometer + * + * @note + * Before reading the mag trimming values + * make sure the following two points are addressed + * @note + * 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note + * 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void) { @@ -16377,82 +16374,82 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void) SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE}; - /* read dig_x1 value*/ + /* read dig_x1 value */ com_rslt = smi130_set_mag_read_addr( SMI130_MAG_DIG_X1); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_X1], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); mag_trim.dig_x1 = v_data_u8[SMI130_BMM150_DIG_X1]; - /* read dig_y1 value*/ + /* read dig_y1 value */ com_rslt += smi130_set_mag_read_addr( SMI130_MAG_DIG_Y1); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_Y1], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); mag_trim.dig_y1 = v_data_u8[SMI130_BMM150_DIG_Y1]; - /* read dig_x2 value*/ + /* read dig_x2 value */ com_rslt += smi130_set_mag_read_addr( SMI130_MAG_DIG_X2); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_X2], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); mag_trim.dig_x2 = v_data_u8[SMI130_BMM150_DIG_X2]; - /* read dig_y2 value*/ + /* read dig_y2 value */ com_rslt += smi130_set_mag_read_addr( SMI130_MAG_DIG_Y2); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_Y3], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); mag_trim.dig_y2 = v_data_u8[SMI130_BMM150_DIG_Y3]; - /* read dig_xy1 value*/ + /* read dig_xy1 value */ com_rslt += smi130_set_mag_read_addr( SMI130_MAG_DIG_XY1); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_XY1], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); mag_trim.dig_xy1 = v_data_u8[SMI130_BMM150_DIG_XY1]; - /* read dig_xy2 value*/ + /* read dig_xy2 value */ com_rslt += smi130_set_mag_read_addr( SMI130_MAG_DIG_XY2); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is v_mag_x_s16 ls register*/ + /* 0x04 is v_mag_x_s16 ls register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_XY2], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); mag_trim.dig_xy2 = v_data_u8[SMI130_BMM150_DIG_XY2]; - /* read dig_z1 lsb value*/ + /* read dig_z1 lsb value */ com_rslt += smi130_set_mag_read_addr( SMI130_MAG_DIG_Z1_LSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_Z1_LSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* read dig_z1 msb value*/ + /* read dig_z1 msb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_Z1_MSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is v_mag_x_s16 msb register*/ + /* 0x04 is v_mag_x_s16 msb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_Z1_MSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -16462,18 +16459,18 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_BMM150_DIG_Z1_LSB])); - /* read dig_z2 lsb value*/ + /* read dig_z2 lsb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_Z2_LSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_Z2_LSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* read dig_z2 msb value*/ + /* read dig_z2 msb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_Z2_MSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is v_mag_x_s16 msb register*/ + /* 0x04 is v_mag_x_s16 msb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_Z2_MSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -16483,18 +16480,18 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_BMM150_DIG_Z2_LSB])); - /* read dig_z3 lsb value*/ + /* read dig_z3 lsb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_Z3_LSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_DIG_Z3_LSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* read dig_z3 msb value*/ + /* read dig_z3 msb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_Z3_MSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is v_mag_x_s16 msb register*/ + /* 0x04 is v_mag_x_s16 msb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_DIG_Z3_MSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -16504,18 +16501,18 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_BMM150_DIG_DIG_Z3_LSB])); - /* read dig_z4 lsb value*/ + /* read dig_z4 lsb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_Z4_LSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_DIG_Z4_LSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* read dig_z4 msb value*/ + /* read dig_z4 msb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_Z4_MSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is v_mag_x_s16 msb register*/ + /* 0x04 is v_mag_x_s16 msb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_DIG_Z4_MSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -16525,18 +16522,18 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void) << SMI130_SHIFT_BIT_POSITION_BY_08_BITS) | (v_data_u8[SMI130_BMM150_DIG_DIG_Z4_LSB])); - /* read dig_xyz1 lsb value*/ + /* read dig_xyz1 lsb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_XYZ1_LSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_DIG_XYZ1_LSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* read dig_xyz1 msb value*/ + /* read dig_xyz1 msb value */ com_rslt += smi130_set_mag_read_addr(SMI130_MAG_DIG_XYZ1_MSB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is v_mag_x_s16 msb register*/ + /* 0x04 is v_mag_x_s16 msb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[SMI130_BMM150_DIG_DIG_XYZ1_MSB], SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -16549,25 +16546,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void) return com_rslt; } /*! -* @brief This function used for initialize -* the AKM09911 and AKM09912 sensor -* -* -* @param v_akm_i2c_address_u8: The value of device address -* AKM sensor | Slave address -* --------------|--------------------- -* AKM09911 | AKM09911_I2C_ADDR_1 -* - | and AKM09911_I2C_ADDR_2 -* AKM09912 | AKM09912_I2C_ADDR_1 -* - | AKM09912_I2C_ADDR_2 -* - | AKM09912_I2C_ADDR_3 -* - | AKM09912_I2C_ADDR_4 -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for initialize + * the AKM09911 and AKM09912 sensor + * + * + * @param v_akm_i2c_address_u8: The value of device address + * AKM sensor | Slave address + * --------------|--------------------- + * AKM09911 | AKM09911_I2C_ADDR_1 + * - | and AKM09911_I2C_ADDR_2 + * AKM09912 | AKM09912_I2C_ADDR_1 + * - | AKM09912_I2C_ADDR_2 + * - | AKM09912_I2C_ADDR_3 + * - | AKM09912_I2C_ADDR_4 + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_akm_mag_interface_init( u8 v_akm_i2c_address_u8) @@ -16620,13 +16617,13 @@ u8 v_akm_i2c_address_u8) p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_mag_manual_enable(&v_data_u8); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /*Enable the MAG interface*/ + /*Enable the MAG interface */ com_rslt += smi130_set_if_mode(SMI130_ENABLE_MAG_IF_MODE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_if_mode(&v_data_u8); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* Set the AKM Fuse ROM mode*/ + /* Set the AKM Fuse ROM mode */ /* Set value for fuse ROM mode*/ com_rslt += smi130_set_mag_write_data(AKM_FUSE_ROM_MODE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); @@ -16635,14 +16632,14 @@ u8 v_akm_i2c_address_u8) p_smi130->delay_msec(SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); /* Read the Fuse ROM v_data_u8 from registers 0x60,0x61 and 0x62*/ - /* ASAX v_data_u8*/ + /* ASAX v_data_u8 */ com_rslt += smi130_read_bosch_akm_sensitivity_data(); p_smi130->delay_msec(SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); /* read the device id of the AKM sensor if device id is 0x05 - AKM09911 if device id is 0x04 - AKM09912*/ com_rslt += smi130_set_mag_read_addr(AKM09912_CHIP_ID_REG); - /* 0x04 is mag_x lsb register*/ + /* 0x04 is mag_x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_akm_chip_id_u8, SMI130_GEN_READ_WRITE_DATA_LENGTH); printk(KERN_INFO "smi130,addr:0x%x, akm_chip_id:0x%x", @@ -16675,27 +16672,27 @@ u8 v_akm_i2c_address_u8) return com_rslt; } /*! -* @brief This function used for read the sensitivity data of -* AKM09911 and AKM09912 -* -* @note Before reading the mag sensitivity values -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for read the sensitivity data of + * AKM09911 and AKM09912 + * + * @note Before reading the mag sensitivity values + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_read_bosch_akm_sensitivity_data(void) { @@ -16706,28 +16703,28 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bosch_akm_sensitivity_data(void) u8 v_data_u8[SMI130_AKM_SENSITIVITY_DATA_SIZE] = { SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE}; - /* read asax value*/ + /* read asax value */ com_rslt = smi130_set_mag_read_addr(SMI130_BST_AKM_ASAX); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[AKM_ASAX], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); akm_asa_data.asax = v_data_u8[AKM_ASAX]; - /* read asay value*/ + /* read asay value */ com_rslt += smi130_set_mag_read_addr(SMI130_BST_AKM_ASAY); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[AKM_ASAY], SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); akm_asa_data.asay = v_data_u8[AKM_ASAY]; - /* read asaz value*/ + /* read asaz value */ com_rslt += smi130_set_mag_read_addr(SMI130_BST_AKM_ASAZ); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[AKM_ASAZ], SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -16737,264 +16734,264 @@ SMI130_RETURN_FUNCTION_TYPE smi130_read_bosch_akm_sensitivity_data(void) return com_rslt; } /*! -* @brief This API used to get the compensated X data -* of AKM09911 the out put of X as s32 -* @note Before start reading the mag compensated X data -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* @param v_bosch_akm_x_s16 : The value of X data -* -* @return results of compensated X data value output as s32 -* -*/ + * @brief This API used to get the compensated X data + * of AKM09911 the out put of X as s32 + * @note Before start reading the mag compensated X data + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * @param v_bosch_akm_x_s16 : The value of X data + * + * @return results of compensated X data value output as s32 + * + */ s32 smi130_bosch_akm09911_compensate_X(s16 v_bosch_akm_x_s16) { /*Return value of AKM x compensated v_data_u8*/ s32 retval = SMI130_INIT_VALUE; /* Convert raw v_data_u8 into compensated v_data_u8*/ - retval = (v_bosch_akm_x_s16* + retval = (v_bosch_akm_x_s16 * ((akm_asa_data.asax/AKM09911_SENSITIVITY_DIV) + SMI130_GEN_READ_WRITE_DATA_LENGTH)); return retval; } /*! -* @brief This API used to get the compensated Y data -* of AKM09911 the out put of Y as s32 -* @note Before start reading the mag compensated Y data -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* @param v_bosch_akm_y_s16 : The value of Y data -* -* @return results of compensated Y data value output as s32 -* -*/ + * @brief This API used to get the compensated Y data + * of AKM09911 the out put of Y as s32 + * @note Before start reading the mag compensated Y data + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * @param v_bosch_akm_y_s16 : The value of Y data + * + * @return results of compensated Y data value output as s32 + * + */ s32 smi130_bosch_akm09911_compensate_Y(s16 v_bosch_akm_y_s16) { /*Return value of AKM y compensated v_data_u8*/ s32 retval = SMI130_INIT_VALUE; /* Convert raw v_data_u8 into compensated v_data_u8*/ - retval = (v_bosch_akm_y_s16* + retval = (v_bosch_akm_y_s16 * ((akm_asa_data.asay/AKM09911_SENSITIVITY_DIV) + SMI130_GEN_READ_WRITE_DATA_LENGTH)); return retval; } /*! -* @brief This API used to get the compensated Z data -* of AKM09911 the out put of Z as s32 -* @note Before start reading the mag compensated Z data -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* @param v_bosch_akm_z_s16 : The value of Z data -* -* @return results of compensated Z data value output as s32 -* -*/ + * @brief This API used to get the compensated Z data + * of AKM09911 the out put of Z as s32 + * @note Before start reading the mag compensated Z data + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * @param v_bosch_akm_z_s16 : The value of Z data + * + * @return results of compensated Z data value output as s32 + * + */ s32 smi130_bosch_akm09911_compensate_Z(s16 v_bosch_akm_z_s16) { /*Return value of AKM z compensated v_data_u8*/ s32 retval = SMI130_INIT_VALUE; /* Convert raw v_data_u8 into compensated v_data_u8*/ - retval = (v_bosch_akm_z_s16* + retval = (v_bosch_akm_z_s16 * ((akm_asa_data.asaz/AKM09911_SENSITIVITY_DIV) + SMI130_GEN_READ_WRITE_DATA_LENGTH)); return retval; } /*! -* @brief This API used to get the compensated X data -* of AKM09912 the out put of X as s32 -* @note Before start reading the mag compensated X data -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* @param v_bosch_akm_x_s16 : The value of X data -* -* @return results of compensated X data value output as s32 -* -*/ + * @brief This API used to get the compensated X data + * of AKM09912 the out put of X as s32 + * @note Before start reading the mag compensated X data + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * @param v_bosch_akm_x_s16 : The value of X data + * + * @return results of compensated X data value output as s32 + * + */ s32 smi130_bosch_akm09912_compensate_X(s16 v_bosch_akm_x_s16) { /*Return value of AKM x compensated data*/ s32 retval = SMI130_INIT_VALUE; /* Convert raw data into compensated data*/ - retval = v_bosch_akm_x_s16* + retval = v_bosch_akm_x_s16 * (akm_asa_data.asax + AKM09912_SENSITIVITY) / AKM09912_SENSITIVITY_DIV; return retval; } /*! -* @brief This API used to get the compensated Y data -* of AKM09912 the out put of Y as s32 -* @note Before start reading the mag compensated Y data -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* @param v_bosch_akm_y_s16 : The value of Y data -* -* @return results of compensated Y data value output as s32 -* -*/ + * @brief This API used to get the compensated Y data + * of AKM09912 the out put of Y as s32 + * @note Before start reading the mag compensated Y data + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * @param v_bosch_akm_y_s16 : The value of Y data + * + * @return results of compensated Y data value output as s32 + * + */ s32 smi130_bosch_akm09912_compensate_Y(s16 v_bosch_akm_y_s16) { /*Return value of AKM y compensated data*/ s32 retval = SMI130_INIT_VALUE; /* Convert raw data into compensated data*/ - retval = v_bosch_akm_y_s16* + retval = v_bosch_akm_y_s16 * (akm_asa_data.asax + AKM09912_SENSITIVITY) / AKM09912_SENSITIVITY_DIV; return retval; } /*! -* @brief This API used to get the compensated Z data -* of AKM09912 the out put of Z as s32 -* @note Before start reading the mag compensated Z data -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* -* @param v_bosch_akm_z_s16 : The value of Z data -* -* @return results of compensated Z data value output as s32 -* -*/ + * @brief This API used to get the compensated Z data + * of AKM09912 the out put of Z as s32 + * @note Before start reading the mag compensated Z data + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * + * @param v_bosch_akm_z_s16 : The value of Z data + * + * @return results of compensated Z data value output as s32 + * + */ s32 smi130_bosch_akm09912_compensate_Z(s16 v_bosch_akm_z_s16) { /*Return value of AKM z compensated data*/ s32 retval = SMI130_INIT_VALUE; /* Convert raw data into compensated data*/ - retval = v_bosch_akm_z_s16* + retval = v_bosch_akm_z_s16 * (akm_asa_data.asax + AKM09912_SENSITIVITY) / AKM09912_SENSITIVITY_DIV; return retval; } /*! -* @brief This function used for read the compensated value of -* AKM09911 -* @note Before start reading the mag compensated data's -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. + * @brief This function used for read the compensated value of + * AKM09911 + * @note Before start reading the mag compensated data's + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_akm09911_compensate_xyz( -struct smi130_mag_xyz_s32_t*bosch_akm_xyz) +struct smi130_mag_xyz_s32_t *bosch_akm_xyz) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; struct smi130_mag_t mag_xyz; com_rslt = smi130_read_mag_xyz(&mag_xyz, BST_AKM); - /* Compensation for X axis*/ + /* Compensation for X axis */ bosch_akm_xyz->x = smi130_bosch_akm09911_compensate_X(mag_xyz.x); - /* Compensation for Y axis*/ + /* Compensation for Y axis */ bosch_akm_xyz->y = smi130_bosch_akm09911_compensate_Y(mag_xyz.y); - /* Compensation for Z axis*/ + /* Compensation for Z axis */ bosch_akm_xyz->z = smi130_bosch_akm09911_compensate_Z(mag_xyz.z); return com_rslt; } /*! -* @brief This function used for read the compensated value of -* AKM09912 -* @note Before start reading the mag compensated data's -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. + * @brief This function used for read the compensated value of + * AKM09912 + * @note Before start reading the mag compensated data's + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_akm09912_compensate_xyz( -struct smi130_mag_xyz_s32_t*bosch_akm_xyz) +struct smi130_mag_xyz_s32_t *bosch_akm_xyz) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; @@ -17003,84 +17000,84 @@ struct smi130_mag_xyz_s32_t*bosch_akm_xyz) com_rslt = smi130_read_mag_xyz(&mag_xyz, BST_AKM); printk(KERN_INFO "akm09912_raw_x:%d, %d, %d, <%s>,<%d>", mag_xyz.x, mag_xyz.y, mag_xyz.z, __func__, __LINE__); - /* Compensation for X axis*/ + /* Compensation for X axis */ bosch_akm_xyz->x = smi130_bosch_akm09912_compensate_X(mag_xyz.x); - /* Compensation for Y axis*/ + /* Compensation for Y axis */ bosch_akm_xyz->y = smi130_bosch_akm09912_compensate_Y(mag_xyz.y); - /* Compensation for Z axis*/ + /* Compensation for Z axis */ bosch_akm_xyz->z = smi130_bosch_akm09912_compensate_Z(mag_xyz.z); return com_rslt; } /*! -* @brief This function used for read the compensated value of -* AKM09912 -* @note Before start reading the mag compensated data's -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. + * @brief This function used for read the compensated value of + * AKM09912 + * @note Before start reading the mag compensated data's + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_akm09912_compensate_xyz_raw( -struct smi130_mag_xyz_s32_t*bosch_akm_xyz) +struct smi130_mag_xyz_s32_t *bosch_akm_xyz) { /* variable used for return the status of communication result*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; - /* Compensation for X axis*/ + /* Compensation for X axis */ bosch_akm_xyz->x = smi130_bosch_akm09912_compensate_X(bosch_akm_xyz->x); - /* Compensation for Y axis*/ + /* Compensation for Y axis */ bosch_akm_xyz->y = smi130_bosch_akm09912_compensate_Y(bosch_akm_xyz->y); - /* Compensation for Z axis*/ + /* Compensation for Z axis */ bosch_akm_xyz->z = smi130_bosch_akm09912_compensate_Z(bosch_akm_xyz->z); return com_rslt; } /*! -* @brief This function used for set the AKM09911 and AKM09912 -* power mode. -* @note Before set the AKM power mode -* make sure the following two points are addressed -* @note 1. Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* @note 2. And also confirm the secondary-interface power mode -* is not in the SUSPEND mode. -* by using the function smi130_get_mag_pmu_status(). -* If the secondary-interface power mode is in SUSPEND mode -* set the value of 0x19(NORMAL mode)by using the -* smi130_set_command_register(0x19) function. -* -* @param v_akm_pow_mode_u8 : The value of akm power mode -* value | Description -* ---------|-------------------- -* 0 | AKM_POWER_DOWN_MODE -* 1 | AKM_SINGLE_MEAS_MODE -* 2 | FUSE_ROM_MODE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for set the AKM09911 and AKM09912 + * power mode. + * @note Before set the AKM power mode + * make sure the following two points are addressed + * @note 1. Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * @note 2. And also confirm the secondary-interface power mode + * is not in the SUSPEND mode. + * by using the function smi130_get_mag_pmu_status(). + * If the secondary-interface power mode is in SUSPEND mode + * set the value of 0x19(NORMAL mode)by using the + * smi130_set_command_register(0x19) function. + * + * @param v_akm_pow_mode_u8 : The value of akm power mode + * value | Description + * ---------|-------------------- + * 0 | AKM_POWER_DOWN_MODE + * 1 | AKM_SINGLE_MEAS_MODE + * 2 | FUSE_ROM_MODE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_akm_set_powermode( u8 v_akm_pow_mode_u8) @@ -17120,7 +17117,7 @@ u8 v_akm_pow_mode_u8) p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); com_rslt += smi130_set_mag_write_addr(AKM_POWER_MODE_REG); p_smi130->delay_msec(SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); - /* Sensitivity v_data_u8*/ + /* Sensitivity v_data_u8 */ com_rslt += smi130_read_bosch_akm_sensitivity_data(); p_smi130->delay_msec(SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); /* power down mode*/ @@ -17144,27 +17141,27 @@ u8 v_akm_pow_mode_u8) return com_rslt; } /*! -* @brief This function used for set the magnetometer -* power mode of AKM09911 and AKM09912 -* @note Before set the mag power mode -* make sure the following two point is addressed -* Make sure the mag interface is enabled or not, -* by using the smi130_get_if_mode() function. -* If mag interface is not enabled set the value of 0x02 -* to the function smi130_get_if_mode(0x02) -* -* @param v_mag_sec_if_pow_mode_u8 : The value of secondary if power mode -* value | Description -* ---------|-------------------- -* 0 | SMI130_MAG_FORCE_MODE -* 1 | SMI130_MAG_SUSPEND_MODE -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for set the magnetometer + * power mode of AKM09911 and AKM09912 + * @note Before set the mag power mode + * make sure the following two point is addressed + * Make sure the mag interface is enabled or not, + * by using the smi130_get_if_mode() function. + * If mag interface is not enabled set the value of 0x02 + * to the function smi130_get_if_mode(0x02) + * + * @param v_mag_sec_if_pow_mode_u8 : The value of secondary if power mode + * value | Description + * ---------|-------------------- + * 0 | SMI130_MAG_FORCE_MODE + * 1 | SMI130_MAG_SUSPEND_MODE + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_bosch_akm_and_secondary_if_powermode( u8 v_mag_sec_if_pow_mode_u8) @@ -17212,14 +17209,14 @@ u8 v_mag_sec_if_pow_mode_u8) return com_rslt; } /*! -* @brief This function used for read the YAMAH-YAS532 init -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for read the YAMAH-YAS532 init + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_mag_interface_init( void) @@ -17271,7 +17268,7 @@ void) p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_mag_manual_enable(&v_data_u8); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /*Enable the MAG interface*/ + /*Enable the MAG interface */ com_rslt += smi130_set_if_mode(SMI130_ENABLE_MAG_IF_MODE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_if_mode(&v_data_u8); @@ -17290,7 +17287,7 @@ void) yas532_data.measure_state = YAS532_MAG_STATE_INIT_COIL; /* Set the default offset as invalid offset*/ set_vector(yas532_data.v_hard_offset_s8, INVALID_OFFSET); - /* set the transform to zero*/ + /* set the transform to zero */ yas532_data.transform = SMI130_NULL; /* Assign overflow as zero*/ yas532_data.overflow = 0; @@ -17320,15 +17317,15 @@ void) return com_rslt; } /*! -* @brief This function used to set the YAS532 initial values -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used to set the YAS532 initial values + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_set_initial_values(void) { /* This variable used for provide the communication @@ -17366,14 +17363,14 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_set_initial_values(void) return com_rslt; } /*! -* @brief This function used for YAS532 offset correction -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used for YAS532 offset correction + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_magnetic_measure_set_offset( void) @@ -17388,7 +17385,7 @@ void) /* offset correction factors*/ static const u8 v_correct_u8[SMI130_YAS_CORRECT_DATA_SIZE] = { 16, 8, 4, 2, 1}; - /* used for the temperature*/ + /* used for the temperature */ u16 v_temp_u16 = SMI130_INIT_VALUE; /* used for the xy1y2 read*/ u16 v_xy1y2_u16[SMI130_YAS_XY1Y2_DATA_SIZE] = {SMI130_INIT_VALUE, @@ -17410,7 +17407,7 @@ void) return E_SMI130_BUSY; /* calculate the magnetic correction with offset and assign the values - to the offset register*/ + to the offset register */ for (j = 0; j < 3; j++) { if (YAS532_DATA_CENTER == v_xy1y2_u16[j]) v_flag_s32[j] = 0; @@ -17422,70 +17419,70 @@ void) for (j = 0; j < 3; j++) { if (v_flag_s32[j]) v_hard_offset_s8[j] = (s8)(v_hard_offset_s8[j] - + v_flag_s32[j]* v_correct_u8[i]); + + v_flag_s32[j] * v_correct_u8[i]); } } - /* set the offset*/ + /* set the offset */ com_rslt += smi130_bosch_yas532_set_offset(v_hard_offset_s8); return com_rslt; } /*! -* @brief This function used for read the -* YAMAHA YAS532 calibration data -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for read the + * YAMAHA YAS532 calibration data + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) { /* This variable used for provide the communication results*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; - /* Array holding the YAS532 calibration values*/ + /* Array holding the YAS532 calibration values */ u8 v_data_u8[SMI130_YAS532_CALIB_DATA_SIZE] = { SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE}; - /* Read the DX value*/ + /* Read the DX value */ com_rslt = smi130_set_mag_read_addr(SMI130_YAS532_CALIB_CX); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[0], SMI130_GEN_READ_WRITE_DATA_LENGTH); yas532_data.calib_yas532.cx = (s32)((v_data_u8[0] * 10) - 1280); - /* Read the DY1 value*/ + /* Read the DY1 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB_CY1); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[1], SMI130_GEN_READ_WRITE_DATA_LENGTH); yas532_data.calib_yas532.cy1 = - (s32)((v_data_u8[1]* 10) - 1280); - /* Read the DY2 value*/ + (s32)((v_data_u8[1] * 10) - 1280); + /* Read the DY2 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB_CY2); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[2], SMI130_GEN_READ_WRITE_DATA_LENGTH); yas532_data.calib_yas532.cy2 = - (s32)((v_data_u8[2]* 10) - 1280); - /* Read the D2 and D3 value*/ + (s32)((v_data_u8[2] * 10) - 1280); + /* Read the D2 and D3 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB1); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[3], SMI130_GEN_READ_WRITE_DATA_LENGTH); yas532_data.calib_yas532.a2 = (s32)(((v_data_u8[3] >> SMI130_SHIFT_BIT_POSITION_BY_02_BITS) & 0x03F) - 32); - /* Read the D3 and D4 value*/ + /* Read the D3 and D4 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB2); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[4], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* calculate a3*/ @@ -17498,9 +17495,9 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) yas532_data.calib_yas532.a4 = (s32)((v_data_u8[4] & 0x3F) - 32); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); - /* Read the D5 and D6 value*/ + /* Read the D5 and D6 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB3); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[5], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* calculate a5*/ @@ -17508,9 +17505,9 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) (s32)(((v_data_u8[5] >> SMI130_SHIFT_BIT_POSITION_BY_02_BITS) & 0x3F) + 38); - /* Read the D6 and D7 value*/ + /* Read the D6 and D7 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB4); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[6], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* calculate a6*/ @@ -17520,9 +17517,9 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) & 0x30) | ((v_data_u8[6] >> SMI130_SHIFT_BIT_POSITION_BY_04_BITS) & 0x0F)) - 32); - /* Read the D7 and D8 value*/ + /* Read the D7 and D8 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB5); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[7], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* calculate a7*/ @@ -17532,9 +17529,9 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) ((v_data_u8[7] >> SMI130_SHIFT_BIT_POSITION_BY_05_BITS) & 0x07)) - 64); - /* Read the D8 and D9 value*/ + /* Read the D8 and D9 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CLAIB6); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[8], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* calculate a8*/ @@ -17544,9 +17541,9 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) SMI130_SHIFT_BIT_POSITION_BY_07_BITS) & 0x01)) - 32); - /* Read the D8 and D9 value*/ + /* Read the D8 and D9 value */ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB7); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[9], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* calculate a9*/ @@ -17559,25 +17556,25 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) SMI130_SHIFT_BIT_POSITION_BY_02_BITS) & 0x1F); /* Read the value from register 0x9A*/ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB8); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[10], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* Read the value from register 0x9B*/ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIIB9); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[11], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* Read the value from register 0x9C*/ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB10); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[12], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* Read the value from register 0x9D*/ com_rslt += smi130_set_mag_read_addr(SMI130_YAS532_CALIB11); - /* 0x04 is secondary read mag x lsb register*/ + /* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &v_data_u8[13], SMI130_GEN_READ_WRITE_DATA_LENGTH); @@ -17617,18 +17614,18 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas532_calib_values(void) return com_rslt; } /*! -* @brief This function used for calculate the -* YAS532 read the linear data -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for calculate the + * YAS532 read the linear data + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_xy1y2_to_linear( -u16*v_xy1y2_u16, s32*xy1y2_linear) +u16 *v_xy1y2_u16, s32 *xy1y2_linear) { /* This variable used for provide the communication results*/ @@ -17646,43 +17643,43 @@ u16*v_xy1y2_u16, s32*xy1y2_linear) return com_rslt; } /*! -* @brief This function used for read the YAS532 sensor data -* @param v_acquisition_command_u8: used to set the data acquisition -* acquisition_command | operation -* ---------------------|------------------------- -* 0x17 | turn on the acquisition coil -* - | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Deferred acquisition mode -* 0x07 | turn on the acquisition coil -* _ | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Normal acquisition mode -* 0x11 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Deferred acquisition mode -* 0x01 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Normal acquisition mode -* -* @param v_busy_u8 : used to get the busy flay for sensor data read -* @param v_temp_u16 : used to get the temperature data -* @param v_xy1y2_u16 : used to get the sensor xy1y2 data -* @param v_overflow_u8 : used to get the overflow data -* -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for read the YAS532 sensor data + * @param v_acquisition_command_u8: used to set the data acquisition + * acquisition_command | operation + * ---------------------|------------------------- + * 0x17 | turn on the acquisition coil + * - | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Deferred acquisition mode + * 0x07 | turn on the acquisition coil + * _ | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Normal acquisition mode + * 0x11 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Deferred acquisition mode + * 0x01 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Normal acquisition mode + * + * @param v_busy_u8 : used to get the busy flay for sensor data read + * @param v_temp_u16 : used to get the temperature data + * @param v_xy1y2_u16 : used to get the sensor xy1y2 data + * @param v_overflow_u8 : used to get the overflow data + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_normal_measurement_data( -u8 v_acquisition_command_u8, u8*v_busy_u8, -u16*v_temp_u16, u16*v_xy1y2_u16, u8*v_overflow_u8) +u8 v_acquisition_command_u8, u8 *v_busy_u8, +u16 *v_temp_u16, u16 *v_xy1y2_u16, u8 *v_overflow_u8) { /* This variable used for provide the communication results*/ @@ -17698,7 +17695,7 @@ u16*v_temp_u16, u16*v_xy1y2_u16, u8*v_overflow_u8) if (p_smi130 == SMI130_NULL) { return E_SMI130_NULL_PTR; } else { - /* read the sensor data*/ + /* read the sensor data */ com_rslt = smi130_bosch_yas532_acquisition_command_register( v_acquisition_command_u8); com_rslt += @@ -17734,48 +17731,48 @@ u16*v_temp_u16, u16*v_xy1y2_u16, u8*v_overflow_u8) *v_overflow_u8 = 0; for (i = 0; i < 3; i++) { if (v_xy1y2_u16[i] == YAS532_DATA_OVERFLOW) - *v_overflow_u8 |= (1 << (i* 2)); + *v_overflow_u8 |= (1 << (i * 2)); if (v_xy1y2_u16[i] == YAS532_DATA_UNDERFLOW) - *v_overflow_u8 |= (1 << (i* 2 + 1)); + *v_overflow_u8 |= (1 << (i * 2 + 1)); } } return com_rslt; } /*! -* @brief This function used for YAS532 sensor data -* @param v_acquisition_command_u8 : the value of CMDR -* acquisition_command | operation -* ---------------------|------------------------- -* 0x17 | turn on the acquisition coil -* - | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Deferred acquisition mode -* 0x07 | turn on the acquisition coil -* _ | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Normal acquisition mode -* 0x11 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Deferred acquisition mode -* 0x01 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Normal acquisition mode -* -* @param xyz_data : the vector xyz output -* @param v_overflow_s8 : the value of overflow -* @param v_temp_correction_u8 : the value of temperate correction enable -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for YAS532 sensor data + * @param v_acquisition_command_u8 : the value of CMDR + * acquisition_command | operation + * ---------------------|------------------------- + * 0x17 | turn on the acquisition coil + * - | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Deferred acquisition mode + * 0x07 | turn on the acquisition coil + * _ | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Normal acquisition mode + * 0x11 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Deferred acquisition mode + * 0x01 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Normal acquisition mode + * + * @param xyz_data : the vector xyz output + * @param v_overflow_s8 : the value of overflow + * @param v_temp_correction_u8 : the value of temperate correction enable + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_measurement_xyz_data( -struct yas532_vector*xyz_data, u8*v_overflow_s8, u8 v_temp_correction_u8, +struct yas532_vector *xyz_data, u8 *v_overflow_s8, u8 v_temp_correction_u8, u8 v_acquisition_command_u8) { /* This variable used for provide the communication @@ -17785,7 +17782,7 @@ u8 v_acquisition_command_u8) s32 v_xy1y2_linear_s32[SMI130_YAS_XY1Y2_DATA_SIZE] = { SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE}; - /* Array holding the temperature data*/ + /* Array holding the temperature data */ s32 v_xyz_tmp_s32[SMI130_YAS_TEMP_DATA_SIZE] = {SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE}; s32 tmp = SMI130_INIT_VALUE; @@ -17828,7 +17825,7 @@ u8 v_acquisition_command_u8) /* Calculate the linear data*/ com_rslt += smi130_bosch_yas532_xy1y2_to_linear(v_xy1y2_u16, v_xy1y2_linear_s32); - /* Calculate temperature correction*/ + /* Calculate temperature correction */ #if YAS532_MAG_LOG < YAS532_MAG_TEMPERATURE_LOG yas532_data.temp_data.log[yas532_data.temp_data.idx++] = v_temp_u16; @@ -17839,8 +17836,8 @@ u8 v_acquisition_command_u8) yas532_data.temp_data.num = YAS532_MAG_TEMPERATURE_LOG; for (i = 0; i < yas532_data.temp_data.num; i++) sum += yas532_data.temp_data.log[i]; - tmp = sum* 10 / yas532_data.temp_data.num - - YAS532_TEMP20DEGREE_TYPICAL* 10; + tmp = sum * 10 / yas532_data.temp_data.num + - YAS532_TEMP20DEGREE_TYPICAL * 10; #else tmp = (v_temp_u16 - YAS532_TEMP20DEGREE_TYPICAL) * 10; @@ -17848,35 +17845,35 @@ u8 v_acquisition_command_u8) sx = v_xy1y2_linear_s32[0]; sy1 = v_xy1y2_linear_s32[1]; sy2 = v_xy1y2_linear_s32[2]; - /* Temperature correction*/ + /* Temperature correction */ if (v_temp_correction_u8) { - sx -= (yas532_data.calib_yas532.cx * tmp) + sx -= (yas532_data.calib_yas532.cx * tmp) / 1000; - sy1 -= (yas532_data.calib_yas532.cy1* tmp) + sy1 -= (yas532_data.calib_yas532.cy1 * tmp) / 1000; - sy2 -= (yas532_data.calib_yas532.cy2* tmp) + sy2 -= (yas532_data.calib_yas532.cy2 * tmp) / 1000; } sy = sy1 - sy2; sz = -sy1 - sy2; - xyz_data->yas532_vector_xyz[0] = yas532_data.calib_yas532.k* - ((100* sx + yas532_data.calib_yas532.a2* sy + - yas532_data.calib_yas532.a3* sz) / 10); - xyz_data->yas532_vector_xyz[1] = yas532_data.calib_yas532.k* - ((yas532_data.calib_yas532.a4* sx + yas532_data.calib_yas532.a5* sy + - yas532_data.calib_yas532.a6* sz) / 10); - xyz_data->yas532_vector_xyz[2] = yas532_data.calib_yas532.k* - ((yas532_data.calib_yas532.a7* sx + yas532_data.calib_yas532.a8* sy + - yas532_data.calib_yas532.a9* sz) / 10); + xyz_data->yas532_vector_xyz[0] = yas532_data.calib_yas532.k * + ((100 * sx + yas532_data.calib_yas532.a2 * sy + + yas532_data.calib_yas532.a3 * sz) / 10); + xyz_data->yas532_vector_xyz[1] = yas532_data.calib_yas532.k * + ((yas532_data.calib_yas532.a4 * sx + yas532_data.calib_yas532.a5 * sy + + yas532_data.calib_yas532.a6 * sz) / 10); + xyz_data->yas532_vector_xyz[2] = yas532_data.calib_yas532.k * + ((yas532_data.calib_yas532.a7 * sx + yas532_data.calib_yas532.a8 * sy + + yas532_data.calib_yas532.a9 * sz) / 10); if (yas532_data.transform != SMI130_NULL) { for (i = 0; i < 3; i++) { v_xyz_tmp_s32[i] = yas532_data.transform[i - * 3]* + * 3] * xyz_data->yas532_vector_xyz[0] - + yas532_data.transform[i* 3 + 1]* + + yas532_data.transform[i * 3 + 1] * xyz_data->yas532_vector_xyz[1] - + yas532_data.transform[i* 3 + 2]* + + yas532_data.transform[i * 3 + 2] * xyz_data->yas532_vector_xyz[2]; } set_vector(xyz_data->yas532_vector_xyz, v_xyz_tmp_s32); @@ -17885,18 +17882,18 @@ u8 v_acquisition_command_u8) xyz_data->yas532_vector_xyz[i] -= xyz_data->yas532_vector_xyz[i] % 10; if (*v_overflow_s8 & (1 - << (i* 2))) + << (i * 2))) xyz_data->yas532_vector_xyz[i] += - 1; /* set overflow*/ + 1; /* set overflow */ if (*v_overflow_s8 & (1 << - (i* 2 + 1))) - xyz_data->yas532_vector_xyz[i] += 2; /* set underflow*/ + (i * 2 + 1))) + xyz_data->yas532_vector_xyz[i] += 2; /* set underflow */ } if (v_busy_u8) return com_rslt; - if (0 <*v_overflow_s8) { + if (0 < *v_overflow_s8) { if (!yas532_data.overflow) yas532_data.overflow = 1; yas532_data.measure_state = YAS532_MAG_STATE_INIT_COIL; @@ -17908,36 +17905,36 @@ if (v_busy_u8) return com_rslt; } /*! -* @brief This function used for YAS532 write data acquisition -* command register write -* @param v_command_reg_data_u8 : the value of data acquisition -* acquisition_command | operation -* ---------------------|------------------------- -* 0x17 | turn on the acquisition coil -* - | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Deferred acquisition mode -* 0x07 | turn on the acquisition coil -* _ | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Normal acquisition mode -* 0x11 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Deferred acquisition mode -* 0x01 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Normal acquisition mode -* -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for YAS532 write data acquisition + * command register write + * @param v_command_reg_data_u8 : the value of data acquisition + * acquisition_command | operation + * ---------------------|------------------------- + * 0x17 | turn on the acquisition coil + * - | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Deferred acquisition mode + * 0x07 | turn on the acquisition coil + * _ | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Normal acquisition mode + * 0x11 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Deferred acquisition mode + * 0x01 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Normal acquisition mode + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_acquisition_command_register( u8 v_command_reg_data_u8) { @@ -17964,19 +17961,19 @@ u8 v_command_reg_data_u8) } /*! -* @brief This function used write offset of YAS532 -* -* @param p_offset_s8 : The value of offset to write -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used write offset of YAS532 + * + * @param p_offset_s8 : The value of offset to write + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas532_set_offset( -const s8*p_offset_s8) +const s8 *p_offset_s8) { /* This variable used for provide the communication results*/ @@ -18013,14 +18010,14 @@ const s8*p_offset_s8) return com_rslt; } /*! -* @brief This function used to init the YAMAH-YAS537 -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* + * @brief This function used to init the YAMAH-YAS537 + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas537_mag_interface_init( void) @@ -18072,7 +18069,7 @@ com_rslt += smi130_set_mag_manual_enable(SMI130_MANUAL_ENABLE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_mag_manual_enable(&v_data_u8); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/*Enable the MAG interface*/ +/*Enable the MAG interface */ com_rslt += smi130_set_if_mode(SMI130_ENABLE_MAG_IF_MODE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); smi130_get_if_mode(&v_data_u8); @@ -18092,7 +18089,7 @@ SMI130_GEN_READ_WRITE_DATA_LENGTH); p_smi130->delay_msec(SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); /* set the mode to NORMAL*/ yas537_data.measure_state = YAS537_MAG_STATE_NORMAL; -/* set the transform to zero*/ +/* set the transform to zero */ yas537_data.transform = SMI130_NULL; yas537_data.average = 32; for (i = 0; i < 3; i++) { @@ -18133,7 +18130,7 @@ u8 v_rcoil_u8) /* This variable used for provide the communication results*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; -/* Array holding the YAS532 calibration values*/ +/* Array holding the YAS532 calibration values */ u8 a_data_u8[SMI130_YAS537_CALIB_DATA_SIZE] = { SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, @@ -18150,106 +18147,106 @@ YAS537_SRSTR_DATA); p_smi130->delay_msec(SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); com_rslt += smi130_set_mag_write_addr(YAS537_REG_SRSTR); p_smi130->delay_msec(SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); -/* Read the DX value*/ +/* Read the DX value */ com_rslt = smi130_set_mag_read_addr(YAS537_REG_CALR_C0); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[0], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the DY1 value*/ +/* Read the DY1 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C1); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[1], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the DY2 value*/ +/* Read the DY2 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C2); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[2], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D2 value*/ +/* Read the D2 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C3); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[3], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D3 value*/ +/* Read the D3 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C4); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[4], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D4 value*/ +/* Read the D4 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C5); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[5], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D5 value*/ +/* Read the D5 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C6); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[6], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D6 value*/ +/* Read the D6 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C7); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[7], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D7 value*/ +/* Read the D7 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C8); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[8], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D8 value*/ +/* Read the D8 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_C9); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[9], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the D9 value*/ +/* Read the D9 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_CA); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[10], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the RX value*/ +/* Read the RX value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_CB); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[11], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the RY1 value*/ +/* Read the RY1 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_CC); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[12], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the RY2 value*/ +/* Read the RY2 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_CD); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[13], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the RY2 value*/ +/* Read the RY2 value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_CE); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[14], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the CHF value*/ +/* Read the CHF value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_CF); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[15], SMI130_GEN_READ_WRITE_DATA_LENGTH); -/* Read the VER value*/ +/* Read the VER value */ com_rslt += smi130_set_mag_read_addr(YAS537_REG_CALR_DO); p_smi130->delay_msec(SMI130_GEN_READ_WRITE_DELAY); -/* 0x04 is secondary read mag x lsb register*/ +/* 0x04 is secondary read mag x lsb register */ com_rslt += smi130_read_reg(SMI130_MAG_DATA_READ_REG, &a_data_u8[16], SMI130_GEN_READ_WRITE_DATA_LENGTH); /* get the calib ver*/ @@ -18365,20 +18362,20 @@ if (yas537_data.calib_yas537.ver == 0) { SMI130_SEC_INTERFACE_GEN_READ_WRITE_DELAY); /* Assign the calibration values*/ - /* a2*/ + /* a2 */ yas537_data.calib_yas537.a2 = ((((a_data_u8[3] << SMI130_SHIFT_BIT_POSITION_BY_02_BITS) & 0x7C) | (a_data_u8[4] >> SMI130_SHIFT_BIT_POSITION_BY_06_BITS)) - 64); - /* a3*/ + /* a3 */ yas537_data.calib_yas537.a3 = ((((a_data_u8[4] << SMI130_SHIFT_BIT_POSITION_BY_01_BIT) & 0x7E) | (a_data_u8[5] >> SMI130_SHIFT_BIT_POSITION_BY_07_BITS)) - 64); - /* a4*/ + /* a4 */ yas537_data.calib_yas537.a4 = ((((a_data_u8[5] << SMI130_SHIFT_BIT_POSITION_BY_01_BIT) @@ -18386,7 +18383,7 @@ if (yas537_data.calib_yas537.ver == 0) { | (a_data_u8[6] >> SMI130_SHIFT_BIT_POSITION_BY_07_BITS)) - 128); - /* a5*/ + /* a5 */ yas537_data.calib_yas537.a5 = ((((a_data_u8[6] << SMI130_SHIFT_BIT_POSITION_BY_02_BITS) @@ -18394,14 +18391,14 @@ if (yas537_data.calib_yas537.ver == 0) { | (a_data_u8[7] >> SMI130_SHIFT_BIT_POSITION_BY_06_BITS)) - 112); - /* a6*/ + /* a6 */ yas537_data.calib_yas537.a6 = ((((a_data_u8[7] << SMI130_SHIFT_BIT_POSITION_BY_01_BIT) & 0x7E) | (a_data_u8[8] >> SMI130_SHIFT_BIT_POSITION_BY_07_BITS)) - 64); - /* a7*/ + /* a7 */ yas537_data.calib_yas537.a7 = ((((a_data_u8[8] << SMI130_SHIFT_BIT_POSITION_BY_01_BIT) @@ -18409,16 +18406,16 @@ if (yas537_data.calib_yas537.ver == 0) { | (a_data_u8[9] >> SMI130_SHIFT_BIT_POSITION_BY_07_BITS)) - 128); - /* a8*/ + /* a8 */ yas537_data.calib_yas537.a8 = ((a_data_u8[9] & 0x7F) - 64); - /* a9*/ + /* a9 */ yas537_data.calib_yas537.a9 = ((((a_data_u8[10] << SMI130_SHIFT_BIT_POSITION_BY_01_BIT) & 0x1FE) | (a_data_u8[11] >> SMI130_SHIFT_BIT_POSITION_BY_07_BITS)) - 112); - /* k*/ + /* k */ yas537_data.calib_yas537.k = ( a_data_u8[11] & 0x7F); } else { @@ -18461,36 +18458,36 @@ return com_rslt; } /*! -* @brief This function used for YAS537 write data acquisition -* command register write -* @param v_command_reg_data_u8 : the value of data acquisition -* acquisition_command | operation -* ---------------------|------------------------- -* 0x17 | turn on the acquisition coil -* - | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Deferred acquisition mode -* 0x07 | turn on the acquisition coil -* _ | set direction of the coil -* _ | (x and y as minus(-)) -* _ | Normal acquisition mode -* 0x11 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Deferred acquisition mode -* 0x01 | turn OFF the acquisition coil -* _ | set direction of the coil -* _ | (x and y as plus(+)) -* _ | Normal acquisition mode -* -* -* - * @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for YAS537 write data acquisition + * command register write + * @param v_command_reg_data_u8 : the value of data acquisition + * acquisition_command | operation + * ---------------------|------------------------- + * 0x17 | turn on the acquisition coil + * - | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Deferred acquisition mode + * 0x07 | turn on the acquisition coil + * _ | set direction of the coil + * _ | (x and y as minus(-)) + * _ | Normal acquisition mode + * 0x11 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Deferred acquisition mode + * 0x01 | turn OFF the acquisition coil + * _ | set direction of the coil + * _ | (x and y as plus(+)) + * _ | Normal acquisition mode + * + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yas537_acquisition_command_register( u8 v_command_reg_data_u8) { @@ -18522,51 +18519,51 @@ u8 v_command_reg_data_u8) } /*! -* @brief This function used for read the -* YAMAHA YAS537 xy1y2 data -* -* @param xy1y2: The value of raw xy1y2 data -* @param xyz: The value of xyz data -* -* -* @return None -* -* -*/ -static void xy1y2_to_xyz(u16*xy1y2, s32*xyz) + * @brief This function used for read the + * YAMAHA YAS537 xy1y2 data + * + * @param xy1y2: The value of raw xy1y2 data + * @param xyz: The value of xyz data + * + * + * @return None + * + * + */ +static void xy1y2_to_xyz(u16 *xy1y2, s32 *xyz) { xyz[0] = ((xy1y2[0] - 8192) * 300); xyz[1] = (((xy1y2[1] - xy1y2[2]) * 1732) / 10); xyz[2] = (((-xy1y2[2] - xy1y2[2]) - + 16384)* 300); -} -/*! -* @brief This function used for read the -* YAMAHA YAS537 xy1y2 data -* -* @param v_coil_stat_u8: The value of R coil status -* @param v_busy_u8: The value of busy status -* @param v_temperature_u16: The value of temperature -* @param xy1y2: The value of raw xy1y2 data -* @param v_ouflow_u8: The value of overflow -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + + 16384) * 300); +} +/*! + * @brief This function used for read the + * YAMAHA YAS537 xy1y2 data + * + * @param v_coil_stat_u8: The value of R coil status + * @param v_busy_u8: The value of busy status + * @param v_temperature_u16: The value of temperature + * @param xy1y2: The value of raw xy1y2 data + * @param v_ouflow_u8: The value of overflow + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas537_read_xy1y2_data( -u8*v_coil_stat_u8, u8*v_busy_u8, -u16*v_temperature_u16, u16*xy1y2, u8*v_ouflow_u8) +u8 *v_coil_stat_u8, u8 *v_busy_u8, +u16 *v_temperature_u16, u16 *xy1y2, u8 *v_ouflow_u8) { /* This variable used for provide the communication results*/ SMI130_RETURN_FUNCTION_TYPE com_rslt = E_SMI130_COMM_RES; - /* Array holding the YAS532 calibration values*/ + /* Array holding the YAS532 calibration values */ u8 a_data_u8[SMI130_YAS_XY1Y2T_DATA_SIZE] = { SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE, @@ -18610,27 +18607,27 @@ u16*v_temperature_u16, u16*xy1y2, u8*v_ouflow_u8) | a_data_u8[7]); for (i = 0; i < 3; i++) yas537_data.last_raw[i] = xy1y2[i]; - yas537_data.last_raw[i] =*v_temperature_u16; + yas537_data.last_raw[i] = *v_temperature_u16; if (yas537_data.calib_yas537.ver == 1) { for (i = 0; i < 3; i++) a_s_s32[i] = xy1y2[i] - 8192; /* read hx*/ - a_h_s32[0] = ((yas537_data.calib_yas537.k* ( - (128* a_s_s32[0]) + - (yas537_data.calib_yas537.a2* a_s_s32[1]) + - (yas537_data.calib_yas537.a3* a_s_s32[2]))) + a_h_s32[0] = ((yas537_data.calib_yas537.k * ( + (128 * a_s_s32[0]) + + (yas537_data.calib_yas537.a2 * a_s_s32[1]) + + (yas537_data.calib_yas537.a3 * a_s_s32[2]))) / (8192)); /* read hy1*/ - a_h_s32[1] = ((yas537_data.calib_yas537.k* ( - (yas537_data.calib_yas537.a4* a_s_s32[0]) + - (yas537_data.calib_yas537.a5* a_s_s32[1]) + - (yas537_data.calib_yas537.a6* a_s_s32[2]))) + a_h_s32[1] = ((yas537_data.calib_yas537.k * ( + (yas537_data.calib_yas537.a4 * a_s_s32[0]) + + (yas537_data.calib_yas537.a5 * a_s_s32[1]) + + (yas537_data.calib_yas537.a6 * a_s_s32[2]))) / (8192)); /* read hy2*/ - a_h_s32[2] = ((yas537_data.calib_yas537.k* ( - (yas537_data.calib_yas537.a7* a_s_s32[0]) + - (yas537_data.calib_yas537.a8* a_s_s32[1]) + - (yas537_data.calib_yas537.a9* a_s_s32[2]))) + a_h_s32[2] = ((yas537_data.calib_yas537.k * ( + (yas537_data.calib_yas537.a7 * a_s_s32[0]) + + (yas537_data.calib_yas537.a8 * a_s_s32[1]) + + (yas537_data.calib_yas537.a9 * a_s_s32[2]))) / (8192)); for (i = 0; i < 3; i++) { @@ -18647,29 +18644,29 @@ u16*v_temperature_u16, u16*xy1y2, u8*v_ouflow_u8) *v_ouflow_u8 = 0; for (i = 0; i < 3; i++) { if (YAS537_DATA_OVERFLOW <= xy1y2[i]) - *v_ouflow_u8 |= (1 << (i* 2)); + *v_ouflow_u8 |= (1 << (i * 2)); if (xy1y2[i] == YAS537_DATA_UNDERFLOW) - *v_ouflow_u8 |= (1 << (i* 2 + 1)); + *v_ouflow_u8 |= (1 << (i * 2 + 1)); } return com_rslt; } /*! -* @brief This function used for read the -* YAMAHA YAS537 xy1y2 data -* -* @param v_ouflow_u8: The value of overflow -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for read the + * YAMAHA YAS537 xy1y2 data + * + * @param v_ouflow_u8: The value of overflow + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ static SMI130_RETURN_FUNCTION_TYPE invalid_magnetic_field( -u16*v_cur_u16, u16*v_last_u16) +u16 *v_cur_u16, u16 *v_last_u16) { s16 invalid_thresh[] = {1500, 1500, 1500}; u8 i = SMI130_INIT_VALUE; @@ -18680,20 +18677,20 @@ u16*v_cur_u16, u16*v_last_u16) return 0; } /*! -* @brief This function used for read the -* YAMAHA YAS537 xy1y2 data -* -* @param v_ouflow_u8: The value of overflow -* -* -* @return results of bus communication function -* @retval 0 -> Success -* @retval -1 -> Error -* -* -*/ + * @brief This function used for read the + * YAMAHA YAS537 xy1y2 data + * + * @param v_ouflow_u8: The value of overflow + * + * + * @return results of bus communication function + * @retval 0 -> Success + * @retval -1 -> Error + * + * + */ SMI130_RETURN_FUNCTION_TYPE smi130_bosch_yamaha_yas537_measure_xyz_data( -u8*v_ouflow_u8, struct yas_vector*vector_xyz) +u8 *v_ouflow_u8, struct yas_vector *vector_xyz) { s32 a_xyz_tmp_s32[SMI130_YAS_TEMP_DATA_SIZE] = { SMI130_INIT_VALUE, SMI130_INIT_VALUE, SMI130_INIT_VALUE}; @@ -18717,10 +18714,10 @@ u8*v_ouflow_u8, struct yas_vector*vector_xyz) yas537_data.transform[i + 3] * vector_xyz->yas537_vector_xyz[0]) + (yas537_data.transform[ - i* 3 + 1] + i * 3 + 1] * vector_xyz->yas537_vector_xyz[1]) + (yas537_data.transform[ - i* 3 + 2] + i * 3 + 2] * vector_xyz->yas537_vector_xyz[2])); } yas537_set_vector( @@ -18730,11 +18727,11 @@ u8*v_ouflow_u8, struct yas_vector*vector_xyz) vector_xyz->yas537_vector_xyz[i] -= vector_xyz->yas537_vector_xyz[i] % 10; if (*v_ouflow_u8 & (1 << - (i* 2))) + (i * 2))) vector_xyz->yas537_vector_xyz[i] += - 1; /* set overflow*/ - if (*v_ouflow_u8 & (1 << (i* 2 + 1))) - /* set underflow*/ + 1; /* set overflow */ + if (*v_ouflow_u8 & (1 << (i * 2 + 1))) + /* set underflow */ vector_xyz->yas537_vector_xyz[i] += 2; } if (v_busy_u8) @@ -18775,14 +18772,14 @@ u8*v_ouflow_u8, struct yas_vector*vector_xyz) return com_rslt; } /*! -* @brief This function used for reading -* smi130_t structure -* -* @return the reference and values of smi130_t -* -* + * @brief This function used for reading + * smi130_t structure + * + * @return the reference and values of smi130_t + * + * */ -struct smi130_t*smi130_get_ptr(void) +struct smi130_t *smi130_get_ptr(void) { return p_smi130; } diff --git a/drivers/input/sensors/smi130/smi130.h b/drivers/input/sensors/smi130/smi130.h index fe2032b695a1..59d22af36022 100644 --- a/drivers/input/sensors/smi130/smi130.h +++ b/drivers/input/sensors/smi130/smi130.h @@ -1,118 +1,121 @@ -/* -**************************************************************************** -* Copyright (C) 2014 Bosch Sensortec GmbH -* -* (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved +/*! + * @section LICENSE + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved + * + * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved + * + * This software program is licensed subject to the GNU General + * Public License (GPL).Version 2,June 1991, + * available at http://www.fsf.org/copyleft/gpl.html + * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. * * smi130.h -* @Date : 2015/04/02 -* @Modification Date 2018/06/21 15:03 +* Date : 2015/04/02 * @id 836294d * Revision : 2.0.9 $ * @brief * The head file of SMI130API * -* Special: Description of the Software: -* -* This software module (hereinafter called "Software") and any -* information on application-sheets (hereinafter called "Information") is -* provided free of charge for the sole purpose to support your application -* work. -* -* As such, the Software is merely an experimental software, not tested for -* safety in the field and only intended for inspiration for further development -* and testing. Any usage in a safety-relevant field of use (like automotive, -* seafaring, spacefaring, industrial plants etc.) was not intended, so there are -* no precautions for such usage incorporated in the Software. -* -* The Software is specifically designed for the exclusive use for Bosch -* Sensortec products by personnel who have special experience and training. Do -* not use this Software if you do not have the proper experience or training. -* -* This Software package is provided as is and without any expressed or -* implied warranties, including without limitation, the implied warranties of -* merchantability and fitness for a particular purpose. -* -* Bosch Sensortec and their representatives and agents deny any liability for -* the functional impairment of this Software in terms of fitness, performance -* and safety. Bosch Sensortec and their representatives and agents shall not be -* liable for any direct or indirect damages or injury, except as otherwise -* stipulated in mandatory applicable law. -* The Information provided is believed to be accurate and reliable. Bosch -* Sensortec assumes no responsibility for the consequences of use of such -* Information nor for any infringement of patents or other rights of third -* parties which may result from its use. -* -*------------------------------------------------------------------------------ -* The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software -* which is licensed under the Apache License, Version 2.0 as stated above. -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Product Disclaimer -* -* Common: -* -* Assessment of Products Returned from Field -* -* Returned products are considered good if they fulfill the specifications / -* test data for 0-mileage and field listed in this document. -* -* Engineering Samples -* -* Engineering samples are marked with (e) or (E). Samples may vary from the -* valid technical specifications of the series product contained in this -* data sheet. Therefore, they are not intended or fit for resale to -* third parties or for use in end products. Their sole purpose is internal -* client testing. The testing of an engineering sample may in no way replace -* the testing of a series product. Bosch assumes no liability for the use -* of engineering samples. The purchaser shall indemnify Bosch from all claims -* arising from the use of engineering samples. -* -* Intended use -* -* Provided that SMI130 is used within the conditions (environment, application, -* installation, loads) as described in this TCD and the corresponding -* agreed upon documents, Bosch ensures that the product complies with -* the agreed properties. Agreements beyond this require -* the written approval by Bosch. The product is considered fit for the intended -* use when the product successfully has passed the tests -* in accordance with the TCD and agreed upon documents. -* -* It is the responsibility of the customer to ensure the proper application -* of the product in the overall system/vehicle. -* -* Bosch does not assume any responsibility for changes to the environment -* of the product that deviate from the TCD and the agreed upon documents -* as well as all applications not released by Bosch -* -* The resale and/or use of products are at the purchaser’s own risk and -* responsibility. The examination and testing of the SMI130 -* is the sole responsibility of the purchaser. -* -* The purchaser shall indemnify Bosch from all third party claims -* arising from any product use not covered by the parameters of -* this product data sheet or not approved by Bosch and reimburse Bosch -* for all costs and damages in connection with such claims. -* -* The purchaser must monitor the market for the purchased products, -* particularly with regard to product safety, and inform Bosch without delay -* of all security relevant incidents. -* -* Application Examples and Hints -* -* With respect to any application examples, advice, normal values -* and/or any information regarding the application of the device, -* Bosch hereby disclaims any and all warranties and liabilities of any kind, -* including without limitation warranties of -* non-infringement of intellectual property rights or copyrights -* of any third party. -* The information given in this document shall in no event be regarded -* as a guarantee of conditions or characteristics. They are provided -* for illustrative purposes only and no evaluation regarding infringement -* of intellectual property rights or copyrights or regarding functionality, -* performance or error has been made. -* -* + **************************************************************************/ /*! \file smi130.h \brief SMI130 Sensor Driver Support Header File */ @@ -443,7 +446,7 @@ burst_read(device_addr, register_addr, register_data, rd_len) /**\name BUS READ AND WRITE FUNCTION POINTERS */ /***************************************************************/ #define SMI130_I2C_ADDR1 0x68 /**< I2C Address needs to be changed */ -#define SMI130_I2C_ADDR2 0x18 /**< I2C Address needs to be changed */ +#define SMI130_I2C_ADDR2 0x69 /**< I2C Address needs to be changed */ #define SMI130_AUX_BMM150_I2C_ADDRESS (0x10) #define SMI130_AUX_YAS532_I2C_ADDRESS (0x2E) /**< I2C address of YAS532*/ diff --git a/drivers/input/sensors/smi130/smi130_acc.c b/drivers/input/sensors/smi130/smi130_acc.c new file mode 100644 index 000000000000..42af22c8a3aa --- /dev/null +++ b/drivers/input/sensors/smi130/smi130_acc.c @@ -0,0 +1,7507 @@ +/*! + * @section LICENSE + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved + * + * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved + * + * This software program is licensed subject to the GNU General + * Public License (GPL).Version 2,June 1991, + * available at http://www.fsf.org/copyleft/gpl.html + * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * + * @filename smi130_acc.c + * @date 2015/11/17 10:32 + * @Modification Date 2018/08/28 18:20 + * @id "836294d" + * @version 2.1.2 + * + * @brief + * This file contains all function implementations for the SMI_ACC2X2 in linux +*/ + +#ifdef CONFIG_SIG_MOTION +#undef CONFIG_HAS_EARLYSUSPEND +#endif +#include <linux/module.h> +#include <linux/init.h> +#include <linux/i2c.h> +#include <linux/input.h> +#include <linux/workqueue.h> +#include <linux/mutex.h> +#include <linux/slab.h> +#include <linux/mutex.h> +#include <linux/interrupt.h> +#include <linux/delay.h> +#include <asm/irq.h> +#include <linux/math64.h> + +#ifdef CONFIG_HAS_EARLYSUSPEND +#include <linux/earlysuspend.h> +#endif + +#ifdef __KERNEL__ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/unistd.h> +#include <linux/types.h> +#include <linux/string.h> +#else +#include <unistd.h> +#include <sys/types.h> +#include <string.h> +#endif + +#include "boschclass.h" +#include "bs_log.h" +#define DRIVER_VERSION "0.0.53.0" +#define ACC_NAME "ACC" +#define SMI_ACC2X2_ENABLE_INT1 1 +#define CONFIG_SMI_ACC_ENABLE_NEWDATA_INT 1 + +#define SENSOR_NAME "smi130_acc" +#define SMI130_ACC_USE_BASIC_I2C_FUNC 1 + +#define MSC_TIME 6 +#define ABSMIN -512 +#define ABSMAX 512 +#define SLOPE_THRESHOLD_VALUE 32 +#define SLOPE_DURATION_VALUE 1 +#define INTERRUPT_LATCH_MODE 13 +#define INTERRUPT_ENABLE 1 +#define INTERRUPT_DISABLE 0 +#define MAP_SLOPE_INTERRUPT 2 +#define SLOPE_X_INDEX 5 +#define SLOPE_Y_INDEX 6 +#define SLOPE_Z_INDEX 7 +#define SMI_ACC2X2_MAX_DELAY 200 +#define SMI_ACC2X2_RANGE_SET 3 /* +/- 2G */ +#define SMI_ACC2X2_BW_SET 12 /* 125HZ */ + +#define LOW_G_INTERRUPT REL_Z +#define HIGH_G_INTERRUPT REL_HWHEEL +#define SLOP_INTERRUPT REL_DIAL +#define DOUBLE_TAP_INTERRUPT REL_WHEEL +#define SINGLE_TAP_INTERRUPT REL_MISC +#define ORIENT_INTERRUPT ABS_PRESSURE +#define FLAT_INTERRUPT ABS_DISTANCE +#define SLOW_NO_MOTION_INTERRUPT REL_Y + +#define HIGH_G_INTERRUPT_X_HAPPENED 1 +#define HIGH_G_INTERRUPT_Y_HAPPENED 2 +#define HIGH_G_INTERRUPT_Z_HAPPENED 3 +#define HIGH_G_INTERRUPT_X_NEGATIVE_HAPPENED 4 +#define HIGH_G_INTERRUPT_Y_NEGATIVE_HAPPENED 5 +#define HIGH_G_INTERRUPT_Z_NEGATIVE_HAPPENED 6 +#define SLOPE_INTERRUPT_X_HAPPENED 7 +#define SLOPE_INTERRUPT_Y_HAPPENED 8 +#define SLOPE_INTERRUPT_Z_HAPPENED 9 +#define SLOPE_INTERRUPT_X_NEGATIVE_HAPPENED 10 +#define SLOPE_INTERRUPT_Y_NEGATIVE_HAPPENED 11 +#define SLOPE_INTERRUPT_Z_NEGATIVE_HAPPENED 12 +#define DOUBLE_TAP_INTERRUPT_HAPPENED 13 +#define SINGLE_TAP_INTERRUPT_HAPPENED 14 +#define UPWARD_PORTRAIT_UP_INTERRUPT_HAPPENED 15 +#define UPWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED 16 +#define UPWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED 17 +#define UPWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED 18 +#define DOWNWARD_PORTRAIT_UP_INTERRUPT_HAPPENED 19 +#define DOWNWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED 20 +#define DOWNWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED 21 +#define DOWNWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED 22 +#define FLAT_INTERRUPT_TURE_HAPPENED 23 +#define FLAT_INTERRUPT_FALSE_HAPPENED 24 +#define LOW_G_INTERRUPT_HAPPENED 25 +#define SLOW_NO_MOTION_INTERRUPT_HAPPENED 26 + +#define PAD_LOWG 0 +#define PAD_HIGHG 1 +#define PAD_SLOP 2 +#define PAD_DOUBLE_TAP 3 +#define PAD_SINGLE_TAP 4 +#define PAD_ORIENT 5 +#define PAD_FLAT 6 +#define PAD_SLOW_NO_MOTION 7 + +#define SMI_ACC2X2_EEP_OFFSET 0x16 +#define SMI_ACC2X2_IMAGE_BASE 0x38 +#define SMI_ACC2X2_IMAGE_LEN 22 + +#define SMI_ACC2X2_CHIP_ID_REG 0x00 +#define SMI_ACC2X2_VERSION_REG 0x01 +#define SMI_ACC2X2_X_AXIS_LSB_REG 0x02 +#define SMI_ACC2X2_X_AXIS_MSB_REG 0x03 +#define SMI_ACC2X2_Y_AXIS_LSB_REG 0x04 +#define SMI_ACC2X2_Y_AXIS_MSB_REG 0x05 +#define SMI_ACC2X2_Z_AXIS_LSB_REG 0x06 +#define SMI_ACC2X2_Z_AXIS_MSB_REG 0x07 +#define SMI_ACC2X2_TEMPERATURE_REG 0x08 +#define SMI_ACC2X2_STATUS1_REG 0x09 +#define SMI_ACC2X2_STATUS2_REG 0x0A +#define SMI_ACC2X2_STATUS_TAP_SLOPE_REG 0x0B +#define SMI_ACC2X2_STATUS_ORIENT_HIGH_REG 0x0C +#define SMI_ACC2X2_STATUS_FIFO_REG 0x0E +#define SMI_ACC2X2_RANGE_SEL_REG 0x0F +#define SMI_ACC2X2_BW_SEL_REG 0x10 +#define SMI_ACC2X2_MODE_CTRL_REG 0x11 +#define SMI_ACC2X2_LOW_NOISE_CTRL_REG 0x12 +#define SMI_ACC2X2_DATA_CTRL_REG 0x13 +#define SMI_ACC2X2_RESET_REG 0x14 +#define SMI_ACC2X2_INT_ENABLE1_REG 0x16 +#define SMI_ACC2X2_INT_ENABLE2_REG 0x17 +#define SMI_ACC2X2_INT_SLO_NO_MOT_REG 0x18 +#define SMI_ACC2X2_INT1_PAD_SEL_REG 0x19 +#define SMI_ACC2X2_INT_DATA_SEL_REG 0x1A +#define SMI_ACC2X2_INT2_PAD_SEL_REG 0x1B +#define SMI_ACC2X2_INT_SRC_REG 0x1E +#define SMI_ACC2X2_INT_SET_REG 0x20 +#define SMI_ACC2X2_INT_CTRL_REG 0x21 +#define SMI_ACC2X2_LOW_DURN_REG 0x22 +#define SMI_ACC2X2_LOW_THRES_REG 0x23 +#define SMI_ACC2X2_LOW_HIGH_HYST_REG 0x24 +#define SMI_ACC2X2_HIGH_DURN_REG 0x25 +#define SMI_ACC2X2_HIGH_THRES_REG 0x26 +#define SMI_ACC2X2_SLOPE_DURN_REG 0x27 +#define SMI_ACC2X2_SLOPE_THRES_REG 0x28 +#define SMI_ACC2X2_SLO_NO_MOT_THRES_REG 0x29 +#define SMI_ACC2X2_TAP_PARAM_REG 0x2A +#define SMI_ACC2X2_TAP_THRES_REG 0x2B +#define SMI_ACC2X2_ORIENT_PARAM_REG 0x2C +#define SMI_ACC2X2_THETA_BLOCK_REG 0x2D +#define SMI_ACC2X2_THETA_FLAT_REG 0x2E +#define SMI_ACC2X2_FLAT_HOLD_TIME_REG 0x2F +#define SMI_ACC2X2_FIFO_WML_TRIG 0x30 +#define SMI_ACC2X2_SELF_TEST_REG 0x32 +#define SMI_ACC2X2_EEPROM_CTRL_REG 0x33 +#define SMI_ACC2X2_SERIAL_CTRL_REG 0x34 +#define SMI_ACC2X2_EXTMODE_CTRL_REG 0x35 +#define SMI_ACC2X2_OFFSET_CTRL_REG 0x36 +#define SMI_ACC2X2_OFFSET_PARAMS_REG 0x37 +#define SMI_ACC2X2_OFFSET_X_AXIS_REG 0x38 +#define SMI_ACC2X2_OFFSET_Y_AXIS_REG 0x39 +#define SMI_ACC2X2_OFFSET_Z_AXIS_REG 0x3A +#define SMI_ACC2X2_GP0_REG 0x3B +#define SMI_ACC2X2_GP1_REG 0x3C +#define SMI_ACC2X2_FIFO_MODE_REG 0x3E +#define SMI_ACC2X2_FIFO_DATA_OUTPUT_REG 0x3F + +#define SMI_ACC2X2_CHIP_ID__POS 0 +#define SMI_ACC2X2_CHIP_ID__MSK 0xFF +#define SMI_ACC2X2_CHIP_ID__LEN 8 +#define SMI_ACC2X2_CHIP_ID__REG SMI_ACC2X2_CHIP_ID_REG + +#define SMI_ACC2X2_VERSION__POS 0 +#define SMI_ACC2X2_VERSION__LEN 8 +#define SMI_ACC2X2_VERSION__MSK 0xFF +#define SMI_ACC2X2_VERSION__REG SMI_ACC2X2_VERSION_REG + +#define SMI130_ACC_SLO_NO_MOT_DUR__POS 2 +#define SMI130_ACC_SLO_NO_MOT_DUR__LEN 6 +#define SMI130_ACC_SLO_NO_MOT_DUR__MSK 0xFC +#define SMI130_ACC_SLO_NO_MOT_DUR__REG SMI_ACC2X2_SLOPE_DURN_REG + +#define SMI_ACC2X2_NEW_DATA_X__POS 0 +#define SMI_ACC2X2_NEW_DATA_X__LEN 1 +#define SMI_ACC2X2_NEW_DATA_X__MSK 0x01 +#define SMI_ACC2X2_NEW_DATA_X__REG SMI_ACC2X2_X_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_X14_LSB__POS 2 +#define SMI_ACC2X2_ACC_X14_LSB__LEN 6 +#define SMI_ACC2X2_ACC_X14_LSB__MSK 0xFC +#define SMI_ACC2X2_ACC_X14_LSB__REG SMI_ACC2X2_X_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_X12_LSB__POS 4 +#define SMI_ACC2X2_ACC_X12_LSB__LEN 4 +#define SMI_ACC2X2_ACC_X12_LSB__MSK 0xF0 +#define SMI_ACC2X2_ACC_X12_LSB__REG SMI_ACC2X2_X_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_X10_LSB__POS 6 +#define SMI_ACC2X2_ACC_X10_LSB__LEN 2 +#define SMI_ACC2X2_ACC_X10_LSB__MSK 0xC0 +#define SMI_ACC2X2_ACC_X10_LSB__REG SMI_ACC2X2_X_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_X8_LSB__POS 0 +#define SMI_ACC2X2_ACC_X8_LSB__LEN 0 +#define SMI_ACC2X2_ACC_X8_LSB__MSK 0x00 +#define SMI_ACC2X2_ACC_X8_LSB__REG SMI_ACC2X2_X_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_X_MSB__POS 0 +#define SMI_ACC2X2_ACC_X_MSB__LEN 8 +#define SMI_ACC2X2_ACC_X_MSB__MSK 0xFF +#define SMI_ACC2X2_ACC_X_MSB__REG SMI_ACC2X2_X_AXIS_MSB_REG + +#define SMI_ACC2X2_NEW_DATA_Y__POS 0 +#define SMI_ACC2X2_NEW_DATA_Y__LEN 1 +#define SMI_ACC2X2_NEW_DATA_Y__MSK 0x01 +#define SMI_ACC2X2_NEW_DATA_Y__REG SMI_ACC2X2_Y_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Y14_LSB__POS 2 +#define SMI_ACC2X2_ACC_Y14_LSB__LEN 6 +#define SMI_ACC2X2_ACC_Y14_LSB__MSK 0xFC +#define SMI_ACC2X2_ACC_Y14_LSB__REG SMI_ACC2X2_Y_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Y12_LSB__POS 4 +#define SMI_ACC2X2_ACC_Y12_LSB__LEN 4 +#define SMI_ACC2X2_ACC_Y12_LSB__MSK 0xF0 +#define SMI_ACC2X2_ACC_Y12_LSB__REG SMI_ACC2X2_Y_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Y10_LSB__POS 6 +#define SMI_ACC2X2_ACC_Y10_LSB__LEN 2 +#define SMI_ACC2X2_ACC_Y10_LSB__MSK 0xC0 +#define SMI_ACC2X2_ACC_Y10_LSB__REG SMI_ACC2X2_Y_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Y8_LSB__POS 0 +#define SMI_ACC2X2_ACC_Y8_LSB__LEN 0 +#define SMI_ACC2X2_ACC_Y8_LSB__MSK 0x00 +#define SMI_ACC2X2_ACC_Y8_LSB__REG SMI_ACC2X2_Y_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Y_MSB__POS 0 +#define SMI_ACC2X2_ACC_Y_MSB__LEN 8 +#define SMI_ACC2X2_ACC_Y_MSB__MSK 0xFF +#define SMI_ACC2X2_ACC_Y_MSB__REG SMI_ACC2X2_Y_AXIS_MSB_REG + +#define SMI_ACC2X2_NEW_DATA_Z__POS 0 +#define SMI_ACC2X2_NEW_DATA_Z__LEN 1 +#define SMI_ACC2X2_NEW_DATA_Z__MSK 0x01 +#define SMI_ACC2X2_NEW_DATA_Z__REG SMI_ACC2X2_Z_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Z14_LSB__POS 2 +#define SMI_ACC2X2_ACC_Z14_LSB__LEN 6 +#define SMI_ACC2X2_ACC_Z14_LSB__MSK 0xFC +#define SMI_ACC2X2_ACC_Z14_LSB__REG SMI_ACC2X2_Z_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Z12_LSB__POS 4 +#define SMI_ACC2X2_ACC_Z12_LSB__LEN 4 +#define SMI_ACC2X2_ACC_Z12_LSB__MSK 0xF0 +#define SMI_ACC2X2_ACC_Z12_LSB__REG SMI_ACC2X2_Z_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Z10_LSB__POS 6 +#define SMI_ACC2X2_ACC_Z10_LSB__LEN 2 +#define SMI_ACC2X2_ACC_Z10_LSB__MSK 0xC0 +#define SMI_ACC2X2_ACC_Z10_LSB__REG SMI_ACC2X2_Z_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Z8_LSB__POS 0 +#define SMI_ACC2X2_ACC_Z8_LSB__LEN 0 +#define SMI_ACC2X2_ACC_Z8_LSB__MSK 0x00 +#define SMI_ACC2X2_ACC_Z8_LSB__REG SMI_ACC2X2_Z_AXIS_LSB_REG + +#define SMI_ACC2X2_ACC_Z_MSB__POS 0 +#define SMI_ACC2X2_ACC_Z_MSB__LEN 8 +#define SMI_ACC2X2_ACC_Z_MSB__MSK 0xFF +#define SMI_ACC2X2_ACC_Z_MSB__REG SMI_ACC2X2_Z_AXIS_MSB_REG + +#define SMI_ACC2X2_TEMPERATURE__POS 0 +#define SMI_ACC2X2_TEMPERATURE__LEN 8 +#define SMI_ACC2X2_TEMPERATURE__MSK 0xFF +#define SMI_ACC2X2_TEMPERATURE__REG SMI_ACC2X2_TEMP_RD_REG + +#define SMI_ACC2X2_LOWG_INT_S__POS 0 +#define SMI_ACC2X2_LOWG_INT_S__LEN 1 +#define SMI_ACC2X2_LOWG_INT_S__MSK 0x01 +#define SMI_ACC2X2_LOWG_INT_S__REG SMI_ACC2X2_STATUS1_REG + +#define SMI_ACC2X2_HIGHG_INT_S__POS 1 +#define SMI_ACC2X2_HIGHG_INT_S__LEN 1 +#define SMI_ACC2X2_HIGHG_INT_S__MSK 0x02 +#define SMI_ACC2X2_HIGHG_INT_S__REG SMI_ACC2X2_STATUS1_REG + +#define SMI_ACC2X2_SLOPE_INT_S__POS 2 +#define SMI_ACC2X2_SLOPE_INT_S__LEN 1 +#define SMI_ACC2X2_SLOPE_INT_S__MSK 0x04 +#define SMI_ACC2X2_SLOPE_INT_S__REG SMI_ACC2X2_STATUS1_REG + + +#define SMI_ACC2X2_SLO_NO_MOT_INT_S__POS 3 +#define SMI_ACC2X2_SLO_NO_MOT_INT_S__LEN 1 +#define SMI_ACC2X2_SLO_NO_MOT_INT_S__MSK 0x08 +#define SMI_ACC2X2_SLO_NO_MOT_INT_S__REG SMI_ACC2X2_STATUS1_REG + +#define SMI_ACC2X2_DOUBLE_TAP_INT_S__POS 4 +#define SMI_ACC2X2_DOUBLE_TAP_INT_S__LEN 1 +#define SMI_ACC2X2_DOUBLE_TAP_INT_S__MSK 0x10 +#define SMI_ACC2X2_DOUBLE_TAP_INT_S__REG SMI_ACC2X2_STATUS1_REG + +#define SMI_ACC2X2_SINGLE_TAP_INT_S__POS 5 +#define SMI_ACC2X2_SINGLE_TAP_INT_S__LEN 1 +#define SMI_ACC2X2_SINGLE_TAP_INT_S__MSK 0x20 +#define SMI_ACC2X2_SINGLE_TAP_INT_S__REG SMI_ACC2X2_STATUS1_REG + +#define SMI_ACC2X2_ORIENT_INT_S__POS 6 +#define SMI_ACC2X2_ORIENT_INT_S__LEN 1 +#define SMI_ACC2X2_ORIENT_INT_S__MSK 0x40 +#define SMI_ACC2X2_ORIENT_INT_S__REG SMI_ACC2X2_STATUS1_REG + +#define SMI_ACC2X2_FLAT_INT_S__POS 7 +#define SMI_ACC2X2_FLAT_INT_S__LEN 1 +#define SMI_ACC2X2_FLAT_INT_S__MSK 0x80 +#define SMI_ACC2X2_FLAT_INT_S__REG SMI_ACC2X2_STATUS1_REG + +#define SMI_ACC2X2_FIFO_FULL_INT_S__POS 5 +#define SMI_ACC2X2_FIFO_FULL_INT_S__LEN 1 +#define SMI_ACC2X2_FIFO_FULL_INT_S__MSK 0x20 +#define SMI_ACC2X2_FIFO_FULL_INT_S__REG SMI_ACC2X2_STATUS2_REG + +#define SMI_ACC2X2_FIFO_WM_INT_S__POS 6 +#define SMI_ACC2X2_FIFO_WM_INT_S__LEN 1 +#define SMI_ACC2X2_FIFO_WM_INT_S__MSK 0x40 +#define SMI_ACC2X2_FIFO_WM_INT_S__REG SMI_ACC2X2_STATUS2_REG + +#define SMI_ACC2X2_DATA_INT_S__POS 7 +#define SMI_ACC2X2_DATA_INT_S__LEN 1 +#define SMI_ACC2X2_DATA_INT_S__MSK 0x80 +#define SMI_ACC2X2_DATA_INT_S__REG SMI_ACC2X2_STATUS2_REG + +#define SMI_ACC2X2_SLOPE_FIRST_X__POS 0 +#define SMI_ACC2X2_SLOPE_FIRST_X__LEN 1 +#define SMI_ACC2X2_SLOPE_FIRST_X__MSK 0x01 +#define SMI_ACC2X2_SLOPE_FIRST_X__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_SLOPE_FIRST_Y__POS 1 +#define SMI_ACC2X2_SLOPE_FIRST_Y__LEN 1 +#define SMI_ACC2X2_SLOPE_FIRST_Y__MSK 0x02 +#define SMI_ACC2X2_SLOPE_FIRST_Y__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_SLOPE_FIRST_Z__POS 2 +#define SMI_ACC2X2_SLOPE_FIRST_Z__LEN 1 +#define SMI_ACC2X2_SLOPE_FIRST_Z__MSK 0x04 +#define SMI_ACC2X2_SLOPE_FIRST_Z__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_SLOPE_SIGN_S__POS 3 +#define SMI_ACC2X2_SLOPE_SIGN_S__LEN 1 +#define SMI_ACC2X2_SLOPE_SIGN_S__MSK 0x08 +#define SMI_ACC2X2_SLOPE_SIGN_S__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_TAP_FIRST_X__POS 4 +#define SMI_ACC2X2_TAP_FIRST_X__LEN 1 +#define SMI_ACC2X2_TAP_FIRST_X__MSK 0x10 +#define SMI_ACC2X2_TAP_FIRST_X__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_TAP_FIRST_Y__POS 5 +#define SMI_ACC2X2_TAP_FIRST_Y__LEN 1 +#define SMI_ACC2X2_TAP_FIRST_Y__MSK 0x20 +#define SMI_ACC2X2_TAP_FIRST_Y__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_TAP_FIRST_Z__POS 6 +#define SMI_ACC2X2_TAP_FIRST_Z__LEN 1 +#define SMI_ACC2X2_TAP_FIRST_Z__MSK 0x40 +#define SMI_ACC2X2_TAP_FIRST_Z__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_TAP_SIGN_S__POS 7 +#define SMI_ACC2X2_TAP_SIGN_S__LEN 1 +#define SMI_ACC2X2_TAP_SIGN_S__MSK 0x80 +#define SMI_ACC2X2_TAP_SIGN_S__REG SMI_ACC2X2_STATUS_TAP_SLOPE_REG + +#define SMI_ACC2X2_HIGHG_FIRST_X__POS 0 +#define SMI_ACC2X2_HIGHG_FIRST_X__LEN 1 +#define SMI_ACC2X2_HIGHG_FIRST_X__MSK 0x01 +#define SMI_ACC2X2_HIGHG_FIRST_X__REG SMI_ACC2X2_STATUS_ORIENT_HIGH_REG + +#define SMI_ACC2X2_HIGHG_FIRST_Y__POS 1 +#define SMI_ACC2X2_HIGHG_FIRST_Y__LEN 1 +#define SMI_ACC2X2_HIGHG_FIRST_Y__MSK 0x02 +#define SMI_ACC2X2_HIGHG_FIRST_Y__REG SMI_ACC2X2_STATUS_ORIENT_HIGH_REG + +#define SMI_ACC2X2_HIGHG_FIRST_Z__POS 2 +#define SMI_ACC2X2_HIGHG_FIRST_Z__LEN 1 +#define SMI_ACC2X2_HIGHG_FIRST_Z__MSK 0x04 +#define SMI_ACC2X2_HIGHG_FIRST_Z__REG SMI_ACC2X2_STATUS_ORIENT_HIGH_REG + +#define SMI_ACC2X2_HIGHG_SIGN_S__POS 3 +#define SMI_ACC2X2_HIGHG_SIGN_S__LEN 1 +#define SMI_ACC2X2_HIGHG_SIGN_S__MSK 0x08 +#define SMI_ACC2X2_HIGHG_SIGN_S__REG SMI_ACC2X2_STATUS_ORIENT_HIGH_REG + +#define SMI_ACC2X2_ORIENT_S__POS 4 +#define SMI_ACC2X2_ORIENT_S__LEN 3 +#define SMI_ACC2X2_ORIENT_S__MSK 0x70 +#define SMI_ACC2X2_ORIENT_S__REG SMI_ACC2X2_STATUS_ORIENT_HIGH_REG + +#define SMI_ACC2X2_FLAT_S__POS 7 +#define SMI_ACC2X2_FLAT_S__LEN 1 +#define SMI_ACC2X2_FLAT_S__MSK 0x80 +#define SMI_ACC2X2_FLAT_S__REG SMI_ACC2X2_STATUS_ORIENT_HIGH_REG + +#define SMI_ACC2X2_FIFO_FRAME_COUNTER_S__POS 0 +#define SMI_ACC2X2_FIFO_FRAME_COUNTER_S__LEN 7 +#define SMI_ACC2X2_FIFO_FRAME_COUNTER_S__MSK 0x7F +#define SMI_ACC2X2_FIFO_FRAME_COUNTER_S__REG SMI_ACC2X2_STATUS_FIFO_REG + +#define SMI_ACC2X2_FIFO_OVERRUN_S__POS 7 +#define SMI_ACC2X2_FIFO_OVERRUN_S__LEN 1 +#define SMI_ACC2X2_FIFO_OVERRUN_S__MSK 0x80 +#define SMI_ACC2X2_FIFO_OVERRUN_S__REG SMI_ACC2X2_STATUS_FIFO_REG + +#define SMI_ACC2X2_RANGE_SEL__POS 0 +#define SMI_ACC2X2_RANGE_SEL__LEN 4 +#define SMI_ACC2X2_RANGE_SEL__MSK 0x0F +#define SMI_ACC2X2_RANGE_SEL__REG SMI_ACC2X2_RANGE_SEL_REG + +#define SMI_ACC2X2_BANDWIDTH__POS 0 +#define SMI_ACC2X2_BANDWIDTH__LEN 5 +#define SMI_ACC2X2_BANDWIDTH__MSK 0x1F +#define SMI_ACC2X2_BANDWIDTH__REG SMI_ACC2X2_BW_SEL_REG + +#define SMI_ACC2X2_SLEEP_DUR__POS 1 +#define SMI_ACC2X2_SLEEP_DUR__LEN 4 +#define SMI_ACC2X2_SLEEP_DUR__MSK 0x1E +#define SMI_ACC2X2_SLEEP_DUR__REG SMI_ACC2X2_MODE_CTRL_REG + +#define SMI_ACC2X2_MODE_CTRL__POS 5 +#define SMI_ACC2X2_MODE_CTRL__LEN 3 +#define SMI_ACC2X2_MODE_CTRL__MSK 0xE0 +#define SMI_ACC2X2_MODE_CTRL__REG SMI_ACC2X2_MODE_CTRL_REG + +#define SMI_ACC2X2_DEEP_SUSPEND__POS 5 +#define SMI_ACC2X2_DEEP_SUSPEND__LEN 1 +#define SMI_ACC2X2_DEEP_SUSPEND__MSK 0x20 +#define SMI_ACC2X2_DEEP_SUSPEND__REG SMI_ACC2X2_MODE_CTRL_REG + +#define SMI_ACC2X2_EN_LOW_POWER__POS 6 +#define SMI_ACC2X2_EN_LOW_POWER__LEN 1 +#define SMI_ACC2X2_EN_LOW_POWER__MSK 0x40 +#define SMI_ACC2X2_EN_LOW_POWER__REG SMI_ACC2X2_MODE_CTRL_REG + +#define SMI_ACC2X2_EN_SUSPEND__POS 7 +#define SMI_ACC2X2_EN_SUSPEND__LEN 1 +#define SMI_ACC2X2_EN_SUSPEND__MSK 0x80 +#define SMI_ACC2X2_EN_SUSPEND__REG SMI_ACC2X2_MODE_CTRL_REG + +#define SMI_ACC2X2_SLEEP_TIMER__POS 5 +#define SMI_ACC2X2_SLEEP_TIMER__LEN 1 +#define SMI_ACC2X2_SLEEP_TIMER__MSK 0x20 +#define SMI_ACC2X2_SLEEP_TIMER__REG SMI_ACC2X2_LOW_NOISE_CTRL_REG + +#define SMI_ACC2X2_LOW_POWER_MODE__POS 6 +#define SMI_ACC2X2_LOW_POWER_MODE__LEN 1 +#define SMI_ACC2X2_LOW_POWER_MODE__MSK 0x40 +#define SMI_ACC2X2_LOW_POWER_MODE__REG SMI_ACC2X2_LOW_NOISE_CTRL_REG + +#define SMI_ACC2X2_EN_LOW_NOISE__POS 7 +#define SMI_ACC2X2_EN_LOW_NOISE__LEN 1 +#define SMI_ACC2X2_EN_LOW_NOISE__MSK 0x80 +#define SMI_ACC2X2_EN_LOW_NOISE__REG SMI_ACC2X2_LOW_NOISE_CTRL_REG + +#define SMI_ACC2X2_DIS_SHADOW_PROC__POS 6 +#define SMI_ACC2X2_DIS_SHADOW_PROC__LEN 1 +#define SMI_ACC2X2_DIS_SHADOW_PROC__MSK 0x40 +#define SMI_ACC2X2_DIS_SHADOW_PROC__REG SMI_ACC2X2_DATA_CTRL_REG + +#define SMI_ACC2X2_EN_DATA_HIGH_BW__POS 7 +#define SMI_ACC2X2_EN_DATA_HIGH_BW__LEN 1 +#define SMI_ACC2X2_EN_DATA_HIGH_BW__MSK 0x80 +#define SMI_ACC2X2_EN_DATA_HIGH_BW__REG SMI_ACC2X2_DATA_CTRL_REG + +#define SMI_ACC2X2_EN_SOFT_RESET__POS 0 +#define SMI_ACC2X2_EN_SOFT_RESET__LEN 8 +#define SMI_ACC2X2_EN_SOFT_RESET__MSK 0xFF +#define SMI_ACC2X2_EN_SOFT_RESET__REG SMI_ACC2X2_RESET_REG + +#define SMI_ACC2X2_EN_SOFT_RESET_VALUE 0xB6 + +#define SMI_ACC2X2_EN_SLOPE_X_INT__POS 0 +#define SMI_ACC2X2_EN_SLOPE_X_INT__LEN 1 +#define SMI_ACC2X2_EN_SLOPE_X_INT__MSK 0x01 +#define SMI_ACC2X2_EN_SLOPE_X_INT__REG SMI_ACC2X2_INT_ENABLE1_REG + +#define SMI_ACC2X2_EN_SLOPE_Y_INT__POS 1 +#define SMI_ACC2X2_EN_SLOPE_Y_INT__LEN 1 +#define SMI_ACC2X2_EN_SLOPE_Y_INT__MSK 0x02 +#define SMI_ACC2X2_EN_SLOPE_Y_INT__REG SMI_ACC2X2_INT_ENABLE1_REG + +#define SMI_ACC2X2_EN_SLOPE_Z_INT__POS 2 +#define SMI_ACC2X2_EN_SLOPE_Z_INT__LEN 1 +#define SMI_ACC2X2_EN_SLOPE_Z_INT__MSK 0x04 +#define SMI_ACC2X2_EN_SLOPE_Z_INT__REG SMI_ACC2X2_INT_ENABLE1_REG + +#define SMI_ACC2X2_EN_DOUBLE_TAP_INT__POS 4 +#define SMI_ACC2X2_EN_DOUBLE_TAP_INT__LEN 1 +#define SMI_ACC2X2_EN_DOUBLE_TAP_INT__MSK 0x10 +#define SMI_ACC2X2_EN_DOUBLE_TAP_INT__REG SMI_ACC2X2_INT_ENABLE1_REG + +#define SMI_ACC2X2_EN_SINGLE_TAP_INT__POS 5 +#define SMI_ACC2X2_EN_SINGLE_TAP_INT__LEN 1 +#define SMI_ACC2X2_EN_SINGLE_TAP_INT__MSK 0x20 +#define SMI_ACC2X2_EN_SINGLE_TAP_INT__REG SMI_ACC2X2_INT_ENABLE1_REG + +#define SMI_ACC2X2_EN_ORIENT_INT__POS 6 +#define SMI_ACC2X2_EN_ORIENT_INT__LEN 1 +#define SMI_ACC2X2_EN_ORIENT_INT__MSK 0x40 +#define SMI_ACC2X2_EN_ORIENT_INT__REG SMI_ACC2X2_INT_ENABLE1_REG + +#define SMI_ACC2X2_EN_FLAT_INT__POS 7 +#define SMI_ACC2X2_EN_FLAT_INT__LEN 1 +#define SMI_ACC2X2_EN_FLAT_INT__MSK 0x80 +#define SMI_ACC2X2_EN_FLAT_INT__REG SMI_ACC2X2_INT_ENABLE1_REG + +#define SMI_ACC2X2_EN_HIGHG_X_INT__POS 0 +#define SMI_ACC2X2_EN_HIGHG_X_INT__LEN 1 +#define SMI_ACC2X2_EN_HIGHG_X_INT__MSK 0x01 +#define SMI_ACC2X2_EN_HIGHG_X_INT__REG SMI_ACC2X2_INT_ENABLE2_REG + +#define SMI_ACC2X2_EN_HIGHG_Y_INT__POS 1 +#define SMI_ACC2X2_EN_HIGHG_Y_INT__LEN 1 +#define SMI_ACC2X2_EN_HIGHG_Y_INT__MSK 0x02 +#define SMI_ACC2X2_EN_HIGHG_Y_INT__REG SMI_ACC2X2_INT_ENABLE2_REG + +#define SMI_ACC2X2_EN_HIGHG_Z_INT__POS 2 +#define SMI_ACC2X2_EN_HIGHG_Z_INT__LEN 1 +#define SMI_ACC2X2_EN_HIGHG_Z_INT__MSK 0x04 +#define SMI_ACC2X2_EN_HIGHG_Z_INT__REG SMI_ACC2X2_INT_ENABLE2_REG + +#define SMI_ACC2X2_EN_LOWG_INT__POS 3 +#define SMI_ACC2X2_EN_LOWG_INT__LEN 1 +#define SMI_ACC2X2_EN_LOWG_INT__MSK 0x08 +#define SMI_ACC2X2_EN_LOWG_INT__REG SMI_ACC2X2_INT_ENABLE2_REG + +#define SMI_ACC2X2_EN_NEW_DATA_INT__POS 4 +#define SMI_ACC2X2_EN_NEW_DATA_INT__LEN 1 +#define SMI_ACC2X2_EN_NEW_DATA_INT__MSK 0x10 +#define SMI_ACC2X2_EN_NEW_DATA_INT__REG SMI_ACC2X2_INT_ENABLE2_REG + +#define SMI_ACC2X2_INT_FFULL_EN_INT__POS 5 +#define SMI_ACC2X2_INT_FFULL_EN_INT__LEN 1 +#define SMI_ACC2X2_INT_FFULL_EN_INT__MSK 0x20 +#define SMI_ACC2X2_INT_FFULL_EN_INT__REG SMI_ACC2X2_INT_ENABLE2_REG + +#define SMI_ACC2X2_INT_FWM_EN_INT__POS 6 +#define SMI_ACC2X2_INT_FWM_EN_INT__LEN 1 +#define SMI_ACC2X2_INT_FWM_EN_INT__MSK 0x40 +#define SMI_ACC2X2_INT_FWM_EN_INT__REG SMI_ACC2X2_INT_ENABLE2_REG + +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_X_INT__POS 0 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_X_INT__LEN 1 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_X_INT__MSK 0x01 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_X_INT__REG SMI_ACC2X2_INT_SLO_NO_MOT_REG + +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Y_INT__POS 1 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Y_INT__LEN 1 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Y_INT__MSK 0x02 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Y_INT__REG SMI_ACC2X2_INT_SLO_NO_MOT_REG + +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Z_INT__POS 2 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Z_INT__LEN 1 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Z_INT__MSK 0x04 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_Z_INT__REG SMI_ACC2X2_INT_SLO_NO_MOT_REG + +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_SEL_INT__POS 3 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_SEL_INT__LEN 1 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_SEL_INT__MSK 0x08 +#define SMI_ACC2X2_INT_SLO_NO_MOT_EN_SEL_INT__REG SMI_ACC2X2_INT_SLO_NO_MOT_REG + +#define SMI_ACC2X2_EN_INT1_PAD_LOWG__POS 0 +#define SMI_ACC2X2_EN_INT1_PAD_LOWG__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_LOWG__MSK 0x01 +#define SMI_ACC2X2_EN_INT1_PAD_LOWG__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_HIGHG__POS 1 +#define SMI_ACC2X2_EN_INT1_PAD_HIGHG__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_HIGHG__MSK 0x02 +#define SMI_ACC2X2_EN_INT1_PAD_HIGHG__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_SLOPE__POS 2 +#define SMI_ACC2X2_EN_INT1_PAD_SLOPE__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_SLOPE__MSK 0x04 +#define SMI_ACC2X2_EN_INT1_PAD_SLOPE__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_SLO_NO_MOT__POS 3 +#define SMI_ACC2X2_EN_INT1_PAD_SLO_NO_MOT__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_SLO_NO_MOT__MSK 0x08 +#define SMI_ACC2X2_EN_INT1_PAD_SLO_NO_MOT__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_DB_TAP__POS 4 +#define SMI_ACC2X2_EN_INT1_PAD_DB_TAP__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_DB_TAP__MSK 0x10 +#define SMI_ACC2X2_EN_INT1_PAD_DB_TAP__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_SNG_TAP__POS 5 +#define SMI_ACC2X2_EN_INT1_PAD_SNG_TAP__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_SNG_TAP__MSK 0x20 +#define SMI_ACC2X2_EN_INT1_PAD_SNG_TAP__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_ORIENT__POS 6 +#define SMI_ACC2X2_EN_INT1_PAD_ORIENT__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_ORIENT__MSK 0x40 +#define SMI_ACC2X2_EN_INT1_PAD_ORIENT__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_FLAT__POS 7 +#define SMI_ACC2X2_EN_INT1_PAD_FLAT__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_FLAT__MSK 0x80 +#define SMI_ACC2X2_EN_INT1_PAD_FLAT__REG SMI_ACC2X2_INT1_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_LOWG__POS 0 +#define SMI_ACC2X2_EN_INT2_PAD_LOWG__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_LOWG__MSK 0x01 +#define SMI_ACC2X2_EN_INT2_PAD_LOWG__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_HIGHG__POS 1 +#define SMI_ACC2X2_EN_INT2_PAD_HIGHG__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_HIGHG__MSK 0x02 +#define SMI_ACC2X2_EN_INT2_PAD_HIGHG__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_SLOPE__POS 2 +#define SMI_ACC2X2_EN_INT2_PAD_SLOPE__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_SLOPE__MSK 0x04 +#define SMI_ACC2X2_EN_INT2_PAD_SLOPE__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_SLO_NO_MOT__POS 3 +#define SMI_ACC2X2_EN_INT2_PAD_SLO_NO_MOT__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_SLO_NO_MOT__MSK 0x08 +#define SMI_ACC2X2_EN_INT2_PAD_SLO_NO_MOT__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_DB_TAP__POS 4 +#define SMI_ACC2X2_EN_INT2_PAD_DB_TAP__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_DB_TAP__MSK 0x10 +#define SMI_ACC2X2_EN_INT2_PAD_DB_TAP__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_SNG_TAP__POS 5 +#define SMI_ACC2X2_EN_INT2_PAD_SNG_TAP__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_SNG_TAP__MSK 0x20 +#define SMI_ACC2X2_EN_INT2_PAD_SNG_TAP__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_ORIENT__POS 6 +#define SMI_ACC2X2_EN_INT2_PAD_ORIENT__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_ORIENT__MSK 0x40 +#define SMI_ACC2X2_EN_INT2_PAD_ORIENT__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_FLAT__POS 7 +#define SMI_ACC2X2_EN_INT2_PAD_FLAT__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_FLAT__MSK 0x80 +#define SMI_ACC2X2_EN_INT2_PAD_FLAT__REG SMI_ACC2X2_INT2_PAD_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_NEWDATA__POS 0 +#define SMI_ACC2X2_EN_INT1_PAD_NEWDATA__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_NEWDATA__MSK 0x01 +#define SMI_ACC2X2_EN_INT1_PAD_NEWDATA__REG SMI_ACC2X2_INT_DATA_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_FWM__POS 1 +#define SMI_ACC2X2_EN_INT1_PAD_FWM__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_FWM__MSK 0x02 +#define SMI_ACC2X2_EN_INT1_PAD_FWM__REG SMI_ACC2X2_INT_DATA_SEL_REG + +#define SMI_ACC2X2_EN_INT1_PAD_FFULL__POS 2 +#define SMI_ACC2X2_EN_INT1_PAD_FFULL__LEN 1 +#define SMI_ACC2X2_EN_INT1_PAD_FFULL__MSK 0x04 +#define SMI_ACC2X2_EN_INT1_PAD_FFULL__REG SMI_ACC2X2_INT_DATA_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_FFULL__POS 5 +#define SMI_ACC2X2_EN_INT2_PAD_FFULL__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_FFULL__MSK 0x20 +#define SMI_ACC2X2_EN_INT2_PAD_FFULL__REG SMI_ACC2X2_INT_DATA_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_FWM__POS 6 +#define SMI_ACC2X2_EN_INT2_PAD_FWM__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_FWM__MSK 0x40 +#define SMI_ACC2X2_EN_INT2_PAD_FWM__REG SMI_ACC2X2_INT_DATA_SEL_REG + +#define SMI_ACC2X2_EN_INT2_PAD_NEWDATA__POS 7 +#define SMI_ACC2X2_EN_INT2_PAD_NEWDATA__LEN 1 +#define SMI_ACC2X2_EN_INT2_PAD_NEWDATA__MSK 0x80 +#define SMI_ACC2X2_EN_INT2_PAD_NEWDATA__REG SMI_ACC2X2_INT_DATA_SEL_REG + +#define SMI_ACC2X2_UNFILT_INT_SRC_LOWG__POS 0 +#define SMI_ACC2X2_UNFILT_INT_SRC_LOWG__LEN 1 +#define SMI_ACC2X2_UNFILT_INT_SRC_LOWG__MSK 0x01 +#define SMI_ACC2X2_UNFILT_INT_SRC_LOWG__REG SMI_ACC2X2_INT_SRC_REG + +#define SMI_ACC2X2_UNFILT_INT_SRC_HIGHG__POS 1 +#define SMI_ACC2X2_UNFILT_INT_SRC_HIGHG__LEN 1 +#define SMI_ACC2X2_UNFILT_INT_SRC_HIGHG__MSK 0x02 +#define SMI_ACC2X2_UNFILT_INT_SRC_HIGHG__REG SMI_ACC2X2_INT_SRC_REG + +#define SMI_ACC2X2_UNFILT_INT_SRC_SLOPE__POS 2 +#define SMI_ACC2X2_UNFILT_INT_SRC_SLOPE__LEN 1 +#define SMI_ACC2X2_UNFILT_INT_SRC_SLOPE__MSK 0x04 +#define SMI_ACC2X2_UNFILT_INT_SRC_SLOPE__REG SMI_ACC2X2_INT_SRC_REG + +#define SMI_ACC2X2_UNFILT_INT_SRC_SLO_NO_MOT__POS 3 +#define SMI_ACC2X2_UNFILT_INT_SRC_SLO_NO_MOT__LEN 1 +#define SMI_ACC2X2_UNFILT_INT_SRC_SLO_NO_MOT__MSK 0x08 +#define SMI_ACC2X2_UNFILT_INT_SRC_SLO_NO_MOT__REG SMI_ACC2X2_INT_SRC_REG + +#define SMI_ACC2X2_UNFILT_INT_SRC_TAP__POS 4 +#define SMI_ACC2X2_UNFILT_INT_SRC_TAP__LEN 1 +#define SMI_ACC2X2_UNFILT_INT_SRC_TAP__MSK 0x10 +#define SMI_ACC2X2_UNFILT_INT_SRC_TAP__REG SMI_ACC2X2_INT_SRC_REG + +#define SMI_ACC2X2_UNFILT_INT_SRC_DATA__POS 5 +#define SMI_ACC2X2_UNFILT_INT_SRC_DATA__LEN 1 +#define SMI_ACC2X2_UNFILT_INT_SRC_DATA__MSK 0x20 +#define SMI_ACC2X2_UNFILT_INT_SRC_DATA__REG SMI_ACC2X2_INT_SRC_REG + +#define SMI_ACC2X2_INT1_PAD_ACTIVE_LEVEL__POS 0 +#define SMI_ACC2X2_INT1_PAD_ACTIVE_LEVEL__LEN 1 +#define SMI_ACC2X2_INT1_PAD_ACTIVE_LEVEL__MSK 0x01 +#define SMI_ACC2X2_INT1_PAD_ACTIVE_LEVEL__REG SMI_ACC2X2_INT_SET_REG + +#define SMI_ACC2X2_INT2_PAD_ACTIVE_LEVEL__POS 2 +#define SMI_ACC2X2_INT2_PAD_ACTIVE_LEVEL__LEN 1 +#define SMI_ACC2X2_INT2_PAD_ACTIVE_LEVEL__MSK 0x04 +#define SMI_ACC2X2_INT2_PAD_ACTIVE_LEVEL__REG SMI_ACC2X2_INT_SET_REG + +#define SMI_ACC2X2_INT1_PAD_OUTPUT_TYPE__POS 1 +#define SMI_ACC2X2_INT1_PAD_OUTPUT_TYPE__LEN 1 +#define SMI_ACC2X2_INT1_PAD_OUTPUT_TYPE__MSK 0x02 +#define SMI_ACC2X2_INT1_PAD_OUTPUT_TYPE__REG SMI_ACC2X2_INT_SET_REG + +#define SMI_ACC2X2_INT2_PAD_OUTPUT_TYPE__POS 3 +#define SMI_ACC2X2_INT2_PAD_OUTPUT_TYPE__LEN 1 +#define SMI_ACC2X2_INT2_PAD_OUTPUT_TYPE__MSK 0x08 +#define SMI_ACC2X2_INT2_PAD_OUTPUT_TYPE__REG SMI_ACC2X2_INT_SET_REG + +#define SMI_ACC2X2_INT_MODE_SEL__POS 0 +#define SMI_ACC2X2_INT_MODE_SEL__LEN 4 +#define SMI_ACC2X2_INT_MODE_SEL__MSK 0x0F +#define SMI_ACC2X2_INT_MODE_SEL__REG SMI_ACC2X2_INT_CTRL_REG + +#define SMI_ACC2X2_RESET_INT__POS 7 +#define SMI_ACC2X2_RESET_INT__LEN 1 +#define SMI_ACC2X2_RESET_INT__MSK 0x80 +#define SMI_ACC2X2_RESET_INT__REG SMI_ACC2X2_INT_CTRL_REG + +#define SMI_ACC2X2_LOWG_DUR__POS 0 +#define SMI_ACC2X2_LOWG_DUR__LEN 8 +#define SMI_ACC2X2_LOWG_DUR__MSK 0xFF +#define SMI_ACC2X2_LOWG_DUR__REG SMI_ACC2X2_LOW_DURN_REG + +#define SMI_ACC2X2_LOWG_THRES__POS 0 +#define SMI_ACC2X2_LOWG_THRES__LEN 8 +#define SMI_ACC2X2_LOWG_THRES__MSK 0xFF +#define SMI_ACC2X2_LOWG_THRES__REG SMI_ACC2X2_LOW_THRES_REG + +#define SMI_ACC2X2_LOWG_HYST__POS 0 +#define SMI_ACC2X2_LOWG_HYST__LEN 2 +#define SMI_ACC2X2_LOWG_HYST__MSK 0x03 +#define SMI_ACC2X2_LOWG_HYST__REG SMI_ACC2X2_LOW_HIGH_HYST_REG + +#define SMI_ACC2X2_LOWG_INT_MODE__POS 2 +#define SMI_ACC2X2_LOWG_INT_MODE__LEN 1 +#define SMI_ACC2X2_LOWG_INT_MODE__MSK 0x04 +#define SMI_ACC2X2_LOWG_INT_MODE__REG SMI_ACC2X2_LOW_HIGH_HYST_REG + +#define SMI_ACC2X2_HIGHG_DUR__POS 0 +#define SMI_ACC2X2_HIGHG_DUR__LEN 8 +#define SMI_ACC2X2_HIGHG_DUR__MSK 0xFF +#define SMI_ACC2X2_HIGHG_DUR__REG SMI_ACC2X2_HIGH_DURN_REG + +#define SMI_ACC2X2_HIGHG_THRES__POS 0 +#define SMI_ACC2X2_HIGHG_THRES__LEN 8 +#define SMI_ACC2X2_HIGHG_THRES__MSK 0xFF +#define SMI_ACC2X2_HIGHG_THRES__REG SMI_ACC2X2_HIGH_THRES_REG + +#define SMI_ACC2X2_HIGHG_HYST__POS 6 +#define SMI_ACC2X2_HIGHG_HYST__LEN 2 +#define SMI_ACC2X2_HIGHG_HYST__MSK 0xC0 +#define SMI_ACC2X2_HIGHG_HYST__REG SMI_ACC2X2_LOW_HIGH_HYST_REG + +#define SMI_ACC2X2_SLOPE_DUR__POS 0 +#define SMI_ACC2X2_SLOPE_DUR__LEN 2 +#define SMI_ACC2X2_SLOPE_DUR__MSK 0x03 +#define SMI_ACC2X2_SLOPE_DUR__REG SMI_ACC2X2_SLOPE_DURN_REG + +#define SMI_ACC2X2_SLO_NO_MOT_DUR__POS 2 +#define SMI_ACC2X2_SLO_NO_MOT_DUR__LEN 6 +#define SMI_ACC2X2_SLO_NO_MOT_DUR__MSK 0xFC +#define SMI_ACC2X2_SLO_NO_MOT_DUR__REG SMI_ACC2X2_SLOPE_DURN_REG + +#define SMI_ACC2X2_SLOPE_THRES__POS 0 +#define SMI_ACC2X2_SLOPE_THRES__LEN 8 +#define SMI_ACC2X2_SLOPE_THRES__MSK 0xFF +#define SMI_ACC2X2_SLOPE_THRES__REG SMI_ACC2X2_SLOPE_THRES_REG + +#define SMI_ACC2X2_SLO_NO_MOT_THRES__POS 0 +#define SMI_ACC2X2_SLO_NO_MOT_THRES__LEN 8 +#define SMI_ACC2X2_SLO_NO_MOT_THRES__MSK 0xFF +#define SMI_ACC2X2_SLO_NO_MOT_THRES__REG SMI_ACC2X2_SLO_NO_MOT_THRES_REG + +#define SMI_ACC2X2_TAP_DUR__POS 0 +#define SMI_ACC2X2_TAP_DUR__LEN 3 +#define SMI_ACC2X2_TAP_DUR__MSK 0x07 +#define SMI_ACC2X2_TAP_DUR__REG SMI_ACC2X2_TAP_PARAM_REG + +#define SMI_ACC2X2_TAP_SHOCK_DURN__POS 6 +#define SMI_ACC2X2_TAP_SHOCK_DURN__LEN 1 +#define SMI_ACC2X2_TAP_SHOCK_DURN__MSK 0x40 +#define SMI_ACC2X2_TAP_SHOCK_DURN__REG SMI_ACC2X2_TAP_PARAM_REG + +#define SMI_ACC2X2_ADV_TAP_INT__POS 5 +#define SMI_ACC2X2_ADV_TAP_INT__LEN 1 +#define SMI_ACC2X2_ADV_TAP_INT__MSK 0x20 +#define SMI_ACC2X2_ADV_TAP_INT__REG SMI_ACC2X2_TAP_PARAM_REG + +#define SMI_ACC2X2_TAP_QUIET_DURN__POS 7 +#define SMI_ACC2X2_TAP_QUIET_DURN__LEN 1 +#define SMI_ACC2X2_TAP_QUIET_DURN__MSK 0x80 +#define SMI_ACC2X2_TAP_QUIET_DURN__REG SMI_ACC2X2_TAP_PARAM_REG + +#define SMI_ACC2X2_TAP_THRES__POS 0 +#define SMI_ACC2X2_TAP_THRES__LEN 5 +#define SMI_ACC2X2_TAP_THRES__MSK 0x1F +#define SMI_ACC2X2_TAP_THRES__REG SMI_ACC2X2_TAP_THRES_REG + +#define SMI_ACC2X2_TAP_SAMPLES__POS 6 +#define SMI_ACC2X2_TAP_SAMPLES__LEN 2 +#define SMI_ACC2X2_TAP_SAMPLES__MSK 0xC0 +#define SMI_ACC2X2_TAP_SAMPLES__REG SMI_ACC2X2_TAP_THRES_REG + +#define SMI_ACC2X2_ORIENT_MODE__POS 0 +#define SMI_ACC2X2_ORIENT_MODE__LEN 2 +#define SMI_ACC2X2_ORIENT_MODE__MSK 0x03 +#define SMI_ACC2X2_ORIENT_MODE__REG SMI_ACC2X2_ORIENT_PARAM_REG + +#define SMI_ACC2X2_ORIENT_BLOCK__POS 2 +#define SMI_ACC2X2_ORIENT_BLOCK__LEN 2 +#define SMI_ACC2X2_ORIENT_BLOCK__MSK 0x0C +#define SMI_ACC2X2_ORIENT_BLOCK__REG SMI_ACC2X2_ORIENT_PARAM_REG + +#define SMI_ACC2X2_ORIENT_HYST__POS 4 +#define SMI_ACC2X2_ORIENT_HYST__LEN 3 +#define SMI_ACC2X2_ORIENT_HYST__MSK 0x70 +#define SMI_ACC2X2_ORIENT_HYST__REG SMI_ACC2X2_ORIENT_PARAM_REG + +#define SMI_ACC2X2_ORIENT_AXIS__POS 7 +#define SMI_ACC2X2_ORIENT_AXIS__LEN 1 +#define SMI_ACC2X2_ORIENT_AXIS__MSK 0x80 +#define SMI_ACC2X2_ORIENT_AXIS__REG SMI_ACC2X2_THETA_BLOCK_REG + +#define SMI_ACC2X2_ORIENT_UD_EN__POS 6 +#define SMI_ACC2X2_ORIENT_UD_EN__LEN 1 +#define SMI_ACC2X2_ORIENT_UD_EN__MSK 0x40 +#define SMI_ACC2X2_ORIENT_UD_EN__REG SMI_ACC2X2_THETA_BLOCK_REG + +#define SMI_ACC2X2_THETA_BLOCK__POS 0 +#define SMI_ACC2X2_THETA_BLOCK__LEN 6 +#define SMI_ACC2X2_THETA_BLOCK__MSK 0x3F +#define SMI_ACC2X2_THETA_BLOCK__REG SMI_ACC2X2_THETA_BLOCK_REG + +#define SMI_ACC2X2_THETA_FLAT__POS 0 +#define SMI_ACC2X2_THETA_FLAT__LEN 6 +#define SMI_ACC2X2_THETA_FLAT__MSK 0x3F +#define SMI_ACC2X2_THETA_FLAT__REG SMI_ACC2X2_THETA_FLAT_REG + +#define SMI_ACC2X2_FLAT_HOLD_TIME__POS 4 +#define SMI_ACC2X2_FLAT_HOLD_TIME__LEN 2 +#define SMI_ACC2X2_FLAT_HOLD_TIME__MSK 0x30 +#define SMI_ACC2X2_FLAT_HOLD_TIME__REG SMI_ACC2X2_FLAT_HOLD_TIME_REG + +#define SMI_ACC2X2_FLAT_HYS__POS 0 +#define SMI_ACC2X2_FLAT_HYS__LEN 3 +#define SMI_ACC2X2_FLAT_HYS__MSK 0x07 +#define SMI_ACC2X2_FLAT_HYS__REG SMI_ACC2X2_FLAT_HOLD_TIME_REG + +#define SMI_ACC2X2_FIFO_WML_TRIG_RETAIN__POS 0 +#define SMI_ACC2X2_FIFO_WML_TRIG_RETAIN__LEN 6 +#define SMI_ACC2X2_FIFO_WML_TRIG_RETAIN__MSK 0x3F +#define SMI_ACC2X2_FIFO_WML_TRIG_RETAIN__REG SMI_ACC2X2_FIFO_WML_TRIG + +#define SMI_ACC2X2_EN_SELF_TEST__POS 0 +#define SMI_ACC2X2_EN_SELF_TEST__LEN 2 +#define SMI_ACC2X2_EN_SELF_TEST__MSK 0x03 +#define SMI_ACC2X2_EN_SELF_TEST__REG SMI_ACC2X2_SELF_TEST_REG + +#define SMI_ACC2X2_NEG_SELF_TEST__POS 2 +#define SMI_ACC2X2_NEG_SELF_TEST__LEN 1 +#define SMI_ACC2X2_NEG_SELF_TEST__MSK 0x04 +#define SMI_ACC2X2_NEG_SELF_TEST__REG SMI_ACC2X2_SELF_TEST_REG + +#define SMI_ACC2X2_SELF_TEST_AMP__POS 4 +#define SMI_ACC2X2_SELF_TEST_AMP__LEN 1 +#define SMI_ACC2X2_SELF_TEST_AMP__MSK 0x10 +#define SMI_ACC2X2_SELF_TEST_AMP__REG SMI_ACC2X2_SELF_TEST_REG + + +#define SMI_ACC2X2_UNLOCK_EE_PROG_MODE__POS 0 +#define SMI_ACC2X2_UNLOCK_EE_PROG_MODE__LEN 1 +#define SMI_ACC2X2_UNLOCK_EE_PROG_MODE__MSK 0x01 +#define SMI_ACC2X2_UNLOCK_EE_PROG_MODE__REG SMI_ACC2X2_EEPROM_CTRL_REG + +#define SMI_ACC2X2_START_EE_PROG_TRIG__POS 1 +#define SMI_ACC2X2_START_EE_PROG_TRIG__LEN 1 +#define SMI_ACC2X2_START_EE_PROG_TRIG__MSK 0x02 +#define SMI_ACC2X2_START_EE_PROG_TRIG__REG SMI_ACC2X2_EEPROM_CTRL_REG + +#define SMI_ACC2X2_EE_PROG_READY__POS 2 +#define SMI_ACC2X2_EE_PROG_READY__LEN 1 +#define SMI_ACC2X2_EE_PROG_READY__MSK 0x04 +#define SMI_ACC2X2_EE_PROG_READY__REG SMI_ACC2X2_EEPROM_CTRL_REG + +#define SMI_ACC2X2_UPDATE_IMAGE__POS 3 +#define SMI_ACC2X2_UPDATE_IMAGE__LEN 1 +#define SMI_ACC2X2_UPDATE_IMAGE__MSK 0x08 +#define SMI_ACC2X2_UPDATE_IMAGE__REG SMI_ACC2X2_EEPROM_CTRL_REG + +#define SMI_ACC2X2_EE_REMAIN__POS 4 +#define SMI_ACC2X2_EE_REMAIN__LEN 4 +#define SMI_ACC2X2_EE_REMAIN__MSK 0xF0 +#define SMI_ACC2X2_EE_REMAIN__REG SMI_ACC2X2_EEPROM_CTRL_REG + +#define SMI_ACC2X2_EN_SPI_MODE_3__POS 0 +#define SMI_ACC2X2_EN_SPI_MODE_3__LEN 1 +#define SMI_ACC2X2_EN_SPI_MODE_3__MSK 0x01 +#define SMI_ACC2X2_EN_SPI_MODE_3__REG SMI_ACC2X2_SERIAL_CTRL_REG + +#define SMI_ACC2X2_I2C_WATCHDOG_PERIOD__POS 1 +#define SMI_ACC2X2_I2C_WATCHDOG_PERIOD__LEN 1 +#define SMI_ACC2X2_I2C_WATCHDOG_PERIOD__MSK 0x02 +#define SMI_ACC2X2_I2C_WATCHDOG_PERIOD__REG SMI_ACC2X2_SERIAL_CTRL_REG + +#define SMI_ACC2X2_EN_I2C_WATCHDOG__POS 2 +#define SMI_ACC2X2_EN_I2C_WATCHDOG__LEN 1 +#define SMI_ACC2X2_EN_I2C_WATCHDOG__MSK 0x04 +#define SMI_ACC2X2_EN_I2C_WATCHDOG__REG SMI_ACC2X2_SERIAL_CTRL_REG + +#define SMI_ACC2X2_EXT_MODE__POS 7 +#define SMI_ACC2X2_EXT_MODE__LEN 1 +#define SMI_ACC2X2_EXT_MODE__MSK 0x80 +#define SMI_ACC2X2_EXT_MODE__REG SMI_ACC2X2_EXTMODE_CTRL_REG + +#define SMI_ACC2X2_ALLOW_UPPER__POS 6 +#define SMI_ACC2X2_ALLOW_UPPER__LEN 1 +#define SMI_ACC2X2_ALLOW_UPPER__MSK 0x40 +#define SMI_ACC2X2_ALLOW_UPPER__REG SMI_ACC2X2_EXTMODE_CTRL_REG + +#define SMI_ACC2X2_MAP_2_LOWER__POS 5 +#define SMI_ACC2X2_MAP_2_LOWER__LEN 1 +#define SMI_ACC2X2_MAP_2_LOWER__MSK 0x20 +#define SMI_ACC2X2_MAP_2_LOWER__REG SMI_ACC2X2_EXTMODE_CTRL_REG + +#define SMI_ACC2X2_MAGIC_NUMBER__POS 0 +#define SMI_ACC2X2_MAGIC_NUMBER__LEN 5 +#define SMI_ACC2X2_MAGIC_NUMBER__MSK 0x1F +#define SMI_ACC2X2_MAGIC_NUMBER__REG SMI_ACC2X2_EXTMODE_CTRL_REG + +#define SMI_ACC2X2_UNLOCK_EE_WRITE_TRIM__POS 4 +#define SMI_ACC2X2_UNLOCK_EE_WRITE_TRIM__LEN 4 +#define SMI_ACC2X2_UNLOCK_EE_WRITE_TRIM__MSK 0xF0 +#define SMI_ACC2X2_UNLOCK_EE_WRITE_TRIM__REG SMI_ACC2X2_CTRL_UNLOCK_REG + +#define SMI_ACC2X2_EN_SLOW_COMP_X__POS 0 +#define SMI_ACC2X2_EN_SLOW_COMP_X__LEN 1 +#define SMI_ACC2X2_EN_SLOW_COMP_X__MSK 0x01 +#define SMI_ACC2X2_EN_SLOW_COMP_X__REG SMI_ACC2X2_OFFSET_CTRL_REG + +#define SMI_ACC2X2_EN_SLOW_COMP_Y__POS 1 +#define SMI_ACC2X2_EN_SLOW_COMP_Y__LEN 1 +#define SMI_ACC2X2_EN_SLOW_COMP_Y__MSK 0x02 +#define SMI_ACC2X2_EN_SLOW_COMP_Y__REG SMI_ACC2X2_OFFSET_CTRL_REG + +#define SMI_ACC2X2_EN_SLOW_COMP_Z__POS 2 +#define SMI_ACC2X2_EN_SLOW_COMP_Z__LEN 1 +#define SMI_ACC2X2_EN_SLOW_COMP_Z__MSK 0x04 +#define SMI_ACC2X2_EN_SLOW_COMP_Z__REG SMI_ACC2X2_OFFSET_CTRL_REG + +#define SMI_ACC2X2_FAST_CAL_RDY_S__POS 4 +#define SMI_ACC2X2_FAST_CAL_RDY_S__LEN 1 +#define SMI_ACC2X2_FAST_CAL_RDY_S__MSK 0x10 +#define SMI_ACC2X2_FAST_CAL_RDY_S__REG SMI_ACC2X2_OFFSET_CTRL_REG + +#define SMI_ACC2X2_CAL_TRIGGER__POS 5 +#define SMI_ACC2X2_CAL_TRIGGER__LEN 2 +#define SMI_ACC2X2_CAL_TRIGGER__MSK 0x60 +#define SMI_ACC2X2_CAL_TRIGGER__REG SMI_ACC2X2_OFFSET_CTRL_REG + +#define SMI_ACC2X2_RESET_OFFSET_REGS__POS 7 +#define SMI_ACC2X2_RESET_OFFSET_REGS__LEN 1 +#define SMI_ACC2X2_RESET_OFFSET_REGS__MSK 0x80 +#define SMI_ACC2X2_RESET_OFFSET_REGS__REG SMI_ACC2X2_OFFSET_CTRL_REG + +#define SMI_ACC2X2_COMP_CUTOFF__POS 0 +#define SMI_ACC2X2_COMP_CUTOFF__LEN 1 +#define SMI_ACC2X2_COMP_CUTOFF__MSK 0x01 +#define SMI_ACC2X2_COMP_CUTOFF__REG SMI_ACC2X2_OFFSET_PARAMS_REG + +#define SMI_ACC2X2_COMP_TARGET_OFFSET_X__POS 1 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_X__LEN 2 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_X__MSK 0x06 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_X__REG SMI_ACC2X2_OFFSET_PARAMS_REG + +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Y__POS 3 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Y__LEN 2 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Y__MSK 0x18 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Y__REG SMI_ACC2X2_OFFSET_PARAMS_REG + +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Z__POS 5 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Z__LEN 2 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Z__MSK 0x60 +#define SMI_ACC2X2_COMP_TARGET_OFFSET_Z__REG SMI_ACC2X2_OFFSET_PARAMS_REG + +#define SMI_ACC2X2_FIFO_DATA_SELECT__POS 0 +#define SMI_ACC2X2_FIFO_DATA_SELECT__LEN 2 +#define SMI_ACC2X2_FIFO_DATA_SELECT__MSK 0x03 +#define SMI_ACC2X2_FIFO_DATA_SELECT__REG SMI_ACC2X2_FIFO_MODE_REG + +#define SMI_ACC2X2_FIFO_TRIGGER_SOURCE__POS 2 +#define SMI_ACC2X2_FIFO_TRIGGER_SOURCE__LEN 2 +#define SMI_ACC2X2_FIFO_TRIGGER_SOURCE__MSK 0x0C +#define SMI_ACC2X2_FIFO_TRIGGER_SOURCE__REG SMI_ACC2X2_FIFO_MODE_REG + +#define SMI_ACC2X2_FIFO_TRIGGER_ACTION__POS 4 +#define SMI_ACC2X2_FIFO_TRIGGER_ACTION__LEN 2 +#define SMI_ACC2X2_FIFO_TRIGGER_ACTION__MSK 0x30 +#define SMI_ACC2X2_FIFO_TRIGGER_ACTION__REG SMI_ACC2X2_FIFO_MODE_REG + +#define SMI_ACC2X2_FIFO_MODE__POS 6 +#define SMI_ACC2X2_FIFO_MODE__LEN 2 +#define SMI_ACC2X2_FIFO_MODE__MSK 0xC0 +#define SMI_ACC2X2_FIFO_MODE__REG SMI_ACC2X2_FIFO_MODE_REG + + +#define SMI_ACC2X2_STATUS1 0 +#define SMI_ACC2X2_STATUS2 1 +#define SMI_ACC2X2_STATUS3 2 +#define SMI_ACC2X2_STATUS4 3 +#define SMI_ACC2X2_STATUS5 4 + + +#define SMI_ACC2X2_RANGE_2G 3 +#define SMI_ACC2X2_RANGE_4G 5 +#define SMI_ACC2X2_RANGE_8G 8 +#define SMI_ACC2X2_RANGE_16G 12 + + +#define SMI_ACC2X2_BW_7_81HZ 0x08 +#define SMI_ACC2X2_BW_15_63HZ 0x09 +#define SMI_ACC2X2_BW_31_25HZ 0x0A +#define SMI_ACC2X2_BW_62_50HZ 0x0B +#define SMI_ACC2X2_BW_125HZ 0x0C +#define SMI_ACC2X2_BW_250HZ 0x0D +#define SMI_ACC2X2_BW_500HZ 0x0E +#define SMI_ACC2X2_BW_1000HZ 0x0F + +#define SMI_ACC2X2_SLEEP_DUR_0_5MS 0x05 +#define SMI_ACC2X2_SLEEP_DUR_1MS 0x06 +#define SMI_ACC2X2_SLEEP_DUR_2MS 0x07 +#define SMI_ACC2X2_SLEEP_DUR_4MS 0x08 +#define SMI_ACC2X2_SLEEP_DUR_6MS 0x09 +#define SMI_ACC2X2_SLEEP_DUR_10MS 0x0A +#define SMI_ACC2X2_SLEEP_DUR_25MS 0x0B +#define SMI_ACC2X2_SLEEP_DUR_50MS 0x0C +#define SMI_ACC2X2_SLEEP_DUR_100MS 0x0D +#define SMI_ACC2X2_SLEEP_DUR_500MS 0x0E +#define SMI_ACC2X2_SLEEP_DUR_1S 0x0F + +#define SMI_ACC2X2_LATCH_DUR_NON_LATCH 0x00 +#define SMI_ACC2X2_LATCH_DUR_250MS 0x01 +#define SMI_ACC2X2_LATCH_DUR_500MS 0x02 +#define SMI_ACC2X2_LATCH_DUR_1S 0x03 +#define SMI_ACC2X2_LATCH_DUR_2S 0x04 +#define SMI_ACC2X2_LATCH_DUR_4S 0x05 +#define SMI_ACC2X2_LATCH_DUR_8S 0x06 +#define SMI_ACC2X2_LATCH_DUR_LATCH 0x07 +#define SMI_ACC2X2_LATCH_DUR_NON_LATCH1 0x08 +#define SMI_ACC2X2_LATCH_DUR_250US 0x09 +#define SMI_ACC2X2_LATCH_DUR_500US 0x0A +#define SMI_ACC2X2_LATCH_DUR_1MS 0x0B +#define SMI_ACC2X2_LATCH_DUR_12_5MS 0x0C +#define SMI_ACC2X2_LATCH_DUR_25MS 0x0D +#define SMI_ACC2X2_LATCH_DUR_50MS 0x0E +#define SMI_ACC2X2_LATCH_DUR_LATCH1 0x0F + +#define SMI_ACC2X2_MODE_NORMAL 0 +#define SMI_ACC2X2_MODE_LOWPOWER1 1 +#define SMI_ACC2X2_MODE_SUSPEND 2 +#define SMI_ACC2X2_MODE_DEEP_SUSPEND 3 +#define SMI_ACC2X2_MODE_LOWPOWER2 4 +#define SMI_ACC2X2_MODE_STANDBY 5 + +#define SMI_ACC2X2_X_AXIS 0 +#define SMI_ACC2X2_Y_AXIS 1 +#define SMI_ACC2X2_Z_AXIS 2 + +#define SMI_ACC2X2_Low_G_Interrupt 0 +#define SMI_ACC2X2_High_G_X_Interrupt 1 +#define SMI_ACC2X2_High_G_Y_Interrupt 2 +#define SMI_ACC2X2_High_G_Z_Interrupt 3 +#define SMI_ACC2X2_DATA_EN 4 +#define SMI_ACC2X2_Slope_X_Interrupt 5 +#define SMI_ACC2X2_Slope_Y_Interrupt 6 +#define SMI_ACC2X2_Slope_Z_Interrupt 7 +#define SMI_ACC2X2_Single_Tap_Interrupt 8 +#define SMI_ACC2X2_Double_Tap_Interrupt 9 +#define SMI_ACC2X2_Orient_Interrupt 10 +#define SMI_ACC2X2_Flat_Interrupt 11 +#define SMI_ACC2X2_FFULL_INTERRUPT 12 +#define SMI_ACC2X2_FWM_INTERRUPT 13 + +#define SMI_ACC2X2_INT1_LOWG 0 +#define SMI_ACC2X2_INT2_LOWG 1 +#define SMI_ACC2X2_INT1_HIGHG 0 +#define SMI_ACC2X2_INT2_HIGHG 1 +#define SMI_ACC2X2_INT1_SLOPE 0 +#define SMI_ACC2X2_INT2_SLOPE 1 +#define SMI_ACC2X2_INT1_SLO_NO_MOT 0 +#define SMI_ACC2X2_INT2_SLO_NO_MOT 1 +#define SMI_ACC2X2_INT1_DTAP 0 +#define SMI_ACC2X2_INT2_DTAP 1 +#define SMI_ACC2X2_INT1_STAP 0 +#define SMI_ACC2X2_INT2_STAP 1 +#define SMI_ACC2X2_INT1_ORIENT 0 +#define SMI_ACC2X2_INT2_ORIENT 1 +#define SMI_ACC2X2_INT1_FLAT 0 +#define SMI_ACC2X2_INT2_FLAT 1 +#define SMI_ACC2X2_INT1_NDATA 0 +#define SMI_ACC2X2_INT2_NDATA 1 +#define SMI_ACC2X2_INT1_FWM 0 +#define SMI_ACC2X2_INT2_FWM 1 +#define SMI_ACC2X2_INT1_FFULL 0 +#define SMI_ACC2X2_INT2_FFULL 1 + +#define SMI_ACC2X2_SRC_LOWG 0 +#define SMI_ACC2X2_SRC_HIGHG 1 +#define SMI_ACC2X2_SRC_SLOPE 2 +#define SMI_ACC2X2_SRC_SLO_NO_MOT 3 +#define SMI_ACC2X2_SRC_TAP 4 +#define SMI_ACC2X2_SRC_DATA 5 + +#define SMI_ACC2X2_INT1_OUTPUT 0 +#define SMI_ACC2X2_INT2_OUTPUT 1 +#define SMI_ACC2X2_INT1_LEVEL 0 +#define SMI_ACC2X2_INT2_LEVEL 1 + +#define SMI_ACC2X2_LOW_DURATION 0 +#define SMI_ACC2X2_HIGH_DURATION 1 +#define SMI_ACC2X2_SLOPE_DURATION 2 +#define SMI_ACC2X2_SLO_NO_MOT_DURATION 3 + +#define SMI_ACC2X2_LOW_THRESHOLD 0 +#define SMI_ACC2X2_HIGH_THRESHOLD 1 +#define SMI_ACC2X2_SLOPE_THRESHOLD 2 +#define SMI_ACC2X2_SLO_NO_MOT_THRESHOLD 3 + + +#define SMI_ACC2X2_LOWG_HYST 0 +#define SMI_ACC2X2_HIGHG_HYST 1 + +#define SMI_ACC2X2_ORIENT_THETA 0 +#define SMI_ACC2X2_FLAT_THETA 1 + +#define SMI_ACC2X2_I2C_SELECT 0 +#define SMI_ACC2X2_I2C_EN 1 + +#define SMI_ACC2X2_SLOW_COMP_X 0 +#define SMI_ACC2X2_SLOW_COMP_Y 1 +#define SMI_ACC2X2_SLOW_COMP_Z 2 + +#define SMI_ACC2X2_CUT_OFF 0 +#define SMI_ACC2X2_OFFSET_TRIGGER_X 1 +#define SMI_ACC2X2_OFFSET_TRIGGER_Y 2 +#define SMI_ACC2X2_OFFSET_TRIGGER_Z 3 + +#define SMI_ACC2X2_GP0 0 +#define SMI_ACC2X2_GP1 1 + +#define SMI_ACC2X2_SLO_NO_MOT_EN_X 0 +#define SMI_ACC2X2_SLO_NO_MOT_EN_Y 1 +#define SMI_ACC2X2_SLO_NO_MOT_EN_Z 2 +#define SMI_ACC2X2_SLO_NO_MOT_EN_SEL 3 + +#define SMI_ACC2X2_WAKE_UP_DUR_20MS 0 +#define SMI_ACC2X2_WAKE_UP_DUR_80MS 1 +#define SMI_ACC2X2_WAKE_UP_DUR_320MS 2 +#define SMI_ACC2X2_WAKE_UP_DUR_2560MS 3 + +#define SMI_ACC2X2_SELF_TEST0_ON 1 +#define SMI_ACC2X2_SELF_TEST1_ON 2 + +#define SMI_ACC2X2_EE_W_OFF 0 +#define SMI_ACC2X2_EE_W_ON 1 + +#define SMI_ACC2X2_LOW_TH_IN_G(gthres, range) ((256 * gthres) / range) + + +#define SMI_ACC2X2_HIGH_TH_IN_G(gthres, range) ((256 * gthres) / range) + + +#define SMI_ACC2X2_LOW_HY_IN_G(ghyst, range) ((32 * ghyst) / range) + + +#define SMI_ACC2X2_HIGH_HY_IN_G(ghyst, range) ((32 * ghyst) / range) + + +#define SMI_ACC2X2_SLOPE_TH_IN_G(gthres, range) ((128 * gthres) / range) + + +#define SMI_ACC2X2_GET_BITSLICE(regvar, bitname)\ + ((regvar & bitname##__MSK) >> bitname##__POS) + + +#define SMI_ACC2X2_SET_BITSLICE(regvar, bitname, val)\ + ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK)) + +#define CHECK_CHIP_ID_TIME_MAX 5 +#define SMI_ACC255_CHIP_ID 0XFA +#define SMI_ACC250E_CHIP_ID 0XF9 +#define SMI_ACC222E_CHIP_ID 0XF8 +#define SMI_ACC280_CHIP_ID 0XFB +#define SMI_ACC355_CHIP_ID 0XEA + +#define SMI_ACC255_TYPE 0 +#define SMI_ACC250E_TYPE 1 +#define SMI_ACC222E_TYPE 2 +#define SMI_ACC280_TYPE 3 + +#define MAX_FIFO_F_LEVEL 32 +#define MAX_FIFO_F_BYTES 6 +#define SMI_ACC_MAX_RETRY_I2C_XFER (100) + +#ifdef CONFIG_DOUBLE_TAP +#define DEFAULT_TAP_JUDGE_PERIOD 1000 /* default judge in 1 second */ +#endif + +/*! Bosch sensor unknown place*/ +#define BOSCH_SENSOR_PLACE_UNKNOWN (-1) +/*! Bosch sensor remapping table size P0~P7*/ +#define MAX_AXIS_REMAP_TAB_SZ 8 + +/* How was SMI_ACC enabled(set to operation mode) */ +#define SMI_ACC_ENABLED_ALL 0 +#define SMI_ACC_ENABLED_SGM 1 +#define SMI_ACC_ENABLED_DTAP 2 +#define SMI_ACC_ENABLED_INPUT 3 +#define SMI_ACC_ENABLED_BSX 4 + + +/*! + * @brief:BMI058 feature + * macro definition +*/ + +#define SMI_ACC2X2_FIFO_DAT_SEL_X 1 +#define SMI_ACC2X2_FIFO_DAT_SEL_Y 2 +#define SMI_ACC2X2_FIFO_DAT_SEL_Z 3 + +#ifdef CONFIG_SENSORS_BMI058 +#define C_BMI058_One_U8X 1 +#define C_BMI058_Two_U8X 2 +#define BMI058_OFFSET_TRIGGER_X SMI_ACC2X2_OFFSET_TRIGGER_Y +#define BMI058_OFFSET_TRIGGER_Y SMI_ACC2X2_OFFSET_TRIGGER_X + +/*! BMI058 X AXIS OFFSET REG definition*/ +#define BMI058_OFFSET_X_AXIS_REG SMI_ACC2X2_OFFSET_Y_AXIS_REG +/*! BMI058 Y AXIS OFFSET REG definition*/ +#define BMI058_OFFSET_Y_AXIS_REG SMI_ACC2X2_OFFSET_X_AXIS_REG + +#define BMI058_FIFO_DAT_SEL_X SMI_ACC2X2_FIFO_DAT_SEL_Y +#define BMI058_FIFO_DAT_SEL_Y SMI_ACC2X2_FIFO_DAT_SEL_X + +/*! SMI130_ACC common slow no motion X interrupt type definition*/ +#define SMI_ACC2X2_SLOW_NO_MOT_X_INT 12 +/*! SMI130_ACC common slow no motion Y interrupt type definition*/ +#define SMI_ACC2X2_SLOW_NO_MOT_Y_INT 13 +/*! SMI130_ACC common High G X interrupt type definition*/ +#define SMI_ACC2X2_HIGHG_X_INT 1 +/*! SMI130_ACC common High G Y interrupt type definition*/ +#define SMI_ACC2X2_HIGHG_Y_INT 2 +/*! SMI130_ACC common slope X interrupt type definition*/ +#define SMI_ACC2X2_SLOPE_X_INT 5 +/*! SMI130_ACC common slope Y interrupt type definition*/ +#define SMI_ACC2X2_SLOPE_Y_INT 6 + +/*! this structure holds some interrupt types difference +**between SMI130_ACC and BMI058. +*/ +struct interrupt_map_t { + int x; + int y; +}; +/*!*Need to use SMI130_ACC Common interrupt type definition to +* instead of Some of BMI058 reversed Interrupt type +* because of HW Register. +* The reversed Interrupt types contain: +* slow_no_mot_x_int && slow_not_mot_y_int +* highg_x_int && highg_y_int +* slope_x_int && slope_y_int +**/ +static const struct interrupt_map_t int_map[] = { + {SMI_ACC2X2_SLOW_NO_MOT_X_INT, SMI_ACC2X2_SLOW_NO_MOT_Y_INT}, + {SMI_ACC2X2_HIGHG_X_INT, SMI_ACC2X2_HIGHG_Y_INT}, + {SMI_ACC2X2_SLOPE_X_INT, SMI_ACC2X2_SLOPE_Y_INT} +}; + +/*! high g or slope interrupt type definition for BMI058*/ +/*! High G interrupt of x, y, z axis happened */ +#define HIGH_G_INTERRUPT_X HIGH_G_INTERRUPT_Y_HAPPENED +#define HIGH_G_INTERRUPT_Y HIGH_G_INTERRUPT_X_HAPPENED +#define HIGH_G_INTERRUPT_Z HIGH_G_INTERRUPT_Z_HAPPENED +/*! High G interrupt of x, y, z negative axis happened */ +#define HIGH_G_INTERRUPT_X_N HIGH_G_INTERRUPT_Y_NEGATIVE_HAPPENED +#define HIGH_G_INTERRUPT_Y_N HIGH_G_INTERRUPT_X_NEGATIVE_HAPPENED +#define HIGH_G_INTERRUPT_Z_N HIGH_G_INTERRUPT_Z_NEGATIVE_HAPPENED +/*! Slope interrupt of x, y, z axis happened */ +#define SLOPE_INTERRUPT_X SLOPE_INTERRUPT_Y_HAPPENED +#define SLOPE_INTERRUPT_Y SLOPE_INTERRUPT_X_HAPPENED +#define SLOPE_INTERRUPT_Z SLOPE_INTERRUPT_Z_HAPPENED +/*! Slope interrupt of x, y, z negative axis happened */ +#define SLOPE_INTERRUPT_X_N SLOPE_INTERRUPT_Y_NEGATIVE_HAPPENED +#define SLOPE_INTERRUPT_Y_N SLOPE_INTERRUPT_X_NEGATIVE_HAPPENED +#define SLOPE_INTERRUPT_Z_N SLOPE_INTERRUPT_Z_NEGATIVE_HAPPENED + + +#else + +/*! high g or slope interrupt type definition*/ +/*! High G interrupt of x, y, z axis happened */ +#define HIGH_G_INTERRUPT_X HIGH_G_INTERRUPT_X_HAPPENED +#define HIGH_G_INTERRUPT_Y HIGH_G_INTERRUPT_Y_HAPPENED +#define HIGH_G_INTERRUPT_Z HIGH_G_INTERRUPT_Z_HAPPENED +/*! High G interrupt of x, y, z negative axis happened */ +#define HIGH_G_INTERRUPT_X_N HIGH_G_INTERRUPT_X_NEGATIVE_HAPPENED +#define HIGH_G_INTERRUPT_Y_N HIGH_G_INTERRUPT_Y_NEGATIVE_HAPPENED +#define HIGH_G_INTERRUPT_Z_N HIGH_G_INTERRUPT_Z_NEGATIVE_HAPPENED +/*! Slope interrupt of x, y, z axis happened */ +#define SLOPE_INTERRUPT_X SLOPE_INTERRUPT_X_HAPPENED +#define SLOPE_INTERRUPT_Y SLOPE_INTERRUPT_Y_HAPPENED +#define SLOPE_INTERRUPT_Z SLOPE_INTERRUPT_Z_HAPPENED +/*! Slope interrupt of x, y, z negative axis happened */ +#define SLOPE_INTERRUPT_X_N SLOPE_INTERRUPT_X_NEGATIVE_HAPPENED +#define SLOPE_INTERRUPT_Y_N SLOPE_INTERRUPT_Y_NEGATIVE_HAPPENED +#define SLOPE_INTERRUPT_Z_N SLOPE_INTERRUPT_Z_NEGATIVE_HAPPENED + + +#endif/*End of CONFIG_SENSORS_BMI058*/ + +/*! A workaroud mask definition with complete resolution exists +* aim at writing operation FIFO_CONFIG_1, 0x3E register */ +#define FIFO_WORKAROUNDS_MSK SMI_ACC2X2_FIFO_TRIGGER_SOURCE__MSK + +struct smi130_acc_type_map_t { + + /*! smi130_acc sensor chip id */ + uint16_t chip_id; + + /*! smi130_acc sensor type */ + uint16_t sensor_type; + + /*! smi130_acc sensor name */ + const char *sensor_name; +}; + +static const struct smi130_acc_type_map_t sensor_type_map[] = { + + {SMI_ACC255_CHIP_ID, SMI_ACC255_TYPE, "SMI_ACC255/254"}, + {SMI_ACC355_CHIP_ID, SMI_ACC255_TYPE, "SMI_ACC355"}, + {SMI_ACC250E_CHIP_ID, SMI_ACC250E_TYPE, "SMI_ACC250E"}, + {SMI_ACC222E_CHIP_ID, SMI_ACC222E_TYPE, "SMI_ACC222E"}, + {SMI_ACC280_CHIP_ID, SMI_ACC280_TYPE, "SMI_ACC280"}, + +}; + +/*! +* Bst sensor common definition, +* please give parameters in BSP file. +*/ +struct bosch_sensor_specific { + char *name; + /* 0 to 7 */ + int place; + int irq; + int (*irq_gpio_cfg)(void); +}; + + +/*! + * we use a typedef to hide the detail, + * because this type might be changed + */ +struct bosch_sensor_axis_remap { + /* src means which source will be mapped to target x, y, z axis */ + /* if an target OS axis is remapped from (-)x, + * src is 0, sign_* is (-)1 */ + /* if an target OS axis is remapped from (-)y, + * src is 1, sign_* is (-)1 */ + /* if an target OS axis is remapped from (-)z, + * src is 2, sign_* is (-)1 */ + int src_x:3; + int src_y:3; + int src_z:3; + + int sign_x:2; + int sign_y:2; + int sign_z:2; +}; + +struct bosch_sensor_data { + union { + int16_t v[3]; + struct { + int16_t x; + int16_t y; + int16_t z; + }; + }; +}; + +struct smi130_accacc { + s16 x; + s16 y; + s16 z; +}; + +struct smi130_acc_data { + struct i2c_client *smi130_acc_client; + atomic_t delay; + atomic_t enable; + atomic_t selftest_result; + unsigned int chip_id; + unsigned int fifo_count; + unsigned char fifo_datasel; + unsigned char mode; + signed char sensor_type; + uint64_t timestamp; + uint64_t fifo_time; + uint64_t base_time; + uint64_t acc_count; + uint64_t time_odr; + uint8_t debug_level; + struct work_struct report_data_work; + int is_timer_running; + struct hrtimer timer; + ktime_t work_delay_kt; + struct input_dev *input; + + struct bosch_dev *bosch_acc; + + struct smi130_accacc value; + struct mutex value_mutex; + struct mutex enable_mutex; + struct mutex mode_mutex; + struct delayed_work work; + struct work_struct irq_work; +#ifdef CONFIG_HAS_EARLYSUSPEND + struct early_suspend early_suspend; +#endif + int16_t IRQ; + struct bosch_sensor_specific *bosch_pd; + + int smi_acc_mode_enabled; + struct input_dev *dev_interrupt; + +#ifdef CONFIG_SIG_MOTION + struct class *g_sensor_class; + struct device *g_sensor_dev; + + /*struct smi_acc250_platform_data *pdata;*/ + atomic_t en_sig_motion; +#endif + +#ifdef CONFIG_DOUBLE_TAP + struct class *g_sensor_class_doubletap; + struct device *g_sensor_dev_doubletap; + atomic_t en_double_tap; + unsigned char tap_times; + struct mutex tap_mutex; + struct timer_list tap_timer; + int tap_time_period; +#endif +}; + +#ifdef CONFIG_HAS_EARLYSUSPEND +static void smi130_acc_early_suspend(struct early_suspend *h); +static void smi130_acc_late_resume(struct early_suspend *h); +#endif + +static int smi130_acc_set_mode(struct i2c_client *client, + u8 mode, u8 enabled_mode); +static int smi130_acc_get_mode(struct i2c_client *client, u8 *mode); +static int smi130_acc_get_fifo_mode(struct i2c_client *client, u8 *fifo_mode); +static int smi130_acc_set_fifo_mode(struct i2c_client *client, u8 fifo_mode); +static int smi130_acc_normal_to_suspend(struct smi130_acc_data *smi130_acc, + unsigned char data1, unsigned char data2); + +static void smi130_acc_delay(u32 msec) +{ + if (msec <= 20) + usleep_range(msec * 1000, msec * 1000); + else + msleep(msec); +} +/*Remapping for SMI_ACC2X2*/ +static const struct bosch_sensor_axis_remap +bosch_axis_remap_tab_dft[MAX_AXIS_REMAP_TAB_SZ] = { + /* src_x src_y src_z sign_x sign_y sign_z */ + { 0, 1, 2, 1, 1, 1 }, /* P0 */ + { 1, 0, 2, 1, -1, 1 }, /* P1 */ + { 0, 1, 2, -1, -1, 1 }, /* P2 */ + { 1, 0, 2, -1, 1, 1 }, /* P3 */ + + { 0, 1, 2, -1, 1, -1 }, /* P4 */ + { 1, 0, 2, -1, -1, -1 }, /* P5 */ + { 0, 1, 2, 1, -1, -1 }, /* P6 */ + { 1, 0, 2, 1, 1, -1 }, /* P7 */ +}; + + +static void bosch_remap_sensor_data(struct bosch_sensor_data *data, + const struct bosch_sensor_axis_remap *remap) +{ + struct bosch_sensor_data tmp; + + tmp.x = data->v[remap->src_x] * remap->sign_x; + tmp.y = data->v[remap->src_y] * remap->sign_y; + tmp.z = data->v[remap->src_z] * remap->sign_z; + + memcpy(data, &tmp, sizeof(*data)); +} + + +static void bosch_remap_sensor_data_dft_tab(struct bosch_sensor_data *data, + int place) +{ + /* sensor with place 0 needs not to be remapped */ + if ((place <= 0) || (place >= MAX_AXIS_REMAP_TAB_SZ)) + return; + + bosch_remap_sensor_data(data, &bosch_axis_remap_tab_dft[place]); +} + +static void smi130_acc_remap_sensor_data(struct smi130_accacc *val, + struct smi130_acc_data *client_data) +{ + struct bosch_sensor_data bsd; + int place; + + if ((NULL == client_data->bosch_pd) || (BOSCH_SENSOR_PLACE_UNKNOWN + == client_data->bosch_pd->place)) + place = BOSCH_SENSOR_PLACE_UNKNOWN; + else + place = client_data->bosch_pd->place; + +#ifdef CONFIG_SENSORS_BMI058 +/*x,y need to be invesed becase of HW Register for BMI058*/ + bsd.y = val->x; + bsd.x = val->y; + bsd.z = val->z; +#else + bsd.x = val->x; + bsd.y = val->y; + bsd.z = val->z; +#endif + + bosch_remap_sensor_data_dft_tab(&bsd, place); + + val->x = bsd.x; + val->y = bsd.y; + val->z = bsd.z; + +} + + +static int smi130_acc_smbus_read_byte(struct i2c_client *client, + unsigned char reg_addr, unsigned char *data) +{ +#if !defined SMI130_ACC_USE_BASIC_I2C_FUNC + s32 dummy; + int len = 1; + if (NULL == client) + return -ENODEV; + + while (0 != len--) { +#ifdef SMI130_ACC_SMBUS + dummy = i2c_smbus_read_byte_data(client, reg_addr); + if (dummy < 0) { + PERR("i2c bus read error"); + return -EIO; + } + *data = (u8)(dummy & 0xff); +#else + dummy = i2c_master_send(client, (char *)®_addr, 1); + if (dummy < 0) + return -EIO; + + dummy = i2c_master_recv(client, (char *)data, 1); + if (dummy < 0) + return -EIO; +#endif + reg_addr++; + data++; + } + return 0; +#else + int retry; + int len = 1; + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = ®_addr, + }, + + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = len, + .buf = data, + }, + }; + + for (retry = 0; retry < SMI_ACC_MAX_RETRY_I2C_XFER; retry++) { + if (i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)) > 0) + break; + else + smi130_acc_delay(1); + } + + if (SMI_ACC_MAX_RETRY_I2C_XFER <= retry) { + PERR("I2C xfer error"); + return -EIO; + } + + return 0; +#endif +} + +static int smi130_acc_smbus_write_byte(struct i2c_client *client, + unsigned char reg_addr, unsigned char *data) +{ +#if !defined SMI130_ACC_USE_BASIC_I2C_FUNC + s32 dummy; + int len = 1; +#ifndef SMI130_ACC_SMBUS + u8 buffer[2]; +#endif + if (NULL == client) + return -ENODEV; + + while (0 != len--) { +#ifdef SMI130_ACC_SMBUS + dummy = i2c_smbus_write_byte_data(client, reg_addr, *data); +#else + buffer[0] = reg_addr; + buffer[1] = *data; + dummy = i2c_master_send(client, (char *)buffer, 2); +#endif + reg_addr++; + data++; + if (dummy < 0) { + PERR("error writing i2c bus"); + return -EIO; + } + + } + return 0; +#else + u8 buffer[2]; + int retry; + int len = 1; + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 2, + .buf = buffer, + }, + }; + while (0 != len--) { + buffer[0] = reg_addr; + buffer[1] = *data; + for (retry = 0; retry < SMI_ACC_MAX_RETRY_I2C_XFER; retry++) { + if (i2c_transfer(client->adapter, msg, + ARRAY_SIZE(msg)) > 0) { + break; + } else { + smi130_acc_delay(1); + } + } + if (SMI_ACC_MAX_RETRY_I2C_XFER <= retry) { + PERR("I2C xfer error"); + return -EIO; + } + reg_addr++; + data++; + } + + return 0; +#endif +} + +static int smi130_acc_smbus_read_byte_block(struct i2c_client *client, + unsigned char reg_addr, unsigned char *data, unsigned char len) +{ + int retry; + + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = ®_addr, + }, + + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = len, + .buf = data, + }, + }; + + for (retry = 0; retry < SMI_ACC_MAX_RETRY_I2C_XFER; retry++) { + if (i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)) > 0) + break; + else + smi130_acc_delay(1); + } + + if (SMI_ACC_MAX_RETRY_I2C_XFER <= retry) { + PERR("I2C xfer error"); + return -EIO; + } + return 0; +} + +static int smi_acc_i2c_burst_read(struct i2c_client *client, u8 reg_addr, + u8 *data, u16 len) +{ + int retry; + + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = ®_addr, + }, + + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = len, + .buf = data, + }, + }; + + for (retry = 0; retry < SMI_ACC_MAX_RETRY_I2C_XFER; retry++) { + if (i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)) > 0) + break; + else + smi130_acc_delay(1); + } + + if (SMI_ACC_MAX_RETRY_I2C_XFER <= retry) { + PINFO("I2C xfer error"); + return -EIO; + } + + return 0; +} + +static int smi130_acc_check_chip_id(struct i2c_client *client, + struct smi130_acc_data *data) +{ + int i = 0; + int err = 0; + unsigned char chip_id = 0; + unsigned char read_count = 0; + unsigned char smi130_acc_sensor_type_count = 0; + + smi130_acc_sensor_type_count = + sizeof(sensor_type_map) / sizeof(struct smi130_acc_type_map_t); + + while (read_count++ < CHECK_CHIP_ID_TIME_MAX) { + if (smi130_acc_smbus_read_byte(client, SMI_ACC2X2_CHIP_ID_REG, + &chip_id) < 0) { + PERR("Bosch Sensortec Device not found\n\n" + "i2c bus read error, read chip_id:%d\n", chip_id); + continue; + } else { + for (i = 0; i < smi130_acc_sensor_type_count; i++) { + if (sensor_type_map[i].chip_id == chip_id) { + data->sensor_type = + sensor_type_map[i].sensor_type; + data->chip_id = chip_id; + PINFO("Bosch Sensortec Device detected,\n\n" + " HW IC name: %s\n", + sensor_type_map[i].sensor_name); + return err; + } + } + if (i < smi130_acc_sensor_type_count) + return err; + else { + if (read_count == CHECK_CHIP_ID_TIME_MAX) { + PERR("Failed! Bosch Sensortec Device\n\n" + " not found, mismatch chip_id:%d\n", + chip_id); + err = -ENODEV; + return err; + } + } + smi130_acc_delay(1); + } + } + return err; +} + +#ifdef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT +static int smi130_acc_set_newdata(struct i2c_client *client, + unsigned char channel, unsigned char int_newdata) +{ + + unsigned char data = 0; + int comres = 0; + + switch (channel) { + case SMI_ACC2X2_INT1_NDATA: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_NEWDATA__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, + SMI_ACC2X2_EN_INT1_PAD_NEWDATA, int_newdata); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_NEWDATA__REG, &data); + break; + case SMI_ACC2X2_INT2_NDATA: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_NEWDATA__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, + SMI_ACC2X2_EN_INT2_PAD_NEWDATA, int_newdata); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_NEWDATA__REG, &data); + break; + default: + comres = -1; + break; + } + + return comres; + +} +#endif /* CONFIG_SMI_ACC_ENABLE_NEWDATA_INT */ + +#ifdef SMI_ACC2X2_ENABLE_INT1 +static int smi130_acc_set_int1_pad_sel(struct i2c_client *client, unsigned char + int1sel) +{ + int comres = 0; + unsigned char data = 0; + unsigned char state; + state = 0x01; + + + switch (int1sel) { + case 0: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_LOWG__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_LOWG, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_LOWG__REG, &data); + break; + case 1: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_HIGHG__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_HIGHG, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_HIGHG__REG, &data); + break; + case 2: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_SLOPE__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_SLOPE, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_SLOPE__REG, &data); + break; + case 3: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_DB_TAP__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_DB_TAP, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_DB_TAP__REG, &data); + break; + case 4: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_SNG_TAP__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_SNG_TAP, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_SNG_TAP__REG, &data); + break; + case 5: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_ORIENT__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_ORIENT, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_ORIENT__REG, &data); + break; + case 6: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_FLAT__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_FLAT, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_FLAT__REG, &data); + break; + case 7: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT1_PAD_SLO_NO_MOT__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT1_PAD_SLO_NO_MOT, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT1_PAD_SLO_NO_MOT__REG, &data); + break; + + default: + break; + } + + return comres; +} +#endif /* SMI_ACC2X2_ENABLE_INT1 */ + +#ifdef SMI_ACC2X2_ENABLE_INT2 +static int smi130_acc_set_int2_pad_sel(struct i2c_client *client, unsigned char + int2sel) +{ + int comres = 0; + unsigned char data = 0; + unsigned char state; + state = 0x01; + + + switch (int2sel) { + case 0: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_LOWG__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_LOWG, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_LOWG__REG, &data); + break; + case 1: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_HIGHG__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_HIGHG, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_HIGHG__REG, &data); + break; + case 2: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_SLOPE__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_SLOPE, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_SLOPE__REG, &data); + break; + case 3: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_DB_TAP__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_DB_TAP, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_DB_TAP__REG, &data); + break; + case 4: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_SNG_TAP__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_SNG_TAP, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_SNG_TAP__REG, &data); + break; + case 5: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_ORIENT__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_ORIENT, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_ORIENT__REG, &data); + break; + case 6: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_FLAT__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_FLAT, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_FLAT__REG, &data); + break; + case 7: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_EN_INT2_PAD_SLO_NO_MOT__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_INT2_PAD_SLO_NO_MOT, + state); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_EN_INT2_PAD_SLO_NO_MOT__REG, &data); + break; + default: + break; + } + + return comres; +} +#endif /* SMI_ACC2X2_ENABLE_INT2 */ + +static int smi130_acc_set_Int_Enable(struct i2c_client *client, unsigned char + InterruptType , unsigned char value) +{ + int comres = 0; + unsigned char data1 = 0; + unsigned char data2 = 0; + + if ((11 < InterruptType) && (InterruptType < 16)) { + switch (InterruptType) { + case 12: + /* slow/no motion X Interrupt */ + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_X_INT__REG, &data1); + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_X_INT, value); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_X_INT__REG, &data1); + break; + case 13: + /* slow/no motion Y Interrupt */ + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_Y_INT__REG, &data1); + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_Y_INT, value); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_Y_INT__REG, &data1); + break; + case 14: + /* slow/no motion Z Interrupt */ + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_Z_INT__REG, &data1); + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_Z_INT, value); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_Z_INT__REG, &data1); + break; + case 15: + /* slow / no motion Interrupt select */ + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_SEL_INT__REG, &data1); + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_SEL_INT, value); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_INT_SLO_NO_MOT_EN_SEL_INT__REG, &data1); + } + + return comres; + } + + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_INT_ENABLE1_REG, &data1); + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_INT_ENABLE2_REG, &data2); + + value = value & 1; + switch (InterruptType) { + case 0: + /* Low G Interrupt */ + data2 = SMI_ACC2X2_SET_BITSLICE(data2, SMI_ACC2X2_EN_LOWG_INT, value); + break; + + case 1: + /* High G X Interrupt */ + data2 = SMI_ACC2X2_SET_BITSLICE(data2, SMI_ACC2X2_EN_HIGHG_X_INT, + value); + break; + + case 2: + /* High G Y Interrupt */ + data2 = SMI_ACC2X2_SET_BITSLICE(data2, SMI_ACC2X2_EN_HIGHG_Y_INT, + value); + break; + + case 3: + /* High G Z Interrupt */ + data2 = SMI_ACC2X2_SET_BITSLICE(data2, SMI_ACC2X2_EN_HIGHG_Z_INT, + value); + break; + + case 4: + /* New Data Interrupt */ + data2 = SMI_ACC2X2_SET_BITSLICE(data2, SMI_ACC2X2_EN_NEW_DATA_INT, + value); + break; + + case 5: + /* Slope X Interrupt */ + data1 = SMI_ACC2X2_SET_BITSLICE(data1, SMI_ACC2X2_EN_SLOPE_X_INT, + value); + break; + + case 6: + /* Slope Y Interrupt */ + data1 = SMI_ACC2X2_SET_BITSLICE(data1, SMI_ACC2X2_EN_SLOPE_Y_INT, + value); + break; + + case 7: + /* Slope Z Interrupt */ + data1 = SMI_ACC2X2_SET_BITSLICE(data1, SMI_ACC2X2_EN_SLOPE_Z_INT, + value); + break; + + case 8: + /* Single Tap Interrupt */ + data1 = SMI_ACC2X2_SET_BITSLICE(data1, SMI_ACC2X2_EN_SINGLE_TAP_INT, + value); + break; + + case 9: + /* Double Tap Interrupt */ + data1 = SMI_ACC2X2_SET_BITSLICE(data1, SMI_ACC2X2_EN_DOUBLE_TAP_INT, + value); + break; + + case 10: + /* Orient Interrupt */ + data1 = SMI_ACC2X2_SET_BITSLICE(data1, SMI_ACC2X2_EN_ORIENT_INT, value); + break; + + case 11: + /* Flat Interrupt */ + data1 = SMI_ACC2X2_SET_BITSLICE(data1, SMI_ACC2X2_EN_FLAT_INT, value); + break; + + default: + break; + } + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_INT_ENABLE1_REG, + &data1); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_INT_ENABLE2_REG, + &data2); + + return comres; +} + + +#if defined(SMI_ACC2X2_ENABLE_INT1) || defined(SMI_ACC2X2_ENABLE_INT2) +static int smi130_acc_get_interruptstatus1(struct i2c_client *client, unsigned char + *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_STATUS1_REG, &data); + *intstatus = data; + + return comres; +} + +#ifdef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT +/* +static int smi130_acc_get_interruptstatus2(struct i2c_client *client, unsigned char + *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_STATUS2_REG, &data); + *intstatus = data; + + return comres; +} +*/ +#endif + +static int smi130_acc_get_HIGH_first(struct i2c_client *client, unsigned char + param, unsigned char *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + switch (param) { + case 0: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_STATUS_ORIENT_HIGH_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_HIGHG_FIRST_X); + *intstatus = data; + break; + case 1: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_STATUS_ORIENT_HIGH_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_HIGHG_FIRST_Y); + *intstatus = data; + break; + case 2: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_STATUS_ORIENT_HIGH_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_HIGHG_FIRST_Z); + *intstatus = data; + break; + default: + break; + } + + return comres; +} + +static int smi130_acc_get_HIGH_sign(struct i2c_client *client, unsigned char + *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_STATUS_ORIENT_HIGH_REG, + &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_HIGHG_SIGN_S); + *intstatus = data; + + return comres; +} + +#ifndef CONFIG_SIG_MOTION +static int smi130_acc_get_slope_first(struct i2c_client *client, unsigned char + param, unsigned char *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + switch (param) { + case 0: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_STATUS_TAP_SLOPE_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_SLOPE_FIRST_X); + *intstatus = data; + break; + case 1: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_STATUS_TAP_SLOPE_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_SLOPE_FIRST_Y); + *intstatus = data; + break; + case 2: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_STATUS_TAP_SLOPE_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_SLOPE_FIRST_Z); + *intstatus = data; + break; + default: + break; + } + + return comres; +} + +static int smi130_acc_get_slope_sign(struct i2c_client *client, unsigned char + *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_STATUS_TAP_SLOPE_REG, + &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_SLOPE_SIGN_S); + *intstatus = data; + + return comres; +} +#endif + +static int smi130_acc_get_orient_status(struct i2c_client *client, unsigned char + *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_STATUS_ORIENT_HIGH_REG, + &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_ORIENT_S); + *intstatus = data; + + return comres; +} + +static int smi130_acc_get_orient_flat_status(struct i2c_client *client, unsigned + char *intstatus) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_STATUS_ORIENT_HIGH_REG, + &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FLAT_S); + *intstatus = data; + + return comres; +} +#endif /* defined(SMI_ACC2X2_ENABLE_INT1)||defined(SMI_ACC2X2_ENABLE_INT2) */ + +static int smi130_acc_set_Int_Mode(struct i2c_client *client, unsigned char Mode) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_INT_MODE_SEL__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_INT_MODE_SEL, Mode); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_INT_MODE_SEL__REG, &data); + + + return comres; +} + +static int smi130_acc_get_Int_Mode(struct i2c_client *client, unsigned char *Mode) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_INT_MODE_SEL__REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_INT_MODE_SEL); + *Mode = data; + + + return comres; +} +static int smi130_acc_set_slope_duration(struct i2c_client *client, unsigned char + duration) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_SLOPE_DUR__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_SLOPE_DUR, duration); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_SLOPE_DUR__REG, &data); + + return comres; +} + +static int smi130_acc_get_slope_duration(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_SLOPE_DURN_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_SLOPE_DUR); + *status = data; + + + return comres; +} + +static int smi130_acc_set_slope_no_mot_duration(struct i2c_client *client, + unsigned char duration) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI130_ACC_SLO_NO_MOT_DUR__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI130_ACC_SLO_NO_MOT_DUR, duration); + comres = smi130_acc_smbus_write_byte(client, + SMI130_ACC_SLO_NO_MOT_DUR__REG, &data); + + + return comres; +} + +static int smi130_acc_get_slope_no_mot_duration(struct i2c_client *client, + unsigned char *status) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI130_ACC_SLO_NO_MOT_DUR__REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI130_ACC_SLO_NO_MOT_DUR); + *status = data; + + + return comres; +} + +static int smi130_acc_set_slope_threshold(struct i2c_client *client, + unsigned char threshold) +{ + int comres = 0; + unsigned char data = 0; + + data = threshold; + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_SLOPE_THRES__REG, &data); + + return comres; +} + +static int smi130_acc_get_slope_threshold(struct i2c_client *client, + unsigned char *status) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_SLOPE_THRES_REG, &data); + *status = data; + + return comres; +} + +static int smi130_acc_set_slope_no_mot_threshold(struct i2c_client *client, + unsigned char threshold) +{ + int comres = 0; + unsigned char data = 0; + + data = threshold; + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_SLO_NO_MOT_THRES_REG, &data); + + return comres; +} + +static int smi130_acc_get_slope_no_mot_threshold(struct i2c_client *client, + unsigned char *status) +{ + int comres = 0; + unsigned char data = 0; + + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_SLO_NO_MOT_THRES_REG, &data); + *status = data; + + return comres; +} + + +static int smi130_acc_set_low_g_duration(struct i2c_client *client, unsigned char + duration) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_LOWG_DUR__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_LOWG_DUR, duration); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_LOWG_DUR__REG, &data); + + return comres; +} + +static int smi130_acc_get_low_g_duration(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_LOW_DURN_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_LOWG_DUR); + *status = data; + + return comres; +} + +static int smi130_acc_set_low_g_threshold(struct i2c_client *client, unsigned char + threshold) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_LOWG_THRES__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_LOWG_THRES, threshold); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_LOWG_THRES__REG, &data); + + return comres; +} + +static int smi130_acc_get_low_g_threshold(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_LOW_THRES_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_LOWG_THRES); + *status = data; + + return comres; +} + +static int smi130_acc_set_high_g_duration(struct i2c_client *client, unsigned char + duration) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_HIGHG_DUR__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_HIGHG_DUR, duration); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_HIGHG_DUR__REG, &data); + + return comres; +} + +static int smi130_acc_get_high_g_duration(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_HIGH_DURN_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_HIGHG_DUR); + *status = data; + + return comres; +} + +static int smi130_acc_set_high_g_threshold(struct i2c_client *client, unsigned char + threshold) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_HIGHG_THRES__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_HIGHG_THRES, threshold); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_HIGHG_THRES__REG, + &data); + + return comres; +} + +static int smi130_acc_get_high_g_threshold(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_HIGH_THRES_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_HIGHG_THRES); + *status = data; + + return comres; +} + + +static int smi130_acc_set_tap_duration(struct i2c_client *client, unsigned char + duration) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_DUR__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_TAP_DUR, duration); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_TAP_DUR__REG, &data); + + return comres; +} + +static int smi130_acc_get_tap_duration(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_PARAM_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_TAP_DUR); + *status = data; + + return comres; +} + +static int smi130_acc_set_tap_shock(struct i2c_client *client, unsigned char setval) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_SHOCK_DURN__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_TAP_SHOCK_DURN, setval); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_TAP_SHOCK_DURN__REG, + &data); + + return comres; +} + +static int smi130_acc_get_tap_shock(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_PARAM_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_TAP_SHOCK_DURN); + *status = data; + + return comres; +} + +static int smi130_acc_set_tap_quiet(struct i2c_client *client, unsigned char + duration) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_QUIET_DURN__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_TAP_QUIET_DURN, duration); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_TAP_QUIET_DURN__REG, + &data); + + return comres; +} + +static int smi130_acc_get_tap_quiet(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_PARAM_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_TAP_QUIET_DURN); + *status = data; + + return comres; +} + +static int smi130_acc_set_tap_threshold(struct i2c_client *client, unsigned char + threshold) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_THRES__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_TAP_THRES, threshold); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_TAP_THRES__REG, &data); + + return comres; +} + +static int smi130_acc_get_tap_threshold(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_THRES_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_TAP_THRES); + *status = data; + + return comres; +} + +static int smi130_acc_set_tap_samp(struct i2c_client *client, unsigned char samp) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_SAMPLES__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_TAP_SAMPLES, samp); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_TAP_SAMPLES__REG, + &data); + + return comres; +} + +static int smi130_acc_get_tap_samp(struct i2c_client *client, unsigned char *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TAP_THRES_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_TAP_SAMPLES); + *status = data; + + return comres; +} + +static int smi130_acc_set_orient_mode(struct i2c_client *client, unsigned char mode) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_MODE__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_ORIENT_MODE, mode); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_ORIENT_MODE__REG, + &data); + + return comres; +} + +static int smi130_acc_get_orient_mode(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_PARAM_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_ORIENT_MODE); + *status = data; + + return comres; +} + +static int smi130_acc_set_orient_blocking(struct i2c_client *client, unsigned char + samp) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_BLOCK__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_ORIENT_BLOCK, samp); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_ORIENT_BLOCK__REG, + &data); + + return comres; +} + +static int smi130_acc_get_orient_blocking(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_PARAM_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_ORIENT_BLOCK); + *status = data; + + return comres; +} + +static int smi130_acc_set_orient_hyst(struct i2c_client *client, unsigned char + orienthyst) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_HYST__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_ORIENT_HYST, orienthyst); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_ORIENT_HYST__REG, + &data); + + return comres; +} + +static int smi130_acc_get_orient_hyst(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_PARAM_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_ORIENT_HYST); + *status = data; + + return comres; +} +static int smi130_acc_set_theta_blocking(struct i2c_client *client, unsigned char + thetablk) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_THETA_BLOCK__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_THETA_BLOCK, thetablk); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_THETA_BLOCK__REG, + &data); + + return comres; +} + +static int smi130_acc_get_theta_blocking(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_THETA_BLOCK_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_THETA_BLOCK); + *status = data; + + return comres; +} + +static int smi130_acc_set_theta_flat(struct i2c_client *client, unsigned char + thetaflat) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_THETA_FLAT__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_THETA_FLAT, thetaflat); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_THETA_FLAT__REG, &data); + + return comres; +} + +static int smi130_acc_get_theta_flat(struct i2c_client *client, unsigned char + *status) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_THETA_FLAT_REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_THETA_FLAT); + *status = data; + + return comres; +} + +static int smi130_acc_set_flat_hold_time(struct i2c_client *client, unsigned char + holdtime) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_FLAT_HOLD_TIME__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_FLAT_HOLD_TIME, holdtime); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_FLAT_HOLD_TIME__REG, + &data); + + return comres; +} + +static int smi130_acc_get_flat_hold_time(struct i2c_client *client, unsigned char + *holdtime) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_FLAT_HOLD_TIME_REG, + &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FLAT_HOLD_TIME); + *holdtime = data; + + return comres; +} + +/*! + * brief: smi130_acc switch from normal to suspend mode + * @param[i] smi130_acc + * @param[i] data1, write to PMU_LPW + * @param[i] data2, write to PMU_LOW_NOSIE + * + * @return zero success, none-zero failed + */ +static int smi130_acc_normal_to_suspend(struct smi130_acc_data *smi130_acc, + unsigned char data1, unsigned char data2) +{ + unsigned char current_fifo_mode; + unsigned char current_op_mode; + if (smi130_acc == NULL) + return -ENODEV; + /* get current op mode from mode register */ + if (smi130_acc_get_mode(smi130_acc->smi130_acc_client, ¤t_op_mode) < 0) + return -EIO; + /* only aimed at operatiom mode chang from normal/lpw1 mode + * to suspend state. + */ + if (current_op_mode == SMI_ACC2X2_MODE_NORMAL || + current_op_mode == SMI_ACC2X2_MODE_LOWPOWER1) { + /* get current fifo mode from fifo config register */ + if (smi130_acc_get_fifo_mode(smi130_acc->smi130_acc_client, + ¤t_fifo_mode) < 0) + return -EIO; + else { + smi130_acc_smbus_write_byte(smi130_acc->smi130_acc_client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, &data2); + smi130_acc_smbus_write_byte(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_CTRL_REG, &data1); + /*! Aim at fifo workarounds with FIFO_CONFIG_1 */ + current_fifo_mode |= FIFO_WORKAROUNDS_MSK; + smi130_acc_smbus_write_byte(smi130_acc->smi130_acc_client, + SMI_ACC2X2_FIFO_MODE__REG, ¤t_fifo_mode); + smi130_acc_delay(3); + return 0; + } + } else { + smi130_acc_smbus_write_byte(smi130_acc->smi130_acc_client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, &data2); + smi130_acc_smbus_write_byte(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_CTRL_REG, &data1); + smi130_acc_delay(3); + return 0; + } + +} + +static int smi130_acc_set_mode(struct i2c_client *client, unsigned char mode, + unsigned char enabled_mode) +{ + int comres = 0; + unsigned char data1 = 0; + unsigned char data2 = 0; + int ret = 0; + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + mutex_lock(&smi130_acc->mode_mutex); + if (SMI_ACC2X2_MODE_SUSPEND == mode) { + if (enabled_mode != SMI_ACC_ENABLED_ALL) { + if ((smi130_acc->smi_acc_mode_enabled & + (1<<enabled_mode)) == 0) { + /* sensor is already closed in this mode */ + mutex_unlock(&smi130_acc->mode_mutex); + return 0; + } else { + smi130_acc->smi_acc_mode_enabled &= ~(1<<enabled_mode); + } + } else { + /* shut down, close all and force do it*/ + smi130_acc->smi_acc_mode_enabled = 0; + } + } else if (SMI_ACC2X2_MODE_NORMAL == mode) { + if ((smi130_acc->smi_acc_mode_enabled & (1<<enabled_mode)) != 0) { + /* sensor is already enabled in this mode */ + mutex_unlock(&smi130_acc->mode_mutex); + return 0; + } else { + smi130_acc->smi_acc_mode_enabled |= (1<<enabled_mode); + } + } else { + /* other mode, close all and force do it*/ + smi130_acc->smi_acc_mode_enabled = 0; + } + mutex_unlock(&smi130_acc->mode_mutex); + + if (mode < 6) { + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_MODE_CTRL_REG, + &data1); + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, + &data2); + switch (mode) { + case SMI_ACC2X2_MODE_NORMAL: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_MODE_CTRL, 0); + data2 = SMI_ACC2X2_SET_BITSLICE(data2, + SMI_ACC2X2_LOW_POWER_MODE, 0); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_MODE_CTRL_REG, &data1); + smi130_acc_delay(3); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, &data2); + break; + case SMI_ACC2X2_MODE_LOWPOWER1: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_MODE_CTRL, 2); + data2 = SMI_ACC2X2_SET_BITSLICE(data2, + SMI_ACC2X2_LOW_POWER_MODE, 0); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_MODE_CTRL_REG, &data1); + smi130_acc_delay(3); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, &data2); + break; + case SMI_ACC2X2_MODE_SUSPEND: + if (smi130_acc->smi_acc_mode_enabled != 0) { + PERR("smi_acc still working"); + return 0; + } + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_MODE_CTRL, 4); + data2 = SMI_ACC2X2_SET_BITSLICE(data2, + SMI_ACC2X2_LOW_POWER_MODE, 0); + /*aimed at anomaly resolution when switch to suspend*/ + ret = smi130_acc_normal_to_suspend(smi130_acc, data1, data2); + if (ret < 0) + PERR("Error switching to suspend"); + break; + case SMI_ACC2X2_MODE_DEEP_SUSPEND: + if (smi130_acc->smi_acc_mode_enabled != 0) { + PERR("smi_acc still working"); + return 0; + } + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_MODE_CTRL, 1); + data2 = SMI_ACC2X2_SET_BITSLICE(data2, + SMI_ACC2X2_LOW_POWER_MODE, 1); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_MODE_CTRL_REG, &data1); + smi130_acc_delay(3); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, &data2); + break; + case SMI_ACC2X2_MODE_LOWPOWER2: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_MODE_CTRL, 2); + data2 = SMI_ACC2X2_SET_BITSLICE(data2, + SMI_ACC2X2_LOW_POWER_MODE, 1); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_MODE_CTRL_REG, &data1); + smi130_acc_delay(3); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, &data2); + break; + case SMI_ACC2X2_MODE_STANDBY: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_MODE_CTRL, 4); + data2 = SMI_ACC2X2_SET_BITSLICE(data2, + SMI_ACC2X2_LOW_POWER_MODE, 1); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_LOW_NOISE_CTRL_REG, &data2); + smi130_acc_delay(3); + smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_MODE_CTRL_REG, &data1); + break; + } + } else { + comres = -1; + } + + return comres; +} + + +static int smi130_acc_get_mode(struct i2c_client *client, unsigned char *mode) +{ + int comres = 0; + unsigned char data1 = 0; + unsigned char data2 = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_MODE_CTRL_REG, &data1); + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_LOW_NOISE_CTRL_REG, + &data2); + + data1 = (data1 & 0xE0) >> 5; + data2 = (data2 & 0x40) >> 6; + + + if ((data1 == 0x00) && (data2 == 0x00)) { + *mode = SMI_ACC2X2_MODE_NORMAL; + } else { + if ((data1 == 0x02) && (data2 == 0x00)) { + *mode = SMI_ACC2X2_MODE_LOWPOWER1; + } else { + if ((data1 == 0x04 || data1 == 0x06) && + (data2 == 0x00)) { + *mode = SMI_ACC2X2_MODE_SUSPEND; + } else { + if (((data1 & 0x01) == 0x01)) { + *mode = SMI_ACC2X2_MODE_DEEP_SUSPEND; + } else { + if ((data1 == 0x02) && + (data2 == 0x01)) { + *mode = SMI_ACC2X2_MODE_LOWPOWER2; + } else { + if ((data1 == 0x04) && (data2 == + 0x01)) { + *mode = + SMI_ACC2X2_MODE_STANDBY; + } else { + *mode = + SMI_ACC2X2_MODE_DEEP_SUSPEND; + } + } + } + } + } + } + + return comres; +} + +static int smi130_acc_set_range(struct i2c_client *client, unsigned char Range) +{ + int comres = 0; + unsigned char data1 = 0; + + if ((Range == 3) || (Range == 5) || (Range == 8) || (Range == 12)) { + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_RANGE_SEL_REG, + &data1); + switch (Range) { + case SMI_ACC2X2_RANGE_2G: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_RANGE_SEL, 3); + break; + case SMI_ACC2X2_RANGE_4G: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_RANGE_SEL, 5); + break; + case SMI_ACC2X2_RANGE_8G: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_RANGE_SEL, 8); + break; + case SMI_ACC2X2_RANGE_16G: + data1 = SMI_ACC2X2_SET_BITSLICE(data1, + SMI_ACC2X2_RANGE_SEL, 12); + break; + default: + break; + } + comres += smi130_acc_smbus_write_byte(client, SMI_ACC2X2_RANGE_SEL_REG, + &data1); + } else { + comres = -1; + } + + return comres; +} + +static int smi130_acc_get_range(struct i2c_client *client, unsigned char *Range) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_RANGE_SEL__REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_RANGE_SEL); + *Range = data; + + return comres; +} + + +static int smi130_acc_set_bandwidth(struct i2c_client *client, unsigned char BW) +{ + int comres = 0; + unsigned char data = 0; + int Bandwidth = 0; + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (BW > 7 && BW < 16) { + switch (BW) { + case SMI_ACC2X2_BW_7_81HZ: + Bandwidth = SMI_ACC2X2_BW_7_81HZ; + smi130_acc->time_odr = 64000000; + + /* 7.81 Hz 64000 uS */ + break; + case SMI_ACC2X2_BW_15_63HZ: + Bandwidth = SMI_ACC2X2_BW_15_63HZ; + smi130_acc->time_odr = 32000000; + /* 15.63 Hz 32000 uS */ + break; + case SMI_ACC2X2_BW_31_25HZ: + Bandwidth = SMI_ACC2X2_BW_31_25HZ; + smi130_acc->time_odr = 16000000; + /* 31.25 Hz 16000 uS */ + break; + case SMI_ACC2X2_BW_62_50HZ: + Bandwidth = SMI_ACC2X2_BW_62_50HZ; + smi130_acc->time_odr = 8000000; + /* 62.50 Hz 8000 uS */ + break; + case SMI_ACC2X2_BW_125HZ: + Bandwidth = SMI_ACC2X2_BW_125HZ; + smi130_acc->time_odr = 4000000; + /* 125 Hz 4000 uS */ + break; + case SMI_ACC2X2_BW_250HZ: + Bandwidth = SMI_ACC2X2_BW_250HZ; + smi130_acc->time_odr = 2000000; + /* 250 Hz 2000 uS */ + break; + case SMI_ACC2X2_BW_500HZ: + Bandwidth = SMI_ACC2X2_BW_500HZ; + smi130_acc->time_odr = 1000000; + /* 500 Hz 1000 uS */ + break; + case SMI_ACC2X2_BW_1000HZ: + Bandwidth = SMI_ACC2X2_BW_1000HZ; + smi130_acc->time_odr = 500000; + /* 1000 Hz 500 uS */ + break; + default: + break; + } + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_BANDWIDTH__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_BANDWIDTH, Bandwidth); + comres += smi130_acc_smbus_write_byte(client, SMI_ACC2X2_BANDWIDTH__REG, + &data); + } else { + comres = -1; + } + + return comres; +} + +static int smi130_acc_get_bandwidth(struct i2c_client *client, unsigned char *BW) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_BANDWIDTH__REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_BANDWIDTH); + *BW = data; + + return comres; +} + +int smi130_acc_get_sleep_duration(struct i2c_client *client, unsigned char + *sleep_dur) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_SLEEP_DUR__REG, &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_SLEEP_DUR); + *sleep_dur = data; + + return comres; +} + +int smi130_acc_set_sleep_duration(struct i2c_client *client, unsigned char + sleep_dur) +{ + int comres = 0; + unsigned char data = 0; + int sleep_duration = 0; + + if (sleep_dur > 4 && sleep_dur < 16) { + switch (sleep_dur) { + case SMI_ACC2X2_SLEEP_DUR_0_5MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_0_5MS; + + /* 0.5 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_1MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_1MS; + + /* 1 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_2MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_2MS; + + /* 2 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_4MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_4MS; + + /* 4 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_6MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_6MS; + + /* 6 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_10MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_10MS; + + /* 10 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_25MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_25MS; + + /* 25 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_50MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_50MS; + + /* 50 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_100MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_100MS; + + /* 100 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_500MS: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_500MS; + + /* 500 MS */ + break; + case SMI_ACC2X2_SLEEP_DUR_1S: + sleep_duration = SMI_ACC2X2_SLEEP_DUR_1S; + + /* 1 SECS */ + break; + default: + break; + } + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_SLEEP_DUR__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_SLEEP_DUR, + sleep_duration); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_SLEEP_DUR__REG, + &data); + } else { + comres = -1; + } + + + return comres; +} + +static int smi130_acc_get_fifo_mode(struct i2c_client *client, unsigned char + *fifo_mode) +{ + int comres; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_FIFO_MODE__REG, &data); + *fifo_mode = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FIFO_MODE); + + return comres; +} + +static int smi130_acc_set_fifo_mode(struct i2c_client *client, unsigned char + fifo_mode) +{ + unsigned char data = 0; + int comres = 0; + + if (fifo_mode < 4) { + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_FIFO_MODE__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_FIFO_MODE, fifo_mode); + /*! Aim at fifo workarounds with FIFO_CONFIG_1 */ + data |= FIFO_WORKAROUNDS_MSK; + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_FIFO_MODE__REG, + &data); + } else { + comres = -1; + } + + return comres; +} + +static int smi130_acc_get_fifo_trig(struct i2c_client *client, unsigned char + *fifo_trig) +{ + int comres; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_FIFO_TRIGGER_ACTION__REG, &data); + *fifo_trig = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FIFO_TRIGGER_ACTION); + + return comres; +} + +static int smi130_acc_set_fifo_trig(struct i2c_client *client, unsigned char + fifo_trig) +{ + unsigned char data = 0; + int comres = 0; + + if (fifo_trig < 4) { + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_FIFO_TRIGGER_ACTION__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_FIFO_TRIGGER_ACTION, + fifo_trig); + /*! Aim at fifo workarounds with FIFO_CONFIG_1 */ + data |= FIFO_WORKAROUNDS_MSK; + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_FIFO_TRIGGER_ACTION__REG, &data); + } else { + comres = -1; + } + + return comres; +} + +static int smi130_acc_get_fifo_trig_src(struct i2c_client *client, unsigned char + *trig_src) +{ + int comres; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_FIFO_TRIGGER_SOURCE__REG, &data); + *trig_src = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FIFO_TRIGGER_SOURCE); + + return comres; +} + +static int smi130_acc_set_fifo_trig_src(struct i2c_client *client, unsigned char + trig_src) +{ + unsigned char data = 0; + int comres = 0; + + if (trig_src < 4) { + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_FIFO_TRIGGER_SOURCE__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_FIFO_TRIGGER_SOURCE, + trig_src); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_FIFO_TRIGGER_SOURCE__REG, &data); + } else { + comres = -1; + } + + return comres; +} + +static int smi130_acc_get_fifo_framecount(struct i2c_client *client, unsigned char + *framecount) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_FIFO_FRAME_COUNTER_S__REG, &data); + *framecount = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FIFO_FRAME_COUNTER_S); + + return comres; +} + +static int smi130_acc_get_fifo_data_sel(struct i2c_client *client, unsigned char + *data_sel) +{ + int comres; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_FIFO_DATA_SELECT__REG, &data); + *data_sel = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FIFO_DATA_SELECT); + + return comres; +} + +static int smi130_acc_set_fifo_data_sel(struct i2c_client *client, unsigned char + data_sel) +{ + unsigned char data = 0; + int comres = 0; + + if (data_sel < 4) { + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_FIFO_DATA_SELECT__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_FIFO_DATA_SELECT, + data_sel); + /*! Aim at fifo workarounds with FIFO_CONFIG_1 */ + data |= FIFO_WORKAROUNDS_MSK; + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_FIFO_DATA_SELECT__REG, + &data); + } else { + comres = -1; + } + + return comres; +} + + +static int smi130_acc_get_offset_target(struct i2c_client *client, unsigned char + channel, unsigned char *offset) +{ + unsigned char data = 0; + int comres = 0; + + switch (channel) { + case SMI_ACC2X2_CUT_OFF: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_CUTOFF__REG, &data); + *offset = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_COMP_CUTOFF); + break; + case SMI_ACC2X2_OFFSET_TRIGGER_X: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_X__REG, &data); + *offset = SMI_ACC2X2_GET_BITSLICE(data, + SMI_ACC2X2_COMP_TARGET_OFFSET_X); + break; + case SMI_ACC2X2_OFFSET_TRIGGER_Y: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_Y__REG, &data); + *offset = SMI_ACC2X2_GET_BITSLICE(data, + SMI_ACC2X2_COMP_TARGET_OFFSET_Y); + break; + case SMI_ACC2X2_OFFSET_TRIGGER_Z: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_Z__REG, &data); + *offset = SMI_ACC2X2_GET_BITSLICE(data, + SMI_ACC2X2_COMP_TARGET_OFFSET_Z); + break; + default: + comres = -1; + break; + } + + return comres; +} + +static int smi130_acc_set_offset_target(struct i2c_client *client, unsigned char + channel, unsigned char offset) +{ + unsigned char data = 0; + int comres = 0; + + switch (channel) { + case SMI_ACC2X2_CUT_OFF: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_CUTOFF__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_COMP_CUTOFF, + offset); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_COMP_CUTOFF__REG, &data); + break; + case SMI_ACC2X2_OFFSET_TRIGGER_X: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_X__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, + SMI_ACC2X2_COMP_TARGET_OFFSET_X, + offset); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_X__REG, + &data); + break; + case SMI_ACC2X2_OFFSET_TRIGGER_Y: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_Y__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, + SMI_ACC2X2_COMP_TARGET_OFFSET_Y, + offset); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_Y__REG, + &data); + break; + case SMI_ACC2X2_OFFSET_TRIGGER_Z: + comres = smi130_acc_smbus_read_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_Z__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, + SMI_ACC2X2_COMP_TARGET_OFFSET_Z, + offset); + comres = smi130_acc_smbus_write_byte(client, + SMI_ACC2X2_COMP_TARGET_OFFSET_Z__REG, + &data); + break; + default: + comres = -1; + break; + } + + return comres; +} + +static int smi130_acc_get_cal_ready(struct i2c_client *client, + unsigned char *calrdy) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_FAST_CAL_RDY_S__REG, + &data); + data = SMI_ACC2X2_GET_BITSLICE(data, SMI_ACC2X2_FAST_CAL_RDY_S); + *calrdy = data; + + return comres; +} + +static int smi130_acc_set_cal_trigger(struct i2c_client *client, unsigned char + caltrigger) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_CAL_TRIGGER__REG, &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_CAL_TRIGGER, caltrigger); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_CAL_TRIGGER__REG, + &data); + + return comres; +} + +static int smi130_acc_write_reg(struct i2c_client *client, unsigned char addr, + unsigned char *data) +{ + int comres = 0; + comres = smi130_acc_smbus_write_byte(client, addr, data); + + return comres; +} + + +static int smi130_acc_set_offset_x(struct i2c_client *client, unsigned char + offsetfilt) +{ + int comres = 0; + unsigned char data = 0; + + data = offsetfilt; + +#ifdef CONFIG_SENSORS_BMI058 + comres = smi130_acc_smbus_write_byte(client, BMI058_OFFSET_X_AXIS_REG, + &data); +#else + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_OFFSET_X_AXIS_REG, + &data); +#endif + + return comres; +} + + +static int smi130_acc_get_offset_x(struct i2c_client *client, unsigned char + *offsetfilt) +{ + int comres = 0; + unsigned char data = 0; + +#ifdef CONFIG_SENSORS_BMI058 + comres = smi130_acc_smbus_read_byte(client, BMI058_OFFSET_X_AXIS_REG, + &data); +#else + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_OFFSET_X_AXIS_REG, + &data); +#endif + *offsetfilt = data; + + return comres; +} + +static int smi130_acc_set_offset_y(struct i2c_client *client, unsigned char + offsetfilt) +{ + int comres = 0; + unsigned char data = 0; + + data = offsetfilt; + +#ifdef CONFIG_SENSORS_BMI058 + comres = smi130_acc_smbus_write_byte(client, BMI058_OFFSET_Y_AXIS_REG, + &data); +#else + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_OFFSET_Y_AXIS_REG, + &data); +#endif + return comres; +} + +static int smi130_acc_get_offset_y(struct i2c_client *client, unsigned char + *offsetfilt) +{ + int comres = 0; + unsigned char data = 0; + +#ifdef CONFIG_SENSORS_BMI058 + comres = smi130_acc_smbus_read_byte(client, BMI058_OFFSET_Y_AXIS_REG, + &data); +#else + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_OFFSET_Y_AXIS_REG, + &data); +#endif + *offsetfilt = data; + + return comres; +} + +static int smi130_acc_set_offset_z(struct i2c_client *client, unsigned char + offsetfilt) +{ + int comres = 0; + unsigned char data = 0; + + data = offsetfilt; + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_OFFSET_Z_AXIS_REG, + &data); + + return comres; +} + +static int smi130_acc_get_offset_z(struct i2c_client *client, unsigned char + *offsetfilt) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_OFFSET_Z_AXIS_REG, + &data); + *offsetfilt = data; + + return comres; +} + + +static int smi130_acc_set_selftest_st(struct i2c_client *client, unsigned char + selftest) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_EN_SELF_TEST__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_EN_SELF_TEST, selftest); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_EN_SELF_TEST__REG, + &data); + + return comres; +} + +static int smi130_acc_set_selftest_stn(struct i2c_client *client, unsigned char stn) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_NEG_SELF_TEST__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_NEG_SELF_TEST, stn); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_NEG_SELF_TEST__REG, + &data); + + return comres; +} + +static int smi130_acc_set_selftest_amp(struct i2c_client *client, unsigned char amp) +{ + int comres = 0; + unsigned char data = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_SELF_TEST_AMP__REG, + &data); + data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_SELF_TEST_AMP, amp); + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_SELF_TEST_AMP__REG, + &data); + + return comres; +} + +static int smi130_acc_read_accel_x(struct i2c_client *client, + signed char sensor_type, short *a_x) +{ + int comres = 0; + unsigned char data[2]; + + switch (sensor_type) { + case 0: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_X12_LSB__REG, data, 2); + *a_x = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_X12_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_X_MSB)<<(SMI_ACC2X2_ACC_X12_LSB__LEN)); + *a_x = *a_x << (sizeof(short)*8-(SMI_ACC2X2_ACC_X12_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + *a_x = *a_x >> (sizeof(short)*8-(SMI_ACC2X2_ACC_X12_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + break; + case 1: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_X10_LSB__REG, data, 2); + *a_x = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_X10_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_X_MSB)<<(SMI_ACC2X2_ACC_X10_LSB__LEN)); + *a_x = *a_x << (sizeof(short)*8-(SMI_ACC2X2_ACC_X10_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + *a_x = *a_x >> (sizeof(short)*8-(SMI_ACC2X2_ACC_X10_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + break; + case 2: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_X8_LSB__REG, data, 2); + *a_x = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_X8_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_X_MSB)<<(SMI_ACC2X2_ACC_X8_LSB__LEN)); + *a_x = *a_x << (sizeof(short)*8-(SMI_ACC2X2_ACC_X8_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + *a_x = *a_x >> (sizeof(short)*8-(SMI_ACC2X2_ACC_X8_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + break; + case 3: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_X14_LSB__REG, data, 2); + *a_x = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_X14_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_X_MSB)<<(SMI_ACC2X2_ACC_X14_LSB__LEN)); + *a_x = *a_x << (sizeof(short)*8-(SMI_ACC2X2_ACC_X14_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + *a_x = *a_x >> (sizeof(short)*8-(SMI_ACC2X2_ACC_X14_LSB__LEN + + SMI_ACC2X2_ACC_X_MSB__LEN)); + break; + default: + break; + } + + return comres; +} + +static int smi130_acc_soft_reset(struct i2c_client *client) +{ + int comres = 0; + unsigned char data = SMI_ACC2X2_EN_SOFT_RESET_VALUE; + + comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_EN_SOFT_RESET__REG, + &data); + + return comres; +} + +static int smi130_acc_read_accel_y(struct i2c_client *client, + signed char sensor_type, short *a_y) +{ + int comres = 0; + unsigned char data[2]; + + switch (sensor_type) { + case 0: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Y12_LSB__REG, data, 2); + *a_y = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Y12_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Y_MSB)<<(SMI_ACC2X2_ACC_Y12_LSB__LEN)); + *a_y = *a_y << (sizeof(short)*8-(SMI_ACC2X2_ACC_Y12_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + *a_y = *a_y >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Y12_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + break; + case 1: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Y10_LSB__REG, data, 2); + *a_y = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Y10_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Y_MSB)<<(SMI_ACC2X2_ACC_Y10_LSB__LEN)); + *a_y = *a_y << (sizeof(short)*8-(SMI_ACC2X2_ACC_Y10_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + *a_y = *a_y >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Y10_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + break; + case 2: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Y8_LSB__REG, data, 2); + *a_y = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Y8_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Y_MSB)<<(SMI_ACC2X2_ACC_Y8_LSB__LEN)); + *a_y = *a_y << (sizeof(short)*8-(SMI_ACC2X2_ACC_Y8_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + *a_y = *a_y >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Y8_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + break; + case 3: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Y14_LSB__REG, data, 2); + *a_y = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Y14_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Y_MSB)<<(SMI_ACC2X2_ACC_Y14_LSB__LEN)); + *a_y = *a_y << (sizeof(short)*8-(SMI_ACC2X2_ACC_Y14_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + *a_y = *a_y >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Y14_LSB__LEN + + SMI_ACC2X2_ACC_Y_MSB__LEN)); + break; + default: + break; + } + + return comres; +} + +static int smi130_acc_read_accel_z(struct i2c_client *client, + signed char sensor_type, short *a_z) +{ + int comres = 0; + unsigned char data[2]; + + switch (sensor_type) { + case 0: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Z12_LSB__REG, data, 2); + *a_z = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Z12_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Z_MSB)<<(SMI_ACC2X2_ACC_Z12_LSB__LEN)); + *a_z = *a_z << (sizeof(short)*8-(SMI_ACC2X2_ACC_Z12_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + *a_z = *a_z >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Z12_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + break; + case 1: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Z10_LSB__REG, data, 2); + *a_z = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Z10_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Z_MSB)<<(SMI_ACC2X2_ACC_Z10_LSB__LEN)); + *a_z = *a_z << (sizeof(short)*8-(SMI_ACC2X2_ACC_Z10_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + *a_z = *a_z >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Z10_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + break; + case 2: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Z8_LSB__REG, data, 2); + *a_z = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Z8_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Z_MSB)<<(SMI_ACC2X2_ACC_Z8_LSB__LEN)); + *a_z = *a_z << (sizeof(short)*8-(SMI_ACC2X2_ACC_Z8_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + *a_z = *a_z >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Z8_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + break; + case 3: + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_Z14_LSB__REG, data, 2); + *a_z = SMI_ACC2X2_GET_BITSLICE(data[0], SMI_ACC2X2_ACC_Z14_LSB)| + (SMI_ACC2X2_GET_BITSLICE(data[1], + SMI_ACC2X2_ACC_Z_MSB)<<(SMI_ACC2X2_ACC_Z14_LSB__LEN)); + *a_z = *a_z << (sizeof(short)*8-(SMI_ACC2X2_ACC_Z14_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + *a_z = *a_z >> (sizeof(short)*8-(SMI_ACC2X2_ACC_Z14_LSB__LEN + + SMI_ACC2X2_ACC_Z_MSB__LEN)); + break; + default: + break; + } + + return comres; +} + + +static int smi130_acc_read_temperature(struct i2c_client *client, + signed char *temperature) +{ + unsigned char data = 0; + int comres = 0; + + comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_TEMPERATURE_REG, &data); + *temperature = (signed char)data; + + return comres; +} + +static ssize_t smi130_acc_enable_int_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int type, value; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); +#ifdef CONFIG_SENSORS_BMI058 + int i; +#endif + + sscanf(buf, "%3d %3d", &type, &value); + +#ifdef CONFIG_SENSORS_BMI058 + for (i = 0; i < sizeof(int_map) / sizeof(struct interrupt_map_t); i++) { + if (int_map[i].x == type) { + type = int_map[i].y; + break; + } + if (int_map[i].y == type) { + type = int_map[i].x; + break; + } + } +#endif + + if (smi130_acc_set_Int_Enable(smi130_acc->smi130_acc_client, type, value) < 0) + return -EINVAL; + + return count; +} + + +static ssize_t smi130_acc_int_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_Int_Mode(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); +} + +static ssize_t smi130_acc_int_mode_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_Int_Mode(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) + return -EINVAL; + + return count; +} +static ssize_t smi130_acc_slope_duration_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_slope_duration(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_slope_duration_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_slope_duration(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_slope_no_mot_duration_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_slope_no_mot_duration(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_slope_no_mot_duration_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_slope_no_mot_duration(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + + +static ssize_t smi130_acc_slope_threshold_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_slope_threshold(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_slope_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_slope_threshold(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_slope_no_mot_threshold_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_slope_no_mot_threshold(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_slope_no_mot_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_slope_no_mot_threshold(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_high_g_duration_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_high_g_duration(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_high_g_duration_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_high_g_duration(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_high_g_threshold_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_high_g_threshold(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_high_g_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_high_g_threshold(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_low_g_duration_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_low_g_duration(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_low_g_duration_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_low_g_duration(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_low_g_threshold_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_low_g_threshold(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_low_g_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_low_g_threshold(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} +static ssize_t smi130_acc_tap_threshold_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_tap_threshold(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_tap_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_tap_threshold(smi130_acc->smi130_acc_client, (unsigned char)data) + < 0) + return -EINVAL; + + return count; +} +static ssize_t smi130_acc_tap_duration_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_tap_duration(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_tap_duration_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_tap_duration(smi130_acc->smi130_acc_client, (unsigned char)data) + < 0) + return -EINVAL; + + return count; +} +static ssize_t smi130_acc_tap_quiet_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_tap_quiet(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_tap_quiet_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_tap_quiet(smi130_acc->smi130_acc_client, (unsigned char)data) < + 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_tap_shock_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_tap_shock(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_tap_shock_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_tap_shock(smi130_acc->smi130_acc_client, (unsigned char)data) < + 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_tap_samp_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_tap_samp(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_tap_samp_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_tap_samp(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_orient_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_orient_mode(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_orient_mode_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_orient_mode(smi130_acc->smi130_acc_client, (unsigned char)data) < + 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_orient_blocking_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_orient_blocking(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_orient_blocking_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_orient_blocking(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} +static ssize_t smi130_acc_orient_hyst_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_orient_hyst(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_orient_hyst_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_orient_hyst(smi130_acc->smi130_acc_client, (unsigned char)data) < + 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_orient_theta_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_theta_blocking(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_orient_theta_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_theta_blocking(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_flat_theta_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_theta_flat(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_flat_theta_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_theta_flat(smi130_acc->smi130_acc_client, (unsigned char)data) < + 0) + return -EINVAL; + + return count; +} +static ssize_t smi130_acc_flat_hold_time_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_flat_hold_time(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} +static ssize_t smi130_acc_selftest_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + + + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%d\n", atomic_read(&smi130_acc->selftest_result)); + +} + +static ssize_t smi130_acc_softreset_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_soft_reset(smi130_acc->smi130_acc_client) < 0) + return -EINVAL; + + return count; +} +static ssize_t smi130_acc_selftest_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + + unsigned long data; + unsigned char clear_value = 0; + int error; + short value1 = 0; + short value2 = 0; + short diff = 0; + unsigned long result = 0; + unsigned char test_result_branch = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + smi130_acc_soft_reset(smi130_acc->smi130_acc_client); + smi130_acc_delay(5); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (data != 1) + return -EINVAL; + + smi130_acc_write_reg(smi130_acc->smi130_acc_client, 0x32, &clear_value); + + if ((smi130_acc->sensor_type == SMI_ACC280_TYPE) || + (smi130_acc->sensor_type == SMI_ACC255_TYPE)) { +#ifdef CONFIG_SENSORS_BMI058 + /*set self test amp */ + if (smi130_acc_set_selftest_amp(smi130_acc->smi130_acc_client, 1) < 0) + return -EINVAL; + /* set to 8 G range */ + if (smi130_acc_set_range(smi130_acc->smi130_acc_client, + SMI_ACC2X2_RANGE_8G) < 0) + return -EINVAL; +#else + /* set to 4 G range */ + if (smi130_acc_set_range(smi130_acc->smi130_acc_client, + SMI_ACC2X2_RANGE_4G) < 0) + return -EINVAL; +#endif + } + + if ((smi130_acc->sensor_type == SMI_ACC250E_TYPE) || + (smi130_acc->sensor_type == SMI_ACC222E_TYPE)) { + /* set to 8 G range */ + if (smi130_acc_set_range(smi130_acc->smi130_acc_client, 8) < 0) + return -EINVAL; + if (smi130_acc_set_selftest_amp(smi130_acc->smi130_acc_client, 1) < 0) + return -EINVAL; + } + + /* 1 for x-axis(but BMI058 is 1 for y-axis )*/ + smi130_acc_set_selftest_st(smi130_acc->smi130_acc_client, 1); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 0); + smi130_acc_delay(10); + smi130_acc_read_accel_x(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value1); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 1); + smi130_acc_delay(10); + smi130_acc_read_accel_x(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value2); + diff = value1-value2; + +#ifdef CONFIG_SENSORS_BMI058 + PINFO("diff y is %d,value1 is %d, value2 is %d\n", diff, + value1, value2); + test_result_branch = 2; +#else + PINFO("diff x is %d,value1 is %d, value2 is %d\n", diff, + value1, value2); + test_result_branch = 1; +#endif + + if (smi130_acc->sensor_type == SMI_ACC280_TYPE) { +#ifdef CONFIG_SENSORS_BMI058 + if (abs(diff) < 819) + result |= test_result_branch; +#else + if (abs(diff) < 1638) + result |= test_result_branch; +#endif + } + if (smi130_acc->sensor_type == SMI_ACC255_TYPE) { + if (abs(diff) < 409) + result |= 1; + } + if (smi130_acc->sensor_type == SMI_ACC250E_TYPE) { + if (abs(diff) < 51) + result |= 1; + } + if (smi130_acc->sensor_type == SMI_ACC222E_TYPE) { + if (abs(diff) < 12) + result |= 1; + } + + /* 2 for y-axis but BMI058 is 1*/ + smi130_acc_set_selftest_st(smi130_acc->smi130_acc_client, 2); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 0); + smi130_acc_delay(10); + smi130_acc_read_accel_y(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value1); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 1); + smi130_acc_delay(10); + smi130_acc_read_accel_y(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value2); + diff = value1-value2; + +#ifdef CONFIG_SENSORS_BMI058 + PINFO("diff x is %d,value1 is %d, value2 is %d\n", diff, + value1, value2); + test_result_branch = 1; +#else + PINFO("diff y is %d,value1 is %d, value2 is %d\n", diff, + value1, value2); + test_result_branch = 2; +#endif + + if (smi130_acc->sensor_type == SMI_ACC280_TYPE) { +#ifdef CONFIG_SENSORS_BMI058 + if (abs(diff) < 819) + result |= test_result_branch; +#else + if (abs(diff) < 1638) + result |= test_result_branch; +#endif + } + if (smi130_acc->sensor_type == SMI_ACC255_TYPE) { + if (abs(diff) < 409) + result |= test_result_branch; + } + if (smi130_acc->sensor_type == SMI_ACC250E_TYPE) { + if (abs(diff) < 51) + result |= test_result_branch; + } + if (smi130_acc->sensor_type == SMI_ACC222E_TYPE) { + if (abs(diff) < 12) + result |= test_result_branch; + } + + + smi130_acc_set_selftest_st(smi130_acc->smi130_acc_client, 3); /* 3 for z-axis*/ + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 0); + smi130_acc_delay(10); + smi130_acc_read_accel_z(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value1); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 1); + smi130_acc_delay(10); + smi130_acc_read_accel_z(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value2); + diff = value1-value2; + + PINFO("diff z is %d,value1 is %d, value2 is %d\n", diff, + value1, value2); + + if (smi130_acc->sensor_type == SMI_ACC280_TYPE) { +#ifdef CONFIG_SENSORS_BMI058 + if (abs(diff) < 409) + result |= 4; +#else + if (abs(diff) < 819) + result |= 4; +#endif + } + if (smi130_acc->sensor_type == SMI_ACC255_TYPE) { + if (abs(diff) < 204) + result |= 4; + } + if (smi130_acc->sensor_type == SMI_ACC250E_TYPE) { + if (abs(diff) < 25) + result |= 4; + } + if (smi130_acc->sensor_type == SMI_ACC222E_TYPE) { + if (abs(diff) < 6) + result |= 4; + } + + /* self test for smi_acc254 */ + if ((smi130_acc->sensor_type == SMI_ACC255_TYPE) && (result > 0)) { + result = 0; + smi130_acc_soft_reset(smi130_acc->smi130_acc_client); + smi130_acc_delay(5); + smi130_acc_write_reg(smi130_acc->smi130_acc_client, 0x32, &clear_value); + /* set to 8 G range */ + if (smi130_acc_set_range(smi130_acc->smi130_acc_client, 8) < 0) + return -EINVAL; + if (smi130_acc_set_selftest_amp(smi130_acc->smi130_acc_client, 1) < 0) + return -EINVAL; + + smi130_acc_set_selftest_st(smi130_acc->smi130_acc_client, 1); /* 1 + for x-axis*/ + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 0); /* + positive direction*/ + smi130_acc_delay(10); + smi130_acc_read_accel_x(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value1); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 1); /* + negative direction*/ + smi130_acc_delay(10); + smi130_acc_read_accel_x(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value2); + diff = value1-value2; + + PINFO("diff x is %d,value1 is %d, value2 is %d\n", + diff, value1, value2); + if (abs(diff) < 204) + result |= 1; + + smi130_acc_set_selftest_st(smi130_acc->smi130_acc_client, 2); /* 2 + for y-axis*/ + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 0); /* + positive direction*/ + smi130_acc_delay(10); + smi130_acc_read_accel_y(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value1); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 1); /* + negative direction*/ + smi130_acc_delay(10); + smi130_acc_read_accel_y(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value2); + diff = value1-value2; + PINFO("diff y is %d,value1 is %d, value2 is %d\n", + diff, value1, value2); + + if (abs(diff) < 204) + result |= 2; + + smi130_acc_set_selftest_st(smi130_acc->smi130_acc_client, 3); /* 3 + for z-axis*/ + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 0); /* + positive direction*/ + smi130_acc_delay(10); + smi130_acc_read_accel_z(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value1); + smi130_acc_set_selftest_stn(smi130_acc->smi130_acc_client, 1); /* + negative direction*/ + smi130_acc_delay(10); + smi130_acc_read_accel_z(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &value2); + diff = value1-value2; + + PINFO("diff z is %d,value1 is %d, value2 is %d\n", + diff, value1, value2); + if (abs(diff) < 102) + result |= 4; + } + + atomic_set(&smi130_acc->selftest_result, (unsigned int)result); + + smi130_acc_soft_reset(smi130_acc->smi130_acc_client); + smi130_acc_delay(5); + PINFO("self test finished\n"); + + return count; +} + + + +static ssize_t smi130_acc_flat_hold_time_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_flat_hold_time(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +const int smi130_acc_sensor_bitwidth[] = { + 12, 10, 8, 14 +}; + +static int smi130_acc_read_accel_xyz(struct i2c_client *client, + signed char sensor_type, struct smi130_accacc *acc) +{ + int comres = 0; + unsigned char data[6]; + struct smi130_acc_data *client_data = i2c_get_clientdata(client); +#ifndef SMI_ACC2X2_SENSOR_IDENTIFICATION_ENABLE + int bitwidth; +#endif + comres = smi130_acc_smbus_read_byte_block(client, + SMI_ACC2X2_ACC_X12_LSB__REG, data, 6); + if (sensor_type >= 4) + return -EINVAL; + + acc->x = (data[1]<<8)|data[0]; + acc->y = (data[3]<<8)|data[2]; + acc->z = (data[5]<<8)|data[4]; + +#ifndef SMI_ACC2X2_SENSOR_IDENTIFICATION_ENABLE + bitwidth = smi130_acc_sensor_bitwidth[sensor_type]; + + acc->x = (acc->x >> (16 - bitwidth)); + acc->y = (acc->y >> (16 - bitwidth)); + acc->z = (acc->z >> (16 - bitwidth)); +#endif + + smi130_acc_remap_sensor_data(acc, client_data); + return comres; +} + +#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT +static void smi130_acc_work_func(struct work_struct *work) +{ + struct smi130_acc_data *smi130_acc = container_of((struct delayed_work *)work, + struct smi130_acc_data, work); + static struct smi130_accacc acc; + unsigned long delay = msecs_to_jiffies(atomic_read(&smi130_acc->delay)); + + smi130_acc_read_accel_xyz(smi130_acc->smi130_acc_client, smi130_acc->sensor_type, &acc); + input_report_abs(smi130_acc->input, ABS_X, acc.x); + input_report_abs(smi130_acc->input, ABS_Y, acc.y); + input_report_abs(smi130_acc->input, ABS_Z, acc.z); + input_sync(smi130_acc->input); + mutex_lock(&smi130_acc->value_mutex); + smi130_acc->value = acc; + mutex_unlock(&smi130_acc->value_mutex); + schedule_delayed_work(&smi130_acc->work, delay); +} +#endif +static struct workqueue_struct *reportdata_wq; + +uint64_t smi130_acc_get_alarm_timestamp(void) +{ + uint64_t ts_ap; + struct timespec tmp_time; + get_monotonic_boottime(&tmp_time); + ts_ap = (uint64_t)tmp_time.tv_sec * 1000000000 + tmp_time.tv_nsec; + return ts_ap; +} + +#define ABS(x) ((x) > 0 ? (x) : -(x)) + +static void smi130_acc_timer_work_fun(struct work_struct *work) +{ + struct smi130_acc_data *smi130_acc = + container_of(work, + struct smi130_acc_data, report_data_work); + int i; + unsigned char count = 0; + unsigned char mode = 0; + signed char fifo_data_out[MAX_FIFO_F_LEVEL * MAX_FIFO_F_BYTES] = {0}; + unsigned char f_len = 0; + uint64_t del = 0; + uint64_t time_internal = 0; + int64_t drift_time = 0; + static uint64_t time_odr; + struct smi130_accacc acc_lsb; + struct timespec ts; + static uint32_t data_cnt; + static uint32_t pre_data_cnt; + static int64_t sample_drift_offset; + + if (smi130_acc->fifo_datasel) { + /*Select one axis data output for every fifo frame*/ + f_len = 2; + } else { + /*Select X Y Z axis data output for every fifo frame*/ + f_len = 6; + } + if (smi130_acc_get_fifo_framecount(smi130_acc->smi130_acc_client, &count) < 0) { + PERR("smi130_acc_get_fifo_framecount err\n"); + return; + } + if (count == 0) { + PERR("smi130_acc_get_fifo_framecount zero\n"); + return; + } + if (count > MAX_FIFO_F_LEVEL) { + if (smi130_acc_get_mode(smi130_acc->smi130_acc_client, &mode) < 0) { + PERR("smi130_acc_get_mode err\n"); + return; + } + if (SMI_ACC2X2_MODE_NORMAL == mode) { + PERR("smi130_acc fifo_count: %d abnormal, op_mode: %d\n", + count, mode); + count = MAX_FIFO_F_LEVEL; + } else { + /*chip already suspend or shutdown*/ + count = 0; + return; + } + } + if (smi_acc_i2c_burst_read(smi130_acc->smi130_acc_client, + SMI_ACC2X2_FIFO_DATA_OUTPUT_REG, fifo_data_out, + count * f_len) < 0) { + PERR("smi130_acc read fifo err\n"); + return; + } + smi130_acc->fifo_time = smi130_acc_get_alarm_timestamp(); + if (smi130_acc->acc_count == 0) + smi130_acc->base_time = smi130_acc->timestamp = + smi130_acc->fifo_time - (count-1) * smi130_acc->time_odr; + + smi130_acc->acc_count += count; + del = smi130_acc->fifo_time - smi130_acc->base_time; + time_internal = div64_u64(del, smi130_acc->acc_count); + + data_cnt++; + if (data_cnt == 1) + time_odr = smi130_acc->time_odr; + + if (time_internal > time_odr) { + if (time_internal - time_odr > div64_u64 (time_odr, 200)) + time_internal = time_odr + div64_u64(time_odr, 200); + } else { + if (time_odr - time_internal > div64_u64(time_odr, 200)) + time_internal = time_odr - div64_u64(time_odr, 200); + } +/* please give attation for the fifo output data format*/ + if (f_len == 6) { + /* Select X Y Z axis data output for every frame */ + for (i = 0; i < count; i++) { + if (smi130_acc->debug_level & 0x01) + printk(KERN_INFO "smi_acc time =%llu fifo_time =%llu smi_acc->count=%llu time_internal =%lld time_odr = %lld ", + smi130_acc->timestamp, smi130_acc->fifo_time, + smi130_acc->acc_count, time_internal, time_odr); + + ts = ns_to_timespec(smi130_acc->timestamp); + acc_lsb.x = + ((unsigned char)fifo_data_out[i * f_len + 1] << 8 | + (unsigned char)fifo_data_out[i * f_len + 0]); + acc_lsb.y = + ((unsigned char)fifo_data_out[i * f_len + 3] << 8 | + (unsigned char)fifo_data_out[i * f_len + 2]); + acc_lsb.z = + ((unsigned char)fifo_data_out[i * f_len + 5] << 8 | + (unsigned char)fifo_data_out[i * f_len + 4]); +#ifndef SMI_ACC2X2_SENSOR_IDENTIFICATION_ENABLE + acc_lsb.x >>= + (16 - smi130_acc_sensor_bitwidth[smi130_acc->sensor_type]); + acc_lsb.y >>= + (16 - smi130_acc_sensor_bitwidth[smi130_acc->sensor_type]); + acc_lsb.z >>= + (16 - smi130_acc_sensor_bitwidth[smi130_acc->sensor_type]); +#endif + smi130_acc_remap_sensor_data(&acc_lsb, smi130_acc); + input_event(smi130_acc->input, EV_MSC, MSC_TIME, + ts.tv_sec); + input_event(smi130_acc->input, EV_MSC, MSC_TIME, + ts.tv_nsec); + input_event(smi130_acc->input, EV_MSC, + MSC_GESTURE, acc_lsb.x); + input_event(smi130_acc->input, EV_MSC, + MSC_RAW, acc_lsb.y); + input_event(smi130_acc->input, EV_MSC, + MSC_SCAN, acc_lsb.z); + input_sync(smi130_acc->input); + smi130_acc->timestamp += + time_internal - sample_drift_offset; + } + } + drift_time = smi130_acc->timestamp - smi130_acc->fifo_time; + if (data_cnt % 20 == 0) { + if (ABS(drift_time) > div64_u64(time_odr, 5)) { + sample_drift_offset = + div64_s64(drift_time, smi130_acc->acc_count - pre_data_cnt); + pre_data_cnt = smi130_acc->acc_count; + time_odr = time_internal; + } + } + +} + +static enum hrtimer_restart reportdata_timer_fun( + struct hrtimer *hrtimer) +{ + struct smi130_acc_data *client_data = + container_of(hrtimer, struct smi130_acc_data, timer); + int32_t delay = 0; + delay = 8; + queue_work(reportdata_wq, &(client_data->report_data_work)); + /*set delay 8ms*/ + client_data->work_delay_kt = ns_to_ktime(delay*1000000); + hrtimer_forward(hrtimer, ktime_get(), client_data->work_delay_kt); + + return HRTIMER_RESTART; +} + +static ssize_t smi130_acc_enable_timer_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%d\n", smi130_acc->is_timer_running); +} + +static ssize_t smi130_acc_enable_timer_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (data) { + if (0 == smi130_acc->is_timer_running) { + hrtimer_start(&smi130_acc->timer, + ns_to_ktime(1000000), + HRTIMER_MODE_REL); + smi130_acc->base_time = 0; + smi130_acc->timestamp = 0; + smi130_acc->is_timer_running = 1; + } + } else { + if (1 == smi130_acc->is_timer_running) { + hrtimer_cancel(&smi130_acc->timer); + smi130_acc->is_timer_running = 0; + smi130_acc->base_time = 0; + smi130_acc->timestamp = 0; + smi130_acc->fifo_time = 0; + smi130_acc->acc_count = 0; + } + } + return count; +} + +static ssize_t smi130_acc_debug_level_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + err = snprintf(buf, 8, "%d\n", smi130_acc->debug_level); + return err; +} +static ssize_t smi130_acc_debug_level_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int32_t ret = 0; + unsigned long data; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + ret = kstrtoul(buf, 16, &data); + if (ret) + return ret; + smi130_acc->debug_level = (uint8_t)data; + return count; +} + +static ssize_t smi130_acc_register_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int address, value; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + sscanf(buf, "%3d %3d", &address, &value); + if (smi130_acc_write_reg(smi130_acc->smi130_acc_client, (unsigned char)address, + (unsigned char *)&value) < 0) + return -EINVAL; + return count; +} +static ssize_t smi130_acc_register_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + size_t count = 0; + u8 reg[0x40]; + int i; + + for (i = 0; i < 0x40; i++) { + smi130_acc_smbus_read_byte(smi130_acc->smi130_acc_client, i, reg+i); + + count += snprintf(&buf[count], 32, "0x%x: %d\n", i, reg[i]); + } + return count; + + +} + +static ssize_t smi130_acc_range_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_range(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); +} + +static ssize_t smi130_acc_range_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_range(smi130_acc->smi130_acc_client, (unsigned char) data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_bandwidth_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_bandwidth(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_bandwidth_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc->sensor_type == SMI_ACC280_TYPE) + if ((unsigned char) data > 14) + return -EINVAL; + + if (smi130_acc_set_bandwidth(smi130_acc->smi130_acc_client, + (unsigned char) data) < 0) + return -EINVAL; + smi130_acc->base_time = 0; + smi130_acc->acc_count = 0; + + return count; +} + +static ssize_t smi130_acc_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_mode(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 32, "%d %d\n", data, smi130_acc->smi_acc_mode_enabled); +} + +static ssize_t smi130_acc_mode_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_mode(smi130_acc->smi130_acc_client, + (unsigned char) data, SMI_ACC_ENABLED_BSX) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_value_cache_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi130_acc_data *smi130_acc = input_get_drvdata(input); + struct smi130_accacc acc_value; + + mutex_lock(&smi130_acc->value_mutex); + acc_value = smi130_acc->value; + mutex_unlock(&smi130_acc->value_mutex); + + return snprintf(buf, 96, "%d %d %d\n", acc_value.x, acc_value.y, + acc_value.z); +} + +static ssize_t smi130_acc_value_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi130_acc_data *smi130_acc = input_get_drvdata(input); + struct smi130_accacc acc_value; + + smi130_acc_read_accel_xyz(smi130_acc->smi130_acc_client, smi130_acc->sensor_type, + &acc_value); + + return snprintf(buf, 96, "%d %d %d\n", acc_value.x, acc_value.y, + acc_value.z); +} + +static ssize_t smi130_acc_delay_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%d\n", atomic_read(&smi130_acc->delay)); + +} + +static ssize_t smi130_acc_chip_id_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%u\n", smi130_acc->chip_id); + +} + + +static ssize_t smi130_acc_place_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + int place = BOSCH_SENSOR_PLACE_UNKNOWN; + + if (NULL != smi130_acc->bosch_pd) + place = smi130_acc->bosch_pd->place; + + return snprintf(buf, 16, "%d\n", place); +} + + +static ssize_t smi130_acc_delay_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (data > SMI_ACC2X2_MAX_DELAY) + data = SMI_ACC2X2_MAX_DELAY; + atomic_set(&smi130_acc->delay, (unsigned int) data); + + return count; +} + + +static ssize_t smi130_acc_enable_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%d\n", atomic_read(&smi130_acc->enable)); + +} + +static void smi130_acc_set_enable(struct device *dev, int enable) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + int pre_enable = atomic_read(&smi130_acc->enable); + + mutex_lock(&smi130_acc->enable_mutex); + if (enable) { + if (pre_enable == 0) { + smi130_acc_set_mode(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_NORMAL, SMI_ACC_ENABLED_INPUT); + + #ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + schedule_delayed_work(&smi130_acc->work, + msecs_to_jiffies(atomic_read(&smi130_acc->delay))); +#endif + atomic_set(&smi130_acc->enable, 1); + } + + } else { + if (pre_enable == 1) { + smi130_acc_set_mode(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_SUSPEND, SMI_ACC_ENABLED_INPUT); + + #ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + cancel_delayed_work_sync(&smi130_acc->work); +#endif + atomic_set(&smi130_acc->enable, 0); + } + } + mutex_unlock(&smi130_acc->enable_mutex); + +} + +static ssize_t smi130_acc_enable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if ((data == 0) || (data == 1)) + smi130_acc_set_enable(dev, data); + + return count; +} +static ssize_t smi130_acc_fast_calibration_x_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + + + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + +#ifdef CONFIG_SENSORS_BMI058 + if (smi130_acc_get_offset_target(smi130_acc->smi130_acc_client, + BMI058_OFFSET_TRIGGER_X, &data) < 0) + return -EINVAL; +#else + if (smi130_acc_get_offset_target(smi130_acc->smi130_acc_client, + SMI_ACC2X2_OFFSET_TRIGGER_X, &data) < 0) + return -EINVAL; +#endif + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_fast_calibration_x_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + signed char tmp; + unsigned char timeout = 0; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + +#ifdef CONFIG_SENSORS_BMI058 + if (smi130_acc_set_offset_target(smi130_acc->smi130_acc_client, + BMI058_OFFSET_TRIGGER_X, (unsigned char)data) < 0) + return -EINVAL; +#else + if (smi130_acc_set_offset_target(smi130_acc->smi130_acc_client, + SMI_ACC2X2_OFFSET_TRIGGER_X, (unsigned char)data) < 0) + return -EINVAL; +#endif + + if (smi130_acc_set_cal_trigger(smi130_acc->smi130_acc_client, 1) < 0) + return -EINVAL; + + do { + smi130_acc_delay(2); + smi130_acc_get_cal_ready(smi130_acc->smi130_acc_client, &tmp); + + /*PINFO("wait 2ms cal ready flag is %d\n", tmp); */ + timeout++; + if (timeout == 50) { + PINFO("get fast calibration ready error\n"); + return -EINVAL; + }; + + } while (tmp == 0); + + PINFO("x axis fast calibration finished\n"); + return count; +} + +static ssize_t smi130_acc_fast_calibration_y_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + + + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + +#ifdef CONFIG_SENSORS_BMI058 + if (smi130_acc_get_offset_target(smi130_acc->smi130_acc_client, + BMI058_OFFSET_TRIGGER_Y, &data) < 0) + return -EINVAL; +#else + if (smi130_acc_get_offset_target(smi130_acc->smi130_acc_client, + SMI_ACC2X2_OFFSET_TRIGGER_Y, &data) < 0) + return -EINVAL; +#endif + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_fast_calibration_y_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + signed char tmp; + unsigned char timeout = 0; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + +#ifdef CONFIG_SENSORS_BMI058 + if (smi130_acc_set_offset_target(smi130_acc->smi130_acc_client, + BMI058_OFFSET_TRIGGER_Y, (unsigned char)data) < 0) + return -EINVAL; +#else + if (smi130_acc_set_offset_target(smi130_acc->smi130_acc_client, + SMI_ACC2X2_OFFSET_TRIGGER_Y, (unsigned char)data) < 0) + return -EINVAL; +#endif + + if (smi130_acc_set_cal_trigger(smi130_acc->smi130_acc_client, 2) < 0) + return -EINVAL; + + do { + smi130_acc_delay(2); + smi130_acc_get_cal_ready(smi130_acc->smi130_acc_client, &tmp); + + /*PINFO("wait 2ms cal ready flag is %d\n", tmp);*/ + timeout++; + if (timeout == 50) { + PINFO("get fast calibration ready error\n"); + return -EINVAL; + }; + + } while (tmp == 0); + + PINFO("y axis fast calibration finished\n"); + return count; +} + +static ssize_t smi130_acc_fast_calibration_z_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + + + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_offset_target(smi130_acc->smi130_acc_client, 3, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_fast_calibration_z_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + signed char tmp; + unsigned char timeout = 0; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_offset_target(smi130_acc->smi130_acc_client, 3, (unsigned + char)data) < 0) + return -EINVAL; + + if (smi130_acc_set_cal_trigger(smi130_acc->smi130_acc_client, 3) < 0) + return -EINVAL; + + do { + smi130_acc_delay(2); + smi130_acc_get_cal_ready(smi130_acc->smi130_acc_client, &tmp); + + /*PINFO("wait 2ms cal ready flag is %d\n", tmp);*/ + timeout++; + if (timeout == 50) { + PINFO("get fast calibration ready error\n"); + return -EINVAL; + }; + + } while (tmp == 0); + + PINFO("z axis fast calibration finished\n"); + return count; +} + + +static ssize_t smi130_acc_SleepDur_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_sleep_duration(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_SleepDur_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_sleep_duration(smi130_acc->smi130_acc_client, + (unsigned char) data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_fifo_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_fifo_mode(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_fifo_mode_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_fifo_mode(smi130_acc->smi130_acc_client, + (unsigned char) data) < 0) + return -EINVAL; + return count; +} + + + +static ssize_t smi130_acc_fifo_trig_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_fifo_trig(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_fifo_trig_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_fifo_trig(smi130_acc->smi130_acc_client, + (unsigned char) data) < 0) + return -EINVAL; + + return count; +} + + + +static ssize_t smi130_acc_fifo_trig_src_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_fifo_trig_src(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_fifo_trig_src_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (smi130_acc_set_fifo_trig_src(smi130_acc->smi130_acc_client, + (unsigned char) data) < 0) + return -EINVAL; + + return count; +} + + +/*! + * @brief show fifo_data_sel axis definition(Android definition, not sensor HW reg). + * 0--> x, y, z axis fifo data for every frame + * 1--> only x axis fifo data for every frame + * 2--> only y axis fifo data for every frame + * 3--> only z axis fifo data for every frame + */ +static ssize_t smi130_acc_fifo_data_sel_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + signed char place = BOSCH_SENSOR_PLACE_UNKNOWN; + if (smi130_acc_get_fifo_data_sel(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + +#ifdef CONFIG_SENSORS_BMI058 +/*Update BMI058 fifo_data_sel to the SMI130_ACC common definition*/ + if (BMI058_FIFO_DAT_SEL_X == data) + data = SMI_ACC2X2_FIFO_DAT_SEL_X; + else if (BMI058_FIFO_DAT_SEL_Y == data) + data = SMI_ACC2X2_FIFO_DAT_SEL_Y; +#endif + + /*remaping fifo_dat_sel if define virtual place in BSP files*/ + if ((NULL != smi130_acc->bosch_pd) && + (BOSCH_SENSOR_PLACE_UNKNOWN != smi130_acc->bosch_pd->place)) { + place = smi130_acc->bosch_pd->place; + /* sensor with place 0 needs not to be remapped */ + if ((place > 0) && (place < MAX_AXIS_REMAP_TAB_SZ)) { + /* SMI_ACC2X2_FIFO_DAT_SEL_X: 1, Y:2, Z:3; + * but bosch_axis_remap_tab_dft[i].src_x:0, y:1, z:2 + * so we need to +1*/ + if (SMI_ACC2X2_FIFO_DAT_SEL_X == data) + data = bosch_axis_remap_tab_dft[place].src_x + 1; + else if (SMI_ACC2X2_FIFO_DAT_SEL_Y == data) + data = bosch_axis_remap_tab_dft[place].src_y + 1; + } + } + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_fifo_framecount_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + unsigned char mode; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_fifo_framecount(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + if (data > MAX_FIFO_F_LEVEL) { + + if (smi130_acc_get_mode(smi130_acc->smi130_acc_client, &mode) < 0) + return -EINVAL; + + if (SMI_ACC2X2_MODE_NORMAL == mode) { + PERR("smi130_acc fifo_count: %d abnormal, op_mode: %d", + data, mode); + data = MAX_FIFO_F_LEVEL; + } else { + /*chip already suspend or shutdown*/ + data = 0; + } + } + + return snprintf(buf, 16, "%d\n", data); +} + +static ssize_t smi130_acc_fifo_framecount_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + smi130_acc->fifo_count = (unsigned int) data; + + return count; +} + +static ssize_t smi130_acc_temperature_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_read_temperature(smi130_acc->smi130_acc_client, &data) < 0) + return -EINVAL; + + return snprintf(buf, 16, "%d\n", data); + +} + +/*! + * @brief store fifo_data_sel axis definition(Android definition, not sensor HW reg). + * 0--> x, y, z axis fifo data for every frame + * 1--> only x axis fifo data for every frame + * 2--> only y axis fifo data for every frame + * 3--> only z axis fifo data for every frame + */ +static ssize_t smi130_acc_fifo_data_sel_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + signed char place; + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + /*save fifo_data_sel(android definition)*/ + smi130_acc->fifo_datasel = (unsigned char) data; + + /*remaping fifo_dat_sel if define virtual place*/ + if ((NULL != smi130_acc->bosch_pd) && + (BOSCH_SENSOR_PLACE_UNKNOWN != smi130_acc->bosch_pd->place)) { + place = smi130_acc->bosch_pd->place; + /* sensor with place 0 needs not to be remapped */ + if ((place > 0) && (place < MAX_AXIS_REMAP_TAB_SZ)) { + /*Need X Y axis revesal sensor place: P1, P3, P5, P7 */ + /* SMI_ACC2X2_FIFO_DAT_SEL_X: 1, Y:2, Z:3; + * but bosch_axis_remap_tab_dft[i].src_x:0, y:1, z:2 + * so we need to +1*/ + if (SMI_ACC2X2_FIFO_DAT_SEL_X == data) + data = bosch_axis_remap_tab_dft[place].src_x + 1; + else if (SMI_ACC2X2_FIFO_DAT_SEL_Y == data) + data = bosch_axis_remap_tab_dft[place].src_y + 1; + } + } +#ifdef CONFIG_SENSORS_BMI058 + /*Update BMI058 fifo_data_sel to the SMI130_ACC common definition*/ + if (SMI_ACC2X2_FIFO_DAT_SEL_X == data) + data = BMI058_FIFO_DAT_SEL_X; + else if (SMI_ACC2X2_FIFO_DAT_SEL_Y == data) + data = BMI058_FIFO_DAT_SEL_Y; + +#endif + if (smi130_acc_set_fifo_data_sel(smi130_acc->smi130_acc_client, + (unsigned char) data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_fifo_data_out_frame_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char f_len = 0; + unsigned char count = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + if (smi130_acc->fifo_datasel) { + /*Select one axis data output for every fifo frame*/ + f_len = 2; + } else { + /*Select X Y Z axis data output for every fifo frame*/ + f_len = 6; + } + if (smi130_acc_get_fifo_framecount(smi130_acc->smi130_acc_client, &count) < 0) { + PERR("smi130_acc_get_fifo_framecount err\n"); + return -EINVAL; + } + if (count == 0) + return 0; + if (smi_acc_i2c_burst_read(smi130_acc->smi130_acc_client, + SMI_ACC2X2_FIFO_DATA_OUTPUT_REG, buf, + count * f_len) < 0) + return -EINVAL; + + return count * f_len; +} + +static ssize_t smi130_acc_offset_x_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_offset_x(smi130_acc->smi130_acc_client, &data) < 0) + return snprintf(buf, 48, "Read error\n"); + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_offset_x_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_offset_x(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_offset_y_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_offset_y(smi130_acc->smi130_acc_client, &data) < 0) + return snprintf(buf, 48, "Read error\n"); + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_offset_y_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_offset_y(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_offset_z_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char data = 0; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + if (smi130_acc_get_offset_z(smi130_acc->smi130_acc_client, &data) < 0) + return snprintf(buf, 48, "Read error\n"); + + return snprintf(buf, 16, "%d\n", data); + +} + +static ssize_t smi130_acc_offset_z_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if (smi130_acc_set_offset_z(smi130_acc->smi130_acc_client, (unsigned + char)data) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi130_acc_driver_version_show(struct device *dev + , struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + int ret; + + if (smi130_acc == NULL) { + printk(KERN_ERR "Invalid client_data pointer"); + return -ENODEV; + } + + ret = snprintf(buf, 128, "Driver version: %s\n", + DRIVER_VERSION); + return ret; +} + +#ifdef CONFIG_SIG_MOTION +static int smi130_acc_set_en_slope_int(struct smi130_acc_data *smi130_acc, + int en) +{ + int err; + struct i2c_client *client = smi130_acc->smi130_acc_client; + + if (en) { + /* Set the related parameters which needs to be fine tuned by + * interfaces: slope_threshold and slope_duration + */ + /*dur: 192 samples ~= 3s*/ + err = smi130_acc_set_slope_duration(client, 0x0); + err += smi130_acc_set_slope_threshold(client, 0x16); + + /*Enable the interrupts*/ + err += smi130_acc_set_Int_Enable(client, 5, 1);/*Slope X*/ + err += smi130_acc_set_Int_Enable(client, 6, 1);/*Slope Y*/ + err += smi130_acc_set_Int_Enable(client, 7, 1);/*Slope Z*/ + #ifdef SMI_ACC2X2_ENABLE_INT1 + /* TODO: SLOPE can now only be routed to INT1 pin*/ + err += smi130_acc_set_int1_pad_sel(client, PAD_SLOP); + #else + /* err += smi130_acc_set_int2_pad_sel(client, PAD_SLOP); */ + #endif + } else { + err = smi130_acc_set_Int_Enable(client, 5, 0);/*Slope X*/ + err += smi130_acc_set_Int_Enable(client, 6, 0);/*Slope Y*/ + err += smi130_acc_set_Int_Enable(client, 7, 0);/*Slope Z*/ + } + return err; +} + +static ssize_t smi130_acc_en_sig_motion_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%d\n", atomic_read(&smi130_acc->en_sig_motion)); +} + +static int smi130_acc_set_en_sig_motion(struct smi130_acc_data *smi130_acc, + int en) +{ + int err = 0; + + en = (en >= 1) ? 1 : 0; /* set sig motion sensor status */ + + if (atomic_read(&smi130_acc->en_sig_motion) != en) { + if (en) { + err = smi130_acc_set_mode(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_NORMAL, SMI_ACC_ENABLED_SGM); + err = smi130_acc_set_en_slope_int(smi130_acc, en); + enable_irq_wake(smi130_acc->IRQ); + } else { + disable_irq_wake(smi130_acc->IRQ); + err = smi130_acc_set_en_slope_int(smi130_acc, en); + err = smi130_acc_set_mode(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_SUSPEND, SMI_ACC_ENABLED_SGM); + } + atomic_set(&smi130_acc->en_sig_motion, en); + } + return err; +} + +static ssize_t smi130_acc_en_sig_motion_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if ((data == 0) || (data == 1)) + smi130_acc_set_en_sig_motion(smi130_acc, data); + + return count; +} +#endif + +#ifdef CONFIG_DOUBLE_TAP +static int smi130_acc_set_en_single_tap_int(struct smi130_acc_data *smi130_acc, int en) +{ + int err; + struct i2c_client *client = smi130_acc->smi130_acc_client; + + if (en) { + /* set tap interruption parameter here if needed. + smi130_acc_set_tap_duration(client, 0xc0); + smi130_acc_set_tap_threshold(client, 0x16); + */ + + /*Enable the single tap interrupts*/ + err = smi130_acc_set_Int_Enable(client, 8, 1); + #ifdef SMI_ACC2X2_ENABLE_INT1 + err += smi130_acc_set_int1_pad_sel(client, PAD_SINGLE_TAP); + #else + err += smi130_acc_set_int2_pad_sel(client, PAD_SINGLE_TAP); + #endif + } else { + err = smi130_acc_set_Int_Enable(client, 8, 0); + } + return err; +} + +static ssize_t smi130_acc_tap_time_period_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%d\n", smi130_acc->tap_time_period); +} + +static ssize_t smi130_acc_tap_time_period_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + smi130_acc->tap_time_period = data; + + return count; +} + +static ssize_t smi130_acc_en_double_tap_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + return snprintf(buf, 16, "%d\n", atomic_read(&smi130_acc->en_double_tap)); +} + +static int smi130_acc_set_en_double_tap(struct smi130_acc_data *smi130_acc, + int en) +{ + int err = 0; + + en = (en >= 1) ? 1 : 0; + + if (atomic_read(&smi130_acc->en_double_tap) != en) { + if (en) { + err = smi130_acc_set_mode(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_NORMAL, SMI_ACC_ENABLED_DTAP); + err = smi130_acc_set_en_single_tap_int(smi130_acc, en); + } else { + err = smi130_acc_set_en_single_tap_int(smi130_acc, en); + err = smi130_acc_set_mode(smi130_acc->smi130_acc_client, + SMI_ACC2X2_MODE_SUSPEND, SMI_ACC_ENABLED_DTAP); + } + atomic_set(&smi130_acc->en_double_tap, en); + } + return err; +} + +static ssize_t smi130_acc_en_double_tap_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct i2c_client *client = to_i2c_client(dev); + struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); + + error = kstrtoul(buf, 10, &data); + if (error) + return error; + + if ((data == 0) || (data == 1)) + smi130_acc_set_en_double_tap(smi130_acc, data); + + return count; +} + +static void smi130_acc_tap_timeout_handle(unsigned long data) +{ + struct smi130_acc_data *smi130_acc = (struct smi130_acc_data *)data; + + PINFO("tap interrupt handle, timeout\n"); + mutex_lock(&smi130_acc->tap_mutex); + smi130_acc->tap_times = 0; + mutex_unlock(&smi130_acc->tap_mutex); + + /* if a single tap need to report, open the define */ +#ifdef REPORT_SINGLE_TAP_WHEN_DOUBLE_TAP_SENSOR_ENABLED + input_report_rel(smi130_acc->dev_interrupt, + SINGLE_TAP_INTERRUPT, + SINGLE_TAP_INTERRUPT_HAPPENED); + input_sync(smi130_acc->dev_interrupt); +#endif + +} +#endif + +static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, + smi130_acc_range_show, smi130_acc_range_store); +static DEVICE_ATTR(bandwidth, S_IRUGO | S_IWUSR, + smi130_acc_bandwidth_show, smi130_acc_bandwidth_store); +static DEVICE_ATTR(op_mode, S_IRUGO | S_IWUSR, + smi130_acc_mode_show, smi130_acc_mode_store); +static DEVICE_ATTR(value, S_IRUSR, + smi130_acc_value_show, NULL); +static DEVICE_ATTR(value_cache, S_IRUSR, + smi130_acc_value_cache_show, NULL); +static DEVICE_ATTR(delay, S_IRUGO | S_IWUSR, + smi130_acc_delay_show, smi130_acc_delay_store); +static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, + smi130_acc_enable_show, smi130_acc_enable_store); +static DEVICE_ATTR(SleepDur, S_IRUGO | S_IWUSR, + smi130_acc_SleepDur_show, smi130_acc_SleepDur_store); +static DEVICE_ATTR(fast_calibration_x, S_IRUGO | S_IWUSR, + smi130_acc_fast_calibration_x_show, + smi130_acc_fast_calibration_x_store); +static DEVICE_ATTR(fast_calibration_y, S_IRUGO | S_IWUSR, + smi130_acc_fast_calibration_y_show, + smi130_acc_fast_calibration_y_store); +static DEVICE_ATTR(fast_calibration_z, S_IRUGO | S_IWUSR, + smi130_acc_fast_calibration_z_show, + smi130_acc_fast_calibration_z_store); +static DEVICE_ATTR(fifo_mode, S_IRUGO | S_IWUSR, + smi130_acc_fifo_mode_show, smi130_acc_fifo_mode_store); +static DEVICE_ATTR(fifo_framecount, S_IRUGO | S_IWUSR, + smi130_acc_fifo_framecount_show, smi130_acc_fifo_framecount_store); +static DEVICE_ATTR(fifo_trig, S_IRUGO | S_IWUSR, + smi130_acc_fifo_trig_show, smi130_acc_fifo_trig_store); +static DEVICE_ATTR(fifo_trig_src, S_IRUGO | S_IWUSR, + smi130_acc_fifo_trig_src_show, smi130_acc_fifo_trig_src_store); +static DEVICE_ATTR(fifo_data_sel, S_IRUGO | S_IWUSR, + smi130_acc_fifo_data_sel_show, smi130_acc_fifo_data_sel_store); +static DEVICE_ATTR(fifo_data_frame, S_IRUGO, + smi130_acc_fifo_data_out_frame_show, NULL); +static DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, + smi130_acc_register_show, smi130_acc_register_store); +static DEVICE_ATTR(chip_id, S_IRUSR, + smi130_acc_chip_id_show, NULL); +static DEVICE_ATTR(offset_x, S_IRUGO | S_IWUSR, + smi130_acc_offset_x_show, + smi130_acc_offset_x_store); +static DEVICE_ATTR(offset_y, S_IRUGO | S_IWUSR, + smi130_acc_offset_y_show, + smi130_acc_offset_y_store); +static DEVICE_ATTR(offset_z, S_IRUGO | S_IWUSR, + smi130_acc_offset_z_show, + smi130_acc_offset_z_store); +static DEVICE_ATTR(enable_int, S_IWUSR, + NULL, smi130_acc_enable_int_store); +static DEVICE_ATTR(int_mode, S_IRUGO | S_IWUSR, + smi130_acc_int_mode_show, smi130_acc_int_mode_store); +static DEVICE_ATTR(slope_duration, S_IRUGO | S_IWUSR, + smi130_acc_slope_duration_show, smi130_acc_slope_duration_store); +static DEVICE_ATTR(slope_threshold, S_IRUGO | S_IWUSR, + smi130_acc_slope_threshold_show, smi130_acc_slope_threshold_store); +static DEVICE_ATTR(slope_no_mot_duration, S_IRUGO | S_IWUSR, + smi130_acc_slope_no_mot_duration_show, + smi130_acc_slope_no_mot_duration_store); +static DEVICE_ATTR(slope_no_mot_threshold, S_IRUGO | S_IWUSR, + smi130_acc_slope_no_mot_threshold_show, + smi130_acc_slope_no_mot_threshold_store); +static DEVICE_ATTR(high_g_duration, S_IRUGO | S_IWUSR, + smi130_acc_high_g_duration_show, smi130_acc_high_g_duration_store); +static DEVICE_ATTR(high_g_threshold, S_IRUGO | S_IWUSR, + smi130_acc_high_g_threshold_show, smi130_acc_high_g_threshold_store); +static DEVICE_ATTR(low_g_duration, S_IRUGO | S_IWUSR, + smi130_acc_low_g_duration_show, smi130_acc_low_g_duration_store); +static DEVICE_ATTR(low_g_threshold, S_IRUGO | S_IWUSR, + smi130_acc_low_g_threshold_show, smi130_acc_low_g_threshold_store); +static DEVICE_ATTR(tap_duration, S_IRUGO | S_IWUSR, + smi130_acc_tap_duration_show, smi130_acc_tap_duration_store); +static DEVICE_ATTR(tap_threshold, S_IRUGO | S_IWUSR, + smi130_acc_tap_threshold_show, smi130_acc_tap_threshold_store); +static DEVICE_ATTR(tap_quiet, S_IRUGO | S_IWUSR, + smi130_acc_tap_quiet_show, smi130_acc_tap_quiet_store); +static DEVICE_ATTR(tap_shock, S_IRUGO | S_IWUSR, + smi130_acc_tap_shock_show, smi130_acc_tap_shock_store); +static DEVICE_ATTR(tap_samp, S_IRUGO | S_IWUSR, + smi130_acc_tap_samp_show, smi130_acc_tap_samp_store); +static DEVICE_ATTR(orient_mode, S_IRUGO | S_IWUSR, + smi130_acc_orient_mode_show, smi130_acc_orient_mode_store); +static DEVICE_ATTR(orient_blocking, S_IRUGO | S_IWUSR, + smi130_acc_orient_blocking_show, smi130_acc_orient_blocking_store); +static DEVICE_ATTR(orient_hyst, S_IRUGO | S_IWUSR, + smi130_acc_orient_hyst_show, smi130_acc_orient_hyst_store); +static DEVICE_ATTR(orient_theta, S_IRUGO | S_IWUSR, + smi130_acc_orient_theta_show, smi130_acc_orient_theta_store); +static DEVICE_ATTR(flat_theta, S_IRUGO | S_IWUSR, + smi130_acc_flat_theta_show, smi130_acc_flat_theta_store); +static DEVICE_ATTR(flat_hold_time, S_IRUGO | S_IWUSR, + smi130_acc_flat_hold_time_show, smi130_acc_flat_hold_time_store); +static DEVICE_ATTR(selftest, S_IRUGO | S_IWUSR, + smi130_acc_selftest_show, smi130_acc_selftest_store); +static DEVICE_ATTR(softreset, S_IWUSR, + NULL, smi130_acc_softreset_store); +static DEVICE_ATTR(enable_timer, S_IRUGO | S_IWUSR, + smi130_acc_enable_timer_show, smi130_acc_enable_timer_store); +static DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR, + smi130_acc_debug_level_show, smi130_acc_debug_level_store); +static DEVICE_ATTR(temperature, S_IRUSR, + smi130_acc_temperature_show, NULL); +static DEVICE_ATTR(place, S_IRUSR, + smi130_acc_place_show, NULL); +static DEVICE_ATTR(driver_version, S_IRUSR, + smi130_acc_driver_version_show, NULL); + +#ifdef CONFIG_SIG_MOTION +static DEVICE_ATTR(en_sig_motion, S_IRUGO|S_IWUSR|S_IWGRP|S_IWOTH, + smi130_acc_en_sig_motion_show, smi130_acc_en_sig_motion_store); +#endif +#ifdef CONFIG_DOUBLE_TAP +static DEVICE_ATTR(tap_time_period, S_IRUGO|S_IWUSR|S_IWGRP|S_IWOTH, + smi130_acc_tap_time_period_show, smi130_acc_tap_time_period_store); +static DEVICE_ATTR(en_double_tap, S_IRUGO|S_IWUSR|S_IWGRP|S_IWOTH, + smi130_acc_en_double_tap_show, smi130_acc_en_double_tap_store); +#endif + +static struct attribute *smi130_acc_attributes[] = { + &dev_attr_range.attr, + &dev_attr_bandwidth.attr, + &dev_attr_op_mode.attr, + &dev_attr_value.attr, + &dev_attr_value_cache.attr, + &dev_attr_delay.attr, + &dev_attr_enable.attr, + &dev_attr_SleepDur.attr, + &dev_attr_reg.attr, + &dev_attr_fast_calibration_x.attr, + &dev_attr_fast_calibration_y.attr, + &dev_attr_fast_calibration_z.attr, + &dev_attr_fifo_mode.attr, + &dev_attr_fifo_framecount.attr, + &dev_attr_fifo_trig.attr, + &dev_attr_fifo_trig_src.attr, + &dev_attr_fifo_data_sel.attr, + &dev_attr_fifo_data_frame.attr, + &dev_attr_chip_id.attr, + &dev_attr_offset_x.attr, + &dev_attr_offset_y.attr, + &dev_attr_offset_z.attr, + &dev_attr_enable_int.attr, + &dev_attr_enable_timer.attr, + &dev_attr_debug_level.attr, + &dev_attr_int_mode.attr, + &dev_attr_slope_duration.attr, + &dev_attr_slope_threshold.attr, + &dev_attr_slope_no_mot_duration.attr, + &dev_attr_slope_no_mot_threshold.attr, + &dev_attr_high_g_duration.attr, + &dev_attr_high_g_threshold.attr, + &dev_attr_low_g_duration.attr, + &dev_attr_low_g_threshold.attr, + &dev_attr_tap_threshold.attr, + &dev_attr_tap_duration.attr, + &dev_attr_tap_quiet.attr, + &dev_attr_tap_shock.attr, + &dev_attr_tap_samp.attr, + &dev_attr_orient_mode.attr, + &dev_attr_orient_blocking.attr, + &dev_attr_orient_hyst.attr, + &dev_attr_orient_theta.attr, + &dev_attr_flat_theta.attr, + &dev_attr_flat_hold_time.attr, + &dev_attr_selftest.attr, + &dev_attr_softreset.attr, + &dev_attr_temperature.attr, + &dev_attr_place.attr, + &dev_attr_driver_version.attr, +#ifdef CONFIG_SIG_MOTION + &dev_attr_en_sig_motion.attr, +#endif +#ifdef CONFIG_DOUBLE_TAP + &dev_attr_en_double_tap.attr, +#endif + + NULL +}; + +static struct attribute_group smi130_acc_attribute_group = { + .attrs = smi130_acc_attributes +}; + +#ifdef CONFIG_SIG_MOTION +static struct attribute *smi130_acc_sig_motion_attributes[] = { + &dev_attr_slope_duration.attr, + &dev_attr_slope_threshold.attr, + &dev_attr_en_sig_motion.attr, + NULL +}; +static struct attribute_group smi130_acc_sig_motion_attribute_group = { + .attrs = smi130_acc_sig_motion_attributes +}; +#endif + +#ifdef CONFIG_DOUBLE_TAP +static struct attribute *smi130_acc_double_tap_attributes[] = { + &dev_attr_tap_threshold.attr, + &dev_attr_tap_duration.attr, + &dev_attr_tap_quiet.attr, + &dev_attr_tap_shock.attr, + &dev_attr_tap_samp.attr, + &dev_attr_tap_time_period.attr, + &dev_attr_en_double_tap.attr, + NULL +}; +static struct attribute_group smi130_acc_double_tap_attribute_group = { + .attrs = smi130_acc_double_tap_attributes +}; +#endif + + +#if defined(SMI_ACC2X2_ENABLE_INT1) || defined(SMI_ACC2X2_ENABLE_INT2) +unsigned char *orient[] = {"upward looking portrait upright", + "upward looking portrait upside-down", + "upward looking landscape left", + "upward looking landscape right", + "downward looking portrait upright", + "downward looking portrait upside-down", + "downward looking landscape left", + "downward looking landscape right"}; + + +static void smi130_acc_high_g_interrupt_handle(struct smi130_acc_data *smi130_acc) +{ + unsigned char first_value = 0; + unsigned char sign_value = 0; + int i; + + for (i = 0; i < 3; i++) { + smi130_acc_get_HIGH_first(smi130_acc->smi130_acc_client, i, &first_value); + if (first_value == 1) { + smi130_acc_get_HIGH_sign(smi130_acc->smi130_acc_client, + &sign_value); + if (sign_value == 1) { + if (i == 0) + input_report_rel(smi130_acc->dev_interrupt, + HIGH_G_INTERRUPT, + HIGH_G_INTERRUPT_X_N); + if (i == 1) + input_report_rel(smi130_acc->dev_interrupt, + HIGH_G_INTERRUPT, + HIGH_G_INTERRUPT_Y_N); + if (i == 2) + input_report_rel(smi130_acc->dev_interrupt, + HIGH_G_INTERRUPT, + HIGH_G_INTERRUPT_Z_N); + } else { + if (i == 0) + input_report_rel(smi130_acc->dev_interrupt, + HIGH_G_INTERRUPT, + HIGH_G_INTERRUPT_X); + if (i == 1) + input_report_rel(smi130_acc->dev_interrupt, + HIGH_G_INTERRUPT, + HIGH_G_INTERRUPT_Y); + if (i == 2) + input_report_rel(smi130_acc->dev_interrupt, + HIGH_G_INTERRUPT, + HIGH_G_INTERRUPT_Z); + } + } + + PINFO("High G interrupt happened,exis is %d,\n\n" + "first is %d,sign is %d\n", i, + first_value, sign_value); + } + + +} + +#ifndef CONFIG_SIG_MOTION +static void smi130_acc_slope_interrupt_handle(struct smi130_acc_data *smi130_acc) +{ + unsigned char first_value = 0; + unsigned char sign_value = 0; + int i; + for (i = 0; i < 3; i++) { + smi130_acc_get_slope_first(smi130_acc->smi130_acc_client, i, &first_value); + if (first_value == 1) { + smi130_acc_get_slope_sign(smi130_acc->smi130_acc_client, + &sign_value); + if (sign_value == 1) { + if (i == 0) + input_report_rel(smi130_acc->dev_interrupt, + SLOP_INTERRUPT, + SLOPE_INTERRUPT_X_N); + if (i == 1) + input_report_rel(smi130_acc->dev_interrupt, + SLOP_INTERRUPT, + SLOPE_INTERRUPT_Y_N); + if (i == 2) + input_report_rel(smi130_acc->dev_interrupt, + SLOP_INTERRUPT, + SLOPE_INTERRUPT_Z_N); + } else { + if (i == 0) + input_report_rel(smi130_acc->dev_interrupt, + SLOP_INTERRUPT, + SLOPE_INTERRUPT_X); + if (i == 1) + input_report_rel(smi130_acc->dev_interrupt, + SLOP_INTERRUPT, + SLOPE_INTERRUPT_Y); + if (i == 2) + input_report_rel(smi130_acc->dev_interrupt, + SLOP_INTERRUPT, + SLOPE_INTERRUPT_Z); + + } + } + + PINFO("Slop interrupt happened,exis is %d,\n\n" + "first is %d,sign is %d\n", i, + first_value, sign_value); + } +} +#endif + +static void smi130_acc_irq_work_func(struct work_struct *work) +{ + struct smi130_acc_data *smi130_acc = container_of((struct work_struct *)work, + struct smi130_acc_data, irq_work); +#ifdef CONFIG_DOUBLE_TAP + struct i2c_client *client = smi130_acc->smi130_acc_client; +#endif + + unsigned char status = 0; + unsigned char first_value = 0; + unsigned char sign_value = 0; + +#ifdef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + static struct smi130_accacc acc; + struct timespec ts; + /* + do not use this function judge new data interrupt + smi130_acc_get_interruptstatus2(smi130_acc->smi130_acc_client, &status); + use the + x-axis value bit new_data_x + y-axis value bit new_data_y + z-axis value bit new_data_z + judge if this is the new data + */ + /* PINFO("New data interrupt happened\n");*/ + smi130_acc_read_accel_xyz(smi130_acc->smi130_acc_client, + smi130_acc->sensor_type, &acc); + ts = ns_to_timespec(smi130_acc->timestamp); + //if ((acc.x & SMI_ACC2X2_NEW_DATA_X__MSK) && + // (acc.y & SMI_ACC2X2_NEW_DATA_Y__MSK) && + // (acc.x & SMI_ACC2X2_NEW_DATA_Z__MSK)) + { + input_event(smi130_acc->input, EV_MSC, MSC_TIME, + ts.tv_sec); + input_event(smi130_acc->input, EV_MSC, MSC_TIME, + ts.tv_nsec); + input_event(smi130_acc->input, EV_MSC, + MSC_GESTURE, acc.x); + input_event(smi130_acc->input, EV_MSC, + MSC_RAW, acc.y); + input_event(smi130_acc->input, EV_MSC, + MSC_SCAN, acc.z); + input_sync(smi130_acc->input); + mutex_lock(&smi130_acc->value_mutex); + smi130_acc->value = acc; + mutex_unlock(&smi130_acc->value_mutex); + } +#endif + + smi130_acc_get_interruptstatus1(smi130_acc->smi130_acc_client, &status); + PINFO("smi130_acc_irq_work_func, status = 0x%x\n", status); + +#ifdef CONFIG_SIG_MOTION + if (status & 0x04) { + if (atomic_read(&smi130_acc->en_sig_motion) == 1) { + PINFO("Significant motion interrupt happened\n"); + /* close sig sensor, + it will be open again if APP wants */ + smi130_acc_set_en_sig_motion(smi130_acc, 0); + + input_report_rel(smi130_acc->dev_interrupt, + SLOP_INTERRUPT, 1); + input_sync(smi130_acc->dev_interrupt); + } + } +#endif + +#ifdef CONFIG_DOUBLE_TAP + if (status & 0x20) { + if (atomic_read(&smi130_acc->en_double_tap) == 1) { + PINFO("single tap interrupt happened\n"); + smi130_acc_set_Int_Enable(client, 8, 0); + if (smi130_acc->tap_times == 0) { + mod_timer(&smi130_acc->tap_timer, jiffies + + msecs_to_jiffies(smi130_acc->tap_time_period)); + smi130_acc->tap_times = 1; + } else { + /* only double tap is judged */ + PINFO("double tap\n"); + mutex_lock(&smi130_acc->tap_mutex); + smi130_acc->tap_times = 0; + del_timer(&smi130_acc->tap_timer); + mutex_unlock(&smi130_acc->tap_mutex); + input_report_rel(smi130_acc->dev_interrupt, + DOUBLE_TAP_INTERRUPT, + DOUBLE_TAP_INTERRUPT_HAPPENED); + input_sync(smi130_acc->dev_interrupt); + } + smi130_acc_set_Int_Enable(client, 8, 1); + } + } +#endif + + switch (status) { + + case 0x01: + PINFO("Low G interrupt happened\n"); + input_report_rel(smi130_acc->dev_interrupt, LOW_G_INTERRUPT, + LOW_G_INTERRUPT_HAPPENED); + break; + + case 0x02: + smi130_acc_high_g_interrupt_handle(smi130_acc); + break; + +#ifndef CONFIG_SIG_MOTION + case 0x04: + smi130_acc_slope_interrupt_handle(smi130_acc); + break; +#endif + + case 0x08: + PINFO("slow/ no motion interrupt happened\n"); + input_report_rel(smi130_acc->dev_interrupt, + SLOW_NO_MOTION_INTERRUPT, + SLOW_NO_MOTION_INTERRUPT_HAPPENED); + break; + +#ifndef CONFIG_DOUBLE_TAP + case 0x10: + PINFO("double tap interrupt happened\n"); + input_report_rel(smi130_acc->dev_interrupt, + DOUBLE_TAP_INTERRUPT, + DOUBLE_TAP_INTERRUPT_HAPPENED); + break; + case 0x20: + PINFO("single tap interrupt happened\n"); + input_report_rel(smi130_acc->dev_interrupt, + SINGLE_TAP_INTERRUPT, + SINGLE_TAP_INTERRUPT_HAPPENED); + break; +#endif + + case 0x40: + smi130_acc_get_orient_status(smi130_acc->smi130_acc_client, + &first_value); + PINFO("orient interrupt happened,%s\n", + orient[first_value]); + if (first_value == 0) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + UPWARD_PORTRAIT_UP_INTERRUPT_HAPPENED); + else if (first_value == 1) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + UPWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED); + else if (first_value == 2) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + UPWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED); + else if (first_value == 3) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + UPWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED); + else if (first_value == 4) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + DOWNWARD_PORTRAIT_UP_INTERRUPT_HAPPENED); + else if (first_value == 5) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + DOWNWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED); + else if (first_value == 6) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + DOWNWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED); + else if (first_value == 7) + input_report_abs(smi130_acc->dev_interrupt, + ORIENT_INTERRUPT, + DOWNWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED); + break; + case 0x80: + smi130_acc_get_orient_flat_status(smi130_acc->smi130_acc_client, + &sign_value); + PINFO("flat interrupt happened,flat status is %d\n", + sign_value); + if (sign_value == 1) { + input_report_abs(smi130_acc->dev_interrupt, + FLAT_INTERRUPT, + FLAT_INTERRUPT_TURE_HAPPENED); + } else { + input_report_abs(smi130_acc->dev_interrupt, + FLAT_INTERRUPT, + FLAT_INTERRUPT_FALSE_HAPPENED); + } + break; + + default: + break; + } +} + +static irqreturn_t smi130_acc_irq_handler(int irq, void *handle) +{ + struct smi130_acc_data *data = handle; + + if (data == NULL) + return IRQ_HANDLED; + if (data->smi130_acc_client == NULL) + return IRQ_HANDLED; + data->timestamp = smi130_acc_get_alarm_timestamp(); + + schedule_work(&data->irq_work); + + return IRQ_HANDLED; +} +#endif /* defined(SMI_ACC2X2_ENABLE_INT1)||defined(SMI_ACC2X2_ENABLE_INT2) */ + + +static int smi130_acc_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + int err = 0; + struct smi130_acc_data *data; + struct input_dev *dev; + struct bosch_dev *dev_acc; +#if defined(SMI_ACC2X2_ENABLE_INT1) || defined(SMI_ACC2X2_ENABLE_INT2) + struct bosch_sensor_specific *pdata; +#endif + struct input_dev *dev_interrupt; + + PINFO("smi130_acc_probe start\n"); + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + PERR("i2c_check_functionality error\n"); + err = -EIO; + goto exit; + } + data = kzalloc(sizeof(struct smi130_acc_data), GFP_KERNEL); + if (!data) { + err = -ENOMEM; + goto exit; + } + + /* read and check chip id */ + if (smi130_acc_check_chip_id(client, data) < 0) { + err = -EINVAL; + goto kfree_exit; + } + + /* do soft reset */ + smi130_acc_delay(5); + if (smi130_acc_soft_reset(client) < 0) { + PERR("i2c bus write error, pls check HW connection\n"); + err = -EINVAL; + goto kfree_exit; + } + smi130_acc_delay(20); + + i2c_set_clientdata(client, data); + data->smi130_acc_client = client; + mutex_init(&data->value_mutex); + mutex_init(&data->mode_mutex); + mutex_init(&data->enable_mutex); + smi130_acc_set_bandwidth(client, SMI_ACC2X2_BW_SET); + smi130_acc_set_range(client, SMI_ACC2X2_RANGE_SET); + +#if defined(SMI_ACC2X2_ENABLE_INT1) || defined(SMI_ACC2X2_ENABLE_INT2) + + pdata = client->dev.platform_data; + if (pdata) { + if (pdata->irq_gpio_cfg && (pdata->irq_gpio_cfg() < 0)) { + PERR("IRQ GPIO conf. error %d\n", + client->irq); + } + } + +#ifdef SMI_ACC2X2_ENABLE_INT1 + /* maps interrupt to INT1 pin */ + smi130_acc_set_int1_pad_sel(client, PAD_LOWG); + smi130_acc_set_int1_pad_sel(client, PAD_HIGHG); + smi130_acc_set_int1_pad_sel(client, PAD_SLOP); + smi130_acc_set_int1_pad_sel(client, PAD_DOUBLE_TAP); + smi130_acc_set_int1_pad_sel(client, PAD_SINGLE_TAP); + smi130_acc_set_int1_pad_sel(client, PAD_ORIENT); + smi130_acc_set_int1_pad_sel(client, PAD_FLAT); + smi130_acc_set_int1_pad_sel(client, PAD_SLOW_NO_MOTION); +#ifdef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + smi130_acc_set_newdata(client, SMI_ACC2X2_INT1_NDATA, 1); + smi130_acc_set_newdata(client, SMI_ACC2X2_INT2_NDATA, 0); +#endif +#endif + +#ifdef SMI_ACC2X2_ENABLE_INT2 + /* maps interrupt to INT2 pin */ + smi130_acc_set_int2_pad_sel(client, PAD_LOWG); + smi130_acc_set_int2_pad_sel(client, PAD_HIGHG); + smi130_acc_set_int2_pad_sel(client, PAD_SLOP); + smi130_acc_set_int2_pad_sel(client, PAD_DOUBLE_TAP); + smi130_acc_set_int2_pad_sel(client, PAD_SINGLE_TAP); + smi130_acc_set_int2_pad_sel(client, PAD_ORIENT); + smi130_acc_set_int2_pad_sel(client, PAD_FLAT); + smi130_acc_set_int2_pad_sel(client, PAD_SLOW_NO_MOTION); +#ifdef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + smi130_acc_set_newdata(client, SMI_ACC2X2_INT1_NDATA, 0); + smi130_acc_set_newdata(client, SMI_ACC2X2_INT2_NDATA, 1); +#endif +#endif + + smi130_acc_set_Int_Mode(client, 1);/*latch interrupt 250ms*/ + + /* do not open any interrupt here */ + /*10,orient + 11,flat*/ + /* smi130_acc_set_Int_Enable(client, 10, 1); */ + /* smi130_acc_set_Int_Enable(client, 11, 1); */ + +#ifdef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + /* enable new data interrupt */ + smi130_acc_set_Int_Enable(client, 4, 1); +#endif + +#ifdef CONFIG_SIG_MOTION + enable_irq_wake(data->IRQ); +#endif + if (err) + PERR("could not request irq\n"); + + INIT_WORK(&data->irq_work, smi130_acc_irq_work_func); +#endif + +#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + INIT_DELAYED_WORK(&data->work, smi130_acc_work_func); +#endif + atomic_set(&data->delay, SMI_ACC2X2_MAX_DELAY); + atomic_set(&data->enable, 0); + + dev = input_allocate_device(); + if (!dev) + return -ENOMEM; + + dev_interrupt = input_allocate_device(); + if (!dev_interrupt) { + kfree(data); + input_free_device(dev); /*free the successful dev and return*/ + return -ENOMEM; + } + + /* only value events reported */ + dev->name = SENSOR_NAME; + dev->id.bustype = BUS_I2C; + input_set_capability(dev, EV_ABS, ABS_MISC); + input_set_abs_params(dev, ABS_X, ABSMIN, ABSMAX, 0, 0); + input_set_abs_params(dev, ABS_Y, ABSMIN, ABSMAX, 0, 0); + input_set_abs_params(dev, ABS_Z, ABSMIN, ABSMAX, 0, 0); + input_set_capability(dev, EV_MSC, MSC_GESTURE); + input_set_capability(dev, EV_MSC, MSC_RAW); + input_set_capability(dev, EV_MSC, MSC_SCAN); + input_set_capability(dev, EV_MSC, MSC_TIME); + input_set_drvdata(dev, data); + err = input_register_device(dev); + if (err < 0) + goto err_register_input_device; + + /* all interrupt generated events are moved to interrupt input devices*/ + dev_interrupt->name = "smi_acc_interrupt"; + dev_interrupt->id.bustype = BUS_I2C; + input_set_capability(dev_interrupt, EV_REL, + SLOW_NO_MOTION_INTERRUPT); + input_set_capability(dev_interrupt, EV_REL, + LOW_G_INTERRUPT); + input_set_capability(dev_interrupt, EV_REL, + HIGH_G_INTERRUPT); + input_set_capability(dev_interrupt, EV_REL, + SLOP_INTERRUPT); + input_set_capability(dev_interrupt, EV_REL, + DOUBLE_TAP_INTERRUPT); + input_set_capability(dev_interrupt, EV_REL, + SINGLE_TAP_INTERRUPT); + input_set_capability(dev_interrupt, EV_ABS, + ORIENT_INTERRUPT); + input_set_capability(dev_interrupt, EV_ABS, + FLAT_INTERRUPT); + input_set_drvdata(dev_interrupt, data); + + err = input_register_device(dev_interrupt); + if (err < 0) + goto err_register_input_device_interrupt; + + data->dev_interrupt = dev_interrupt; + data->input = dev; + +#ifdef CONFIG_SIG_MOTION + data->g_sensor_class = class_create(THIS_MODULE, "sig_sensor"); + if (IS_ERR(data->g_sensor_class)) { + err = PTR_ERR(data->g_sensor_class); + data->g_sensor_class = NULL; + PERR("could not allocate g_sensor_class\n"); + goto err_create_class; + } + + data->g_sensor_dev = device_create(data->g_sensor_class, + NULL, 0, "%s", "g_sensor"); + if (unlikely(IS_ERR(data->g_sensor_dev))) { + err = PTR_ERR(data->g_sensor_dev); + data->g_sensor_dev = NULL; + + PERR("could not allocate g_sensor_dev\n"); + goto err_create_g_sensor_device; + } + + dev_set_drvdata(data->g_sensor_dev, data); + + err = sysfs_create_group(&data->g_sensor_dev->kobj, + &smi130_acc_sig_motion_attribute_group); + if (err < 0) + goto error_sysfs; +#endif + +#ifdef CONFIG_DOUBLE_TAP + data->g_sensor_class_doubletap = + class_create(THIS_MODULE, "dtap_sensor"); + if (IS_ERR(data->g_sensor_class_doubletap)) { + err = PTR_ERR(data->g_sensor_class_doubletap); + data->g_sensor_class_doubletap = NULL; + PERR("could not allocate g_sensor_class_doubletap\n"); + goto err_create_class; + } + + data->g_sensor_dev_doubletap = device_create( + data->g_sensor_class_doubletap, + NULL, 0, "%s", "g_sensor"); + if (unlikely(IS_ERR(data->g_sensor_dev_doubletap))) { + err = PTR_ERR(data->g_sensor_dev_doubletap); + data->g_sensor_dev_doubletap = NULL; + + PERR("could not allocate g_sensor_dev_doubletap\n"); + goto err_create_g_sensor_device_double_tap; + } + + dev_set_drvdata(data->g_sensor_dev_doubletap, data); + + err = sysfs_create_group(&data->g_sensor_dev_doubletap->kobj, + &smi130_acc_double_tap_attribute_group); + if (err < 0) + goto error_sysfs; +#endif + + err = sysfs_create_group(&data->input->dev.kobj, + &smi130_acc_attribute_group); + if (err < 0) + goto error_sysfs; + + dev_acc = bosch_allocate_device(); + if (!dev_acc) { + err = -ENOMEM; + goto error_sysfs; + } + dev_acc->name = ACC_NAME; + + bosch_set_drvdata(dev_acc, data); + + err = bosch_register_device(dev_acc); + if (err < 0) + goto bosch_free_acc_exit; + + data->bosch_acc = dev_acc; + err = sysfs_create_group(&data->bosch_acc->dev.kobj, + &smi130_acc_attribute_group); + + if (err < 0) + goto bosch_free_exit; + + if (NULL != client->dev.platform_data) { + data->bosch_pd = kzalloc(sizeof(*data->bosch_pd), + GFP_KERNEL); + + if (NULL != data->bosch_pd) { + memcpy(data->bosch_pd, client->dev.platform_data, + sizeof(*data->bosch_pd)); + PINFO("%s sensor driver set place: p%d", + data->bosch_pd->name, data->bosch_pd->place); + } + } + +#ifdef CONFIG_HAS_EARLYSUSPEND + data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; + data->early_suspend.suspend = smi130_acc_early_suspend; + data->early_suspend.resume = smi130_acc_late_resume; + register_early_suspend(&data->early_suspend); +#endif + INIT_WORK(&data->report_data_work, + smi130_acc_timer_work_fun); + reportdata_wq = create_singlethread_workqueue("smi130_acc_wq"); + if (NULL == reportdata_wq) + PERR("fail to create the reportdta_wq"); + hrtimer_init(&data->timer, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); + data->timer.function = reportdata_timer_fun; + data->work_delay_kt = ns_to_ktime(4000000); + data->is_timer_running = 0; + data->timestamp = 0; + data->time_odr = 4000000;/*default bandwidth 125HZ*/ + data->smi_acc_mode_enabled = 0; + data->fifo_datasel = 0; + data->fifo_count = 0; + data->acc_count = 0; + +#ifdef CONFIG_SIG_MOTION + atomic_set(&data->en_sig_motion, 0); +#endif +#ifdef CONFIG_DOUBLE_TAP + atomic_set(&data->en_double_tap, 0); + data->tap_times = 0; + data->tap_time_period = DEFAULT_TAP_JUDGE_PERIOD; + mutex_init(&data->tap_mutex); + setup_timer(&data->tap_timer, smi130_acc_tap_timeout_handle, + (unsigned long)data); +#endif + if (smi130_acc_set_mode(client, SMI_ACC2X2_MODE_SUSPEND, SMI_ACC_ENABLED_ALL) < 0) + return -EINVAL; + data->IRQ = client->irq; + PDEBUG("data->IRQ = %d", data->IRQ); + err = request_irq(data->IRQ, smi130_acc_irq_handler, IRQF_TRIGGER_RISING, + "smi130_acc", data); + PINFO("SMI130_ACC driver probe successfully"); + + return 0; + +bosch_free_exit: + bosch_unregister_device(dev_acc); + +bosch_free_acc_exit: + bosch_free_device(dev_acc); + +error_sysfs: + input_unregister_device(data->input); + +#ifdef CONFIG_DOUBLE_TAP +err_create_g_sensor_device_double_tap: + class_destroy(data->g_sensor_class_doubletap); +#endif + +#ifdef CONFIG_SIG_MOTION +err_create_g_sensor_device: + class_destroy(data->g_sensor_class); +#endif + +#if defined(CONFIG_SIG_MOTION) || defined(CONFIG_DOUBLE_TAP) +err_create_class: + input_unregister_device(data->dev_interrupt); +#endif + +err_register_input_device_interrupt: + input_free_device(dev_interrupt); + input_unregister_device(data->input); + +err_register_input_device: + input_free_device(dev); + +kfree_exit: + if ((NULL != data) && (NULL != data->bosch_pd)) { + kfree(data->bosch_pd); + data->bosch_pd = NULL; + } + kfree(data); +exit: + return err; +} + +#ifdef CONFIG_HAS_EARLYSUSPEND +static void smi130_acc_early_suspend(struct early_suspend *h) +{ + struct smi130_acc_data *data = + container_of(h, struct smi130_acc_data, early_suspend); + + mutex_lock(&data->enable_mutex); + if (atomic_read(&data->enable) == 1) { + smi130_acc_set_mode(data->smi130_acc_client, + SMI_ACC2X2_MODE_SUSPEND, SMI_ACC_ENABLED_INPUT); +#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + cancel_delayed_work_sync(&data->work); +#endif + } + if (data->is_timer_running) { + /*diable fifo_mode when close timer*/ + if (smi130_acc_set_fifo_mode(data->smi130_acc_client, 0) < 0) + PERR("set fifo_mode falied"); + hrtimer_cancel(&data->timer); + data->base_time = 0; + data->timestamp = 0; + data->fifo_time = 0; + data->acc_count = 0; + } + mutex_unlock(&data->enable_mutex); +} + +static void smi130_acc_late_resume(struct early_suspend *h) +{ + struct smi130_acc_data *data = + container_of(h, struct smi130_acc_data, early_suspend); + if (NULL == data) + return; + + mutex_lock(&data->enable_mutex); + if (atomic_read(&data->enable) == 1) { + smi130_acc_set_mode(data->smi130_acc_client, + SMI_ACC2X2_MODE_NORMAL, SMI_ACC_ENABLED_INPUT); +#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + schedule_delayed_work(&data->work, + msecs_to_jiffies(atomic_read(&data->delay))); +#endif + } + if (data->is_timer_running) { + hrtimer_start(&data->timer, + ns_to_ktime(data->time_odr), + HRTIMER_MODE_REL); + /*enable fifo_mode when init*/ + if (smi130_acc_set_fifo_mode(data->smi130_acc_client, 2) < 0) + PERR("set fifo_mode falied"); + data->base_time = 0; + data->timestamp = 0; + data->is_timer_running = 1; + data->acc_count = 0; + } + mutex_unlock(&data->enable_mutex); +} +#endif + +static int smi130_acc_remove(struct i2c_client *client) +{ + struct smi130_acc_data *data = i2c_get_clientdata(client); + + if (NULL == data) + return 0; + + smi130_acc_set_enable(&client->dev, 0); +#ifdef CONFIG_HAS_EARLYSUSPEND + unregister_early_suspend(&data->early_suspend); +#endif + sysfs_remove_group(&data->input->dev.kobj, &smi130_acc_attribute_group); + input_unregister_device(data->input); + + if (NULL != data->bosch_pd) { + kfree(data->bosch_pd); + data->bosch_pd = NULL; + } + + kfree(data); + return 0; +} + +void smi130_acc_shutdown(struct i2c_client *client) +{ + struct smi130_acc_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->enable_mutex); + smi130_acc_set_mode(data->smi130_acc_client, + SMI_ACC2X2_MODE_DEEP_SUSPEND, SMI_ACC_ENABLED_ALL); + mutex_unlock(&data->enable_mutex); +} + +#ifdef CONFIG_PM +static int smi130_acc_suspend(struct i2c_client *client, pm_message_t mesg) +{ + struct smi130_acc_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->enable_mutex); + if (atomic_read(&data->enable) == 1) { + smi130_acc_set_mode(data->smi130_acc_client, + SMI_ACC2X2_MODE_SUSPEND, SMI_ACC_ENABLED_INPUT); +#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + cancel_delayed_work_sync(&data->work); +#endif + } + if (data->is_timer_running) { + hrtimer_cancel(&data->timer); + data->base_time = 0; + data->timestamp = 0; + data->fifo_time = 0; + data->acc_count = 0; + } + mutex_unlock(&data->enable_mutex); + + return 0; +} + +static int smi130_acc_resume(struct i2c_client *client) +{ + struct smi130_acc_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->enable_mutex); + if (atomic_read(&data->enable) == 1) { + smi130_acc_set_mode(data->smi130_acc_client, + SMI_ACC2X2_MODE_NORMAL, SMI_ACC_ENABLED_INPUT); +#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT + schedule_delayed_work(&data->work, + msecs_to_jiffies(atomic_read(&data->delay))); +#endif + } + if (data->is_timer_running) { + hrtimer_start(&data->timer, + ns_to_ktime(data->time_odr), + HRTIMER_MODE_REL); + data->base_time = 0; + data->timestamp = 0; + data->is_timer_running = 1; + } + mutex_unlock(&data->enable_mutex); + + return 0; +} + +#else + +#define smi130_acc_suspend NULL +#define smi130_acc_resume NULL + +#endif /* CONFIG_PM */ + +static const struct i2c_device_id smi130_acc_id[] = { + { SENSOR_NAME, 0 }, + { } +}; + +MODULE_DEVICE_TABLE(i2c, smi130_acc_id); +static const struct of_device_id smi130_acc_of_match[] = { + { .compatible = "smi130_acc", }, + { } +}; +MODULE_DEVICE_TABLE(i2c, smi130_acc_of_match); + +static struct i2c_driver smi130_acc_driver = { + .driver = { + .owner = THIS_MODULE, + .name = SENSOR_NAME, + .of_match_table = smi130_acc_of_match, + }, + //.suspend = smi130_acc_suspend, + //.resume = smi130_acc_resume, + .id_table = smi130_acc_id, + .probe = smi130_acc_probe, + .remove = smi130_acc_remove, + .shutdown = smi130_acc_shutdown, +}; + +static int __init SMI_ACC2X2_init(void) +{ + return i2c_add_driver(&smi130_acc_driver); +} + +static void __exit SMI_ACC2X2_exit(void) +{ + i2c_del_driver(&smi130_acc_driver); +} + +MODULE_AUTHOR("contact@bosch-sensortec.com"); +MODULE_DESCRIPTION("SMI_ACC2X2 ACCELEROMETER SENSOR DRIVER"); +MODULE_LICENSE("GPL v2"); + +module_init(SMI_ACC2X2_init); +module_exit(SMI_ACC2X2_exit); + diff --git a/drivers/input/sensors/smi130/smi130_driver.c b/drivers/input/sensors/smi130/smi130_driver.c index 16f79d8b45cd..0c332d6a4a88 100644 --- a/drivers/input/sensors/smi130/smi130_driver.c +++ b/drivers/input/sensors/smi130/smi130_driver.c @@ -1,6 +1,6 @@ -/* +/*! * @section LICENSE - * (C) Copyright 2011~2018 Bosch Sensortec GmbH All Rights Reserved + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved * * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved * @@ -8,10 +8,110 @@ * Public License (GPL).Version 2,June 1991, * available at http://www.fsf.org/copyleft/gpl.html * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. * * @filename smi130_driver.c * @date 2016/08/01 14:40 - * @Modification Date 2018/06/21 15:03 + * @Modification Date 2018/08/28 18:20 + * @id "b5ff23a" * @version 1.3 * * @brief @@ -261,7 +361,7 @@ struct smi130_type_mapping_type { /*! smi16x chip revision code */ uint16_t revision_id; - /*! bma2x2 sensor name */ + /*! smi130_acc sensor name */ const char *sensor_name; }; @@ -285,7 +385,9 @@ uint64_t get_current_timestamp(void) /*! sensor support type map */ static const struct smi130_type_mapping_type sensor_type_map[] = { - {SENSOR_CHIP_ID_SMI, SENSOR_CHIP_REV_ID_SMI, "SMI130"}, + {SENSOR_CHIP_ID_SMI, SENSOR_CHIP_REV_ID_SMI, "SMI130/162AB"}, + {SENSOR_CHIP_ID_SMI_C2, SENSOR_CHIP_REV_ID_SMI, "SMI130C2"}, + {SENSOR_CHIP_ID_SMI_C3, SENSOR_CHIP_REV_ID_SMI, "SMI130C3"}, }; diff --git a/drivers/input/sensors/smi130/smi130_driver.h b/drivers/input/sensors/smi130/smi130_driver.h index c1ef78cc6d2f..4307ae55fd69 100644 --- a/drivers/input/sensors/smi130/smi130_driver.h +++ b/drivers/input/sensors/smi130/smi130_driver.h @@ -1,6 +1,6 @@ - /* +/*! * @section LICENSE - * (C) Copyright 2011~2018 Bosch Sensortec GmbH All Rights Reserved + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved * * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved * @@ -8,9 +8,110 @@ * Public License (GPL).Version 2,June 1991, * available at http://www.fsf.org/copyleft/gpl.html * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * * @filename smi130_driver.h * @date 2015/08/17 14:40 - * @Modification Date 2018/06/21 15:03 + * @Modification Date 2018/08/28 18:20 + * @id "e90a329" * @version 1.3 * * @brief @@ -60,8 +161,9 @@ /*#define SMI130_AKM09912_SUPPORT 1*/ #define SMI_USE_BASIC_I2C_FUNC 1 -#define SENSOR_CHIP_ID_SMI (0xFA) - +#define SENSOR_CHIP_ID_SMI (0xD0) +#define SENSOR_CHIP_ID_SMI_C2 (0xD1) +#define SENSOR_CHIP_ID_SMI_C3 (0xD3) #define SENSOR_CHIP_REV_ID_SMI (0x00) diff --git a/drivers/input/sensors/smi130/smi130_gyro.c b/drivers/input/sensors/smi130/smi130_gyro.c new file mode 100644 index 000000000000..ef3fc38fb68b --- /dev/null +++ b/drivers/input/sensors/smi130/smi130_gyro.c @@ -0,0 +1,7422 @@ +/*! + * @section LICENSE + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved + * + * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved + * + * This software program is licensed subject to the GNU General + * Public License (GPL).Version 2,June 1991, + * available at http://www.fsf.org/copyleft/gpl.html + * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * @filename smi130_gyro.c + * @date 2013/11/25 + * @Modification Date 2018/08/28 18:20 + * @id "8fcde22" + * @version 1.5 + * + * @brief SMI130_GYROAPI +*/ + +#include "smi130_gyro.h" +static struct smi130_gyro_t *p_smi130_gyro; + + +/***************************************************************************** + * Description: *//**brief API Initialization routine + * + * + * + * +* \param smi130_gyro_t *smi130_gyro + * Pointer to a structure. + * + * structure members are + * + * unsigned char chip_id; + * unsigned char dev_addr; + * SMI130_GYRO_BRD_FUNC_PTR; + * SMI130_GYRO_WR_FUNC_PTR; + * SMI130_GYRO_RD_FUNC_PTR; + * void(*delay_msec)( SMI130_GYRO_MDELAY_DATA_TYPE ); + * + * + * + * + * + * \return result of communication routines + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_init(struct smi130_gyro_t *smi130_gyro) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char a_data_u8r = C_SMI130_GYRO_Zero_U8X; + p_smi130_gyro = smi130_gyro; + + p_smi130_gyro->dev_addr = SMI130_GYRO_I2C_ADDR; + + /*Read CHIP_ID */ + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_CHIP_ID_ADDR, &a_data_u8r, 1); + p_smi130_gyro->chip_id = a_data_u8r; + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads Rate dataX from location 02h and 03h + * registers + * + * + * + * + * \param + * SMI130_GYRO_S16 *data_x : Address of data_x + * + * + * \return + * result of communication routines + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataX(SMI130_GYRO_S16 *data_x) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char a_data_u8r[2] = {0, 0}; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RATE_X_LSB_VALUEX__REG, a_data_u8r, 2); + a_data_u8r[0] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[0], + SMI130_GYRO_RATE_X_LSB_VALUEX); + *data_x = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[1])) << + SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[0])); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads rate dataY from location 04h and 05h + * registers + * + * + * + * + * \param + * SMI130_GYRO_S16 *data_y : Address of data_y + * + * + * \return + * result of communication routines + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataY(SMI130_GYRO_S16 *data_y) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char a_data_u8r[2] = {0, 0}; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RATE_Y_LSB_VALUEY__REG, a_data_u8r, 2); + a_data_u8r[0] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[0], + SMI130_GYRO_RATE_Y_LSB_VALUEY); + *data_y = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[1])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[0])); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads rate dataZ from location 06h and 07h + * registers + * + * + * + * + * \param + * SMI130_GYRO_S16 *data_z : Address of data_z + * + * + * \return + * result of communication routines + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataZ(SMI130_GYRO_S16 *data_z) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char a_data_u8r[2] = {0, 0}; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RATE_Z_LSB_VALUEZ__REG, a_data_u8r, 2); + a_data_u8r[0] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[0], + SMI130_GYRO_RATE_Z_LSB_VALUEZ); + *data_z = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[1])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[0])); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads data X,Y and Z from location 02h to 07h + * + * + * + * + * \param + * smi130_gyro_data_t *data : Address of smi130_gyro_data_t + * + * + * \return + * result of communication routines + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataXYZ(struct smi130_gyro_data_t *data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char a_data_u8r[6] = {0, 0, 0, 0, 0, 0}; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RATE_X_LSB_VALUEX__REG, a_data_u8r, 6); + /* Data X */ + a_data_u8r[0] = + SMI130_GYRO_GET_BITSLICE(a_data_u8r[0], SMI130_GYRO_RATE_X_LSB_VALUEX); + data->datax = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[1])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[0])); + /* Data Y */ + a_data_u8r[2] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[2], + SMI130_GYRO_RATE_Y_LSB_VALUEY); + data->datay = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[3])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[2])); + /* Data Z */ + a_data_u8r[4] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[4], + SMI130_GYRO_RATE_Z_LSB_VALUEZ); + data->dataz = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[5])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[4])); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads data X,Y,Z and Interrupts + * from location 02h to 07h + * + * + * + * + * \param + * smi130_gyro_data_t *data : Address of smi130_gyro_data_t + * + * + * \return + * result of communication routines + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataXYZI(struct smi130_gyro_data_t *data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char a_data_u8r[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RATE_X_LSB_VALUEX__REG, a_data_u8r, 12); + /* Data X */ + a_data_u8r[0] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[0], + SMI130_GYRO_RATE_X_LSB_VALUEX); + data->datax = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[1])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[0])); + /* Data Y */ + a_data_u8r[2] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[2], + SMI130_GYRO_RATE_Y_LSB_VALUEY); + data->datay = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[3])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[2])); + /* Data Z */ + a_data_u8r[4] = SMI130_GYRO_GET_BITSLICE(a_data_u8r[4], + SMI130_GYRO_RATE_Z_LSB_VALUEZ); + data->dataz = (SMI130_GYRO_S16) + ((((SMI130_GYRO_S16)((signed char)a_data_u8r[5])) + << SMI130_GYRO_SHIFT_8_POSITION) | (a_data_u8r[4])); + data->intstatus[0] = a_data_u8r[7]; + data->intstatus[1] = a_data_u8r[8]; + data->intstatus[2] = a_data_u8r[9]; + data->intstatus[3] = a_data_u8r[10]; + data->intstatus[4] = a_data_u8r[11]; + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads Temperature from location 08h + * + * + * + * + * \param + * unsigned char *temp : Address of temperature + * + * + * \return + * result of communication routines + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_Temperature(unsigned char *temperature) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TEMP_ADDR, &v_data_u8r, 1); + *temperature = v_data_u8r; + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API reads the data from the given register + * + * + * + * + *\param unsigned char addr, unsigned char *data unsigned char len + * addr -> Address of the register + * data -> address of the variable, read value will be + * kept + * len -> No of byte to be read. + * \return results of bus communication function + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_read_register(unsigned char addr, +unsigned char *data, unsigned char len) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, addr, data, len); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API reads the data from the given register + * + * + * + * + *\param unsigned char addr, unsigned char *data SMI130_GYRO_S32 len + * addr -> Address of the register + * data -> address of the variable, read value will be + * kept + * len -> No of byte to be read. + * \return results of bus communication function + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_burst_read(unsigned char addr, +unsigned char *data, SMI130_GYRO_S32 len) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BURST_READ_FUNC(p_smi130_gyro->dev_addr, + addr, data, len); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API given data to the given register + * + * + * + * + *\param unsigned char addr, unsigned char data,unsigned char len + * addr -> Address of the register + * data -> Data to be written to the register + * len -> No of byte to be read. + * + * \return Results of bus communication function + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_write_register(unsigned char addr, +unsigned char *data, unsigned char len) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, addr, data, len); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads interrupt status 0 register byte from 09h + * + * + * + * + * \param + * unsigned char *status0_data : Address of status 0 register + * + * + * \return + * Result of bus communication function + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_0( +unsigned char *status0_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_STATUSZERO__REG, &v_data_u8r, 1); + *status0_data = + SMI130_GYRO_GET_BITSLICE(v_data_u8r, SMI130_GYRO_INT_STATUSZERO); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads interrupt status 1 register byte from 0Ah + * + * + * + * + * \param + * unsigned char *status1_data : Address of status register + * + * + * \return + * Result of bus communication function + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_1( +unsigned char *status1_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, SMI130_GYRO_INT_STATUSONE__REG, + &v_data_u8r, 1); + *status1_data = + SMI130_GYRO_GET_BITSLICE(v_data_u8r, SMI130_GYRO_INT_STATUSONE); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads interrupt status register byte from 0Bh + * + * + * + * + * \param + * unsigned char *status2_data : Address of status 2 register + * + * + * \return + * Result of bus communication function + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_2( +unsigned char *status2_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_STATUSTWO__REG, &v_data_u8r, 1); + *status2_data = + SMI130_GYRO_GET_BITSLICE(v_data_u8r, SMI130_GYRO_INT_STATUSTWO); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads interrupt status 3 register byte from 0Ch + * + * + * + * + * \param + * unsigned char *status3_data : Address of status 3 register + * + * + * \return + * Result of bus communication function + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_3( +unsigned char *status3_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_STATUSTHREE__REG, &v_data_u8r, 1); + *status3_data = + SMI130_GYRO_GET_BITSLICE(v_data_u8r, SMI130_GYRO_INT_STATUSTHREE); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API reads the range from register 0x0Fh of + * (0 to 2) bits + * + * + * + * + *\param unsigned char *range + * Range[0....7] + * 0 2000/s + * 1 1000/s + * 2 500/s + * 3 250/s + * 4 125/s + * + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_range_reg(unsigned char *range) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_RANGE_ADDR_RANGE__REG, &v_data_u8r, 1); + *range = + SMI130_GYRO_GET_BITSLICE(v_data_u8r, SMI130_GYRO_RANGE_ADDR_RANGE); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API sets the range register 0x0Fh + * (0 to 2 bits) + * + * + * + * + *\param unsigned char range + * + * Range[0....7] + * 0 2000/s + * 1 1000/s + * 2 500/s + * 3 250/s + * 4 125/s + * + * + * + * + * \return Communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_range_reg(unsigned char range) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (range < C_SMI130_GYRO_Five_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_RANGE_ADDR_RANGE__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_RANGE_ADDR_RANGE, + range); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_RANGE_ADDR_RANGE__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API reads the high resolution bit of 0x10h + * Register 7th bit + * + * + * + * + *\param unsigned char *high_res + * Pointer to a variable passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_res(unsigned char *high_res) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BW_ADDR_HIGH_RES__REG, &v_data_u8r, 1); + *high_res = + SMI130_GYRO_GET_BITSLICE(v_data_u8r, SMI130_GYRO_BW_ADDR_HIGH_RES); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API reads the bandwidth register of 0x10h 0 to + * 3 bits + * + * + * + * +* \param unsigned char *bandwidth + * pointer to a variable passed as a parameter + * + * 0 no filter(523 Hz) + * 1 230Hz + * 2 116Hz + * 3 47Hz + * 4 23Hz + * 5 12Hz + * 6 64Hz + * 7 32Hz + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_bw(unsigned char *bandwidth) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, SMI130_GYRO_BW_ADDR__REG, &v_data_u8r, 1); + *bandwidth = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_BW_ADDR); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API writes the Bandwidth register (0x10h of 0 + * to 3 bits) + * + * + * + * + *\param unsigned char bandwidth, + * The bandwidth to be set passed as a parameter + * + * 0 no filter(523 Hz) + * 1 230Hz + * 2 116Hz + * 3 47Hz + * 4 23Hz + * 5 12Hz + * 6 64Hz + * 7 32Hz + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_bw(unsigned char bandwidth) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + unsigned char v_mode_u8r = C_SMI130_GYRO_Zero_U8X; + unsigned char v_autosleepduration = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (bandwidth < C_SMI130_GYRO_Eight_U8X) { + smi130_gyro_get_mode(&v_mode_u8r); + if (v_mode_u8r == SMI130_GYRO_MODE_ADVANCEDPOWERSAVING) { + smi130_gyro_get_autosleepdur(&v_autosleepduration); + smi130_gyro_set_autosleepdur(v_autosleepduration, + bandwidth); + } + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BW_ADDR__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_BW_ADDR, bandwidth); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BW_ADDR__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API reads the status of External Trigger + * selection bits (4 and 5) of 0x12h registers + * + * + * + * + *\param unsigned char *pwu_ext_tri_sel + * Pointer to a variable passed as a parameter + * + * + * + * \return Communication Results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_pmu_ext_tri_sel( +unsigned char *pwu_ext_tri_sel) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL__REG, &v_data_u8r, 1); + *pwu_ext_tri_sel = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API writes the External Trigger selection + * bits (4 and 5) of 0x12h registers + * + * + * + * + *\param unsigned char pwu_ext_tri_sel + * Value to be written passed as a parameter + * + * + * + * \return Communication Results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_pmu_ext_tri_sel( +unsigned char pwu_ext_tri_sel) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL, pwu_ext_tri_sel); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get data high bandwidth + * + * + * + * + *\param unsigned char *high_bw : Address of high_bw + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_bw(unsigned char *high_bw) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW__REG, &v_data_u8r, 1); + *high_bw = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set data high bandwidth + * + * + * + * + *\param unsigned char high_bw: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_bw(unsigned char high_bw) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (high_bw < C_SMI130_GYRO_Two_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW__REG, + &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW, high_bw); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW__REG, + &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get shadow dis + * + * + * + * + *\param unsigned char *shadow_dis : Address of shadow_dis + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_shadow_dis(unsigned char *shadow_dis) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS__REG, &v_data_u8r, 1); + *shadow_dis = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set shadow dis + * + * + * + * + *\param unsigned char shadow_dis + * Value to be written passed as a parameter + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_shadow_dis(unsigned char shadow_dis) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (shadow_dis < C_SMI130_GYRO_Two_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS, shadow_dis); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief + * This function is used for the soft reset + * The soft reset register will be written with 0xB6. + * + * + * +* \param None + * + * + * + * \return Communication results. + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_soft_reset() +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_SoftReset_u8r = C_SMI130_GYRO_Zero_U8X; + v_SoftReset_u8r = 0xB6; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SOFTRESET_ADDR, &v_SoftReset_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get data enable data + * + * + * + * + *\param unsigned char *data_en : Address of data_en + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_data_enable(unsigned char *data_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_DATAEN__REG, &v_data_u8r, 1); + *data_en = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE0_DATAEN); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set data enable data + * + * + * + * + * \param unsigned char data_en: + * Value to be written passed as a \parameter + * 0 --> Disable + * 1 --> Enable + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_data_en(unsigned char data_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_DATAEN__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE0_DATAEN, data_en); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_DATAEN__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get fifo enable bit + * + * + * + * + * \param unsigned char *fifo_en : Address of fifo_en + * Pointer to a variable passed as a parameter + + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_enable(unsigned char *fifo_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_FIFOEN__REG, &v_data_u8r, 1); + *fifo_en = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE0_FIFOEN); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set fifo enable bit + * + * + * + * + * \param unsigned char fifo_en: + * Value to be written passed as a parameter + * 0 --> Disable + * 1 --> Enable + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_enable(unsigned char fifo_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (fifo_en < C_SMI130_GYRO_Two_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_FIFOEN__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE0_FIFOEN, fifo_en); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_FIFOEN__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API reads the status of the Auto offset + * Enable bit + * (0x15 Reg 3rd Bit) + * + * + * + * + * \param unsigned char *offset_en + * address of a variable, + * + * + * + * \return Communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_auto_offset_en( +unsigned char *offset_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN__REG, &v_data_u8r, 1); + *offset_en = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API sets the Auto offset enable bit + * (Reg 0x15 3rd Bit) + * + * + * + * + * \param unsigned char offset_en + * 0 --> Disable + * 1 --> Enable + * + * \return Communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_auto_offset_en(unsigned char offset_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN, offset_en); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the output type status + * + * + * + * + * \param unsigned char channel,unsigned char *int_od + * SMI130_GYRO_INT1 -> 0 + * SMI130_GYRO_INT2 -> 1 + * int_od : open drain -> 1 + * push pull -> 0 + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_od(unsigned char param, +unsigned char *int_od) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_INT1: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT1_OD__REG, &v_data_u8r, 1); + *int_od = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT1_OD); + break; + case SMI130_GYRO_INT2: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT2_OD__REG, &v_data_u8r, 1); + *int_od = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT2_OD); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the output type status + * + * + * + * + * \param unsigned char channel,unsigned char *int_od + * SMI130_GYRO_INT1 -> 0 + * SMI130_GYRO_INT2 -> 1 + * int_od : open drain -> 1 + * push pull -> 0 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_od(unsigned char param, +unsigned char int_od) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_INT1: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT1_OD__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT1_OD, int_od); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT1_OD__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_INT2: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT2_OD__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT2_OD, int_od); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT2_OD__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Active Level status + * + * + * + * + * \param unsigned char channel,unsigned char *int_lvl + * SMI130_GYRO_INT1 -> 0 + * SMI130_GYRO_INT2 -> 1 + * int_lvl : Active HI -> 1 + * Active LO -> 0 + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_lvl(unsigned char param, +unsigned char *int_lvl) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_INT1: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT1_LVL__REG, &v_data_u8r, 1); + *int_lvl = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT1_LVL); + break; + case SMI130_GYRO_INT2: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT2_LVL__REG, &v_data_u8r, 1); + *int_lvl = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT2_LVL); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Active Level status + * + * + * + * + * \param unsigned char channel,unsigned char *int_lvl + * SMI130_GYRO_INT1 -> 0 + * SMI130_GYRO_INT2 -> 1 + * int_lvl : Active HI -> 1 + * Active LO -> 0 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_lvl(unsigned char param, +unsigned char int_lvl) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_INT1: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT1_LVL__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT1_LVL, int_lvl); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT1_LVL__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_INT2: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT2_LVL__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_ENABLE1_IT2_LVL, int_lvl); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_ENABLE1_IT2_LVL__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get High Interrupt1 + * + * + * + * + * \param unsigned char *int1_high : Address of high_bw + * Pointer to a variable passed as a parameter + + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_high(unsigned char *int1_high) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_0_INT1_HIGH__REG, &v_data_u8r, 1); + *int1_high = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_0_INT1_HIGH); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set High Interrupt1 + * + * + * + * + * \param unsigned char int1_high + * 0 -> Disable + * 1 -> Enable + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_high(unsigned char int1_high) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_0_INT1_HIGH__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_0_INT1_HIGH, int1_high); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_0_INT1_HIGH__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Any Interrupt1 + * + * + * + * + * \param unsigned char *int1_any : Address of high_bw + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_any(unsigned char *int1_any) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_0_INT1_ANY__REG, &v_data_u8r, 1); + *int1_any = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_0_INT1_ANY); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Any Interrupt1 + * + * + * + * + *\param unsigned char int1_any + * 0 -> Disable + * 1 -> Enable + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_any(unsigned char int1_any) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_0_INT1_ANY__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_0_INT1_ANY, int1_any); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_0_INT1_ANY__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get data Interrupt1 and data + * Interrupt2 + * + * + * + * + * \param unsigned char axis,unsigned char *int_data + * axis : + * SMI130_GYRO_INT1_DATA -> 0 + * SMI130_GYRO_INT2_DATA -> 1 + * int_data : + * Disable -> 0 + * Enable -> 1 + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_data(unsigned char axis, +unsigned char *int_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_INT1_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_DATA__REG, &v_data_u8r, 1); + *int_data = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_DATA); + break; + case SMI130_GYRO_INT2_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_DATA__REG, &v_data_u8r, 1); + *int_data = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_DATA); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set data Interrupt1 and data + * Interrupt2 + * + * + * + * + * \param unsigned char axis,unsigned char *int_data + * axis : + * SMI130_GYRO_INT1_DATA -> 0 + * SMI130_GYRO_INT2_DATA -> 1 + * int_data : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_data(unsigned char axis, +unsigned char int_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_INT1_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_DATA__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_DATA, int_data); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_DATA__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_INT2_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_DATA__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_DATA, int_data); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_DATA__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; + } + +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get fast offset and auto + * offset Interrupt2 + * + * + * + * + *\param unsigned char axis,unsigned char *int2_offset + * axis : + * SMI130_GYRO_AUTO_OFFSET -> 1 + * SMI130_GYRO_FAST_OFFSET -> 2 + * int2_offset : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_offset(unsigned char axis, +unsigned char *int2_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_FAST_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FAST_OFFSET__REG, &v_data_u8r, 1); + *int2_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_FAST_OFFSET); + break; + case SMI130_GYRO_AUTO_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET__REG, &v_data_u8r, 1); + *int2_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set fast offset and auto + * offset Interrupt2 + * + * + * + * + *\param unsigned char axis,unsigned char *int2_offset + * axis : + * SMI130_GYRO_AUTO_OFFSET -> 1 + * SMI130_GYRO_FAST_OFFSET -> 2 + * int2_offset : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_offset(unsigned char axis, +unsigned char int2_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_FAST_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FAST_OFFSET__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_FAST_OFFSET, int2_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FAST_OFFSET__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_AUTO_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET, int2_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get fast offset and auto + * offset Interrupt1 + * + * + * + * + *\param unsigned char axis,unsigned char *int1_offset + * axis : + * SMI130_GYRO_AUTO_OFFSET -> 1 + * SMI130_GYRO_FAST_OFFSET -> 2 + * int2_offset : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_offset(unsigned char axis, +unsigned char *int1_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_FAST_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FAST_OFFSET__REG, &v_data_u8r, 1); + *int1_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_FAST_OFFSET); + break; + case SMI130_GYRO_AUTO_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET__REG, &v_data_u8r, 1); + *int1_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set fast offset and auto + * offset Interrupt1 + * + * + * + * + *\param unsigned char axis,unsigned char *int1_offset + * axis : + * SMI130_GYRO_AUTO_OFFSET -> 1 + * SMI130_GYRO_FAST_OFFSET -> 2 + * int2_offset : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_offset(unsigned char axis, +unsigned char int1_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_FAST_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FAST_OFFSET__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_FAST_OFFSET, int1_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FAST_OFFSET__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_AUTO_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET, int1_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get status of FIFO Interrupt + * + * + * + * + *\param unsigned char *int_fifo : Address of int_fifo + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_fifo(unsigned char *int_fifo) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_STATUS1_FIFO_INT__REG, &v_data_u8r, 1); + *int_fifo = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_STATUS1_FIFO_INT); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get FIFO Interrupt2 + * + * + * + * + *\param unsigned char *int_fifo + * int_fifo : + * Disable -> 0 + * Enable -> 1 + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_fifo(unsigned char *int_fifo) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FIFO__REG, &v_data_u8r, 1); + *int_fifo = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_FIFO); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get FIFO Interrupt1 + * + * + * + * + *\param unsigned char *int_fifo + * int_fifo : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_fifo(unsigned char *int_fifo) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FIFO__REG, &v_data_u8r, 1); + *int_fifo = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_FIFO); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief + * + * + * + * + * \param + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_fifo(unsigned char axis, +unsigned char int_fifo) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_INT1: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FIFO__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_FIFO, int_fifo); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FIFO__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_INT2: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FIFO__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_FIFO, int_fifo); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FIFO__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set FIFO Interrupt1 + * + * + * + * + *\param unsigned char *fifo_int1 + * fifo_int1 : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_fifo(unsigned char fifo_int1) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (fifo_int1 < C_SMI130_GYRO_Two_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FIFO__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT1_FIFO, fifo_int1); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT1_FIFO__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set FIFO Interrupt2 + * + * + * + * + *\param unsigned char *fifo_int2 + * fifo_int2 : + * Disable -> 0 + * Enable -> 1 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_fifo(unsigned char fifo_int2) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (fifo_int2 < C_SMI130_GYRO_Two_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FIFO__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MAP_1_INT2_FIFO, fifo_int2); + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MAP_1_INT2_FIFO__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get High Interrupt2 + * + * + * + * + *\param unsigned char *int2_high : Address of int2_high + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_high(unsigned char *int2_high) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_2_INT2_HIGH__REG, &v_data_u8r, 1); + *int2_high = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_2_INT2_HIGH); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get High Interrupt2 + * + * + * + * + *\param unsigned char int2_high + * 0 -> Disable + * 1 -> Enable + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_high(unsigned char int2_high) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_2_INT2_HIGH__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_2_INT2_HIGH, int2_high); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_2_INT2_HIGH__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Any Interrupt2 + * + * + * + * + *\param unsigned char *int2_any : Address of int2_any + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_any(unsigned char *int2_any) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_2_INT2_ANY__REG, &v_data_u8r, 1); + *int2_any = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_2_INT2_ANY); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Any Interrupt2 + * + * + * + * + *\param unsigned char int2_any + * 0 -> Disable + * 1 -> Enable + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_any(unsigned char int2_any) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_2_INT2_ANY__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_MAP_2_INT2_ANY, int2_any); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_MAP_2_INT2_ANY__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get slow offset and fast + * offset unfilt data + * + * + * + *\param unsigned char param,unsigned char *offset_unfilt + * param : + * SMI130_GYRO_SLOW_OFFSET -> 0 + * SMI130_GYRO_FAST_OFFSET -> 2 + * offset_unfilt: Enable -> 1 + * Disable -> 0 + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_offset_unfilt(unsigned char param, +unsigned char *offset_unfilt) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_SLOW_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT__REG, + &v_data_u8r, 1); + *offset_unfilt = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT); + break; + case SMI130_GYRO_FAST_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT__REG, + &v_data_u8r, 1); + *offset_unfilt = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set slow offset and fast + * offset unfilt data + * + * + * + * + *\param unsigned char param,unsigned char *offset_unfilt + * param : + * SMI130_GYRO_SLOW_OFFSET -> 0 + * SMI130_GYRO_FAST_OFFSET -> 2 + * offset_unfilt: Enable -> 1 + * Disable -> 0 + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset_unfilt(unsigned char param, +unsigned char offset_unfilt) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_SLOW_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT__REG, + &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT, offset_unfilt); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT__REG, + &v_data_u8r, 1); + break; + case SMI130_GYRO_FAST_OFFSET: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT__REG, + &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT, offset_unfilt); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT__REG, + &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Tap, High, Constant, Any, + * Shake unfilt data + * + * + * + * + *\param unsigned char param,unsigned char *unfilt_data + * param : + * + * SMI130_GYRO_HIGH_UNFILT_DATA -> 1 + * SMI130_GYRO_ANY_UNFILT_DATA -> 3 + * + * unfilt_data: Enable -> 1 + * Disable -> 0 + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_unfilt_data(unsigned char param, +unsigned char *unfilt_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_HIGH_UNFILT_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA__REG, + &v_data_u8r, 1); + *unfilt_data = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA); + break; + case SMI130_GYRO_ANY_UNFILT_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA__REG, &v_data_u8r, 1); + *unfilt_data = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Tap, High, Constant, Any, + * Shake unfilt data + * + * + * + * + *\param unsigned char param,unsigned char *unfilt_data + * param : + * + * SMI130_GYRO_HIGH_UNFILT_DATA -> 1 + * SMI130_GYRO_ANY_UNFILT_DATA -> 3 + * + * unfilt_data: Enable -> 1 + * Disable -> 0 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_unfilt_data(unsigned char param, +unsigned char unfilt_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_HIGH_UNFILT_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA__REG, + &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA, unfilt_data); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA__REG, + &v_data_u8r, 1); + break; + case SMI130_GYRO_ANY_UNFILT_DATA: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA, unfilt_data); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Any Threshold + * + * + * + * + *\param unsigned char *any_th : Address of any_th + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_any_th(unsigned char *any_th) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_1_ADDR_ANY_TH__REG, &v_data_u8r, 1); + *any_th = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_1_ADDR_ANY_TH); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Any Threshold + * + * + * + * + *\param unsigned char any_th: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_any_th(unsigned char any_th) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_1_ADDR_ANY_TH__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_1_ADDR_ANY_TH, any_th); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_1_ADDR_ANY_TH__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Awake Duration + * + * + * + * + *\param unsigned char *awake_dur : Address of awake_dur + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_awake_dur(unsigned char *awake_dur) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_AWAKE_DUR__REG, &v_data_u8r, 1); + *awake_dur = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_AWAKE_DUR); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Awake Duration + * + * + * + * + *\param unsigned char awake_dur: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + ***************************************************************************** + * Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_awake_dur(unsigned char awake_dur) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_AWAKE_DUR__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_AWAKE_DUR, awake_dur); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_AWAKE_DUR__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Any Duration Sample + * + * + * + * + *\param unsigned char *dursample : Address of dursample + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_any_dursample(unsigned char *dursample) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE__REG, &v_data_u8r, 1); + *dursample = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Any Duration Sample + * + * + * + * + *\param unsigned char dursample: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_any_dursample(unsigned char dursample) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE, dursample); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of Any Enable + * Channel X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *data + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * data : + * Enable -> 1 + * disable -> 0 + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_any_en_ch(unsigned char channel, +unsigned char *data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_X__REG, &v_data_u8r, 1); + *data = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_EN_X); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Y__REG, &v_data_u8r, 1); + *data = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Y); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Z__REG, &v_data_u8r, 1); + *data = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Z); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of Any Enable + * Channel X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *data + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * data : + * Enable -> 1 + * disable -> 0 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_any_en_ch(unsigned char channel, +unsigned char data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_X__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_EN_X, data); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_X__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Y__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Y, data); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Y__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Z__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Z, data); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_2_ADDR_ANY_EN_Z__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of FIFO WM + * Enable + * + * + * + * + *\param unsigned char *fifo_wn_en + * Enable -> 1 + * Disable -> 0 + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_watermark_enable( +unsigned char *fifo_wn_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_4_FIFO_WM_EN__REG, &v_data_u8r, 1); + *fifo_wn_en = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_4_FIFO_WM_EN); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set FIFO WM Enable + * + * + * + * + *\param unsigned char *fifo_wn_en + * Enable -> 1 + * Disable -> 0 + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_watermark_enable( +unsigned char fifo_wn_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (fifo_wn_en < C_SMI130_GYRO_Two_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_4_FIFO_WM_EN__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_INT_4_FIFO_WM_EN, fifo_wn_en); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_INT_4_FIFO_WM_EN__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the Interrupt Reset + * + * + * + * + *\param unsigned char reset_int + * 1 -> Reset All Interrupts + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_reset_int(unsigned char reset_int) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_RESET_INT__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_RST_LATCH_ADDR_RESET_INT, reset_int); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_RESET_INT__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the Offset Reset + * + * + * + * + *\param unsigned char offset_reset + * 1 -> Resets All the Offsets + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset_reset( +unsigned char offset_reset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_OFFSET_RESET__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_RST_LATCH_ADDR_OFFSET_RESET, offset_reset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_OFFSET_RESET__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the Latch Status + * + * + * + * + *\param unsigned char *latch_status : Address of latch_status + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_latch_status( +unsigned char *latch_status) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS__REG, &v_data_u8r, 1); + *latch_status = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the Latch Status + * + * + * + * + *\param unsigned char latch_status: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_latch_status( +unsigned char latch_status) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS, latch_status); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the Latch Interrupt + * + * + * + * + *\param unsigned char *latch_int : Address of latch_int + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_latch_int(unsigned char *latch_int) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT__REG, &v_data_u8r, 1); + *latch_int = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the Latch Interrupt + * + * + * + * + *\param unsigned char latch_int: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_latch_int(unsigned char latch_int) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT, latch_int); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of High + * Hysteresis X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *high_hy + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * high_hy : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_hy(unsigned char channel, +unsigned char *high_hy) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_X__REG, &v_data_u8r, 1); + *high_hy = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_HY_X); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_Y__REG, &v_data_u8r, 1); + *high_hy = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_HY_Y); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_Z__REG, &v_data_u8r, 1); + *high_hy = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_HY_Z); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of High + * Hysteresis X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *high_hy + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * high_hy : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_hy(unsigned char channel, +unsigned char high_hy) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_X__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_HY_X, high_hy); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_X__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_Y__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_HY_Y, high_hy); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_Y__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_Z__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_HY_Z, high_hy); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_HY_Z__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of High + * Threshold X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *high_th + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * high_th : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_th(unsigned char channel, +unsigned char *high_th) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_X__REG, &v_data_u8r, 1); + *high_th = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_TH_X); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_Y__REG, &v_data_u8r, 1); + *high_th = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_TH_Y); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_Z__REG, &v_data_u8r, 1); + *high_th = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_TH_Z); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of High + * Threshold X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *high_th + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * high_th : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_th(unsigned char channel, +unsigned char high_th) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_X__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_TH_X, high_th); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_X__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_Y__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_TH_Y, high_th); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_Y__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_Z__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_TH_Z, high_th); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_TH_Z__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of High Enable + * Channel X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *high_en + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * high_en : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_en_ch(unsigned char channel, +unsigned char *high_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_X__REG, &v_data_u8r, 1); + *high_en = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_EN_X); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_Y__REG, &v_data_u8r, 1); + *high_en = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_EN_Y); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_Z__REG, &v_data_u8r, 1); + *high_en = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_EN_Z); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of High Enable + * Channel X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *high_en + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * high_en : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_en_ch(unsigned char channel, +unsigned char high_en) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_X__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_EN_X, high_en); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_X__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_Y__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_EN_Y, high_en); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_Y__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_Z__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_HIGH_EN_Z, high_en); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_EN_Z__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get High Duration + * + * + * + * + *\param unsigned char channel,unsigned char *high_dur + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * *high_dur : Address of high_bw + * Pointer to a variable passed as a + * parameter + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_dur_ch(unsigned char channel, +unsigned char *high_dur) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_DUR_X_ADDR, &v_data_u8r, 1); + *high_dur = v_data_u8r; + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_DUR_Y_ADDR, &v_data_u8r, 1); + *high_dur = v_data_u8r; + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_DUR_Z_ADDR, &v_data_u8r, 1); + *high_dur = v_data_u8r; + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set High Duration + * + * + * + * + *\param unsigned char channel,unsigned char *high_dur + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * high_dur : Value to be written passed as a parameter + * + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_dur_ch(unsigned char channel, +unsigned char high_dur) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + v_data_u8r = high_dur; + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_DUR_X_ADDR, &v_data_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + v_data_u8r = high_dur; + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_DUR_Y_ADDR, &v_data_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + v_data_u8r = high_dur; + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_HIGH_DUR_Z_ADDR, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Slow Offset Threshold + * + * + * + * + *\param unsigned char *offset_th : Address of offset_th + * Pointer to a variable passed as a parameter + + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_slow_offset_th( +unsigned char *offset_th) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_TH__REG, &v_data_u8r, 1); + *offset_th = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_TH); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Slow Offset Threshold + * + * + * + * + *\param unsigned char offset_th: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_slow_offset_th(unsigned char offset_th) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_TH__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_TH, offset_th); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_TH__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Slow Offset Duration + * + * + * + * + *\param unsigned char *offset_dur : Address of offset_dur + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_slow_offset_dur( +unsigned char *offset_dur) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_DUR__REG, &v_data_u8r, 1); + *offset_dur = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_DUR); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Slow Offset Duration + * + * + * + * + *\param unsigned char offset_dur: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_slow_offset_dur( +unsigned char offset_dur) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_DUR__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_DUR, offset_dur); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_DUR__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Slow Offset Enable channel + * X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *slow_offset + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * slow_offset : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_slow_offset_en_ch( +unsigned char channel, unsigned char *slow_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_X__REG, &v_data_u8r, 1); + *slow_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_EN_X); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_Y__REG, &v_data_u8r, 1); + *slow_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_EN_Y); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_Z__REG, &v_data_u8r, 1); + *slow_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_EN_Z); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Slow Offset Enable channel + * X,Y,Z + * + * + * + * + *\param unsigned char channel,unsigned char *slow_offset + * channel : + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * slow_offset : + * Enable -> 1 + * disable -> 0 + * + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_slow_offset_en_ch( +unsigned char channel, unsigned char slow_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_X__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_EN_X, slow_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_X__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_Y__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_EN_Y, slow_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_Y__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_Z__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_SLOW_OFFSET_EN_Z, + slow_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_SLOW_OFFSET_EN_Z__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Fast Offset WordLength and + * Auto Offset WordLength + * + * + * + * + *\param unsigned char channel,unsigned char *offset_wl + * channel : + * SMI130_GYRO_AUTO_OFFSET_WL -> 0 + * SMI130_GYRO_FAST_OFFSET_WL -> 1 + * *offset_wl : Address of high_bw + * Pointer to a variable passed as a + * parameter + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_offset_wl(unsigned char channel, +unsigned char *offset_wl) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_AUTO_OFFSET_WL: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_AUTO_OFFSET_WL__REG, &v_data_u8r, 1); + *offset_wl = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_AUTO_OFFSET_WL); + break; + case SMI130_GYRO_FAST_OFFSET_WL: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_WL__REG, &v_data_u8r, 1); + *offset_wl = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FAST_OFFSET_WL); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Fast Offset WordLength and + * Auto Offset WordLength + * + * + * + * + *\param unsigned char channel,unsigned char *offset_wl + * channel : + * SMI130_GYRO_AUTO_OFFSET_WL -> 0 + * SMI130_GYRO_FAST_OFFSET_WL -> 1 + * offset_wl : Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset_wl( +unsigned char channel, unsigned char offset_wl) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_AUTO_OFFSET_WL: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_AUTO_OFFSET_WL__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_AUTO_OFFSET_WL, offset_wl); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_AUTO_OFFSET_WL__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_FAST_OFFSET_WL: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_WL__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FAST_OFFSET_WL, offset_wl); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_WL__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to enable fast offset + * + * + * + * +* \param smi130_gyro_enable_fast_offset + * Enable -> 1 + * Disable -> 0 + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_enable_fast_offset() +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FAST_OFFSET_EN, 1); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API read the Fast offset en status from the + * 0x32h of 0 to 2 bits. + * + * + * + * + *\param unsigned char *fast_offset + * Pointer to a variable passed as a parameter + * + * + * + * \return Communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fast_offset_en_ch( +unsigned char *fast_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN_XYZ__REG, &v_data_u8r, 1); + *fast_offset = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FAST_OFFSET_EN_XYZ); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API writes the Fast offset enable bit based + * on the Channel selection 0x32h of (0 to 2 bits) + * + * + * + * +* \param unsigned char channel,unsigned char fast_offset + * + * channel --> SMI130_GYRO_X_AXIS,SMI130_GYRO_Y_AXIS,SMI130_GYRO_Z_AXIS + * fast_offset --> 0 - Disable + * 1 - Enable + * + * + * + * \return Communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fast_offset_en_ch( +unsigned char channel, unsigned char fast_offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (channel) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN_X__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FAST_OFFSET_EN_X, fast_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN_X__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN_Y__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FAST_OFFSET_EN_Y, fast_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN_Y__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN_Z__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FAST_OFFSET_EN_Z, fast_offset); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FAST_OFFSET_EN_Z__REG, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of nvm program + * remain + * + * + * + * + *\param unsigned char *nvm_remain + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_nvm_remain(unsigned char *nvm_remain) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_REMAIN__REG, &v_data_u8r, 1); + *nvm_remain = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_REMAIN); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of nvm load + * + * + * + * + *\param unsigned char nvm_load + * 1 -> load offset value from NVM + * 0 -> no action + * + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_nvm_load(unsigned char nvm_load) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_LOAD__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_LOAD, nvm_load); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_LOAD__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of nvmprogram + * ready + * + * + * + * + *\param unsigned char *nvm_rdy + * 1 -> program seq finished + * 0 -> program seq in progress + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_nvm_rdy(unsigned char *nvm_rdy) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_RDY__REG, &v_data_u8r, 1); + *nvm_rdy = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_RDY); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of nvm program + * trigger + * + * + * + * + *\param unsigned char trig + * 1 -> trig program seq (wo) + * 0 -> No Action + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_nvm_prog_trig(unsigned char prog_trig) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_TRIG__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_TRIG, prog_trig); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_TRIG__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of nvm program + * mode + * + * + * + * +* \param unsigned char *prog_mode : Address of *prog_mode + * 1 -> Enable program mode + * 0 -> Disable program mode + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_nvm_prog_mode(unsigned char *prog_mode) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE__REG, &v_data_u8r, 1); + *prog_mode = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/****************************************************************************** + * Description: *//**brief This API is used to set the status of nvmprogram + * mode + * + * + * + * +* \param(unsigned char prog_mode) + * 1 -> Enable program mode + * 0 -> Disable program mode + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_nvm_prog_mode(unsigned char prog_mode) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE, prog_mode); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE__REG, &v_data_u8r, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of i2c wdt + * + * + * + * + *\param unsigned char channel,unsigned char *prog_mode + * SMI130_GYRO_I2C_WDT_SEL 1 + * SMI130_GYRO_I2C_WDT_EN 0 + * *prog_mode : Address of prog_mode + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_i2c_wdt(unsigned char i2c_wdt, +unsigned char *prog_mode) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (i2c_wdt) { + case SMI130_GYRO_I2C_WDT_EN: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN__REG, + &v_data_u8r, 1); + *prog_mode = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN); + break; + case SMI130_GYRO_I2C_WDT_SEL: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL__REG, + &v_data_u8r, 1); + *prog_mode = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of i2c wdt + * + * + * + * + *\param unsigned char channel,unsigned char prog_mode + * SMI130_GYRO_I2C_WDT_SEL 1 + * SMI130_GYRO_I2C_WDT_EN 0 + * prog_mode : Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_i2c_wdt(unsigned char i2c_wdt, +unsigned char prog_mode) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (i2c_wdt) { + case SMI130_GYRO_I2C_WDT_EN: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN__REG, + &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN, prog_mode); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN__REG, + &v_data_u8r, 1); + break; + case SMI130_GYRO_I2C_WDT_SEL: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL__REG, + &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL, prog_mode); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL__REG, + &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of spi3 + * + * + * + * +* \param unsigned char *spi3 : Address of spi3 + * Pointer to a variable passed as a parameter + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_spi3(unsigned char *spi3) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3__REG, &v_data_u8r, 1); + *spi3 = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of spi3 + * + * + * + * + *\param unsigned char spi3 + * + * + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_spi3(unsigned char spi3) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3, spi3); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3__REG, &v_data_u8r, 1); + } + return comres; +} +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_tag(unsigned char *tag) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF1_ADDR_TAG__REG, &v_data_u8r, 1); + *tag = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF1_ADDR_TAG); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of Tag + * + * + * + * + *\param unsigned char tag + * Enable -> 1 + * Disable -> 0 + * + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_tag(unsigned char tag) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (tag < C_SMI130_GYRO_Two_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF1_ADDR_TAG__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF1_ADDR_TAG, tag); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF1_ADDR_TAG__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get Water Mark Level + * + * + * + * + *\param unsigned char *water_mark_level : Address of water_mark_level + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_watermarklevel( +unsigned char *water_mark_level) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF1_ADDR_WML__REG, &v_data_u8r, 1); + *water_mark_level = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF1_ADDR_WML); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set Water Mark Level + * + * + * + * + *\param unsigned char water_mark_level: + * Value to be written passed as a parameter + + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_watermarklevel( +unsigned char water_mark_level) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (water_mark_level < C_SMI130_GYRO_OneTwentyEight_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF1_ADDR_WML__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF1_ADDR_WML, water_mark_level); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF1_ADDR_WML__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of offset + * + * + * + * + *\param unsigned char axis,unsigned char *offset + * axis -> + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * offset -> Any valid value + * + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_offset(unsigned char axis, +SMI130_GYRO_S16 *offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data1_u8r = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data2_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_X_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X__REG, &v_data1_u8r, 1); + v_data1_u8r = SMI130_GYRO_GET_BITSLICE(v_data1_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X); + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC1_ADDR_OFFSET_X__REG, &v_data2_u8r, 1); + v_data2_u8r = SMI130_GYRO_GET_BITSLICE(v_data2_u8r, + SMI130_GYRO_OFC1_ADDR_OFFSET_X); + v_data2_u8r = ((v_data2_u8r << + SMI130_GYRO_SHIFT_2_POSITION) | v_data1_u8r); + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, SMI130_GYRO_OFC2_ADDR, &v_data1_u8r, 1); + *offset = (SMI130_GYRO_S16)((((SMI130_GYRO_S16) + ((signed char)v_data1_u8r)) + << SMI130_GYRO_SHIFT_4_POSITION) | (v_data2_u8r)); + break; + case SMI130_GYRO_Y_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y__REG, &v_data1_u8r, 1); + v_data1_u8r = SMI130_GYRO_GET_BITSLICE(v_data1_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y); + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC1_ADDR_OFFSET_Y__REG, &v_data2_u8r, 1); + v_data2_u8r = SMI130_GYRO_GET_BITSLICE(v_data2_u8r, + SMI130_GYRO_OFC1_ADDR_OFFSET_Y); + v_data2_u8r = ((v_data2_u8r << + SMI130_GYRO_SHIFT_1_POSITION) | v_data1_u8r); + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC3_ADDR, &v_data1_u8r, 1); + *offset = (SMI130_GYRO_S16)((((SMI130_GYRO_S16) + ((signed char)v_data1_u8r)) + << SMI130_GYRO_SHIFT_4_POSITION) | (v_data2_u8r)); + break; + case SMI130_GYRO_Z_AXIS: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z__REG, &v_data1_u8r, 1); + v_data1_u8r = SMI130_GYRO_GET_BITSLICE(v_data1_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z); + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC1_ADDR_OFFSET_Z__REG, &v_data2_u8r, 1); + v_data2_u8r = SMI130_GYRO_GET_BITSLICE(v_data2_u8r, + SMI130_GYRO_OFC1_ADDR_OFFSET_Z); + v_data2_u8r = ((v_data2_u8r << SMI130_GYRO_SHIFT_1_POSITION) + | v_data1_u8r); + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC4_ADDR, &v_data1_u8r, 1); + *offset = (SMI130_GYRO_S16)((((SMI130_GYRO_S16) + ((signed char)v_data1_u8r)) + << SMI130_GYRO_SHIFT_4_POSITION) | (v_data2_u8r)); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of offset + * + * + * + * + *\param unsigned char axis,unsigned char offset + * axis -> + * SMI130_GYRO_X_AXIS -> 0 + * SMI130_GYRO_Y_AXIS -> 1 + * SMI130_GYRO_Z_AXIS -> 2 + * offset -> Any valid value + * + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset( +unsigned char axis, SMI130_GYRO_S16 offset) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data1_u8r = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data2_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (axis) { + case SMI130_GYRO_X_AXIS: + v_data1_u8r = ((signed char) (offset & 0x0FF0)) + >> SMI130_GYRO_SHIFT_4_POSITION; + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC2_ADDR, &v_data1_u8r, 1); + + v_data1_u8r = (unsigned char) (offset & 0x000C); + v_data2_u8r = SMI130_GYRO_SET_BITSLICE(v_data2_u8r, + SMI130_GYRO_OFC1_ADDR_OFFSET_X, v_data1_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC1_ADDR_OFFSET_X__REG, &v_data2_u8r, 1); + + v_data1_u8r = (unsigned char) (offset & 0x0003); + v_data2_u8r = SMI130_GYRO_SET_BITSLICE(v_data2_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X, v_data1_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X__REG, &v_data2_u8r, 1); + break; + case SMI130_GYRO_Y_AXIS: + v_data1_u8r = ((signed char) (offset & 0x0FF0)) >> + SMI130_GYRO_SHIFT_4_POSITION; + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC3_ADDR, &v_data1_u8r, 1); + + v_data1_u8r = (unsigned char) (offset & 0x000E); + v_data2_u8r = SMI130_GYRO_SET_BITSLICE(v_data2_u8r, + SMI130_GYRO_OFC1_ADDR_OFFSET_Y, v_data1_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC1_ADDR_OFFSET_Y__REG, &v_data2_u8r, 1); + + v_data1_u8r = (unsigned char) (offset & 0x0001); + v_data2_u8r = SMI130_GYRO_SET_BITSLICE(v_data2_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y, v_data1_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y__REG, &v_data2_u8r, 1); + break; + case SMI130_GYRO_Z_AXIS: + v_data1_u8r = ((signed char) (offset & 0x0FF0)) >> + SMI130_GYRO_SHIFT_4_POSITION; + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC4_ADDR, &v_data1_u8r, 1); + + v_data1_u8r = (unsigned char) (offset & 0x000E); + v_data2_u8r = SMI130_GYRO_SET_BITSLICE(v_data2_u8r, + SMI130_GYRO_OFC1_ADDR_OFFSET_Z, v_data1_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_OFC1_ADDR_OFFSET_Z__REG, &v_data2_u8r, 1); + + v_data1_u8r = (unsigned char) (offset & 0x0001); + v_data2_u8r = SMI130_GYRO_SET_BITSLICE(v_data2_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z, v_data1_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z__REG, &v_data2_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of general + * purpose register + * + * + * + * + *\param unsigned char param,unsigned char *value + * param -> + * SMI130_GYRO_GP0 0 + * SMI130_GYRO_GP0 1 + * *value -> Address of high_bw + * Pointer to a variable passed as a parameter + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_gp(unsigned char param, +unsigned char *value) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_GP0: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_GP0__REG, &v_data_u8r, 1); + *value = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_GP0); + break; + case SMI130_GYRO_GP1: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP1_ADDR, &v_data_u8r, 1); + *value = v_data_u8r; + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of general + * purpose register + * + * + * + * + *\param unsigned char param,unsigned char value + * param -> + * SMI130_GYRO_GP0 0 + * SMI130_GYRO_GP0 1 + * value -> Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_gp(unsigned char param, +unsigned char value) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + switch (param) { + case SMI130_GYRO_GP0: + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_GP0__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_TRIM_GP0_ADDR_GP0, value); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP0_ADDR_GP0__REG, &v_data_u8r, 1); + break; + case SMI130_GYRO_GP1: + v_data_u8r = value; + comres = p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_TRIM_GP1_ADDR, &v_data_u8r, 1); + break; + default: + comres = E_SMI130_GYRO_OUT_OF_RANGE; + break; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads FIFI data from location 3Fh + * + * + * + * + * \param + * unsigned char *fifo_data : Address of FIFO data bits + * + * + * + * + * \return result of communication routines + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_FIFO_data_reg(unsigned char *fifo_data) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_DATA_ADDR, &v_data_u8r, 1); + *fifo_data = v_data_u8r; + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads interrupt fifo status register byte from 0Eh + * + * + * + * + * \param + * unsigned char *fifo_status : Address of Fifo status register + * + * + * \return + * Result of bus communication function + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifostatus_reg( +unsigned char *fifo_status) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_STATUS_ADDR, fifo_status, 1); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads interrupt fifo status register byte from 0Eh + * + * + * + * + * \param + * unsigned char *fifo_framecount: Address of FIFO status register + * + * + * \return + * Result of bus communication function + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_framecount( +unsigned char *fifo_framecount) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_STATUS_FRAME_COUNTER__REG, &v_data_u8r, 1); + *fifo_framecount = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_STATUS_FRAME_COUNTER); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief Reads interrupt fifo status register byte from 0Eh + * + * + * + * + * \param + * unsigned char *fifo_overrun: Address of FIFO status register + * + * + * \return + * Result of bus communication function + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_overrun( +unsigned char *fifo_overrun) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_STATUS_OVERRUN__REG, &v_data_u8r, 1); + *fifo_overrun = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_STATUS_OVERRUN); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of fifo mode + * + * + * + * + *\param unsigned char *mode : Address of mode + * fifo_mode 0 --> Bypass + * 1 --> FIFO + * 2 --> Stream + * 3 --> Reserved + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_mode(unsigned char *mode) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF0_ADDR_MODE__REG, &v_data_u8r, 1); + *mode = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF0_ADDR_MODE); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used set to FIFO mode + * + * + * + * +* \param 0 --> BYPASS + * 1 --> FIFO + * 2 --> STREAM + * + * + * \return Communication Results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_mode(unsigned char mode) +{ + int comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (mode < C_SMI130_GYRO_Four_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF0_ADDR_MODE__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF0_ADDR_MODE, mode); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF0_ADDR_MODE__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the status of fifo data + * sel + * + * + * + * + *\param unsigned char *data_sel : Address of data_sel + * data_sel --> [0:3] + * 0 --> X,Y and Z (DEFAULT) + * 1 --> X only + * 2 --> Y only + * 3 --> Z only + * + * + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_data_sel(unsigned char *data_sel) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL__REG, &v_data_u8r, 1); + *data_sel = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the status of fifo data + * sel + * + * + * + * + *\param unsigned char data_sel + * data_sel --> [0:3] + * 0 --> X,Y and Z (DEFAULT) + * 1 --> X only + * 2 --> Y only + * 3 --> Z only + * + * + * + * \return communication results + * + * + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_data_sel(unsigned char data_sel) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (data_sel < C_SMI130_GYRO_Four_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL__REG, &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL, data_sel); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL__REG, &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get the operating modes of the + * sensor + * + * + * + * + *\param unsigned char * mode : Address of mode + * 0 -> NORMAL + * 1 -> SUSPEND + * 2 -> DEEP SUSPEND + * 3 -> FAST POWERUP + * 4 -> ADVANCED POWERSAVING + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_mode(unsigned char *mode) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char data1 = C_SMI130_GYRO_Zero_U8X; + unsigned char data2 = C_SMI130_GYRO_Zero_U8X; + unsigned char data3 = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == C_SMI130_GYRO_Zero_U8X) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM1_ADDR, &data1, C_SMI130_GYRO_One_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data2, C_SMI130_GYRO_One_U8X); + data1 = (data1 & 0xA0) >> 5; + data3 = (data2 & 0x40) >> 6; + data2 = (data2 & 0x80) >> 7; + if (data3 == 0x01) { + *mode = SMI130_GYRO_MODE_ADVANCEDPOWERSAVING; + } else { + if ((data1 == 0x00) && (data2 == 0x00)) { + *mode = SMI130_GYRO_MODE_NORMAL; + } else { + if ((data1 == 0x01) || (data1 == 0x05)) { + *mode = SMI130_GYRO_MODE_DEEPSUSPEND; + } else { + if ((data1 == 0x04) && + (data2 == 0x00)) { + *mode = SMI130_GYRO_MODE_SUSPEND; + } else { + if ((data1 == 0x04) && + (data2 == 0x01)) + *mode = + SMI130_GYRO_MODE_FASTPOWERUP; + } + } + } + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set the operating Modes of the + * sensor + * + * + * + * + *\param unsigned char Mode + * 0 -> NORMAL + * 1 -> DEEPSUSPEND + * 2 -> SUSPEND + * 3 -> Fast Powerup + * 4 -> Advance Powerup + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_mode(unsigned char mode) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char data1 = C_SMI130_GYRO_Zero_U8X; + unsigned char data2 = C_SMI130_GYRO_Zero_U8X; + unsigned char data3 = C_SMI130_GYRO_Zero_U8X; + unsigned char v_autosleepduration = C_SMI130_GYRO_Zero_U8X; + unsigned char v_bw_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == C_SMI130_GYRO_Zero_U8X) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (mode < C_SMI130_GYRO_Five_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM1_ADDR, &data1, C_SMI130_GYRO_One_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data2, C_SMI130_GYRO_One_U8X); + switch (mode) { + case SMI130_GYRO_MODE_NORMAL: + data1 = SMI130_GYRO_SET_BITSLICE(data1, + SMI130_GYRO_MODE_LPM1, C_SMI130_GYRO_Zero_U8X); + data2 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP, + C_SMI130_GYRO_Zero_U8X); + data3 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING, + C_SMI130_GYRO_Zero_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM1_ADDR, &data1, C_SMI130_GYRO_One_U8X); + p_smi130_gyro->delay_msec(1);/*A minimum delay of atleast + 450us is required for Multiple write.*/ + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data3, C_SMI130_GYRO_One_U8X); + break; + case SMI130_GYRO_MODE_DEEPSUSPEND: + data1 = SMI130_GYRO_SET_BITSLICE(data1, + SMI130_GYRO_MODE_LPM1, C_SMI130_GYRO_One_U8X); + data2 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP, + C_SMI130_GYRO_Zero_U8X); + data3 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING, + C_SMI130_GYRO_Zero_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM1_ADDR, &data1, C_SMI130_GYRO_One_U8X); + p_smi130_gyro->delay_msec(1);/*A minimum delay of atleast + 450us is required for Multiple write.*/ + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data3, C_SMI130_GYRO_One_U8X); + break; + case SMI130_GYRO_MODE_SUSPEND: + data1 = SMI130_GYRO_SET_BITSLICE(data1, + SMI130_GYRO_MODE_LPM1, C_SMI130_GYRO_Four_U8X); + data2 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP, + C_SMI130_GYRO_Zero_U8X); + data3 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING, + C_SMI130_GYRO_Zero_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM1_ADDR, &data1, C_SMI130_GYRO_One_U8X); + p_smi130_gyro->delay_msec(1);/*A minimum delay of atleast + 450us is required for Multiple write.*/ + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data3, C_SMI130_GYRO_One_U8X); + break; + case SMI130_GYRO_MODE_FASTPOWERUP: + data1 = SMI130_GYRO_SET_BITSLICE(data1, + SMI130_GYRO_MODE_LPM1, C_SMI130_GYRO_Four_U8X); + data2 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP, + C_SMI130_GYRO_One_U8X); + data3 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING, + C_SMI130_GYRO_Zero_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM1_ADDR, &data1, C_SMI130_GYRO_One_U8X); + p_smi130_gyro->delay_msec(1);/*A minimum delay of atleast + 450us is required for Multiple write.*/ + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data3, C_SMI130_GYRO_One_U8X); + break; + case SMI130_GYRO_MODE_ADVANCEDPOWERSAVING: + /* Configuring the proper settings for auto + sleep duration */ + smi130_gyro_get_bw(&v_bw_u8r); + smi130_gyro_get_autosleepdur(&v_autosleepduration); + smi130_gyro_set_autosleepdur(v_autosleepduration, + v_bw_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data2, + C_SMI130_GYRO_One_U8X); + /* Configuring the advanced power saving mode*/ + data1 = SMI130_GYRO_SET_BITSLICE(data1, + SMI130_GYRO_MODE_LPM1, C_SMI130_GYRO_Zero_U8X); + data2 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP, + C_SMI130_GYRO_Zero_U8X); + data3 = SMI130_GYRO_SET_BITSLICE(data2, + SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING, + C_SMI130_GYRO_One_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM1_ADDR, &data1, C_SMI130_GYRO_One_U8X); + p_smi130_gyro->delay_msec(1);/*A minimum delay of atleast + 450us is required for Multiple write.*/ + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR, &data3, C_SMI130_GYRO_One_U8X); + break; + } + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to to do selftest to sensor + * sensor + * + * + * + * + *\param unsigned char *result + * + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_selftest(unsigned char *result) + { + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char data1 = C_SMI130_GYRO_Zero_U8X; + unsigned char data2 = C_SMI130_GYRO_Zero_U8X; + + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SELF_TEST_ADDR, &data1, C_SMI130_GYRO_One_U8X); + data2 = SMI130_GYRO_GET_BITSLICE(data1, SMI130_GYRO_SELF_TEST_ADDR_RATEOK); + data1 = SMI130_GYRO_SET_BITSLICE(data1, SMI130_GYRO_SELF_TEST_ADDR_TRIGBIST, + C_SMI130_GYRO_One_U8X); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SELF_TEST_ADDR_TRIGBIST__REG, &data1, C_SMI130_GYRO_One_U8X); + + /* Waiting time to complete the selftest process */ + p_smi130_gyro->delay_msec(10); + + /* Reading Selftest result bir bist_failure */ + comres += p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_SELF_TEST_ADDR_BISTFAIL__REG, &data1, C_SMI130_GYRO_One_U8X); + data1 = SMI130_GYRO_GET_BITSLICE(data1, SMI130_GYRO_SELF_TEST_ADDR_BISTFAIL); + if ((data1 == 0x00) && (data2 == 0x01)) + *result = C_SMI130_GYRO_SUCCESS; + else + *result = C_SMI130_GYRO_FAILURE; + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get data auto sleep duration + * + * + * + * + *\param unsigned char *duration : Address of auto sleep duration + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_autosleepdur(unsigned char *duration) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR__REG, &v_data_u8r, 1); + *duration = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set duration + * + * + * + * + *\param unsigned char duration: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_autosleepdur(unsigned char duration, +unsigned char bandwith) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + unsigned char v_autosleepduration_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR__REG, + &v_data_u8r, 1); + if (duration < C_SMI130_GYRO_Eight_U8X) { + switch (bandwith) { + case C_SMI130_GYRO_No_Filter_U8X: + if (duration > + C_SMI130_GYRO_4ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_4ms_AutoSleepDur_U8X; + break; + case C_SMI130_GYRO_BW_230Hz_U8X: + if (duration > + C_SMI130_GYRO_4ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_4ms_AutoSleepDur_U8X; + break; + case C_SMI130_GYRO_BW_116Hz_U8X: + if (duration > + C_SMI130_GYRO_4ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_4ms_AutoSleepDur_U8X; + break; + case C_SMI130_GYRO_BW_47Hz_U8X: + if (duration > + C_SMI130_GYRO_5ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_5ms_AutoSleepDur_U8X; + break; + case C_SMI130_GYRO_BW_23Hz_U8X: + if (duration > + C_SMI130_GYRO_10ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_10ms_AutoSleepDur_U8X; + break; + case C_SMI130_GYRO_BW_12Hz_U8X: + if (duration > + C_SMI130_GYRO_20ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_20ms_AutoSleepDur_U8X; + break; + case C_SMI130_GYRO_BW_64Hz_U8X: + if (duration > + C_SMI130_GYRO_10ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_10ms_AutoSleepDur_U8X; + break; + case C_SMI130_GYRO_BW_32Hz_U8X: + if (duration > + C_SMI130_GYRO_20ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_20ms_AutoSleepDur_U8X; + break; + default: + if (duration > + C_SMI130_GYRO_4ms_AutoSleepDur_U8X) + v_autosleepduration_u8r = + duration; + else + v_autosleepduration_u8r = + C_SMI130_GYRO_4ms_AutoSleepDur_U8X; + break; + } + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR, + v_autosleepduration_u8r); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR__REG, + &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to get data sleep duration + * + * + * + * + *\param unsigned char *duration : Address of sleep duration + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_sleepdur(unsigned char *duration) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC(p_smi130_gyro->dev_addr, + SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR__REG, &v_data_u8r, 1); + *duration = SMI130_GYRO_GET_BITSLICE(v_data_u8r, + SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR); + } + return comres; +} +/* Compiler Switch if applicable +#ifdef + +#endif +*/ +/***************************************************************************** + * Description: *//**brief This API is used to set duration + * + * + * + * + *\param unsigned char duration: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_sleepdur(unsigned char duration) +{ + SMI130_GYRO_RETURN_FUNCTION_TYPE comres = C_SMI130_GYRO_Zero_U8X; + unsigned char v_data_u8r = C_SMI130_GYRO_Zero_U8X; + if (p_smi130_gyro == SMI130_GYRO_NULL) { + return E_SMI130_GYRO_NULL_PTR; + } else { + if (duration < C_SMI130_GYRO_Eight_U8X) { + comres = p_smi130_gyro->SMI130_GYRO_BUS_READ_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR__REG, + &v_data_u8r, 1); + v_data_u8r = SMI130_GYRO_SET_BITSLICE(v_data_u8r, + SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR, duration); + comres += p_smi130_gyro->SMI130_GYRO_BUS_WRITE_FUNC + (p_smi130_gyro->dev_addr, + SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR__REG, + &v_data_u8r, 1); + } else { + comres = E_SMI130_GYRO_OUT_OF_RANGE; + } + } + return comres; +} + diff --git a/drivers/input/sensors/smi130/smi130_gyro.h b/drivers/input/sensors/smi130/smi130_gyro.h new file mode 100644 index 000000000000..38e52acc304f --- /dev/null +++ b/drivers/input/sensors/smi130/smi130_gyro.h @@ -0,0 +1,4705 @@ +/*! + * @section LICENSE + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved + * + * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved + * + * This software program is licensed subject to the GNU General + * Public License (GPL).Version 2,June 1991, + * available at http://www.fsf.org/copyleft/gpl.html + * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * + * @filename smi130_gyro.h + * @date 2013/11/25 + * @Modification Date 2018/08/28 18:20 + * @id "8fcde22" + * @version 1.5 + * + * @brief Header of SMI130_GYRO API +*/ + +/* user defined code to be added here ... */ +#ifndef __SMI130_GYRO_H__ +#define __SMI130_GYRO_H__ + +#ifdef __KERNEL__ +#define SMI130_GYRO_U16 unsigned short /* 16 bit achieved with short */ +#define SMI130_GYRO_S16 signed short +#define SMI130_GYRO_S32 signed int /* 32 bit achieved with int */ +#else +#include <limits.h> /*needed to test integer limits */ + + +/* find correct data type for signed/unsigned 16 bit variables \ +by checking max of unsigned variant */ +#if USHRT_MAX == 0xFFFF + /* 16 bit achieved with short */ + #define SMI130_GYRO_U16 unsigned short + #define SMI130_GYRO_S16 signed short +#elif UINT_MAX == 0xFFFF + /* 16 bit achieved with int */ + #define SMI130_GYRO_U16 unsigned int + #define SMI130_GYRO_S16 signed int +#else + #error SMI130_GYRO_U16 and SMI130_GYRO_S16 could not be + #error defined automatically, please do so manually +#endif + +/* find correct data type for signed 32 bit variables */ +#if INT_MAX == 0x7FFFFFFF + /* 32 bit achieved with int */ + #define SMI130_GYRO_S32 signed int +#elif LONG_MAX == 0x7FFFFFFF + /* 32 bit achieved with long int */ + #define SMI130_GYRO_S32 signed long int +#else + #error SMI130_GYRO_S32 could not be + #error defined automatically, please do so manually +#endif +#endif + +/**\brief defines the calling parameter types of the SMI130_GYRO_WR_FUNCTION */ +#define SMI130_GYRO_BUS_WR_RETURN_TYPE char + +/**\brief links the order of parameters defined in +SMI130_GYRO_BUS_WR_PARAM_TYPE to function calls used inside the API*/ +#define SMI130_GYRO_BUS_WR_PARAM_TYPES unsigned char, unsigned char,\ +unsigned char *, unsigned char + +/**\brief links the order of parameters defined in +SMI130_GYRO_BUS_WR_PARAM_TYPE to function calls used inside the API*/ +#define SMI130_GYRO_BUS_WR_PARAM_ORDER(device_addr, register_addr,\ +register_data, wr_len) + +/* never change this line */ +#define SMI130_GYRO_BUS_WRITE_FUNC(device_addr, register_addr,\ +register_data, wr_len) bus_write(device_addr, register_addr,\ +register_data, wr_len) +/**\brief defines the return parameter type of the SMI130_GYRO_RD_FUNCTION +*/ +#define SMI130_GYRO_BUS_RD_RETURN_TYPE char +/**\brief defines the calling parameter types of the SMI130_GYRO_RD_FUNCTION +*/ +#define SMI130_GYRO_BUS_RD_PARAM_TYPES unsigned char, unsigned char,\ +unsigned char *, unsigned char +/**\brief links the order of parameters defined in \ +SMI130_GYRO_BUS_RD_PARAM_TYPE to function calls used inside the API +*/ +#define SMI130_GYRO_BUS_RD_PARAM_ORDER (device_addr, register_addr,\ +register_data) +/* never change this line */ +#define SMI130_GYRO_BUS_READ_FUNC(device_addr, register_addr,\ +register_data, rd_len)bus_read(device_addr, register_addr,\ +register_data, rd_len) +/**\brief defines the return parameter type of the SMI130_GYRO_RD_FUNCTION +*/ +#define SMI130_GYRO_BURST_RD_RETURN_TYPE char +/**\brief defines the calling parameter types of the SMI130_GYRO_RD_FUNCTION +*/ +#define SMI130_GYRO_BURST_RD_PARAM_TYPES unsigned char,\ +unsigned char, unsigned char *, signed int +/**\brief links the order of parameters defined in \ +SMI130_GYRO_BURST_RD_PARAM_TYPE to function calls used inside the API +*/ +#define SMI130_GYRO_BURST_RD_PARAM_ORDER (device_addr, register_addr,\ +register_data) +/* never change this line */ +#define SMI130_GYRO_BURST_READ_FUNC(device_addr, register_addr,\ +register_data, rd_len)burst_read(device_addr, \ +register_addr, register_data, rd_len) +/**\brief defines the return parameter type of the SMI130_GYRO_DELAY_FUNCTION +*/ +#define SMI130_GYRO_DELAY_RETURN_TYPE void +/* never change this line */ +#define SMI130_GYRO_DELAY_FUNC(delay_in_msec)\ + delay_func(delay_in_msec) +#define SMI130_GYRO_RETURN_FUNCTION_TYPE int +/**< This refers SMI130_GYRO return type as char */ + +#define SMI130_GYRO_I2C_ADDR1 0x68 +#define SMI130_GYRO_I2C_ADDR SMI130_GYRO_I2C_ADDR1 +#define SMI130_GYRO_I2C_ADDR2 0x69 + + + +/*Define of registers*/ + +/* Hard Wired */ +#define SMI130_GYRO_CHIP_ID_ADDR 0x00 +/**<Address of Chip ID Register*/ + + +/* Data Register */ +#define SMI130_GYRO_RATE_X_LSB_ADDR 0x02 +/**< Address of X axis Rate LSB Register */ +#define SMI130_GYRO_RATE_X_MSB_ADDR 0x03 +/**< Address of X axis Rate MSB Register */ +#define SMI130_GYRO_RATE_Y_LSB_ADDR 0x04 +/**< Address of Y axis Rate LSB Register */ +#define SMI130_GYRO_RATE_Y_MSB_ADDR 0x05 +/**< Address of Y axis Rate MSB Register */ +#define SMI130_GYRO_RATE_Z_LSB_ADDR 0x06 +/**< Address of Z axis Rate LSB Register */ +#define SMI130_GYRO_RATE_Z_MSB_ADDR 0x07 +/**< Address of Z axis Rate MSB Register */ +#define SMI130_GYRO_TEMP_ADDR 0x08 +/**< Address of Temperature Data LSB Register */ + +/* Status Register */ +#define SMI130_GYRO_INT_STATUS0_ADDR 0x09 +/**< Address of Interrupt status Register 0 */ +#define SMI130_GYRO_INT_STATUS1_ADDR 0x0A +/**< Address of Interrupt status Register 1 */ +#define SMI130_GYRO_INT_STATUS2_ADDR 0x0B +/**< Address of Interrupt status Register 2 */ +#define SMI130_GYRO_INT_STATUS3_ADDR 0x0C +/**< Address of Interrupt status Register 3 */ +#define SMI130_GYRO_FIFO_STATUS_ADDR 0x0E +/**< Address of FIFO status Register */ + +/* Control Register */ +#define SMI130_GYRO_RANGE_ADDR 0x0F +/**< Address of Range address Register */ +#define SMI130_GYRO_BW_ADDR 0x10 +/**< Address of Bandwidth Register */ +#define SMI130_GYRO_MODE_LPM1_ADDR 0x11 +/**< Address of Mode LPM1 Register */ +#define SMI130_GYRO_MODE_LPM2_ADDR 0x12 +/**< Address of Mode LPM2 Register */ +#define SMI130_GYRO_RATED_HBW_ADDR 0x13 +/**< Address of Rate HBW Register */ +#define SMI130_GYRO_BGW_SOFTRESET_ADDR 0x14 +/**< Address of BGW Softreset Register */ +#define SMI130_GYRO_INT_ENABLE0_ADDR 0x15 +/**< Address of Interrupt Enable 0 */ +#define SMI130_GYRO_INT_ENABLE1_ADDR 0x16 +/**< Address of Interrupt Enable 1 */ +#define SMI130_GYRO_INT_MAP_0_ADDR 0x17 +/**< Address of Interrupt MAP 0 */ +#define SMI130_GYRO_INT_MAP_1_ADDR 0x18 +/**< Address of Interrupt MAP 1 */ +#define SMI130_GYRO_INT_MAP_2_ADDR 0x19 +/**< Address of Interrupt MAP 2 */ +#define SMI130_GYRO_INT_0_ADDR 0x1A +/**< Address of Interrupt 0 register */ +#define SMI130_GYRO_INT_1_ADDR 0x1B +/**< Address of Interrupt 1 register */ +#define SMI130_GYRO_INT_2_ADDR 0x1C +/**< Address of Interrupt 2 register */ +#define SMI130_GYRO_INT_4_ADDR 0x1E +/**< Address of Interrupt 4 register */ +#define SMI130_GYRO_RST_LATCH_ADDR 0x21 +/**< Address of Reset Latch Register */ +#define SMI130_GYRO_HIGH_TH_X_ADDR 0x22 +/**< Address of High Th x Address register */ +#define SMI130_GYRO_HIGH_DUR_X_ADDR 0x23 +/**< Address of High Dur x Address register */ +#define SMI130_GYRO_HIGH_TH_Y_ADDR 0x24 +/**< Address of High Th y Address register */ +#define SMI130_GYRO_HIGH_DUR_Y_ADDR 0x25 +/**< Address of High Dur y Address register */ +#define SMI130_GYRO_HIGH_TH_Z_ADDR 0x26 +/**< Address of High Th z Address register */ +#define SMI130_GYRO_HIGH_DUR_Z_ADDR 0x27 +/**< Address of High Dur z Address register */ +#define SMI130_GYRO_SOC_ADDR 0x31 +/**< Address of SOC register */ +#define SMI130_GYRO_A_FOC_ADDR 0x32 +/**< Address of A_FOC Register */ +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR 0x33 +/**< Address of Trim NVM control register */ +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR 0x34 +/**< Address of BGW SPI3,WDT Register */ + + +/* Trim Register */ +#define SMI130_GYRO_OFC1_ADDR 0x36 +/**< Address of OFC1 Register */ +#define SMI130_GYRO_OFC2_ADDR 0x37 +/**< Address of OFC2 Register */ +#define SMI130_GYRO_OFC3_ADDR 0x38 +/**< Address of OFC3 Register */ +#define SMI130_GYRO_OFC4_ADDR 0x39 +/**< Address of OFC4 Register */ +#define SMI130_GYRO_TRIM_GP0_ADDR 0x3A +/**< Address of Trim GP0 Register */ +#define SMI130_GYRO_TRIM_GP1_ADDR 0x3B +/**< Address of Trim GP1 Register */ +#define SMI130_GYRO_SELF_TEST_ADDR 0x3C +/**< Address of BGW Self test Register */ + +/* Control Register */ +#define SMI130_GYRO_FIFO_CGF1_ADDR 0x3D +/**< Address of FIFO CGF0 Register */ +#define SMI130_GYRO_FIFO_CGF0_ADDR 0x3E +/**< Address of FIFO CGF1 Register */ + +/* Data Register */ +#define SMI130_GYRO_FIFO_DATA_ADDR 0x3F +/**< Address of FIFO Data Register */ + +/* Rate X LSB Register */ +#define SMI130_GYRO_RATE_X_LSB_VALUEX__POS 0 + +/**< Last 8 bits of RateX LSB Registers */ +#define SMI130_GYRO_RATE_X_LSB_VALUEX__LEN 8 +#define SMI130_GYRO_RATE_X_LSB_VALUEX__MSK 0xFF +#define SMI130_GYRO_RATE_X_LSB_VALUEX__REG SMI130_GYRO_RATE_X_LSB_ADDR + +/* Rate Y LSB Register */ +/**< Last 8 bits of RateY LSB Registers */ +#define SMI130_GYRO_RATE_Y_LSB_VALUEY__POS 0 +#define SMI130_GYRO_RATE_Y_LSB_VALUEY__LEN 8 +#define SMI130_GYRO_RATE_Y_LSB_VALUEY__MSK 0xFF +#define SMI130_GYRO_RATE_Y_LSB_VALUEY__REG SMI130_GYRO_RATE_Y_LSB_ADDR + +/* Rate Z LSB Register */ +/**< Last 8 bits of RateZ LSB Registers */ +#define SMI130_GYRO_RATE_Z_LSB_VALUEZ__POS 0 +#define SMI130_GYRO_RATE_Z_LSB_VALUEZ__LEN 8 +#define SMI130_GYRO_RATE_Z_LSB_VALUEZ__MSK 0xFF +#define SMI130_GYRO_RATE_Z_LSB_VALUEZ__REG SMI130_GYRO_RATE_Z_LSB_ADDR + +/* Interrupt status 0 Register */ + /**< 2th bit of Interrupt status 0 register */ +#define SMI130_GYRO_INT_STATUS0_ANY_INT__POS 2 +#define SMI130_GYRO_INT_STATUS0_ANY_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS0_ANY_INT__MSK 0x04 +#define SMI130_GYRO_INT_STATUS0_ANY_INT__REG SMI130_GYRO_INT_STATUS0_ADDR + +/**< 1st bit of Interrupt status 0 register */ +#define SMI130_GYRO_INT_STATUS0_HIGH_INT__POS 1 +#define SMI130_GYRO_INT_STATUS0_HIGH_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS0_HIGH_INT__MSK 0x02 +#define SMI130_GYRO_INT_STATUS0_HIGH_INT__REG SMI130_GYRO_INT_STATUS0_ADDR + + /**< 1st and 2nd bit of Interrupt status 0 register */ +#define SMI130_GYRO_INT_STATUSZERO__POS 1 +#define SMI130_GYRO_INT_STATUSZERO__LEN 2 +#define SMI130_GYRO_INT_STATUSZERO__MSK 0x06 +#define SMI130_GYRO_INT_STATUSZERO__REG SMI130_GYRO_INT_STATUS0_ADDR + +/* Interrupt status 1 Register */ +/**< 7th bit of Interrupt status 1 register */ +#define SMI130_GYRO_INT_STATUS1_DATA_INT__POS 7 +#define SMI130_GYRO_INT_STATUS1_DATA_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS1_DATA_INT__MSK 0x80 +#define SMI130_GYRO_INT_STATUS1_DATA_INT__REG SMI130_GYRO_INT_STATUS1_ADDR + + /**< 6th bit of Interrupt status 1 register */ +#define SMI130_GYRO_INT_STATUS1_AUTO_OFFSET_INT__POS 6 +#define SMI130_GYRO_INT_STATUS1_AUTO_OFFSET_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS1_AUTO_OFFSET_INT__MSK 0x40 +#define SMI130_GYRO_INT_STATUS1_AUTO_OFFSET_INT__REG SMI130_GYRO_INT_STATUS1_ADDR + +/**< 5th bit of Interrupt status 1 register */ +#define SMI130_GYRO_INT_STATUS1_FAST_OFFSET_INT__POS 5 +#define SMI130_GYRO_INT_STATUS1_FAST_OFFSET_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS1_FAST_OFFSET_INT__MSK 0x20 +#define SMI130_GYRO_INT_STATUS1_FAST_OFFSET_INT__REG SMI130_GYRO_INT_STATUS1_ADDR + +/**< 4th bit of Interrupt status 1 register */ +#define SMI130_GYRO_INT_STATUS1_FIFO_INT__POS 4 +#define SMI130_GYRO_INT_STATUS1_FIFO_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS1_FIFO_INT__MSK 0x10 +#define SMI130_GYRO_INT_STATUS1_FIFO_INT__REG SMI130_GYRO_INT_STATUS1_ADDR + +/**< MSB 4 bits of Interrupt status1 register */ +#define SMI130_GYRO_INT_STATUSONE__POS 4 +#define SMI130_GYRO_INT_STATUSONE__LEN 4 +#define SMI130_GYRO_INT_STATUSONE__MSK 0xF0 +#define SMI130_GYRO_INT_STATUSONE__REG SMI130_GYRO_INT_STATUS1_ADDR + +/* Interrupt status 2 Register */ +/**< 3th bit of Interrupt status 2 register */ +#define SMI130_GYRO_INT_STATUS2_ANY_SIGN_INT__POS 3 +#define SMI130_GYRO_INT_STATUS2_ANY_SIGN_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS2_ANY_SIGN_INT__MSK 0x08 +#define SMI130_GYRO_INT_STATUS2_ANY_SIGN_INT__REG SMI130_GYRO_INT_STATUS2_ADDR + +/**< 2th bit of Interrupt status 2 register */ +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTZ_INT__POS 2 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTZ_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTZ_INT__MSK 0x04 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTZ_INT__REG SMI130_GYRO_INT_STATUS2_ADDR + +/**< 1st bit of Interrupt status 2 register */ +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTY_INT__POS 1 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTY_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTY_INT__MSK 0x02 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTY_INT__REG SMI130_GYRO_INT_STATUS2_ADDR + +/**< 0th bit of Interrupt status 2 register */ +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTX_INT__POS 0 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTX_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTX_INT__MSK 0x01 +#define SMI130_GYRO_INT_STATUS2_ANY_FIRSTX_INT__REG SMI130_GYRO_INT_STATUS2_ADDR + +/**< 4 bits of Interrupt status 2 register */ +#define SMI130_GYRO_INT_STATUSTWO__POS 0 +#define SMI130_GYRO_INT_STATUSTWO__LEN 4 +#define SMI130_GYRO_INT_STATUSTWO__MSK 0x0F +#define SMI130_GYRO_INT_STATUSTWO__REG SMI130_GYRO_INT_STATUS2_ADDR + +/* Interrupt status 3 Register */ +/**< 3th bit of Interrupt status 3 register */ +#define SMI130_GYRO_INT_STATUS3_HIGH_SIGN_INT__POS 3 +#define SMI130_GYRO_INT_STATUS3_HIGH_SIGN_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS3_HIGH_SIGN_INT__MSK 0x08 +#define SMI130_GYRO_INT_STATUS3_HIGH_SIGN_INT__REG SMI130_GYRO_INT_STATUS3_ADDR + +/**< 2th bit of Interrupt status 3 register */ +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTZ_INT__POS 2 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTZ_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTZ_INT__MSK 0x04 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTZ_INT__REG SMI130_GYRO_INT_STATUS3_ADDR + +/**< 1st bit of Interrupt status 3 register */ +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTY_INT__POS 1 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTY_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTY_INT__MSK 0x02 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTY_INT__REG SMI130_GYRO_INT_STATUS3_ADDR + +/**< 0th bit of Interrupt status 3 register */ +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTX_INT__POS 0 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTX_INT__LEN 1 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTX_INT__MSK 0x01 +#define SMI130_GYRO_INT_STATUS3_HIGH_FIRSTX_INT__REG SMI130_GYRO_INT_STATUS3_ADDR + +/**< LSB 4 bits of Interrupt status 3 register */ +#define SMI130_GYRO_INT_STATUSTHREE__POS 0 +#define SMI130_GYRO_INT_STATUSTHREE__LEN 4 +#define SMI130_GYRO_INT_STATUSTHREE__MSK 0x0F +#define SMI130_GYRO_INT_STATUSTHREE__REG SMI130_GYRO_INT_STATUS3_ADDR + +/* SMI130_GYRO FIFO Status Register */ +/**< 7th bit of FIFO status Register */ +#define SMI130_GYRO_FIFO_STATUS_OVERRUN__POS 7 +#define SMI130_GYRO_FIFO_STATUS_OVERRUN__LEN 1 +#define SMI130_GYRO_FIFO_STATUS_OVERRUN__MSK 0x80 +#define SMI130_GYRO_FIFO_STATUS_OVERRUN__REG SMI130_GYRO_FIFO_STATUS_ADDR + +/**< First 7 bits of FIFO status Register */ +#define SMI130_GYRO_FIFO_STATUS_FRAME_COUNTER__POS 0 +#define SMI130_GYRO_FIFO_STATUS_FRAME_COUNTER__LEN 7 +#define SMI130_GYRO_FIFO_STATUS_FRAME_COUNTER__MSK 0x7F +#define SMI130_GYRO_FIFO_STATUS_FRAME_COUNTER__REG SMI130_GYRO_FIFO_STATUS_ADDR + +/**< First 3 bits of range Registers */ +#define SMI130_GYRO_RANGE_ADDR_RANGE__POS 0 +#define SMI130_GYRO_RANGE_ADDR_RANGE__LEN 3 +#define SMI130_GYRO_RANGE_ADDR_RANGE__MSK 0x07 +#define SMI130_GYRO_RANGE_ADDR_RANGE__REG SMI130_GYRO_RANGE_ADDR + +/**< Last bit of Bandwidth Registers */ +#define SMI130_GYRO_BW_ADDR_HIGH_RES__POS 7 +#define SMI130_GYRO_BW_ADDR_HIGH_RES__LEN 1 +#define SMI130_GYRO_BW_ADDR_HIGH_RES__MSK 0x80 +#define SMI130_GYRO_BW_ADDR_HIGH_RES__REG SMI130_GYRO_BW_ADDR + +/**< First 3 bits of Bandwidth Registers */ +#define SMI130_GYRO_BW_ADDR__POS 0 +#define SMI130_GYRO_BW_ADDR__LEN 3 +#define SMI130_GYRO_BW_ADDR__MSK 0x07 +#define SMI130_GYRO_BW_ADDR__REG SMI130_GYRO_BW_ADDR + +/**< 6th bit of Bandwidth Registers */ +#define SMI130_GYRO_BW_ADDR_IMG_STB__POS 6 +#define SMI130_GYRO_BW_ADDR_IMG_STB__LEN 1 +#define SMI130_GYRO_BW_ADDR_IMG_STB__MSK 0x40 +#define SMI130_GYRO_BW_ADDR_IMG_STB__REG SMI130_GYRO_BW_ADDR + +/**< 5th and 7th bit of LPM1 Register */ +#define SMI130_GYRO_MODE_LPM1__POS 5 +#define SMI130_GYRO_MODE_LPM1__LEN 3 +#define SMI130_GYRO_MODE_LPM1__MSK 0xA0 +#define SMI130_GYRO_MODE_LPM1__REG SMI130_GYRO_MODE_LPM1_ADDR + +/**< 1st to 3rd bit of LPM1 Register */ +#define SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR__POS 1 +#define SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR__LEN 3 +#define SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR__MSK 0x0E +#define SMI130_GYRO_MODELPM1_ADDR_SLEEPDUR__REG SMI130_GYRO_MODE_LPM1_ADDR + +/**< 7th bit of Mode LPM2 Register */ +#define SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP__POS 7 +#define SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP__LEN 1 +#define SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP__MSK 0x80 +#define SMI130_GYRO_MODE_LPM2_ADDR_FAST_POWERUP__REG SMI130_GYRO_MODE_LPM2_ADDR + +/**< 6th bit of Mode LPM2 Register */ +#define SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING__POS 6 +#define SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING__LEN 1 +#define SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING__MSK 0x40 +#define SMI130_GYRO_MODE_LPM2_ADDR_ADV_POWERSAVING__REG SMI130_GYRO_MODE_LPM2_ADDR + +/**< 4th & 5th bit of Mode LPM2 Register */ +#define SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL__POS 4 +#define SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL__LEN 2 +#define SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL__MSK 0x30 +#define SMI130_GYRO_MODE_LPM2_ADDR_EXT_TRI_SEL__REG SMI130_GYRO_MODE_LPM2_ADDR + +/**< 0th to 2nd bit of LPM2 Register */ +#define SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR__POS 0 +#define SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR__LEN 3 +#define SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR__MSK 0x07 +#define SMI130_GYRO_MODE_LPM2_ADDR_AUTOSLEEPDUR__REG SMI130_GYRO_MODE_LPM2_ADDR + +/**< 7th bit of HBW Register */ +#define SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW__POS 7 +#define SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW__LEN 1 +#define SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW__MSK 0x80 +#define SMI130_GYRO_RATED_HBW_ADDR_DATA_HIGHBW__REG SMI130_GYRO_RATED_HBW_ADDR + +/**< 6th bit of HBW Register */ +#define SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS__POS 6 +#define SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS__LEN 1 +#define SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS__MSK 0x40 +#define SMI130_GYRO_RATED_HBW_ADDR_SHADOW_DIS__REG SMI130_GYRO_RATED_HBW_ADDR + +/**< 7th bit of Interrupt Enable 0 Registers */ +#define SMI130_GYRO_INT_ENABLE0_DATAEN__POS 7 +#define SMI130_GYRO_INT_ENABLE0_DATAEN__LEN 1 +#define SMI130_GYRO_INT_ENABLE0_DATAEN__MSK 0x80 +#define SMI130_GYRO_INT_ENABLE0_DATAEN__REG SMI130_GYRO_INT_ENABLE0_ADDR + +/**< 6th bit of Interrupt Enable 0 Registers */ +#define SMI130_GYRO_INT_ENABLE0_FIFOEN__POS 6 +#define SMI130_GYRO_INT_ENABLE0_FIFOEN__LEN 1 +#define SMI130_GYRO_INT_ENABLE0_FIFOEN__MSK 0x40 +#define SMI130_GYRO_INT_ENABLE0_FIFOEN__REG SMI130_GYRO_INT_ENABLE0_ADDR + +/**< 2nd bit of Interrupt Enable 0 Registers */ +#define SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN__POS 2 +#define SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN__LEN 1 +#define SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN__MSK 0x04 +#define SMI130_GYRO_INT_ENABLE0_AUTO_OFFSETEN__REG SMI130_GYRO_INT_ENABLE0_ADDR + +/**< 3rd bit of Interrupt Enable 1 Registers */ +#define SMI130_GYRO_INT_ENABLE1_IT2_OD__POS 3 +#define SMI130_GYRO_INT_ENABLE1_IT2_OD__LEN 1 +#define SMI130_GYRO_INT_ENABLE1_IT2_OD__MSK 0x08 +#define SMI130_GYRO_INT_ENABLE1_IT2_OD__REG SMI130_GYRO_INT_ENABLE1_ADDR + +/**< 2nd bit of Interrupt Enable 1 Registers */ +#define SMI130_GYRO_INT_ENABLE1_IT2_LVL__POS 2 +#define SMI130_GYRO_INT_ENABLE1_IT2_LVL__LEN 1 +#define SMI130_GYRO_INT_ENABLE1_IT2_LVL__MSK 0x04 +#define SMI130_GYRO_INT_ENABLE1_IT2_LVL__REG SMI130_GYRO_INT_ENABLE1_ADDR + +/**< 1st bit of Interrupt Enable 1 Registers */ +#define SMI130_GYRO_INT_ENABLE1_IT1_OD__POS 1 +#define SMI130_GYRO_INT_ENABLE1_IT1_OD__LEN 1 +#define SMI130_GYRO_INT_ENABLE1_IT1_OD__MSK 0x02 +#define SMI130_GYRO_INT_ENABLE1_IT1_OD__REG SMI130_GYRO_INT_ENABLE1_ADDR + +/**< 0th bit of Interrupt Enable 1 Registers */ +#define SMI130_GYRO_INT_ENABLE1_IT1_LVL__POS 0 +#define SMI130_GYRO_INT_ENABLE1_IT1_LVL__LEN 1 +#define SMI130_GYRO_INT_ENABLE1_IT1_LVL__MSK 0x01 +#define SMI130_GYRO_INT_ENABLE1_IT1_LVL__REG SMI130_GYRO_INT_ENABLE1_ADDR + +/**< 3rd bit of Interrupt MAP 0 Registers */ +#define SMI130_GYRO_INT_MAP_0_INT1_HIGH__POS 3 +#define SMI130_GYRO_INT_MAP_0_INT1_HIGH__LEN 1 +#define SMI130_GYRO_INT_MAP_0_INT1_HIGH__MSK 0x08 +#define SMI130_GYRO_INT_MAP_0_INT1_HIGH__REG SMI130_GYRO_INT_MAP_0_ADDR + +/**< 1st bit of Interrupt MAP 0 Registers */ +#define SMI130_GYRO_INT_MAP_0_INT1_ANY__POS 1 +#define SMI130_GYRO_INT_MAP_0_INT1_ANY__LEN 1 +#define SMI130_GYRO_INT_MAP_0_INT1_ANY__MSK 0x02 +#define SMI130_GYRO_INT_MAP_0_INT1_ANY__REG SMI130_GYRO_INT_MAP_0_ADDR + +/**< 7th bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT2_DATA__POS 7 +#define SMI130_GYRO_MAP_1_INT2_DATA__LEN 1 +#define SMI130_GYRO_MAP_1_INT2_DATA__MSK 0x80 +#define SMI130_GYRO_MAP_1_INT2_DATA__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 6th bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT2_FAST_OFFSET__POS 6 +#define SMI130_GYRO_MAP_1_INT2_FAST_OFFSET__LEN 1 +#define SMI130_GYRO_MAP_1_INT2_FAST_OFFSET__MSK 0x40 +#define SMI130_GYRO_MAP_1_INT2_FAST_OFFSET__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 5th bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT2_FIFO__POS 5 +#define SMI130_GYRO_MAP_1_INT2_FIFO__LEN 1 +#define SMI130_GYRO_MAP_1_INT2_FIFO__MSK 0x20 +#define SMI130_GYRO_MAP_1_INT2_FIFO__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 4th bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET__POS 4 +#define SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET__LEN 1 +#define SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET__MSK 0x10 +#define SMI130_GYRO_MAP_1_INT2_AUTO_OFFSET__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 3rd bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET__POS 3 +#define SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET__LEN 1 +#define SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET__MSK 0x08 +#define SMI130_GYRO_MAP_1_INT1_AUTO_OFFSET__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 2nd bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT1_FIFO__POS 2 +#define SMI130_GYRO_MAP_1_INT1_FIFO__LEN 1 +#define SMI130_GYRO_MAP_1_INT1_FIFO__MSK 0x04 +#define SMI130_GYRO_MAP_1_INT1_FIFO__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 1st bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT1_FAST_OFFSET__POS 1 +#define SMI130_GYRO_MAP_1_INT1_FAST_OFFSET__LEN 1 +#define SMI130_GYRO_MAP_1_INT1_FAST_OFFSET__MSK 0x02 +#define SMI130_GYRO_MAP_1_INT1_FAST_OFFSET__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 0th bit of MAP_1Registers */ +#define SMI130_GYRO_MAP_1_INT1_DATA__POS 0 +#define SMI130_GYRO_MAP_1_INT1_DATA__LEN 1 +#define SMI130_GYRO_MAP_1_INT1_DATA__MSK 0x01 +#define SMI130_GYRO_MAP_1_INT1_DATA__REG SMI130_GYRO_INT_MAP_1_ADDR + +/**< 3rd bit of Interrupt Map 2 Registers */ +#define SMI130_GYRO_INT_MAP_2_INT2_HIGH__POS 3 +#define SMI130_GYRO_INT_MAP_2_INT2_HIGH__LEN 1 +#define SMI130_GYRO_INT_MAP_2_INT2_HIGH__MSK 0x08 +#define SMI130_GYRO_INT_MAP_2_INT2_HIGH__REG SMI130_GYRO_INT_MAP_2_ADDR + +/**< 1st bit of Interrupt Map 2 Registers */ +#define SMI130_GYRO_INT_MAP_2_INT2_ANY__POS 1 +#define SMI130_GYRO_INT_MAP_2_INT2_ANY__LEN 1 +#define SMI130_GYRO_INT_MAP_2_INT2_ANY__MSK 0x02 +#define SMI130_GYRO_INT_MAP_2_INT2_ANY__REG SMI130_GYRO_INT_MAP_2_ADDR + +/**< 5th bit of Interrupt 0 Registers */ +#define SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT__POS 5 +#define SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT__LEN 1 +#define SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT__MSK 0x20 +#define SMI130_GYRO_INT_0_ADDR_SLOW_OFFSET_UNFILT__REG SMI130_GYRO_INT_0_ADDR + +/**< 3rd bit of Interrupt 0 Registers */ +#define SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA__POS 3 +#define SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA__LEN 1 +#define SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA__MSK 0x08 +#define SMI130_GYRO_INT_0_ADDR_HIGH_UNFILT_DATA__REG SMI130_GYRO_INT_0_ADDR + +/**< 1st bit of Interrupt 0 Registers */ +#define SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA__POS 1 +#define SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA__LEN 1 +#define SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA__MSK 0x02 +#define SMI130_GYRO_INT_0_ADDR_ANY_UNFILT_DATA__REG SMI130_GYRO_INT_0_ADDR + +/**< 7th bit of INT_1 Registers */ +#define SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT__POS 7 +#define SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT__LEN 1 +#define SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT__MSK 0x80 +#define SMI130_GYRO_INT_1_ADDR_FAST_OFFSET_UNFILT__REG SMI130_GYRO_INT_1_ADDR + +/**< First 7 bits of INT_1 Registers */ +#define SMI130_GYRO_INT_1_ADDR_ANY_TH__POS 0 +#define SMI130_GYRO_INT_1_ADDR_ANY_TH__LEN 7 +#define SMI130_GYRO_INT_1_ADDR_ANY_TH__MSK 0x7F +#define SMI130_GYRO_INT_1_ADDR_ANY_TH__REG SMI130_GYRO_INT_1_ADDR + +/**< Last 2 bits of INT 2Registers */ +#define SMI130_GYRO_INT_2_ADDR_AWAKE_DUR__POS 6 +#define SMI130_GYRO_INT_2_ADDR_AWAKE_DUR__LEN 2 +#define SMI130_GYRO_INT_2_ADDR_AWAKE_DUR__MSK 0xC0 +#define SMI130_GYRO_INT_2_ADDR_AWAKE_DUR__REG SMI130_GYRO_INT_2_ADDR + +/**< 4th & 5th bit of INT 2Registers */ +#define SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE__POS 4 +#define SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE__LEN 2 +#define SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE__MSK 0x30 +#define SMI130_GYRO_INT_2_ADDR_ANY_DURSAMPLE__REG SMI130_GYRO_INT_2_ADDR + +/**< 2nd bit of INT 2Registers */ +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Z__POS 2 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Z__LEN 1 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Z__MSK 0x04 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Z__REG SMI130_GYRO_INT_2_ADDR + +/**< 1st bit of INT 2Registers */ +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Y__POS 1 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Y__LEN 1 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Y__MSK 0x02 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_Y__REG SMI130_GYRO_INT_2_ADDR + +/**< 0th bit of INT 2Registers */ +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_X__POS 0 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_X__LEN 1 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_X__MSK 0x01 +#define SMI130_GYRO_INT_2_ADDR_ANY_EN_X__REG SMI130_GYRO_INT_2_ADDR + +/**< Last bit of INT 4 Registers */ +#define SMI130_GYRO_INT_4_FIFO_WM_EN__POS 7 +#define SMI130_GYRO_INT_4_FIFO_WM_EN__LEN 1 +#define SMI130_GYRO_INT_4_FIFO_WM_EN__MSK 0x80 +#define SMI130_GYRO_INT_4_FIFO_WM_EN__REG SMI130_GYRO_INT_4_ADDR + +/**< Last bit of Reset Latch Registers */ +#define SMI130_GYRO_RST_LATCH_ADDR_RESET_INT__POS 7 +#define SMI130_GYRO_RST_LATCH_ADDR_RESET_INT__LEN 1 +#define SMI130_GYRO_RST_LATCH_ADDR_RESET_INT__MSK 0x80 +#define SMI130_GYRO_RST_LATCH_ADDR_RESET_INT__REG SMI130_GYRO_RST_LATCH_ADDR + +/**< 6th bit of Reset Latch Registers */ +#define SMI130_GYRO_RST_LATCH_ADDR_OFFSET_RESET__POS 6 +#define SMI130_GYRO_RST_LATCH_ADDR_OFFSET_RESET__LEN 1 +#define SMI130_GYRO_RST_LATCH_ADDR_OFFSET_RESET__MSK 0x40 +#define SMI130_GYRO_RST_LATCH_ADDR_OFFSET_RESET__REG SMI130_GYRO_RST_LATCH_ADDR + +/**< 4th bit of Reset Latch Registers */ +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS__POS 4 +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS__LEN 1 +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS__MSK 0x10 +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_STATUS__REG SMI130_GYRO_RST_LATCH_ADDR + +/**< First 4 bits of Reset Latch Registers */ +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT__POS 0 +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT__LEN 4 +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT__MSK 0x0F +#define SMI130_GYRO_RST_LATCH_ADDR_LATCH_INT__REG SMI130_GYRO_RST_LATCH_ADDR + +/**< Last 2 bits of HIGH_TH_X Registers */ +#define SMI130_GYRO_HIGH_HY_X__POS 6 +#define SMI130_GYRO_HIGH_HY_X__LEN 2 +#define SMI130_GYRO_HIGH_HY_X__MSK 0xC0 +#define SMI130_GYRO_HIGH_HY_X__REG SMI130_GYRO_HIGH_TH_X_ADDR + +/**< 5 bits of HIGH_TH_X Registers */ +#define SMI130_GYRO_HIGH_TH_X__POS 1 +#define SMI130_GYRO_HIGH_TH_X__LEN 5 +#define SMI130_GYRO_HIGH_TH_X__MSK 0x3E +#define SMI130_GYRO_HIGH_TH_X__REG SMI130_GYRO_HIGH_TH_X_ADDR + +/**< 0th bit of HIGH_TH_X Registers */ +#define SMI130_GYRO_HIGH_EN_X__POS 0 +#define SMI130_GYRO_HIGH_EN_X__LEN 1 +#define SMI130_GYRO_HIGH_EN_X__MSK 0x01 +#define SMI130_GYRO_HIGH_EN_X__REG SMI130_GYRO_HIGH_TH_X_ADDR + +/**< Last 2 bits of HIGH_TH_Y Registers */ +#define SMI130_GYRO_HIGH_HY_Y__POS 6 +#define SMI130_GYRO_HIGH_HY_Y__LEN 2 +#define SMI130_GYRO_HIGH_HY_Y__MSK 0xC0 +#define SMI130_GYRO_HIGH_HY_Y__REG SMI130_GYRO_HIGH_TH_Y_ADDR + +/**< 5 bits of HIGH_TH_Y Registers */ +#define SMI130_GYRO_HIGH_TH_Y__POS 1 +#define SMI130_GYRO_HIGH_TH_Y__LEN 5 +#define SMI130_GYRO_HIGH_TH_Y__MSK 0x3E +#define SMI130_GYRO_HIGH_TH_Y__REG SMI130_GYRO_HIGH_TH_Y_ADDR + +/**< 0th bit of HIGH_TH_Y Registers */ +#define SMI130_GYRO_HIGH_EN_Y__POS 0 +#define SMI130_GYRO_HIGH_EN_Y__LEN 1 +#define SMI130_GYRO_HIGH_EN_Y__MSK 0x01 +#define SMI130_GYRO_HIGH_EN_Y__REG SMI130_GYRO_HIGH_TH_Y_ADDR + +/**< Last 2 bits of HIGH_TH_Z Registers */ +#define SMI130_GYRO_HIGH_HY_Z__POS 6 +#define SMI130_GYRO_HIGH_HY_Z__LEN 2 +#define SMI130_GYRO_HIGH_HY_Z__MSK 0xC0 +#define SMI130_GYRO_HIGH_HY_Z__REG SMI130_GYRO_HIGH_TH_Z_ADDR + +/**< 5 bits of HIGH_TH_Z Registers */ +#define SMI130_GYRO_HIGH_TH_Z__POS 1 +#define SMI130_GYRO_HIGH_TH_Z__LEN 5 +#define SMI130_GYRO_HIGH_TH_Z__MSK 0x3E +#define SMI130_GYRO_HIGH_TH_Z__REG SMI130_GYRO_HIGH_TH_Z_ADDR + +/**< 0th bit of HIGH_TH_Z Registers */ +#define SMI130_GYRO_HIGH_EN_Z__POS 0 +#define SMI130_GYRO_HIGH_EN_Z__LEN 1 +#define SMI130_GYRO_HIGH_EN_Z__MSK 0x01 +#define SMI130_GYRO_HIGH_EN_Z__REG SMI130_GYRO_HIGH_TH_Z_ADDR + +/**< Last 3 bits of INT OFF0 Registers */ +#define SMI130_GYRO_SLOW_OFFSET_TH__POS 6 +#define SMI130_GYRO_SLOW_OFFSET_TH__LEN 2 +#define SMI130_GYRO_SLOW_OFFSET_TH__MSK 0xC0 +#define SMI130_GYRO_SLOW_OFFSET_TH__REG SMI130_GYRO_SOC_ADDR + +/**< 2 bits of INT OFF0 Registers */ +#define SMI130_GYRO_SLOW_OFFSET_DUR__POS 3 +#define SMI130_GYRO_SLOW_OFFSET_DUR__LEN 3 +#define SMI130_GYRO_SLOW_OFFSET_DUR__MSK 0x38 +#define SMI130_GYRO_SLOW_OFFSET_DUR__REG SMI130_GYRO_SOC_ADDR + +/**< 2nd bit of INT OFF0 Registers */ +#define SMI130_GYRO_SLOW_OFFSET_EN_Z__POS 2 +#define SMI130_GYRO_SLOW_OFFSET_EN_Z__LEN 1 +#define SMI130_GYRO_SLOW_OFFSET_EN_Z__MSK 0x04 +#define SMI130_GYRO_SLOW_OFFSET_EN_Z__REG SMI130_GYRO_SOC_ADDR + +/**< 1st bit of INT OFF0 Registers */ +#define SMI130_GYRO_SLOW_OFFSET_EN_Y__POS 1 +#define SMI130_GYRO_SLOW_OFFSET_EN_Y__LEN 1 +#define SMI130_GYRO_SLOW_OFFSET_EN_Y__MSK 0x02 +#define SMI130_GYRO_SLOW_OFFSET_EN_Y__REG SMI130_GYRO_SOC_ADDR + +/**< 0th bit of INT OFF0 Registers */ +#define SMI130_GYRO_SLOW_OFFSET_EN_X__POS 0 +#define SMI130_GYRO_SLOW_OFFSET_EN_X__LEN 1 +#define SMI130_GYRO_SLOW_OFFSET_EN_X__MSK 0x01 +#define SMI130_GYRO_SLOW_OFFSET_EN_X__REG SMI130_GYRO_SOC_ADDR + +/**< Last 2 bits of INT OFF1 Registers */ +#define SMI130_GYRO_AUTO_OFFSET_WL__POS 6 +#define SMI130_GYRO_AUTO_OFFSET_WL__LEN 2 +#define SMI130_GYRO_AUTO_OFFSET_WL__MSK 0xC0 +#define SMI130_GYRO_AUTO_OFFSET_WL__REG SMI130_GYRO_A_FOC_ADDR + +/**< 2 bits of INT OFF1 Registers */ +#define SMI130_GYRO_FAST_OFFSET_WL__POS 4 +#define SMI130_GYRO_FAST_OFFSET_WL__LEN 2 +#define SMI130_GYRO_FAST_OFFSET_WL__MSK 0x30 +#define SMI130_GYRO_FAST_OFFSET_WL__REG SMI130_GYRO_A_FOC_ADDR + +/**< 3nd bit of INT OFF1 Registers */ +#define SMI130_GYRO_FAST_OFFSET_EN__POS 3 +#define SMI130_GYRO_FAST_OFFSET_EN__LEN 1 +#define SMI130_GYRO_FAST_OFFSET_EN__MSK 0x08 +#define SMI130_GYRO_FAST_OFFSET_EN__REG SMI130_GYRO_A_FOC_ADDR + +/**< 2nd bit of INT OFF1 Registers */ +#define SMI130_GYRO_FAST_OFFSET_EN_Z__POS 2 +#define SMI130_GYRO_FAST_OFFSET_EN_Z__LEN 1 +#define SMI130_GYRO_FAST_OFFSET_EN_Z__MSK 0x04 +#define SMI130_GYRO_FAST_OFFSET_EN_Z__REG SMI130_GYRO_A_FOC_ADDR + +/**< 1st bit of INT OFF1 Registers */ +#define SMI130_GYRO_FAST_OFFSET_EN_Y__POS 1 +#define SMI130_GYRO_FAST_OFFSET_EN_Y__LEN 1 +#define SMI130_GYRO_FAST_OFFSET_EN_Y__MSK 0x02 +#define SMI130_GYRO_FAST_OFFSET_EN_Y__REG SMI130_GYRO_A_FOC_ADDR + +/**< 0th bit of INT OFF1 Registers */ +#define SMI130_GYRO_FAST_OFFSET_EN_X__POS 0 +#define SMI130_GYRO_FAST_OFFSET_EN_X__LEN 1 +#define SMI130_GYRO_FAST_OFFSET_EN_X__MSK 0x01 +#define SMI130_GYRO_FAST_OFFSET_EN_X__REG SMI130_GYRO_A_FOC_ADDR + +/**< 0 to 2 bits of INT OFF1 Registers */ +#define SMI130_GYRO_FAST_OFFSET_EN_XYZ__POS 0 +#define SMI130_GYRO_FAST_OFFSET_EN_XYZ__LEN 3 +#define SMI130_GYRO_FAST_OFFSET_EN_XYZ__MSK 0x07 +#define SMI130_GYRO_FAST_OFFSET_EN_XYZ__REG SMI130_GYRO_A_FOC_ADDR + +/**< Last 4 bits of Trim NVM control Registers */ +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_REMAIN__POS 4 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_REMAIN__LEN 4 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_REMAIN__MSK 0xF0 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_REMAIN__REG \ +SMI130_GYRO_TRIM_NVM_CTRL_ADDR + +/**< 3rd bit of Trim NVM control Registers */ +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_LOAD__POS 3 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_LOAD__LEN 1 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_LOAD__MSK 0x08 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_LOAD__REG \ +SMI130_GYRO_TRIM_NVM_CTRL_ADDR + +/**< 2nd bit of Trim NVM control Registers */ +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_RDY__POS 2 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_RDY__LEN 1 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_RDY__MSK 0x04 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_RDY__REG \ +SMI130_GYRO_TRIM_NVM_CTRL_ADDR + + /**< 1st bit of Trim NVM control Registers */ +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_TRIG__POS 1 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_TRIG__LEN 1 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_TRIG__MSK 0x02 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_TRIG__REG \ +SMI130_GYRO_TRIM_NVM_CTRL_ADDR + +/**< 0th bit of Trim NVM control Registers */ +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE__POS 0 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE__LEN 1 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE__MSK 0x01 +#define SMI130_GYRO_TRIM_NVM_CTRL_ADDR_NVM_PROG_MODE__REG \ +SMI130_GYRO_TRIM_NVM_CTRL_ADDR + + /**< 2nd bit of SPI3 WDT Registers */ +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN__POS 2 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN__LEN 1 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN__MSK 0x04 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_EN__REG \ +SMI130_GYRO_BGW_SPI3_WDT_ADDR + + /**< 1st bit of SPI3 WDT Registers */ +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL__POS 1 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL__LEN 1 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL__MSK 0x02 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_I2C_WDT_SEL__REG \ +SMI130_GYRO_BGW_SPI3_WDT_ADDR + +/**< 0th bit of SPI3 WDT Registers */ +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3__POS 0 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3__LEN 1 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3__MSK 0x01 +#define SMI130_GYRO_BGW_SPI3_WDT_ADDR_SPI3__REG \ +SMI130_GYRO_BGW_SPI3_WDT_ADDR + +/**< 4th bit of Self test Registers */ +#define SMI130_GYRO_SELF_TEST_ADDR_RATEOK__POS 4 +#define SMI130_GYRO_SELF_TEST_ADDR_RATEOK__LEN 1 +#define SMI130_GYRO_SELF_TEST_ADDR_RATEOK__MSK 0x10 +#define SMI130_GYRO_SELF_TEST_ADDR_RATEOK__REG \ +SMI130_GYRO_SELF_TEST_ADDR + +/**< 2nd bit of Self test Registers */ +#define SMI130_GYRO_SELF_TEST_ADDR_BISTFAIL__POS 2 +#define SMI130_GYRO_SELF_TEST_ADDR_BISTFAIL__LEN 1 +#define SMI130_GYRO_SELF_TEST_ADDR_BISTFAIL__MSK 0x04 +#define SMI130_GYRO_SELF_TEST_ADDR_BISTFAIL__REG \ +SMI130_GYRO_SELF_TEST_ADDR + +/**< 1st bit of Self test Registers */ +#define SMI130_GYRO_SELF_TEST_ADDR_BISTRDY__POS 1 +#define SMI130_GYRO_SELF_TEST_ADDR_BISTRDY__LEN 1 +#define SMI130_GYRO_SELF_TEST_ADDR_BISTRDY__MSK 0x02 +#define SMI130_GYRO_SELF_TEST_ADDR_BISTRDY__REG \ +SMI130_GYRO_SELF_TEST_ADDR + +/**< 0th bit of Self test Registers */ +#define SMI130_GYRO_SELF_TEST_ADDR_TRIGBIST__POS 0 +#define SMI130_GYRO_SELF_TEST_ADDR_TRIGBIST__LEN 1 +#define SMI130_GYRO_SELF_TEST_ADDR_TRIGBIST__MSK 0x01 +#define SMI130_GYRO_SELF_TEST_ADDR_TRIGBIST__REG \ +SMI130_GYRO_SELF_TEST_ADDR + +/**< 7th bit of FIFO CGF1 Registers */ +#define SMI130_GYRO_FIFO_CGF1_ADDR_TAG__POS 7 +#define SMI130_GYRO_FIFO_CGF1_ADDR_TAG__LEN 1 +#define SMI130_GYRO_FIFO_CGF1_ADDR_TAG__MSK 0x80 +#define SMI130_GYRO_FIFO_CGF1_ADDR_TAG__REG SMI130_GYRO_FIFO_CGF1_ADDR + +/**< First 7 bits of FIFO CGF1 Registers */ +#define SMI130_GYRO_FIFO_CGF1_ADDR_WML__POS 0 +#define SMI130_GYRO_FIFO_CGF1_ADDR_WML__LEN 7 +#define SMI130_GYRO_FIFO_CGF1_ADDR_WML__MSK 0x7F +#define SMI130_GYRO_FIFO_CGF1_ADDR_WML__REG SMI130_GYRO_FIFO_CGF1_ADDR + +/**< Last 2 bits of FIFO CGF0 Addr Registers */ +#define SMI130_GYRO_FIFO_CGF0_ADDR_MODE__POS 6 +#define SMI130_GYRO_FIFO_CGF0_ADDR_MODE__LEN 2 +#define SMI130_GYRO_FIFO_CGF0_ADDR_MODE__MSK 0xC0 +#define SMI130_GYRO_FIFO_CGF0_ADDR_MODE__REG SMI130_GYRO_FIFO_CGF0_ADDR + +/**< First 2 bits of FIFO CGF0 Addr Registers */ +#define SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL__POS 0 +#define SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL__LEN 2 +#define SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL__MSK 0x03 +#define SMI130_GYRO_FIFO_CGF0_ADDR_DATA_SEL__REG SMI130_GYRO_FIFO_CGF0_ADDR + + /**< Last 2 bits of INL Offset MSB Registers */ +#define SMI130_GYRO_OFC1_ADDR_OFFSET_X__POS 6 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_X__LEN 2 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_X__MSK 0xC0 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_X__REG SMI130_GYRO_OFC1_ADDR + +/**< 3 bits of INL Offset MSB Registers */ +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Y__POS 3 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Y__LEN 3 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Y__MSK 0x38 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Y__REG SMI130_GYRO_OFC1_ADDR + +/**< First 3 bits of INL Offset MSB Registers */ +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Z__POS 0 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Z__LEN 3 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Z__MSK 0x07 +#define SMI130_GYRO_OFC1_ADDR_OFFSET_Z__REG SMI130_GYRO_OFC1_ADDR + +/**< 4 bits of Trim GP0 Registers */ +#define SMI130_GYRO_TRIM_GP0_ADDR_GP0__POS 4 +#define SMI130_GYRO_TRIM_GP0_ADDR_GP0__LEN 4 +#define SMI130_GYRO_TRIM_GP0_ADDR_GP0__MSK 0xF0 +#define SMI130_GYRO_TRIM_GP0_ADDR_GP0__REG SMI130_GYRO_TRIM_GP0_ADDR + +/**< 2 bits of Trim GP0 Registers */ +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X__POS 2 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X__LEN 2 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X__MSK 0x0C +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_X__REG SMI130_GYRO_TRIM_GP0_ADDR + +/**< 1st bit of Trim GP0 Registers */ +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y__POS 1 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y__LEN 1 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y__MSK 0x02 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Y__REG SMI130_GYRO_TRIM_GP0_ADDR + +/**< First bit of Trim GP0 Registers */ +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z__POS 0 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z__LEN 1 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z__MSK 0x01 +#define SMI130_GYRO_TRIM_GP0_ADDR_OFFSET_Z__REG SMI130_GYRO_TRIM_GP0_ADDR + +/* For Axis Selection */ +/**< It refers SMI130_GYRO X-axis */ +#define SMI130_GYRO_X_AXIS 0 +/**< It refers SMI130_GYRO Y-axis */ +#define SMI130_GYRO_Y_AXIS 1 +/**< It refers SMI130_GYRO Z-axis */ +#define SMI130_GYRO_Z_AXIS 2 + +/* For Mode Settings */ +#define SMI130_GYRO_MODE_NORMAL 0 +#define SMI130_GYRO_MODE_DEEPSUSPEND 1 +#define SMI130_GYRO_MODE_SUSPEND 2 +#define SMI130_GYRO_MODE_FASTPOWERUP 3 +#define SMI130_GYRO_MODE_ADVANCEDPOWERSAVING 4 + +/* get bit slice */ +#define SMI130_GYRO_GET_BITSLICE(regvar, bitname)\ +((regvar & bitname##__MSK) >> bitname##__POS) + +/* Set bit slice */ +#define SMI130_GYRO_SET_BITSLICE(regvar, bitname, val)\ +((regvar&~bitname##__MSK)|((val<<bitname##__POS)&bitname##__MSK)) +/* Constants */ + +#define SMI130_GYRO_NULL 0 +/**< constant declaration of NULL */ +#define SMI130_GYRO_DISABLE 0 +/**< It refers SMI130_GYRO disable */ +#define SMI130_GYRO_ENABLE 1 +/**< It refers SMI130_GYRO enable */ +#define SMI130_GYRO_OFF 0 +/**< It refers SMI130_GYRO OFF state */ +#define SMI130_GYRO_ON 1 +/**< It refers SMI130_GYRO ON state */ + + +#define SMI130_GYRO_TURN1 0 +/**< It refers SMI130_GYRO TURN1 */ +#define SMI130_GYRO_TURN2 1 +/**< It refers SMI130_GYRO TURN2 */ + +#define SMI130_GYRO_INT1 0 +/**< It refers SMI130_GYRO INT1 */ +#define SMI130_GYRO_INT2 1 +/**< It refers SMI130_GYRO INT2 */ + +#define SMI130_GYRO_SLOW_OFFSET 0 +/**< It refers SMI130_GYRO Slow Offset */ +#define SMI130_GYRO_AUTO_OFFSET 1 +/**< It refers SMI130_GYRO Auto Offset */ +#define SMI130_GYRO_FAST_OFFSET 2 +/**< It refers SMI130_GYRO Fast Offset */ +#define SMI130_GYRO_S_TAP 0 +/**< It refers SMI130_GYRO Single Tap */ +#define SMI130_GYRO_D_TAP 1 +/**< It refers SMI130_GYRO Double Tap */ +#define SMI130_GYRO_INT1_DATA 0 +/**< It refers SMI130_GYRO Int1 Data */ +#define SMI130_GYRO_INT2_DATA 1 +/**< It refers SMI130_GYRO Int2 Data */ +#define SMI130_GYRO_TAP_UNFILT_DATA 0 +/**< It refers SMI130_GYRO Tap unfilt data */ +#define SMI130_GYRO_HIGH_UNFILT_DATA 1 +/**< It refers SMI130_GYRO High unfilt data */ +#define SMI130_GYRO_CONST_UNFILT_DATA 2 +/**< It refers SMI130_GYRO Const unfilt data */ +#define SMI130_GYRO_ANY_UNFILT_DATA 3 +/**< It refers SMI130_GYRO Any unfilt data */ +#define SMI130_GYRO_SHAKE_UNFILT_DATA 4 +/**< It refers SMI130_GYRO Shake unfilt data */ +#define SMI130_GYRO_SHAKE_TH 0 +/**< It refers SMI130_GYRO Shake Threshold */ +#define SMI130_GYRO_SHAKE_TH2 1 +/**< It refers SMI130_GYRO Shake Threshold2 */ +#define SMI130_GYRO_AUTO_OFFSET_WL 0 +/**< It refers SMI130_GYRO Auto Offset word length */ +#define SMI130_GYRO_FAST_OFFSET_WL 1 +/**< It refers SMI130_GYRO Fast Offset word length */ +#define SMI130_GYRO_I2C_WDT_EN 0 +/**< It refers SMI130_GYRO I2C WDT En */ +#define SMI130_GYRO_I2C_WDT_SEL 1 +/**< It refers SMI130_GYRO I2C WDT Sel */ +#define SMI130_GYRO_EXT_MODE 0 +/**< It refers SMI130_GYRO Ext Mode */ +#define SMI130_GYRO_EXT_PAGE 1 +/**< It refers SMI130_GYRO Ext page */ +#define SMI130_GYRO_START_ADDR 0 +/**< It refers SMI130_GYRO Start Address */ +#define SMI130_GYRO_STOP_ADDR 1 +/**< It refers SMI130_GYRO Stop Address */ +#define SMI130_GYRO_SLOW_CMD 0 +/**< It refers SMI130_GYRO Slow Command */ +#define SMI130_GYRO_FAST_CMD 1 +/**< It refers SMI130_GYRO Fast Command */ +#define SMI130_GYRO_TRIM_VRA 0 +/**< It refers SMI130_GYRO Trim VRA */ +#define SMI130_GYRO_TRIM_VRD 1 +/**< It refers SMI130_GYRO Trim VRD */ +#define SMI130_GYRO_LOGBIT_EM 0 +/**< It refers SMI130_GYRO LogBit Em */ +#define SMI130_GYRO_LOGBIT_VM 1 +/**< It refers SMI130_GYRO LogBit VM */ +#define SMI130_GYRO_GP0 0 +/**< It refers SMI130_GYRO GP0 */ +#define SMI130_GYRO_GP1 1 +/**< It refers SMI130_GYRO GP1*/ +#define SMI130_GYRO_LOW_SPEED 0 +/**< It refers SMI130_GYRO Low Speed Oscillator */ +#define SMI130_GYRO_HIGH_SPEED 1 +/**< It refers SMI130_GYRO High Speed Oscillator */ +#define SMI130_GYRO_DRIVE_OFFSET_P 0 +/**< It refers SMI130_GYRO Drive Offset P */ +#define SMI130_GYRO_DRIVE_OFFSET_N 1 +/**< It refers SMI130_GYRO Drive Offset N */ +#define SMI130_GYRO_TEST_MODE_EN 0 +/**< It refers SMI130_GYRO Test Mode Enable */ +#define SMI130_GYRO_TEST_MODE_REG 1 +/**< It refers SMI130_GYRO Test Mode reg */ +#define SMI130_GYRO_IBIAS_DRIVE_TRIM 0 +/**< It refers SMI130_GYRO IBIAS Drive Trim */ +#define SMI130_GYRO_IBIAS_RATE_TRIM 1 +/**< It refers SMI130_GYRO IBIAS Rate Trim */ +#define SMI130_GYRO_BAA_MODE 0 +/**< It refers SMI130_GYRO BAA Mode Trim */ +#define SMI130_GYRO_SMI_ACC_MODE 1 +/**< It refers SMI130_GYRO SMI_ACC Mode Trim */ +#define SMI130_GYRO_PI_KP 0 +/**< It refers SMI130_GYRO PI KP */ +#define SMI130_GYRO_PI_KI 1 +/**< It refers SMI130_GYRO PI KI */ + + +#define C_SMI130_GYRO_SUCCESS 0 +/**< It refers SMI130_GYRO operation is success */ +#define C_SMI130_GYRO_FAILURE 1 +/**< It refers SMI130_GYRO operation is Failure */ + +#define SMI130_GYRO_SPI_RD_MASK 0x80 +/**< Read mask **/ +#define SMI130_GYRO_READ_SET 0x01 +/**< Setting for rading data **/ + +#define SMI130_GYRO_SHIFT_1_POSITION 1 +/**< Shift bit by 1 Position **/ +#define SMI130_GYRO_SHIFT_2_POSITION 2 +/**< Shift bit by 2 Position **/ +#define SMI130_GYRO_SHIFT_3_POSITION 3 +/**< Shift bit by 3 Position **/ +#define SMI130_GYRO_SHIFT_4_POSITION 4 +/**< Shift bit by 4 Position **/ +#define SMI130_GYRO_SHIFT_5_POSITION 5 +/**< Shift bit by 5 Position **/ +#define SMI130_GYRO_SHIFT_6_POSITION 6 +/**< Shift bit by 6 Position **/ +#define SMI130_GYRO_SHIFT_7_POSITION 7 +/**< Shift bit by 7 Position **/ +#define SMI130_GYRO_SHIFT_8_POSITION 8 +/**< Shift bit by 8 Position **/ +#define SMI130_GYRO_SHIFT_12_POSITION 12 +/**< Shift bit by 12 Position **/ + +#define C_SMI130_GYRO_Null_U8X 0 +#define C_SMI130_GYRO_Zero_U8X 0 +#define C_SMI130_GYRO_One_U8X 1 +#define C_SMI130_GYRO_Two_U8X 2 +#define C_SMI130_GYRO_Three_U8X 3 +#define C_SMI130_GYRO_Four_U8X 4 +#define C_SMI130_GYRO_Five_U8X 5 +#define C_SMI130_GYRO_Six_U8X 6 +#define C_SMI130_GYRO_Seven_U8X 7 +#define C_SMI130_GYRO_Eight_U8X 8 +#define C_SMI130_GYRO_Nine_U8X 9 +#define C_SMI130_GYRO_Ten_U8X 10 +#define C_SMI130_GYRO_Eleven_U8X 11 +#define C_SMI130_GYRO_Twelve_U8X 12 +#define C_SMI130_GYRO_Thirteen_U8X 13 +#define C_SMI130_GYRO_Fifteen_U8X 15 +#define C_SMI130_GYRO_Sixteen_U8X 16 +#define C_SMI130_GYRO_TwentyTwo_U8X 22 +#define C_SMI130_GYRO_TwentyThree_U8X 23 +#define C_SMI130_GYRO_TwentyFour_U8X 24 +#define C_SMI130_GYRO_TwentyFive_U8X 25 +#define C_SMI130_GYRO_ThirtyTwo_U8X 32 +#define C_SMI130_GYRO_Hundred_U8X 100 +#define C_SMI130_GYRO_OneTwentySeven_U8X 127 +#define C_SMI130_GYRO_OneTwentyEight_U8X 128 +#define C_SMI130_GYRO_TwoFiftyFive_U8X 255 +#define C_SMI130_GYRO_TwoFiftySix_U16X 256 + +#define E_SMI130_GYRO_NULL_PTR (signed char)(-127) +#define E_SMI130_GYRO_COMM_RES (signed char)(-1) +#define E_SMI130_GYRO_OUT_OF_RANGE (signed char)(-2) + +#define C_SMI130_GYRO_No_Filter_U8X 0 +#define C_SMI130_GYRO_BW_230Hz_U8X 1 +#define C_SMI130_GYRO_BW_116Hz_U8X 2 +#define C_SMI130_GYRO_BW_47Hz_U8X 3 +#define C_SMI130_GYRO_BW_23Hz_U8X 4 +#define C_SMI130_GYRO_BW_12Hz_U8X 5 +#define C_SMI130_GYRO_BW_64Hz_U8X 6 +#define C_SMI130_GYRO_BW_32Hz_U8X 7 + +#define C_SMI130_GYRO_No_AutoSleepDur_U8X 0 +#define C_SMI130_GYRO_4ms_AutoSleepDur_U8X 1 +#define C_SMI130_GYRO_5ms_AutoSleepDur_U8X 2 +#define C_SMI130_GYRO_8ms_AutoSleepDur_U8X 3 +#define C_SMI130_GYRO_10ms_AutoSleepDur_U8X 4 +#define C_SMI130_GYRO_15ms_AutoSleepDur_U8X 5 +#define C_SMI130_GYRO_20ms_AutoSleepDur_U8X 6 +#define C_SMI130_GYRO_40ms_AutoSleepDur_U8X 7 + + + + +#define SMI130_GYRO_WR_FUNC_PTR int (*bus_write)\ +(unsigned char, unsigned char, unsigned char *, unsigned char) +#define SMI130_GYRO_RD_FUNC_PTR int (*bus_read)\ +(unsigned char, unsigned char, unsigned char *, unsigned char) +#define SMI130_GYRO_BRD_FUNC_PTR int (*burst_read)\ +(unsigned char, unsigned char, unsigned char *, SMI130_GYRO_S32) +#define SMI130_GYRO_MDELAY_DATA_TYPE SMI130_GYRO_U16 + + + + +/*user defined Structures*/ +struct smi130_gyro_data_t { + SMI130_GYRO_S16 datax; + SMI130_GYRO_S16 datay; + SMI130_GYRO_S16 dataz; + char intstatus[5]; +}; + + +struct smi130_gyro_offset_t { + SMI130_GYRO_U16 datax; + SMI130_GYRO_U16 datay; + SMI130_GYRO_U16 dataz; +}; + + +struct smi130_gyro_t { + unsigned char chip_id; + unsigned char dev_addr; + SMI130_GYRO_BRD_FUNC_PTR; + SMI130_GYRO_WR_FUNC_PTR; + SMI130_GYRO_RD_FUNC_PTR; + void(*delay_msec)(SMI130_GYRO_MDELAY_DATA_TYPE); +}; + +/*************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * + * + * \return + * + * + ***************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ***************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_init(struct smi130_gyro_t *p_smi130_gyro); +/*************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * + * + * \return + * + * + ***************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataX(SMI130_GYRO_S16 *data_x); +/**************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ***************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataY(SMI130_GYRO_S16 *data_y); +/*************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ***************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataZ(SMI130_GYRO_S16 *data_z); +/************************************************************ + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + *************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ***************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataXYZ(struct smi130_gyro_data_t *data); +/*************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ********************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_dataXYZI(struct smi130_gyro_data_t *data); +/******************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ********************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_Temperature(unsigned char *temperature); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_FIFO_data_reg +(unsigned char *fifo_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_read_register(unsigned char addr, +unsigned char *data, unsigned char len); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_burst_read(unsigned char addr, +unsigned char *data, SMI130_GYRO_S32 len); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_write_register(unsigned char addr, +unsigned char *data, unsigned char len); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_0 +(unsigned char *status0_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_1 +(unsigned char *status1_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_2 +(unsigned char *status2_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_interrupt_status_reg_3 +(unsigned char *status3_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ + +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifostatus_reg +(unsigned char *fifo_status); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_range_reg +(unsigned char *range); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_range_reg +(unsigned char range); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_res +(unsigned char *high_res); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_res +(unsigned char high_res); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_bw(unsigned char *bandwidth); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_bw(unsigned char bandwidth); +/**************************************************************************** + * Description: *//**\brief + * + * + + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_pmu_ext_tri_sel +(unsigned char *pwu_ext_tri_sel); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_pmu_ext_tri_sel +(unsigned char pwu_ext_tri_sel); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_bw +(unsigned char *high_bw); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_bw +(unsigned char high_bw); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_shadow_dis +(unsigned char *shadow_dis); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_shadow_dis +(unsigned char shadow_dis); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_soft_reset(void); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_data_enable(unsigned char *data_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_data_en(unsigned char data_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_enable(unsigned char *fifo_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_enable(unsigned char fifo_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_offset_enable +(unsigned char mode, unsigned char *offset_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset_enable +(unsigned char mode, unsigned char offset_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_od +(unsigned char param, unsigned char *int_od); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_od +(unsigned char param, unsigned char int_od); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_lvl +(unsigned char param, unsigned char *int_lvl); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_lvl +(unsigned char param, unsigned char int_lvl); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_high +(unsigned char *int1_high); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_high +(unsigned char int1_high); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_any +(unsigned char *int1_any); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_any +(unsigned char int1_any); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_data +(unsigned char axis, unsigned char *int_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_data +(unsigned char axis, unsigned char int_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_offset +(unsigned char axis, unsigned char *int2_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_offset +(unsigned char axis, unsigned char int2_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_offset +(unsigned char axis, unsigned char *int1_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_offset +(unsigned char axis, unsigned char int1_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int_fifo(unsigned char *int_fifo); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int_fifo +(unsigned char axis, unsigned char int_fifo); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_high +(unsigned char *int2_high); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_high +(unsigned char int2_high); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_any +(unsigned char *int2_any); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_any +(unsigned char int2_any); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_offset_unfilt +(unsigned char param, unsigned char *offset_unfilt); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset_unfilt +(unsigned char param, unsigned char offset_unfilt); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_unfilt_data +(unsigned char param, unsigned char *unfilt_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_unfilt_data +(unsigned char param, unsigned char unfilt_data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_any_th +(unsigned char *any_th); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_any_th +(unsigned char any_th); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_awake_dur +(unsigned char *awake_dur); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_awake_dur +(unsigned char awake_dur); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_any_dursample +(unsigned char *dursample); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_any_dursample +(unsigned char dursample); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_any_en_ch +(unsigned char channel, unsigned char *data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_any_en_ch +(unsigned char channel, unsigned char data); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_watermark_enable +(unsigned char *fifo_wn_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_watermark_enable +(unsigned char fifo_wn_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_reset_int +(unsigned char reset_int); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset_reset +(unsigned char offset_reset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_latch_status +(unsigned char *latch_status); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_latch_status +(unsigned char latch_status); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_latch_int +(unsigned char *latch_int); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_latch_int +(unsigned char latch_int); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_hy +(unsigned char channel, unsigned char *high_hy); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_hy +(unsigned char channel, unsigned char high_hy); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_th +(unsigned char channel, unsigned char *high_th); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_th +(unsigned char channel, unsigned char high_th); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_en_ch +(unsigned char channel, unsigned char *high_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_en_ch +(unsigned char channel, unsigned char high_en); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_high_dur_ch +(unsigned char channel, unsigned char *high_dur); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_high_dur_ch +(unsigned char channel, unsigned char high_dur); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_slow_offset_th +(unsigned char *offset_th); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_slow_offset_th +(unsigned char offset_th); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_slow_offset_dur +(unsigned char *offset_dur); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_slow_offset_dur +(unsigned char offset_dur); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_slow_offset_en_ch +(unsigned char channel, unsigned char *slow_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_slow_offset_en_ch +(unsigned char channel, unsigned char slow_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_offset_wl +(unsigned char channel, unsigned char *offset_wl); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset_wl +(unsigned char channel, unsigned char offset_wl); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fast_offset_en +(unsigned char fast_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fast_offset_en_ch +(unsigned char *fast_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fast_offset_en_ch +(unsigned char channel, unsigned char fast_offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_enable_fast_offset(void); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_nvm_remain +(unsigned char *nvm_remain); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_nvm_load +(unsigned char nvm_load); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_nvm_rdy +(unsigned char *nvm_rdy); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_nvm_prog_trig +(unsigned char prog_trig); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_nvm_prog_mode +(unsigned char *prog_mode); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_nvm_prog_mode +(unsigned char prog_mode); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_i2c_wdt +(unsigned char i2c_wdt, unsigned char *prog_mode); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_i2c_wdt +(unsigned char i2c_wdt, unsigned char prog_mode); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_spi3(unsigned char *spi3); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_spi3(unsigned char spi3); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_tag(unsigned char *tag); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_tag(unsigned char tag); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_watermarklevel +(unsigned char *water_mark_level); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_watermarklevel +(unsigned char water_mark_level); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_mode +(unsigned char *mode); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_mode(unsigned char mode); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_data_sel +(unsigned char *data_sel); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_fifo_data_sel +(unsigned char data_sel); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_offset +(unsigned char axis, SMI130_GYRO_S16 *offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_offset +(unsigned char axis, SMI130_GYRO_S16 offset); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_gp +(unsigned char param, unsigned char *value); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_gp +(unsigned char param, unsigned char value); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_framecount +(unsigned char *fifo_framecount); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_fifo_overrun +(unsigned char *fifo_overrun); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int2_fifo +(unsigned char *int_fifo); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_int1_fifo +(unsigned char *int_fifo); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int2_fifo +(unsigned char fifo_int2); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_int1_fifo +(unsigned char fifo_int1); +/**************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_mode(unsigned char *mode); +/***************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_mode(unsigned char mode); +/***************************************************************************** + * Description: *//**\brief + * + * + * + * + * \param + * + * + * \return + * + * + ****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + ****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_selftest(unsigned char *result); +/***************************************************************************** + * Description: *//**\brief This API is used to get data auto sleep duration + * + * + * + * + * \param unsigned char *duration : Address of auto sleep duration + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_autosleepdur(unsigned char *duration); +/***************************************************************************** + * Description: *//**\brief This API is used to set duration + * + * + * + * + * \param unsigned char duration: + * Value to be written passed as a parameter + * unsigned char bandwidth: + * Value to be written passed as a parameter + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_autosleepdur(unsigned char duration, +unsigned char bandwith); +/***************************************************************************** + * Description: *//**\brief This API is used to get data sleep duration + * + * + * + * + * \param unsigned char *duration : Address of sleep duration + * Pointer to a variable passed as a parameter + * + * + * + * \return + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_sleepdur(unsigned char *duration); +/***************************************************************************** + * Description: *//**\brief This API is used to set duration + * + * + * + * + * \param unsigned char duration: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_sleepdur(unsigned char duration); +/***************************************************************************** + * Description: *//**\brief This API is used to set auto offset + * + * + * + * + * \param unsigned char duration: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_set_auto_offset_en(unsigned char offset_en); +/***************************************************************************** + * Description: *//**\brief This API is used to get auto offset + * + * + * + * + * \param unsigned char duration: + * Value to be written passed as a parameter + * + * + * + * \return communication results + * + * + *****************************************************************************/ +/* Scheduling: + * + * + * + * Usage guide: + * + * + * Remarks: + * + *****************************************************************************/ +SMI130_GYRO_RETURN_FUNCTION_TYPE smi130_gyro_get_auto_offset_en( +unsigned char *offset_en); +#endif diff --git a/drivers/input/sensors/smi130/smi130_gyro_driver.c b/drivers/input/sensors/smi130/smi130_gyro_driver.c new file mode 100644 index 000000000000..65e303c6d8e6 --- /dev/null +++ b/drivers/input/sensors/smi130/smi130_gyro_driver.c @@ -0,0 +1,2036 @@ +/*! + * @section LICENSE + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved + * + * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved + * + * This software program is licensed subject to the GNU General + * Public License (GPL).Version 2,June 1991, + * available at http://www.fsf.org/copyleft/gpl.html + * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * @filename smi130_gyro_driver.c + * @date 2015/11/17 13:44 + * @Modification Date 2018/08/28 18:20 + * @id "836294d" + * @version 1.5.9 + * + * @brief SMI130_GYRO Linux Driver + */ +#ifdef __KERNEL__ +#include <linux/kernel.h> +#include <linux/unistd.h> +#include <linux/types.h> +#include <linux/string.h> +#else +#include <unistd.h> +#include <sys/types.h> +#include <string.h> +#endif +#include <linux/math64.h> +#include <linux/version.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/input.h> +#include <linux/workqueue.h> +#include <linux/mutex.h> +#include <linux/slab.h> +#include <linux/delay.h> +#include <linux/gpio.h> +#include <linux/of_gpio.h> +#include <linux/of_irq.h> + +#ifdef CONFIG_HAS_EARLYSUSPEND +#include <linux/earlysuspend.h> +#endif + +#include "smi130_gyro.h" +#include "bs_log.h" + +/* sensor specific */ +#define SENSOR_NAME "smi130_gyro" +#define SMI130_GYRO_ENABLE_INT1 1 +#define SENSOR_CHIP_ID_SMI_GYRO (0x0f) +#define CHECK_CHIP_ID_TIME_MAX 5 +#define DRIVER_VERSION "0.0.53.0" +#define SMI_GYRO_USE_FIFO 1 +#define SMI_GYRO_USE_BASIC_I2C_FUNC 1 +#define SMI_GYRO_REG_NAME(name) SMI130_GYRO_##name +#define SMI_GYRO_VAL_NAME(name) SMI130_GYRO_##name +#define SMI_GYRO_CALL_API(name) smi130_gyro_##name +#define MSC_TIME 6 + +#define SMI_GYRO_I2C_WRITE_DELAY_TIME 1 + +/* generic */ +#define SMI_GYRO_MAX_RETRY_I2C_XFER (100) +#define SMI_GYRO_MAX_RETRY_WAKEUP (5) +#define SMI_GYRO_MAX_RETRY_WAIT_DRDY (100) + +#define SMI_GYRO_DELAY_MIN (1) +#define SMI_GYRO_DELAY_DEFAULT (200) + +#define SMI_GYRO_VALUE_MAX (32767) +#define SMI_GYRO_VALUE_MIN (-32768) + +#define BYTES_PER_LINE (16) + +#define SMI_GYRO_SELF_TEST 0 + +#define SMI_GYRO_SOFT_RESET_VALUE 0xB6 + +#ifdef SMI_GYRO_USE_FIFO +#define MAX_FIFO_F_LEVEL 100 +#define MAX_FIFO_F_BYTES 8 +#define SMI130_GYRO_FIFO_DAT_SEL_X 1 +#define SMI130_GYRO_FIFO_DAT_SEL_Y 2 +#define SMI130_GYRO_FIFO_DAT_SEL_Z 3 +#endif + +/*! + * @brief:BMI058 feature + * macro definition +*/ +#ifdef CONFIG_SENSORS_BMI058 +/*! BMI058 X AXIS definition*/ +#define BMI058_X_AXIS SMI130_GYRO_Y_AXIS +/*! BMI058 Y AXIS definition*/ +#define BMI058_Y_AXIS SMI130_GYRO_X_AXIS + +#define C_BMI058_One_U8X 1 +#define C_BMI058_Two_U8X 2 +#endif + +/*! Bosch sensor unknown place*/ +#define BOSCH_SENSOR_PLACE_UNKNOWN (-1) +/*! Bosch sensor remapping table size P0~P7*/ +#define MAX_AXIS_REMAP_TAB_SZ 8 + + +struct bosch_sensor_specific { + char *name; + /* 0 to 7 */ + int place; + int irq; + int (*irq_gpio_cfg)(void); +}; + + +/*! + * we use a typedef to hide the detail, + * because this type might be changed + */ +struct bosch_sensor_axis_remap { + /* src means which source will be mapped to target x, y, z axis */ + /* if an target OS axis is remapped from (-)x, + * src is 0, sign_* is (-)1 */ + /* if an target OS axis is remapped from (-)y, + * src is 1, sign_* is (-)1 */ + /* if an target OS axis is remapped from (-)z, + * src is 2, sign_* is (-)1 */ + int src_x:3; + int src_y:3; + int src_z:3; + + int sign_x:2; + int sign_y:2; + int sign_z:2; +}; + + +struct bosch_sensor_data { + union { + int16_t v[3]; + struct { + int16_t x; + int16_t y; + int16_t z; + }; + }; +}; + +struct smi_gyro_client_data { + struct smi130_gyro_t device; + struct i2c_client *client; + struct input_dev *input; + struct delayed_work work; + +#ifdef CONFIG_HAS_EARLYSUSPEND + struct early_suspend early_suspend_handler; +#endif + + atomic_t delay; + uint8_t debug_level; + struct smi130_gyro_data_t value; + u8 enable:1; + unsigned int fifo_count; + unsigned char fifo_datasel; + uint64_t timestamp; + uint64_t base_time; + uint64_t fifo_time; + uint64_t gyro_count; + uint64_t time_odr; + /* controls not only reg, but also workqueue */ + struct mutex mutex_op_mode; + struct mutex mutex_enable; + struct bosch_sensor_specific *bosch_pd; + struct work_struct report_data_work; + int is_timer_running; + struct hrtimer timer; + ktime_t work_delay_kt; + uint8_t gpio_pin; + int16_t IRQ; + struct work_struct irq_work; +}; + +static struct i2c_client *smi_gyro_client; +/* i2c operation for API */ +static int smi_gyro_i2c_read(struct i2c_client *client, u8 reg_addr, + u8 *data, u8 len); +static int smi_gyro_i2c_write(struct i2c_client *client, u8 reg_addr, + u8 *data, u8 len); + +static void smi_gyro_dump_reg(struct i2c_client *client); +static int smi_gyro_check_chip_id(struct i2c_client *client); + +static int smi_gyro_pre_suspend(struct i2c_client *client); +static int smi_gyro_post_resume(struct i2c_client *client); + +#ifdef CONFIG_HAS_EARLYSUSPEND +static void smi_gyro_early_suspend(struct early_suspend *handler); +static void smi_gyro_late_resume(struct early_suspend *handler); +#endif + +static void smi130_gyro_delay(SMI130_GYRO_U16 msec) +{ + if (msec <= 20) + usleep_range(msec * 1000, msec * 1000); + else + msleep(msec); +} + +/*! +* SMI130_GYRO sensor remapping function +* need to give some parameter in BSP files first. +*/ +static const struct bosch_sensor_axis_remap + bosch_axis_remap_tab_dft[MAX_AXIS_REMAP_TAB_SZ] = { + /* src_x src_y src_z sign_x sign_y sign_z */ + { 0, 1, 2, 1, 1, 1 }, /* P0 */ + { 1, 0, 2, 1, -1, 1 }, /* P1 */ + { 0, 1, 2, -1, -1, 1 }, /* P2 */ + { 1, 0, 2, -1, 1, 1 }, /* P3 */ + + { 0, 1, 2, -1, 1, -1 }, /* P4 */ + { 1, 0, 2, -1, -1, -1 }, /* P5 */ + { 0, 1, 2, 1, -1, -1 }, /* P6 */ + { 1, 0, 2, 1, 1, -1 }, /* P7 */ +}; + +static void bosch_remap_sensor_data(struct bosch_sensor_data *data, + const struct bosch_sensor_axis_remap *remap) +{ + struct bosch_sensor_data tmp; + + tmp.x = data->v[remap->src_x] * remap->sign_x; + tmp.y = data->v[remap->src_y] * remap->sign_y; + tmp.z = data->v[remap->src_z] * remap->sign_z; + + memcpy(data, &tmp, sizeof(*data)); +} + +static void bosch_remap_sensor_data_dft_tab(struct bosch_sensor_data *data, + int place) +{ +/* sensor with place 0 needs not to be remapped */ + if ((place <= 0) || (place >= MAX_AXIS_REMAP_TAB_SZ)) + return; + bosch_remap_sensor_data(data, &bosch_axis_remap_tab_dft[place]); +} + +static void smi130_gyro_remap_sensor_data(struct smi130_gyro_data_t *val, + struct smi_gyro_client_data *client_data) +{ + struct bosch_sensor_data bsd; + int place; + + if ((NULL == client_data->bosch_pd) || (BOSCH_SENSOR_PLACE_UNKNOWN + == client_data->bosch_pd->place)) + place = BOSCH_SENSOR_PLACE_UNKNOWN; + else + place = client_data->bosch_pd->place; + +#ifdef CONFIG_SENSORS_BMI058 +/*x,y need to be invesed becase of HW Register for BMI058*/ + bsd.y = val->datax; + bsd.x = val->datay; + bsd.z = val->dataz; +#else + bsd.x = val->datax; + bsd.y = val->datay; + bsd.z = val->dataz; +#endif + + bosch_remap_sensor_data_dft_tab(&bsd, place); + + val->datax = bsd.x; + val->datay = bsd.y; + val->dataz = bsd.z; + +} + +static int smi_gyro_check_chip_id(struct i2c_client *client) +{ + int err = -1; + u8 chip_id = 0; + u8 read_count = 0; + + while (read_count++ < CHECK_CHIP_ID_TIME_MAX) { + smi_gyro_i2c_read(client, SMI_GYRO_REG_NAME(CHIP_ID_ADDR), &chip_id, 1); + PINFO("read chip id result: %#x", chip_id); + + if ((chip_id & 0xff) != SENSOR_CHIP_ID_SMI_GYRO) { + smi130_gyro_delay(1); + } else { + err = 0; + break; + } + } + return err; +} + +static void smi_gyro_dump_reg(struct i2c_client *client) +{ + int i; + u8 dbg_buf[64]; + u8 dbg_buf_str[64 * 3 + 1] = ""; + + for (i = 0; i < BYTES_PER_LINE; i++) { + dbg_buf[i] = i; + snprintf(dbg_buf_str + i * 3, 16, "%02x%c", + dbg_buf[i], + (((i + 1) % BYTES_PER_LINE == 0) ? '\n' : ' ')); + } + dev_dbg(&client->dev, "%s\n", dbg_buf_str); + + smi_gyro_i2c_read(client, SMI_GYRO_REG_NAME(CHIP_ID_ADDR), dbg_buf, 64); + for (i = 0; i < 64; i++) { + snprintf(dbg_buf_str + i * 3, 16, "%02x%c", + dbg_buf[i], + (((i + 1) % BYTES_PER_LINE == 0) ? '\n' : ' ')); + } + dev_dbg(&client->dev, "%s\n", dbg_buf_str); +} + +/*i2c read routine for API*/ +static int smi_gyro_i2c_read(struct i2c_client *client, u8 reg_addr, + u8 *data, u8 len) +{ +#if !defined SMI_GYRO_USE_BASIC_I2C_FUNC + s32 dummy; + if (NULL == client) + return -ENODEV; + + while (0 != len--) { +#ifdef SMI_GYRO_SMBUS + dummy = i2c_smbus_read_byte_data(client, reg_addr); + if (dummy < 0) { + dev_err(&client->dev, "i2c bus read error"); + return -EIO; + } + *data = (u8)(dummy & 0xff); +#else + dummy = i2c_master_send(client, (char *)®_addr, 1); + if (dummy < 0) + return -EIO; + + dummy = i2c_master_recv(client, (char *)data, 1); + if (dummy < 0) + return -EIO; +#endif + reg_addr++; + data++; + } + return 0; +#else + int retry; + + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = ®_addr, + }, + + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = len, + .buf = data, + }, + }; + + for (retry = 0; retry < SMI_GYRO_MAX_RETRY_I2C_XFER; retry++) { + if (i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)) > 0) + break; + else + smi130_gyro_delay(SMI_GYRO_I2C_WRITE_DELAY_TIME); + } + + if (SMI_GYRO_MAX_RETRY_I2C_XFER <= retry) { + dev_err(&client->dev, "I2C xfer error"); + return -EIO; + } + + return 0; +#endif +} + +#ifdef SMI_GYRO_USE_FIFO +static int smi_gyro_i2c_burst_read(struct i2c_client *client, u8 reg_addr, + u8 *data, u16 len) +{ + int retry; + + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = ®_addr, + }, + + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = len, + .buf = data, + }, + }; + + for (retry = 0; retry < SMI_GYRO_MAX_RETRY_I2C_XFER; retry++) { + if (i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)) > 0) + break; + else + smi130_gyro_delay(SMI_GYRO_I2C_WRITE_DELAY_TIME); + } + + if (SMI_GYRO_MAX_RETRY_I2C_XFER <= retry) { + dev_err(&client->dev, "I2C xfer error"); + return -EIO; + } + + return 0; +} +#endif + +/*i2c write routine for */ +static int smi_gyro_i2c_write(struct i2c_client *client, u8 reg_addr, + u8 *data, u8 len) +{ +#if !defined SMI_GYRO_USE_BASIC_I2C_FUNC + s32 dummy; + +#ifndef SMI_GYRO_SMBUS + u8 buffer[2]; +#endif + + if (NULL == client) + return -ENODEV; + + while (0 != len--) { +#ifdef SMI_GYRO_SMBUS + dummy = i2c_smbus_write_byte_data(client, reg_addr, *data); +#else + buffer[0] = reg_addr; + buffer[1] = *data; + dummy = i2c_master_send(client, (char *)buffer, 2); +#endif + reg_addr++; + data++; + if (dummy < 0) { + dev_err(&client->dev, "error writing i2c bus"); + return -EIO; + } + + } + return 0; +#else + u8 buffer[2]; + int retry; + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = 2, + .buf = buffer, + }, + }; + + while (0 != len--) { + buffer[0] = reg_addr; + buffer[1] = *data; + for (retry = 0; retry < SMI_GYRO_MAX_RETRY_I2C_XFER; retry++) { + if (i2c_transfer(client->adapter, msg, + ARRAY_SIZE(msg)) > 0) { + break; + } else { + smi130_gyro_delay(SMI_GYRO_I2C_WRITE_DELAY_TIME); + } + } + if (SMI_GYRO_MAX_RETRY_I2C_XFER <= retry) { + dev_err(&client->dev, "I2C xfer error"); + return -EIO; + } + reg_addr++; + data++; + } + + return 0; +#endif +} + +static int smi_gyro_i2c_read_wrapper(u8 dev_addr, u8 reg_addr, u8 *data, u8 len) +{ + int err; + err = smi_gyro_i2c_read(smi_gyro_client, reg_addr, data, len); + return err; +} + +static int smi_gyro_i2c_write_wrapper(u8 dev_addr, u8 reg_addr, u8 *data, u8 len) +{ + int err; + err = smi_gyro_i2c_write(smi_gyro_client, reg_addr, data, len); + return err; +} + + +static void smi_gyro_work_func(struct work_struct *work) +{ + struct smi_gyro_client_data *client_data = + container_of((struct delayed_work *)work, + struct smi_gyro_client_data, work); + + unsigned long delay = + msecs_to_jiffies(atomic_read(&client_data->delay)); + struct smi130_gyro_data_t gyro_data; + + SMI_GYRO_CALL_API(get_dataXYZ)(&gyro_data); + /*remapping for SMI130_GYRO sensor*/ + smi130_gyro_remap_sensor_data(&gyro_data, client_data); + + input_report_abs(client_data->input, ABS_X, gyro_data.datax); + input_report_abs(client_data->input, ABS_Y, gyro_data.datay); + input_report_abs(client_data->input, ABS_Z, gyro_data.dataz); + input_sync(client_data->input); + + schedule_delayed_work(&client_data->work, delay); +} + +static struct workqueue_struct *reportdata_wq; + +uint64_t smi130_gyro_get_alarm_timestamp(void) +{ + uint64_t ts_ap; + struct timespec tmp_time; + get_monotonic_boottime(&tmp_time); + ts_ap = (uint64_t)tmp_time.tv_sec * 1000000000 + tmp_time.tv_nsec; + return ts_ap; +} +#define ABS(x) ((x) > 0 ? (x) : -(x)) + +static void smi130_gyro_work_func(struct work_struct *work) +{ + struct smi_gyro_client_data *smi130_gyro = + container_of(work, + struct smi_gyro_client_data, report_data_work); + int i; + struct smi130_gyro_data_t gyro_lsb; + unsigned char fifo_framecount; + signed char fifo_data_out[MAX_FIFO_F_LEVEL * MAX_FIFO_F_BYTES] = {0}; + unsigned char f_len = 0; + uint64_t del; + uint64_t time_internal; + struct timespec ts; + int64_t drift_time = 0; + static uint64_t time_odr; + static uint32_t data_cnt; + static uint32_t pre_data_cnt; + static int64_t sample_drift_offset; + if (smi130_gyro->fifo_datasel) + /*Select one axis data output for every fifo frame*/ + f_len = 2; + else + /*Select X Y Z axis data output for every fifo frame*/ + f_len = 6; + if (SMI_GYRO_CALL_API(get_fifo_framecount)(&fifo_framecount) < 0) { + PERR("bm160_get_fifo_framecount err\n"); + return; + } + if (fifo_framecount == 0) + return; + if (fifo_framecount > MAX_FIFO_F_LEVEL) + fifo_framecount = MAX_FIFO_F_LEVEL; + if (smi_gyro_i2c_burst_read(smi130_gyro->client, SMI130_GYRO_FIFO_DATA_ADDR, + fifo_data_out, fifo_framecount * f_len) < 0) { + PERR("smi130_gyro read fifo err\n"); + return; + } + smi130_gyro->fifo_time = smi130_gyro_get_alarm_timestamp(); + if (smi130_gyro->gyro_count == 0) + smi130_gyro->base_time = smi130_gyro->timestamp = + smi130_gyro->fifo_time - (fifo_framecount-1) * smi130_gyro->time_odr; + + smi130_gyro->gyro_count += fifo_framecount; + del = smi130_gyro->fifo_time - smi130_gyro->base_time; + time_internal = div64_u64(del, smi130_gyro->gyro_count); + data_cnt++; + if (data_cnt == 1) + time_odr = smi130_gyro->time_odr; + if (time_internal > time_odr) { + if (time_internal - time_odr > div64_u64 (time_odr, 200)) + time_internal = time_odr + div64_u64(time_odr, 200); + } else { + if (time_odr - time_internal > div64_u64(time_odr, 200)) + time_internal = time_odr - div64_u64(time_odr, 200); + } + + /* Select X Y Z axis data output for every frame */ + for (i = 0; i < fifo_framecount; i++) { + if (smi130_gyro->debug_level & 0x01) + printk(KERN_INFO "smi_gyro time =%llu fifo_time = %llu time_internal = %llu smi_gyro->count= %llu count = %d", + smi130_gyro->timestamp, smi130_gyro->fifo_time, + time_internal, smi130_gyro->gyro_count, fifo_framecount); + ts = ns_to_timespec(smi130_gyro->timestamp); + gyro_lsb.datax = + ((unsigned char)fifo_data_out[i * f_len + 1] << 8 + | (unsigned char)fifo_data_out[i * f_len + 0]); + gyro_lsb.datay = + ((unsigned char)fifo_data_out[i * f_len + 3] << 8 + | (unsigned char)fifo_data_out[i * f_len + 2]); + gyro_lsb.dataz = + ((unsigned char)fifo_data_out[i * f_len + 5] << 8 + | (unsigned char)fifo_data_out[i * f_len + 4]); + smi130_gyro_remap_sensor_data(&gyro_lsb, smi130_gyro); + input_event(smi130_gyro->input, EV_MSC, MSC_TIME, + ts.tv_sec); + input_event(smi130_gyro->input, EV_MSC, MSC_TIME, + ts.tv_nsec); + input_event(smi130_gyro->input, EV_MSC, + MSC_GESTURE, gyro_lsb.datax); + input_event(smi130_gyro->input, EV_MSC, + MSC_RAW, gyro_lsb.datay); + input_event(smi130_gyro->input, EV_MSC, + MSC_SCAN, gyro_lsb.dataz); + input_sync(smi130_gyro->input); + smi130_gyro->timestamp += time_internal - sample_drift_offset; + } + drift_time = smi130_gyro->timestamp - smi130_gyro->fifo_time; + if (data_cnt % 20 == 0) { + if (ABS(drift_time) > div64_u64(time_odr, 5)) { + sample_drift_offset = + div64_s64(drift_time, smi130_gyro->gyro_count - pre_data_cnt); + pre_data_cnt = smi130_gyro->gyro_count; + time_odr = time_internal; + } + } +} + + +static enum hrtimer_restart reportdata_timer_fun( + struct hrtimer *hrtimer) +{ + struct smi_gyro_client_data *client_data = + container_of(hrtimer, struct smi_gyro_client_data, timer); + int32_t delay = 0; + delay = 10; + queue_work(reportdata_wq, &(client_data->report_data_work)); + client_data->work_delay_kt = ns_to_ktime(delay*1000000); + hrtimer_forward(hrtimer, ktime_get(), client_data->work_delay_kt); + + return HRTIMER_RESTART; +} + +static ssize_t smi_gyro_show_enable_timer(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + + return snprintf(buf, 16, "%d\n", client_data->is_timer_running); +} + +static ssize_t smi_gyro_store_enable_timer(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + error = kstrtoul(buf, 10, &data); + if (error) + return error; + if (data) { + if (0 == client_data->is_timer_running) { + hrtimer_start(&client_data->timer, + ns_to_ktime(10000000), + HRTIMER_MODE_REL); + client_data->is_timer_running = 1; + client_data->base_time = 0; + client_data->timestamp = 0; + client_data->gyro_count = 0; + } + } else { + if (1 == client_data->is_timer_running) { + hrtimer_cancel(&client_data->timer); + client_data->is_timer_running = 0; + client_data->base_time = 0; + client_data->timestamp = 0; + client_data->gyro_count = 0; + } + } + return count; +} + +static ssize_t smi130_gyro_show_debug_level(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + err = snprintf(buf, 8, "%d\n", client_data->debug_level); + return err; +} +static ssize_t smi130_gyro_store_debug_level(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int32_t ret = 0; + unsigned long data; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + ret = kstrtoul(buf, 16, &data); + if (ret) + return ret; + client_data->debug_level = (uint8_t)data; + return count; +} + +static int smi_gyro_set_soft_reset(struct i2c_client *client) +{ + int err = 0; + unsigned char data = SMI_GYRO_SOFT_RESET_VALUE; + err = smi_gyro_i2c_write(client, SMI130_GYRO_BGW_SOFTRESET_ADDR, &data, 1); + return err; +} + +static ssize_t smi_gyro_show_chip_id(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return snprintf(buf, 16, "%d\n", SENSOR_CHIP_ID_SMI_GYRO); +} + +static ssize_t smi_gyro_show_op_mode(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int ret; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + u8 op_mode = 0xff; + + mutex_lock(&client_data->mutex_op_mode); + SMI_GYRO_CALL_API(get_mode)(&op_mode); + mutex_unlock(&client_data->mutex_op_mode); + + ret = snprintf(buf, 16, "%d\n", op_mode); + + return ret; +} + +static ssize_t smi_gyro_store_op_mode(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + + long op_mode; + + err = kstrtoul(buf, 10, &op_mode); + if (err) + return err; + mutex_lock(&client_data->mutex_op_mode); + + err = SMI_GYRO_CALL_API(set_mode)(op_mode); + + mutex_unlock(&client_data->mutex_op_mode); + + if (err) + return err; + else + return count; +} + + + +static ssize_t smi_gyro_show_value(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + int count; + + struct smi130_gyro_data_t value_data; + SMI_GYRO_CALL_API(get_dataXYZ)(&value_data); + /*SMI130_GYRO sensor raw data remapping*/ + smi130_gyro_remap_sensor_data(&value_data, client_data); + + count = snprintf(buf, 96, "%hd %hd %hd\n", + value_data.datax, + value_data.datay, + value_data.dataz); + + return count; +} + +static ssize_t smi_gyro_show_range(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char range = 0; + SMI_GYRO_CALL_API(get_range_reg)(&range); + err = snprintf(buf, 16, "%d\n", range); + return err; +} + +static ssize_t smi_gyro_store_range(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + unsigned long range; + err = kstrtoul(buf, 10, &range); + if (err) + return err; + SMI_GYRO_CALL_API(set_range_reg)(range); + return count; +} + +/* +decimation odr filter bandwidth bits +20 100HZ 32HZ 7 +10 200Hz 64HZ 6 +20 100HZ 12HZ 5 +10 200hz 23HZ 4 +5 400HZ 47HZ 3 +2 1000HZ 116HZ 2 +0 2000HZ 230HZ 1 +0 2000HZ Unfiltered(523HZ) 0 +*/ + +static const uint64_t odr_map[8] = { +500000, 500000, 1000000, 2500000, 5000000, 10000000, 5000000, 10000000}; + +static ssize_t smi_gyro_show_bandwidth(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char bandwidth = 0; + SMI_GYRO_CALL_API(get_bw)(&bandwidth); + err = snprintf(buf, 16, "%d\n", bandwidth); + return err; +} + +static ssize_t smi_gyro_store_bandwidth(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + unsigned long bandwidth; + u8 op_mode = 0xff; + err = kstrtoul(buf, 10, &bandwidth); + if (err) + return err; + /* + set bandwidth only in the op_mode=0 + */ + err = SMI_GYRO_CALL_API(get_mode)(&op_mode); + if (op_mode == 0) { + err += SMI_GYRO_CALL_API(set_bw)(bandwidth); + } else { + err += SMI_GYRO_CALL_API(set_mode)(0); + err += SMI_GYRO_CALL_API(set_bw)(bandwidth); + smi130_gyro_delay(1); + err += SMI_GYRO_CALL_API(set_mode)(2); + smi130_gyro_delay(3); + } + + if (err) + PERR("set failed"); + client_data->time_odr = odr_map[bandwidth]; + client_data->base_time = 0; + client_data->gyro_count = 0; + return count; +} + + +static ssize_t smi_gyro_show_enable(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + int err; + + mutex_lock(&client_data->mutex_enable); + err = snprintf(buf, 16, "%d\n", client_data->enable); + mutex_unlock(&client_data->mutex_enable); + return err; +} + +static ssize_t smi_gyro_store_enable(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int err; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + + err = kstrtoul(buf, 10, &data); + if (err) + return err; + + data = data ? 1 : 0; + mutex_lock(&client_data->mutex_enable); + if (data != client_data->enable) { + if (data) { + schedule_delayed_work( + &client_data->work, + msecs_to_jiffies(atomic_read( + &client_data->delay))); + } else { + cancel_delayed_work_sync(&client_data->work); + } + + client_data->enable = data; + } + mutex_unlock(&client_data->mutex_enable); + + return count; +} + +static ssize_t smi_gyro_show_delay(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + + return snprintf(buf, 16, "%d\n", atomic_read(&client_data->delay)); + +} + +static ssize_t smi_gyro_store_delay(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int err; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + + err = kstrtoul(buf, 10, &data); + if (err) + return err; + + if (data == 0) { + err = -EINVAL; + return err; + } + + if (data < SMI_GYRO_DELAY_MIN) + data = SMI_GYRO_DELAY_MIN; + + atomic_set(&client_data->delay, data); + + return count; +} + + +static ssize_t smi_gyro_store_fastoffset_en(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + unsigned long fastoffset_en; + err = kstrtoul(buf, 10, &fastoffset_en); + if (err) + return err; + if (fastoffset_en) { + +#ifdef CONFIG_SENSORS_BMI058 + SMI_GYRO_CALL_API(set_fast_offset_en_ch)(BMI058_X_AXIS, 1); + SMI_GYRO_CALL_API(set_fast_offset_en_ch)(BMI058_Y_AXIS, 1); +#else + SMI_GYRO_CALL_API(set_fast_offset_en_ch)(SMI130_GYRO_X_AXIS, 1); + SMI_GYRO_CALL_API(set_fast_offset_en_ch)(SMI130_GYRO_Y_AXIS, 1); +#endif + + SMI_GYRO_CALL_API(set_fast_offset_en_ch)(SMI130_GYRO_Z_AXIS, 1); + SMI_GYRO_CALL_API(enable_fast_offset)(); + } + return count; +} + +static ssize_t smi_gyro_store_slowoffset_en(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + unsigned long slowoffset_en; + err = kstrtoul(buf, 10, &slowoffset_en); + if (err) + return err; + if (slowoffset_en) { + SMI_GYRO_CALL_API(set_slow_offset_th)(3); + SMI_GYRO_CALL_API(set_slow_offset_dur)(0); +#ifdef CONFIG_SENSORS_BMI058 + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(BMI058_X_AXIS, 1); + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(BMI058_Y_AXIS, 1); +#else + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(SMI130_GYRO_X_AXIS, 1); + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(SMI130_GYRO_Y_AXIS, 1); +#endif + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(SMI130_GYRO_Z_AXIS, 1); + } else { +#ifdef CONFIG_SENSORS_BMI058 + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(BMI058_X_AXIS, 0); + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(BMI058_Y_AXIS, 0); +#else + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(SMI130_GYRO_X_AXIS, 0); + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(SMI130_GYRO_Y_AXIS, 0); +#endif + SMI_GYRO_CALL_API(set_slow_offset_en_ch)(SMI130_GYRO_Z_AXIS, 0); + } + + return count; +} + +static ssize_t smi_gyro_show_selftest(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char selftest; + SMI_GYRO_CALL_API(selftest)(&selftest); + err = snprintf(buf, 16, "%d\n", selftest); + return err; +} + +static ssize_t smi_gyro_show_sleepdur(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char sleepdur; + SMI_GYRO_CALL_API(get_sleepdur)(&sleepdur); + err = snprintf(buf, 16, "%d\n", sleepdur); + return err; +} + +static ssize_t smi_gyro_store_sleepdur(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + unsigned long sleepdur; + err = kstrtoul(buf, 10, &sleepdur); + if (err) + return err; + SMI_GYRO_CALL_API(set_sleepdur)(sleepdur); + return count; +} + +static ssize_t smi_gyro_show_autosleepdur(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char autosleepdur; + SMI_GYRO_CALL_API(get_autosleepdur)(&autosleepdur); + err = snprintf(buf, 16, "%d\n", autosleepdur); + return err; +} + +static ssize_t smi_gyro_store_autosleepdur(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + unsigned long autosleepdur; + unsigned char bandwidth; + err = kstrtoul(buf, 10, &autosleepdur); + if (err) + return err; + SMI_GYRO_CALL_API(get_bw)(&bandwidth); + SMI_GYRO_CALL_API(set_autosleepdur)(autosleepdur, bandwidth); + return count; +} + +static ssize_t smi_gyro_show_place(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + int place = BOSCH_SENSOR_PLACE_UNKNOWN; + + if (NULL != client_data->bosch_pd) + place = client_data->bosch_pd->place; + + return snprintf(buf, 16, "%d\n", place); +} + + +#ifdef SMI_GYRO_DEBUG +static ssize_t smi_gyro_store_softreset(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + unsigned long softreset; + err = kstrtoul(buf, 10, &softreset); + if (err) + return err; + SMI_GYRO_CALL_API(set_soft_reset)(); + return count; +} + +static ssize_t smi_gyro_show_dumpreg(struct device *dev, + struct device_attribute *attr, char *buf) +{ + size_t count = 0; + u8 reg[0x40]; + int i; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + + for (i = 0; i < 0x40; i++) { + smi_gyro_i2c_read(client_data->client, i, reg+i, 1); + + count += snprintf(&buf[count], 48, "0x%x: 0x%x\n", i, reg[i]); + } + return count; +} +#endif + +#ifdef SMI_GYRO_USE_FIFO +static ssize_t smi_gyro_show_fifo_mode(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char fifo_mode; + SMI_GYRO_CALL_API(get_fifo_mode)(&fifo_mode); + err = snprintf(buf, 16, "%d\n", fifo_mode); + return err; +} + +static ssize_t smi_gyro_store_fifo_mode(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int err; + unsigned long fifo_mode; + err = kstrtoul(buf, 10, &fifo_mode); + if (err) + return err; + SMI_GYRO_CALL_API(set_fifo_mode)(fifo_mode); + return count; +} + +static ssize_t smi_gyro_show_fifo_framecount(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char fifo_framecount; + SMI_GYRO_CALL_API(get_fifo_framecount)(&fifo_framecount); + err = snprintf(buf, 32, "%d\n", fifo_framecount); + return err; +} + +static ssize_t smi_gyro_store_fifo_framecount(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int error; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + error = kstrtoul(buf, 10, &data); + if (error) + return error; + client_data->fifo_count = (unsigned int) data; + + return count; +} + +static ssize_t smi_gyro_show_fifo_overrun(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char fifo_overrun; + SMI_GYRO_CALL_API(get_fifo_overrun)(&fifo_overrun); + err = snprintf(buf, 16, "%d\n", fifo_overrun); + return err; +} + +static ssize_t smi_gyro_show_fifo_data_frame(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned char f_len = 0; + unsigned char fifo_framecount; + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + + if (client_data->fifo_datasel) + /*Select one axis data output for every fifo frame*/ + f_len = 2; + else + /*Select X Y Z axis data output for every fifo frame*/ + f_len = 6; + + if (SMI_GYRO_CALL_API(get_fifo_framecount)(&fifo_framecount) < 0) { + PERR("bm160_get_fifo_framecount err\n"); + return -EINVAL; + } + if (fifo_framecount == 0) + return 0; + + smi_gyro_i2c_burst_read(client_data->client, SMI130_GYRO_FIFO_DATA_ADDR, + buf, fifo_framecount * f_len); + return fifo_framecount * f_len; +} + +/*! + * @brief show fifo_data_sel axis definition(Android definition, not sensor HW reg). + * 0--> x, y, z axis fifo data for every frame + * 1--> only x axis fifo data for every frame + * 2--> only y axis fifo data for every frame + * 3--> only z axis fifo data for every frame + */ +static ssize_t smi_gyro_show_fifo_data_sel(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char fifo_data_sel; + struct i2c_client *client = to_i2c_client(dev); + struct smi_gyro_client_data *client_data = i2c_get_clientdata(client); + signed char place = BOSCH_SENSOR_PLACE_UNKNOWN; + + SMI_GYRO_CALL_API(get_fifo_data_sel)(&fifo_data_sel); + + /*remapping fifo_dat_sel if define virtual place in BSP files*/ + if ((NULL != client_data->bosch_pd) && + (BOSCH_SENSOR_PLACE_UNKNOWN != client_data->bosch_pd->place)) { + place = client_data->bosch_pd->place; + /* sensor with place 0 needs not to be remapped */ + if ((place > 0) && (place < MAX_AXIS_REMAP_TAB_SZ)) { + if (SMI130_GYRO_FIFO_DAT_SEL_X == fifo_data_sel) + /* SMI130_GYRO_FIFO_DAT_SEL_X: 1, Y:2, Z:3; + *bosch_axis_remap_tab_dft[i].src_x:0, y:1, z:2 + *so we need to +1*/ + fifo_data_sel = + bosch_axis_remap_tab_dft[place].src_x + 1; + + else if (SMI130_GYRO_FIFO_DAT_SEL_Y == fifo_data_sel) + fifo_data_sel = + bosch_axis_remap_tab_dft[place].src_y + 1; + } + + } + + err = snprintf(buf, 16, "%d\n", fifo_data_sel); + return err; +} + +/*! + * @brief store fifo_data_sel axis definition(Android definition, not sensor HW reg). + * 0--> x, y, z axis fifo data for every frame + * 1--> only x axis fifo data for every frame + * 2--> only y axis fifo data for every frame + * 3--> only z axis fifo data for every frame + */ +static ssize_t smi_gyro_store_fifo_data_sel(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) + +{ + int err; + unsigned long fifo_data_sel; + + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + signed char place; + + err = kstrtoul(buf, 10, &fifo_data_sel); + if (err) + return err; + + /*save fifo_data_sel(android axis definition)*/ + client_data->fifo_datasel = (unsigned char) fifo_data_sel; + + /*remaping fifo_dat_sel if define virtual place*/ + if ((NULL != client_data->bosch_pd) && + (BOSCH_SENSOR_PLACE_UNKNOWN != client_data->bosch_pd->place)) { + place = client_data->bosch_pd->place; + /* sensor with place 0 needs not to be remapped */ + if ((place > 0) && (place < MAX_AXIS_REMAP_TAB_SZ)) { + /*Need X Y axis revesal sensor place: P1, P3, P5, P7 */ + /* SMI130_GYRO_FIFO_DAT_SEL_X: 1, Y:2, Z:3; + * but bosch_axis_remap_tab_dft[i].src_x:0, y:1, z:2 + * so we need to +1*/ + if (SMI130_GYRO_FIFO_DAT_SEL_X == fifo_data_sel) + fifo_data_sel = + bosch_axis_remap_tab_dft[place].src_x + 1; + + else if (SMI130_GYRO_FIFO_DAT_SEL_Y == fifo_data_sel) + fifo_data_sel = + bosch_axis_remap_tab_dft[place].src_y + 1; + } + } + + if (SMI_GYRO_CALL_API(set_fifo_data_sel)(fifo_data_sel) < 0) + return -EINVAL; + + return count; +} + +static ssize_t smi_gyro_show_fifo_tag(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int err; + unsigned char fifo_tag; + SMI_GYRO_CALL_API(get_fifo_tag)(&fifo_tag); + err = snprintf(buf, 16, "%d\n", fifo_tag); + return err; +} + +static ssize_t smi_gyro_store_fifo_tag(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) + +{ + int err; + unsigned long fifo_tag; + err = kstrtoul(buf, 10, &fifo_tag); + if (err) + return err; + SMI_GYRO_CALL_API(set_fifo_tag)(fifo_tag); + return count; +} +#endif + +static ssize_t smi130_gyro_driver_version_show(struct device *dev + , struct device_attribute *attr, char *buf) +{ + struct input_dev *input = to_input_dev(dev); + struct smi_gyro_client_data *client_data = input_get_drvdata(input); + int ret; + + if (client_data == NULL) { + printk(KERN_ERR "Invalid client_data pointer"); + return -ENODEV; + } + + ret = snprintf(buf, 128, "Driver version: %s\n", + DRIVER_VERSION); + return ret; +} +static DEVICE_ATTR(chip_id, S_IRUSR, + smi_gyro_show_chip_id, NULL); +static DEVICE_ATTR(op_mode, S_IRUGO | S_IWUSR, + smi_gyro_show_op_mode, smi_gyro_store_op_mode); +static DEVICE_ATTR(value, S_IRUSR, + smi_gyro_show_value, NULL); +static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, + smi_gyro_show_range, smi_gyro_store_range); +static DEVICE_ATTR(bandwidth, S_IRUGO | S_IWUSR, + smi_gyro_show_bandwidth, smi_gyro_store_bandwidth); +static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, + smi_gyro_show_enable, smi_gyro_store_enable); +static DEVICE_ATTR(delay, S_IRUGO | S_IWUSR, + smi_gyro_show_delay, smi_gyro_store_delay); +static DEVICE_ATTR(fastoffset_en, S_IWUSR, + NULL, smi_gyro_store_fastoffset_en); +static DEVICE_ATTR(slowoffset_en, S_IWUSR, + NULL, smi_gyro_store_slowoffset_en); +static DEVICE_ATTR(selftest, S_IRUGO, + smi_gyro_show_selftest, NULL); +static DEVICE_ATTR(sleepdur, S_IRUGO | S_IWUSR, + smi_gyro_show_sleepdur, smi_gyro_store_sleepdur); +static DEVICE_ATTR(autosleepdur, S_IRUGO | S_IWUSR, + smi_gyro_show_autosleepdur, smi_gyro_store_autosleepdur); +static DEVICE_ATTR(place, S_IRUSR, + smi_gyro_show_place, NULL); +static DEVICE_ATTR(enable_timer, S_IRUGO | S_IWUSR, + smi_gyro_show_enable_timer, smi_gyro_store_enable_timer); +static DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR, + smi130_gyro_show_debug_level, smi130_gyro_store_debug_level); +static DEVICE_ATTR(driver_version, S_IRUSR, + smi130_gyro_driver_version_show, NULL); +#ifdef SMI_GYRO_DEBUG +static DEVICE_ATTR(softreset, S_IWUSR, + NULL, smi_gyro_store_softreset); +static DEVICE_ATTR(regdump, S_IRUSR, + smi_gyro_show_dumpreg, NULL); +#endif +#ifdef SMI_GYRO_USE_FIFO +static DEVICE_ATTR(fifo_mode, S_IRUGO | S_IWUSR, + smi_gyro_show_fifo_mode, smi_gyro_store_fifo_mode); +static DEVICE_ATTR(fifo_framecount, S_IRUGO | S_IWUSR, + smi_gyro_show_fifo_framecount, smi_gyro_store_fifo_framecount); +static DEVICE_ATTR(fifo_overrun, S_IRUGO, + smi_gyro_show_fifo_overrun, NULL); +static DEVICE_ATTR(fifo_data_frame, S_IRUSR, + smi_gyro_show_fifo_data_frame, NULL); +static DEVICE_ATTR(fifo_data_sel, S_IRUGO | S_IWUSR, + smi_gyro_show_fifo_data_sel, smi_gyro_store_fifo_data_sel); +static DEVICE_ATTR(fifo_tag, S_IRUGO | S_IWUSR, + smi_gyro_show_fifo_tag, smi_gyro_store_fifo_tag); +#endif + +static struct attribute *smi_gyro_attributes[] = { + &dev_attr_chip_id.attr, + &dev_attr_op_mode.attr, + &dev_attr_value.attr, + &dev_attr_range.attr, + &dev_attr_bandwidth.attr, + &dev_attr_enable.attr, + &dev_attr_delay.attr, + &dev_attr_fastoffset_en.attr, + &dev_attr_slowoffset_en.attr, + &dev_attr_selftest.attr, + &dev_attr_sleepdur.attr, + &dev_attr_autosleepdur.attr, + &dev_attr_place.attr, + &dev_attr_enable_timer.attr, + &dev_attr_debug_level.attr, + &dev_attr_driver_version.attr, +#ifdef SMI_GYRO_DEBUG + &dev_attr_softreset.attr, + &dev_attr_regdump.attr, +#endif +#ifdef SMI_GYRO_USE_FIFO + &dev_attr_fifo_mode.attr, + &dev_attr_fifo_framecount.attr, + &dev_attr_fifo_overrun.attr, + &dev_attr_fifo_data_frame.attr, + &dev_attr_fifo_data_sel.attr, + &dev_attr_fifo_tag.attr, +#endif + NULL +}; + +static struct attribute_group smi_gyro_attribute_group = { + .attrs = smi_gyro_attributes +}; + + +static int smi_gyro_input_init(struct smi_gyro_client_data *client_data) +{ + struct input_dev *dev; + int err = 0; + + dev = input_allocate_device(); + if (NULL == dev) + return -ENOMEM; + + dev->name = SENSOR_NAME; + dev->id.bustype = BUS_I2C; + + input_set_capability(dev, EV_ABS, ABS_MISC); + input_set_abs_params(dev, ABS_X, SMI_GYRO_VALUE_MIN, SMI_GYRO_VALUE_MAX, 0, 0); + input_set_abs_params(dev, ABS_Y, SMI_GYRO_VALUE_MIN, SMI_GYRO_VALUE_MAX, 0, 0); + input_set_abs_params(dev, ABS_Z, SMI_GYRO_VALUE_MIN, SMI_GYRO_VALUE_MAX, 0, 0); + input_set_capability(dev, EV_MSC, MSC_GESTURE); + input_set_capability(dev, EV_MSC, MSC_RAW); + input_set_capability(dev, EV_MSC, MSC_SCAN); + input_set_capability(dev, EV_MSC, MSC_TIME); + input_set_drvdata(dev, client_data); + + err = input_register_device(dev); + if (err < 0) { + input_free_device(dev); + return err; + } + client_data->input = dev; + + return 0; +} + +static void smi_gyro_input_destroy(struct smi_gyro_client_data *client_data) +{ + struct input_dev *dev = client_data->input; + + input_unregister_device(dev); + input_free_device(dev); +} + +#if defined(SMI130_GYRO_ENABLE_INT1) || defined(SMI130_GYRO_ENABLE_INT2) +static void smi130_gyro_irq_work_func(struct work_struct *work) +{ + struct smi_gyro_client_data *client_data = container_of(work, + struct smi_gyro_client_data, irq_work); + struct smi130_gyro_data_t gyro_data; + struct timespec ts; + ts = ns_to_timespec(client_data->timestamp); + + SMI_GYRO_CALL_API(get_dataXYZ)(&gyro_data); + /*remapping for SMI130_GYRO sensor*/ + smi130_gyro_remap_sensor_data(&gyro_data, client_data); + input_event(client_data->input, EV_MSC, MSC_TIME, + ts.tv_sec); + input_event(client_data->input, EV_MSC, MSC_TIME, + ts.tv_nsec); + input_event(client_data->input, EV_MSC, + MSC_GESTURE, gyro_data.datax); + input_event(client_data->input, EV_MSC, + MSC_RAW, gyro_data.datay); + input_event(client_data->input, EV_MSC, + MSC_SCAN, gyro_data.dataz); + input_sync(client_data->input); + +} + +static irqreturn_t smi_gyro_irq_handler(int irq, void *handle) +{ + struct smi_gyro_client_data *client_data = handle; + client_data->timestamp= smi130_gyro_get_alarm_timestamp(); + schedule_work(&client_data->irq_work); + return IRQ_HANDLED; +} +#endif +static int smi_gyro_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + int err = 0; + struct smi_gyro_client_data *client_data = NULL; + PINFO("function entrance"); + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + PERR("i2c_check_functionality error!"); + err = -EIO; + goto exit_err_clean; + } + + if (NULL == smi_gyro_client) { + smi_gyro_client = client; + } else { + PERR("this driver does not support multiple clients"); + err = -EINVAL; + goto exit_err_clean; + } + + /* check chip id */ + err = smi_gyro_check_chip_id(client); + if (!err) { + PINFO("Bosch Sensortec Device %s detected", SENSOR_NAME); + } else { + PERR("Bosch Sensortec Device not found, chip id mismatch"); + err = -1; + goto exit_err_clean; + } + + /* do soft reset */ + smi130_gyro_delay(5); + err = smi_gyro_set_soft_reset(client); + if (err < 0) { + PERR("erro soft reset!\n"); + err = -EINVAL; + goto exit_err_clean; + } + smi130_gyro_delay(30); + + + client_data = kzalloc(sizeof(struct smi_gyro_client_data), GFP_KERNEL); + if (NULL == client_data) { + PERR("no memory available"); + err = -ENOMEM; + goto exit_err_clean; + } + + i2c_set_clientdata(client, client_data); + client_data->client = client; + + mutex_init(&client_data->mutex_op_mode); + mutex_init(&client_data->mutex_enable); + + /* input device init */ + err = smi_gyro_input_init(client_data); + if (err < 0) + goto exit_err_clean; + + /* sysfs node creation */ + err = sysfs_create_group(&client_data->input->dev.kobj, + &smi_gyro_attribute_group); + + if (err < 0) + goto exit_err_sysfs; + + if (NULL != client->dev.platform_data) { + client_data->bosch_pd = kzalloc(sizeof(*client_data->bosch_pd), + GFP_KERNEL); + + if (NULL != client_data->bosch_pd) { + memcpy(client_data->bosch_pd, client->dev.platform_data, + sizeof(*client_data->bosch_pd)); + PINFO("%s sensor driver set place: p%d", + SENSOR_NAME, + client_data->bosch_pd->place); + } + } + + /* workqueue init */ + INIT_DELAYED_WORK(&client_data->work, smi_gyro_work_func); + atomic_set(&client_data->delay, SMI_GYRO_DELAY_DEFAULT); + + /* h/w init */ + client_data->device.bus_read = smi_gyro_i2c_read_wrapper; + client_data->device.bus_write = smi_gyro_i2c_write_wrapper; + client_data->device.delay_msec = smi130_gyro_delay; + SMI_GYRO_CALL_API(init)(&client_data->device); + + smi_gyro_dump_reg(client); + + client_data->enable = 0; + client_data->fifo_datasel = 0; + client_data->fifo_count = 0; + + /*workqueue init*/ + INIT_WORK(&client_data->report_data_work, + smi130_gyro_work_func); + reportdata_wq = create_singlethread_workqueue("smi130_gyro_wq"); + if (NULL == reportdata_wq) + PERR("fail to create the reportdta_wq %d", -ENOMEM); + hrtimer_init(&client_data->timer, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); + client_data->timer.function = reportdata_timer_fun; + client_data->work_delay_kt = ns_to_ktime(10000000); + client_data->is_timer_running = 0; + client_data->time_odr = 500000; +#ifdef SMI130_GYRO_ENABLE_INT1 + err = SMI_GYRO_CALL_API(set_mode)(SMI130_GYRO_MODE_NORMAL); + smi130_gyro_delay(5); + /*config the interrupt and map the interrupt*/ + /*high level trigger*/ + err += smi130_gyro_set_int_lvl(SMI130_GYRO_INT1_DATA, 1); + smi130_gyro_delay(5); + err += smi130_gyro_set_int_od(SMI130_GYRO_INT1, 0); + smi130_gyro_delay(5); + err += smi130_gyro_set_int_data(SMI130_GYRO_INT1_DATA, SMI130_GYRO_ENABLE); + smi130_gyro_delay(5); + err += smi130_gyro_set_data_en(SMI130_GYRO_ENABLE); + smi130_gyro_delay(5); + /*default odr is 100HZ*/ + err += SMI_GYRO_CALL_API(set_bw)(7); + smi130_gyro_delay(5); + if (err) + PERR("config sensor data ready interrupt failed"); +#endif +#ifdef SMI130_GYRO_ENABLE_INT2 + err = SMI_GYRO_CALL_API(set_mode)(SMI130_GYRO_MODE_NORMAL); + /*config the interrupt and map the interrupt*/ + /*high level trigger*/ + err += smi130_gyro_set_int_lvl(SMI130_GYRO_INT2_DATA, 1); + smi130_gyro_delay(3); + err += smi130_gyro_set_int_od(SMI130_GYRO_INT2, 0); + smi130_gyro_delay(5); + err += smi130_gyro_set_int_data(SMI130_GYRO_INT2_DATA, SMI130_GYRO_ENABLE); + smi130_gyro_delay(3); + err += smi130_gyro_set_data_en(SMI130_GYRO_ENABLE); + /*default odr is 100HZ*/ + err += SMI_GYRO_CALL_API(set_bw)(7); + smi130_gyro_delay(5); + if (err) + PERR("config sensor data ready interrupt failed"); +#endif + err += SMI_GYRO_CALL_API(set_mode)( + SMI_GYRO_VAL_NAME(MODE_SUSPEND)); + if (err < 0) + goto exit_err_sysfs; +#ifdef CONFIG_HAS_EARLYSUSPEND + client_data->early_suspend_handler.suspend = smi_gyro_early_suspend; + client_data->early_suspend_handler.resume = smi_gyro_late_resume; + register_early_suspend(&client_data->early_suspend_handler); +#endif +#if defined(SMI130_GYRO_ENABLE_INT1) || defined(SMI130_GYRO_ENABLE_INT2) + client_data->gpio_pin = of_get_named_gpio_flags( + client->dev.of_node, + "smi130_gyro,gpio_irq", 0, NULL); + PDEBUG("smi130_gyro qpio number:%d\n", client_data->gpio_pin); + err = gpio_request_one(client_data->gpio_pin, + GPIOF_IN, "bm160_interrupt"); + if (err < 0) { + PDEBUG("requestgpio failed\n"); + client_data->gpio_pin = 0; + } + if (client_data->gpio_pin != 0) { + err = gpio_direction_input(client_data->gpio_pin); + if (err < 0) { + PDEBUG("request failed\n"); + } + client_data->IRQ = gpio_to_irq(client_data->gpio_pin); + err = request_irq(client_data->IRQ, smi_gyro_irq_handler, + IRQF_TRIGGER_RISING, + SENSOR_NAME, client_data); + if (err < 0) + PDEBUG("request handle failed\n"); + } + INIT_WORK(&client_data->irq_work, smi130_gyro_irq_work_func); +#endif + PINFO("sensor %s probed successfully", SENSOR_NAME); + + dev_dbg(&client->dev, + "i2c_client: %p client_data: %p i2c_device: %p input: %p", + client, client_data, &client->dev, client_data->input); + + return 0; + +exit_err_sysfs: + if (err) + smi_gyro_input_destroy(client_data); + +exit_err_clean: + if (err) { + if (client_data != NULL) { + kfree(client_data); + client_data = NULL; + } + + smi_gyro_client = NULL; + } + + return err; +} + +static int smi_gyro_pre_suspend(struct i2c_client *client) +{ + int err = 0; + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)i2c_get_clientdata(client); + PINFO("function entrance"); + + mutex_lock(&client_data->mutex_enable); + if (client_data->enable) { + cancel_delayed_work_sync(&client_data->work); + PINFO("cancel work"); + } + mutex_unlock(&client_data->mutex_enable); + if (client_data->is_timer_running) { + hrtimer_cancel(&client_data->timer); + client_data->base_time = 0; + client_data->timestamp = 0; + client_data->fifo_time = 0; + client_data->gyro_count = 0; + } + return err; +} + +static int smi_gyro_post_resume(struct i2c_client *client) +{ + int err = 0; + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)i2c_get_clientdata(client); + + PINFO("function entrance"); + mutex_lock(&client_data->mutex_enable); + if (client_data->enable) { + schedule_delayed_work(&client_data->work, + msecs_to_jiffies( + atomic_read(&client_data->delay))); + } + mutex_unlock(&client_data->mutex_enable); + if (client_data->is_timer_running) { + hrtimer_start(&client_data->timer, + ns_to_ktime(client_data->time_odr), + HRTIMER_MODE_REL); + client_data->base_time = 0; + client_data->timestamp = 0; + client_data->is_timer_running = 1; + client_data->gyro_count = 0; + } + return err; +} + +#ifdef CONFIG_HAS_EARLYSUSPEND +static void smi_gyro_early_suspend(struct early_suspend *handler) +{ + int err = 0; + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)container_of(handler, + struct smi_gyro_client_data, early_suspend_handler); + struct i2c_client *client = client_data->client; + + PINFO("function entrance"); + + mutex_lock(&client_data->mutex_op_mode); + if (client_data->enable) { + err = smi_gyro_pre_suspend(client); + err = SMI_GYRO_CALL_API(set_mode)( + SMI_GYRO_VAL_NAME(MODE_SUSPEND)); + } + mutex_unlock(&client_data->mutex_op_mode); +} + +static void smi_gyro_late_resume(struct early_suspend *handler) +{ + + int err = 0; + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)container_of(handler, + struct smi_gyro_client_data, early_suspend_handler); + struct i2c_client *client = client_data->client; + + PINFO("function entrance"); + + mutex_lock(&client_data->mutex_op_mode); + + if (client_data->enable) + err = SMI_GYRO_CALL_API(set_mode)(SMI_GYRO_VAL_NAME(MODE_NORMAL)); + + /* post resume operation */ + smi_gyro_post_resume(client); + + mutex_unlock(&client_data->mutex_op_mode); +} +#else +static int smi_gyro_suspend(struct i2c_client *client, pm_message_t mesg) +{ + int err = 0; + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)i2c_get_clientdata(client); + + PINFO("function entrance"); + + mutex_lock(&client_data->mutex_op_mode); + if (client_data->enable) { + err = smi_gyro_pre_suspend(client); + err = SMI_GYRO_CALL_API(set_mode)( + SMI_GYRO_VAL_NAME(MODE_SUSPEND)); + } + mutex_unlock(&client_data->mutex_op_mode); + return err; +} + +static int smi_gyro_resume(struct i2c_client *client) +{ + + int err = 0; + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)i2c_get_clientdata(client); + + PINFO("function entrance"); + + mutex_lock(&client_data->mutex_op_mode); + + if (client_data->enable) + err = SMI_GYRO_CALL_API(set_mode)(SMI_GYRO_VAL_NAME(MODE_NORMAL)); + + /* post resume operation */ + smi_gyro_post_resume(client); + + mutex_unlock(&client_data->mutex_op_mode); + return err; +} +#endif + +void smi_gyro_shutdown(struct i2c_client *client) +{ + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)i2c_get_clientdata(client); + + mutex_lock(&client_data->mutex_op_mode); + SMI_GYRO_CALL_API(set_mode)( + SMI_GYRO_VAL_NAME(MODE_DEEPSUSPEND)); + mutex_unlock(&client_data->mutex_op_mode); +} + +static int smi_gyro_remove(struct i2c_client *client) +{ + int err = 0; + u8 op_mode; + + struct smi_gyro_client_data *client_data = + (struct smi_gyro_client_data *)i2c_get_clientdata(client); + + if (NULL != client_data) { +#ifdef CONFIG_HAS_EARLYSUSPEND + unregister_early_suspend(&client_data->early_suspend_handler); +#endif + mutex_lock(&client_data->mutex_op_mode); + SMI_GYRO_CALL_API(get_mode)(&op_mode); + if (SMI_GYRO_VAL_NAME(MODE_NORMAL) == op_mode) { + cancel_delayed_work_sync(&client_data->work); + PINFO("cancel work"); + } + mutex_unlock(&client_data->mutex_op_mode); + + err = SMI_GYRO_CALL_API(set_mode)( + SMI_GYRO_VAL_NAME(MODE_SUSPEND)); + smi130_gyro_delay(SMI_GYRO_I2C_WRITE_DELAY_TIME); + + sysfs_remove_group(&client_data->input->dev.kobj, + &smi_gyro_attribute_group); + smi_gyro_input_destroy(client_data); + kfree(client_data); + + smi_gyro_client = NULL; + } + + return err; +} + +static const struct i2c_device_id smi_gyro_id[] = { + { SENSOR_NAME, 0 }, + { } +}; + +MODULE_DEVICE_TABLE(i2c, smi_gyro_id); +static const struct of_device_id smi130_gyro_of_match[] = { + { .compatible = "smi130_gyro", }, + { } +}; +MODULE_DEVICE_TABLE(i2c, smi130_gyro_of_match); + +static struct i2c_driver smi_gyro_driver = { + .driver = { + .owner = THIS_MODULE, + .name = SENSOR_NAME, + .of_match_table = smi130_gyro_of_match, + }, + .class = I2C_CLASS_HWMON, + .id_table = smi_gyro_id, + .probe = smi_gyro_probe, + .remove = smi_gyro_remove, + .shutdown = smi_gyro_shutdown, +#ifndef CONFIG_HAS_EARLYSUSPEND + //.suspend = smi_gyro_suspend, + //.resume = smi_gyro_resume, +#endif +}; + +static int __init SMI_GYRO_init(void) +{ + return i2c_add_driver(&smi_gyro_driver); +} + +static void __exit SMI_GYRO_exit(void) +{ + i2c_del_driver(&smi_gyro_driver); +} + +MODULE_AUTHOR("contact@bosch-sensortec.com>"); +MODULE_DESCRIPTION("SMI_GYRO GYROSCOPE SENSOR DRIVER"); +MODULE_LICENSE("GPL v2"); + +module_init(SMI_GYRO_init); +module_exit(SMI_GYRO_exit); diff --git a/drivers/input/sensors/smi130/smi130_i2c.c b/drivers/input/sensors/smi130/smi130_i2c.c index 24a66c8cb31b..09c4d29e3959 100644 --- a/drivers/input/sensors/smi130/smi130_i2c.c +++ b/drivers/input/sensors/smi130/smi130_i2c.c @@ -1,6 +1,6 @@ - /* +/*! * @section LICENSE - * (C) Copyright 2011~2018 Bosch Sensortec GmbH All Rights Reserved + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved * * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved * @@ -8,10 +8,110 @@ * Public License (GPL).Version 2,June 1991, * available at http://www.fsf.org/copyleft/gpl.html * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. * * @filename smi130_i2c.c * @date 2014/11/25 14:40 - * @Modification Date 2018/06/21 15:03 + * @Modification Date 2018/08/28 18:20 + * @id "20f77db" * @version 1.3 * * @brief diff --git a/drivers/input/sensors/smi130/smi130_spi.c b/drivers/input/sensors/smi130/smi130_spi.c index 05bd4b8a9b60..b02efbf111b1 100644 --- a/drivers/input/sensors/smi130/smi130_spi.c +++ b/drivers/input/sensors/smi130/smi130_spi.c @@ -1,122 +1,122 @@ -/* -* @section LICENSE -* (C) Copyright 2011~2018 Bosch Sensortec GmbH All Rights Reserved -* -* (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved -* -* This software program is licensed subject to the GNU General -* Public License (GPL).Version 2,June 1991, -* available at http://www.fsf.org/copyleft/gpl.html -* -* Special: Description of the Software: -* -* This software module (hereinafter called "Software") and any -* information on application-sheets (hereinafter called "Information") is -* provided free of charge for the sole purpose to support your application -* work. -* -* As such, the Software is merely an experimental software, not tested for -* safety in the field and only intended for inspiration for further development -* and testing. Any usage in a safety-relevant field of use (like automotive, -* seafaring, spacefaring, industrial plants etc.) was not intended, so there are -* no precautions for such usage incorporated in the Software. -* -* The Software is specifically designed for the exclusive use for Bosch -* Sensortec products by personnel who have special experience and training. Do -* not use this Software if you do not have the proper experience or training. -* -* This Software package is provided as is and without any expressed or -* implied warranties, including without limitation, the implied warranties of -* merchantability and fitness for a particular purpose. -* -* Bosch Sensortec and their representatives and agents deny any liability for -* the functional impairment of this Software in terms of fitness, performance -* and safety. Bosch Sensortec and their representatives and agents shall not be -* liable for any direct or indirect damages or injury, except as otherwise -* stipulated in mandatory applicable law. -* The Information provided is believed to be accurate and reliable. Bosch -* Sensortec assumes no responsibility for the consequences of use of such -* Information nor for any infringement of patents or other rights of third -* parties which may result from its use. -* -*------------------------------------------------------------------------------ -* The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software -* which is licensed under the Apache License, Version 2.0 as stated above. -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Product Disclaimer -* -* Common: -* -* Assessment of Products Returned from Field -* -* Returned products are considered good if they fulfill the specifications / -* test data for 0-mileage and field listed in this document. -* -* Engineering Samples -* -* Engineering samples are marked with (e) or (E). Samples may vary from the -* valid technical specifications of the series product contained in this -* data sheet. Therefore, they are not intended or fit for resale to -* third parties or for use in end products. Their sole purpose is internal -* client testing. The testing of an engineering sample may in no way replace -* the testing of a series product. Bosch assumes no liability for the use -* of engineering samples. The purchaser shall indemnify Bosch from all claims -* arising from the use of engineering samples. -* -* Intended use -* -* Provided that SMI130 is used within the conditions (environment, application, -* installation, loads) as described in this TCD and the corresponding -* agreed upon documents, Bosch ensures that the product complies with -* the agreed properties. Agreements beyond this require -* the written approval by Bosch. The product is considered fit for the intended -* use when the product successfully has passed the tests -* in accordance with the TCD and agreed upon documents. -* -* It is the responsibility of the customer to ensure the proper application -* of the product in the overall system/vehicle. -* -* Bosch does not assume any responsibility for changes to the environment -* of the product that deviate from the TCD and the agreed upon documents -* as well as all applications not released by Bosch -* -* The resale and/or use of products are at the purchaser’s own risk and -* responsibility. The examination and testing of the SMI130 -* is the sole responsibility of the purchaser. -* -* The purchaser shall indemnify Bosch from all third party claims -* arising from any product use not covered by the parameters of -* this product data sheet or not approved by Bosch and reimburse Bosch -* for all costs and damages in connection with such claims. -* -* The purchaser must monitor the market for the purchased products, -* particularly with regard to product safety, and inform Bosch without delay -* of all security relevant incidents. -* -* Application Examples and Hints -* -* With respect to any application examples, advice, normal values -* and/or any information regarding the application of the device, -* Bosch hereby disclaims any and all warranties and liabilities of any kind, -* including without limitation warranties of -* non-infringement of intellectual property rights or copyrights -* of any third party. -* The information given in this document shall in no event be regarded -* as a guarantee of conditions or characteristics. They are provided -* for illustrative purposes only and no evaluation regarding infringement -* of intellectual property rights or copyrights or regarding functionality, -* performance or error has been made. -* -* -* @filename smi130_spi.c -* @date 2014/11/25 14:40 -* @Modification Date 2018/06/21 15:03 -* @version 1.3 -* -* @brief -* This file implements moudle function, which add -* the driver to SPI core. +/*! + * @section LICENSE + * (C) Copyright 2011~2016 Bosch Sensortec GmbH All Rights Reserved + * + * (C) Modification Copyright 2018 Robert Bosch Kft All Rights Reserved + * + * This software program is licensed subject to the GNU General + * Public License (GPL).Version 2,June 1991, + * available at http://www.fsf.org/copyleft/gpl.html + * + * Special: Description of the Software: + * + * This software module (hereinafter called "Software") and any + * information on application-sheets (hereinafter called "Information") is + * provided free of charge for the sole purpose to support your application + * work. + * + * As such, the Software is merely an experimental software, not tested for + * safety in the field and only intended for inspiration for further development + * and testing. Any usage in a safety-relevant field of use (like automotive, + * seafaring, spacefaring, industrial plants etc.) was not intended, so there are + * no precautions for such usage incorporated in the Software. + * + * The Software is specifically designed for the exclusive use for Bosch + * Sensortec products by personnel who have special experience and training. Do + * not use this Software if you do not have the proper experience or training. + * + * This Software package is provided as is and without any expressed or + * implied warranties, including without limitation, the implied warranties of + * merchantability and fitness for a particular purpose. + * + * Bosch Sensortec and their representatives and agents deny any liability for + * the functional impairment of this Software in terms of fitness, performance + * and safety. Bosch Sensortec and their representatives and agents shall not be + * liable for any direct or indirect damages or injury, except as otherwise + * stipulated in mandatory applicable law. + * The Information provided is believed to be accurate and reliable. Bosch + * Sensortec assumes no responsibility for the consequences of use of such + * Information nor for any infringement of patents or other rights of third + * parties which may result from its use. + * + *------------------------------------------------------------------------------ + * The following Product Disclaimer does not apply to the BSX4-HAL-4.1NoFusion Software + * which is licensed under the Apache License, Version 2.0 as stated above. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Product Disclaimer + * + * Common: + * + * Assessment of Products Returned from Field + * + * Returned products are considered good if they fulfill the specifications / + * test data for 0-mileage and field listed in this document. + * + * Engineering Samples + * + * Engineering samples are marked with (e) or (E). Samples may vary from the + * valid technical specifications of the series product contained in this + * data sheet. Therefore, they are not intended or fit for resale to + * third parties or for use in end products. Their sole purpose is internal + * client testing. The testing of an engineering sample may in no way replace + * the testing of a series product. Bosch assumes no liability for the use + * of engineering samples. The purchaser shall indemnify Bosch from all claims + * arising from the use of engineering samples. + * + * Intended use + * + * Provided that SMI130 is used within the conditions (environment, application, + * installation, loads) as described in this TCD and the corresponding + * agreed upon documents, Bosch ensures that the product complies with + * the agreed properties. Agreements beyond this require + * the written approval by Bosch. The product is considered fit for the intended + * use when the product successfully has passed the tests + * in accordance with the TCD and agreed upon documents. + * + * It is the responsibility of the customer to ensure the proper application + * of the product in the overall system/vehicle. + * + * Bosch does not assume any responsibility for changes to the environment + * of the product that deviate from the TCD and the agreed upon documents + * as well as all applications not released by Bosch + * + * The resale and/or use of products are at the purchaser’s own risk and + * responsibility. The examination and testing of the SMI130 + * is the sole responsibility of the purchaser. + * + * The purchaser shall indemnify Bosch from all third party claims + * arising from any product use not covered by the parameters of + * this product data sheet or not approved by Bosch and reimburse Bosch + * for all costs and damages in connection with such claims. + * + * The purchaser must monitor the market for the purchased products, + * particularly with regard to product safety, and inform Bosch without delay + * of all security relevant incidents. + * + * Application Examples and Hints + * + * With respect to any application examples, advice, normal values + * and/or any information regarding the application of the device, + * Bosch hereby disclaims any and all warranties and liabilities of any kind, + * including without limitation warranties of + * non-infringement of intellectual property rights or copyrights + * of any third party. + * The information given in this document shall in no event be regarded + * as a guarantee of conditions or characteristics. They are provided + * for illustrative purposes only and no evaluation regarding infringement + * of intellectual property rights or copyrights or regarding functionality, + * performance or error has been made. + * + * @filename smi130_spi.c + * @date 2014/11/25 14:40 + * @Modification Date 2018/08/28 18:20 + * @id "20f77db" + * @version 1.3 + * + * @brief + * This file implements moudle function, which add + * the driver to SPI core. */ #include <linux/module.h> |