1

how can i call this function in C ???

decodeEvent(signal ? EVENT_SHORTPULSE : EVENT_SHORTSPACE);

i think that is call with conditions ??

i find it in this code :

void RC5::decodePulse(unsigned char signal, unsigned long period)
{
    if (period >= MIN_SHORT && period <= MAX_SHORT) {
        this->decodeEvent(signal ? EVENT_SHORTPULSE : EVENT_SHORTSPACE);
    } else if (period >= MIN_LONG && period <= MAX_LONG) {
        this->decodeEvent(signal ? EVENT_LONGPULSE : EVENT_LONGSPACE);
    } else {
        // time period out of range, reset
        this->reset();
    }
}

void RC5::decodeEvent(unsigned char event)
{
    // find next state, 2 bits
    unsigned char newState = (trans[this->state]>>event) & 0x3;
    if (newState==this->state) {
        // no state change indicates error, reset
        this->reset();
    } else {
        this->state = newState;
        if (newState == STATE_MID0) {
            // always emit 0 when entering mid0 state
            this->command = (this->command<<1)+0;
            this->bits++;
        } else if (newState == STATE_MID1) {
            // always emit 1 when entering mid1 state
            this->command = (this->command<<1)+1;
            this->bits++;
        }
    }
}
StoryTeller - Unslander Monica
  • 165,132
  • 21
  • 377
  • 458
khaloud1980
  • 43
  • 1
  • 7

0 Answers0