zephyr/drivers/sensor/Kconfig.sensor_clock
Mark Chen f4da9b9705 drivers: sensor: Add sensor clock API support
This commit introduces a new Sensor Clock API, enabling the retrieval
of cycle counts and conversion to nanoseconds based on the system or
external clock. The API includes:

- `sensor_clock_get_cycles()` to get the current cycle count from the
  sensor clock.
- `sensor_clock_cycles_to_ns()` to convert cycles to nanoseconds using
  the clock's frequency.

The implementation supports both system clocks and external clocks
defined in the device tree, making the sensor clock integration more
flexible for various sensor use cases.

Signed-off-by: Mark Chen <mark.chen@cienet.com>
2025-01-15 19:03:13 +01:00

30 lines
621 B
Text

# Sensor clock configuration options
# Copyright(c) 2024 Cienet
# SPDX-License-Identifier: Apache-2.0
config SENSOR_CLOCK
bool
default y if SENSOR_ASYNC_API
help
Configure the sensor clock source for the system.
if SENSOR_CLOCK
choice
prompt "Sensor clock type"
default SENSOR_CLOCK_SYSTEM
help
Select the clock source to be used for sensor timing.
config SENSOR_CLOCK_SYSTEM
bool "Use the system counter for sensor time"
config SENSOR_CLOCK_COUNTER
bool "Use a counter device/API for sensor time"
config SENSOR_CLOCK_RTC
bool "Use an RTC device/API for sensor time"
endchoice
endif # SENSOR_CLOCK