diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-06-01 13:11:40 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-06-01 15:08:52 -0700 |
| commit | 717199018bcb43dd50af9011e2259f3caf3290f8 (patch) | |
| tree | 366dd7e8759bf43472807b2c0822280967eead56 /ports/atmel-samd/peripherals | |
| parent | f386144428b8ad4fab29e0df6657856141e7f96b (diff) | |
Adapt for feedback and hack around pIRkey size constraint.
Diffstat (limited to 'ports/atmel-samd/peripherals')
| -rw-r--r-- | ports/atmel-samd/peripherals/samd21/events.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ports/atmel-samd/peripherals/samd21/events.c b/ports/atmel-samd/peripherals/samd21/events.c index 70dfa249d..08b82c91f 100644 --- a/ports/atmel-samd/peripherals/samd21/events.c +++ b/ports/atmel-samd/peripherals/samd21/events.c @@ -74,8 +74,8 @@ void init_event_channel_interrupt(uint8_t channel, uint8_t gclk, uint8_t generat EVSYS_CHANNEL_EVGEN(generator) | EVSYS_CHANNEL_PATH_RESYNCHRONIZED | EVSYS_CHANNEL_EDGSEL_RISING_EDGE; - if (channel > 7) { - uint8_t value = 1 << (channel - 7); + if (channel >= 8) { + uint8_t value = 1 << (channel - 8); EVSYS->INTFLAG.reg = EVSYS_INTFLAG_EVDp8(value) | EVSYS_INTFLAG_OVRp8(value); EVSYS->INTENSET.reg = EVSYS_INTENSET_EVDp8(value) | EVSYS_INTENSET_OVRp8(value); } else { @@ -87,8 +87,8 @@ void init_event_channel_interrupt(uint8_t channel, uint8_t gclk, uint8_t generat bool event_interrupt_active(uint8_t channel) { bool active = false; - if (channel > 7) { - uint8_t value = 1 << (channel - 7); + if (channel >= 8) { + uint8_t value = 1 << (channel - 8); active = (EVSYS->INTFLAG.reg & EVSYS_INTFLAG_EVDp8(value)) != 0; // Only clear if we know its active, otherwise there is the possibility it becomes active // after we check but before we clear. @@ -107,8 +107,8 @@ bool event_interrupt_active(uint8_t channel) { bool event_interrupt_overflow(uint8_t channel) { bool overflow = false; - if (channel > 7) { - uint8_t value = 1 << (channel - 7); + if (channel >= 8) { + uint8_t value = 1 << (channel - 8); overflow = (EVSYS->INTFLAG.reg & EVSYS_INTFLAG_OVRp8(value)) != 0; } else { uint8_t value = 1 << channel; |
