Quantum Leaps - 2018-11-01

Regarding the proposed changes in the handler ISR(TIMER2_COMPA_vect), it seems to be a misunderstanding of what the different clock ticks are for.

So, the different clock tick rates are intended for different frequency (rate) of ticking. For example rate-0 might be for fast-speed ticking (say, 100Hz), while rate-1 for slow ticking (say, 1Hz).

For this reason, it really doesn't make sense to call the handles for the various tick rates at the same tick rate. Perhaps you could use a software pre-scaler, like in the following pseudo-code:

ISR(TIMER2_COMPA_vect) {
    static uint8_t prescaler1 = 1U;
    static uint8_t prescaler2 = 1U;

    QF_tickXISR(0); // tick rate 0
    if (--prescaler1 == 0U) {
         prescaler1 = 10U;
         QF_tickXISR(1); // tick rate 1
     }
    if (--prescaler2 == 0U) {
         prescaler2 = 100U;
         QF_tickXISR(2); // tick rate 2
     }
}

Regarding the suggested new macros (SELF, SEND_EVT_TO, etc.), its good that you notice the repeating patterns. But at this point it's not clear that they would simplify coding enough to justify adding another layer of indirection to the QP-nano API. I mean, such things only bloat the API, increase amount of documentation, etc.

--MMS