硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2858|回复: 0
收起左侧

[STM32H7] RTX5针对HAL库使用滴答定时器的处理方法

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107101
QQ
发表于 2018-4-5 12:09:37 | 显示全部楼层 |阅读模式
  1. /**
  2.   * Override default HAL_GetTick function
  3.   */
  4. uint32_t HAL_GetTick (void) {
  5.   static uint32_t ticks = 0U;
  6.          uint32_t i;

  7.   if (osKernelGetState () == osKernelRunning) {
  8.     return ((uint32_t)osKernelGetTickCount ());
  9.   }

  10.   /* If Kernel is not running wait approximately 1 ms then increment
  11.      and return auxiliary tick counter value */
  12.   for (i = (SystemCoreClock >> 14U); i > 0U; i--) {
  13.     __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP();
  14.     __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP();
  15.   }
  16.   return ++ticks;
  17. }
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-18 08:28 , Processed in 0.140894 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表