This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Hot to detect the GPIO status with Timer

I would like to make a timer to check the GPIO status.

The current code is like below:

I already checked that timer function is worked by implant the specific event into the charge_event_handler as below:

charge_event_handler(TYPE_C,GPIOTE_CONFIG_POLARITY_LoToHi );

But not sure how to make it switch from different event.

Or there is any smart way to make it?

Parents
  • Hi,

    But not sure how to make it switch from different event.

    Not sure what you want to achieve or different event as in?

    Are you disabling gpiote from some other function? It is being reinitialized every time a timeout occurs.

    I have a simple code that reads pin status after a timeout occurs.

    You can use gpiote with ppi in case you want it for your application. Do let me know if it works or what do you want to implement.

    Regards

  • Hi Ali,

    I just tried your suggestion, and it work properly.

    I am curious about what is the different between using GPIO and GPIOTE? Will it make power consumption different?

    Honestly, I do not familiar with PPI why it could be used with GPIOTE or why it need? Does it have any benefit?

    Thanks.

Reply
  • Hi Ali,

    I just tried your suggestion, and it work properly.

    I am curious about what is the different between using GPIO and GPIOTE? Will it make power consumption different?

    Honestly, I do not familiar with PPI why it could be used with GPIOTE or why it need? Does it have any benefit?

    Thanks.

Children
  • Hi,

    Good to know it works!

    If you have a button or wakeup interrupt from button/IC or similar case you can use GPIOTE which is a peripheral that generates events on pin state change or as configured.

    You can look at posts and infocenter here to know more

    Link Link Link

    Peripherals can interact with tasks and events independent of CPU with Programmable peripheral interconnect (PPI). You can learn more about it here and in this post.

    Do let us know if it helps or need some understanding.

    Regards

    (Note: I have sighted nRF52832 as an example. You can refer Product specification of your case.)