]> git.itanic.dy.fi Git - BME280_driver/commitdiff
Removed self-test
authorBosch Sensortec <github@bosch-sensortec.com>
Tue, 17 Mar 2020 08:41:54 +0000 (09:41 +0100)
committerKevin Goveas <kevin.goveas@bosch-sensortec.com>
Tue, 17 Mar 2020 08:42:11 +0000 (09:42 +0100)
selftest/bme280_selftest.c [deleted file]
selftest/bme280_selftest.h [deleted file]

diff --git a/selftest/bme280_selftest.c b/selftest/bme280_selftest.c
deleted file mode 100644 (file)
index 4bce46c..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/**\r
-* Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.\r
-*\r
-* BSD-3-Clause\r
-*\r
-* Redistribution and use in source and binary forms, with or without\r
-* modification, are permitted provided that the following conditions are met:\r
-*\r
-* 1. Redistributions of source code must retain the above copyright\r
-*    notice, this list of conditions and the following disclaimer.\r
-*\r
-* 2. Redistributions in binary form must reproduce the above copyright\r
-*    notice, this list of conditions and the following disclaimer in the\r
-*    documentation and/or other materials provided with the distribution.\r
-*\r
-* 3. Neither the name of the copyright holder nor the names of its\r
-*    contributors may be used to endorse or promote products derived from\r
-*    this software without specific prior written permission.\r
-*\r
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
-* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
-* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
-* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\r
-* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
-* POSSIBILITY OF SUCH DAMAGE.\r
-*\r
-* @file        bme280_selftest.c\r
-* @date        2020-01-24\r
-* @version     v3.4.3\r
-*\r
-*/\r
-\r
-#include "bme280_selftest.h"\r
-\r
-#define BME280_CRC_DATA_ADDR   UINT8_C(0xE8)\r
-#define BME280_CRC_DATA_LEN    UINT8_C(1)\r
-#define BME280_CRC_CALIB1_ADDR UINT8_C(0x88)\r
-#define BME280_CRC_CALIB1_LEN  UINT8_C(26)\r
-#define BME280_CRC_CALIB2_ADDR UINT8_C(0xE1)\r
-#define BME280_CRC_CALIB2_LEN  UINT8_C(7)\r
-\r
-/*!\r
- * @brief This API calculates the CRC\r
- *\r
- * @param[in] mem_values : reg_data parameter to calculate CRC\r
- * @param[in] mem_length : Parameter to calculate CRC\r
- *\r
- * @return Result of API execution status\r
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\r
- */\r
-static uint8_t crc_calculate(uint8_t *mem_values, uint8_t mem_length);\r
-\r
-/*!\r
- * @brief This API reads the stored CRC and then compare with calculated CRC\r
- *\r
- * @param[in] dev : Structure instance of bme280_dev.\r
- *\r
- * @return Result of API execution status\r
- * @retval zero -> self test success / +ve value -> warning(self test fail)\r
- */\r
-int8_t bme280_selftest_crc(const struct bme280_dev *dev)\r
-{\r
-    int8_t rslt;\r
-    uint8_t reg_addr;\r
-    uint8_t reg_data[64];\r
-    uint8_t stored_crc = 0;\r
-    uint8_t calculated_crc = 0;\r
-\r
-    /* Read stored crc value from register */\r
-    reg_addr = BME280_CRC_DATA_ADDR;\r
-    rslt = bme280_get_regs(reg_addr, reg_data, BME280_CRC_DATA_LEN, dev);\r
-    if (rslt == BME280_OK)\r
-    {\r
-        stored_crc = reg_data[0];\r
-\r
-        /* Calculated CRC value with calibration register */\r
-        reg_addr = BME280_CRC_CALIB1_ADDR;\r
-        rslt = bme280_get_regs(reg_addr, &reg_data[0], BME280_CRC_CALIB1_LEN, dev);\r
-        if (rslt == BME280_OK)\r
-        {\r
-            reg_addr = BME280_CRC_CALIB2_ADDR;\r
-            rslt = bme280_get_regs(reg_addr, &reg_data[BME280_CRC_CALIB1_LEN], BME280_CRC_CALIB2_LEN, dev);\r
-            if (rslt == BME280_OK)\r
-            {\r
-                calculated_crc = crc_calculate(reg_data, BME280_CRC_CALIB1_LEN + BME280_CRC_CALIB2_LEN);\r
-\r
-                /* Validate CRC */\r
-                if (stored_crc == calculated_crc)\r
-                {\r
-                    rslt = BME280_OK;\r
-                }\r
-                else\r
-                {\r
-                    rslt = BME280_W_SELF_TEST_FAIL;\r
-                }\r
-            }\r
-        }\r
-    }\r
-\r
-    return rslt;\r
-}\r
-\r
-/*!\r
- * @brief This API calculates the CRC\r
- *\r
- * @param[in] mem_values : reg_data parameter to calculate CRC\r
- * @param[in] mem_length : Parameter to calculate CRC\r
- *\r
- * @return Result of API execution status\r
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\r
- */\r
-static uint8_t crc_calculate(uint8_t *mem_values, uint8_t mem_length)\r
-{\r
-    uint32_t crc_reg = 0xFF;\r
-    uint8_t polynomial = 0x1D;\r
-    uint8_t bitno, index;\r
-    uint8_t din = 0;\r
-\r
-    for (index = 0; index < mem_length; index++)\r
-    {\r
-        for (bitno = 0; bitno < 8; bitno++)\r
-        {\r
-            if ((crc_reg & 0x80) != (mem_values[index] & 0x80))\r
-            {\r
-                din = 1;\r
-            }\r
-            else\r
-            {\r
-                din = 0;\r
-            }\r
-\r
-            /* Truncate 8th bit for crc_reg and mem_values */\r
-            crc_reg = (uint32_t)((crc_reg & 0x7F) << 1);\r
-            mem_values[index] = (uint8_t)((mem_values[index] & 0x7F) << 1);\r
-            crc_reg = (uint32_t)(crc_reg ^ (polynomial * din));\r
-        }\r
-    }\r
-\r
-    return (uint8_t)(crc_reg ^ 0xFF);\r
-}\r
diff --git a/selftest/bme280_selftest.h b/selftest/bme280_selftest.h
deleted file mode 100644 (file)
index e1908db..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**\r
-* Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.\r
-*\r
-* BSD-3-Clause\r
-*\r
-* Redistribution and use in source and binary forms, with or without\r
-* modification, are permitted provided that the following conditions are met:\r
-*\r
-* 1. Redistributions of source code must retain the above copyright\r
-*    notice, this list of conditions and the following disclaimer.\r
-*\r
-* 2. Redistributions in binary form must reproduce the above copyright\r
-*    notice, this list of conditions and the following disclaimer in the\r
-*    documentation and/or other materials provided with the distribution.\r
-*\r
-* 3. Neither the name of the copyright holder nor the names of its\r
-*    contributors may be used to endorse or promote products derived from\r
-*    this software without specific prior written permission.\r
-*\r
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
-* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
-* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
-* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\r
-* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
-* POSSIBILITY OF SUCH DAMAGE.\r
-*\r
-* @file        bme280_selftest.h\r
-* @date        2020-01-24\r
-* @version     v3.4.3\r
-*\r
-*/\r
-\r
-/*!\r
- * @addtogroup bme280_selftest\r
- * @brief\r
- */\r
-\r
-#ifndef BME280_SELFTEST_H_\r
-#define BME280_SELFTEST_H_\r
-\r
-#include "bme280.h"\r
-\r
-/*! CPP guard */\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/**\name API warning code */\r
-#define BME280_W_SELF_TEST_FAIL INT8_C(2)\r
-\r
-/*!\r
- * @brief This API reads the stored CRC and then compare with calculated CRC\r
- *\r
- * @param[in] dev : Structure instance of bme280_dev.\r
- *\r
- * @return Result of API execution status\r
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\r
- */\r
-int8_t bme280_selftest_crc(const struct bme280_dev *dev);\r
-\r
-/*! CPP guard */\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* BME280_SELFTEST_H_ */\r
-/** @}*/\r