mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 07:46:16 +08:00
drivers/capture: add fake capture driver for testing and development
This commit introduces a software-based fake capture driver that simulates a 10Hz square wave with 50% duty cycle, enabling development and testing of capture-related applications without requiring real hardware. Background: The capture driver subsystem requires hardware support (timers with input capture functionality) to measure external signal frequency and duty cycle. During development, testing, or on platforms without capture hardware, it's difficult to develop and test applications that use the capture API. Problem: Without a fake/simulator driver: - Developers cannot test capture applications without specific hardware - Continuous Integration (CI) systems cannot run capture-related tests - Applications cannot be developed on platforms lacking capture hardware - Testing edge notification features requires complex hardware setup - Difficult to reproduce specific timing scenarios for debugging Solution: This commit provides a software-simulated capture driver that generates predictable capture events using a watchdog timer. The fake driver produces a square wave signal at 10Hz frequency with 50% duty cycle, allowing applications to test the full capture API without hardware. Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
committed by
Alan C. Assis
parent
f6a9f8239d
commit
57217a7983
@@ -51,6 +51,7 @@
|
||||
#include <nuttx/syslog/syslog_console.h>
|
||||
#include <nuttx/thermal.h>
|
||||
#include <nuttx/timers/ptp_clock_dummy.h>
|
||||
#include <nuttx/timers/capture.h>
|
||||
#include <nuttx/trace.h>
|
||||
#include <nuttx/usrsock/usrsock_rpmsg.h>
|
||||
#include <nuttx/vhost/vhost.h>
|
||||
@@ -298,5 +299,9 @@ void drivers_initialize(void)
|
||||
ptp_clock_dummy_initialize(0);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FAKE_CAPTURE
|
||||
fake_capture_initialize(2);
|
||||
#endif
|
||||
|
||||
drivers_trace_end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user