Waveshare NRF52840 User Manual page 36

Eval kit
Table of Contents

Advertisement

NRF52840 Eval Kit User Manual
}
BME280 Initialization in main.c
struct
bme280_dev
int8_t
rslt
= BME280_OK;
dev.dev_id
= BME280_I2C_ADDR_SEC;
dev.intf
= BME280_I2C_INTF;
dev.read
= user_i2c_read;
dev.write
= user_i2c_write;
dev.delay_ms
= user_delay_ms;
//before you init bme280, you can choose to do a selftest
rslt
= bme280_crc_selftest(&dev);
if(rslt
== 0)
{
NRF_LOG_INFO("BME280 self test
NRF_LOG_FLUSH();
}
rslt
= bme280_init(&dev);
if(rslt
== 0)
{
NRF_LOG_INFO("Init
NRF_LOG_FLUSH();
}
else
{
NRF_LOG_INFO("Init Fail,Please Check your address or the wire
you
connected!!!\r\n");
NRF_LOG_FLUSH();
while(1);
}
/*
Using normal mode to read the data
*/
stream_sensor_data_normal_mode(&dev);
bme280_crc_selftest(): Self testing function
stream_sensor_data_normal_mode(&dev): Read data of bme280 and calculate. Use
bme280_get_sensor_data() and print_sensor_data() to read and print_sensor_data().
Vision: V1.0.1 Date: 2019.01.19
dev;
pass\r\n");
Success\r\n");
36 / 72

Advertisement

Table of Contents
loading

Table of Contents