Skip to content

feat(firmware/c_board): Replace DWT delay helper with TIM2/TIM9 timer service#31

Merged
qzhhhi merged 3 commits intomainfrom
dev/delay-async
Mar 7, 2026
Merged

feat(firmware/c_board): Replace DWT delay helper with TIM2/TIM9 timer service#31
qzhhhi merged 3 commits intomainfrom
dev/delay-async

Conversation

@qzhhhi
Copy link
Member

@qzhhhi qzhhhi commented Mar 6, 2026

  • Add 48-bit timepoint based on chained TIM2/TIM9 counters.
  • Add delay_async APIs for non-blocking delay checks.
  • Route HAL_Delay and BMI088 delays through timer::timer.
  • Initialize TIM2/TIM9 during app startup and regenerate CubeMX TIM config.
  • Remove legacy DWT-based delay.hpp.

固件延迟计时器服务重构(更新)

概述

本 PR 用基于链式 TIM2/TIM9 计数的 Timer 服务替换了原先基于 DWT 的 busy-wait 延迟实现,新增 48 位时间点与非阻塞延迟检查接口(delay_async 风格的 check_expired),并将 HAL_Delay 及 BMI088 驱动中的延迟调用路由到新的 timer 服务;同时在应用启动时初始化 TIM9/TIM2 并更新了 CubeMX 的 TIM 配置,移除了旧的 DWT delay.hpp。

主要改动

  • 新增 Timer 实现:firmware/c_board/app/src/timer/timer.hpp

    • 添加类 librmcs::firmware::timer::Timer 及全局懒初始化实例 inline constinit Timer::Lazy timer。
    • 提供 32 位与组合的 48 位时间点(TimePoint / TimePoint48)、Tick/Duration 类型、check_expired 重载用于非阻塞检查,以及 spin_wait(Duration48) 的忙等待实现。
    • 使用 TIM2(低 32 位)与 TIM9(高位)组合为 48 位计数,提供 to_duration_checked / to_duration48_checked 等安全转换与边界断言,并暴露相关常量与计数寄存器引用。
  • 启动/初始化调整:firmware/c_board/app/src/app.cpp

    • 调整 TIM 初始化顺序:先 MX_TIM9_Init(),再 MX_TIM2_Init(),随后调用 timer::timer.init();相关注释和初始化位置调整(TIM9 必须先于 TIM2)。
  • CubeMX / HAL 定时器变更

    • firmware/c_board/bsp/cubemx/Core/Inc/tim.h:新增 extern TIM_HandleTypeDef htim2、htim9 及 MX_TIM2_Init/MX_TIM9_Init 声明。
    • firmware/c_board/bsp/cubemx/Core/Src/tim.c:新增 htim2/htim9 定义与 MX_TIM2_Init / MX_TIM9_Init 实现,包含 TIM9 的从属/ITR 配置与 TIM2 的基础计数配置,并在 MSP init/deinit 中加入 TIM2/TIM9 时钟控制。
    • rmcs_slave.ioc:更新 MCU 外设、引脚映射及 TIM2/TIM9 的配置项以反映新 TIM 拓扑和参数。
  • 移除与重路由

    • 删除旧的 DWT busy-wait 头文件:firmware/c_board/app/src/timer/delay.hpp(移除 kSystemFrequency、delay_basic、delay 模板等 API)。
    • firmware/c_board/app/src/timer/delay.cpp:
      • 将 HAL_Delay(uint32_t) 实现改为通过 timer::timer->spin_wait(...)(使用 Timer::to_duration48_checked 转换)。
      • 新增并导出 HAL_IncTick() 的实现以维护系统 tick(uwTick)。
    • BMI088 驱动(accel.hpp / gyro.hpp / base.hpp):
      • include 从 timer/delay.hpp 改为 timer/timer.hpp。
      • 将 timer::delay(...) 调用替换为 timer::timer->spin_wait(...)(保留原逻辑节拍,但改用新计时服务)。

