Add sensors Sensor interface and a verified host test setup
Sensor/SensorValue in components/sensors/include/sensor.h is modeled on Zephyr's sensor API: a fetch()/get() split so multi-channel sensors (e.g. BME280) pay the hardware read cost once, fixed-point SensorValue (no float/double -- ESP32-C6 has no hardware FPU), a fine-grained SensorChannel enum, and an optional interrupt-driven set_trigger() for the battery-first sleep/wake design. Adds components/sensors/test_apps/host, a self-contained ESP-IDF project building against the `linux` target so this logic is host-testable per AGENTS.md's testing philosophy -- verified in a clean run against the pinned espressif/idf:v6.0.2 image (builds, 4/4 tests pass). Replaces the earlier generic top-level test/README.md placeholder now that a real per-component pattern exists. Also fixes .gitignore's build/managed_components patterns to match nested paths, not just the repo root. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
18
components/sensors/test_apps/host/CMakeLists.txt
Normal file
18
components/sensors/test_apps/host/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
# Host-based unit tests for the `sensors` component, run on ESP-IDF's
|
||||
# `linux` target (no board needed). Build/run with:
|
||||
#
|
||||
# idf.py --preview set-target linux
|
||||
# idf.py build
|
||||
# ./build/test_sensor_host.elf
|
||||
#
|
||||
# COMPONENTS is restricted (mirrors the pattern used by ESP-IDF's own
|
||||
# in-tree host test apps, e.g. components/cxx/test_apps/*) so the build
|
||||
# doesn't try to pull in board-only components that don't build for
|
||||
# linux.
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../../")
|
||||
set(COMPONENTS main sensors unity)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(test_sensor_host)
|
||||
Reference in New Issue
Block a user