-
Notifications
You must be signed in to change notification settings - Fork 141
nrfx 1.8.1 to 2.0.0
Karol Lasończyk edited this page Dec 6, 2019
·
1 revision
nrfx 2.0.0 introduces API changes. This guide lists the actions required to make your code compatible with these changes.
- Changed __STATIC_INLINE to NRF_STATIC_INLINE and NRFX_STATIC_INLINE.
- All functions that modify registers in the peripheral now take the first value as a pointer to the structure of registers of this peripheral. It affects the following HALs: ADC, CLOCK, COMP, GPIOTE, LPCOMP, NFCT, PDM, POWER, PPI, QDEC, RADIO, RNG, SAADC, USBD, WDT.
- Changed the returned type of the nrf_*_int_enable_check() functions from bool to uint32_t in HALs: QDEC, SAADC, SPI, SPIM, SPIS, SPU, TEMP, TIMER, TWI, TWIM, TWIS, UART, UARTE, USBD, WDT. Now, the functions return a mask of the enabled interrupts.
- Address getter functions nrf_task_address_get() and nrfevent_address_get() now return uint32_t instead of pointer to uint32_t. It affects the following HALs: PPI (as nrf_ppi_task_group*), QDEC, TIMER, TWI, TWIM.
- Removed deprecated API functions: nrf_ecb_init(), nrf_ecb_crypt(), and nrf_ecb_set_key().
- Action: Rewrite the code using the current nrf_ecb_* functions.
-
Changed the name of the symbols referring to tasks and events.
-
Actions:
- Update the symbols nrf_gpiote_tasks_t to nrf_gpiote_task_t and nrf_gpiote_events_t to nrf_gpiote_event_t.
- For enumerations, change NRF_GPIOTE_TASKS_* to NRF_GPIOTE_TASK_* and NRF_GPIOTE_EVENTS_* to NRF_GPIOTE_EVENT_*.
-
Changed the following function names:
- nrf_gpiote_task_addr_get() to nrf_gpiote_task_address_get()
- nrf_gpiote_int_is_enabled() to nrf_gpiote_int_enable_check()
- nrf_gpiote_event_is_set() to nrf_gpiote_event_check()
- Action: Change these function names in your code.
- Changed the name of the NRF_LPCOMP_CONFIG_REF_EXT_REF1 symbol in enumerator nrf_lpcomp_ref_t.
- Action: Replace it with NRF_LPCOMP_REF_EXT_REF1.
- Changed the name of the NRF_LPCOMP_HYST_50mV symbol in enumerator nrf_lpcomp_hysteresis_t.
- Action: Replace it with NRF_LPCOMP_HYST_ENABLED.
- Changed the following function names:
- nrf_nfct_selsres_cascade_check() to nrf_nfct_selres_cascade_check()
- nrf_nfct_selsres_protocol_get() to nrf_nfct_selres_protocol_get()
- Action: Change these function names in your code.
- Removed deprecated API functions: nrf_nvmc_page_erase(), nrf_nvmc_write_byte(), nrf_nvmc_write_word(), nrf_nvmc_write_bytes(), and nrf_nvmc_write_words().
- Action: Switch to the nrfx_nvmc driver.
- Removed the NRF_NVMC_ICACHE_PRESENT symbol.
- Action: Use NVMC_FEATURE_CACHE_PRESENT instead.
- Changed the following functions names:
- nrf_ppi_channel_disable_all() to nrf_ppi_channels_disable_all()
- nrf_ppi_channel_group_clear() to nrf_ppi_group_clear()
- Action: Change these function names in your code.
- Changed the name of the nrf_qdec_event_get() function to nrf_qdec_event_check(). The return value type is now bool.
- Changed the name of the nrf_qdec_sampleper_reg_get() function to nrf_qdec_sampleper_get(). The return value type is now nrf_qdec_sampleper_t.
- Action: Update the calls to these functions in your code.
- Changed the following functions names:
- nrf_rng_event_get() to nrf_rng_event_check()
- nrf_rng_int_get() to nrf_rng_int_enable_check()
- Action: Change these function names in your code.
- Changed the following functions names:
- nrf_rtc_int_is_enabled() to nrf_rtc_int_enable_check().
- nrf_rtc_event_pending() to nrf_rtc_event_check().
- rtc_prescaler_get() to nrf_rtc_prescaler_get().
- Action: Change these function names in your code.
- Function nrf_rtc_int_get() was removed.
- Action: Use nrf_rtc_int_enable_check(~0uL) instead.
- Removed the NRF_SAADC_CHANNEL_COUNT symbol.
- Action: Use SAADC_CH_NUM instead.
- Removed pin_p and pin_n fields from the nrf_saadc_channel_config_t structure.
- Action: Configure analog pins using the following functions:
- nrf_saadc_channel_pos_input_set() as a replacement for pin_p.
- nrf_saadc_channel_input_set() as a replacement for both pin_n and pin_p.
- Removed function nrf_saadc_event_limit_address_get().
- Action: Use the following function instead: nrf_saadc_event_address_get(NRF_SAADC, nrf_saadc_limit_event_get(channel, limit_type)).
- Removed deprecated API functions: nrf_temp_init() and nrf_temp_read().
- Action: Use nrfx_temp instead.
- Changed the following functions names:
- nrf_timer_cc_write() to nrf_timer_cc_set()
- nrf_timer_cc_read() to nrf_timer_cc_get()
- Action: Change these function names in your code.
- Removed the nrf_twis_amount_t type.
- Changed the number of arguments in the nrf_uart_configure() function. It now takes two parameters: pointer to the register and configuration structures.
- Action: Update the following source code:
nrf_uart_configure(NRF_UART0, parity, hwfc);
to:
nrf_uart_config_t config = {
.hwfc = hwfc,
.parity = parity
};
nrf_uart_configure(NRF_UART0, &config);
- Changed the number of arguments in the nrf_uart_configure() function. It now takes two parameters: pointer to the register and configuration structures.
- Action: Update the following source code:
nrf_uarte_configure(NRF_UARTEx, parity, hwfc);
to:
nrf_uarte_config_t config = {
.hwfc = hwfc,
.parity = parity
};
nrf_uarte_configure(NRF_UARTEx, &config);
- Changed the behavior of the nrf_usbd_ep_all_disable() function.
- Action: Use nrf_usbd_ep_default_config instead of nrf_usbd_ep_all_disable when restoring the default configuration.
- Removed the default values of *_DEFAULT_CONFIG macros for the drivers from nrfx_config header files. Now header files of the drivers contain the default configuration with detailed description.
- The nrfx_gpiote_init() function now takes one parameter - interrupt priority. This was previously a hard-coded value, configured in nrfx_config files.
- Changed error codes for nrfx_gpiote_out_init() function. NRFX_ERROR_BUSY is now returned instead of NRFX_ERROR_INVALID STATE.
- nrfx_pwm_init() now takes a pointer to the context as its last parameter. Can be set as NULL.
- Expanded event handler type with the context as its last parameter.
-
The driver was completely refactored. Source code that used the old driver has to be rewritten. The attached files contain examples that will help you get familiar with the new driver.
- Removed the driver.
- Action: Use NVIC directly or nrfx_egu if you use the EGU peripheral.
- Removed functions nrfx_twi_tx() and nrfx_twi_rx().
- Action: Change these functions to:
nrfx_twi_xfer_desc_t xfer = NRFX_TWI_XFER_DESC_TX(address, (uint8_t*)p_data, length);
nrfx_twi_xfer(p_instance, &xfer, no_stop ? NRFX_TWI_FLAG_TX_NO_STOP : 0);
and
nrfx_twi_xfer_desc_t xfer = NRFX_TWI_XFER_DESC_RX(address, (uint8_t*)p_data, length);
nrfx_twi_xfer(p_instance, &xfer, 0);
- Removed functions nrfx_twim_tx() and nrfx_twim_rx().
- Action: Change these functions to:
nrfx_twim_xfer_desc_t xfer = NRFX_TWIM_XFER_DESC_TX(address, (uint8_t*)p_data, length);
nrfx_twim_xfer(p_instance, &xfer, no_stop ? NRFX_TWIM_FLAG_TX_NO_STOP : 0);
and
nrfx_twim_xfer_desc_t xfer = NRFX_TWIM_XFER_DESC_RX(address, (uint8_t*)p_data, length);
nrfx_twim_xfer(p_instance, &xfer, 0);
- Moved hwfc and parity fields in the nrfx_uart_config_t to the hal_cfg field.
- Action: Update your config structure.
- Moved hwfc and parity fields in the nrfx_uarte_config_t to the hal_cfg field.
- Action: Update your config structure.
- The driver now supports multiple WDT peripherals. Every function takes a pointer to the instance as the first parameter. Note that the symbol NRFX_WDT_CONFIG_NO_IRQ now applies globally on every instance.
- Action: To support older code with the new WDT driver, declare an instance and pass it as the first argument to each nrfx_wdt_* function:
nrfx_wdt_t const wdt_instance = NRFX_WDT_INSTANCE(0);
...
nrfx_wdt_enable(&wdt_instance);
nrf_bitmask.h:
- Changed the return value type of the nrf_bitmask_bit_is_set() function from uint32_t to bool. It now returns true if the bit is set in the mask and false otherwise.
- Changed the type of the length parameter in nrf_bitmask_masks_or() and nrf_bitmask_masks_and() functions from uint32_t to size_t.
- Action: Update the type of these variables in the application.