Skip to content

Commit

Permalink
nrfx 1.4.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kl-cruz committed Nov 30, 2018
1 parent d4ebe15 commit 595e79f
Show file tree
Hide file tree
Showing 34 changed files with 1,281 additions and 808 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Changelog
All notable changes to this project are documented in this file.

## [1.4.0] - 2018-11-30
### Added
- Added the nrfx_is_word_aligned() function for checking whether an address is word-aligned.
- Added HAL for ACL.
- Added functions for disabling and re-enabling interrupts in the SWI driver.
- Added possibility to completely remove interrupt handling from the WDT driver.

### Changed
- Updated the documentation for the nrfx_uarte_rx() function. It now correctly reflects the actual behavior of the function.

### Fixed
- Corrected the type of the nrfx_uarte_xfer_evt_t structure field that holds the amount of transferred bytes.
- Corrected the way of disabling interrupts in the NFCT driver when moving the peripheral to the disabled state.
- Fixed a typo in the name of the bmRequest field in the nrfx_usbd_setup_t structure. The new correct name is bRequest.
- Fixed the nrfx_ppi_channel_fork_assign() function. It now accepts also pre-programmed channels.
- Fixed handling of long custom instruction responses in the QSPI driver.
- Fixed a bug affecting the conversion of time to ticks in the TIMER HAL.

## [1.3.1] - 2018-09-28
### Fixed
- Corrected the type of nrfx_usbd_ep_status_get() return value.
Expand Down
10 changes: 10 additions & 0 deletions doc/config_dox/nrfx_wdt_dox_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
*/
#define NRFX_WDT_CONFIG_RELOAD_VALUE

/** @brief Remove WDT IRQ handling from WDT driver
*
* Following options are available:
* - 0 - Include WDT IRQ handling
* - 1 - Remove WDT IRQ handling
*
* @note This is an NRF_CONFIG macro.
*/
#define NRFX_WDT_CONFIG_NO_IRQ

/** @brief Interrupt priority
*
* Following options are available:
Expand Down
1 change: 1 addition & 0 deletions doc/drv_supp_matrix.dox
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This matrix shows which drivers are supported by particular Nordic SoCs.
Driver | nRF51 Series | nRF52810 | nRF52832 | nRF52840 |
-----------------|--------------|--------------| -------------| -------------|
@ref nrf_adc |@tagGreenTick |@tagRedCross |@tagRedCross |@tagRedCross |
@ref nrf_acl |@tagRedCross |@tagRedCross |@tagRedCross |@tagGreenTick |
@ref nrf_ccm |@tagGreenTick |@tagGreenTick |@tagGreenTick |@tagGreenTick |
@ref nrf_clock |@tagGreenTick |@tagGreenTick |@tagGreenTick |@tagGreenTick |
@ref nrf_comp |@tagRedCross |@tagGreenTick |@tagGreenTick |@tagGreenTick |
Expand Down
2 changes: 2 additions & 0 deletions doc/nrf52840.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
@page nrf52840_drivers nRF52840 Drivers
@{

@ref nrf_acl

@ref nrf_ccm

@ref nrf_clock
Expand Down
2 changes: 1 addition & 1 deletion doc/nrfx.doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PROJECT_NAME = "nrfx"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = "1.3"
PROJECT_NUMBER = "1.4"
### EDIT THIS ###

# Using the PROJECT_BRIEF tag one can provide an optional one line description
Expand Down
2 changes: 2 additions & 0 deletions doc/nrfx_api.dox
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
@brief List of all drivers available in nrfx.
@defgroup nrf_adc ADC

@defgroup nrf_acl ACL

@defgroup nrf_ccm CCM

@defgroup nrf_clock CLOCK
Expand Down
1 change: 0 additions & 1 deletion drivers/include/nrfx_ppi.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ nrfx_err_t nrfx_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint
*
* @retval NRFX_SUCCESS If the channel was successfully assigned.
* @retval NRFX_ERROR_INVALID_STATE If the channel is not allocated for the user.
* @retval NRFX_ERROR_INVALID_PARAM If the channel is not user-configurable.
* @retval NRFX_ERROR_NOT_SUPPORTED If function is not supported.
*/
nrfx_err_t nrfx_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork_tep);
Expand Down
19 changes: 19 additions & 0 deletions drivers/include/nrfx_swi.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ typedef void (*nrfx_swi_handler_t)(nrfx_swi_t swi, nrfx_swi_flags_t flags);
/**
* @brief Function for allocating the first unused SWI instance and setting a handler.
*
* If provided handler is not NULL, an allocated SWI has its interrupt enabled by default.
* The interrupt can be disabled by @ref nrfx_swi_int_disable.
*
* @param[out] p_swi Points to a place where the allocated SWI instance
* number is to be stored.
* @param[in] event_handler Event handler function.
Expand All @@ -93,6 +96,22 @@ nrfx_err_t nrfx_swi_alloc(nrfx_swi_t * p_swi,
nrfx_swi_handler_t event_handler,
uint32_t irq_priority);

/**
* @brief Function for disabling an allocated SWI interrupt.
*
* Use @ref nrfx_swi_int_enable to re-enable the interrupt.
*
* @param[in] swi SWI instance.
*/
void nrfx_swi_int_disable(nrfx_swi_t swi);

