diff options
| author | Michal Hanus <hanus.michal@divelit.cz> | 2025-04-23 13:43:14 +0200 |
|---|---|---|
| committer | Michal Hanus <hanus.michal@divelit.cz> | 2025-04-23 13:43:14 +0200 |
| commit | d1c04e8b36bc206eb520f7b79183d5c015855252 (patch) | |
| tree | 469857024814e16b8ed27c52c5b8689358455f33 /gnss | |
| parent | 851d92974af6cefa00de1379dad8b8076c2dd107 (diff) | |
| parent | 0dee9f28ef79d54ec06f460b5e1deb10a8efd303 (diff) | |
Merge remote-tracking branch 'refs/remotes/xyz/master'
Diffstat (limited to 'gnss')
| -rw-r--r-- | gnss/.vscode/settings.json | 6 | ||||
| -rw-r--r-- | gnss/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | gnss/Kconfig | 31 | ||||
| -rw-r--r-- | gnss/README.md | 107 | ||||
| -rw-r--r-- | gnss/nrf9161dk_nrf9161_ns.overlay | 47 | ||||
| -rw-r--r-- | gnss/prj.conf | 70 | ||||
| -rw-r--r-- | gnss/sample.yaml | 11 | ||||
| -rw-r--r-- | gnss/src/bme680/bme680.c | 0 | ||||
| -rw-r--r-- | gnss/src/bme680/bme680.h | 0 | ||||
| -rw-r--r-- | gnss/src/main.c | 344 | ||||
| -rw-r--r-- | gnss/sysbuild.conf | 7 |
11 files changed, 637 insertions, 0 deletions
diff --git a/gnss/.vscode/settings.json b/gnss/.vscode/settings.json new file mode 100644 index 0000000..1e0d06f --- /dev/null +++ b/gnss/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "lte_lc.h": "c", + "bme680.h": "c" + } +}
\ No newline at end of file diff --git a/gnss/CMakeLists.txt b/gnss/CMakeLists.txt new file mode 100644 index 0000000..db86532 --- /dev/null +++ b/gnss/CMakeLists.txt @@ -0,0 +1,14 @@ +# +# Copyright (c) 2019 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(gnss) + +# NORDIC SDK APP START +target_sources(app PRIVATE src/main.c) +# NORDIC SDK APP END
\ No newline at end of file diff --git a/gnss/Kconfig b/gnss/Kconfig new file mode 100644 index 0000000..a515d8c --- /dev/null +++ b/gnss/Kconfig @@ -0,0 +1,31 @@ +# +# Copyright (c) 2019 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +menu "GNSS Sample" + + +# Define configuration for fix interval +config GNSS_PERIODIC_INTERVAL + int "Fix interval for periodic GPS fixes" + range 10 65535 + default 120 + help + Fix interval (in seconds) for periodic fixes. + +# Define configuration for fix timeout +config GNSS_PERIODIC_TIMEOUT + int "Fix timeout for periodic GPS fixes" + range 0 65535 + default 480 + help + Fix timeout (in seconds) for periodic fixes. + If set to zero, GNSS is allowed to run indefinitely until a valid PVT estimate is produced. + +endmenu + +menu "Zephyr Kernel" +source "Kconfig.zephyr" +endmenu
\ No newline at end of file diff --git a/gnss/README.md b/gnss/README.md new file mode 100644 index 0000000..46811c1 --- /dev/null +++ b/gnss/README.md @@ -0,0 +1,107 @@ + +# Stratus GNSS Sample Application + +The sample first initializes the GNSS module. +Then it handles events from the interface, reads the associated data and outputs information to the console. + +Using `lte_lc_func_mode_set()`, the modem is set to normal mode. Then it deactivates LTE using `LTE_LC_FUNC_MODE_DEACTIVATE_LTE`, +so that the GNSS can operate as intended. In an actual full application, you wouldn’t completely deactivate LTE but +rather configure PSM or eDRX so that the GNSS and LTE can be used rather often without having to completely +activate and deactivate the modes. Here it is purely for testing Stratus nRF9160 DK GPS only. + +By default, the sample runs in periodic mode. +We have configured the GNSS in periodic mode, by setting the fix interval to 2 minutes and the fix retry period to 8 minutes. +``` +CONFIG_GNSS_PERIODIC_INTERVAL=120 +CONFIG_GNSS_PERIODIC_TIMEOUT=480 +``` + +After getting the first fix, the GNSS will sleep then wakes up when the GNSS fix interval has +passed (120 seconds or 2 minutes) and starts searching for a new fix. Then it sleeps and repeats the process. + +Build the sample and flash it to your STratus board. +To test the application, make sure you are outdoors under an open sky to achieve the best conditions. + +The sample app also display the carrier-to-noise density ratio for all the valid satellites the GNSS is currently +tracking, which is found in the member cn0. This tells us something about the signal strength from that satellite and it has +to be above 30 dB/Hz (cn0 = 300) for the GNSS receiver to consider the satellite “healthy” and use it in calculations. +Printing the satellite information and signal strength is useful for debugging purposes if your application is not getting a fix. +As per Nordic Semi, because the GNSS is solving for four unknown variables, it needs at least 4 satellites to get a valid fix. + + +## Stratus GPS Antenna configurations + +Following settings are needed to enable the oboard GPS antenna and the LNA in order for the GPS to work. + +``` +# Enable modem GPS mode +CONFIG_LTE_NETWORK_MODE_LTE_M_NBIOT_GPS=y + +# Stratus DK GPS configurations +CONFIG_MODEM_ANTENNA=y +# Enable onboard GPS antenna +CONFIG_MODEM_ANTENNA_GNSS_ONBOARD=y +CONFIG_MODEM_ANTENNA_AT_MAGPIO="AT\%XMAGPIO=1,0,0,1,1,1574,1577" +# Stratus GPS external antenna configuration with LNA enabled +CONFIG_MODEM_ANTENNA_AT_COEX0="AT\%XCOEX0=1,1,1565,1586" +``` + +## Building and Running + +See the (device documentation)[https://docs.conexiotech.com] for detailed instructions on how to get started. + +For the Stratus Pro nrf9151/nRF9161 device, the `west` build command is: +``` +west build -b conexio_stratus_pro/nrf9161/ns -- -DBOARD_ROOT=/opt/nordic/ncs/v2.7.0/conexio-firmware-sdk +``` + +For the Stratus nRF9160 device, the build command is: + +``` +west build -b conexio_stratus/nrf9160/ns -- -DBOARD_ROOT=/opt/nordic/ncs/v2.7.0/conexio-firmware-sdk +``` + +Flash the compiled firmware using `newtmgr` + +``` +newtmgr -c serial image upload build/zephyr/app_update.bin +``` + +## Sample Output + +``` +*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 *** +*** Using Zephyr OS v3.6.99-100befc70c74 *** +[00:00:00.583,709] <inf> GNSS_sample: Stratus GNSS sample started +[00:00:00.583,709] <inf> GNSS_sample: Connecting to LTE network +[00:00:01.562,622] <inf> GNSS_sample: RRC mode: Connected +[00:00:03.604,370] <inf> GNSS_sample: Network registration status: Connected - roaming +[00:00:03.604,553] <inf> GNSS_sample: Connected to LTE network +[00:00:03.604,553] <inf> GNSS_sample: Deactivating LTE +[00:00:05.000,640] <inf> GNSS_sample: RRC mode: Idle +[00:00:05.076,110] <inf> GNSS_sample: Activating GNSS +[00:00:05.078,826] <inf> GNSS_sample: Starting GNSS +[00:00:05.104,583] <inf> GNSS_sample: Searching... +[00:00:06.108,734] <inf> GNSS_sample: Searching... +[00:00:07.110,412] <inf> GNSS_sample: Searching... +[00:00:08.109,893] <inf> GNSS_sample: Searching... +... +... +[00:00:33.112,548] <inf> GNSS_sample: Searching... +[00:00:34.112,518] <inf> GNSS_sample: Searching... +[00:00:35.112,579] <inf> GNSS_sample: Searching... +[00:00:36.112,579] <inf> GNSS_sample: Searching... +[00:00:37.112,701] <inf> GNSS_sample: Searching... +[00:00:38.112,670] <inf> GNSS_sample: Searching... +[00:00:39.178,436] <inf> GNSS_sample: Searching... +[00:00:39.178,497] <inf> GNSS_sample: Latitude: 41.908028 +[00:00:39.178,527] <inf> GNSS_sample: Longitude: -87.629970 +[00:00:39.178,527] <inf> GNSS_sample: Altitude: 569.3 m +[00:00:39.178,558] <inf> GNSS_sample: Time (UTC): 15:18:00.567 +[00:00:39.178,558] <inf> GNSS_sample: Time to first fix: 77 s +[00:00:39.180,928] <inf> GNSS_sample: GNSS enter sleep after fix +``` + +## Credit + +Nordic Semiconductor
\ No newline at end of file diff --git a/gnss/nrf9161dk_nrf9161_ns.overlay b/gnss/nrf9161dk_nrf9161_ns.overlay new file mode 100644 index 0000000..50a7e92 --- /dev/null +++ b/gnss/nrf9161dk_nrf9161_ns.overlay @@ -0,0 +1,47 @@ +// To get started, press Ctrl+Space to bring up the completion menu and view the available nodes. + +// You can also use the buttons in the sidebar to perform actions on nodes. +// Actions currently available include: + +// * Enabling / disabling the node +// * Adding the bus to a bus +// * Removing the node +// * Connecting ADC channels + +// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html +// You can also visit the nRF DeviceTree extension documentation at https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/ncs_configure_app.html#devicetree-support-in-the-extension + +&i2c2 { + status = "okay"; + pinctrl-0 = <&i2c2_default>; + pinctrl-1 = <&i2c2_sleep>; + pinctrl-names = "default", "sleep"; + /*mysensor: mysensor@77{ + compatible = "i2c-device"; + status = "okay"; + reg = < 0x77 >; + }; + */ + bme688@77 { + compatible = "bosch,bme680"; + reg = <0x77>; + status = "okay"; + }; +}; + +&pinctrl { + /omit-if-no-ref/ i2c2_default: i2c2_default { + group1 { + psels = <NRF_PSEL(TWIM_SCL, 0, 8)>, + <NRF_PSEL(TWIM_SDA, 0, 9)>; + }; + }; + + /omit-if-no-ref/ i2c2_sleep: i2c2_sleep { + group1 { + psels = <NRF_PSEL(TWIM_SCL, 0, 8)>, + <NRF_PSEL(TWIM_SDA, 0, 9)>; + low-power-enable; + }; + }; +};
\ No newline at end of file diff --git a/gnss/prj.conf b/gnss/prj.conf new file mode 100644 index 0000000..1850a4d --- /dev/null +++ b/gnss/prj.conf @@ -0,0 +1,70 @@ +# +# Copyright (c) 2019 Nordic Semiconductor ASA +# Copyright (c) 2024 Conexio Technologies, Inc +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Logging +CONFIG_LOG=y + +# Button and LED support +CONFIG_DK_LIBRARY=y + +# Newlib +CONFIG_NEWLIB_LIBC=y +# Enable printing of floating-points +CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y +CONFIG_FPU=y + +# Network +CONFIG_NETWORKING=y +CONFIG_NET_NATIVE=n +CONFIG_NET_SOCKETS=y +CONFIG_NET_SOCKETS_OFFLOAD=y +CONFIG_NET_SOCKETS_POSIX_NAMES=y + +# Memory +CONFIG_HEAP_MEM_POOL_SIZE=4096 +CONFIG_MAIN_STACK_SIZE=4096 + +# Modem library +CONFIG_NRF_MODEM_LIB=y + +# LTE link control +CONFIG_LTE_LINK_CONTROL=y + +# Enable modem GPS mode +CONFIG_LTE_NETWORK_MODE_LTE_M_NBIOT_GPS=y + +# Stratus DK GPS configurations +CONFIG_MODEM_ANTENNA=y +# Enable GPS antenna +CONFIG_MODEM_ANTENNA_GNSS_ONBOARD=y + +CONFIG_MODEM_ANTENNA_AT_MAGPIO="AT\%XMAGPIO=1,0,0,1,1,1574,1577" +# Stratus GPS external antenna configuration with LNA enabled +CONFIG_MODEM_ANTENNA_AT_COEX0="AT\%XCOEX0=1,1,1565,1586" + +# Fix interval (in seconds) for periodic fixes +CONFIG_GNSS_PERIODIC_INTERVAL=120 + +# Fix timeout (in seconds) for periodic fixes. +# If set to zero, GNSS is allowed to run indefinitely until a valid PVT estimate is produced. +CONFIG_GNSS_PERIODIC_TIMEOUT=480 + +# Must enable Stratus application to be booted by MCUboot +CONFIG_BOOTLOADER_MCUBOOT=y + +#I2C +CONFIG_I2C=y +#CONFIG_I2C_NRFX=y + +CONFIG_TFM_SECURE_UART=n + +CONFIG_TFM_LOG_LEVEL_SILENCE=y + +CONFIG_CBPRINTF_FP_SUPPORT=y + +CONFIG_STDOUT_CONSOLE=y +CONFIG_SENSOR=y
\ No newline at end of file diff --git a/gnss/sample.yaml b/gnss/sample.yaml new file mode 100644 index 0000000..cf0684e --- /dev/null +++ b/gnss/sample.yaml @@ -0,0 +1,11 @@ +sample: + name: GNSS fix +tests: + samples.cellular.fundamentals_course: + build_only: true + platform_allow: nrf9160dk_nrf9160_ns thingy91_nrf9160_ns conexio_stratus_ns + integration_platforms: + - nrf9160dk_nrf9160_ns + - thingy91_nrf9160_ns + - conexio_stratus_ns + tags: ci_build
\ No newline at end of file diff --git a/gnss/src/bme680/bme680.c b/gnss/src/bme680/bme680.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gnss/src/bme680/bme680.c diff --git a/gnss/src/bme680/bme680.h b/gnss/src/bme680/bme680.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gnss/src/bme680/bme680.h diff --git a/gnss/src/main.c b/gnss/src/main.c new file mode 100644 index 0000000..29264e5 --- /dev/null +++ b/gnss/src/main.c @@ -0,0 +1,344 @@ +#if 1 +/* + * Copyright (c) 2024 Conexio Technologies, Inc + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include <stdio.h> +#include <zephyr/kernel.h> + +#include <zephyr/logging/log.h> +#include <modem/nrf_modem_lib.h> +#include <modem/lte_lc.h> +#include <dk_buttons_and_leds.h> + +/* Include the header file for the GNSS interface */ +#include <nrf_modem_gnss.h> + +/* Define the PVT data frame variable */ +static struct nrf_modem_gnss_pvt_data_frame pvt_data; + +/* Declare helper variables to find the TTFF */ +static int64_t gnss_start_time; +static bool first_fix = false; + +static K_SEM_DEFINE(lte_connected, 0, 1); + +LOG_MODULE_REGISTER(GNSS_sample, LOG_LEVEL_INF); + + +static int modem_configure(void) +{ + int err; + + LOG_INF("Initializing modem library"); + + err = nrf_modem_lib_init(); + if (err) { + LOG_ERR("Failed to initialize the modem library, error: %d", err); + return err; + } + + err = lte_lc_init(); + if (err) { + LOG_ERR("Failed to initialize LTE Link Controller, error: %d", err); + return err; + } + + return 0; +} + +/* Define a function to log fix data in a readable format */ +static void print_fix_data(struct nrf_modem_gnss_pvt_data_frame *pvt_data) +{ + LOG_INF("Latitude: %.06f", pvt_data->latitude); + LOG_INF("Longitude: %.06f", pvt_data->longitude); + LOG_INF("Altitude: %.01f m", pvt_data->altitude); + LOG_INF("Time (UTC): %02u:%02u:%02u.%03u", + pvt_data->datetime.hour, + pvt_data->datetime.minute, + pvt_data->datetime.seconds, + pvt_data->datetime.ms); +} + + +static void gnss_event_handler(int event) +{ + int err; + + switch (event) { + /* On a PVT event, confirm if PVT data is a valid fix */ + case NRF_MODEM_GNSS_EVT_PVT: + LOG_INF("Searching..."); + /* Print satellite information */ + int num_satellites = 0; + for (int i = 0; i < 12 ; i++) { + if (pvt_data.sv[i].signal != 0) { + LOG_INF("sv: %d, cn0: %d", pvt_data.sv[i].sv, pvt_data.sv[i].cn0); + num_satellites++; + } + } + LOG_INF("Number of current satellites: %d", num_satellites); + err = nrf_modem_gnss_read(&pvt_data, sizeof(pvt_data), NRF_MODEM_GNSS_DATA_PVT); + if (err) { + LOG_ERR("nrf_modem_gnss_read failed, err %d", err); + return; + } + if (pvt_data.flags & NRF_MODEM_GNSS_PVT_FLAG_FIX_VALID) { + dk_set_led_on(DK_LED1); + print_fix_data(&pvt_data); + /* Print the time to first fix */ + if (!first_fix) { + LOG_INF("Time to first fix: %2.1lld s", (k_uptime_get() - gnss_start_time)/1000); + first_fix = true; + } + return; + } + break; + /* Log when the GNSS sleeps and wakes up */ + case NRF_MODEM_GNSS_EVT_PERIODIC_WAKEUP: + LOG_INF("GNSS has woken up"); + break; + case NRF_MODEM_GNSS_EVT_SLEEP_AFTER_FIX: + LOG_INF("GNSS enter sleep after fix"); + break; + default: + break; + } +} + +int main(void) +{ + int err; + + LOG_INF("Stratus GNSS sample started"); + + if (dk_leds_init() != 0) { + LOG_ERR("Failed to initialize the LEDs Library"); + } + + err = modem_configure(); + if (err) { + LOG_ERR("Failed to configure the modem"); + return 0; + } + + /* Activate only the GNSS stack */ + if (lte_lc_func_mode_set(LTE_LC_FUNC_MODE_ACTIVATE_GNSS) != 0) { + LOG_ERR("Failed to activate GNSS functional mode"); + return 0; + } + + /* Register the GNSS event handler */ + if (nrf_modem_gnss_event_handler_set(gnss_event_handler) != 0) { + LOG_ERR("Failed to set GNSS event handler"); + return 0; + } + + /* Set the GNSS fix interval and GNSS fix retry period */ + if (nrf_modem_gnss_fix_interval_set(CONFIG_GNSS_PERIODIC_INTERVAL) != 0) { + LOG_ERR("Failed to set GNSS fix interval"); + return 0; + } + + if (nrf_modem_gnss_fix_retry_set(CONFIG_GNSS_PERIODIC_TIMEOUT) != 0) { + LOG_ERR("Failed to set GNSS fix retry"); + return 0; + } + + /* Start the GNSS receiver */ + LOG_INF("Starting GNSS"); + if (nrf_modem_gnss_start() != 0) { + LOG_ERR("Failed to start GNSS"); + return 0; + } + + /* Log the current system uptime */ + gnss_start_time = k_uptime_get(); + + return 0; +} +#elif 0 +/* */ +/* Copyright (c) 2020 Nordic Semiconductor ASA */ +/* */ +/* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include <zephyr/kernel.h> +#include <zephyr/sys/printk.h> +#include <zephyr/drivers/i2c.h> + +/* STEP 8 - Define the addresses of relevant registers */ +#define CTRLMEAS 0xF4 +#define CALIB00 0x88 +#define ID 0xD0 +#define TEMPMSB 0xFA + +#define CHIP_ID 0x61 +#define SENSOR_CONFIG_VALUE 0x93 + +/* STEP 6 - Get the node identifier of the sensor */ +#define I2C_NODE DT_NODELABEL(mysensor) + +/* Data structure to store BME280 data */ +struct bme280_data { + /* Compensation parameters */ + uint16_t dig_t1; + int16_t dig_t2; + int16_t dig_t3; +} bmedata; + +/* Read sensor calibration data and stores these into sensor data */ +void bme_calibrationdata(const struct i2c_dt_spec *spec, struct bme280_data *sensor_data_ptr) +{ + + /* Step 10 - Put calibration function code */ + uint8_t values[6]; + + int ret = i2c_burst_read_dt(spec, CALIB00, values, 6); + + if (ret != 0) { + printk("Failed to read register %x \n", CALIB00); + return; + } + + sensor_data_ptr->dig_t1 = ((uint16_t)values[1]) << 8 | values[0]; + sensor_data_ptr->dig_t2 = ((uint16_t)values[3]) << 8 | values[2]; + sensor_data_ptr->dig_t3 = ((uint16_t)values[5]) << 8 | values[4]; +} + +/* Compensate current temperature using previously stored sensor calibration data */ +static int32_t bme280_compensate_temp(struct bme280_data *data, int32_t adc_temp) +{ + int32_t var1, var2; + + var1 = (((adc_temp >> 3) - ((int32_t)data->dig_t1 << 1)) * ((int32_t)data->dig_t2)) >> 11; + + var2 = (((((adc_temp >> 4) - ((int32_t)data->dig_t1)) * + ((adc_temp >> 4) - ((int32_t)data->dig_t1))) >> + 12) * + ((int32_t)data->dig_t3)) >> + 14; + + return ((var1 + var2) * 5 + 128) >> 8; +} + +int main(void) +{ + + /* STEP 7 - Retrieve the API-specific device structure and make sure that the device is + * ready to use */ + static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C_NODE); + + if (!device_is_ready(dev_i2c.bus)) { + printk("I2C bus %s is not ready!\n", dev_i2c.bus->name); + return -1; + } + + /* STEP 9 - Verify it is proper device by reading device id */ + uint8_t id = 0; + uint8_t regs[] = {ID}; + + int ret = i2c_write_read_dt(&dev_i2c, regs, 1, &id, 1); + + if (ret != 0) { + printk("Failed to read register %x \n", regs[0]); + return -1; + } + + if (id != CHIP_ID) { + printk("Invalid chip id! %x \n", id); + return -1; + } + + bme_calibrationdata(&dev_i2c, &bmedata); + + /* STEP 11 - Setup the sensor by writing the value 0x93 to the Configuration register */ + uint8_t sensor_config[] = {CTRLMEAS, SENSOR_CONFIG_VALUE}; + + ret = i2c_write_dt(&dev_i2c, sensor_config, 2); + + if (ret != 0) { + printk("Failed to write register %x \n", sensor_config[0]); + return -1; + } + + while (1) { + + /* STEP 12 - Read the temperature from the sensor */ + uint8_t temp_val[3] = {0}; + + int ret = i2c_burst_read_dt(&dev_i2c, TEMPMSB, temp_val, 3); + + if (ret != 0) { + printk("Failed to read register %x \n", TEMPMSB); + k_msleep(1000); + continue; + } + + /* STEP 12.1 - Put the data read from registers into actual order (see datasheet) */ + int32_t adc_temp = + (temp_val[0] << 12) | (temp_val[1] << 4) | ((temp_val[2] >> 4) & 0x0F); + + /* STEP 12.2 - Compensate temperature */ + int32_t comp_temp = bme280_compensate_temp(&bmedata, adc_temp); + + /* STEP 12.3 - Convert temperature */ + float temperature = (float)comp_temp / 100.0f; + double fTemp = (double)temperature * 1.8 + 32; + + // Print reading to console + printk("Temperature in Celsius : %8.2f C\n", (double)temperature); + printk("Temperature in Fahrenheit : %.2f F\n", fTemp); + + k_msleep(1000); + } +} +#else + +/* + * Copyright (c) 2018 Bosch Sensortec GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + + #include <zephyr/kernel.h> + #include <zephyr/device.h> + #include <zephyr/drivers/sensor.h> + #include <stdio.h> + + int main(void) + { + const struct device *const dev = DEVICE_DT_GET_ONE(bosch_bme680); + struct sensor_value temp, press, humidity, gas_res; + + if (!device_is_ready(dev)) { + printk("sensor: device not ready.\n"); + return 0; + } + + printf("Device %p name is %s\n", dev, dev->name); + + #ifndef CONFIG_COVERAGE + while (1) { + #else + for (int i = 0; i < 5; i++) { + #endif + k_sleep(K_MSEC(3000)); + + sensor_sample_fetch(dev); + sensor_channel_get(dev, SENSOR_CHAN_AMBIENT_TEMP, &temp); + sensor_channel_get(dev, SENSOR_CHAN_PRESS, &press); + sensor_channel_get(dev, SENSOR_CHAN_HUMIDITY, &humidity); + sensor_channel_get(dev, SENSOR_CHAN_GAS_RES, &gas_res); + + printf("Temp: %d.%02d degC; Press: %d.%02d kPa; RH: %d.%02d %%; G: %d.%02d Ohm\n", + temp.val1, temp.val2, press.val1, press.val2, + humidity.val1, humidity.val2, gas_res.val1, + gas_res.val2); + } + return 0; + } + + +#endif diff --git a/gnss/sysbuild.conf b/gnss/sysbuild.conf new file mode 100644 index 0000000..fb58195 --- /dev/null +++ b/gnss/sysbuild.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2025 Conexio Technologies, Inc +# +# SPDX-License-Identifier: Apache-2.0 +# + +SB_CONFIG_BOOTLOADER_MCUBOOT=y |
