About the use of gpiote and dppi of nrf5340

I want to use nRF5340's GPIOTE and DPPI implementation, pull up PA_SWITCH_CTX_PIN when NRF_RADIO->EVENTS_RXREADY is triggered, and pull down PA_SWITCH_CTX_PIN when NRF_RADIO->EVENTS_TXREADY is triggered;

I wrote the following code with reference to demo \v2.0.0\zephyr\samples\boards\nrf\nrfx. When I found out that using this method can only achieve one event for one task. Please how should I modify it.

	static uint8_t tx_ppi_chaannel;
	
	nrfx_gpiote_init(99);

	nrfx_gpiote_out_config_t const out_config = {
		.action = NRF_GPIOTE_POLARITY_HITOLO,
		.init_state = 1,
		.task_pin = true,
	};

	nrfx_gpiote_out_init(PA_SWITCH_CTX_PIN, &out_config);
	nrfx_gpiote_out_task_enable(PA_SWITCH_CTX_PIN);

	nrfx_dppi_channel_alloc(&tx_ppi_chaannel);

	nrfx_gppi_channel_endpoints_setup(tx_ppi_chaannel, 
		(uint32_t)&NRF_RADIO->EVENTS_RXREADY,
		nrf_gpiote_task_address_get(NRF_GPIOTE,
			nrfx_gpiote_out_task_get(PA_SWITCH_CTX_PIN)));

	nrfx_dppi_channel_enable(tx_ppi_chaannel);

Parents Reply Children
No Data
Related