/**
* @brief Function for enabling an allocated SWI interrupt.
*
* @param[in] swi SWI instance.
*/
void nrfx_swi_int_enable(nrfx_swi_t swi);

/**
* @brief Function for freeing a previously allocated SWI.
*
Expand Down
25 changes: 18 additions & 7 deletions drivers/include/nrfx_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,25 +250,36 @@ void nrfx_uart_tx_abort(nrfx_uart_t const * p_instance);
*
* If an event handler was provided in the nrfx_uart_init() call, this function
* returns immediately and the handler is called when the transfer is done.
* Otherwise, the transfer is performed in blocking mode, i.e. this function
* Otherwise, the transfer is performed in blocking mode, meaning that this function
* returns when the transfer is finished. Blocking mode is not using interrupt so
* there is no context switching inside the function.
*
* The receive buffer pointer is double buffered in non-blocking mode. The secondary
* buffer can be set immediately after starting the transfer and will be filled
* when the primary buffer is full. The double buffering feature allows
* receiving data continuously.
*
* If this function is used without a previous call to @ref nrfx_uart_rx_enable, the reception
* will be stopped on error or when the supplied buffer fills up. In both cases,
* RX FIFO gets disabled. This means that, in case of error, the bytes that follow are lost.
* If this nrfx_uart_rx() function is used with the previous call to @ref nrfx_uart_rx_enable,
* the reception is stopped in case of error, but FIFO is still ongoing. The receiver is still
* working, so after handling the error, an immediate repeated call to this nrfx_uart_rx()
* function with fresh data buffer will re-establish reception. To disable the receiver,
* you must call @ref nrfx_uart_rx_disable explicitly.
*
* @param[in] p_instance Pointer to the driver instance structure.
* @param[in] p_data Pointer to data.
* @param[in] length Number of bytes to receive.
*
* @retval NRFX_SUCCESS If initialization was successful.
* @retval NRFX_ERROR_BUSY If the driver is already receiving
* (and the secondary buffer has already been set
* in non-blocking mode).
* @retval NRFX_SUCCESS If reception is complete (in case of blocking mode) or it is
* successfully started (in case of non-blocking mode).
* @retval NRFX_ERROR_BUSY If the driver is already receiving
* (and the secondary buffer has already been set
* in non-blocking mode).
* @retval NRFX_ERROR_FORBIDDEN If the transfer was aborted from a different context
* (blocking mode only, also see @ref nrfx_uart_rx_disable).
* @retval NRFX_ERROR_INTERNAL If UART peripheral reported an error.
* (blocking mode only, also see @ref nrfx_uart_rx_disable).
* @retval NRFX_ERROR_INTERNAL If UART peripheral reported an error.
*/
nrfx_err_t nrfx_uart_rx(nrfx_uart_t const * p_instance,
uint8_t * p_data,
Expand Down
2 changes: 1 addition & 1 deletion drivers/include/nrfx_uarte.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ typedef struct
typedef struct
{
uint8_t * p_data; ///< Pointer to memory used for transfer.
uint8_t bytes; ///< Number of bytes transfered.
size_t bytes; ///< Number of bytes transfered.
} nrfx_uarte_xfer_evt_t;

/**
Expand Down
2 changes: 1 addition & 1 deletion drivers/include/nrfx_usbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ typedef struct
typedef struct
{
uint8_t bmRequestType; //!< byte 0
uint8_t bmRequest; //!< byte 1
uint8_t bRequest; //!< byte 1
uint16_t wValue; //!< byte 2, 3
uint16_t wIndex; //!< byte 4, 5
uint16_t wLength; //!< byte 6, 7
Expand Down
19 changes: 16 additions & 3 deletions drivers/include/nrfx_wdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,23 @@ extern "C" {
* @brief Watchdog Timer (WDT) peripheral driver.
*/

#if !NRFX_CHECK(NRFX_WDT_CONFIG_NO_IRQ) || defined(__NRFX_DOXYGEN__)
/**
* @brief WDT instance interrupt priority configuration.
*/
#define NRFX_WDT_IRQ_CONFIG .interrupt_priority = NRFX_WDT_CONFIG_IRQ_PRIORITY
#else
#define NRFX_WDT_IRQ_CONFIG
#endif

/**@brief Struct for WDT initialization. */
typedef struct
{
nrf_wdt_behaviour_t behaviour; /**< WDT behaviour when CPU in sleep/halt mode. */
uint32_t reload_value; /**< WDT reload value in ms. */
#if !NRFX_CHECK(NRFX_WDT_CONFIG_NO_IRQ) || defined(__NRFX_DOXYGEN__)
uint8_t interrupt_priority; /**< WDT interrupt priority */
#endif
} nrfx_wdt_config_t;

/**@brief WDT event handler function type. */
Expand All @@ -64,14 +75,14 @@ typedef nrf_wdt_rr_register_t nrfx_wdt_channel_id;
{ \
.behaviour = (nrf_wdt_behaviour_t)NRFX_WDT_CONFIG_BEHAVIOUR, \
.reload_value = NRFX_WDT_CONFIG_RELOAD_VALUE, \
.interrupt_priority = NRFX_WDT_CONFIG_IRQ_PRIORITY, \
NRFX_WDT_IRQ_CONFIG \
}
/**
* @brief This function initializes watchdog.
*
* @param[in] p_config Pointer to the structure with initial configuration.
* @param[in] wdt_event_handler Event handler provided by the user.
* Must not be NULL.
* @param[in] wdt_event_handler Event handler provided by the user. Ignored when
* @ref NRFX_WDT_CONFIG_NO_IRQ option is enabled.
*
* @return NRFX_SUCCESS on success, otherwise an error code.
*/
Expand Down Expand Up @@ -134,7 +145,9 @@ __STATIC_INLINE uint32_t nrfx_wdt_ppi_event_addr(nrf_wdt_event_t event)
}


