MediaTek-Labs / mt3620_m4_software

mt3620_m4_driver
Other
32 stars 29 forks source link

[Question] GPIOIF example #41

Open m4tto opened 3 years ago

m4tto commented 3 years ago

Do you have a running example with GPIOIF in capture counter mode? I cannot make it working and no interrupt is generated.

These are the initialization instructions:

mtk_os_hal_gpioif_ctlr_init(group);

// Register callback function
mtk_os_hal_gpioif_int_callback_register(group, CAP_callback, NULL);

// Disable de-glitch 
mtk_os_hal_gpioif_de_glitch(group, 0, 0, 0, 0); 
mtk_os_hal_gpioif_de_glitch(group, 1, 0, 0, 0); 

// Configure capture
mtk_os_hal_gpioif_set_capture_mode(group, 
                                   MHAL_GPIOIF_GPIO_0_BOTH_RISING_FALLING, 
                                   MHAL_GPIOIF_GPIO_1_BOTH_RISING_FALLING, 
                                   MHAL_GPIOIF_CLOCK_32KHZ);                // Possible values 32KHz, 26MHz, 125MHz, 200MHz 

mtk_os_hal_gpioif_interrupt_control(group, 1, 1, IRQ_GPIOIF_CFIFO0_NOT_EMPTY|IRQ_GPIOIF_CFIFO1_NOT_EMPTY); 

Do I have to set something in the app_manifest?

LawranceLiu commented 3 years ago

Please refer to the sample code: https://github.com/MediaTek-Labs/mt3620_m4_software/commit/98d4c919a52711336ad0099cf69d2dde6898b0c8