Justice_Gao 发表于 2021-6-13 23:06

大赛分享四:RSL10蓝牙SoC之BME680传感器数据采集

<p>设备:</p>

<p>RSL10-SENSE-GEVK:RSL10 传感器开发套件</p>

<p>&nbsp;</p>

<p>该传感器的数据采集有例程,直接上修改后的代码</p>

<pre>
<code>//-----------------------------------------------------------------------------
// Copyright (c) 2018 Semiconductor Components Industries LLC
// (d/b/a "ON Semiconductor").All rights reserved.
// This software and/or documentation is licensed by ON Semiconductor under
// limited terms and conditions.The terms and conditions pertaining to the
// software and/or documentation are available at
// http://www.onsemi.com/site/pdf/ONSEMI_T&amp;C.pdf ("ON Semiconductor Standard
// Terms and Conditions of Sale, Section 8 Software") and if applicable the
// software license agreement.Do not use this software and/or documentation
// unless you have carefully read and you agree to the limited terms and
// conditions.By using this software and/or documentation, you agree to the
// limited terms and conditions.
//-----------------------------------------------------------------------------
#include &lt;stdio.h&gt;
#include &lt;BDK.h&gt;
#include &lt;BSP_Components.h&gt;
#include &lt;BLE_Components.h&gt;
#include &lt;SoftwareTimer.h&gt;
#include &lt;bsec_integration.h&gt;

#define DATA_LEN 36
struct SwTimer bsec_timer;
bsec_env_process_struct bsec_process_params = APP_BSEC_PROCESS_STRUCT_VALUE;



int main(void)
{
    BDK_Initialize();
    printf("\r\nAPP: BME680_BSEC example.\r\n");

    /* Clear saved BSEC state if button is pressed after reset. */
    {
      I2CEeprom m24rf64;
      uint8_t buffer = { 0 };

      I2CEeprom_Initialize(APP_BSEC_EEPROM_I2C_ADDR,
                APP_BSEC_EEPROM_PAGE_SIZE, &amp;m24rf64);

      I2CEeprom_Write(APP_BSEC_EEPROM_ADDR, buffer,
                APP_BSEC_EEPROM_MAGIC_SIZE, &amp;m24rf64);

      printf("APP: Deleted saved BSEC state.\r\n");
    }

    /* Initialize BSEC library */
    {
      bsec_env_return_val retval;
      bsec_env_init_struct bsec_init_params = APP_BSEC_INIT_STRUCT_VALUE;

      retval = BSEC_ENV_Initialize(&amp;bsec_init_params);

      ASSERT_DEBUG(retval.bme680_status == BME680_OK);
      ASSERT_DEBUG(retval.bsec_status == BSEC_OK);
    }

    SwTimer_Initialize(&amp;bsec_timer);
    SwTimer_ExpireInMs(&amp;bsec_timer, 1);

    printf("APP: Entering main loop.\r\n");
    while (1)
    {
      /* Execute any events that occurred and refresh Watchdog. */
      BDK_Schedule();

      if (SwTimer_IsExpired(&amp;bsec_timer) == true)
      {
            int64_t next_call;

            next_call = BSEC_ENV_Process(&amp;bsec_process_params);

            SwTimer_ExpireInMs(&amp;bsec_timer, next_call);

            printf("BSEC: Next process call in: %lu ms.\r\n",
                  (uint32_t) next_call);
      }

      SYS_WAIT_FOR_INTERRUPT;
    }

    return 0;
}
</code></pre>

<p>结果打印日志:</p>

<p>iaq = 25 空气质量</p>

<p>temperature = 30.89 温度</p>

<p>humidity = 70.76% 湿度</p>

<p>raw_pressure = 100067.000000Pa 气压</p>

<p>co2_equivalent = 500.00 ppm 二氧化碳浓度</p>

<p>breath_voc_equivalent = 0.50 ppm</p>

Jacktang 发表于 2021-6-14 10:47

<p>结果应该很精确吧</p>

<p>测试的可以</p>

Justice_Gao 发表于 2021-6-14 12:06

<p>精确度确实很高&nbsp; 非常棒的传感器</p>
页: [1]
查看完整版本: 大赛分享四:RSL10蓝牙SoC之BME680传感器数据采集