Hi everyone:
I use nrf_drv_ppi_channel_alloc(&m_ppi_channel1) to allocate ppi channel. Every time i call nrf_drv_ppi_channel_alloc(&m_ppi_channel1), the m_ppi_channel1 will increase. when m_ppi_channel1 > 16 will return error. How to release ppi channel? Is it correct to Using sd_ppi_channel_enable_clr() to release ppi channel? or any suggestions?
void ppi_init(void)
{
uint32_t err_code = NRF_SUCCESS;
err_code = nrf_drv_ppi_channel_alloc(&m_ppi_channel1);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("PPI Channel: %d", m_ppi_channel1);
err_code = sd_ppi_channel_assign(m_ppi_channel1,
(const volatile void *)nrf_drv_gpiote_in_event_addr_get(TAGSENSOR_PIN),
(const volatile void *)nrf_drv_timer_task_address_get(&timer1, NRF_TIMER_TASK_CAPTURE0));
APP_ERROR_CHECK(err_code);
err_code = sd_ppi_channel_enable_set(1 << m_ppi_channel1);
APP_ERROR_CHECK(err_code);
}
void tag_sensor_test(void)
{
uint32_t err_code;
ppi_init();
do_something...
err_code = sd_ppi_channel_enable_clr(1 << m_ppi_channel1);
APP_ERROR_CHECK(err_code);
}