Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3febb13

Browse files
Merge pull request #1503 from arduino/benjamindannegard/timer-info-update
[UNO R4] Timers section for cheat sheet
2 parents c7fc346 + 783309f commit 3febb13

File tree

1 file changed

+19
-0
lines changed
  • content/hardware/02.hero/boards/uno-r4-wifi/tutorials/cheat-sheet

1 file changed

+19
-0
lines changed

‎content/hardware/02.hero/boards/uno-r4-wifi/tutorials/cheat-sheet/cheat-sheet.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,25 @@ if(Serial.available() > 0) {
505505
}
506506
```
507507

508+
### Timers
509+
510+
In the Ardunio API there is a [`FspTimer`](https://github.com/arduino/ArduinoCore-renesas/blob/149f78b6490ccbafeb420f68919c381a5bdb6e21/cores/arduino/FspTimer.h#L87) class which provides all the necessary functionality for using timers in a sketch.
511+
512+
The UNO R4 WiFi has two timer peripherals, a Asynchronous General Purpose Timer (AGT) and a General PWM Timer (GPT). There are two AGT timers on the board, one of them is used for time measuring methods such as `millis()` and `microseconds()`.
513+
514+
The board has 7 GPT timers to help perform PWM tasks, such as calculating duty cycles by measuring how long a signal is active. It is possible to use these reserved PWM timers by using the previously mentioned [`FspTimer`](https://github.com/arduino/ArduinoCore-renesas/blob/main/cores/arduino/FspTimer.h#L87) library. Using this function will explicitly request a PWM timer:
515+
516+
```arduino
517+
FspTimer::force_use_of_pwm_reserved_timer();
518+
```
519+
520+
When using the timer functions of the library you will need to enter the timers type. Which is either AGT or GPT. This can be declared in the sketch like this:
521+
522+
```arduino
523+
uint8_t gpt_timer_type = GPT_TIMER;
524+
uint8_t agt_timer_type = AGT_TIMER;
525+
```
526+
508527
### SerialUSB
509528

510529
The UNO R4 WiFi has an extended set of Serial methods that can be enabled whenever you include the `<HID.h>` library in your sketch.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /