libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::CH32Timebase Class Reference

CH32 时间基准实现 / CH32 timebase implementation. More...

#include <ch32_timebase.hpp>

Inheritance diagram for LibXR::CH32Timebase:
[legend]
Collaboration diagram for LibXR::CH32Timebase:
[legend]

Public Member Functions

 CH32Timebase ()
 构造函数 / Constructor
 
void Sync (uint32_t ticks)
 同步毫秒计数器。 Synchronize the millisecond counter.
 
- Public Member Functions inherited from LibXR::Timebase
 Timebase ()=default
 默认构造函数。 Default constructor.
 
 Timebase (const Timebase &)=delete
 禁止拷贝构造。 Copy construction is disabled.
 
Timebaseoperator= (const Timebase &)=delete
 禁止拷贝赋值。 Copy assignment is disabled.
 

Static Public Member Functions

static void OnSysTickInterrupt ()
 SysTick 中断入口辅助函数。 Helper called from the SysTick interrupt path.
 
- Static Public Member Functions inherited from LibXR::Timebase
static MicrosecondTimestamp GetMicroseconds ()
 获取当前时间的微秒级时间戳。 Gets the current timestamp in microseconds.
 
static MillisecondTimestamp GetMilliseconds ()
 获取当前时间的毫秒级时间戳。 Gets the current timestamp in milliseconds.
 
static bool IsReady () noexcept
 检查时间基是否已经初始化。 Check whether the active timebase backend is initialized.
 
static void DelayMicroseconds (uint32_t us)
 微秒级延时 / Delay in microseconds
 

Static Public Attributes

static volatile uint32_t sys_tick_ms_ = 0
 SysTick 毫秒计数器。 SysTick millisecond counter.
 

Additional Inherited Members

- Static Protected Member Functions inherited from LibXR::Timebase
static void SetReady (bool ready=true) noexcept
 设置时间基就绪状态。 Set the timebase ready flag.
 
static void ConfigureWrapRange (uint64_t max_valid_us, uint32_t max_valid_ms) noexcept
 配置时间戳回绕上界。 Configure the timestamp wraparound limits.
 
static uint64_t GetConfiguredWrapRangeUs () noexcept
 读取当前配置的微秒回绕上界。 Read the configured microsecond wraparound limit.
 
static uint32_t GetConfiguredWrapRangeMs () noexcept
 读取当前配置的毫秒回绕上界。 Read the configured millisecond wraparound limit.
 

Detailed Description

CH32 时间基准实现 / CH32 timebase implementation.

Definition at line 15 of file ch32_timebase.hpp.

Constructor & Destructor Documentation

◆ CH32Timebase()

CH32Timebase::CH32Timebase ( )

构造函数 / Constructor

配置 CH32 SysTick 时间基的回绕范围,并标记时间基已就绪。 Configures the CH32 SysTick wrap range and marks the timebase ready.

Definition at line 6 of file ch32_timebase.cpp.

7{
8 ConfigureWrapRange(static_cast<uint64_t>(UINT32_MAX) * 1000ULL + 999ULL, UINT32_MAX);
9 SetReady();
10}
static void ConfigureWrapRange(uint64_t max_valid_us, uint32_t max_valid_ms) noexcept
配置时间戳回绕上界。 Configure the timestamp wraparound limits.
Definition timebase.hpp:95
static void SetReady(bool ready=true) noexcept
设置时间基就绪状态。 Set the timebase ready flag.
Definition timebase.hpp:85

Member Function Documentation

◆ OnSysTickInterrupt()

void CH32Timebase::OnSysTickInterrupt ( )
inlinestatic

SysTick 中断入口辅助函数。 Helper called from the SysTick interrupt path.

Definition at line 42 of file ch32_timebase.cpp.

42{ sys_tick_ms_ = sys_tick_ms_ + 1U; }
static volatile uint32_t sys_tick_ms_
SysTick 毫秒计数器。 SysTick millisecond counter.

◆ Sync()

void CH32Timebase::Sync ( uint32_t ticks)

同步毫秒计数器。 Synchronize the millisecond counter.

Parameters
ticks新的毫秒计数值。New millisecond tick value.

Definition at line 44 of file ch32_timebase.cpp.

44{ sys_tick_ms_ = ticks; }

Field Documentation

◆ sys_tick_ms_

volatile uint32_t LibXR::CH32Timebase::sys_tick_ms_ = 0
inlinestatic

SysTick 毫秒计数器。 SysTick millisecond counter.

Definition at line 43 of file ch32_timebase.hpp.


The documentation for this class was generated from the following files: