Skip to content

Commit

Permalink
更新C++17依赖说明
Browse files Browse the repository at this point in the history
  • Loading branch information
埃博拉酱 committed Apr 18, 2022
1 parent ddc8505 commit 18cb141
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

充分利用开发板上所有的计时器。

音响、方波、延迟任务、定时重复,这些任务都需要应用开发板上的计时器才能完成。有时你甚至需要多个计时器同步运行,实现多线程任务。但是,当前Arduino社区并没有提供比较完善的计时器运行库。它们能够执行的任务模式非常有限,而且用户无法指定具体要使用哪个计时器。其结果就是,经常有一些使用计时器的库发生冲突,或者和用户自己的应用发生冲突。本项目旨在将计时器可能需要使用的所有功能在所有计时器上实现,最关键的是允许用户手动指定要是用的硬件计时器,避免冲突。

*您必须为您的 IDE 启用 C++17。打开“%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt”并将参数“-std=gnu++11”更改为-std=gnu++17。*

**由于作者精力有限,目前本项目所有函数,仅时长、重复次数参数可以在运行时动态设置,其它参数必须为编译期常量,作为模板参数。后续有空会实现更多可以动态设置参数的API。当然更欢迎上GitHub主页贡献Pull request。**
# 硬件计时器
本库所有公开API的第一个模板参数,都是计时器的编号。不同计时器之间完全独立运行,互不干扰。用户必须在代码中手动指定要使用哪个硬件计时器来执行功能。不同CPU中的计时器数目和属性各不相同,此处以Arduino Mega开发板上常用的ATMega2560系列CPU为例:
Expand All @@ -24,6 +25,8 @@ Make full use of all your hardware timers on your Arduino board.

The only library you can choose any hardware timer you like to use in your timing function. Tones, square waves, delayed tasks, timed repetitive tasks are provided as building blocks for your own sophisticated multi-timer tasks. My library hides hardware register details for you.

*You must enable C++17 for your IDE. Open "%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt" and change the argument "-std=gnu++11" to -std=gnu++17.*

**Currently, for all APIs, only time length and RepeatTimes arguments can be specified at runtime. Other arguments are all template arguments, i.e., they must be known as constexprs at compiling time. I'll implement more runtime arguments if I have more free time. Pull requests are fully welcomed on my GitHub site.**
# Timers
All public APIs are under namespace TimersOneForAll, and require TimerCode as the first template argument. TimerCode indicates which hardware timer you want to use. Hardware timers vary by CPUs. For ATMega2560 (Arduino Mega), there're 6 timers:
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=TimersOneForAll
version=1.5.0
version=1.5.1
author=EbolaChan <[email protected]>
maintainer=EbolaChan <[email protected]>
sentence=Make full use of all your hardware timers on your Arduino board. 充分利用你开发板上所有的硬件计时器
paragraph=*You must enable C++17 for your IDE. Open "%AppData%\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt" and change the argument "-std=gnu++11" to -std=gnu++17.* Delayed task, repetitive delayed task, tones, square waves, timing by milliseconds. Hardware interrupt that can break into any running code accurately at the time you set. Specify which hardware timer to use, all with 1/16 microsecond accuracy. Allocate them to different tasks so that they run simultaneously without conflicts. Currently only support timing for less than 1 minute. *您必须为您的 IDE 启用 C++17。打开“%AppData%\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt”并将参数“-std=gnu++11”更改为-std=gnu++17。* 延迟任务,重复任务,音调,方波,毫秒秒表,可以自由指定互不冲突的独立硬件计时器,硬件中断,事件驱动。
paragraph=*You must enable C++17 for your IDE. Open "%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt" and change the argument "-std=gnu++11" to -std=gnu++17.* Delayed task, repetitive delayed task, tones, square waves, timing by milliseconds. Hardware interrupt that can break into any running code accurately at the time you set. Specify which hardware timer to use, all with 1/16 microsecond accuracy. Allocate them to different tasks so that they run simultaneously without conflicts. Currently only support timing for less than 1 minute. *您必须为您的 IDE 启用 C++17。打开“%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt”并将参数“-std=gnu++11”更改为-std=gnu++17。* 延迟任务,重复任务,音调,方波,毫秒秒表,可以自由指定互不冲突的独立硬件计时器,硬件中断,事件驱动。
category=Timing
url=https://github.com/Silver-Fang/TimersOneForAll
architectures=avr
Expand Down

0 comments on commit 18cb141

Please sign in to comment.