uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep) { uint32_t err_code; if (((uint32_t *)eep == NULL) || ((uint32_t *)tep == NULL)) { err_code = NRF_ERROR_NULL; } else if (!is_programmable_app_channel(channel)) { err_code = NRF_ERROR_INVALID_PARAM; } else if (!is_allocated_channel(channel)) { err_code = NRF_ERROR_INVALID_STATE; } else { #if (NRF_PPI_RESTRICTED > 0) err_code = sd_ppi_channel_assign((uint8_t) channel, (const volatile void *) eep, (const volatile void *) tep); if (err_code != NRF_SUCCESS) { err_code = NRF_ERROR_INVALID_PARAM; } #else nrf_ppi_channel_endpoint_setup(channel, eep, tep); err_code = NRF_SUCCESS; #endif } return err_code; }
uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep) { if (((uint32_t *)eep == NULL) || ((uint32_t *)tep == NULL)) { return NRF_ERROR_NULL; } if (!is_programmable_app_channel(channel)) { return NRF_ERROR_INVALID_PARAM; } if (!is_allocated_channel(channel)) { return NRF_ERROR_INVALID_STATE; } nrf_ppi_channel_endpoint_setup(channel, eep, tep); return NRF_SUCCESS; }
/** * @brief Initialize PPI to toggle GPIO pins on Softdevice events. Initialize GPIO to set it * according to Softdevice arbiter client events. */ static void raal_softdevice_event_gpio_toggle_init(void) { #if RAAL_SOFTDEVICE nrf_gpio_cfg_output(PIN_DBG_TIMESLOT_ACTIVE); nrf_gpio_cfg_output(PIN_DBG_TIMESLOT_EXTEND_REQ); nrf_gpio_cfg_output(PIN_DBG_TIMESLOT_SESSION_IDLE); nrf_gpio_cfg_output(PIN_DBG_TIMESLOT_RADIO_IRQ); nrf_gpio_cfg_output(PIN_DBG_TIMESLOT_FAILED); nrf_gpio_cfg_output(PIN_DBG_TIMESLOT_BLOCKED); nrf_gpio_cfg_output(PIN_DBG_RTC0_EVT_REM); nrf_gpiote_task_configure(5, PIN_DBG_RTC0_EVT_REM, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_enable(5); nrf_ppi_channel_endpoint_setup(NRF_PPI_CHANNEL5, (uint32_t) &NRF_RTC0->EVENTS_COMPARE[1], nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_5)); nrf_ppi_channel_enable(NRF_PPI_CHANNEL5); #endif // RAAL_SOFTDEVICE }
uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep) { VERIFY_PARAM_NOT_NULL((uint32_t *)eep); VERIFY_PARAM_NOT_NULL((uint32_t *)tep); ret_code_t err_code = NRF_SUCCESS; if (!is_programmable_app_channel(channel)) { err_code = NRF_ERROR_INVALID_PARAM; } else if (!is_allocated_channel(channel)) { err_code = NRF_ERROR_INVALID_STATE; } else { nrf_ppi_channel_endpoint_setup(channel, eep, tep); NRF_LOG_INFO("Assigned channel: %d, event end point: %x, task end point: %x.\r\n", channel, eep, tep); } NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); return err_code; }
/** * @brief Initialize PPI to toggle GPIO pins on radio events. */ static void radio_event_gpio_toggle_init(void) { nrf_gpio_cfg_output(PIN_DBG_RADIO_EVT_END); nrf_gpio_cfg_output(PIN_DBG_RADIO_EVT_DISABLED); nrf_gpio_cfg_output(PIN_DBG_RADIO_EVT_READY); nrf_gpio_cfg_output(PIN_DBG_RADIO_EVT_FRAMESTART); nrf_gpio_cfg_output(PIN_DBG_RADIO_EVT_EDEND); nrf_gpio_cfg_output(PIN_DBG_RADIO_EVT_PHYEND); nrf_gpiote_task_configure(0, PIN_DBG_RADIO_EVT_END, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_configure(1, PIN_DBG_RADIO_EVT_DISABLED, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_configure(2, PIN_DBG_RADIO_EVT_READY, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_configure(3, PIN_DBG_RADIO_EVT_FRAMESTART, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_configure(4, PIN_DBG_RADIO_EVT_EDEND, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_configure(5, PIN_DBG_RADIO_EVT_PHYEND, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH); nrf_gpiote_task_enable(0); nrf_gpiote_task_enable(1); nrf_gpiote_task_enable(2); nrf_gpiote_task_enable(3); nrf_gpiote_task_enable(4); nrf_gpiote_task_enable(5); nrf_ppi_channel_endpoint_setup(NRF_PPI_CHANNEL0, (uint32_t) &NRF_RADIO->EVENTS_END, nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_0)); nrf_ppi_channel_endpoint_setup(NRF_PPI_CHANNEL1, (uint32_t) &NRF_RADIO->EVENTS_DISABLED, nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_1)); nrf_ppi_channel_endpoint_setup(NRF_PPI_CHANNEL2, (uint32_t) &NRF_RADIO->EVENTS_READY, nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_2)); nrf_ppi_channel_endpoint_setup(NRF_PPI_CHANNEL3, (uint32_t) &NRF_RADIO->EVENTS_FRAMESTART, nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_3)); nrf_ppi_channel_endpoint_setup(NRF_PPI_CHANNEL4, (uint32_t) &NRF_RADIO->EVENTS_EDEND, nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_4)); nrf_ppi_channel_endpoint_setup(NRF_PPI_CHANNEL5, (uint32_t) &NRF_RADIO->EVENTS_PHYEND, nrf_gpiote_task_addr_get(NRF_GPIOTE_TASKS_OUT_5)); nrf_ppi_channel_enable(NRF_PPI_CHANNEL0); nrf_ppi_channel_enable(NRF_PPI_CHANNEL1); nrf_ppi_channel_enable(NRF_PPI_CHANNEL2); nrf_ppi_channel_enable(NRF_PPI_CHANNEL3); nrf_ppi_channel_enable(NRF_PPI_CHANNEL4); nrf_ppi_channel_enable(NRF_PPI_CHANNEL5); }