对公开/导出符号的影响

  • 新增导出:
    • librmcs::firmware::timer::Timer 类及其类型别名与方法;inline constinit Timer::Lazy timer 实例。
    • BSP/CubeMX 导出:htim2、htim9、MX_TIM2_Init(void)、MX_TIM9_Init(void)。
    • 在 delay.cpp 中新增并导出 extern "C" void HAL_IncTick()(并修改 HAL_Delay 的实现)。
  • 移除:
    • 旧的 DWT 延迟 API(firmware/c_board/app/src/timer/delay.hpp 中的 delay_basic / delay 模板、kSystemFrequency、SysFreqDuration 等)。

兼容性与行为注意

  • HAL_Delay 现在通过基于 TIM2/TIM9 的 Timer 服务实现(使用 48 位时间点与 spin_wait),在禁用中断或高精度需求下行为与原 DWT 实现可能存在差异,但目标是提供对更大时长与中断场景更可靠的支持。
  • 新 Timer 提供的 check_expired(delay_async 风格)可用于非阻塞轮询,调用方可替代阻塞调用以实现异步延迟检查。
  • 必须保证 TIM 初始化顺序(TIM9 先于 TIM2);PR 已在应用构造/初始化中做出相应调整。
  • 合并时需注意 BSP / CubeMX .ioc 中的时钟与引脚映射变更与项目的实际硬件配置保持一致。

影响范围

  • 应用启动流程(新增 TIM9/TIM2 初始化、timer.init 调用位置变化)。
  • HAL_Delay / HAL_IncTick 的实现与行为。
  • BMI088 驱动中所有延迟调用路径(改为通过 timer::timer 实例)。
  • BSP/CubeMX 定时器配置与外设引脚映射(.ioc、tim.h、tim.c 的变更)。

@qzhhhi
Copy link
Member Author

qzhhhi commented Mar 6, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0fec4f78-61e7-44ea-b628-ea988dc5dec4

📥 Commits

Reviewing files that changed from the base of the PR and between 5b63d67 and 398a39f.

📒 Files selected for processing (1)
  • firmware/c_board/app/src/timer/delay.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • firmware/c_board/app/src/timer/delay.cpp

Walkthrough

新增基于硬件定时器的 Timer 类与全局实例,删除基于 DWT 的 delay API;调整启动顺序以先初始化 TIM9/TIM2 并初始化 timer 实例;将 HAL_Delay 与 BMI088 驱动的延时调用迁移到新的 timer 接口;添加 TIM2/TIM9 的 CubeMX 配置与驱动实现。

Changes

Cohort / File(s) Summary
Timer 实现与全局实例
firmware/c_board/app/src/timer/timer.hpp
新增 Timer 类(timepoint/48 位时基、check_expired、spin_wait、转换工具)并导出 inline 全局 Lazy 实例 timer
移除旧 DWT 延时头
firmware/c_board/app/src/timer/delay.hpp
删除基于 DWT 的 delay/delay_basic、相关常量与类型别名(公共 API 被移除)。
HAL 延时集成修改
firmware/c_board/app/src/timer/delay.cpp
HAL_Delay 改为通过 timer::timer->spin_wait(...) 实现(48 位时基转换),并新增/实现 HAL_IncTick() 符号。
应用启动顺序调整
firmware/c_board/app/src/app.cpp
包含 timer.hpp,在构造/启动流程中先调用 MX_TIM9_Init()MX_TIM2_Init(),随后初始化 timer::timer;timer 初始化移动到 GPIO 之前。
BMI088 驱动替换延时调用
firmware/c_board/app/src/spi/bmi088/accel.hpp, .../base.hpp, .../gyro.hpp
替换包含头(delay.hpptimer.hpp),并将 timer::delay(1ms) 调用改为 timer::timer->spin_wait(1ms)(若干处)。
CubeMX 与 TIM 外设支持
firmware/c_board/bsp/cubemx/Core/Inc/tim.h, .../Core/Src/tim.c, .../rmcs_slave.ioc
新增并导出 TIM2/TIM9 的 extern 与 MX_TIM2_Init/MX_TIM9_Init 实现,扩展时钟/从模式/同步配置,更新 .ioc 以包含 TIM2/TIM9 映射与引脚参数。

