Ejemplo n.º 1
0
QJsonObject Blink1Input::toJson()
{
    QJsonObject obj;
    obj.insert("name", name());
    obj.insert("type",type());
    obj.insert("arg1",arg1());
    obj.insert("arg2",arg2());
    obj.insert("date",date());
    obj.insert("patternName",patternName());
    obj.insert("freq",freq());
    obj.insert("freqCounter",freqCounter());
    return obj;
}
Ejemplo n.º 2
0
        if ((len - i - 1) % 3 == 0 && i < len-1) *c++ = ',';
    }
    
    if (_gatePeriod > 1) {
        itoa(freq % _gatePeriod, f, 10);
        *c++ = '.';
        if (strlen(f) < 2 && _gatePeriod > 10) *c++ = '0';
        pf = f;
        while (*c++ = *pf++);
    }
    else {
        *c++ = 0;
    }    
}

freqCounter gpsFreq = freqCounter();    //instantiate the frequency counter object for the user

ISR(INT0_vect)
{
    if (gpsFreq._gateInterrupts == 0) {                //start counting with the first interrupt
        TCCR1B = 0;
        TCCR1A = 0;                                    //stop timer 1
        TCCR1C = 0;
        TIMSK1 = 0;
        TCNT1 = 0;                                     //zero timer 1
        TIFR1 = _BV(TOV1);                             //clear timer 1 overflow flag
        gpsFreq._t1ovf = 0;
        TIMSK1 = _BV(TOIE1);                           //interrupt on timer 1 overflow
        TCCR1B = _BV(CS12) | _BV(CS11);                //start timer 1, external clock on falling edge
    }
    else if (gpsFreq._gateInterrupts >= gpsFreq._gatePeriod) {   //time to stop counting?