This video, the second part of a hands-on series, details the nRF Connect SDK application development process, focusing on file structure and sensor integration.
CMakeLists.txt for the new files, and configuring Kconfig and Devicetree overlay files.
src directory, containing the application's core logic (e.g., main.c). [00:01:27]prj.conf: The main application configuration file, enabling modules like Bluetooth LE (e.g., CONFIG_BT=y), defining device names (CONFIG_BT_DEVICE_NAME), and enabling services (e.g., CONFIG_LBS=y). [00:01:57]NCS_SAMPLES_DEFAULT. [00:02:12]prj_minimal.conf: An alternative configuration file, often used for optimized "release" builds, disabling features like extensive logging to save memory. [00:03:35]
Kconfig.sysbuild: Used for multi-image builds, such as supporting MCUboot or dual-core devices like the nRF5340. [00:04:39]Kconfig: Defines the application's own custom software options and configurations, which are optional. [00:05:02]boards directory: Contains board-specific configuration fragments (ending in .conf) and Devicetree overlays (ending in .overlay). [00:06:33].overlay files) are used to modify or extend the base Devicetree provided by the build target (e.g., nrf52840dk_nrf52840) to add custom hardware components or change pin assignments. [00:07:02]CMakeLists.txt (Build System): A mandatory file for every nRF Connect SDK application, as all applications are CMake projects. [00:05:33]
DT_LABEL. [00:14:39]sensor_sample_fetch): Instructs the sensor driver to read data from all its channels, storing it internally in the driver's buffer. [00:14:56]sensor_channel_get): Retrieves individual channel values from the driver's buffer. [00:15:02]
sensor_data_collector.c: Contains the sensor data collection logic, including a thread that continuously fetches and processes sensor data. [00:10:04]sensor_data_collector.h: Defines the interface and data structures (e.g., sensor_data_t struct for temperature, humidity, pressure, accelerometer) to expose sensor readings to other modules. [00:11:15]
CMakeLists.txt: Add the new source and header files (sensor_data_collector.c, sensor_data_collector.h) to the application's build system. [00:10:24]prj.conf: Enable the generic sensor drivers using CONFIG_SENSOR=y. [00:12:07]nrf52840dk_nrf52840.overlay): Configure the simulated sensor by defining it as a node with specific properties (e.g., compatible = "zephyr,sim-temp-hum-press-accel"). [00:13:26]
CONFIG_SIMULATED_SENSOR, to the application's Kconfig file, allowing developers to choose between using the simulated or physical sensors. [00:20:17]#if CONFIG_SIMULATED_SENSOR) in sensor_data_collector.c to call the appropriate sensor initialization and data fetching functions based on the selected option. [00:21:02]
CONFIG_SIMULATED_SENSOR disabled (set to n).