mirror of https://github.com/ARMmbed/mbed-os.git
parent
ddbb67a996
commit
3172fd97ca
|
@ -37,17 +37,20 @@ static inline void handle_interrupt_in(uint32_t channel) {
|
||||||
uint8_t pin_num = (pin_names[channel] & (0x0f << PIN_SHIFT)) >> PIN_SHIFT;
|
uint8_t pin_num = (pin_names[channel] & (0x0f << PIN_SHIFT)) >> PIN_SHIFT;
|
||||||
uint8_t trigger_event = trigger_events[channel];
|
uint8_t trigger_event = trigger_events[channel];
|
||||||
|
|
||||||
if (trigger_event == 1) {
|
if (trigger_event == 1)
|
||||||
// Rising edge.
|
|
||||||
irq_handler(channel_ids[channel], IRQ_RISE);
|
irq_handler(channel_ids[channel], IRQ_RISE);
|
||||||
}
|
else if (trigger_event == 2)
|
||||||
else if (trigger_event == 2) {
|
|
||||||
// Low, therefore falling edge...
|
|
||||||
irq_handler(channel_ids[channel], IRQ_FALL);
|
irq_handler(channel_ids[channel], IRQ_FALL);
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// This is supposed to be triggered by both cases...
|
// In order to get an idea of which kind of event it is,
|
||||||
irq_handler(channel_ids[channel], IRQ_RISE);
|
// We need to read the logic level of the pin...
|
||||||
|
|
||||||
|
uint8_t logic = (port_reg->DATA & (1 << pin_num)) >> pin_num;
|
||||||
|
|
||||||
|
if (logic == 1)
|
||||||
|
irq_handler(channel_ids[channel], IRQ_RISE);
|
||||||
|
else
|
||||||
|
irq_handler(channel_ids[channel], IRQ_FALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the interrupt...
|
// Clear the interrupt...
|
||||||
|
|
Loading…
Reference in New Issue