update nrfx to 1.3.1
This commit is contained in:
1 parent
f3f93adf0c
commit
1213fafe00
14 files changed
+870
-21
No files matched your search
@@ -1,9 +1,37 @@
|
||||
# Changelog
|
||||
All notable changes to this project are documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
## [1.3.1] - 2018-09-28
|
||||
### Fixed
|
||||
- Fixed starting TWIM TXRX transfer after preceding transfer was without stop condition.
|
||||
- Corrected the type of nrfx_usbd_ep_status_get() return value.
|
||||
- Corrected calls to undefined macros in NFCT and USBD drivers.
|
||||
|
||||
## [1.3.0] - 2018-09-21
|
||||
### Added
|
||||
- Added HAL and driver for NFCT.
|
||||
- Added driver for USBD.
|
||||
- Added function for setting the burst mode in the SAADC HAL.
|
||||
- Added the NRFX_ARRAY_SIZE macro.
|
||||
|
||||
### Changed
|
||||
- Moved the implementation of nrfx_power_clock_irq_handler() to nrfx_power.c, removed nrfx_power_clock.c.
|
||||
|
||||
### Fixed
|
||||
- Replaced ARRAY_SIZE macro calls with NRFX_ARRAY_SIZE ones.
|
||||
|
||||
## [1.2.0] - 2018-09-06
|
||||
### Added
|
||||
- Added function for checking if a specific channel is enabled in the GPIOTE HAL.
|
||||
- Added support for using the QDEC driver without LED.
|
||||
- Added functions for modifying only the event endpoint or only the task endpoint in the PPI HAL.
|
||||
- Added function for reading the pin pull configuration in the GPIO HAL.
|
||||
|
||||
### Changed
|
||||
- Corrected ISOSPLIT enumerator names in the USBD HAL.
|
||||
|
||||
### Fixed
|
||||
- Fixed a double buffering bug that occurred in the UARTE driver after the RX abort.
|
||||
- Fixed the TXRX transfers in the TWIM driver. They can now be started after transfers that are not ended with the stop condition.
|
||||
|
||||
## [1.1.0] - 2018-06-15
|
||||
### Added
|
||||
@@ -41,7 +69,7 @@ All notable changes to this project are documented in this file.
|
||||
- Changed the RNG bias correction configuration option to be enabled by default.
|
||||
- Refactored the ADC driver and HAL.
|
||||
- Corrected assertions in the TIMER driver to make it usable in debug version with PPI.
|
||||
- Improved buffer handling in the I2S driver. The API of the driver has been sligthly modified.
|
||||
- Improved buffer handling in the I2S driver. The API of the driver has been slightly modified.
|
||||
- Enhanced SPIS driver API: added the "p_context" parameter, allowed NULL pointers for zero-length buffers.
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef NRFX_NFCT_H__
|
||||
#define NRFX_NFCT_H__
|
||||
|
||||
#include <nrfx.h>
|
||||
#include <hal/nrf_nfct.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup nrfx_nfct NFCT driver
|
||||
* @{
|
||||
* @ingroup nrf_nfct
|
||||
* @brief Near Field Communication Tag (NFCT) peripheral driver.
|
||||
*/
|
||||
|
||||
#define NRFX_NFCT_NFCID1_SINGLE_SIZE 4u ///< Length of single-size NFCID1.
|
||||
#define NRFX_NFCT_NFCID1_DOUBLE_SIZE 7u ///< Length of double-size NFCID1.
|
||||
#define NRFX_NFCT_NFCID1_TRIPLE_SIZE 10u ///< Length of triple-size NFCID1.
|
||||
|
||||
#define NRFX_NFCT_NFCID1_DEFAULT_LEN NRFX_NFCT_NFCID1_DOUBLE_SIZE ///< Default length of NFC ID. */
|
||||
|
||||
/**
|
||||
* @brief NFCT hardware states.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_NFCT_STATE_DISABLED = NRF_NFCT_TASK_DISABLE, ///< NFC Tag is disabled (no sensing of an external NFC field).
|
||||
NRFX_NFCT_STATE_SENSING = NRF_NFCT_TASK_SENSE, ///< NFC Tag is sensing whether there is an external NFC field.
|
||||
NRFX_NFCT_STATE_ACTIVATED = NRF_NFCT_TASK_ACTIVATE, ///< NFC Tag is powered-up (see @ref nrfx_nfct_active_state_t for possible substates).
|
||||
} nrfx_nfct_state_t;
|
||||
|
||||
/**
|
||||
* @brief NFC tag states, when NFCT hardware is activated.
|
||||
*
|
||||
* @details These states are substates of the @ref NRFX_NFCT_STATE_ACTIVATED state.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_NFCT_ACTIVE_STATE_IDLE = NRF_NFCT_TASK_GOIDLE, ///< NFC Tag is activated and idle (not selected by a reader).
|
||||
NRFX_NFCT_ACTIVE_STATE_SLEEP = NRF_NFCT_TASK_GOSLEEP, ///< NFC Tag is sleeping.
|
||||
NRFX_NFCT_ACTIVE_STATE_DEFAULT, ///< NFC Tag is either sleeping or idle, depending on the previous state before being selected by a poller.
|
||||
} nrfx_nfct_active_state_t;
|
||||
|
||||
/**
|
||||
* @brief NFCT driver event types, passed to the upper-layer callback function
|
||||
* provided during the initialization.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_NFCT_EVT_FIELD_DETECTED = NRF_NFCT_INT_FIELDDETECTED_MASK, ///< External NFC field is detected.
|
||||
NRFX_NFCT_EVT_FIELD_LOST = NRF_NFCT_INT_FIELDLOST_MASK, ///< External NFC Field is lost.
|
||||
NRFX_NFCT_EVT_SELECTED = NRF_NFCT_INT_SELECTED_MASK, ///< Tag was selected by the poller.
|
||||
NRFX_NFCT_EVT_RX_FRAMESTART = NRF_NFCT_INT_RXFRAMESTART_MASK, ///< Data frame reception started.
|
||||
NRFX_NFCT_EVT_RX_FRAMEEND = NRF_NFCT_INT_RXFRAMEEND_MASK, ///< Data frame is received.
|
||||
NRFX_NFCT_EVT_TX_FRAMESTART = NRF_NFCT_INT_TXFRAMESTART_MASK, ///< Data frame transmission started.
|
||||
NRFX_NFCT_EVT_TX_FRAMEEND = NRF_NFCT_INT_TXFRAMEEND_MASK, ///< Data frame is transmitted.
|
||||
NRFX_NFCT_EVT_ERROR = NRF_NFCT_INT_ERROR_MASK, ///< Error occurred in an NFC communication.
|
||||
} nrfx_nfct_evt_id_t;
|
||||
|
||||
/**
|
||||
* @brief NFCT timing-related error types.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_NFCT_ERROR_FRAMEDELAYTIMEOUT, ///< No response frame was transmitted to the poller in the transmit window.
|
||||
NRFX_NFCT_ERROR_NUM, ///< Total number of possible errors.
|
||||
} nrfx_nfct_error_t;
|
||||
|
||||
/**
|
||||
* @brief NFCT driver parameter types.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_NFCT_PARAM_ID_FDT, ///< NFC-A Frame Delay Time parameter.
|
||||
NRFX_NFCT_PARAM_ID_SEL_RES, ///< Value of the 'Protocol' field in the NFC-A SEL_RES frame.
|
||||
NRFX_NFCT_PARAM_ID_NFCID1, ///< NFC-A NFCID1 setting (NFC tag identifier).
|
||||
} nrfx_nfct_param_id_t;
|
||||
|
||||
/**
|
||||
* @brief NFCID1 descriptor.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t const * p_id; ///< NFCID1 data.
|
||||
uint8_t id_size; ///< NFCID1 size.
|
||||
} nrfx_nfct_nfcid1_t;
|
||||
|
||||
/**
|
||||
* @brief NFCT driver parameter descriptor.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
nrfx_nfct_param_id_t id; ///< Type of parameter.
|
||||
union
|
||||
{
|
||||
uint32_t fdt; ///< NFC-A Frame Delay Time. Filled when nrfx_nfct_param_t::id is @ref NRFX_NFCT_PARAM_ID_FDT.
|
||||
uint8_t sel_res_protocol; ///< NFC-A value of the 'Protocol' field in the SEL_RES frame. Filled when nrfx_nfct_param_t::id is @ref NRFX_NFCT_PARAM_ID_SEL_RES.
|
||||
nrfx_nfct_nfcid1_t nfcid1; ///< NFC-A NFCID1 value (tag identifier). Filled when nrfx_nfct_param_t::id is @ref NRFX_NFCT_PARAM_ID_NFCID1.
|
||||
} data;
|
||||
} nrfx_nfct_param_t;
|
||||
|
||||
/**
|
||||
* @brief NFCT driver RX/TX buffer descriptor.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t data_size; ///< RX/TX buffer size.
|
||||
uint8_t const * p_data; ///< RX/TX buffer.
|
||||
} nrfx_nfct_data_desc_t;
|
||||
|
||||
/**
|
||||
* @brief Structure used to describe the @ref NRFX_NFCT_EVT_RX_FRAMEEND event type.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t rx_status; ///< RX error status.
|
||||
nrfx_nfct_data_desc_t rx_data; ///< RX buffer.
|
||||
} nrfx_nfct_evt_rx_frameend_t;
|
||||
|
||||
/**
|
||||
* @brief Structure used to describe the @ref NRFX_NFCT_EVT_TX_FRAMESTART event type.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
nrfx_nfct_data_desc_t tx_data; ///< TX buffer.
|
||||
} nrfx_nfct_evt_tx_framestart_t;
|
||||
|
||||
/**
|
||||
* @brief Structure used to describe the @ref NRFX_NFCT_EVT_ERROR event type.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
nrfx_nfct_error_t reason; ///< Reason for error.
|
||||
} nrfx_nfct_evt_error_t;
|
||||
|
||||
/**
|
||||
* @brief NFCT driver event.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
nrfx_nfct_evt_id_t evt_id; ///< Type of event.
|
||||
union
|
||||
{
|
||||
nrfx_nfct_evt_rx_frameend_t rx_frameend; ///< End of the RX frame data. Filled when nrfx_nfct_evt_t::evt_id is @ref NRFX_NFCT_EVT_RX_FRAMEEND.
|
||||
nrfx_nfct_evt_tx_framestart_t tx_framestart; ///< Start of the TX frame data. Filled when nrfx_nfct_evt_t::evt_id is @ref NRFX_NFCT_EVT_TX_FRAMESTART.
|
||||
nrfx_nfct_evt_error_t error; ///< Error data. Filled when nrfx_nfct_evt_t::evt_id is @ref NRFX_NFCT_EVT_ERROR.
|
||||
} params;
|
||||
} nrfx_nfct_evt_t;
|
||||
|
||||
/**
|
||||
* @brief Callback descriptor to pass events from the NFCT driver to the upper layer.
|
||||
*
|
||||
* @param[in] p_event Pointer to the event descriptor.
|
||||
*/
|
||||
typedef void (*nrfx_nfct_handler_t)(nrfx_nfct_evt_t const * p_event);
|
||||
|
||||
/**
|
||||
* @brief NFCT driver configuration structure.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t rxtx_int_mask; ///< Mask for enabling RX/TX events. Indicate which events must be forwarded to the upper layer by using @ref nrfx_nfct_evt_id_t. By default, no events are enabled. */
|
||||
nrfx_nfct_handler_t cb; ///< Callback.
|
||||
} nrfx_nfct_config_t;
|
||||
|
||||
/**
|
||||
* @brief Function for initializing the NFCT driver.
|
||||
*
|
||||
* @param[in] p_config Pointer to the NFCT driver configuration structure.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the NFCT driver was initialized successfully.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the NFCT driver is already initialized.
|
||||
*/
|
||||
nrfx_err_t nrfx_nfct_init(nrfx_nfct_config_t const * p_config);
|
||||
|
||||
/**
|
||||
* @brief Function for uninitializing the NFCT driver.
|
||||
*
|
||||
* After uninitialization, the instance is in disabled state.
|
||||
*/
|
||||
void nrfx_nfct_uninit(void);
|
||||
|
||||
/**
|
||||
* @brief Function for starting the NFC subsystem.
|
||||
*
|
||||
* After this function completes, NFC readers are able to detect the tag.
|
||||
*/
|
||||
void nrfx_nfct_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling the NFCT driver.
|
||||
*
|
||||
* After this function returns, NFC readers are no longer able to connect
|
||||
* to the tag.
|
||||
*/
|
||||
void nrfx_nfct_disable(void);
|
||||
|
||||
/**
|
||||
* @brief Function for checking whether the external NFC field is present in the range of the tag.
|
||||
*
|
||||
* @retval true If the NFC field is present.
|
||||
* @retval false If no NFC field is present.
|
||||
*/
|
||||
bool nrfx_nfct_field_check(void);
|
||||
|
||||
/**
|
||||
* @brief Function for preparing the NFCT driver for receiving an NFC frame.
|
||||
*
|
||||
* @param[in] p_rx_data Pointer to the RX buffer.
|
||||
*/
|
||||
void nrfx_nfct_rx(nrfx_nfct_data_desc_t const * p_rx_data);
|
||||
|
||||
/**
|
||||
* @brief Function for transmitting an NFC frame.
|
||||
*
|
||||
* @param[in] p_tx_data Pointer to the TX buffer.
|
||||
* @param[in] delay_mode Delay mode of the NFCT frame timer.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the operation was successful.
|
||||
* @retval NRFX_ERROR_INVALID_LENGTH If the TX buffer size is invalid.
|
||||
*/
|
||||
nrfx_err_t nrfx_nfct_tx(nrfx_nfct_data_desc_t const * p_tx_data,
|
||||
nrf_nfct_frame_delay_mode_t delay_mode);
|
||||
|
||||
/**
|
||||
* @brief Function for moving the NFCT to a new state.
|
||||
*
|
||||
* @note The HFCLK must be running before activating the NFCT with
|
||||
* @ref NRFX_NFCT_STATE_ACTIVATED.
|
||||
*
|
||||
* @param[in] state The required state.
|
||||
*/
|
||||
void nrfx_nfct_state_force(nrfx_nfct_state_t state);
|
||||
|
||||
/**
|
||||
* @brief Function for moving the NFCT to a new initial substate within @ref NRFX_NFCT_STATE_ACTIVATED.
|
||||
*
|
||||
* @param[in] sub_state The required substate.
|
||||
*/
|
||||
void nrfx_nfct_init_substate_force(nrfx_nfct_active_state_t sub_state);
|
||||
|
||||
/**
|
||||
* @brief Function for setting the NFC communication parameter.
|
||||
*
|
||||
* @note Parameter validation for length and acceptable values.
|
||||
*
|
||||
* @param[in] p_param Pointer to parameter descriptor.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the operation was successful.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If the parameter data is invalid.
|
||||
*/
|
||||
nrfx_err_t nrfx_nfct_parameter_set(nrfx_nfct_param_t const * p_param);
|
||||
|
||||
/**
|
||||
* @brief Function for getting default bytes for NFCID1.
|
||||
*
|
||||
* @param[in,out] p_nfcid1_buff In: empty buffer for data;
|
||||
* Out: buffer with the NFCID1 default data. These values
|
||||
* can be used to fill the Type 2 Tag Internal Bytes.
|
||||
* @param[in] nfcid1_buff_len Length of the NFCID1 buffer.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the operation was successful.
|
||||
* @retval NRFX_ERROR_INVALID_LENGTH If length of the NFCID buffer is different than
|
||||
* @ref NRFX_NFCT_NFCID1_SINGLE_SIZE,
|
||||
* @ref NRFX_NFCT_NFCID1_DOUBLE_SIZE, or
|
||||
* @ref NRFX_NFCT_NFCID1_TRIPLE_SIZE.
|
||||
*/
|
||||
nrfx_err_t nrfx_nfct_nfcid1_default_bytes_get(uint8_t * const p_nfcid1_buff,
|
||||
uint32_t nfcid1_buff_len);
|
||||
|
||||
/**
|
||||
* @brief Function for enabling the automatic collision resolution.
|
||||
*
|
||||
* @details As defined by the NFC Forum Digital Protocol Technical Specification (and ISO 14443-3),
|
||||
* the automatic collision resolution is implemented in the NFCT hardware.
|
||||
* This function allows enabling and disabling this feature.
|
||||
*/
|
||||
void nrfx_nfct_autocolres_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling the automatic collision resolution.
|
||||
*
|
||||
* @details See also details in @ref nrfx_nfct_autocolres_enable.
|
||||
*/
|
||||
void nrfx_nfct_autocolres_disable(void);
|
||||
|
||||
|
||||
void nrfx_nfct_irq_handler(void);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup nrfx_nfct_fixes NFCT driver fixes and workarounds
|
||||
* @{
|
||||
* @ingroup nrf_nfct
|
||||
* @brief Fixes for hardware-related anomalies.
|
||||
*
|
||||
* If you are using the nRF52832 chip, the workarounds for the following anomalies are applied:
|
||||
* - 79. NFCT: A false EVENTS_FIELDDETECTED event occurs after the field is lost.
|
||||
* - 116. NFCT does not release HFCLK when switching from ACTIVATED to SENSE mode.
|
||||
* To implement the first workaround, an instance of NRF_TIMER is used. After the NFC field is detected,
|
||||
* the timing module periodically polls its state to determine when the field is turned off.
|
||||
* To implement the second workaround, power reset is used to release the clock acquired by NFCT
|
||||
* after the field is turned off. Note that the NFCT register configuration is restored to defaults.
|
||||
*
|
||||
* If you are using the nRF52840 chip, rev. Engineering A, the workarounds for the following anomalies
|
||||
* are applied:
|
||||
* - 98. NFCT: The NFCT is not able to communicate with the peer.
|
||||
* - 116. NFCT does not release HFCLK when switching from ACTIVATED to SENSE mode.
|
||||
* - 144. NFCT: Not optimal NFC performance
|
||||
*
|
||||
* If you are using the nRF52840 chip, rev. 1, or rev. Engineering B or C, the workarounds for the following
|
||||
* anomalies are applied:
|
||||
* - 190. NFCT: Event FIELDDETECTED can be generated too early.
|
||||
* To implement this workaround, an instance of NRF_TIMER is used. After the NFC field is detected,
|
||||
* the timing module measures the necessary waiting period after which NFCT can be activated.
|
||||
* This debouncing technique is used to filter possible field instabilities.
|
||||
*
|
||||
* The application of the implemented workarounds for the nRF52840 chip is determined at runtime and depends
|
||||
* on the chip variant.
|
||||
*
|
||||
* The current code contains a patch for the anomaly 25 (NFCT: Reset value of
|
||||
* SENSRES register is incorrect), so that the module now works on Windows Phone.
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // NRFX_NFCT_H__
|
||||
@@ -117,6 +117,27 @@ extern "C" {
|
||||
*/
|
||||
#define NRFX_ROUNDED_DIV(a, b) (((a) + ((b) / 2)) / (b))
|
||||
|
||||
/**@brief Macro for performing integer division, making sure the result is rounded up.
|
||||
*
|
||||
* @details A typical use case for this macro is to compute the number of objects
|
||||
* with size @c b required to hold @c a number of bytes.
|
||||
*
|
||||
* @param a Numerator.
|
||||
* @param b Denominator.
|
||||
*
|
||||
* @return Integer result of dividing @c a by @c b, rounded up.
|
||||
*/
|
||||
#define NRFX_CEIL_DIV(a, b) ((((a) - 1) / (b)) + 1)
|
||||
|
||||
/**
|
||||
* @brief Macro for getting the number of elements in an array.
|
||||
*
|
||||
* @param array Name of the array.
|
||||
*
|
||||
* @return Array element count.
|
||||
*/
|
||||
#define NRFX_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
|
||||
|
||||
/**@brief Macro for checking if given lengths of EasyDMA transfers do not exceed
|
||||
* the limit of the specified peripheral.
|
||||
*
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#if NRFX_CHECK(NRFX_CLOCK_ENABLED)
|
||||
extern bool nrfx_clock_irq_enabled;
|
||||
extern void nrfx_clock_irq_handler(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -294,4 +295,22 @@ void nrfx_power_irq_handler(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NRFX_CHECK(NRFX_CLOCK_ENABLED)
|
||||
/*
|
||||
* If both POWER and CLOCK drivers are used, a common IRQ handler function must
|
||||
* be used that calls the handlers in these two drivers. This is because these
|
||||
* two peripherals share one interrupt.
|
||||
* This function is located here, not in a separate nrfx_power_clock.c file,
|
||||
* so that it does not end up as the only symbol in a separate object when
|
||||
* a library with nrfx is created. In such case, forcing a linker to use this
|
||||
* function instead of another one defined as weak will require additional
|
||||
* actions, and might be even impossible.
|
||||
*/
|
||||
void nrfx_power_clock_irq_handler(void)
|
||||
{
|
||||
nrfx_power_irq_handler();
|
||||
nrfx_clock_irq_handler();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRFX_CHECK(NRFX_POWER_ENABLED)
|
||||
@@ -0,0 +1,328 @@
|
||||
/*
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <nrfx.h>
|
||||
|
||||
#if NRFX_CHECK(NRFX_QSPI_ENABLED)
|
||||
|
||||
#include <nrfx_qspi.h>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Command byte used to read status register.
|
||||
*
|
||||
*/
|
||||
#define QSPI_STD_CMD_RDSR 0x05
|
||||
|
||||
/**
|
||||
* @brief Byte used to mask status register and retrieve the write-in-progess bit.
|
||||
*
|
||||
*/
|
||||
#define QSPI_MEM_STATUSREG_WIP_Pos 0x01
|
||||
|
||||
/**
|
||||
* @brief Default time used in timeout function.
|
||||
*/
|
||||
#define QSPI_DEF_WAIT_TIME_US 10
|
||||
|
||||
/**
|
||||
* @brief Default number of tries in timeout function.
|
||||
*/
|
||||
#define QSPI_DEF_WAIT_ATTEMPTS 100
|
||||
|
||||
/**
|
||||
* @brief Control block - driver instance local data.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
nrfx_qspi_handler_t handler; /**< Handler. */
|
||||
nrfx_drv_state_t state; /**< Driver state. */
|
||||
volatile bool interrupt_driven; /**< Information if the current operation is performed and is interrupt-driven. */
|
||||
void * p_context; /**< Driver context used in interrupt. */
|
||||
} qspi_control_block_t;
|
||||
|
||||
static qspi_control_block_t m_cb;
|
||||
|
||||
static nrfx_err_t qspi_task_perform(nrf_qspi_task_t task)
|
||||
{
|
||||
// Wait for peripheral
|
||||
if (m_cb.interrupt_driven)
|
||||
{
|
||||
return NRFX_ERROR_BUSY;
|
||||
}
|
||||
|
||||
nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
|
||||
|
||||
if (m_cb.handler)
|
||||
{
|
||||
m_cb.interrupt_driven = true;
|
||||
nrf_qspi_int_enable(NRF_QSPI, NRF_QSPI_INT_READY_MASK);
|
||||
}
|
||||
|
||||
nrf_qspi_task_trigger(NRF_QSPI, task);
|
||||
|
||||
if (m_cb.handler == NULL)
|
||||
{
|
||||
while (!nrf_qspi_event_check(NRF_QSPI, NRF_QSPI_EVENT_READY))
|
||||
{};
|
||||
}
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
static bool qspi_pins_configure(nrf_qspi_pins_t const * p_config)
|
||||
{
|
||||
// Check if the user set meaningful values to struct fields. If not, return false.
|
||||
if ((p_config->sck_pin == NRF_QSPI_PIN_NOT_CONNECTED) ||
|
||||
(p_config->csn_pin == NRF_QSPI_PIN_NOT_CONNECTED) ||
|
||||
(p_config->io0_pin == NRF_QSPI_PIN_NOT_CONNECTED) ||
|
||||
(p_config->io1_pin == NRF_QSPI_PIN_NOT_CONNECTED))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nrf_qspi_pins_set(NRF_QSPI, p_config);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_init(nrfx_qspi_config_t const * p_config,
|
||||
nrfx_qspi_handler_t handler,
|
||||
void * p_context)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
if (m_cb.state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
{
|
||||
return NRFX_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!qspi_pins_configure(&p_config->pins))
|
||||
{
|
||||
return NRFX_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
nrf_qspi_xip_offset_set(NRF_QSPI, p_config->xip_offset);
|
||||
nrf_qspi_ifconfig0_set(NRF_QSPI, &p_config->prot_if);
|
||||
nrf_qspi_ifconfig1_set(NRF_QSPI, &p_config->phy_if);
|
||||
|
||||
m_cb.interrupt_driven = false;
|
||||
m_cb.handler = handler;
|
||||
m_cb.p_context = p_context;
|
||||
|
||||
/* QSPI interrupt is disabled because the device should be enabled in polling mode (wait for activate
|
||||
task event ready)*/
|
||||
nrf_qspi_int_disable(NRF_QSPI, NRF_QSPI_INT_READY_MASK);
|
||||
|
||||
if (handler)
|
||||
{
|
||||
NRFX_IRQ_PRIORITY_SET(QSPI_IRQn, p_config->irq_priority);
|
||||
NRFX_IRQ_ENABLE(QSPI_IRQn);
|
||||
}
|
||||
|
||||
m_cb.state = NRFX_DRV_STATE_INITIALIZED;
|
||||
|
||||
nrf_qspi_enable(NRF_QSPI);
|
||||
|
||||
nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
|
||||
nrf_qspi_task_trigger(NRF_QSPI, NRF_QSPI_TASK_ACTIVATE);
|
||||
|
||||
// Waiting for the peripheral to activate
|
||||
bool result;
|
||||
NRFX_WAIT_FOR(nrf_qspi_event_check(NRF_QSPI, NRF_QSPI_EVENT_READY),
|
||||
QSPI_DEF_WAIT_ATTEMPTS,
|
||||
QSPI_DEF_WAIT_TIME_US,
|
||||
result);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
return NRFX_ERROR_TIMEOUT;
|
||||
}
|
||||
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_cinstr_xfer(nrf_qspi_cinstr_conf_t const * p_config,
|
||||
void const * p_tx_buffer,
|
||||
void * p_rx_buffer)
|
||||
{
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
|
||||
if (m_cb.interrupt_driven)
|
||||
{
|
||||
return NRFX_ERROR_BUSY;
|
||||
}
|
||||
|
||||
nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
|
||||
/* In some cases, only opcode should be sent. To prevent execution, set function code is
|
||||
* surrounded by an if.
|
||||
*/
|
||||
if (p_tx_buffer)
|
||||
{
|
||||
nrf_qspi_cinstrdata_set(NRF_QSPI, p_config->length, p_tx_buffer);
|
||||
}
|
||||
nrf_qspi_int_disable(NRF_QSPI, NRF_QSPI_INT_READY_MASK);
|
||||
|
||||
nrf_qspi_cinstr_transfer_start(NRF_QSPI, p_config);
|
||||
|
||||
bool result;
|
||||
NRFX_WAIT_FOR(nrf_qspi_event_check(NRF_QSPI, NRF_QSPI_EVENT_READY),
|
||||
QSPI_DEF_WAIT_ATTEMPTS,
|
||||
QSPI_DEF_WAIT_TIME_US,
|
||||
result);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
// This timeout should never occur when WIPWAIT is not active, since in this
|
||||
// case the QSPI peripheral should send the command immediately, without any
|
||||
// waiting for previous write to complete.
|
||||
NRFX_ASSERT(p_config->wipwait);
|
||||
|
||||
return NRFX_ERROR_TIMEOUT;
|
||||
}
|
||||
nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
|
||||
nrf_qspi_int_enable(NRF_QSPI, NRF_QSPI_INT_READY_MASK);
|
||||
|
||||
if (p_rx_buffer)
|
||||
{
|
||||
nrf_qspi_cinstrdata_get(NRF_QSPI, p_config->length, p_rx_buffer);
|
||||
}
|
||||
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_cinstr_quick_send(uint8_t opcode,
|
||||
nrf_qspi_cinstr_len_t length,
|
||||
void const * p_tx_buffer)
|
||||
{
|
||||
nrf_qspi_cinstr_conf_t config = NRFX_QSPI_DEFAULT_CINSTR(opcode, length);
|
||||
return nrfx_qspi_cinstr_xfer(&config, p_tx_buffer, NULL);
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_mem_busy_check(void)
|
||||
{
|
||||
nrfx_err_t ret_code;
|
||||
uint8_t status_value = 0;
|
||||
|
||||
nrf_qspi_cinstr_conf_t const config =
|
||||
NRFX_QSPI_DEFAULT_CINSTR(QSPI_STD_CMD_RDSR,
|
||||
NRF_QSPI_CINSTR_LEN_2B);
|
||||
ret_code = nrfx_qspi_cinstr_xfer(&config, &status_value, &status_value);
|
||||
|
||||
if (ret_code != NRFX_SUCCESS)
|
||||
{
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
if ((status_value & QSPI_MEM_STATUSREG_WIP_Pos) != 0x00)
|
||||
{
|
||||
return NRFX_ERROR_BUSY;
|
||||
}
|
||||
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
void nrfx_qspi_uninit(void)
|
||||
{
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
|
||||
nrf_qspi_int_disable(NRF_QSPI, NRF_QSPI_INT_READY_MASK);
|
||||
|
||||
nrf_qspi_task_trigger(NRF_QSPI, NRF_QSPI_TASK_DEACTIVATE);
|
||||
|
||||
// Workaround for nRF52840 anomaly 122: Current consumption is too high.
|
||||
*(volatile uint32_t *)0x40029054ul = 1ul;
|
||||
|
||||
nrf_qspi_disable(NRF_QSPI);
|
||||
|
||||
NRFX_IRQ_DISABLE(QSPI_IRQn);
|
||||
|
||||
nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
|
||||
|
||||
m_cb.state = NRFX_DRV_STATE_UNINITIALIZED;
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_write(void const * p_tx_buffer,
|
||||
size_t tx_buffer_length,
|
||||
uint32_t dst_address)
|
||||
{
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
NRFX_ASSERT(p_tx_buffer != NULL);
|
||||
|
||||
if (!nrfx_is_in_ram(p_tx_buffer))
|
||||
{
|
||||
return NRFX_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
nrf_qspi_write_buffer_set(NRF_QSPI, p_tx_buffer, tx_buffer_length, dst_address);
|
||||
return qspi_task_perform(NRF_QSPI_TASK_WRITESTART);
|
||||
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_read(void * p_rx_buffer,
|
||||
size_t rx_buffer_length,
|
||||
uint32_t src_address)
|
||||
{
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
NRFX_ASSERT(p_rx_buffer != NULL);
|
||||
|
||||
if (!nrfx_is_in_ram(p_rx_buffer))
|
||||
{
|
||||
return NRFX_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
nrf_qspi_read_buffer_set(NRF_QSPI, p_rx_buffer, rx_buffer_length, src_address);
|
||||
return qspi_task_perform(NRF_QSPI_TASK_READSTART);
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_erase(nrf_qspi_erase_len_t length,
|
||||
uint32_t start_address)
|
||||
{
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
nrf_qspi_erase_ptr_set(NRF_QSPI, start_address, length);
|
||||
return qspi_task_perform(NRF_QSPI_TASK_ERASESTART);
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_qspi_chip_erase(void)
|
||||
{
|
||||
return nrfx_qspi_erase(NRF_QSPI_ERASE_LEN_ALL, 0);
|
||||
}
|
||||
|
||||
void nrfx_qspi_irq_handler(void)
|
||||
{
|
||||
// Catch Event ready interrupts
|
||||
if (nrf_qspi_event_check(NRF_QSPI, NRF_QSPI_EVENT_READY))
|
||||
{
|
||||
m_cb.interrupt_driven = false;
|
||||
nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
|
||||
m_cb.handler(NRFX_QSPI_EVENT_DONE, m_cb.p_context);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NRFX_CHECK(NRFX_QSPI_ENABLED)
|
||||
@@ -321,6 +321,15 @@ __STATIC_INLINE nrf_gpio_pin_sense_t nrf_gpio_pin_sense_get(uint32_t pin_number)
|
||||
*/
|
||||
__STATIC_INLINE nrf_gpio_pin_dir_t nrf_gpio_pin_dir_get(uint32_t pin_number);
|
||||
|
||||
/**
|
||||
* @brief Function for reading the pull configuration of a GPIO pin.
|
||||
*
|
||||
* @param pin_number Specifies the pin number to read.
|
||||
*
|
||||
* @retval Pull configuration.
|
||||
*/
|
||||
__STATIC_INLINE nrf_gpio_pin_pull_t nrf_gpio_pin_pull_get(uint32_t pin_number);
|
||||
|
||||
/**
|
||||
* @brief Function for setting output direction on selected pins on a given port.
|
||||
*
|
||||
@@ -683,6 +692,15 @@ __STATIC_INLINE nrf_gpio_pin_dir_t nrf_gpio_pin_dir_get(uint32_t pin_number)
|
||||
}
|
||||
|
||||
|
||||
__STATIC_INLINE nrf_gpio_pin_pull_t nrf_gpio_pin_pull_get(uint32_t pin_number)
|
||||
{
|
||||
NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number);
|
||||
|
||||
return (nrf_gpio_pin_pull_t)((reg->PIN_CNF[pin_number] &
|
||||
GPIO_PIN_CNF_PULL_Msk) >> GPIO_PIN_CNF_PULL_Pos);
|
||||
}
|
||||
|
||||
|
||||
__STATIC_INLINE void nrf_gpio_port_dir_output_set(NRF_GPIO_Type * p_reg, uint32_t out_mask)
|
||||
{
|
||||
p_reg->DIRSET = out_mask;
|
||||
|
||||
@@ -292,6 +292,15 @@ __STATIC_INLINE void nrf_gpiote_task_force(uint32_t idx, nrf_gpiote_outinit_t in
|
||||
*/
|
||||
__STATIC_INLINE void nrf_gpiote_te_default(uint32_t idx);
|
||||
|
||||
/**@brief Function for checking if particular Task-Event is enabled.
|
||||
*
|
||||
* @param[in] idx Task-Event index.
|
||||
*
|
||||
* @retval true If the Task-Event mode is set to Task or Event.
|
||||
* @retval false If the Task-Event mode is set to Disabled.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_gpiote_te_is_enabled(uint32_t idx);
|
||||
|
||||
#ifndef SUPPRESS_INLINE_IMPLEMENTATION
|
||||
__STATIC_INLINE void nrf_gpiote_task_set(nrf_gpiote_tasks_t task)
|
||||
{
|
||||
@@ -408,6 +417,11 @@ __STATIC_INLINE void nrf_gpiote_te_default(uint32_t idx)
|
||||
{
|
||||
NRF_GPIOTE->CONFIG[idx] = 0;
|
||||
}
|
||||
|
||||
__STATIC_INLINE bool nrf_gpiote_te_is_enabled(uint32_t idx)
|
||||
{
|
||||
return (NRF_GPIOTE->CONFIG[idx] & GPIOTE_CONFIG_MODE_Msk) != GPIOTE_CONFIG_MODE_Disabled;
|
||||
}
|
||||
#endif //SUPPRESS_INLINE_IMPLEMENTATION
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -966,19 +966,19 @@ __STATIC_INLINE bool nrf_power_dcdcen_get(void)
|
||||
#if NRF_POWER_HAS_RAMPOWER_REGS
|
||||
__STATIC_INLINE void nrf_power_rampower_mask_on(uint8_t block, uint32_t section_mask)
|
||||
{
|
||||
NRFX_ASSERT(block < ARRAY_SIZE(NRF_POWER->RAM));
|
||||
NRFX_ASSERT(block < NRFX_ARRAY_SIZE(NRF_POWER->RAM));
|
||||
NRF_POWER->RAM[block].POWERSET = section_mask;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_power_rampower_mask_off(uint8_t block, uint32_t section_mask)
|
||||
{
|
||||
NRFX_ASSERT(block < ARRAY_SIZE(NRF_POWER->RAM));
|
||||
NRFX_ASSERT(block < NRFX_ARRAY_SIZE(NRF_POWER->RAM));
|
||||
NRF_POWER->RAM[block].POWERCLR = section_mask;
|
||||
}
|
||||
|
||||
__STATIC_INLINE uint32_t nrf_power_rampower_mask_get(uint8_t block)
|
||||
{
|
||||
NRFX_ASSERT(block < ARRAY_SIZE(NRF_POWER->RAM));
|
||||
NRFX_ASSERT(block < NRFX_ARRAY_SIZE(NRF_POWER->RAM));
|
||||
return NRF_POWER->RAM[block].POWER;
|
||||
}
|
||||
#endif /* NRF_POWER_HAS_RAMPOWER_REGS */
|
||||
|
||||
@@ -214,6 +214,25 @@ __STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t eep,
|
||||
uint32_t tep);
|
||||
|
||||
/**
|
||||
* @brief Function for setting up the event endpoint for a given PPI channel.
|
||||
*
|
||||
* @param[in] eep Event register address.
|
||||
* @param[in] channel Channel to which the given endpoint is assigned.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_event_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t eep);
|
||||
|
||||
/**
|
||||
* @brief Function for setting up the task endpoint for a given PPI channel.
|
||||
*
|
||||
* @param[in] tep Task register address.
|
||||
* @param[in] channel Channel to which the given endpoint is assigned.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_task_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t tep);
|
||||
|
||||
|
||||
#if defined(PPI_FEATURE_FORKS_PRESENT) || defined(__NRFX_DOXYGEN__)
|
||||
/**
|
||||
* @brief Function for setting up task endpoint for a given PPI fork.
|
||||
@@ -392,6 +411,18 @@ __STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
NRF_PPI->CH[(uint32_t) channel].TEP = tep;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_event_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t eep)
|
||||
{
|
||||
NRF_PPI->CH[(uint32_t) channel].EEP = eep;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_task_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t tep)
|
||||
{
|
||||
NRF_PPI->CH[(uint32_t) channel].TEP = tep;
|
||||
}
|
||||
|
||||
#if defined(PPI_FEATURE_FORKS_PRESENT)
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_fork_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
|
||||
@@ -44,6 +44,13 @@ extern "C" {
|
||||
* @brief Hardware access layer for managing the Quadrature Decoder (QDEC) peripheral.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This value can be provided as a parameter for the @ref nrf_qdec_pio_assign
|
||||
* function call to specify that a LED signal shall not be use by the QDEC and
|
||||
* connected to a physical pin.
|
||||
*/
|
||||
#define NRF_QDEC_LED_NOT_CONNECTED 0xFFFFFFFF
|
||||
|
||||
/**
|
||||
* @enum nrf_qdec_task_t
|
||||
* @brief QDEC tasks.
|
||||
|
||||
@@ -635,6 +635,20 @@ __STATIC_INLINE void nrf_saadc_channel_init(uint8_t
|
||||
nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function for configuring the burst mode for the specified channel.
|
||||
*
|
||||
* @param[in] channel Channel number.
|
||||
* @param[in] burst Burst mode setting.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_saadc_burst_set(uint8_t channel,
|
||||
nrf_saadc_burst_t burst)
|
||||
{
|
||||
NRF_SAADC->CH[channel].CONFIG =
|
||||
(NRF_SAADC->CH[channel].CONFIG & ~SAADC_CH_CONFIG_BURST_Msk) |
|
||||
(burst << SAADC_CH_CONFIG_BURST_Pos);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -531,11 +531,11 @@ void nrf_usbd_int_disable(uint32_t int_mask)
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRF_USBD_EVENTCAUSE_ISOOUTCRC_MASK = USBD_EVENTCAUSE_ISOOUTCRC_Msk, /**< CRC error was detected on isochronous OUT endpoint 8. */
|
||||
NRF_USBD_EVENTCAUSE_SUSPEND_MASK = USBD_EVENTCAUSE_SUSPEND_Msk , /**< Signals that the USB lines have been seen idle long enough for the device to enter suspend. */
|
||||
NRF_USBD_EVENTCAUSE_RESUME_MASK = USBD_EVENTCAUSE_RESUME_Msk , /**< Signals that a RESUME condition (K state or activity restart) has been detected on the USB lines. */
|
||||
NRF_USBD_EVENTCAUSE_READY_MASK = USBD_EVENTCAUSE_READY_Msk, /**< MAC is ready for normal operation, rised few us after USBD enabling */
|
||||
NRF_USBD_EVENTCAUSE_WUREQ_MASK = (1U << 10) /**< The USBD peripheral has exited Low Power mode */
|
||||
NRF_USBD_EVENTCAUSE_ISOOUTCRC_MASK = USBD_EVENTCAUSE_ISOOUTCRC_Msk, /**< CRC error was detected on isochronous OUT endpoint 8. */
|
||||
NRF_USBD_EVENTCAUSE_SUSPEND_MASK = USBD_EVENTCAUSE_SUSPEND_Msk, /**< Signals that the USB lines have been seen idle long enough for the device to enter suspend. */
|
||||
NRF_USBD_EVENTCAUSE_RESUME_MASK = USBD_EVENTCAUSE_RESUME_Msk, /**< Signals that a RESUME condition (K state or activity restart) has been detected on the USB lines. */
|
||||
NRF_USBD_EVENTCAUSE_WUREQ_MASK = USBD_EVENTCAUSE_USBWUALLOWED_Msk, /**< The USBD peripheral has exited Low Power mode */
|
||||
NRF_USBD_EVENTCAUSE_READY_MASK = USBD_EVENTCAUSE_READY_Msk, /**< MAC is ready for normal operation, rised few us after USBD enabling */
|
||||
}nrf_usbd_eventcause_mask_t;
|
||||
|
||||
/**
|
||||
@@ -613,8 +613,8 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRF_USBD_ISOSPLIT_OneDir = USBD_ISOSPLIT_SPLIT_OneDir, /**< Full buffer dedicated to either iso IN or OUT */
|
||||
NRF_USBD_ISOSPLIT_Half = USBD_ISOSPLIT_SPLIT_HalfIN, /**< Buffer divided in half */
|
||||
NRF_USBD_ISOSPLIT_ONEDIR = USBD_ISOSPLIT_SPLIT_OneDir, /**< Full buffer dedicated to either iso IN or OUT */
|
||||
NRF_USBD_ISOSPLIT_HALF = USBD_ISOSPLIT_SPLIT_HalfIN, /**< Buffer divided in half */
|
||||
}nrf_usbd_isosplit_t;
|
||||
|
||||
/**
|
||||
@@ -1046,12 +1046,12 @@ uint32_t nrf_usbd_haltedep(uint8_t ep)
|
||||
uint8_t epnr = NRF_USBD_EP_NR_GET(ep);
|
||||
if (NRF_USBD_EPIN_CHECK(ep))
|
||||
{
|
||||
NRFX_ASSERT(epnr < ARRAY_SIZE(NRF_USBD->HALTED.EPIN));
|
||||
NRFX_ASSERT(epnr < NRFX_ARRAY_SIZE(NRF_USBD->HALTED.EPIN));
|
||||
return NRF_USBD->HALTED.EPIN[epnr];
|
||||
}
|
||||
else
|
||||
{
|
||||
NRFX_ASSERT(epnr < ARRAY_SIZE(NRF_USBD->HALTED.EPOUT));
|
||||
NRFX_ASSERT(epnr < NRFX_ARRAY_SIZE(NRF_USBD->HALTED.EPOUT));
|
||||
return NRF_USBD->HALTED.EPOUT[epnr];
|
||||
}
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ size_t nrf_usbd_epout_size_get(uint8_t ep)
|
||||
return size_isoout;
|
||||
}
|
||||
|
||||
NRFX_ASSERT(NRF_USBD_EP_NR_GET(ep) < ARRAY_SIZE(NRF_USBD->SIZE.EPOUT));
|
||||
NRFX_ASSERT(NRF_USBD_EP_NR_GET(ep) < NRFX_ARRAY_SIZE(NRF_USBD->SIZE.EPOUT));
|
||||
return NRF_USBD->SIZE.EPOUT[NRF_USBD_EP_NR_GET(ep)];
|
||||
}
|
||||
|
||||
@@ -1169,7 +1169,7 @@ size_t nrf_usbd_episoout_size_get(uint8_t ep)
|
||||
|
||||
void nrf_usbd_epout_clear(uint8_t ep)
|
||||
{
|
||||
NRFX_ASSERT(NRF_USBD_EPOUT_CHECK(ep) && (NRF_USBD_EP_NR_GET(ep) < ARRAY_SIZE(NRF_USBD->SIZE.EPOUT)));
|
||||
NRFX_ASSERT(NRF_USBD_EPOUT_CHECK(ep) && (NRF_USBD_EP_NR_GET(ep) < NRFX_ARRAY_SIZE(NRF_USBD->SIZE.EPOUT)));
|
||||
NRF_USBD->SIZE.EPOUT[NRF_USBD_EP_NR_GET(ep)] = 0;
|
||||
__ISB();
|
||||
__DSB();
|
||||
@@ -1346,7 +1346,7 @@ void nrf_usbd_ep_easydma_set(uint8_t ep, uint32_t ptr, uint32_t maxcnt)
|
||||
else
|
||||
{
|
||||
uint8_t epnr = NRF_USBD_EP_NR_GET(ep);
|
||||
NRFX_ASSERT(epnr < ARRAY_SIZE(NRF_USBD->EPIN));
|
||||
NRFX_ASSERT(epnr < NRFX_ARRAY_SIZE(NRF_USBD->EPIN));
|
||||
NRF_USBD->EPIN[epnr].PTR = ptr;
|
||||
NRF_USBD->EPIN[epnr].MAXCNT = maxcnt;
|
||||
}
|
||||
@@ -1361,7 +1361,7 @@ void nrf_usbd_ep_easydma_set(uint8_t ep, uint32_t ptr, uint32_t maxcnt)
|
||||
else
|
||||
{
|
||||
uint8_t epnr = NRF_USBD_EP_NR_GET(ep);
|
||||
NRFX_ASSERT(epnr < ARRAY_SIZE(NRF_USBD->EPOUT));
|
||||
NRFX_ASSERT(epnr < NRFX_ARRAY_SIZE(NRF_USBD->EPOUT));
|
||||
NRF_USBD->EPOUT[epnr].PTR = ptr;
|
||||
NRF_USBD->EPOUT[epnr].MAXCNT = maxcnt;
|
||||
}
|
||||
@@ -1381,7 +1381,7 @@ uint32_t nrf_usbd_ep_amount_get(uint8_t ep)
|
||||
else
|
||||
{
|
||||
uint8_t epnr = NRF_USBD_EP_NR_GET(ep);
|
||||
NRFX_ASSERT(epnr < ARRAY_SIZE(NRF_USBD->EPOUT));
|
||||
NRFX_ASSERT(epnr < NRFX_ARRAY_SIZE(NRF_USBD->EPOUT));
|
||||
ret = NRF_USBD->EPIN[epnr].AMOUNT;
|
||||
}
|
||||
}
|
||||
@@ -1394,7 +1394,7 @@ uint32_t nrf_usbd_ep_amount_get(uint8_t ep)
|
||||
else
|
||||
{
|
||||
uint8_t epnr = NRF_USBD_EP_NR_GET(ep);
|
||||
NRFX_ASSERT(epnr < ARRAY_SIZE(NRF_USBD->EPOUT));
|
||||
NRFX_ASSERT(epnr < NRFX_ARRAY_SIZE(NRF_USBD->EPOUT));
|
||||
ret = NRF_USBD->EPOUT[epnr].AMOUNT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// NFCT_IRQn
|
||||
#define nrfx_nfct_irq_handler NFCT_IRQHandler
|
||||
|
||||
// GPIOTE_IRQn
|
||||
#define nrfx_gpiote_irq_handler GPIOTE_IRQHandler
|
||||
|
||||
@@ -75,6 +75,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// NFCT_IRQn
|
||||
#define nrfx_nfct_irq_handler NFCT_IRQHandler
|
||||
|
||||
// GPIOTE_IRQn
|
||||
#define nrfx_gpiote_irq_handler GPIOTE_IRQHandler
|
||||
@@ -176,6 +177,7 @@ extern "C" {
|
||||
// FPU_IRQn
|
||||
|
||||
// USBD_IRQn
|
||||
#define nrfx_usbd_irq_handler USBD_IRQHandler
|
||||
|
||||
// UARTE1_IRQn
|
||||
#define nrfx_uarte_1_irq_handler UARTE1_IRQHandler
|
||||
|
||||
Reference in new issue
Block a user