Forcing state of GPIO or triggering manually GPIOTE task

Hi,

On my system (nRF52832, NCS 2.2.0), I have a pin that I have connected to a GPIOTE task that is usually triggered from a timer through PPI (see code below).

At one point in my code, I need to manually set the output state of this GPIO without using the timer.

Is there a way to manually trigger the GPIOTE task ? or should I disable the GPIOTE task and set the output pin state manually ?

    /* Configure TX pin as gpiote output event using nrfx driver */
	uint8_t gpiote_out_channel;
	ret = nrfx_gpiote_channel_alloc(&gpiote_out_channel);
	if (ret != NRFX_SUCCESS)
	{
		LOG_ERR("Failed to allocate out_channel, error: 0x%08X", ret);
		return -EIO;
	}

	static const nrfx_gpiote_output_config_t output_config = {
		.drive = NRF_GPIO_PIN_S0S1,
		.input_connect = NRF_GPIO_PIN_INPUT_DISCONNECT,
		.pull = NRF_GPIO_PIN_NOPULL,
	};
	const nrfx_gpiote_task_config_t task_config = {
		.task_ch = gpiote_out_channel,
		.polarity = NRF_GPIOTE_POLARITY_TOGGLE,
		.init_val = 0,	// TODO Define initial state of TX pin
	};
	ret = nrfx_gpiote_output_configure(ctx->hal->txPin.pin, &output_config, &task_config);
	if (ret != NRFX_SUCCESS)
	{
		LOG_ERR("nrfx_gpiote_output_configure error: 0x%08X", ret);
		return -1;
	}

Regards

Parents Reply Children
No Data
Related