#if !NRFX_CHECK(NRFX_WDT_CONFIG_NO_IRQ)
void nrfx_wdt_irq_handler(void);
#endif


/** @} */
Expand Down
21 changes: 21 additions & 0 deletions drivers/nrfx_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,22 @@ typedef enum
*/
__STATIC_INLINE bool nrfx_is_in_ram(void const * p_object);


/**
* @brief Function for checking if an object is aligned to a 32-bit word
*
* Several peripherals (the ones using EasyDMA) require the transfer buffers
* to be aligned to a 32-bit word. This function can be used to check if
* this condition is met.
*
* @param[in] p_object Pointer to an object whose location is to be checked.
*
* @retval true if the pointed object is aligned to a 32-bit word.
* @retval false otherwise.
*/
__STATIC_INLINE bool nrfx_is_word_aligned(void const * p_object);


/**
* @brief Function for getting the interrupt number for a specific peripheral.
*
Expand Down Expand Up @@ -269,6 +285,11 @@ __STATIC_INLINE bool nrfx_is_in_ram(void const * p_object)
return ((((uint32_t)p_object) & 0xE0000000u) == 0x20000000u);
}

__STATIC_INLINE bool nrfx_is_word_aligned(void const * p_object)
{
return ((((uint32_t)p_object) & 0x3u) == 0u);
}

__STATIC_INLINE IRQn_Type nrfx_get_irq_number(void const * p_reg)
{
return (IRQn_Type)NRFX_IRQ_NUMBER_GET(p_reg);
Expand Down
3 changes: 3 additions & 0 deletions drivers/src/nrfx_gpiote.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
#define SENSE_FIELD_POS (6)
#define SENSE_FIELD_MASK (0xC0)

/* Check if every pin can be encoded on provided number of bits. */
NRFX_STATIC_ASSERT(NUMBER_OF_PINS <= (1 << SENSE_FIELD_POS));

