This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 8aa48c4fb examples: foc: Add critical section protection to FOC 
control loop
8aa48c4fb is described below

commit 8aa48c4fb6a691a321bd167892c79a844ec52cf1
Author: hujun5 <[email protected]>
AuthorDate: Tue Jan 27 14:14:26 2026 +0800

    examples: foc: Add critical section protection to FOC control loop
    
    Introduce CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC configuration option to enable
    critical section protection in the FOC (Field-Oriented Control) motor 
control
    examples. This adds irq-safe critical sections around the main control loop
    processing to prevent race conditions and ensure atomic updates of motor
    control state and parameters during interrupt handling.
    
    Signed-off-by: hujun5 <[email protected]>
---
 examples/foc/foc_fixed16_thr.c | 2 ++
 examples/foc/foc_float_thr.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/examples/foc/foc_fixed16_thr.c b/examples/foc/foc_fixed16_thr.c
index 2ba2998e6..3c9a8c77b 100644
--- a/examples/foc/foc_fixed16_thr.c
+++ b/examples/foc/foc_fixed16_thr.c
@@ -26,6 +26,8 @@
 
 #include <nuttx/config.h>
 
+#include <nuttx/spinlock.h>
+
 #include <assert.h>
 #include <dspb16.h>
 #include <fcntl.h>
diff --git a/examples/foc/foc_float_thr.c b/examples/foc/foc_float_thr.c
index af967f255..4c52b86bf 100644
--- a/examples/foc/foc_float_thr.c
+++ b/examples/foc/foc_float_thr.c
@@ -26,6 +26,8 @@
 
 #include <nuttx/config.h>
 
+#include <nuttx/spinlock.h>
+
 #include <assert.h>
 #include <dsp.h>
 #include <fcntl.h>

Reply via email to