mjs513
Senior Member+
@defragster. First, I apologize for being long winded but Conceptually I thought I understood what was going on with the eventresponder, at least for the repeating timer piece. However, with all the talk about chaining I started to dig into the inner workings to figure chaining out.
What I found was Tail-chaining as it refered to interrupts and the chaining of PIT timers, but I couldn't see where that was applicable to repeating timers.
So I then looked at what was going on with the code and that led me to Systick_isr which is runs the runFromTimer() function which is using the linked list (which I knew nothing about, oh well). From what I think I am seeing that systick_isr is running every millisecond so each timer created is decremeted until it hits zero and then the original value gets reloaded into the list and the process starts all over.
This is done via timer -> _ms decremented timer and timer -> reload which reloads the original timer value. The event gets triggered by the call to event.triggerEvent(0, timer). The process is shown below (i put a couple of prints where i thought things where happening):
Now what i don't understand is how the linkedlist actually gets created. It is, i think i know how, but its not what is shown when i do search for c++ linkedlist. Still have to figure out how the interrupt piece works because I did see anything where a IRQ number is assigned. I did see where pendSV is set - have to figure that one out next. Do you have an example of eventresponder using interrupt events?
Thanks for all your help.
Mike
What I found was Tail-chaining as it refered to interrupts and the chaining of PIT timers, but I couldn't see where that was applicable to repeating timers.
So I then looked at what was going on with the code and that led me to Systick_isr which is runs the runFromTimer() function which is using the linked list (which I knew nothing about, oh well). From what I think I am seeing that systick_isr is running every millisecond so each timer created is decremeted until it hits zero and then the original value gets reloaded into the list and the process starts all over.
This is done via timer -> _ms decremented timer and timer -> reload which reloads the original timer value. The event gets triggered by the call to event.triggerEvent(0, timer). The process is shown below (i put a couple of prints where i thought things where happening):
Code:
=========
#define EVENT2_TIME 850
#define EVENT3_TIME 1050
#define EVENT4_TIME 250
#define EVENT0_TIME 750 (loop trigger at 750)
========
EventResponder test
ms timer: 248
ms timer: 247
ms timer: 246
ms timer: 245
.......
.......
.......
ms timer: 4
ms timer: 3
ms timer: 2
ms timer: 1
ms timer: 0
Reload: 250
ms timer: 250
2213 - T4(0) 250 (T4)
ms timer: 249
ms timer: 248
ms timer: 247
.....
.....
.....
ms timer: 3
ms timer: 2
ms timer: 1
ms timer: 0
Reload: 250 500 (T4)
ms timer: 250
2463 - T4(0)
ms timer: 249
ms timer: 248
ms timer: 247
ms timer: 246
....
....
....
ms timer: 5
ms timer: 4
ms timer: 3
ms timer: 2
ms timer: 1
ms timer: 0
Reload: 250
ms timer: 100 next timer is at 850-750=100
for T2
2713 - T4(0) 750 (T4) next trigger at 1000
ms timer: 99
ms timer: 98
ms timer: 97
.....
.....
.....
ms timer: 5
ms timer: 4
ms timer: 3
ms timer: 2
ms timer: 1
ms timer: 0
Reload: 850 850 actually funny because its loading
850 for T2 timer plus 850 passed
ms timer: 150 150 left to go to T4 which is at 1000
2813 - T2(0)
ms timer: 149
ms timer: 148
ms timer: 147
......
........
......
ms timer: 4
ms timer: 3
ms timer: 2
ms timer: 1
ms timer: 0
Reload: 250
ms timer: 50 50 left to T3
2963 - T4(0) bingo hit the T4 timer which is
at 1000. T3 should happen again
at
loop trigger dosomething
dosomething event
ms timer: 49
ms timer: 48
ms timer: 47
......
......
......
ms timer: 3
ms timer: 2
ms timer: 1
ms timer: 0
Reload: 1050
ms timer: 200
3013 - T3(0) Ok got through the cycle
Thanks for all your help.
Mike