| 97 | } |
| 98 | |
| 99 | void SoftSigReaderInt::_irq_handler(EICUDriver *eicup, eicuchannel_t aux_channel) |
| 100 | { |
| 101 | eicuchannel_t channel = get_pair_channel(aux_channel); |
| 102 | pulse_t pulse; |
| 103 | pulse.w0 = eicup->tim->CCR[channel]; |
| 104 | pulse.w1 = eicup->tim->CCR[aux_channel]; |
| 105 | |
| 106 | _singleton->sigbuf.push(pulse); |
| 107 | |
| 108 | //check for missed interrupt |
| 109 | uint32_t mask = (STM32_TIM_SR_CC1OF << channel) | (STM32_TIM_SR_CC1OF << aux_channel); |
| 110 | if ((eicup->tim->SR & mask) != 0) { |
| 111 | //we have missed some pulses |
| 112 | //try to reset RCProtocol parser by returning invalid value (i.e. 0 width pulse) |
| 113 | pulse.w0 = 0; |
| 114 | pulse.w1 = 0; |
| 115 | _singleton->sigbuf.push(pulse); |
| 116 | //reset overcapture mask |
| 117 | eicup->tim->SR &= ~mask; |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | bool SoftSigReaderInt::read(uint32_t &widths0, uint32_t &widths1) |
| 122 | { |