Sequence Diagram(s)

sequenceDiagram
    participant App as App (startup)
    participant MX as MX_TIM9_Init / MX_TIM2_Init
    participant HAL as HAL / TIM peripherals
    participant Timer as timer::Timer
    participant BMI as BMI088 driver

    App->>MX: 调用 MX_TIM9_Init()
    App->>MX: 调用 MX_TIM2_Init()
    MX->>HAL: 配置并启动 TIM9/TIM2(时钟/同步/从模式)
    App->>Timer: 初始化 timer::timer
    Timer->>HAL: HAL_TIM_Base_Start(kTimerHigh/kTimerLow)
    BMI->>Timer: 调用 timer::timer->spin_wait(1ms)
    Timer-->>BMI: 等待结束并返回
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 轻跳小兔子,数着 TIM 的节拍;
TIM9 先醒来,TIM2 紧随其后。
我在微秒间偷笑,spin_wait 把夜数开,
BMI 的数据点头,固件悄悄长出盖。

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: replacing the DWT-based delay helper with a TIM2/TIM9 timer service, which aligns with the file changes showing removal of delay.hpp and addition of timer.hpp infrastructure.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev/delay-async

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
firmware/c_board/bsp/cubemx/rmcs_slave.ioc (1)

348-349: 把 TIM5 的 ITR 虚拟配置从 .ioc 里撤掉。

