You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
-
I do not see how the RTOS is a problem in the situation described. It's actually sort of typical (and, frankly, very annoying/disappointing) that 2 or more libraries contend the use of the same timer. I'd rather patch them, drop the meddling with the timer and let the RTOS call them when appropriate. If anything, this shows a shortcoming of the Arduino libraries, where there is no standardized way to do timed stuff and the author of each library is let alone to figure out what HW timer to use.Igor Stoppa– Igor Stoppa2015-08-05 00:30:42 +00:00Commented Aug 5, 2015 at 0:30
-
It's not a problem that has an easy solution. Things like pin-change interrupts, for example, used by SoftwareSerial. Once you add one of the interrupt handlers you are committed to handling 8 pins. And how do you handle when one library wants timer 2 for timing an event, and another one wants it to do PWM?Nick Gammon– Nick Gammon ♦2015-08-05 01:11:37 +00:00Commented Aug 5, 2015 at 1:11
-
As I said: let the RTOS replace the direct use of the timer. If a library just needs a periodic signal, most likely the RTOS can replace the timer handler with a thread. Same goes for PWM. Of course it depends on the time resolution and precision required. But I think in most cases it would be sufficiently accurate. Software Serial is something beyond redemption, as it busy loops in interrupt context. It's ok for a simple project, but in a serious application, I would definitely not use it, as the delay is not even fixed, but depends on the baud rate.Igor Stoppa– Igor Stoppa2015-08-05 01:19:34 +00:00Commented Aug 5, 2015 at 1:19
-
For the pin change interrupt, I think that's another short coming of the standard Arduino library. IMHO there should be a default, standard, way of running timed tasks and to get the OS to handle inputs/outputs, like providing the first/last time an input line changed or generate a pwm by sw on an arbitrary pin. I moved away from the Arduino standard libraries after noticing that thy make it harder to do apparently simple tasks.Igor Stoppa– Igor Stoppa2015-08-05 01:26:49 +00:00Commented Aug 5, 2015 at 1:26
-
That horse has probably well and truly left the stable by now. A lot of libraries assume you are only going to use their library (or at least not another one with conflicting requirements). To have imposed a RTOS during the early days of design would probably have been too hard, and now it is too late. The other issue is memory. To have multiple threads you need multiple stacks, and probably multiple heaps. It's going to get rather hard to manage all this when you only have 2 KB of RAM to start with.Nick Gammon– Nick Gammon ♦2015-08-05 01:45:00 +00:00Commented Aug 5, 2015 at 1:45
|
Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. arduino-uno), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-cpp