[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 

This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Use libary for software-events RSS feed
Forum Index » IoAbstraction & TaskManagerIO
Author Message

Joined: Jun 5, 2020
Messages: 1

I started to work with arduinos for my electronic projects. Currently I try to build a word-clock. To avoid unclean programming I found the library IoAbstraction. I like to work with events (my job is to work with C#) so I tried to find a solution for that. For timing issues or hardware switches it is perfect. I still use it for that.

But now my question:
It is possible to use this library for triggering an event by software.

For example I have a class called DCF. This class is responsible to receive the time by DCF77. If a new time is available it should fire an event. So it is not really a hardware event. It should be triggered by software.

class DCF {

in my main program I would like to register the class "DCF". If the ExecuteNewTimeReceived() function will be run in class DCF an event should be fired and the main program can do something.

Currently for this issue I use a timing event and ask the DCF if a new time is available. It works for sure but maybe there is a better way to do that.

taskManager.scheduleFixedRate(100, checkNewDataDCF);

void checkNewDataDCF() {
	// check if new data of DCF is available

My next step would be to extend the library by myself to have this feature. I think it is similar to the SwitchInput Class...only that I is not triggered by hardware.

Thanks in advance for your help! And thanks for the great library!!

Joined: Jan 19, 2019
Messages: 686
Hi there, at the moment taskManager cannot handle events that are not either interrupt-driven or timed. I have a plan to add timed events that can be replaced so there's only even one of a given ID on the queue, but I've not really considered a more generic eventing framework. I'm not 100% sure how that would work to be honest. I'm open to discussion on it though.

Joined: Jan 19, 2019
Messages: 686
Sometimes, a bit of time is needed to work out how something can be done...

I had an idea, there is a method of creating tasks that are of type Executable, these tasks get the virtual exec() method called when the time is hit. There's a couple of possibilities here:

1. create an Event class extending abstract type Executable that carries the event payload and the exec method would "process" the event.

2. make taskmanager able to either "find" or "replace" an existing entry if a new executable with the same key arrives.

As of 1.5.0 where the task queue grows in size as needed, this is now a possibility because it can handle a much larger pool of events than before. If you take a look at the IoAbstraction documentation you'll see the Executable type documented there, let me know if you also think something could be done around this.

Forum Index » IoAbstraction & TaskManagerIO
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.