这两行会让 CubeMX 在 firmware/c_board/bsp/cubemx/Core/Src/tim.c 里给现有 TIM5 PWM 定时器再生成一段 HAL_TIM_SlaveConfigSynchro() 配置。当前 48 位 timepoint 只依赖 TIM2/TIM9,这个 TIM5 触发源配置没有功能收益,却扩大了 LED 定时器的回归面。建议只保留 TIM2/TIM9 的虚拟时钟配置。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@firmware/c_board/bsp/cubemx/rmcs_slave.ioc` around lines 348 - 349, 删除 .ioc
文件中 VP_TIM5_VS_ClockSourceITR.Mode=TriggerSource_ITR0 和
VP_TIM5_VS_ClockSourceITR.Signal=TIM5_VS_ClockSourceITR 这两行,避免 CubeMX 在
Core/Src/tim.c 对现有 TIM5 PWM 定时器再生成 HAL_TIM_SlaveConfigSynchro() 的从属触发配置;保留仅针对
TIM2/TIM9 的虚拟时钟配置并在修改后用 CubeMX 重新生成代码以验证 TIM5 触发配置不再被写入。
firmware/c_board/app/src/timer/timer.hpp (1)

22-22: 建议添加时钟频率计算的注释说明。

168'000'000 / 2 / 21 的计算依赖于 STM32 时钟树配置(系统时钟、APB 分频、定时器预分频),建议添加注释说明推导过程,便于维护时与 CubeMX 配置保持同步。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@firmware/c_board/app/src/timer/timer.hpp` at line 22, 常量 kClockFrequency
的数值来源不直观;在 timer.hpp 为该行添加一行注释,说明推导:168'000'000 是系统主时钟频率,除以 APB 分频 (2)
得到定时器总线输入(或按当前时钟树配置的分频),再除以 软件/硬件定时器预分频 21 得到实际定时器计数频率;并指出该注释应随
CubeMX/时钟树配置变更同步更新。这样在后续维护时能快速对应到系统时钟、APB 分频和定时器预分频(kClockFrequency 的来源)。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@firmware/c_board/app/src/timer/timer.hpp`:
- Line 22: 常量 kClockFrequency 的数值来源不直观;在 timer.hpp 为该行添加一行注释,说明推导:168'000'000
是系统主时钟频率,除以 APB 分频 (2) 得到定时器总线输入(或按当前时钟树配置的分频),再除以 软件/硬件定时器预分频 21
得到实际定时器计数频率;并指出该注释应随 CubeMX/时钟树配置变更同步更新。这样在后续维护时能快速对应到系统时钟、APB
分频和定时器预分频(kClockFrequency 的来源)。

In `@firmware/c_board/bsp/cubemx/rmcs_slave.ioc`:
- Around line 348-349: 删除 .ioc 文件中
VP_TIM5_VS_ClockSourceITR.Mode=TriggerSource_ITR0 和
VP_TIM5_VS_ClockSourceITR.Signal=TIM5_VS_ClockSourceITR 这两行,避免 CubeMX 在
Core/Src/tim.c 对现有 TIM5 PWM 定时器再生成 HAL_TIM_SlaveConfigSynchro() 的从属触发配置;保留仅针对
TIM2/TIM9 的虚拟时钟配置并在修改后用 CubeMX 重新生成代码以验证 TIM5 触发配置不再被写入。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99c15462-2d79-494e-b9d3-afe314b1342f

📥 Commits

Reviewing files that changed from the base of the PR and between a534fbe and 6ac67a0.

📒 Files selected for processing (10)
  • firmware/c_board/app/src/app.cpp
  • firmware/c_board/app/src/spi/bmi088/accel.hpp
  • firmware/c_board/app/src/spi/bmi088/base.hpp
  • firmware/c_board/app/src/spi/bmi088/gyro.hpp
  • firmware/c_board/app/src/timer/delay.cpp
  • firmware/c_board/app/src/timer/delay.hpp
  • firmware/c_board/app/src/timer/timer.hpp
  • firmware/c_board/bsp/cubemx/Core/Inc/tim.h
  • firmware/c_board/bsp/cubemx/Core/Src/tim.c
  • firmware/c_board/bsp/cubemx/rmcs_slave.ioc
💤 Files with no reviewable changes (1)
  • firmware/c_board/app/src/timer/delay.hpp

… service

- Add 48-bit timepoint based on chained TIM2/TIM9 counters.
- Add delay_async APIs for non-blocking delay checks.
- Route HAL_Delay and BMI088 delays through timer::timer.
- Initialize TIM2/TIM9 during app startup and regenerate CubeMX TIM config.
- Remove legacy DWT-based delay.hpp.
@qzhhhi qzhhhi force-pushed the dev/delay-async branch from 6ac67a0 to 2de3b5c Compare March 7, 2026 10:17
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
firmware/c_board/bsp/cubemx/rmcs_slave.ioc (1)

265-265: 把 CubeMX 的函数排序也同步成先 TIM9TIM2

firmware/c_board/app/src/app.cpp Line 38-41 已经把这两个初始化写成硬依赖,但这里的 functionlistsort 仍然把 MX_TIM2_Init 排在 MX_TIM9_Init 前面。现在主流程虽然是手写的,后续重新生成代码或按 .ioc 顺序维护时,还是很容易把这个依赖关系回退坏。

♻️ 建议修改
-ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_CAN1_Init-CAN1-false-HAL-true,6-MX_CAN2_Init-CAN2-false-HAL-true,7-MX_USART1_UART_Init-USART1-false-HAL-true,8-MX_USART3_UART_Init-USART3-false-HAL-true,9-MX_USART6_UART_Init-USART6-false-HAL-true,10-MX_TIM5_Init-TIM5-false-HAL-true,11-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,12-MX_TIM2_Init-TIM2-false-HAL-true,13-MX_TIM9_Init-TIM9-false-HAL-true
+ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_CAN1_Init-CAN1-false-HAL-true,6-MX_CAN2_Init-CAN2-false-HAL-true,7-MX_USART1_UART_Init-USART1-false-HAL-true,8-MX_USART3_UART_Init-USART3-false-HAL-true,9-MX_USART6_UART_Init-USART6-false-HAL-true,10-MX_TIM5_Init-TIM5-false-HAL-true,11-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,12-MX_TIM9_Init-TIM9-false-HAL-true,13-MX_TIM2_Init-TIM2-false-HAL-true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@firmware/c_board/bsp/cubemx/rmcs_slave.ioc` at line 265, 更新
ProjectManager.functionlistsort 中的函数顺序,使 MX_TIM9_Init 排在 MX_TIM2_Init 之前以匹配
app.cpp 对 TIM9->TIM2 的硬依赖关系;具体操作是在 functionlistsort 字段中将条目
"12-MX_TIM2_Init-TIM2-..." 和 "13-MX_TIM9_Init-TIM9-..." 互换顺序(使 MX_TIM9_Init
的条目编号和位置在 MX_TIM2_Init 之前),确保 ProjectManager.functionlistsort 中的顺序与 MX_TIM9_Init
和 MX_TIM2_Init 的依赖顺序一致以防止后续代码生成回退出错。
firmware/c_board/app/src/timer/timer.hpp (1)

