for (int i = 0; i < count; i++) {
irq[i].irq = base + i;
+ irq[i].flags = IRQ_FLAG_INIT;
if (pool)
_avr_irq_pool_add(pool, &irq[i]);
if (names && names[i])
if (!irq)
return ;
uint32_t output = (irq->flags & IRQ_FLAG_NOT) ? !value : value;
- if (irq->value == output && (irq->flags & IRQ_FLAG_FILTERED))
+ // if value is the same but it's the first time, raise it anyway
+ if (irq->value == output &&
+ (irq->flags & IRQ_FLAG_FILTERED) && !(irq->flags & IRQ_FLAG_INIT))
return;
+ irq->flags &= ~IRQ_FLAG_INIT;
avr_irq_hook_t *hook = irq->hook;
while (hook) {
avr_irq_hook_t * next = hook->next;
IRQ_FLAG_NOT = (1 << 0), //!< change polarity of the IRQ
IRQ_FLAG_FILTERED = (1 << 1), //!< do not "notify" if "value" is the same as previous raise
IRQ_FLAG_ALLOC = (1 << 2), //!< this irq structure was malloced via avr_alloc_irq
+ IRQ_FLAG_INIT = (1 << 3), //!< this irq hasn't been used yet
};
/*