I am new to NRF52832. I want to monitor continuously PIN 3 where I have connected USB to check whether my USB is connected or not. How can I do that. Please reply ASAP.
I am new to NRF52832. I want to monitor continuously PIN 3 where I have connected USB to check whether my USB is connected or not. How can I do that. Please reply ASAP.
Hi..Amit
first define PIN 3 and After that ,create timer instance for repeated mode and start it.
then initalize , configure nrf_drv_gpiote_init driver based on ur configuration and enable input event on it.
for more information u can look at example pin_change_int in SDK example folder.
Regards.
Hi Luis,
void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { LEDS_CONFIGURE(1<<19);
if (nrf_gpio_pin_read(3) == ON) { usb_detect_on_off = ON; LED_ON(1<<19); } else if (nrf_gpio_pin_read(3) == OFF) { usb_detect_on_off = OFF; LED_OFF(1<<19); } }
Hope this will help you.
Regards, Amit
Hi Luis,
void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { LEDS_CONFIGURE(1<<19);
if (nrf_gpio_pin_read(3) == ON) { usb_detect_on_off = ON; LED_ON(1<<19); } else if (nrf_gpio_pin_read(3) == OFF) { usb_detect_on_off = OFF; LED_OFF(1<<19); } }
Hope this will help you.
Regards, Amit