22-23: 避免把 TIM2 时基参数硬编码两份。

这里的 168'000'000 / 2 / 21firmware/c_board/bsp/cubemx/Core/Src/tim.c:45-65 / firmware/c_board/bsp/cubemx/rmcs_slave.ioc Line 317-320 是重复来源。后续只要改了 APB1 分频或 TIM2 预分频,这里的 std::chrono 换算就会静默失真,所有 delay 都会跑偏。建议至少在 Timer() 里加一个运行时一致性断言,或者把频率收敛到单一来源。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@firmware/c_board/app/src/timer/timer.hpp` around lines 22 - 23, The code
currently hardcodes kClockFrequency and TickPeriod which duplicates TIM2
configuration; change to a single source or add a runtime consistency check:
either (A) centralize the TIM2 clock/prescaler into one header/constant used by
both the CubeMX-generated TIM2 init and timer.hpp (remove the literal
168'000'000 / 2 / 21), or (B) keep the compile-time value but add a runtime
assertion in Timer::Timer() that computes the effective TIM2 tick rate from the
RCC/APB1 prescaler and the TIM2->PSC (or via HAL_RCC_GetPCLK1Freq and TIM2->PSC)
and compare it to constexpr kClockFrequency (allowing a small tolerance) and
error/log/abort on mismatch; reference kClockFrequency, TickPeriod and
Timer::Timer() when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@firmware/c_board/app/src/timer/timer.hpp`:
- Around line 81-98: 在 delay 模板函数中,当前用 InputDuration remaining(基于输入单位)每轮减去的是
max_segment 的截断值但实际等待的是更大的 max_segment_ticks,导致累积超时;把剩余量统一按实际 ticks/FullDuration
跟踪:将传入的 delay 先转换为以 ticks 为单位的 FullDuration 或整型剩余 ticks(使用
duration_to_ticks_checked_ceil/count_to_u64_checked),在循环中每次从该剩余 ticks 中减去真正调用
delay_basic 的 max_segment_ticks(或其 ticks 值),最后对不足一段的剩余 ticks 调用
delay_basic;定位符:delay, InputDuration, remaining, max_segment_ticks, max_segment,
delay_basic, FullDuration, duration_to_ticks_checked_ceil, count_to_u64_checked。
- Around line 120-130: The helpers duration_to_ticks_checked_32 and
duration_to_ticks_checked_48 (and the underlying duration_to_ticks_checked
template they call) currently truncate durations to whole ticks causing
non-multiple-of-tick waits to under-wait; change the conversion to perform
ceiling rounding (i.e., round up to the next tick) so that any fractional tick
yields at least one full tick, while preserving the existing overflow/max-check
behavior against kMaxDelay32Ticks and kMaxDelay48Ticks; locate
duration_to_ticks_checked<max_ticks>, adjust its math to use an upward rounding
strategy (or std::chrono::ceil) and ensure the return types and overflow checks
remain correct for duration_to_ticks_checked_32 and
duration_to_ticks_checked_48.

---

