NRF52840 Eval Kit User Manual
Vision: V1.0.1 Date: 2019.01.19
36
/
72
}
BME280 Initialization in main.c
struct
bme280_dev 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 pass\r\n"
);
NRF_LOG_FLUSH
();
}
rslt
=
bme280_init
(&
dev
);
if
(
rslt
==
0
)
{
NRF_LOG_INFO
(
"Init Success\r\n"
);
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().
Содержание NRF52840
Страница 1: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 1 72 NRF52840 Eval Kit User Manual...
Страница 46: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 46 72 You can also send data directly on Show log...
Страница 61: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 61 72...