ivanseidel / ivanseidel/DueTimer

How can I create a class with its own timer

Open
#76 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
217
Forks
87
PR merge metrics
No merged PRs in 30d

Description

I need a one class , have a timer. in class method can start, stop timer.
```
#include

void RGBmatrixPanel::begin(void) {
Timer3.attachInterrupt(updateDisplay);
Timer3.start(250);
}
void RGBmatrixPanel::updateDisplay() {
if(something doing){
Timer3.stop();
}
}
```
But i get error on arduinodue
```
E:\kutuphane\belgelerim\Arduino\libraries\RGB-matrix-Panel-master\RGBmatrixPanel.cpp: In member function 'void RGBmatrixPanel::begin()':
E:\kutuphane\belgelerim\Arduino\libraries\RGB-matrix-Panel-master\RGBmatrixPanel.cpp:86:41: error: no matching function for call to 'DueTimer::attachInterrupt()'
Timer3.attachInterrupt(updateDisplay);
^
E:\kutuphane\belgelerim\Arduino\libraries\RGB-matrix-Panel-master\RGBmatrixPanel.cpp:86:41: note: candidate is:
In file included from E:\kutuphane\belgelerim\Arduino\libraries\RGB-matrix-Panel-master\RGBmatrixPanel.h:26:0,
from E:\kutuphane\belgelerim\Arduino\libraries\RGB-matrix-Panel-master\RGBmatrixPanel.cpp:3:
E:\kutuphane\belgelerim\Arduino\libraries\DueTimer-master/DueTimer.h:84:12: note: DueTimer& DueTimer::attachInterrupt(void (*)())
DueTimer& attachInterrupt(void (*isr)());

```
how to use in a class duetimer library?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading DueTimer.h, especially the attachInterrupt(void (*)()) declaration, and the RGBmatrixPanel.cpp begin() and updateDisplay() methods shown in the report. Reproduce the Arduino Due compile error and determine how the class callback is expected to satisfy the timer API; done means the example compiles and the timer can be started and stopped from the class.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.