Nitpick comments:
In `@firmware/c_board/app/src/timer/timer.hpp`:
- Around line 22-23: The code currently hardcodes kClockFrequency and TickPeriod
which duplicates TIM2 configuration; change to a single source or add a runtime
consistency check: either (A) centralize the TIM2 clock/prescaler into one
header/constant used by both the CubeMX-generated TIM2 init and timer.hpp
(remove the literal 168'000'000 / 2 / 21), or (B) keep the compile-time value
but add a runtime assertion in Timer::Timer() that computes the effective TIM2
tick rate from the RCC/APB1 prescaler and the TIM2->PSC (or via
HAL_RCC_GetPCLK1Freq and TIM2->PSC) and compare it to constexpr kClockFrequency
(allowing a small tolerance) and error/log/abort on mismatch; reference
kClockFrequency, TickPeriod and Timer::Timer() when making the change.

In `@firmware/c_board/bsp/cubemx/rmcs_slave.ioc`:
- Line 265: 更新 ProjectManager.functionlistsort 中的函数顺序,使 MX_TIM9_Init 排在
MX_TIM2_Init 之前以匹配 app.cpp 对 TIM9->TIM2 的硬依赖关系;具体操作是在 functionlistsort 字段中将条目
"12-MX_TIM2_Init-TIM2-..." 和 "13-MX_TIM9_Init-TIM9-..." 互换顺序(使 MX_TIM9_Init
的条目编号和位置在 MX_TIM2_Init 之前),确保 ProjectManager.functionlistsort 中的顺序与 MX_TIM9_Init
和 MX_TIM2_Init 的依赖顺序一致以防止后续代码生成回退出错。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 081908e0-1072-4526-aa5a-7c1488423fb2

📥 Commits

Reviewing files that changed from the base of the PR and between 6ac67a0 and 2de3b5c.

📒 Files selected for processing (10)
  • firmware/c_board/app/src/app.cpp
  • firmware/c_board/app/src/spi/bmi088/accel.hpp
  • firmware/c_board/app/src/spi/bmi088/base.hpp
  • firmware/c_board/app/src/spi/bmi088/gyro.hpp
  • firmware/c_board/app/src/timer/delay.cpp
  • firmware/c_board/app/src/timer/delay.hpp
  • firmware/c_board/app/src/timer/timer.hpp
  • firmware/c_board/bsp/cubemx/Core/Inc/tim.h
  • firmware/c_board/bsp/cubemx/Core/Src/tim.c
  • firmware/c_board/bsp/cubemx/rmcs_slave.ioc
💤 Files with no reviewable changes (1)
  • firmware/c_board/app/src/timer/delay.hpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • firmware/c_board/bsp/cubemx/Core/Src/tim.c
  • firmware/c_board/app/src/spi/bmi088/accel.hpp

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@firmware/c_board/app/src/timer/delay.cpp`:
- Around line 14-15: Formatting issue: run clang-format on
firmware/c_board/app/src/timer/delay.cpp to fix the lint failure at the call to
timer::timer->spin_wait(timer::Timer::to_duration48_checked(std::chrono::milliseconds(delay)));;
apply the project's clang-format configuration (or run the repo's format script)
so the call and nested function arguments are wrapped/indented according to
style, then commit the formatted file so CI lint passes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: db00ee13-9c6e-44e1-a014-54ee1b2cfea1

📥 Commits

Reviewing files that changed from the base of the PR and between 2de3b5c and 5b63d67.

📒 Files selected for processing (5)
  • firmware/c_board/app/src/spi/bmi088/accel.hpp
  • firmware/c_board/app/src/spi/bmi088/base.hpp
  • firmware/c_board/app/src/spi/bmi088/gyro.hpp
  • firmware/c_board/app/src/timer/delay.cpp
  • firmware/c_board/app/src/timer/timer.hpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • firmware/c_board/app/src/spi/bmi088/accel.hpp
  • firmware/c_board/app/src/spi/bmi088/base.hpp

@qzhhhi qzhhhi merged commit ad270df into main Mar 7, 2026
5 checks passed
@qzhhhi qzhhhi deleted the dev/delay-async branch March 7, 2026 12:30
@github-project-automation github-project-automation bot moved this from Todo to Done in RMCS Slave SDK Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant