GPIO Interrupts

JH-7110 supports the following 5 interrupt trigger modes.
  • High trigger
  • Low trigger
  • Positive edge trigger
  • Negative edge trigger
  • Both edge trigger
Follow the steps below to configure GPIO interrupts.
  1. Configure the is/ibe/iev register according to the following table.
  2. Clean the irq status by writing ic register.
  3. Write ie register to enable the interrupt.
Table 1. GPIO Interrupts
Trigger Mode reg->is reg->ibe reg->iev
high trigger 0 0/1 0
low trigger 0 0/1 1
positive edge trigger 1 0 1
negative edge trigger 1 0 0
both edge trigger 1 1 0/1
The following code block provides an example of configuring the positive edge trigger.
port = 11;
is = 1; ibe = 0; iev = 1; //positive edge trigger
n = port>>5, 
bit = port & 0x1f;
modl(regs->is+n, BIT(bit), is<<bit);
modl(regs->ibe+n, BIT(bit), ibe<<bit);
modl(regs->iev+n, BIT(bit), iev<<bit);
modl(regs->ic+n, BIT(bit), 0);
modl(regs->ic+n, BIT(bit), BIT(bit));
modl(regs->ie+n, BIT(bit), BIT(bit));