2 Replies Latest reply on Nov 23, 2020 8:17 PM by YoIs_1298666

    void ISR_ClearPending(void)  for GPIO with PSoC4000S

    YoIs_1298666

      Hello,

       

      The following is written in void ISR_ClearPending (void) explanation.

      What does the NOTE description say other than "void ISR_ClearPending(void)" to clear interrupt pending in GPIOs?

       

      Best regards,

      Yocchi

        • 1. Re: void ISR_ClearPending(void)  for GPIO with PSoC4000S
          GaneshD_41

          Hi Yoshi-san,

           

          The description says to clear the interrupt bit of the corresponding IP block. Generally the interrupt bits of the IP blocks like GPIO, Timer are sticky. So the user has to call Pin_ClearInterrupt() API to clear the pin interrupt,  Timer_ClearInterrupt() in case of timer.

           

          If you refer the Interrupts code example in PSoC Creator the ISR definition will be as follows:

           

          CY_ISR(GPIOIsrHandler)
          {
              /* Clear pending Interrupt */
              isr_GPIO_ClearPending();
              
              /* Clear pin Interrupt */
              Pin_Sw_ClearInterrupt();
              
              /* Turn On the LED */
              LED_Isr_Write(LIGHT_ON);
          
          
              /* Cause nested software interrupt after 1000 ms */
              CyDelay(1000u);
              CyIntSetPending(NESTED_ISR);
          
          
              /* Turn Off the LED */
              LED_Isr_Write(LIGHT_OFF);
          }
          

           

          Here please note that both isr_GPIO_ClearPending(); and Pin_Sw_ClearInterrupt(); should be called.

           

          Hope this answers your question.

          Thanks

          Ganesh

          • 2. Re: void ISR_ClearPending(void)  for GPIO with PSoC4000S
            YoIs_1298666

            Hello Ganesh-san,

             

            Thank you very much for your help.

             

            In case of GPIO interrupt, unnecessary interrupts will occur unless the order is as follows.

             

              /* Clear pin Interrupt */ 

              Pin_Sw_ClearInterrupt();

             

              /* Clear pending Interrupt */ 

              isr_GPIO_ClearPending(); 

             

            What do you think?

             

            Best regards,

            Yocchi