Add some comments in pcnt.h.

This commit is contained in:
kooho
2018-05-25 15:37:20 +08:00
parent baa4613fc1
commit 01516abe5a
3 changed files with 18 additions and 3 deletions

View File

@@ -54,6 +54,7 @@
#define LEDC_OUTPUT_IO 18 // Output GPIO of a sample 1 Hz pulse generator
xQueueHandle pcnt_evt_queue; // A queue to handle pulse counter events
pcnt_isr_handle_t user_isr_handle = NULL; //user's ISR service handle
/* A sample structure to pass events from the PCNT
* interrupt handler to the main program.
@@ -159,7 +160,7 @@ static void pcnt_example_init(void)
pcnt_counter_clear(PCNT_TEST_UNIT);
/* Register ISR handler and enable interrupts for PCNT unit */
pcnt_isr_register(pcnt_example_intr_handler, NULL, 0, NULL);
pcnt_isr_register(pcnt_example_intr_handler, NULL, 0, &user_isr_handle);
pcnt_intr_enable(PCNT_TEST_UNIT);
/* Everything is set up, now go to counting */
@@ -206,4 +207,9 @@ void app_main()
printf("Current counter value :%d\n", count);
}
}
if(user_isr_handle) {
//Free the ISR service handle.
esp_intr_free(user_isr_handle);
user_isr_handle = NULL;
}
}