/**
* @brief Macro for converting task-event index to an address of an event register.
*
Expand Down
12 changes: 12 additions & 0 deletions drivers/src/nrfx_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ nrfx_err_t nrfx_i2s_start(nrfx_i2s_buffers_t const * p_initial_buffers,
NRFX_ASSERT(p_initial_buffers != NULL);
NRFX_ASSERT(p_initial_buffers->p_rx_buffer != NULL ||
p_initial_buffers->p_tx_buffer != NULL);
NRFX_ASSERT((p_initial_buffers->p_rx_buffer == NULL) ||
(nrfx_is_in_ram(p_initial_buffers->p_rx_buffer) &&
nrfx_is_word_aligned(p_initial_buffers->p_rx_buffer)));
NRFX_ASSERT((p_initial_buffers->p_tx_buffer == NULL) ||
(nrfx_is_in_ram(p_initial_buffers->p_tx_buffer) &&
nrfx_is_word_aligned(p_initial_buffers->p_tx_buffer)));
NRFX_ASSERT(buffer_size != 0);
(void)(flags);

Expand Down Expand Up @@ -275,6 +281,12 @@ nrfx_err_t nrfx_i2s_next_buffers_set(nrfx_i2s_buffers_t const * p_buffers)
{
NRFX_ASSERT(m_cb.state == NRFX_DRV_STATE_POWERED_ON);
NRFX_ASSERT(p_buffers);
NRFX_ASSERT((p_buffers->p_rx_buffer == NULL) ||
(nrfx_is_in_ram(p_buffers->p_rx_buffer) &&
nrfx_is_word_aligned(p_buffers->p_rx_buffer)));
NRFX_ASSERT((p_buffers->p_tx_buffer == NULL) ||
(nrfx_is_in_ram(p_buffers->p_tx_buffer) &&
nrfx_is_word_aligned(p_buffers->p_tx_buffer)));

nrfx_err_t err_code;

Expand Down
29 changes: 19 additions & 10 deletions drivers/src/nrfx_nfct.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@ static void nrfx_nfct_hw_init_setup(void)
}
#endif // NRF52840_XXAA

//Enable necessary interrupts.
nrf_nfct_int_enable(NRF_NFCT_INT_FIELDDETECTED_MASK | NRF_NFCT_INT_ERROR_MASK |
NRF_NFCT_INT_SELECTED_MASK);
#if !defined(NRF52832_XXAA) && !defined(NRF52832_XXAB)
nrf_nfct_int_enable(NRF_NFCT_INT_FIELDLOST_MASK);
#endif //!defined(NRF52832_XXAA) && !defined(NRF52832_XXAB)

// Use Window Grid frame delay mode.
nrf_nfct_frame_delay_mode_set(NRF_NFCT_FRAME_DELAY_MODE_WINDOWGRID);

Expand Down Expand Up @@ -326,6 +319,7 @@ static void nrfx_nfct_activate_check(void)
static inline void nrfx_nfct_reset(void)
{
uint32_t fdm;
uint32_t int_enabled;
uint8_t nfcid1[NRF_NFCT_SENSRES_NFCID1_SIZE_TRIPLE];
nrf_nfct_sensres_nfcid1_size_t nfcid1_size;
nrf_nfct_selres_protocol_t protocol;
Expand All @@ -334,6 +328,7 @@ static inline void nrfx_nfct_reset(void)
fdm = nrf_nfct_frame_delay_max_get();
nfcid1_size = nrf_nfct_nfcid1_get(nfcid1);
protocol = nrf_nfct_selsres_protocol_get();
int_enabled = nrf_nfct_int_enable_get();

// Reset the NFCT peripheral.
*(volatile uint32_t *)0x40005FFC = 0;
Expand All @@ -347,6 +342,10 @@ static inline void nrfx_nfct_reset(void)

// Restore general HW configuration.
nrfx_nfct_hw_init_setup();

// Restore interrupts.
nrf_nfct_int_enable(int_enabled);

NRFX_LOG_INFO("Reinitialize");
}

Expand Down Expand Up @@ -466,6 +465,10 @@ nrfx_err_t nrfx_nfct_init(nrfx_nfct_config_t const * p_config)
m_nfct_cb.config = *p_config;
nrfx_nfct_hw_init_setup();

NRFX_IRQ_PENDING_CLEAR(NFCT_IRQn);
NRFX_IRQ_PRIORITY_SET(NFCT_IRQn, NRFX_NFCT_CONFIG_IRQ_PRIORITY);
NRFX_IRQ_ENABLE(NFCT_IRQn);

#ifdef USE_TIMER_WORKAROUND
/* Initialize Timer module as the workaround for NFCT HW issues. */
#ifdef NRF52840_XXAA
Expand Down Expand Up @@ -498,6 +501,9 @@ void nrfx_nfct_uninit(void)
{
nrfx_nfct_disable();

NRFX_IRQ_DISABLE(NFCT_IRQn);
NRFX_IRQ_PENDING_CLEAR(NFCT_IRQn);

#ifdef USE_TIMER_WORKAROUND
/* Initialize Timer module as the workaround for NFCT HW issues. */
#ifdef NRF52840_XXAA
Expand All @@ -516,15 +522,18 @@ void nrfx_nfct_enable(void)
nrf_nfct_error_status_clear(NRFX_NFCT_ERROR_STATUS_ALL_MASK);
nrf_nfct_task_trigger(NRF_NFCT_TASK_SENSE);

NRFX_IRQ_PENDING_CLEAR(NFCT_IRQn);
NRFX_IRQ_PRIORITY_SET(NFCT_IRQn, NRFX_NFCT_CONFIG_IRQ_PRIORITY);
NRFX_IRQ_ENABLE(NFCT_IRQn);
nrf_nfct_int_enable(NRF_NFCT_INT_FIELDDETECTED_MASK | NRF_NFCT_INT_ERROR_MASK |
NRF_NFCT_INT_SELECTED_MASK);
#if !defined(NRF52832_XXAA) && !defined(NRF52832_XXAB)
nrf_nfct_int_enable(NRF_NFCT_INT_FIELDLOST_MASK);
#endif //!defined(NRF52832_XXAA) && !defined(NRF52832_XXAB)

NRFX_LOG_INFO("Start");
}

void nrfx_nfct_disable(void)
{
nrf_nfct_int_disable(NRF_NFCT_DISABLE_ALL_INT);
nrf_nfct_task_trigger(NRF_NFCT_TASK_DISABLE);

NRFX_LOG_INFO("Stop");
Expand Down
6 changes: 1 addition & 5 deletions drivers/src/nrfx_ppi.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,7 @@ nrfx_err_t nrfx_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork
{
nrfx_err_t err_code = NRFX_SUCCESS;
#ifdef PPI_FEATURE_FORKS_PRESENT
if (!is_programmable_app_channel(channel))
{
err_code = NRFX_ERROR_INVALID_PARAM;
}
else if (!is_allocated_channel(channel))
if (!is_allocated_channel(channel))
{
err_code = NRFX_ERROR_INVALID_STATE;
}
Expand Down
Loading

0 comments on commit 595e79f

Please sign in to comment.