ext: hal: nordic: Update nrfx to version 1.0.0
Updates nrfx to the recently released version and adjusts its glue layer accordingly. License headers are slightly corrected to match the license text at https://opensource.org/licenses/BSD-3-Clause. Deprecated MDK files nrf51xxx_peripherals.h are removed, since they are replaced by a common file named nrf51_peripherals.h. Origin: nrfx License: BSD 3-Clause URL: https://github.com/NordicSemiconductor/nrfx/tree/v1.0.0 commit: cf78ebfea1719d85cf4018fe6c08cc73fe5ec719 Purpose: Provide peripheral drivers for Nordic SoCs Maintained-by: External Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
ad24576501
commit
3dd8b903d2
138 changed files with 5480 additions and 3864 deletions
|
@ -2,10 +2,10 @@ nrfx
|
|||
####
|
||||
|
||||
Origin:
|
||||
https://github.com/NordicSemiconductor/nrfx/tree/v0.8.0
|
||||
https://github.com/NordicSemiconductor/nrfx/tree/v1.0.0
|
||||
|
||||
Status:
|
||||
v0.8.0
|
||||
v1.0.0
|
||||
|
||||
Purpose:
|
||||
With added proper shims adapting it to Zephyr's APIs, nrfx will provide
|
||||
|
@ -28,7 +28,7 @@ URL:
|
|||
https://github.com/NordicSemiconductor/nrfx
|
||||
|
||||
commit:
|
||||
b7cfe970b45ad7cc9c36b62ee620508e9e2c7fb5
|
||||
cf78ebfea1719d85cf4018fe6c08cc73fe5ec719
|
||||
|
||||
Maintained-by:
|
||||
External
|
||||
|
@ -37,4 +37,4 @@ License:
|
|||
BSD-3-Clause
|
||||
|
||||
License Link:
|
||||
https://github.com/NordicSemiconductor/nrfx/blob/master/LICENSE
|
||||
https://github.com/NordicSemiconductor/nrfx/blob/v1.0.0/LICENSE
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -55,14 +55,12 @@ typedef enum
|
|||
NRFX_ADC_EVT_SAMPLE, ///< Event generated when the requested channel is sampled.
|
||||
} nrfx_adc_evt_type_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Analog-to-digital converter driver DONE event.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
nrf_adc_value_t * p_buffer; ///< Pointer to buffer with converted samples.
|
||||
nrf_adc_value_t * p_buffer; ///< Pointer to the buffer with converted samples.
|
||||
uint16_t size; ///< Number of samples in the buffer.
|
||||
} nrfx_adc_done_evt_t;
|
||||
|
||||
|
@ -89,27 +87,16 @@ typedef struct
|
|||
|
||||
/**@brief Macro for initializing the ADC channel with the default configuration. */
|
||||
#define NRFX_ADC_DEFAULT_CHANNEL(analog_input) \
|
||||
{{{ \
|
||||
{ \
|
||||
NULL, \
|
||||
{ \
|
||||
.resolution = NRF_ADC_CONFIG_RES_10BIT, \
|
||||
.input = NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE, \
|
||||
.scaling = NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE, \
|
||||
.reference = NRF_ADC_CONFIG_REF_VBG, \
|
||||
.ain = (analog_input) \
|
||||
}}, NULL}
|
||||
|
||||
/**
|
||||
* @brief ADC channel configuration.
|
||||
*
|
||||
* @note The bit fields reflect bit fields in the ADC CONFIG register.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t resolution :2; ///< 8 - 10 bit resolution.
|
||||
uint32_t input :3; ///< Input selection and scaling.
|
||||
uint32_t reference :2; ///< Reference source.
|
||||
uint32_t reserved :1; ///< Unused bit fields.
|
||||
uint32_t ain :8; ///< Analog input.
|
||||
uint32_t external_reference:2; ///< Eternal reference source.
|
||||
}nrfx_adc_channel_config_t;
|
||||
.input = (analog_input), \
|
||||
.extref = NRF_ADC_CONFIG_EXTREFSEL_NONE \
|
||||
} \
|
||||
}
|
||||
|
||||
// Forward declaration of the nrfx_adc_channel_t type.
|
||||
typedef struct nrfx_adc_channel_s nrfx_adc_channel_t;
|
||||
|
@ -122,12 +109,8 @@ typedef struct nrfx_adc_channel_s nrfx_adc_channel_t;
|
|||
*/
|
||||
struct nrfx_adc_channel_s
|
||||
{
|
||||
union
|
||||
{
|
||||
nrfx_adc_channel_config_t config; ///< Channel configuration.
|
||||
uint32_t data; ///< Raw value.
|
||||
} config;
|
||||
nrfx_adc_channel_t * p_next; ///< Pointer to the next enabled channel (for internal use).
|
||||
nrf_adc_config_t config; ///< ADC configuration for the current channel.
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -182,8 +165,7 @@ void nrfx_adc_uninit(void);
|
|||
* called, all channels that have been enabled with this function are sampled.
|
||||
*
|
||||
* @note The channel instance variable @p p_channel is used by the driver as an item
|
||||
* in a list. Therefore, it cannot be an automatic variable, and an assertion fails if it is
|
||||
* an automatic variable (if asserts are enabled).
|
||||
* in a list. Therefore, it cannot be an automatic variable that is located on the stack.
|
||||
*/
|
||||
void nrfx_adc_channel_enable(nrfx_adc_channel_t * const p_channel);
|
||||
|
||||
|
@ -206,7 +188,7 @@ void nrfx_adc_sample(void);
|
|||
* This function selects the desired input and starts a single conversion. If a valid pointer
|
||||
* is provided for the result, the function blocks until the conversion is completed. Otherwise, the
|
||||
* function returns when the conversion is started, and the result is provided in an event (driver
|
||||
* must be initialized in non-blocking mode otherwise an assertion will fail). The function will
|
||||
* must be initialized in non-blocking mode, otherwise an assertion will fail). The function will
|
||||
* fail if ADC is busy. The channel does not need to be enabled to perform a single conversion.
|
||||
*
|
||||
* @param[in] p_channel Channel.
|
||||
|
@ -236,6 +218,7 @@ nrfx_err_t nrfx_adc_sample_convert(nrfx_adc_channel_t const * const p_channel,
|
|||
* a single START task will trigger conversion on all enabled channels. For example:
|
||||
* If 3 channels are enabled and the user requests 6 samples, the completion event
|
||||
* handler will be called after 2 START tasks.
|
||||
*
|
||||
* @note The application must adjust the sampling frequency. The maximum frequency
|
||||
* depends on the sampling timer and the maximum latency of the ADC interrupt. If
|
||||
* an interrupt is not handled before the next sampling is triggered, the sample
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -70,6 +70,9 @@ typedef void (*nrfx_clock_event_handler_t)(nrfx_clock_evt_type_t event);
|
|||
*
|
||||
* After initialization, the module is in power off state (clocks are not started).
|
||||
*
|
||||
* @param[in] event_handler Event handler provided by the user.
|
||||
* Must not be NULL.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the procedure was successful.
|
||||
* @retval NRFX_ERROR_ALREADY_INITIALIZED If the driver was already initialized.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -136,11 +136,14 @@ typedef struct
|
|||
* To start the driver, call the function @ref nrfx_comp_start() after initialization.
|
||||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] event_handler Handler function.
|
||||
* @param[in] event_handler Event handler provided by the user.
|
||||
* Must not be NULL.
|
||||
*
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If the configuration is invalid.
|
||||
* @retval NRFX_SUCCESS If initialization was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the driver has already been initialized.
|
||||
* @retval NRFX_ERROR_BUSY If the LPCOMP driver is initialized.
|
||||
* @retval NRFX_ERROR_BUSY If the LPCOMP peripheral is already in use.
|
||||
* This is possible only if @ref nrfx_prs module
|
||||
* is enabled.
|
||||
*/
|
||||
nrfx_err_t nrfx_comp_init(nrfx_comp_config_t const * p_config,
|
||||
nrfx_comp_event_handler_t event_handler);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -52,8 +52,9 @@ typedef struct
|
|||
{
|
||||
nrf_gpiote_polarity_t sense; /**< Transition that triggers interrupt. */
|
||||
nrf_gpio_pin_pull_t pull; /**< Pulling mode. */
|
||||
bool is_watcher; /**< True when the input pin is tracking an output pin. */
|
||||
bool hi_accuracy;/**< True when high accuracy (IN_EVENT) is used. */
|
||||
bool is_watcher : 1; /**< True when the input pin is tracking an output pin. */
|
||||
bool hi_accuracy : 1; /**< True when high accuracy (IN_EVENT) is used. */
|
||||
bool skip_gpio_setup : 1; /**< Do not change GPIO configuration */
|
||||
} nrfx_gpiote_in_config_t;
|
||||
|
||||
/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition.
|
||||
|
@ -86,6 +87,43 @@ typedef struct
|
|||
.sense = NRF_GPIOTE_POLARITY_TOGGLE, \
|
||||
}
|
||||
|
||||
/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition.
|
||||
* @details Set hi_accu to true to use IN_EVENT.
|
||||
* @note This macro prepares configuration that skips GPIO setup. */
|
||||
#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_LOTOHI(hi_accu) \
|
||||
{ \
|
||||
.is_watcher = false, \
|
||||
.hi_accuracy = hi_accu, \
|
||||
.pull = NRF_GPIO_PIN_NOPULL, \
|
||||
.sense = NRF_GPIOTE_POLARITY_LOTOHI, \
|
||||
.skip_gpio_setup = true, \
|
||||
}
|
||||
|
||||
/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect high-to-low transition.
|
||||
* @details Set hi_accu to true to use IN_EVENT.
|
||||
* @note This macro prepares configuration that skips GPIO setup. */
|
||||
#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_HITOLO(hi_accu) \
|
||||
{ \
|
||||
.is_watcher = false, \
|
||||
.hi_accuracy = hi_accu, \
|
||||
.pull = NRF_GPIO_PIN_NOPULL, \
|
||||
.sense = NRF_GPIOTE_POLARITY_HITOLO, \
|
||||
.skip_gpio_setup = true, \
|
||||
}
|
||||
|
||||
/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect any change on the pin.
|
||||
* @details Set hi_accu to true to use IN_EVENT.
|
||||
* @note This macro prepares configuration that skips GPIO setup. */
|
||||
#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_TOGGLE(hi_accu) \
|
||||
{ \
|
||||
.is_watcher = false, \
|
||||
.hi_accuracy = hi_accu, \
|
||||
.pull = NRF_GPIO_PIN_NOPULL, \
|
||||
.sense = NRF_GPIOTE_POLARITY_TOGGLE, \
|
||||
.skip_gpio_setup = true, \
|
||||
}
|
||||
|
||||
|
||||
/**@brief Output pin configuration. */
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -54,21 +54,7 @@ extern "C" {
|
|||
*/
|
||||
#define NRFX_I2S_PIN_NOT_USED 0xFF
|
||||
|
||||
/**
|
||||
* @brief Flag indicating that calls to the data handler for RX and TX should
|
||||
* be synchronized, thus always combined into one call.
|
||||
*
|
||||
* Use this flag when calling @ref nrfx_i2s_start to force a common call
|
||||
* to the @ref nrfx_i2s_data_handler_t "data handler" for RX and TX data.
|
||||
* This is useful, for example, when received data should be processed and
|
||||
* then be sent back. Obviously, this flag is only applicable when both
|
||||
* directions (RX and TX) are enabled.
|
||||
*/
|
||||
#define NRFX_I2S_FLAG_SYNCHRONIZED_MODE 0x01
|
||||
|
||||
/**
|
||||
* @brief I2S driver configuration structure.
|
||||
*/
|
||||
/** @brief I2S driver configuration structure. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t sck_pin; ///< SCK pin number.
|
||||
|
@ -93,6 +79,13 @@ typedef struct
|
|||
nrf_i2s_ratio_t ratio; ///< MCK/LRCK ratio.
|
||||
} nrfx_i2s_config_t;
|
||||
|
||||
/** @brief I2S driver buffers structure. */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t * p_rx_buffer;
|
||||
uint32_t const * p_tx_buffer;
|
||||
} nrfx_i2s_buffers_t;
|
||||
|
||||
/**
|
||||
* @brief I2S driver default configuration.
|
||||
*/
|
||||
|
@ -113,38 +106,53 @@ typedef struct
|
|||
.ratio = (nrf_i2s_ratio_t)NRFX_I2S_CONFIG_RATIO, \
|
||||
}
|
||||
|
||||
|
||||
#define NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED (1UL << 0)
|
||||
/**< The application should provide buffers that are to be used in the next
|
||||
* part of the transfer. A call to @ref nrfx_i2s_next_buffers_set should
|
||||
* be done before the currently used buffers are completely processed
|
||||
* (i.e. the time remaining for supplying the next buffers depends on
|
||||
* the used size of the buffers). */
|
||||
|
||||
/**
|
||||
* @brief I2S driver data handler type.
|
||||
*
|
||||
* A data handling function of this type must be specified during initialization
|
||||
* of the driver. The driver will call this function when a new portion of data
|
||||
* is received or a new portion of data should be prepared for transmission.
|
||||
* The first case is indicated by a non-NULL value in the @p p_data_received
|
||||
* parameter (which points to the memory containing the received data).
|
||||
* Similarly, the second case is indicated by a non-NULL value in the
|
||||
* @p p_data_to_send parameter (which points to where the data to be transmitted
|
||||
* should be placed).
|
||||
* of the driver. The driver will call this function when it finishes using
|
||||
* buffers passed to it by the application, and when it needs to be provided
|
||||
* with buffers for the next part of the transfer.
|
||||
*
|
||||
* @note The two cases mentioned above may be indicated separately or combined
|
||||
* into one call (depending on the environment in which the driver is
|
||||
* used). Therefore, both parameters should be checked and handled
|
||||
* properly in every call. @ref NRFX_I2S_FLAG_SYNCHRONIZED_MODE
|
||||
* "Synchronized mode" can be used to always combine these indications.
|
||||
* @note The @c p_released pointer passed to this function is temporary and
|
||||
* will be invalid after the function returns, hence it cannot be stored
|
||||
* and used later. If needed, the pointed content (i.e. buffers pointers)
|
||||
* should be copied instead.
|
||||
*
|
||||
* @param[in] p_data_received Pointer to the buffer with received data,
|
||||
* or NULL if the handler is called to prepare
|
||||
* transmission only.
|
||||
* @param[out] p_data_to_send Pointer to the buffer where data to be sent
|
||||
* should be written, or NULL if the handler is
|
||||
* called for received data only.
|
||||
* @param[in] number_of_words Length of data received and/or to be written
|
||||
* (in 32-bit words). This value is always equal to
|
||||
* half the size of the buffers set by the call
|
||||
* to the @ref nrfx_i2s_start function.
|
||||
* @param[in] p_released Pointer to a structure with pointers to buffers
|
||||
* passed previously to the driver that will no longer
|
||||
* be access by it (they can be now safely released or
|
||||
* used for another purpose, in particular for a next
|
||||
* part of the transfer).
|
||||
* This pointer will be NULL if the application did not
|
||||
* supply the buffers for the next part of the transfer
|
||||
* (via a call to @ref nrfx_i2s_next_buffers_set) since
|
||||
* the previous time the data handler signaled such need.
|
||||
* This means that data corruption occurred (the previous
|
||||
* buffers are used for the second time) and no buffers
|
||||
* can be released at the moment.
|
||||
* Both pointers in this structure are NULL when the
|
||||
* handler is called for the first time after a transfer
|
||||
* is started, because no data has been transferred yet
|
||||
* at this point. In all successive calls the pointers
|
||||
* specify what has been sent (TX) and what has been
|
||||
* received (RX) in the part of transfer that has just
|
||||
* been completed (provided that a given direction is
|
||||
* enabled, see @ref nrfx_i2s_start).
|
||||
* @param[in] status Bit field describing the current status of the transfer.
|
||||
* It can be 0 or a combination of the following flags:
|
||||
* - @ref NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED
|
||||
*/
|
||||
typedef void (* nrfx_i2s_data_handler_t)(uint32_t const * p_data_received,
|
||||
uint32_t * p_data_to_send,
|
||||
uint16_t number_of_words);
|
||||
typedef void (* nrfx_i2s_data_handler_t)(nrfx_i2s_buffers_t const * p_released,
|
||||
uint32_t status);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -161,9 +169,7 @@ typedef void (* nrfx_i2s_data_handler_t)(uint32_t const * p_data_received,
|
|||
nrfx_err_t nrfx_i2s_init(nrfx_i2s_config_t const * p_config,
|
||||
nrfx_i2s_data_handler_t handler);
|
||||
|
||||
/**
|
||||
* @brief Function for uninitializing the I2S driver.
|
||||
*/
|
||||
/** @brief Function for uninitializing the I2S driver. */
|
||||
void nrfx_i2s_uninit(void);
|
||||
|
||||
/**
|
||||
|
@ -182,36 +188,18 @@ void nrfx_i2s_uninit(void);
|
|||
* For a detailed memory mapping for different supported configurations,
|
||||
* see the @linkProductSpecification52.
|
||||
*
|
||||
* The provided buffers are logically divided into two parts of equal size.
|
||||
* One of them is in use by the peripheral (for storing received data or for
|
||||
* getting data to be transmitted, respectively). The other part is provided
|
||||
* to the application via a call to the defined @ref nrfx_i2s_data_handler_t
|
||||
* "data handling function", so that the application can process the received
|
||||
* data or prepare the next portion of data to be sent. The two parts are
|
||||
* swapped every time @p buffer_size/2 data words are received or transmitted.
|
||||
*
|
||||
* Additional options are provided using the @p flags parameter:
|
||||
* - @ref NRFX_I2S_FLAG_SYNCHRONIZED_MODE - the calls to data handler should
|
||||
* be done in a synchronized manner (one common call for TX and RX).
|
||||
* Applicable only when both RX and TX are enabled.
|
||||
*
|
||||
* @attention All data exchange is done in the data handler only. In particular,
|
||||
* no data should be written to the transmit buffer before calling
|
||||
* this function (a proper call to the data handler to get the first
|
||||
* portion of data to be sent will be done before the actual transfer
|
||||
* starts).
|
||||
*
|
||||
* @note Peripherals using EasyDMA (including I2S) require the transfer buffers
|
||||
* to be placed in the Data RAM region. If this condition is not met,
|
||||
* this function will fail with the error code NRFX_ERROR_INVALID_ADDR.
|
||||
*
|
||||
* @param[in] p_rx_buffer Pointer to the receive buffer.
|
||||
* Pass NULL if reception is not required.
|
||||
* @param[in] p_tx_buffer Pointer to the transmit buffer.
|
||||
* Pass NULL if transmission is not required.
|
||||
* @param[in] p_initial_buffers Pointer to a structure specifying the buffers
|
||||
* to be used in the initial part of the transfer
|
||||
* (buffers for all consecutive parts are provided
|
||||
* through the data handler).
|
||||
* @param[in] buffer_size Size of the buffers (in 32-bit words).
|
||||
* The size must be an even number greater than 0.
|
||||
* Must not be 0.
|
||||
* @param[in] flags Transfer options (0 for default settings).
|
||||
* Currently, no additional flags are available.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the operation was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If a transfer was already started or
|
||||
|
@ -219,25 +207,39 @@ void nrfx_i2s_uninit(void);
|
|||
* @retval NRFX_ERROR_INVALID_ADDR If the provided buffers are not placed
|
||||
* in the Data RAM region.
|
||||
*/
|
||||
nrfx_err_t nrfx_i2s_start(uint32_t * p_rx_buffer,
|
||||
uint32_t * p_tx_buffer,
|
||||
nrfx_err_t nrfx_i2s_start(nrfx_i2s_buffers_t const * p_initial_buffers,
|
||||
uint16_t buffer_size,
|
||||
uint8_t flags);
|
||||
|
||||
/**
|
||||
* @brief Function for stopping the I2S transfer.
|
||||
* @brief Function for supplying the buffers to be used in the next part of
|
||||
* the transfer.
|
||||
*
|
||||
* The application should call this function when the data handler receives
|
||||
* @ref NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED in the @c status parameter.
|
||||
* The call can be done immediately from the data handler function or later,
|
||||
* but it has to be done before the I2S peripheral finishes processing the
|
||||
* buffers supplied previously. Otherwise, data corruption will occur.
|
||||
*
|
||||
* @sa nrfx_i2s_data_handler_t
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the operation was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the buffers were already supplied or
|
||||
* the peripheral is currently being stopped.
|
||||
*/
|
||||
nrfx_err_t nrfx_i2s_next_buffers_set(nrfx_i2s_buffers_t const * p_buffers);
|
||||
|
||||
/** @brief Function for stopping the I2S transfer. */
|
||||
void nrfx_i2s_stop(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
void nrfx_i2s_irq_handler(void);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRFX_I2S_H__
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -86,13 +86,15 @@ typedef struct
|
|||
* This function initializes the LPCOMP driver, but does not enable the peripheral or any interrupts.
|
||||
* To start the driver, call the function nrfx_lpcomp_enable() after initialization.
|
||||
*
|
||||
* If no configuration structure is provided, the driver is initialized with the default settings.
|
||||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] event_handler Handler function.
|
||||
* @param[in] event_handler Event handler provided by the user.
|
||||
* Must not be NULL.
|
||||
*
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If the configuration is invalid.
|
||||
* @retval NRFX_SUCCESS If initialization was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the driver has already been initialized.
|
||||
* @retval NRFX_ERROR_BUSY If the COMP peripheral is already in use.
|
||||
* This is possible only if @ref nrfx_prs module
|
||||
* is enabled.
|
||||
*/
|
||||
nrfx_err_t nrfx_lpcomp_init(nrfx_lpcomp_config_t const * p_config,
|
||||
nrfx_lpcomp_event_handler_t event_handler);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -122,7 +122,7 @@ typedef void (*nrfx_pdm_event_handler_t)(nrfx_pdm_evt_t const * const p_evt);
|
|||
*
|
||||
* @retval NRFX_SUCCESS If initialization was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the driver is already initialized.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If specified event handler is NULL.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If invalid configuration was specified.
|
||||
*/
|
||||
nrfx_err_t nrfx_pdm_init(nrfx_pdm_config_t const * p_config,
|
||||
nrfx_pdm_event_handler_t event_handler);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -108,10 +108,10 @@ typedef void (*nrfx_qdec_event_handler_t)(nrfx_qdec_event_t event);
|
|||
/**@brief Function for initializing QDEC.
|
||||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] event_handler Event handler function.
|
||||
* @param[in] event_handler Event handler provided by the user.
|
||||
* Must not be NULL.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If initialization was successful.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If invalid parameters were supplied.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If QDEC was already initialized.
|
||||
*/
|
||||
nrfx_err_t nrfx_qdec_init(nrfx_qdec_config_t const * p_config,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -117,13 +117,25 @@ typedef void (*nrfx_qspi_handler_t)(nrfx_qspi_evt_t event, void * p_context);
|
|||
/**
|
||||
* @brief Function for initializing the QSPI driver instance.
|
||||
*
|
||||
* This function configures the peripheral and its interrupts and activates it. During the
|
||||
* activation process, the internal clocks are started and the QSPI peripheral tries to read
|
||||
* the status byte to read the busy bit. Reading the status byte is done in a simple poll and wait
|
||||
* mechanism.
|
||||
* If the busy bit is 1, this indicates issues with the external memory device. As a result,
|
||||
* @ref nrfx_qspi_init returns NRFX_ERROR_TIMEOUT.
|
||||
*
|
||||
* In case of issues:
|
||||
* - Check the connection.
|
||||
* - Make sure that the memory device does not perform other operations like erasing or writing.
|
||||
* - Check if there is a short circuit.
|
||||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] handler Event handler provided by the user. If NULL, transfers
|
||||
* will be performed in blocking mode.
|
||||
* @param[in] p_context Pointer to context. Use in interrupt handler.
|
||||
*
|
||||
*
|
||||
* @retval NRFX_SUCCESS If initialization was successful.
|
||||
* @retval NRFX_ERROR_TIMEOUT If the peripheral cannot connect with external memory.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the driver was already initialized.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If the pin configuration was incorrect.
|
||||
*/
|
||||
|
@ -241,6 +253,7 @@ nrfx_err_t nrfx_qspi_mem_busy_check(void);
|
|||
* @param[out] p_rx_buffer Pointer to the array for data to receive. Can be NULL if there is nothing to receive.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the operation was successful.
|
||||
* @retval NRFX_ERROR_TIMEOUT If the external memory is busy or there are connection issues.
|
||||
* @retval NRFX_ERROR_BUSY If the driver currently handles other operation.
|
||||
*/
|
||||
nrfx_err_t nrfx_qspi_cinstr_xfer(nrf_qspi_cinstr_conf_t const * p_config,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -78,12 +78,10 @@ typedef void (* nrfx_rng_evt_handler_t)(uint8_t rng_data);
|
|||
* @brief Function for initializing the nrfx_rng module.
|
||||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] handler Event handler provided by the user. Handler is required
|
||||
* to work with the module. NULL value is not supported.
|
||||
* @param[in] handler Event handler provided by the user. Must not be NULL.
|
||||
*
|
||||
* @retval NRFX_SUCCESS Driver was successfully initialized.
|
||||
* @retval NRFX_ERROR_ALREADY_INITIALIZED Driver was already initialized.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM Handler value is NULL.
|
||||
*/
|
||||
nrfx_err_t nrfx_rng_init(nrfx_rng_config_t const * p_config, nrfx_rng_evt_handler_t handler);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -87,9 +87,6 @@ enum {
|
|||
#endif
|
||||
#if NRFX_CHECK(NRFX_RTC2_ENABLED)
|
||||
NRFX_RTC2_INST_IDX,
|
||||
#endif
|
||||
#if NRFX_CHECK(NRFX_RTC3_ENABLED)
|
||||
NRFX_RTC3_INST_IDX,
|
||||
#endif
|
||||
NRFX_RTC_ENABLED_COUNT
|
||||
};
|
||||
|
@ -122,10 +119,10 @@ typedef void (*nrfx_rtc_handler_t)(nrfx_rtc_int_type_t int_type);
|
|||
*
|
||||
* @param[in] p_instance Pointer to the driver instance structure.
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] handler User's event handler.
|
||||
* @param[in] handler Event handler provided by the user.
|
||||
* Must not be NULL.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If successfully initialized.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If no handler was provided.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the instance is already initialized.
|
||||
*/
|
||||
nrfx_err_t nrfx_rtc_init(nrfx_rtc_t const * const p_instance,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -170,10 +170,10 @@ typedef void (* nrfx_saadc_event_handler_t)(nrfx_saadc_evt_t const * p_event);
|
|||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] event_handler Event handler provided by the user.
|
||||
* Must not be NULL.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If initialization was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the driver is already initialized.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If event_handler is NULL.
|
||||
*/
|
||||
nrfx_err_t nrfx_saadc_init(nrfx_saadc_config_t const * p_config,
|
||||
nrfx_saadc_event_handler_t event_handler);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -84,40 +84,6 @@ enum {
|
|||
*/
|
||||
#define NRFX_SPI_PIN_NOT_USED 0xFF
|
||||
|
||||
/**
|
||||
* @brief SPI data rates.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_SPI_FREQ_125K = NRF_SPI_FREQ_125K, ///< 125 kbps.
|
||||
NRFX_SPI_FREQ_250K = NRF_SPI_FREQ_250K, ///< 250 kbps.
|
||||
NRFX_SPI_FREQ_500K = NRF_SPI_FREQ_500K, ///< 500 kbps.
|
||||
NRFX_SPI_FREQ_1M = NRF_SPI_FREQ_1M, ///< 1 Mbps.
|
||||
NRFX_SPI_FREQ_2M = NRF_SPI_FREQ_2M, ///< 2 Mbps.
|
||||
NRFX_SPI_FREQ_4M = NRF_SPI_FREQ_4M, ///< 4 Mbps.
|
||||
NRFX_SPI_FREQ_8M = NRF_SPI_FREQ_8M ///< 8 Mbps.
|
||||
} nrfx_spi_frequency_t;
|
||||
|
||||
/**
|
||||
* @brief SPI modes.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_SPI_MODE_0 = NRF_SPI_MODE_0, ///< SCK active high, sample on leading edge of clock.
|
||||
NRFX_SPI_MODE_1 = NRF_SPI_MODE_1, ///< SCK active high, sample on trailing edge of clock.
|
||||
NRFX_SPI_MODE_2 = NRF_SPI_MODE_2, ///< SCK active low, sample on leading edge of clock.
|
||||
NRFX_SPI_MODE_3 = NRF_SPI_MODE_3 ///< SCK active low, sample on trailing edge of clock.
|
||||
} nrfx_spi_mode_t;
|
||||
|
||||
/**
|
||||
* @brief SPI bit orders.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRFX_SPI_BIT_ORDER_MSB_FIRST = NRF_SPI_BIT_ORDER_MSB_FIRST, ///< Most significant bit shifted out first.
|
||||
NRFX_SPI_BIT_ORDER_LSB_FIRST = NRF_SPI_BIT_ORDER_LSB_FIRST ///< Least significant bit shifted out first.
|
||||
} nrfx_spi_bit_order_t;
|
||||
|
||||
/**
|
||||
* @brief SPI master driver instance configuration structure.
|
||||
*/
|
||||
|
@ -140,9 +106,9 @@ typedef struct
|
|||
uint8_t orc; ///< Over-run character.
|
||||
/**< This character is used when all bytes from the TX buffer are sent,
|
||||
but the transfer continues due to RX. */
|
||||
nrfx_spi_frequency_t frequency; ///< SPI frequency.
|
||||
nrfx_spi_mode_t mode; ///< SPI mode.
|
||||
nrfx_spi_bit_order_t bit_order; ///< SPI bit order.
|
||||
nrf_spi_frequency_t frequency; ///< SPI frequency.
|
||||
nrf_spi_mode_t mode; ///< SPI mode.
|
||||
nrf_spi_bit_order_t bit_order; ///< SPI bit order.
|
||||
} nrfx_spi_config_t;
|
||||
|
||||
/**
|
||||
|
@ -156,9 +122,9 @@ typedef struct
|
|||
.ss_pin = NRFX_SPI_PIN_NOT_USED, \
|
||||
.irq_priority = NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY, \
|
||||
.orc = 0xFF, \
|
||||
.frequency = NRFX_SPI_FREQ_4M, \
|
||||
.mode = NRFX_SPI_MODE_0, \
|
||||
.bit_order = NRFX_SPI_BIT_ORDER_MSB_FIRST, \
|
||||
.frequency = NRF_SPI_FREQ_4M, \
|
||||
.mode = NRF_SPI_MODE_0, \
|
||||
.bit_order = NRF_SPI_BIT_ORDER_MSB_FIRST, \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -47,48 +47,6 @@ extern "C" {
|
|||
* @brief SPI Slave peripheral driver.
|
||||
*/
|
||||
|
||||
#define NRFX_SPIS_DEFAULT_CSN_PULLUP NRF_GPIO_PIN_NOPULL /**< Default pull-up configuration of the SPI CS. */
|
||||
#define NRFX_SPIS_DEFAULT_MISO_DRIVE NRF_GPIO_PIN_S0S1 /**< Default drive configuration of the SPI MISO. */
|
||||
|
||||
/**
|
||||
* @brief This value can be provided instead of a pin number for the signals MOSI
|
||||
* and MISO to specify that the given signal is not used and therefore
|
||||
* does not need to be connected to a pin.
|
||||
*/
|
||||
#define NRFX_SPIS_PIN_NOT_USED 0xFF
|
||||
|
||||
/** @brief SPIS transaction bit order definitions. */
|
||||
typedef enum
|
||||
{
|
||||
NRFX_SPIS_BIT_ORDER_LSB_FIRST = NRF_SPIS_BIT_ORDER_LSB_FIRST, /**< Least significant bit shifted out first. */
|
||||
NRFX_SPIS_BIT_ORDER_MSB_FIRST = NRF_SPIS_BIT_ORDER_MSB_FIRST /**< Most significant bit shifted out first. */
|
||||
} nrfx_spis_endian_t;
|
||||
|
||||
/** @brief SPIS mode definitions for clock polarity and phase. */
|
||||
typedef enum
|
||||
{
|
||||
NRFX_SPIS_MODE_0 = NRF_SPIS_MODE_0, /**< (CPOL = 0, CPHA = 0). */
|
||||
NRFX_SPIS_MODE_1 = NRF_SPIS_MODE_1, /**< (CPOL = 0, CPHA = 1). */
|
||||
NRFX_SPIS_MODE_2 = NRF_SPIS_MODE_2, /**< (CPOL = 1, CPHA = 0). */
|
||||
NRFX_SPIS_MODE_3 = NRF_SPIS_MODE_3 /**< (CPOL = 1, CPHA = 1). */
|
||||
} nrfx_spis_mode_t;
|
||||
|
||||
/** @brief Event callback function event definitions. */
|
||||
typedef enum
|
||||
{
|
||||
NRFX_SPIS_BUFFERS_SET_DONE, /**< Memory buffer set event. Memory buffers have been set successfully to the SPI slave device, and SPI transactions can be done. */
|
||||
NRFX_SPIS_XFER_DONE, /**< SPI transaction event. SPI transaction has been completed. */
|
||||
NRFX_SPIS_EVT_TYPE_MAX /**< Enumeration upper bound. */
|
||||
} nrfx_spis_event_type_t;
|
||||
|
||||
/** @brief Structure containing the event context from the SPI slave driver. */
|
||||
typedef struct
|
||||
{
|
||||
nrfx_spis_event_type_t evt_type; //!< Type of event.
|
||||
size_t rx_amount; //!< Number of bytes received in the last transaction. This parameter is only valid for @ref NRFX_SPIS_XFER_DONE events.
|
||||
size_t tx_amount; //!< Number of bytes transmitted in the last transaction. This parameter is only valid for @ref NRFX_SPIS_XFER_DONE events.
|
||||
} nrfx_spis_event_t;
|
||||
|
||||
/** @brief SPI slave driver instance data structure. */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -96,13 +54,6 @@ typedef struct
|
|||
uint8_t drv_inst_idx; //!< Driver instance index.
|
||||
} nrfx_spis_t;
|
||||
|
||||
/** @brief Macro for creating an SPI slave driver instance. */
|
||||
#define NRFX_SPIS_INSTANCE(id) \
|
||||
{ \
|
||||
.p_reg = NRFX_CONCAT_2(NRF_SPIS, id), \
|
||||
.drv_inst_idx = NRFX_CONCAT_3(NRFX_SPIS, id, _INST_IDX), \
|
||||
}
|
||||
|
||||
enum {
|
||||
#if NRFX_CHECK(NRFX_SPIS0_ENABLED)
|
||||
NRFX_SPIS0_INST_IDX,
|
||||
|
@ -116,6 +67,41 @@ enum {
|
|||
NRFX_SPIS_ENABLED_COUNT
|
||||
};
|
||||
|
||||
/** @brief Macro for creating an SPI slave driver instance. */
|
||||
#define NRFX_SPIS_INSTANCE(id) \
|
||||
{ \
|
||||
.p_reg = NRFX_CONCAT_2(NRF_SPIS, id), \
|
||||
.drv_inst_idx = NRFX_CONCAT_3(NRFX_SPIS, id, _INST_IDX), \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This value can be provided instead of a pin number for the signals MOSI
|
||||
* and MISO to specify that the given signal is not used and therefore
|
||||
* does not need to be connected to a pin.
|
||||
*/
|
||||
#define NRFX_SPIS_PIN_NOT_USED 0xFF
|
||||
|
||||
/** @brief Default pull-up configuration of the SPI CS. */
|
||||
#define NRFX_SPIS_DEFAULT_CSN_PULLUP NRF_GPIO_PIN_NOPULL
|
||||
/** @brief Default drive configuration of the SPI MISO. */
|
||||
#define NRFX_SPIS_DEFAULT_MISO_DRIVE NRF_GPIO_PIN_S0S1
|
||||
|
||||
/** @brief SPI slave driver event types. */
|
||||
typedef enum
|
||||
{
|
||||
NRFX_SPIS_BUFFERS_SET_DONE, //!< Memory buffer set event. Memory buffers have been set successfully to the SPI slave device, and SPI transaction can be done.
|
||||
NRFX_SPIS_XFER_DONE, //!< SPI transaction event. SPI transaction has been completed.
|
||||
NRFX_SPIS_EVT_TYPE_MAX //!< Enumeration upper bound.
|
||||
} nrfx_spis_evt_type_t;
|
||||
|
||||
/** @brief SPI slave driver event structure. */
|
||||
typedef struct
|
||||
{
|
||||
nrfx_spis_evt_type_t evt_type; //!< Type of the event.
|
||||
size_t rx_amount; //!< Number of bytes received in the last transaction. This parameter is only valid for @ref NRFX_SPIS_XFER_DONE events.
|
||||
size_t tx_amount; //!< Number of bytes transmitted in the last transaction. This parameter is only valid for @ref NRFX_SPIS_XFER_DONE events.
|
||||
} nrfx_spis_evt_t;
|
||||
|
||||
/** @brief SPI slave instance default configuration. */
|
||||
#define NRFX_SPIS_DEFAULT_CONFIG \
|
||||
{ \
|
||||
|
@ -123,12 +109,12 @@ enum {
|
|||
.mosi_pin = NRFX_SPIS_PIN_NOT_USED, \
|
||||
.miso_pin = NRFX_SPIS_PIN_NOT_USED, \
|
||||
.csn_pin = NRFX_SPIS_PIN_NOT_USED, \
|
||||
.miso_drive = NRFX_SPIS_DEFAULT_MISO_DRIVE, \
|
||||
.mode = NRF_SPIS_MODE_0, \
|
||||
.bit_order = NRF_SPIS_BIT_ORDER_MSB_FIRST, \
|
||||
.csn_pullup = NRFX_SPIS_DEFAULT_CSN_PULLUP, \
|
||||
.orc = NRFX_SPIS_DEFAULT_ORC, \
|
||||
.miso_drive = NRFX_SPIS_DEFAULT_MISO_DRIVE, \
|
||||
.def = NRFX_SPIS_DEFAULT_DEF, \
|
||||
.mode = (nrfx_spis_mode_t)NRFX_SPIS_DEFAULT_MODE, \
|
||||
.bit_order = (nrfx_spis_endian_t)NRFX_SPIS_DEFAULT_BIT_ORDER, \
|
||||
.orc = NRFX_SPIS_DEFAULT_ORC, \
|
||||
.irq_priority = NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY, \
|
||||
}
|
||||
|
||||
|
@ -143,8 +129,8 @@ typedef struct
|
|||
* if this signal is not needed. */
|
||||
uint32_t sck_pin; //!< SPI SCK pin.
|
||||
uint32_t csn_pin; //!< SPI CSN pin.
|
||||
nrfx_spis_mode_t mode; //!< SPI mode.
|
||||
nrfx_spis_endian_t bit_order; //!< SPI transaction bit order.
|
||||
nrf_spis_mode_t mode; //!< SPI mode.
|
||||
nrf_spis_bit_order_t bit_order; //!< SPI transaction bit order.
|
||||
nrf_gpio_pin_pull_t csn_pullup; //!< CSN pin pull-up configuration.
|
||||
nrf_gpio_pin_drive_t miso_drive; //!< MISO pin drive configuration.
|
||||
uint8_t def; //!< Character clocked out in case of an ignored transaction.
|
||||
|
@ -153,13 +139,19 @@ typedef struct
|
|||
} nrfx_spis_config_t;
|
||||
|
||||
|
||||
/** @brief SPI slave event callback function type.
|
||||
/**
|
||||
* @brief SPI slave driver event handler type.
|
||||
*
|
||||
* @param[in] event SPI slave driver event.
|
||||
* @param[in] p_event Pointer to the event structure. The structure is
|
||||
* allocated on the stack so it is valid only until
|
||||
* the event handler returns.
|
||||
* @param[in] p_context Context set on initialization.
|
||||
*/
|
||||
typedef void (*nrfx_spis_event_handler_t)(nrfx_spis_event_t event);
|
||||
typedef void (*nrfx_spis_event_handler_t)(nrfx_spis_evt_t const * p_event,
|
||||
void * p_context);
|
||||
|
||||
/** @brief Function for initializing the SPI slave driver instance.
|
||||
/**
|
||||
* @brief Function for initializing the SPI slave driver instance.
|
||||
*
|
||||
* @note When the nRF52 Anomaly 109 workaround for SPIS is enabled, this function
|
||||
* initializes the GPIOTE driver as well, and uses one of GPIOTE channels
|
||||
|
@ -168,8 +160,11 @@ typedef void (*nrfx_spis_event_handler_t)(nrfx_spis_event_t event);
|
|||
* @param[in] p_instance Pointer to the driver instance structure.
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] event_handler Function to be called by the SPI slave driver upon event.
|
||||
* Must not be NULL.
|
||||
* @param[in] p_context Context passed to the event handler.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the initialization was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the instance is already initialized.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If an invalid parameter is supplied.
|
||||
* @retval NRFX_ERROR_BUSY If some other peripheral with the same
|
||||
* instance ID is already in use. This is
|
||||
|
@ -181,7 +176,8 @@ typedef void (*nrfx_spis_event_handler_t)(nrfx_spis_event_t event);
|
|||
*/
|
||||
nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
||||
nrfx_spis_config_t const * p_config,
|
||||
nrfx_spis_event_handler_t event_handler);
|
||||
nrfx_spis_event_handler_t event_handler,
|
||||
void * p_context);
|
||||
|
||||
/**
|
||||
* @brief Function for uninitializing the SPI slave driver instance.
|
||||
|
@ -190,14 +186,15 @@ nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
|||
*/
|
||||
void nrfx_spis_uninit(nrfx_spis_t const * const p_instance);
|
||||
|
||||
/** @brief Function for preparing the SPI slave instance for a single SPI transaction.
|
||||
/**
|
||||
* @brief Function for preparing the SPI slave instance for a single SPI transaction.
|
||||
*
|
||||
* This function prepares the SPI slave device to be ready for a single SPI transaction. It configures
|
||||
* the SPI slave device to use the memory supplied with the function call in SPI transactions.
|
||||
*
|
||||
* When either the memory buffer configuration or the SPI transaction has been
|
||||
* completed, the event callback function will be called with the appropriate event
|
||||
* @ref nrfx_spis_event_type_t. Note that the callback function can be called before returning from
|
||||
* @ref nrfx_spis_evt_type_t. Note that the callback function can be called before returning from
|
||||
* this function, because it is called from the SPI slave interrupt context.
|
||||
*
|
||||
* @note This function can be called from the callback function context.
|
||||
|
@ -210,13 +207,12 @@ void nrfx_spis_uninit(nrfx_spis_t const * const p_instance);
|
|||
* this function will fail with the error code NRFX_ERROR_INVALID_ADDR.
|
||||
*
|
||||
* @param[in] p_instance Pointer to the driver instance structure.
|
||||
* @param[in] p_tx_buffer Pointer to the TX buffer.
|
||||
* @param[in] p_rx_buffer Pointer to the RX buffer.
|
||||
* @param[in] p_tx_buffer Pointer to the TX buffer. Can be NULL when the buffer length is zero.
|
||||
* @param[in] p_rx_buffer Pointer to the RX buffer. Can be NULL when the buffer length is zero.
|
||||
* @param[in] tx_buffer_length Length of the TX buffer in bytes.
|
||||
* @param[in] rx_buffer_length Length of the RX buffer in bytes.
|
||||
*
|
||||
* @retval NRFX_SUCCESS If the operation was successful.
|
||||
* @retval NRFX_ERROR_NULL If the operation failed because a NULL pointer was supplied.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the operation failed because the SPI slave device is in an incorrect state.
|
||||
* @retval NRFX_ERROR_INVALID_ADDR If the provided buffers are not placed in the Data
|
||||
* RAM region.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -131,7 +131,6 @@ typedef void (* nrfx_timer_event_handler_t)(nrf_timer_event_t event_type,
|
|||
*
|
||||
* @retval NRFX_SUCCESS If initialization was successful.
|
||||
* @retval NRFX_ERROR_INVALID_STATE If the instance is already initialized.
|
||||
* @retval NRFX_ERROR_INVALID_PARAM If no handler was provided.
|
||||
*/
|
||||
nrfx_err_t nrfx_timer_init(nrfx_timer_t const * const p_instance,
|
||||
nrfx_timer_config_t const * p_config,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -70,9 +70,8 @@ typedef nrf_wdt_rr_register_t nrfx_wdt_channel_id;
|
|||
* @brief This function initializes watchdog.
|
||||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* @param[in] wdt_event_handler specifies event handler provided by user.
|
||||
*
|
||||
* @note Function asserts if wdt_event_handler is NULL.
|
||||
* @param[in] wdt_event_handler Event handler provided by the user.
|
||||
* Must not be NULL.
|
||||
*
|
||||
* @return NRFX_SUCCESS on success, otherwise an error code.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -130,6 +130,27 @@ extern "C" {
|
|||
(((length1) < (1U << NRFX_CONCAT_2(peripheral, _EASYDMA_MAXCNT_SIZE))) && \
|
||||
((length2) < (1U << NRFX_CONCAT_2(peripheral, _EASYDMA_MAXCNT_SIZE))))
|
||||
|
||||
/**@brief Macro for waiting until condition is met.
|
||||
*
|
||||
* @param[in] condition Condition to meet.
|
||||
* @param[in] attempts Maximum number of condition checks. Must not be 0.
|
||||
* @param[in] delay_us Delay between consecutive checks, in microseconds.
|
||||
* @param[out] result Boolean variable to store the result of the wait process.
|
||||
* Set to true if the condition is met or false otherwise.
|
||||
*/
|
||||
#define NRFX_WAIT_FOR(condition, attempts, delay_us, result) \
|
||||
do { \
|
||||
result = false; \
|
||||
uint32_t remaining_attempts = (attempts); \
|
||||
do { \
|
||||
if (condition) \
|
||||
{ \
|
||||
result = true; \
|
||||
break; \
|
||||
} \
|
||||
NRFX_DELAY_US(delay_us); \
|
||||
} while (--remaining_attempts); \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
* @brief IRQ handler type.
|
||||
|
@ -202,6 +223,7 @@ __STATIC_INLINE uint32_t nrfx_bitpos_to_event(uint32_t bit);
|
|||
*/
|
||||
__STATIC_INLINE uint32_t nrfx_event_to_bitpos(uint32_t event);
|
||||
|
||||
|
||||
#ifndef SUPPRESS_INLINE_IMPLEMENTATION
|
||||
|
||||
__STATIC_INLINE bool nrfx_is_in_ram(void const * p_object)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -42,7 +42,7 @@
|
|||
* @brief Global error codes definitions.
|
||||
*/
|
||||
|
||||
#define NRFX_ERROR_BASE_NUM 0xBAD00000
|
||||
#define NRFX_ERROR_BASE_NUM 0x0BAD0000
|
||||
#define NRFX_ERROR_DRIVERS_BASE_NUM (NRFX_ERROR_BASE_NUM + 0x10000)
|
||||
|
||||
/** @brief Enumerated type for error codes. */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -46,8 +46,8 @@ typedef struct
|
|||
nrfx_adc_channel_t * p_head;
|
||||
nrfx_adc_channel_t * p_current_conv;
|
||||
nrf_adc_value_t * p_buffer;
|
||||
uint8_t size;
|
||||
uint8_t idx;
|
||||
uint16_t size;
|
||||
uint16_t idx;
|
||||
nrfx_drv_state_t state;
|
||||
} adc_cb_t;
|
||||
|
||||
|
@ -94,7 +94,6 @@ void nrfx_adc_uninit(void)
|
|||
|
||||
void nrfx_adc_channel_enable(nrfx_adc_channel_t * const p_channel)
|
||||
{
|
||||
NRFX_ASSERT(!is_address_from_stack(p_channel));
|
||||
NRFX_ASSERT(!nrfx_adc_is_busy());
|
||||
|
||||
p_channel->p_next = NULL;
|
||||
|
@ -144,8 +143,8 @@ void nrfx_adc_channel_disable(nrfx_adc_channel_t * const p_channel)
|
|||
void nrfx_adc_sample(void)
|
||||
{
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
NRFX_ASSERT(!nrf_adc_is_busy());
|
||||
nrf_adc_start();
|
||||
NRFX_ASSERT(!nrf_adc_busy_check());
|
||||
nrf_adc_task_trigger(NRF_ADC_TASK_START);
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_adc_sample_convert(nrfx_adc_channel_t const * const p_channel,
|
||||
|
@ -166,10 +165,10 @@ nrfx_err_t nrfx_adc_sample_convert(nrfx_adc_channel_t const * const p_channel,
|
|||
{
|
||||
m_cb.state = NRFX_DRV_STATE_POWERED_ON;
|
||||
|
||||
nrf_adc_config_set(p_channel->config.data);
|
||||
nrf_adc_init(&p_channel->config);
|
||||
nrf_adc_enable();
|
||||
nrf_adc_int_disable(NRF_ADC_INT_END_MASK);
|
||||
nrf_adc_start();
|
||||
nrf_adc_task_trigger(NRF_ADC_TASK_START);
|
||||
if (p_value)
|
||||
{
|
||||
while (!nrf_adc_event_check(NRF_ADC_EVENT_END)) {}
|
||||
|
@ -211,11 +210,10 @@ static bool adc_sample_process()
|
|||
m_cb.p_current_conv = m_cb.p_current_conv->p_next;
|
||||
task_trigger = true;
|
||||
}
|
||||
nrf_adc_config_set(m_cb.p_current_conv->config.data);
|
||||
nrf_adc_init(&m_cb.p_current_conv->config);
|
||||
nrf_adc_enable();
|
||||
if (task_trigger)
|
||||
{
|
||||
//nrf_adc_start();
|
||||
nrf_adc_task_trigger(NRF_ADC_TASK_START);
|
||||
}
|
||||
return false;
|
||||
|
@ -249,7 +247,7 @@ nrfx_err_t nrfx_adc_buffer_convert(nrf_adc_value_t * buffer, uint16_t size)
|
|||
m_cb.size = size;
|
||||
m_cb.idx = 0;
|
||||
m_cb.p_buffer = buffer;
|
||||
nrf_adc_config_set(m_cb.p_current_conv->config.data);
|
||||
nrf_adc_init(&m_cb.p_current_conv->config);
|
||||
nrf_adc_event_clear(NRF_ADC_EVENT_END);
|
||||
nrf_adc_enable();
|
||||
if (m_cb.event_handler)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -62,6 +62,17 @@ extern bool nrfx_power_irq_enabled;
|
|||
#define CALIBRATION_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#if defined(NRF52810_XXAA) || \
|
||||
defined(NRF52832_XXAA) || defined(NRF52832_XXAB) || \
|
||||
defined(NRF52840_XXAA)
|
||||
// Enable workaround for nRF52 anomaly 192 (LFRC oscillator frequency is wrong
|
||||
// after calibration, exceeding 500 ppm).
|
||||
#define USE_WORKAROUND_FOR_ANOMALY_192
|
||||
|
||||
// Enable workaround for nRF52 anomaly 201 (EVENTS_HFCLKSTARTED might be generated twice).
|
||||
#define USE_WORKAROUND_FOR_ANOMALY_201
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CAL_STATE_IDLE,
|
||||
|
@ -73,6 +84,10 @@ typedef struct
|
|||
{
|
||||
nrfx_clock_event_handler_t event_handler;
|
||||
bool module_initialized; /*< Indicate the state of module */
|
||||
#if defined(USE_WORKAROUND_FOR_ANOMALY_201)
|
||||
bool hfclk_started; /*< Anomaly 201 workaround. */
|
||||
#endif
|
||||
|
||||
#if CALIBRATION_SUPPORT
|
||||
volatile nrfx_clock_cal_state_t cal_state;
|
||||
#endif // CALIBRATION_SUPPORT
|
||||
|
@ -88,7 +103,7 @@ static nrfx_clock_cb_t m_clock_cb;
|
|||
bool nrfx_clock_irq_enabled;
|
||||
#endif
|
||||
|
||||
#ifdef NRF52832_XXAA
|
||||
#if defined(NRF52832_XXAA) || defined(NRF52832_XXAB)
|
||||
|
||||
// ANOMALY 132 - LFCLK needs to avoid frame from 66us to 138us after LFCLK stop. This solution
|
||||
// applies delay of 138us before starting LFCLK.
|
||||
|
@ -131,10 +146,12 @@ static void nrfx_clock_anomaly_132(void)
|
|||
CoreDebug->DEMCR = core_debug;
|
||||
}
|
||||
|
||||
#endif // NRF52832_XXAA
|
||||
#endif // defined(NRF52832_XXAA) || defined(NRF52832_XXAB)
|
||||
|
||||
nrfx_err_t nrfx_clock_init(nrfx_clock_event_handler_t event_handler)
|
||||
{
|
||||
NRFX_ASSERT(event_handler);
|
||||
|
||||
nrfx_err_t err_code = NRFX_SUCCESS;
|
||||
if (m_clock_cb.module_initialized)
|
||||
{
|
||||
|
@ -147,6 +164,9 @@ nrfx_err_t nrfx_clock_init(nrfx_clock_event_handler_t event_handler)
|
|||
#endif
|
||||
m_clock_cb.event_handler = event_handler;
|
||||
m_clock_cb.module_initialized = true;
|
||||
#if defined(USE_WORKAROUND_FOR_ANOMALY_201)
|
||||
m_clock_cb.hfclk_started = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
NRFX_LOG_INFO("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
|
@ -201,7 +221,7 @@ void nrfx_clock_lfclk_start(void)
|
|||
nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED);
|
||||
nrf_clock_int_enable(NRF_CLOCK_INT_LF_STARTED_MASK);
|
||||
|
||||
#ifdef NRF52832_XXAA
|
||||
#if defined(NRF52832_XXAA) || defined(NRF52832_XXAB)
|
||||
nrfx_clock_anomaly_132();
|
||||
#endif
|
||||
|
||||
|
@ -230,6 +250,9 @@ void nrfx_clock_hfclk_stop(void)
|
|||
nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP);
|
||||
while (nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY))
|
||||
{}
|
||||
#if defined(USE_WORKAROUND_FOR_ANOMALY_201)
|
||||
m_clock_cb.hfclk_started = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_clock_calibration_start(void)
|
||||
|
@ -251,6 +274,9 @@ nrfx_err_t nrfx_clock_calibration_start(void)
|
|||
nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE);
|
||||
nrf_clock_int_enable(NRF_CLOCK_INT_DONE_MASK);
|
||||
m_clock_cb.cal_state = CAL_STATE_CAL;
|
||||
#if defined(USE_WORKAROUND_FOR_ANOMALY_192)
|
||||
*(volatile uint32_t *)0x40000C34 = 0x00000002;
|
||||
#endif
|
||||
nrf_clock_task_trigger(NRF_CLOCK_TASK_CAL);
|
||||
}
|
||||
else
|
||||
|
@ -297,8 +323,16 @@ void nrfx_clock_irq_handler(void)
|
|||
NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRF_CLOCK_EVENT_HFCLKSTARTED));
|
||||
nrf_clock_int_disable(NRF_CLOCK_INT_HF_STARTED_MASK);
|
||||
|
||||
#if defined(USE_WORKAROUND_FOR_ANOMALY_201)
|
||||
if (!m_clock_cb.hfclk_started)
|
||||
{
|
||||
m_clock_cb.hfclk_started = true;
|
||||
m_clock_cb.event_handler(NRFX_CLOCK_EVT_HFCLK_STARTED);
|
||||
}
|
||||
#else
|
||||
m_clock_cb.event_handler(NRFX_CLOCK_EVT_HFCLK_STARTED);
|
||||
#endif
|
||||
}
|
||||
if (nrf_clock_event_check(NRF_CLOCK_EVENT_LFCLKSTARTED))
|
||||
{
|
||||
nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED);
|
||||
|
@ -319,6 +353,9 @@ void nrfx_clock_irq_handler(void)
|
|||
|
||||
if (nrf_clock_event_check(NRF_CLOCK_EVENT_DONE))
|
||||
{
|
||||
#if defined(USE_WORKAROUND_FOR_ANOMALY_192)
|
||||
*(volatile uint32_t *)0x40000C34 = 0x00000000;
|
||||
#endif
|
||||
nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE);
|
||||
NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRF_CLOCK_EVENT_DONE));
|
||||
nrf_clock_int_disable(NRF_CLOCK_INT_DONE_MASK);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -74,6 +74,7 @@ nrfx_err_t nrfx_comp_init(nrfx_comp_config_t const * p_config,
|
|||
nrfx_comp_event_handler_t event_handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(event_handler);
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (m_state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
|
@ -85,18 +86,7 @@ nrfx_err_t nrfx_comp_init(nrfx_comp_config_t const * p_config,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if (event_handler)
|
||||
{
|
||||
m_comp_event_handler = event_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
#if NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
if (nrfx_prs_acquire(NRF_COMP, nrfx_comp_irq_handler) != NRFX_SUCCESS)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -91,6 +91,7 @@ typedef struct
|
|||
nrfx_gpiote_evt_handler_t handlers[GPIOTE_CH_NUM + NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS];
|
||||
int8_t pin_assignments[NUMBER_OF_PINS];
|
||||
int8_t port_handlers_pins[NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS];
|
||||
uint8_t configured_pins[((NUMBER_OF_PINS)+7) / 8];
|
||||
nrfx_drv_state_t state;
|
||||
} gpiote_control_block_t;
|
||||
|
||||
|
@ -153,6 +154,21 @@ __STATIC_INLINE void pin_in_use_clear(uint32_t pin)
|
|||
}
|
||||
|
||||
|
||||
__STATIC_INLINE void pin_configured_set(uint32_t pin)
|
||||
{
|
||||
nrf_bitmask_bit_set(pin, m_cb.configured_pins);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void pin_configured_clear(uint32_t pin)
|
||||
{
|
||||
nrf_bitmask_bit_clear(pin, m_cb.configured_pins);
|
||||
}
|
||||
|
||||
__STATIC_INLINE bool pin_configured_check(uint32_t pin)
|
||||
{
|
||||
return 0 != nrf_bitmask_bit_is_set(pin, m_cb.configured_pins);
|
||||
}
|
||||
|
||||
__STATIC_INLINE int8_t channel_port_get(uint32_t pin)
|
||||
{
|
||||
return m_cb.pin_assignments[pin];
|
||||
|
@ -225,6 +241,8 @@ nrfx_err_t nrfx_gpiote_init(void)
|
|||
channel_free(i);
|
||||
}
|
||||
|
||||
memset(m_cb.configured_pins, 0, sizeof(m_cb.configured_pins));
|
||||
|
||||
NRFX_IRQ_PRIORITY_SET(GPIOTE_IRQn, NRFX_GPIOTE_CONFIG_IRQ_PRIORITY);
|
||||
NRFX_IRQ_ENABLE(GPIOTE_IRQn);
|
||||
nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_PORT);
|
||||
|
@ -316,6 +334,7 @@ nrfx_err_t nrfx_gpiote_out_init(nrfx_gpiote_pin_t pin,
|
|||
}
|
||||
|
||||
nrf_gpio_cfg_output(pin);
|
||||
pin_configured_set(pin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,7 +355,11 @@ void nrfx_gpiote_out_uninit(nrfx_gpiote_pin_t pin)
|
|||
}
|
||||
pin_in_use_clear(pin);
|
||||
|
||||
if (pin_configured_check(pin))
|
||||
{
|
||||
nrf_gpio_cfg_default(pin);
|
||||
pin_configured_clear(pin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -344,7 +367,7 @@ void nrfx_gpiote_out_set(nrfx_gpiote_pin_t pin)
|
|||
{
|
||||
NRFX_ASSERT(pin < NUMBER_OF_PINS);
|
||||
NRFX_ASSERT(pin_in_use(pin));
|
||||
NRFX_ASSERT(!pin_in_use_by_te(pin))
|
||||
NRFX_ASSERT(!pin_in_use_by_te(pin));
|
||||
|
||||
nrf_gpio_pin_set(pin);
|
||||
}
|
||||
|
@ -354,7 +377,7 @@ void nrfx_gpiote_out_clear(nrfx_gpiote_pin_t pin)
|
|||
{
|
||||
NRFX_ASSERT(pin < NUMBER_OF_PINS);
|
||||
NRFX_ASSERT(pin_in_use(pin));
|
||||
NRFX_ASSERT(!pin_in_use_by_te(pin))
|
||||
NRFX_ASSERT(!pin_in_use_by_te(pin));
|
||||
|
||||
nrf_gpio_pin_clear(pin);
|
||||
}
|
||||
|
@ -364,7 +387,7 @@ void nrfx_gpiote_out_toggle(nrfx_gpiote_pin_t pin)
|
|||
{
|
||||
NRFX_ASSERT(pin < NUMBER_OF_PINS);
|
||||
NRFX_ASSERT(pin_in_use(pin));
|
||||
NRFX_ASSERT(!pin_in_use_by_te(pin))
|
||||
NRFX_ASSERT(!pin_in_use_by_te(pin));
|
||||
|
||||
nrf_gpio_pin_toggle(pin);
|
||||
}
|
||||
|
@ -374,7 +397,7 @@ void nrfx_gpiote_out_task_enable(nrfx_gpiote_pin_t pin)
|
|||
{
|
||||
NRFX_ASSERT(pin < NUMBER_OF_PINS);
|
||||
NRFX_ASSERT(pin_in_use(pin));
|
||||
NRFX_ASSERT(pin_in_use_by_te(pin))
|
||||
NRFX_ASSERT(pin_in_use_by_te(pin));
|
||||
|
||||
nrf_gpiote_task_enable((uint32_t)m_cb.pin_assignments[pin]);
|
||||
}
|
||||
|
@ -384,7 +407,7 @@ void nrfx_gpiote_out_task_disable(nrfx_gpiote_pin_t pin)
|
|||
{
|
||||
NRFX_ASSERT(pin < NUMBER_OF_PINS);
|
||||
NRFX_ASSERT(pin_in_use(pin));
|
||||
NRFX_ASSERT(pin_in_use_by_te(pin))
|
||||
NRFX_ASSERT(pin_in_use_by_te(pin));
|
||||
|
||||
nrf_gpiote_task_disable((uint32_t)m_cb.pin_assignments[pin]);
|
||||
}
|
||||
|
@ -493,6 +516,8 @@ nrfx_err_t nrfx_gpiote_in_init(nrfx_gpiote_pin_t pin,
|
|||
{
|
||||
int8_t channel = channel_port_alloc(pin, evt_handler, p_config->hi_accuracy);
|
||||
if (channel != NO_CHANNELS)
|
||||
{
|
||||
if (!p_config->skip_gpio_setup)
|
||||
{
|
||||
if (p_config->is_watcher)
|
||||
{
|
||||
|
@ -502,6 +527,8 @@ nrfx_err_t nrfx_gpiote_in_init(nrfx_gpiote_pin_t pin,
|
|||
{
|
||||
nrf_gpio_cfg_input(pin, p_config->pull);
|
||||
}
|
||||
pin_configured_set(pin);
|
||||
}
|
||||
|
||||
if (p_config->hi_accuracy)
|
||||
{
|
||||
|
@ -523,7 +550,6 @@ nrfx_err_t nrfx_gpiote_in_init(nrfx_gpiote_pin_t pin,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
|
||||
void nrfx_gpiote_in_event_enable(nrfx_gpiote_pin_t pin, bool int_enable)
|
||||
{
|
||||
NRFX_ASSERT(pin < NUMBER_OF_PINS);
|
||||
|
@ -595,7 +621,11 @@ void nrfx_gpiote_in_uninit(nrfx_gpiote_pin_t pin)
|
|||
{
|
||||
nrf_gpiote_te_default((uint32_t)channel_port_get(pin));
|
||||
}
|
||||
if (pin_configured_check(pin))
|
||||
{
|
||||
nrf_gpio_cfg_default(pin);
|
||||
pin_configured_clear(pin);
|
||||
}
|
||||
channel_free((uint8_t)channel_port_get(pin));
|
||||
pin_in_use_clear(pin);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -35,7 +35,6 @@
|
|||
|
||||
#include <nrfx_i2s.h>
|
||||
#include <hal/nrf_gpio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NRFX_LOG_MODULE I2S
|
||||
#include <nrfx_log.h>
|
||||
|
@ -52,16 +51,20 @@ typedef struct
|
|||
nrfx_i2s_data_handler_t handler;
|
||||
nrfx_drv_state_t state;
|
||||
|
||||
bool synchronized_mode : 1;
|
||||
bool use_rx : 1;
|
||||
bool use_tx : 1;
|
||||
bool rx_ready : 1;
|
||||
bool tx_ready : 1;
|
||||
bool just_started : 1;
|
||||
uint16_t buffer_half_size;
|
||||
uint32_t * p_rx_buffer;
|
||||
uint32_t * p_tx_buffer;
|
||||
bool buffers_needed : 1;
|
||||
bool buffers_reused : 1;
|
||||
|
||||
uint16_t buffer_size;
|
||||
nrfx_i2s_buffers_t next_buffers;
|
||||
nrfx_i2s_buffers_t current_buffers;
|
||||
} i2s_control_block_t;
|
||||
static i2s_control_block_t m_cb;
|
||||
|
||||
|
||||
static void configure_pins(nrfx_i2s_config_t const * p_config)
|
||||
{
|
||||
uint32_t mck_pin, sdout_pin, sdin_pin;
|
||||
|
@ -115,8 +118,12 @@ static void configure_pins(nrfx_i2s_config_t const * p_config)
|
|||
sdin_pin = NRF_I2S_PIN_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
nrf_i2s_pins_set(NRF_I2S, p_config->sck_pin, p_config->lrck_pin,
|
||||
mck_pin, sdout_pin, sdin_pin);
|
||||
nrf_i2s_pins_set(NRF_I2S,
|
||||
p_config->sck_pin,
|
||||
p_config->lrck_pin,
|
||||
mck_pin,
|
||||
sdout_pin,
|
||||
sdin_pin);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +144,8 @@ nrfx_err_t nrfx_i2s_init(nrfx_i2s_config_t const * p_config,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if (!nrf_i2s_configure(NRF_I2S, p_config->mode,
|
||||
if (!nrf_i2s_configure(NRF_I2S,
|
||||
p_config->mode,
|
||||
p_config->format,
|
||||
p_config->alignment,
|
||||
p_config->sample_width,
|
||||
|
@ -160,9 +168,8 @@ nrfx_err_t nrfx_i2s_init(nrfx_i2s_config_t const * p_config,
|
|||
|
||||
m_cb.state = NRFX_DRV_STATE_INITIALIZED;
|
||||
|
||||
err_code = NRFX_SUCCESS;
|
||||
NRFX_LOG_INFO("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
NRFX_LOG_INFO("Initialized.");
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,29 +181,44 @@ void nrfx_i2s_uninit(void)
|
|||
|
||||
NRFX_IRQ_DISABLE(I2S_IRQn);
|
||||
|
||||
nrf_i2s_pins_set(NRF_I2S,
|
||||
NRF_I2S_PIN_NOT_CONNECTED,
|
||||
NRF_I2S_PIN_NOT_CONNECTED,
|
||||
NRF_I2S_PIN_NOT_CONNECTED,
|
||||
NRF_I2S_PIN_NOT_CONNECTED,
|
||||
NRF_I2S_PIN_NOT_CONNECTED);
|
||||
|
||||
m_cb.state = NRFX_DRV_STATE_UNINITIALIZED;
|
||||
NRFX_LOG_INFO("Initialized.");
|
||||
NRFX_LOG_INFO("Uninitialized.");
|
||||
}
|
||||
|
||||
|
||||
nrfx_err_t nrfx_i2s_start(uint32_t * p_rx_buffer,
|
||||
uint32_t * p_tx_buffer,
|
||||
nrfx_err_t nrfx_i2s_start(nrfx_i2s_buffers_t const * p_initial_buffers,
|
||||
uint16_t buffer_size,
|
||||
uint8_t flags)
|
||||
{
|
||||
NRFX_ASSERT((p_rx_buffer != NULL) || (p_tx_buffer != NULL));
|
||||
|
||||
uint16_t buffer_half_size = buffer_size / 2;
|
||||
NRFX_ASSERT(buffer_half_size != 0);
|
||||
|
||||
if (m_cb.state != NRFX_DRV_STATE_INITIALIZED)
|
||||
{
|
||||
return NRFX_ERROR_INVALID_STATE;
|
||||
}
|
||||
NRFX_ASSERT(p_initial_buffers != NULL);
|
||||
NRFX_ASSERT(p_initial_buffers->p_rx_buffer != NULL ||
|
||||
p_initial_buffers->p_tx_buffer != NULL);
|
||||
NRFX_ASSERT(buffer_size != 0);
|
||||
(void)(flags);
|
||||
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if ((p_rx_buffer != NULL) && !nrfx_is_in_ram(p_rx_buffer))
|
||||
if (m_cb.state != NRFX_DRV_STATE_INITIALIZED)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_STATE;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
if (((p_initial_buffers->p_rx_buffer != NULL)
|
||||
&& !nrfx_is_in_ram(p_initial_buffers->p_rx_buffer))
|
||||
||
|
||||
((p_initial_buffers->p_tx_buffer != NULL)
|
||||
&& !nrfx_is_in_ram(p_initial_buffers->p_tx_buffer)))
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_ADDR;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
|
@ -205,219 +227,185 @@ nrfx_err_t nrfx_i2s_start(uint32_t * p_rx_buffer,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if ((p_tx_buffer != NULL) && !nrfx_is_in_ram(p_tx_buffer))
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_ADDR;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
// Initially we set up the peripheral to use the first half of each buffer,
|
||||
// then in 'nrfx_i2s_irq_handler' we will switch to the second half.
|
||||
nrf_i2s_transfer_set(NRF_I2S, buffer_half_size, p_rx_buffer, p_tx_buffer);
|
||||
|
||||
m_cb.p_rx_buffer = p_rx_buffer;
|
||||
m_cb.p_tx_buffer = p_tx_buffer;
|
||||
m_cb.buffer_half_size = buffer_half_size;
|
||||
m_cb.just_started = true;
|
||||
|
||||
if ((flags & NRFX_I2S_FLAG_SYNCHRONIZED_MODE) &&
|
||||
// [synchronized mode makes sense only when both RX and TX are enabled]
|
||||
(m_cb.p_rx_buffer != NULL) && (m_cb.p_tx_buffer != NULL))
|
||||
{
|
||||
m_cb.synchronized_mode = true;
|
||||
m_cb.use_rx = (p_initial_buffers->p_rx_buffer != NULL);
|
||||
m_cb.use_tx = (p_initial_buffers->p_tx_buffer != NULL);
|
||||
m_cb.rx_ready = false;
|
||||
m_cb.tx_ready = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cb.synchronized_mode = false;
|
||||
}
|
||||
m_cb.buffers_needed = false;
|
||||
m_cb.buffer_size = buffer_size;
|
||||
|
||||
// Set the provided initial buffers as next, they will become the current
|
||||
// ones after the IRQ handler is called for the first time, what will occur
|
||||
// right after the START task is triggered.
|
||||
m_cb.next_buffers = *p_initial_buffers;
|
||||
m_cb.current_buffers.p_rx_buffer = NULL;
|
||||
m_cb.current_buffers.p_tx_buffer = NULL;
|
||||
|
||||
nrf_i2s_transfer_set(NRF_I2S,
|
||||
m_cb.buffer_size,
|
||||
m_cb.next_buffers.p_rx_buffer,
|
||||
m_cb.next_buffers.p_tx_buffer);
|
||||
|
||||
nrf_i2s_enable(NRF_I2S);
|
||||
|
||||
m_cb.state = NRFX_DRV_STATE_POWERED_ON;
|
||||
|
||||
if (m_cb.p_tx_buffer != NULL)
|
||||
{
|
||||
// Get from the application the first portion of data to be sent - we
|
||||
// need to have it in the transmit buffer before we start the transfer.
|
||||
// Unless the synchronized mode is active. In this mode we must wait
|
||||
// with this until the first portion of data is received, so here we
|
||||
// just make sure that there will be silence on the SDOUT line prior
|
||||
// to that moment.
|
||||
if (m_cb.synchronized_mode)
|
||||
{
|
||||
memset(m_cb.p_tx_buffer, 0, m_cb.buffer_half_size * sizeof(uint32_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cb.handler(NULL, m_cb.p_tx_buffer, m_cb.buffer_half_size);
|
||||
}
|
||||
}
|
||||
|
||||
nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD);
|
||||
nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD);
|
||||
nrf_i2s_int_enable(NRF_I2S,
|
||||
NRF_I2S_INT_RXPTRUPD_MASK | NRF_I2S_INT_TXPTRUPD_MASK);
|
||||
nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_STOPPED);
|
||||
nrf_i2s_int_enable(NRF_I2S, (m_cb.use_rx ? NRF_I2S_INT_RXPTRUPD_MASK : 0) |
|
||||
(m_cb.use_tx ? NRF_I2S_INT_TXPTRUPD_MASK : 0) |
|
||||
NRF_I2S_INT_STOPPED_MASK);
|
||||
nrf_i2s_task_trigger(NRF_I2S, NRF_I2S_TASK_START);
|
||||
|
||||
err_code = NRFX_SUCCESS;
|
||||
NRFX_LOG_INFO("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
NRFX_LOG_INFO("Started.");
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
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_err_t err_code;
|
||||
|
||||
if (!m_cb.buffers_needed)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_STATE;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
if (((p_buffers->p_rx_buffer != NULL)
|
||||
&& !nrfx_is_in_ram(p_buffers->p_rx_buffer))
|
||||
||
|
||||
((p_buffers->p_tx_buffer != NULL)
|
||||
&& !nrfx_is_in_ram(p_buffers->p_tx_buffer)))
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_ADDR;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
if (m_cb.use_tx)
|
||||
{
|
||||
NRFX_ASSERT(p_buffers->p_tx_buffer != NULL);
|
||||
nrf_i2s_tx_buffer_set(NRF_I2S, p_buffers->p_tx_buffer);
|
||||
}
|
||||
if (m_cb.use_rx)
|
||||
{
|
||||
NRFX_ASSERT(p_buffers->p_rx_buffer != NULL);
|
||||
nrf_i2s_rx_buffer_set(NRF_I2S, p_buffers->p_rx_buffer);
|
||||
}
|
||||
|
||||
m_cb.next_buffers = *p_buffers;
|
||||
m_cb.buffers_needed = false;
|
||||
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void nrfx_i2s_stop(void)
|
||||
{
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
|
||||
m_cb.buffers_needed = false;
|
||||
|
||||
// First disable interrupts, then trigger the STOP task, so no spurious
|
||||
// RXPTRUPD and TXPTRUPD events (see FTPAN-55) will be processed.
|
||||
nrf_i2s_int_disable(NRF_I2S, NRF_I2S_INT_RXPTRUPD_MASK | NRF_I2S_INT_TXPTRUPD_MASK);
|
||||
|
||||
// RXPTRUPD and TXPTRUPD events (see nRF52 anomaly 55) are processed.
|
||||
nrf_i2s_int_disable(NRF_I2S, NRF_I2S_INT_RXPTRUPD_MASK |
|
||||
NRF_I2S_INT_TXPTRUPD_MASK);
|
||||
nrf_i2s_task_trigger(NRF_I2S, NRF_I2S_TASK_STOP);
|
||||
|
||||
nrf_i2s_disable(NRF_I2S);
|
||||
|
||||
m_cb.state = NRFX_DRV_STATE_INITIALIZED;
|
||||
|
||||
NRFX_LOG_INFO("Disabled.");
|
||||
}
|
||||
|
||||
|
||||
void nrfx_i2s_irq_handler(void)
|
||||
{
|
||||
uint32_t const * p_data_received = NULL;
|
||||
uint32_t * p_data_to_send = NULL;
|
||||
|
||||
if (nrf_i2s_event_check(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD))
|
||||
{
|
||||
nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD);
|
||||
NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRF_I2S_EVENT_TXPTRUPD));
|
||||
|
||||
// If transmission is not enabled, but for some reason the TXPTRUPD
|
||||
// event has been generated, just ignore it.
|
||||
if (m_cb.p_tx_buffer != NULL)
|
||||
{
|
||||
uint32_t * p_tx_buffer_next;
|
||||
if (nrf_i2s_tx_buffer_get(NRF_I2S) == m_cb.p_tx_buffer)
|
||||
{
|
||||
p_tx_buffer_next = m_cb.p_tx_buffer + m_cb.buffer_half_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_tx_buffer_next = m_cb.p_tx_buffer;
|
||||
}
|
||||
nrf_i2s_tx_buffer_set(NRF_I2S, p_tx_buffer_next);
|
||||
|
||||
m_cb.tx_ready = true;
|
||||
|
||||
// Now the part of the buffer that we've configured as "next" should
|
||||
// be filled by the application with proper data to be sent;
|
||||
// the peripheral is sending data from the other part of the buffer
|
||||
// (but it will finish soon...).
|
||||
p_data_to_send = p_tx_buffer_next;
|
||||
|
||||
if (m_cb.use_tx && m_cb.buffers_needed)
|
||||
{
|
||||
m_cb.buffers_reused = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (nrf_i2s_event_check(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD))
|
||||
{
|
||||
nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD);
|
||||
NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRF_I2S_EVENT_RXPTRUPD));
|
||||
|
||||
// If reception is not enabled, but for some reason the RXPTRUPD event
|
||||
// has been generated, just ignore it.
|
||||
if (m_cb.p_rx_buffer != NULL)
|
||||
{
|
||||
uint32_t * p_rx_buffer_next;
|
||||
if (nrf_i2s_rx_buffer_get(NRF_I2S) == m_cb.p_rx_buffer)
|
||||
{
|
||||
p_rx_buffer_next = m_cb.p_rx_buffer + m_cb.buffer_half_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_rx_buffer_next = m_cb.p_rx_buffer;
|
||||
}
|
||||
nrf_i2s_rx_buffer_set(NRF_I2S, p_rx_buffer_next);
|
||||
|
||||
m_cb.rx_ready = true;
|
||||
|
||||
// The RXPTRUPD event is generated for the first time right after
|
||||
// the transfer is started. Since there is no data received yet at
|
||||
// this point we only update the buffer pointer (it is done above),
|
||||
// there is no callback to the application.
|
||||
// [for synchronized mode this has to be handled differently -
|
||||
// see below]
|
||||
if (m_cb.just_started && !m_cb.synchronized_mode)
|
||||
if (m_cb.use_rx && m_cb.buffers_needed)
|
||||
{
|
||||
m_cb.just_started = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The RXPTRUPD event indicates that from now on the peripheral
|
||||
// will be filling the part of the buffer that was pointed at
|
||||
// the time the event has been generated, hence now we can let
|
||||
// the application process the data stored in the other part of
|
||||
// the buffer - the one that we've just set to be filled next.
|
||||
p_data_received = p_rx_buffer_next;
|
||||
}
|
||||
m_cb.buffers_reused = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Call the data handler passing received data to the application and/or
|
||||
// requesting data to be sent.
|
||||
if (!m_cb.synchronized_mode)
|
||||
if (nrf_i2s_event_check(NRF_I2S, NRF_I2S_EVENT_STOPPED))
|
||||
{
|
||||
if ((p_data_received != NULL) || (p_data_to_send != NULL))
|
||||
{
|
||||
if (p_data_received != NULL)
|
||||
{
|
||||
NRFX_LOG_DEBUG("Rx data:");
|
||||
NRFX_LOG_HEXDUMP_DEBUG((uint8_t *)p_data_received,
|
||||
m_cb.buffer_half_size * sizeof(p_data_received[0]));
|
||||
nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_STOPPED);
|
||||
nrf_i2s_int_disable(NRF_I2S, NRF_I2S_INT_STOPPED_MASK);
|
||||
nrf_i2s_disable(NRF_I2S);
|
||||
|
||||
// When stopped, release all buffers, including these scheduled for
|
||||
// the next transfer.
|
||||
m_cb.handler(&m_cb.current_buffers, 0);
|
||||
m_cb.handler(&m_cb.next_buffers, 0);
|
||||
|
||||
m_cb.state = NRFX_DRV_STATE_INITIALIZED;
|
||||
NRFX_LOG_INFO("Stopped.");
|
||||
}
|
||||
m_cb.handler(p_data_received, p_data_to_send,
|
||||
m_cb.buffer_half_size);
|
||||
if (p_data_to_send != NULL)
|
||||
{
|
||||
NRFX_LOG_DEBUG("Tx data:");
|
||||
NRFX_LOG_HEXDUMP_DEBUG((uint8_t *)p_data_to_send,
|
||||
m_cb.buffer_half_size * sizeof(p_data_to_send[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
// In the synchronized mode wait until the events for both RX and TX occur.
|
||||
// And ignore the initial occurrences of these events, since they only
|
||||
// indicate that the transfer has started - no data is received yet at
|
||||
// that moment, so we have got nothing to pass to the application.
|
||||
else
|
||||
{
|
||||
if (m_cb.rx_ready && m_cb.tx_ready)
|
||||
// Check if the requested transfer has been completed:
|
||||
// - full-duplex mode
|
||||
if ((m_cb.use_tx && m_cb.use_rx && m_cb.tx_ready && m_cb.rx_ready) ||
|
||||
// - TX only mode
|
||||
(!m_cb.use_rx && m_cb.tx_ready) ||
|
||||
// - RX only mode
|
||||
(!m_cb.use_tx && m_cb.rx_ready))
|
||||
{
|
||||
m_cb.rx_ready = false;
|
||||
m_cb.tx_ready = false;
|
||||
m_cb.rx_ready = false;
|
||||
|
||||
if (m_cb.just_started)
|
||||
// If the application did not supply the buffers for the next
|
||||
// part of the transfer until this moment, the current buffers
|
||||
// cannot be released, since the I2S peripheral already started
|
||||
// using them. Signal this situation to the application by
|
||||
// passing NULL instead of the structure with released buffers.
|
||||
if (m_cb.buffers_reused)
|
||||
{
|
||||
m_cb.just_started = false;
|
||||
m_cb.buffers_reused = false;
|
||||
// This will most likely be set at this point. However, there is
|
||||
// a small time window between TXPTRUPD and RXPTRUPD events,
|
||||
// and it is theoretically possible that next buffers will be
|
||||
// set in this window, so to be sure this flag is set to true,
|
||||
// set it explicitly.
|
||||
m_cb.buffers_needed = true;
|
||||
m_cb.handler(NULL,
|
||||
NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED);
|
||||
}
|
||||
else
|
||||
{
|
||||
NRFX_LOG_DEBUG("Rx data:");
|
||||
NRFX_LOG_HEXDUMP_DEBUG((uint8_t *)nrf_i2s_rx_buffer_get(NRF_I2S),
|
||||
m_cb.buffer_half_size * sizeof(p_data_received[0]));
|
||||
m_cb.handler(nrf_i2s_rx_buffer_get(NRF_I2S),
|
||||
nrf_i2s_tx_buffer_get(NRF_I2S),
|
||||
m_cb.buffer_half_size);
|
||||
NRFX_LOG_DEBUG("Tx data:");
|
||||
NRFX_LOG_HEXDUMP_DEBUG((uint8_t *)nrf_i2s_tx_buffer_get(NRF_I2S),
|
||||
m_cb.buffer_half_size * sizeof(p_data_to_send[0]));
|
||||
}
|
||||
// Buffers that have been used by the I2S peripheral (current)
|
||||
// are now released and will be returned to the application,
|
||||
// and the ones scheduled to be used as next become the current
|
||||
// ones.
|
||||
nrfx_i2s_buffers_t released_buffers = m_cb.current_buffers;
|
||||
m_cb.current_buffers = m_cb.next_buffers;
|
||||
m_cb.next_buffers.p_rx_buffer = NULL;
|
||||
m_cb.next_buffers.p_tx_buffer = NULL;
|
||||
m_cb.buffers_needed = true;
|
||||
m_cb.handler(&released_buffers,
|
||||
NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NRFX_CHECK(NRFX_I2S_ENABLED)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -73,6 +73,7 @@ nrfx_err_t nrfx_lpcomp_init(nrfx_lpcomp_config_t const * p_config,
|
|||
nrfx_lpcomp_event_handler_t event_handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(event_handler);
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (m_state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
|
@ -84,18 +85,7 @@ nrfx_err_t nrfx_lpcomp_init(nrfx_lpcomp_config_t const * p_config,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if (event_handler)
|
||||
{
|
||||
m_lpcomp_event_handler = event_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
#if NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
if (nrfx_prs_acquire(NRF_LPCOMP, nrfx_lpcomp_irq_handler) != NRFX_SUCCESS)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -171,6 +171,7 @@ nrfx_err_t nrfx_pdm_init(nrfx_pdm_config_t const * p_config,
|
|||
nrfx_pdm_event_handler_t event_handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(event_handler);
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (m_cb.drv_state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
|
@ -181,14 +182,6 @@ nrfx_err_t nrfx_pdm_init(nrfx_pdm_config_t const * p_config,
|
|||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
if (event_handler == NULL)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
if (p_config->gain_l > NRF_PDM_GAIN_MAXIMUM ||
|
||||
p_config->gain_r > NRF_PDM_GAIN_MAXIMUM)
|
||||
|
@ -250,7 +243,7 @@ static void pdm_start()
|
|||
static void pdm_buf_request()
|
||||
{
|
||||
m_cb.irq_buff_request = 1;
|
||||
NVIC_SetPendingIRQ(PDM_IRQn);
|
||||
NRFX_IRQ_PENDING_SET(PDM_IRQn);
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_pdm_start(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -92,6 +92,7 @@ nrfx_err_t nrfx_qdec_init(nrfx_qdec_config_t const * p_config,
|
|||
nrfx_qdec_event_handler_t event_handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(event_handler);
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (m_state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
|
@ -103,18 +104,7 @@ nrfx_err_t nrfx_qdec_init(nrfx_qdec_config_t const * p_config,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if (event_handler)
|
||||
{
|
||||
m_qdec_event_handler = event_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
nrf_qdec_sampleper_set(p_config->sampleper);
|
||||
nrf_gpio_cfg_input(p_config->pselled, NRF_GPIO_PIN_NOPULL);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -48,9 +48,15 @@
|
|||
*/
|
||||
#define QSPI_MEM_STATUSREG_WIP_Pos 0x01
|
||||
|
||||
#define QSPI_WAIT_READY() do { \
|
||||
while (!nrf_qspi_event_check(NRF_QSPI, NRF_QSPI_EVENT_READY)); \
|
||||
} while(0)
|
||||
/**
|
||||
* @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.
|
||||
|
@ -85,7 +91,8 @@ static nrfx_err_t qspi_task_perform(nrf_qspi_task_t task)
|
|||
|
||||
if (m_cb.handler == NULL)
|
||||
{
|
||||
QSPI_WAIT_READY();
|
||||
while (!nrf_qspi_event_check(NRF_QSPI, NRF_QSPI_EVENT_READY))
|
||||
{};
|
||||
}
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
@ -147,7 +154,16 @@ nrfx_err_t nrfx_qspi_init(nrfx_qspi_config_t const * p_config,
|
|||
nrf_qspi_task_trigger(NRF_QSPI, NRF_QSPI_TASK_ACTIVATE);
|
||||
|
||||
// Waiting for the peripheral to activate
|
||||
QSPI_WAIT_READY();
|
||||
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;
|
||||
}
|
||||
|
@ -175,7 +191,21 @@ nrfx_err_t nrfx_qspi_cinstr_xfer(nrf_qspi_cinstr_conf_t const * p_config,
|
|||
|
||||
nrf_qspi_cinstr_transfer_start(NRF_QSPI, p_config);
|
||||
|
||||
QSPI_WAIT_READY();
|
||||
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);
|
||||
|
||||
|
@ -226,6 +256,11 @@ void nrfx_qspi_uninit(void)
|
|||
|
||||
nrf_qspi_disable(NRF_QSPI);
|
||||
|
||||
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;
|
||||
|
||||
NRFX_IRQ_DISABLE(QSPI_IRQn);
|
||||
|
||||
nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -51,16 +51,12 @@ static nrfx_rng_evt_handler_t m_rng_hndl;
|
|||
nrfx_err_t nrfx_rng_init(nrfx_rng_config_t const * p_config, nrfx_rng_evt_handler_t handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(handler);
|
||||
if (m_rng_state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
{
|
||||
return NRFX_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
if (handler == NULL)
|
||||
{
|
||||
return NRFX_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
m_rng_hndl = handler;
|
||||
|
||||
if (p_config->error_correction)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -70,21 +70,10 @@ nrfx_err_t nrfx_rtc_init(nrfx_rtc_t const * const p_instance,
|
|||
nrfx_rtc_handler_t handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
|
||||
NRFX_ASSERT(handler);
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (handler)
|
||||
{
|
||||
m_handlers[p_instance->instance_id] = handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
if (m_cb[p_instance->instance_id].state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
{
|
||||
|
@ -168,7 +157,7 @@ nrfx_err_t nrfx_rtc_cc_disable(nrfx_rtc_t const * const p_instance, uint32_t cha
|
|||
return err_code;
|
||||
}
|
||||
}
|
||||
NRFX_LOG_INFO("RTC id: %d, channel disabled: %d.", p_instance->instance_id, channel);
|
||||
NRFX_LOG_INFO("RTC id: %d, channel disabled: %lu.", p_instance->instance_id, channel);
|
||||
err_code = NRFX_SUCCESS;
|
||||
NRFX_LOG_INFO("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
|
@ -220,7 +209,7 @@ nrfx_err_t nrfx_rtc_cc_set(nrfx_rtc_t const * const p_instance,
|
|||
}
|
||||
nrf_rtc_event_enable(p_instance->p_reg,int_mask);
|
||||
|
||||
NRFX_LOG_INFO("RTC id: %d, channel enabled: %d, compare value: %d.",
|
||||
NRFX_LOG_INFO("RTC id: %d, channel enabled: %lu, compare value: %lu.",
|
||||
p_instance->instance_id,
|
||||
channel,
|
||||
val);
|
||||
|
@ -301,7 +290,7 @@ static void irq_handler(NRF_RTC_Type * p_reg,
|
|||
nrf_rtc_event_disable(p_reg,int_mask);
|
||||
nrf_rtc_int_disable(p_reg,int_mask);
|
||||
nrf_rtc_event_clear(p_reg,event);
|
||||
NRFX_LOG_DEBUG("Event: %s, instance id: %d.", EVT_TO_STR(event), instance_id);
|
||||
NRFX_LOG_DEBUG("Event: %s, instance id: %lu.", EVT_TO_STR(event), instance_id);
|
||||
m_handlers[instance_id]((nrfx_rtc_int_type_t)i);
|
||||
}
|
||||
int_mask <<= 1;
|
||||
|
@ -312,7 +301,7 @@ static void irq_handler(NRF_RTC_Type * p_reg,
|
|||
nrf_rtc_event_pending(p_reg, event))
|
||||
{
|
||||
nrf_rtc_event_clear(p_reg, event);
|
||||
NRFX_LOG_DEBUG("Event: %s, instance id: %d.", EVT_TO_STR(event), instance_id);
|
||||
NRFX_LOG_DEBUG("Event: %s, instance id: %lu.", EVT_TO_STR(event), instance_id);
|
||||
m_handlers[instance_id](NRFX_RTC_INT_TICK);
|
||||
}
|
||||
|
||||
|
@ -321,7 +310,7 @@ static void irq_handler(NRF_RTC_Type * p_reg,
|
|||
nrf_rtc_event_pending(p_reg, event))
|
||||
{
|
||||
nrf_rtc_event_clear(p_reg,event);
|
||||
NRFX_LOG_DEBUG("Event: %s, instance id: %d.", EVT_TO_STR(event), instance_id);
|
||||
NRFX_LOG_DEBUG("Event: %s, instance id: %lu.", EVT_TO_STR(event), instance_id);
|
||||
m_handlers[instance_id](NRFX_RTC_INT_OVERFLOW);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -203,6 +203,7 @@ nrfx_err_t nrfx_saadc_init(nrfx_saadc_config_t const * p_config,
|
|||
nrfx_saadc_event_handler_t event_handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(event_handler);
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (m_cb.state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
|
@ -213,14 +214,6 @@ nrfx_err_t nrfx_saadc_init(nrfx_saadc_config_t const * p_config,
|
|||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
if (event_handler == NULL)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
m_cb.event_handler = event_handler;
|
||||
nrf_saadc_resolution_set(p_config->resolution);
|
||||
|
@ -262,13 +255,9 @@ void nrfx_saadc_uninit(void)
|
|||
nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP);
|
||||
|
||||
// Wait for ADC being stopped.
|
||||
uint32_t timeout = HW_TIMEOUT;
|
||||
|
||||
while (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED) == 0 && timeout > 0)
|
||||
{
|
||||
--timeout;
|
||||
}
|
||||
NRFX_ASSERT(timeout > 0);
|
||||
bool result;
|
||||
NRFX_WAIT_FOR(nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED), HW_TIMEOUT, 0, result);
|
||||
NRFX_ASSERT(result);
|
||||
|
||||
nrf_saadc_disable();
|
||||
m_cb.adc_state = NRF_SAADC_STATE_IDLE;
|
||||
|
@ -277,7 +266,8 @@ void nrfx_saadc_uninit(void)
|
|||
{
|
||||
if (m_cb.psel[channel].pselp != NRF_SAADC_INPUT_DISABLED)
|
||||
{
|
||||
(void)nrfx_saadc_channel_uninit(channel);
|
||||
nrfx_err_t err_code = nrfx_saadc_channel_uninit(channel);
|
||||
NRFX_ASSERT(err_code == NRFX_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,7 +307,7 @@ nrfx_err_t nrfx_saadc_channel_init(uint8_t chan
|
|||
}
|
||||
#endif //NRF52_PAN_74
|
||||
|
||||
if (!m_cb.psel[channel].pselp)
|
||||
if (m_cb.psel[channel].pselp == NRF_SAADC_INPUT_DISABLED)
|
||||
{
|
||||
++m_cb.active_channels;
|
||||
}
|
||||
|
@ -343,7 +333,7 @@ nrfx_err_t nrfx_saadc_channel_init(uint8_t chan
|
|||
|
||||
nrfx_err_t nrfx_saadc_channel_uninit(uint8_t channel)
|
||||
{
|
||||
NRFX_ASSERT(channel < NRF_SAADC_CHANNEL_COUNT)
|
||||
NRFX_ASSERT(channel < NRF_SAADC_CHANNEL_COUNT);
|
||||
NRFX_ASSERT(m_cb.state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
|
||||
nrfx_err_t err_code;
|
||||
|
@ -358,7 +348,7 @@ nrfx_err_t nrfx_saadc_channel_uninit(uint8_t channel)
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if (m_cb.psel[channel].pselp)
|
||||
if (m_cb.psel[channel].pselp != NRF_SAADC_INPUT_DISABLED)
|
||||
{
|
||||
--m_cb.active_channels;
|
||||
}
|
||||
|
@ -407,12 +397,10 @@ nrfx_err_t nrfx_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_valu
|
|||
nrf_saadc_task_trigger(NRF_SAADC_TASK_START);
|
||||
nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE);
|
||||
|
||||
uint32_t timeout = HW_TIMEOUT;
|
||||
bool result;
|
||||
NRFX_WAIT_FOR(nrf_saadc_event_check(NRF_SAADC_EVENT_END), HW_TIMEOUT, 0, result);
|
||||
NRFX_ASSERT(result);
|
||||
|
||||
while (0 == nrf_saadc_event_check(NRF_SAADC_EVENT_END) && timeout > 0)
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED);
|
||||
nrf_saadc_event_clear(NRF_SAADC_EVENT_END);
|
||||
|
||||
|
@ -497,7 +485,7 @@ nrfx_err_t nrfx_saadc_buffer_convert(nrf_saadc_value_t * p_buffer, uint16_t size
|
|||
m_cb.buffer_size = size;
|
||||
m_cb.p_secondary_buffer = NULL;
|
||||
|
||||
NRFX_LOG_INFO("Function: %d, buffer length: %d, active channels: %d.",
|
||||
NRFX_LOG_INFO("Function: %s, buffer length: %d, active channels: %d.",
|
||||
__func__,
|
||||
size,
|
||||
m_cb.active_channels);
|
||||
|
@ -582,6 +570,7 @@ void nrfx_saadc_abort(void)
|
|||
if (nrfx_saadc_is_busy())
|
||||
{
|
||||
nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED);
|
||||
nrf_saadc_int_enable(NRF_SAADC_INT_STOPPED);
|
||||
nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP);
|
||||
|
||||
if (m_cb.adc_state == NRF_SAADC_STATE_CALIBRATION)
|
||||
|
@ -591,14 +580,12 @@ void nrfx_saadc_abort(void)
|
|||
else
|
||||
{
|
||||
// Wait for ADC being stopped.
|
||||
uint32_t timeout = HW_TIMEOUT;
|
||||
bool result;
|
||||
NRFX_WAIT_FOR((m_cb.adc_state != NRF_SAADC_STATE_IDLE), HW_TIMEOUT, 0, result);
|
||||
NRFX_ASSERT(result);
|
||||
}
|
||||
|
||||
while ((m_cb.adc_state != NRF_SAADC_STATE_IDLE) && (timeout > 0))
|
||||
{
|
||||
--timeout;
|
||||
}
|
||||
NRFX_ASSERT(timeout > 0);
|
||||
}
|
||||
nrf_saadc_int_disable(NRF_SAADC_INT_STOPPED);
|
||||
|
||||
m_cb.p_buffer = 0;
|
||||
m_cb.p_secondary_buffer = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -57,6 +57,7 @@ typedef struct
|
|||
// [no need for 'volatile' attribute for the following members, as they
|
||||
// are not concurrently used in IRQ handlers and main line code]
|
||||
uint8_t ss_pin;
|
||||
uint8_t miso_pin;
|
||||
uint8_t orc;
|
||||
size_t bytes_transferred;
|
||||
|
||||
|
@ -116,7 +117,7 @@ nrfx_err_t nrfx_spi_init(nrfx_spi_t const * const p_instance,
|
|||
// 0 - for modes 0 and 1 (CPOL = 0), 1 - for modes 2 and 3 (CPOL = 1);
|
||||
// according to the reference manual guidelines this pin and its input
|
||||
// buffer must always be connected for the SPI to work.
|
||||
if (p_config->mode <= NRFX_SPI_MODE_1)
|
||||
if (p_config->mode <= NRF_SPI_MODE_1)
|
||||
{
|
||||
nrf_gpio_pin_clear(p_config->sck_pin);
|
||||
}
|
||||
|
@ -151,6 +152,7 @@ nrfx_err_t nrfx_spi_init(nrfx_spi_t const * const p_instance,
|
|||
{
|
||||
miso_pin = NRF_SPI_PIN_NOT_CONNECTED;
|
||||
}
|
||||
m_cb[p_instance->drv_inst_idx].miso_pin = p_config->miso_pin;
|
||||
// - Slave Select (optional) - output with initial value 1 (inactive).
|
||||
if (p_config->ss_pin != NRFX_SPI_PIN_NOT_USED)
|
||||
{
|
||||
|
@ -161,11 +163,8 @@ nrfx_err_t nrfx_spi_init(nrfx_spi_t const * const p_instance,
|
|||
|
||||
NRF_SPI_Type * p_spi = p_instance->p_reg;
|
||||
nrf_spi_pins_set(p_spi, p_config->sck_pin, mosi_pin, miso_pin);
|
||||
nrf_spi_frequency_set(p_spi,
|
||||
(nrf_spi_frequency_t)p_config->frequency);
|
||||
nrf_spi_configure(p_spi,
|
||||
(nrf_spi_mode_t)p_config->mode,
|
||||
(nrf_spi_bit_order_t)p_config->bit_order);
|
||||
nrf_spi_frequency_set(p_spi, p_config->frequency);
|
||||
nrf_spi_configure(p_spi, p_config->mode, p_config->bit_order);
|
||||
|
||||
m_cb[p_instance->drv_inst_idx].orc = p_config->orc;
|
||||
|
||||
|
@ -206,6 +205,11 @@ void nrfx_spi_uninit(nrfx_spi_t const * const p_instance)
|
|||
{
|
||||
nrf_spi_int_disable(p_spi, NRF_SPI_ALL_INTS_MASK);
|
||||
}
|
||||
|
||||
if (p_cb->miso_pin != NRFX_SPI_PIN_NOT_USED)
|
||||
{
|
||||
nrf_gpio_cfg_default(p_cb->miso_pin);
|
||||
}
|
||||
nrf_spi_disable(p_spi);
|
||||
|
||||
#if NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -101,6 +101,7 @@ typedef struct
|
|||
// are not concurrently used in IRQ handlers and main line code]
|
||||
bool ss_active_high;
|
||||
uint8_t ss_pin;
|
||||
uint8_t miso_pin;
|
||||
uint8_t orc;
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED)
|
||||
|
@ -110,6 +111,47 @@ typedef struct
|
|||
} spim_control_block_t;
|
||||
static spim_control_block_t m_cb[NRFX_SPIM_ENABLED_COUNT];
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED)
|
||||
|
||||
// Workaround for nRF52840 anomaly 198: SPIM3 transmit data might be corrupted.
|
||||
|
||||
static uint32_t m_anomaly_198_preserved_value;
|
||||
|
||||
static void anomaly_198_enable(uint8_t const * p_buffer, size_t buf_len)
|
||||
{
|
||||
m_anomaly_198_preserved_value = *((volatile uint32_t *)0x40000E00);
|
||||
|
||||
if (buf_len == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint32_t buffer_end_addr = ((uint32_t)p_buffer) + buf_len;
|
||||
uint32_t block_addr = ((uint32_t)p_buffer) & ~0x1FFF;
|
||||
uint32_t block_flag = (1UL << ((block_addr >> 13) & 0xFFFF));
|
||||
uint32_t occupied_blocks = 0;
|
||||
|
||||
if (block_addr >= 0x20010000)
|
||||
{
|
||||
occupied_blocks = (1UL << 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
do {
|
||||
occupied_blocks |= block_flag;
|
||||
block_flag <<= 1;
|
||||
block_addr += 0x2000;
|
||||
} while ((block_addr < buffer_end_addr) && (block_addr < 0x20012000));
|
||||
}
|
||||
|
||||
*((volatile uint32_t *)0x40000E00) = occupied_blocks;
|
||||
}
|
||||
|
||||
static void anomaly_198_disable(void)
|
||||
{
|
||||
*((volatile uint32_t *)0x40000E00) = m_anomaly_198_preserved_value;
|
||||
}
|
||||
#endif // NRFX_CHECK(NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED)
|
||||
|
||||
nrfx_err_t nrfx_spim_init(nrfx_spim_t const * const p_instance,
|
||||
nrfx_spim_config_t const * p_config,
|
||||
nrfx_spim_evt_handler_t handler,
|
||||
|
@ -219,6 +261,7 @@ nrfx_err_t nrfx_spim_init(nrfx_spim_t const * const p_instance,
|
|||
{
|
||||
miso_pin = NRF_SPIM_PIN_NOT_CONNECTED;
|
||||
}
|
||||
m_cb[p_instance->drv_inst_idx].miso_pin = p_config->miso_pin;
|
||||
// - Slave Select (optional) - output with initial value 1 (inactive).
|
||||
if (p_config->ss_pin != NRFX_SPIM_PIN_NOT_USED)
|
||||
{
|
||||
|
@ -261,11 +304,8 @@ nrfx_err_t nrfx_spim_init(nrfx_spim_t const * const p_instance,
|
|||
|
||||
|
||||
nrf_spim_pins_set(p_spim, p_config->sck_pin, mosi_pin, miso_pin);
|
||||
nrf_spim_frequency_set(p_spim,
|
||||
(nrf_spim_frequency_t)p_config->frequency);
|
||||
nrf_spim_configure(p_spim,
|
||||
(nrf_spim_mode_t)p_config->mode,
|
||||
(nrf_spim_bit_order_t)p_config->bit_order);
|
||||
nrf_spim_frequency_set(p_spim, p_config->frequency);
|
||||
nrf_spim_configure(p_spim, p_config->mode, p_config->bit_order);
|
||||
|
||||
nrf_spim_orc_set(p_spim, p_config->orc);
|
||||
|
||||
|
@ -314,6 +354,11 @@ void nrfx_spim_uninit(nrfx_spim_t const * const p_instance)
|
|||
p_cb->transfer_in_progress = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_cb->miso_pin != NRFX_SPIM_PIN_NOT_USED)
|
||||
{
|
||||
nrf_gpio_cfg_default(p_cb->miso_pin);
|
||||
}
|
||||
nrf_spim_disable(p_spim);
|
||||
|
||||
#if NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
|
@ -329,7 +374,7 @@ nrfx_err_t nrfx_spim_xfer_dcx(nrfx_spim_t const * const p_instance,
|
|||
uint32_t flags,
|
||||
uint8_t cmd_length)
|
||||
{
|
||||
ASSERT(cmd_length <= NRF_SPIM_DCX_CNT_ALL_CMD)
|
||||
NRFX_ASSERT(cmd_length <= NRF_SPIM_DCX_CNT_ALL_CMD);
|
||||
nrf_spim_dcx_cnt_set((NRF_SPIM_Type *)p_instance->p_reg, cmd_length);
|
||||
return nrfx_spim_xfer(p_instance, p_xfer_desc, 0);
|
||||
}
|
||||
|
@ -423,6 +468,13 @@ static nrfx_err_t spim_xfer(NRF_SPIM_Type * p_spim,
|
|||
nrf_spim_tx_buffer_set(p_spim, p_xfer_desc->p_tx_buffer, p_xfer_desc->tx_length);
|
||||
nrf_spim_rx_buffer_set(p_spim, p_xfer_desc->p_rx_buffer, p_xfer_desc->rx_length);
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED)
|
||||
if (p_spim == NRF_SPIM3)
|
||||
{
|
||||
anomaly_198_enable(p_xfer_desc->p_tx_buffer, p_xfer_desc->tx_length);
|
||||
}
|
||||
#endif
|
||||
|
||||
nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END);
|
||||
|
||||
spim_list_enable_handle(p_spim, flags);
|
||||
|
@ -446,6 +498,13 @@ static nrfx_err_t spim_xfer(NRF_SPIM_Type * p_spim,
|
|||
if (!p_cb->handler)
|
||||
{
|
||||
while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){}
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED)
|
||||
if (p_spim == NRF_SPIM3)
|
||||
{
|
||||
anomaly_198_disable();
|
||||
}
|
||||
#endif
|
||||
if (p_cb->ss_pin != NRFX_SPIM_PIN_NOT_USED)
|
||||
{
|
||||
#if NRFX_CHECK(NRFX_SPIM_EXTENDED_ENABLED)
|
||||
|
@ -576,6 +635,12 @@ static void irq_handler(NRF_SPIM_Type * p_spim, spim_control_block_t * p_cb)
|
|||
|
||||
if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END))
|
||||
{
|
||||
#if NRFX_CHECK(NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED)
|
||||
if (p_spim == NRF_SPIM3)
|
||||
{
|
||||
anomaly_198_disable();
|
||||
}
|
||||
#endif
|
||||
nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END);
|
||||
NRFX_ASSERT(p_cb->handler);
|
||||
NRFX_LOG_DEBUG("Event: NRF_SPIM_EVENT_END.");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2013 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -44,13 +44,6 @@
|
|||
#define NRFX_LOG_MODULE SPIS
|
||||
#include <nrfx_log.h>
|
||||
|
||||
#if defined(NRF51) && !defined(SPIS1_EASYDMA_MAXCNT_SIZE)
|
||||
/* MDK comes with SPIS0 definition of maximum transmission length but nRF51 Series is equipped
|
||||
* with SPIS1 only. It is a simple workaround and will be removed in the next release of the MDK.
|
||||
*/
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE SPIS0_EASYDMA_MAXCNT_SIZE
|
||||
#endif
|
||||
|
||||
#define EVT_TO_STR(event) \
|
||||
(event == NRF_SPIS_EVENT_ACQUIRED ? "NRF_SPIS_EVENT_ACQUIRED" : \
|
||||
(event == NRF_SPIS_EVENT_END ? "NRF_SPIS_EVENT_END" : \
|
||||
|
@ -116,15 +109,18 @@ typedef struct
|
|||
volatile uint8_t * rx_buffer; //!< SPI slave RX buffer.
|
||||
nrfx_drv_state_t state; //!< driver initialization state.
|
||||
volatile nrfx_spis_state_t spi_state; //!< SPI slave state.
|
||||
void * p_context; //!< Context set on initialization.
|
||||
} spis_cb_t;
|
||||
|
||||
static spis_cb_t m_cb[NRFX_SPIS_ENABLED_COUNT];
|
||||
|
||||
nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
||||
nrfx_spis_config_t const * p_config,
|
||||
nrfx_spis_event_handler_t event_handler)
|
||||
nrfx_spis_event_handler_t event_handler,
|
||||
void * p_context)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(event_handler);
|
||||
spis_cb_t * p_cb = &m_cb[p_instance->drv_inst_idx];
|
||||
nrfx_err_t err_code;
|
||||
|
||||
|
@ -139,7 +135,7 @@ nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if ((uint32_t)p_config->mode > (uint32_t)NRFX_SPIS_MODE_3)
|
||||
if ((uint32_t)p_config->mode > (uint32_t)NRF_SPIS_MODE_3)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
|
@ -147,14 +143,6 @@ nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
|||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
if (!event_handler)
|
||||
{
|
||||
err_code = NRFX_ERROR_NULL;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
#if NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
static nrfx_irq_handler_t const irq_handlers[NRFX_SPIS_ENABLED_COUNT] = {
|
||||
#if NRFX_CHECK(NRFX_SPIS0_ENABLED)
|
||||
|
@ -232,8 +220,7 @@ nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
|||
nrf_spis_tx_buffer_set(p_spis, NULL, 0);
|
||||
|
||||
// Configure SPI mode.
|
||||
nrf_spis_configure(p_spis, (nrf_spis_mode_t) p_config->mode,
|
||||
(nrf_spis_bit_order_t) p_config->bit_order);
|
||||
nrf_spis_configure(p_spis, p_config->mode, p_config->bit_order);
|
||||
|
||||
// Configure DEF and ORC characters.
|
||||
nrf_spis_def_set(p_spis, p_config->def);
|
||||
|
@ -246,8 +233,9 @@ nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
|||
// Enable END_ACQUIRE shortcut.
|
||||
nrf_spis_shorts_enable(p_spis, NRF_SPIS_SHORT_END_ACQUIRE);
|
||||
|
||||
m_cb[p_instance->drv_inst_idx].spi_state = SPIS_STATE_INIT;
|
||||
m_cb[p_instance->drv_inst_idx].handler = event_handler;
|
||||
p_cb->spi_state = SPIS_STATE_INIT;
|
||||
p_cb->handler = event_handler;
|
||||
p_cb->p_context = p_context;
|
||||
|
||||
#if defined(USE_DMA_ISSUE_WORKAROUND)
|
||||
// Configure a GPIOTE channel to generate interrupts on each falling edge
|
||||
|
@ -285,11 +273,8 @@ nrfx_err_t nrfx_spis_init(nrfx_spis_t const * const p_instance,
|
|||
// Enable SPI slave device.
|
||||
nrf_spis_enable(p_spis);
|
||||
|
||||
err_code = NRFX_SUCCESS;
|
||||
NRFX_LOG_INFO("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
NRFX_LOG_INFO("Initialized.");
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -311,7 +296,7 @@ void nrfx_spis_uninit(nrfx_spis_t const * const p_instance)
|
|||
#endif
|
||||
|
||||
p_cb->state = NRFX_DRV_STATE_UNINITIALIZED;
|
||||
NRFX_LOG_INFO("Initialized.");
|
||||
NRFX_LOG_INFO("Uninitialized.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -319,7 +304,7 @@ void nrfx_spis_uninit(nrfx_spis_t const * const p_instance)
|
|||
static void spis_state_entry_action_execute(NRF_SPIS_Type * p_spis,
|
||||
spis_cb_t * p_cb)
|
||||
{
|
||||
nrfx_spis_event_t event;
|
||||
nrfx_spis_evt_t event;
|
||||
|
||||
switch (p_cb->spi_state)
|
||||
{
|
||||
|
@ -333,7 +318,7 @@ static void spis_state_entry_action_execute(NRF_SPIS_Type * p_spis,
|
|||
event.tx_amount = 0;
|
||||
|
||||
NRFX_ASSERT(p_cb->handler != NULL);
|
||||
p_cb->handler(event);
|
||||
p_cb->handler(&event, p_cb->p_context);
|
||||
break;
|
||||
|
||||
case SPIS_XFER_COMPLETED:
|
||||
|
@ -345,7 +330,7 @@ static void spis_state_entry_action_execute(NRF_SPIS_Type * p_spis,
|
|||
NRFX_LOG_HEXDUMP_DEBUG((uint8_t const *)p_cb->rx_buffer,
|
||||
event.rx_amount * sizeof(p_cb->rx_buffer[0]));
|
||||
NRFX_ASSERT(p_cb->handler != NULL);
|
||||
p_cb->handler(event);
|
||||
p_cb->handler(&event, p_cb->p_context);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -374,14 +359,12 @@ nrfx_err_t nrfx_spis_buffers_set(nrfx_spis_t const * const p_instance,
|
|||
uint8_t * p_rx_buffer,
|
||||
size_t rx_buffer_length)
|
||||
{
|
||||
NRFX_ASSERT(p_tx_buffer != NULL || tx_buffer_length == 0);
|
||||
NRFX_ASSERT(p_rx_buffer != NULL || rx_buffer_length == 0);
|
||||
|
||||
spis_cb_t * p_cb = &m_cb[p_instance->drv_inst_idx];
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (p_rx_buffer == NULL || p_tx_buffer == NULL)
|
||||
{
|
||||
return NRFX_ERROR_NULL;
|
||||
}
|
||||
|
||||
if (!SPIS_LENGTH_VALIDATE(p_instance->drv_inst_idx,
|
||||
rx_buffer_length,
|
||||
tx_buffer_length))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -271,7 +271,7 @@ void nrfx_swi_trigger(nrfx_swi_t swi, uint8_t flag_number)
|
|||
if (p_egu == NULL)
|
||||
{
|
||||
m_swi_flags[swi - NRFX_SWI_EGU_COUNT] |= (1 << flag_number);
|
||||
NVIC_SetPendingIRQ(swi_irq_number_get(swi));
|
||||
NRFX_IRQ_PENDING_SET(swi_irq_number_get(swi));
|
||||
}
|
||||
else
|
||||
#endif // (NRFX_SWI_EGU_COUNT < SWI_COUNT)
|
||||
|
@ -283,7 +283,7 @@ void nrfx_swi_trigger(nrfx_swi_t swi, uint8_t flag_number)
|
|||
#else // -> #if !NRFX_SWI_EGU_COUNT
|
||||
|
||||
m_swi_flags[swi - NRFX_SWI_EGU_COUNT] |= (1 << flag_number);
|
||||
NVIC_SetPendingIRQ(swi_irq_number_get(swi));
|
||||
NRFX_IRQ_PENDING_SET(swi_irq_number_get(swi));
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -74,7 +74,7 @@
|
|||
* @param us Time in microseconds to check
|
||||
*/
|
||||
#define NRFX_SYSTICK_ASSERT_TIMEOUT(us) \
|
||||
NRFX_ASSERT(us <= (NRFX_SYSTICK_TICKS_MAX / ((SystemCoreClock) / NRFX_SYSTICK_US)))
|
||||
NRFX_ASSERT(us <= (NRFX_SYSTICK_TICKS_MAX / ((SystemCoreClock) / NRFX_SYSTICK_US)));
|
||||
|
||||
/**
|
||||
* @brief Function that converts microseconds to ticks
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -63,6 +63,7 @@ nrfx_err_t nrfx_timer_init(nrfx_timer_t const * const p_instance,
|
|||
NRFX_ASSERT(p_instance->p_reg != NRF_TIMER0);
|
||||
#endif
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(timer_event_handler);
|
||||
|
||||
nrfx_err_t err_code;
|
||||
|
||||
|
@ -75,15 +76,6 @@ nrfx_err_t nrfx_timer_init(nrfx_timer_t const * const p_instance,
|
|||
return err_code;
|
||||
}
|
||||
|
||||
if (timer_event_handler == NULL)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
/* Warning 685: Relational operator '<=' always evaluates to 'true'"
|
||||
* Warning in NRF_TIMER_IS_BIT_WIDTH_VALID macro. Macro validate timers resolution.
|
||||
* Not necessary in nRF52 based systems. Obligatory in nRF51 based systems.
|
||||
|
@ -131,10 +123,7 @@ void nrfx_timer_uninit(nrfx_timer_t const * const p_instance)
|
|||
nrf_timer_int_disable(p_instance->p_reg, DISABLE_ALL);
|
||||
#undef DISABLE_ALL
|
||||
|
||||
if (m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_POWERED_ON)
|
||||
{
|
||||
nrfx_timer_disable(p_instance);
|
||||
}
|
||||
|
||||
m_cb[p_instance->instance_id].state = NRFX_DRV_STATE_UNINITIALIZED;
|
||||
NRFX_LOG_INFO("Uninitialized instance: %d.", p_instance->instance_id);
|
||||
|
@ -150,7 +139,7 @@ void nrfx_timer_enable(nrfx_timer_t const * const p_instance)
|
|||
|
||||
void nrfx_timer_disable(nrfx_timer_t const * const p_instance)
|
||||
{
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_POWERED_ON);
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_SHUTDOWN);
|
||||
m_cb[p_instance->instance_id].state = NRFX_DRV_STATE_INITIALIZED;
|
||||
NRFX_LOG_INFO("Disabled instance: %d.", p_instance->instance_id);
|
||||
|
@ -164,14 +153,14 @@ bool nrfx_timer_is_enabled(nrfx_timer_t const * const p_instance)
|
|||
|
||||
void nrfx_timer_resume(nrfx_timer_t const * const p_instance)
|
||||
{
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_POWERED_ON);
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START);
|
||||
NRFX_LOG_INFO("Resumed instance: %d.", p_instance->instance_id);
|
||||
}
|
||||
|
||||
void nrfx_timer_pause(nrfx_timer_t const * const p_instance)
|
||||
{
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_POWERED_ON);
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_STOP);
|
||||
NRFX_LOG_INFO("Paused instance: %d.", p_instance->instance_id);
|
||||
}
|
||||
|
@ -184,7 +173,7 @@ void nrfx_timer_clear(nrfx_timer_t const * const p_instance)
|
|||
|
||||
void nrfx_timer_increment(nrfx_timer_t const * const p_instance)
|
||||
{
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_POWERED_ON);
|
||||
NRFX_ASSERT(m_cb[p_instance->instance_id].state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
NRFX_ASSERT(nrf_timer_mode_get(p_instance->p_reg) != NRF_TIMER_MODE_TIMER);
|
||||
|
||||
nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_COUNT);
|
||||
|
@ -219,7 +208,7 @@ void nrfx_timer_compare(nrfx_timer_t const * const p_instance,
|
|||
}
|
||||
|
||||
nrf_timer_cc_write(p_instance->p_reg, cc_channel, cc_value);
|
||||
NRFX_LOG_INFO("Timer id: %d, capture value set: %d, channel: %d.",
|
||||
NRFX_LOG_INFO("Timer id: %d, capture value set: %lu, channel: %d.",
|
||||
p_instance->instance_id,
|
||||
cc_value,
|
||||
cc_channel);
|
||||
|
@ -241,7 +230,7 @@ void nrfx_timer_extended_compare(nrfx_timer_t const * const p_instance,
|
|||
cc_channel,
|
||||
cc_value,
|
||||
enable_int);
|
||||
NRFX_LOG_INFO("Timer id: %d, capture value set: %d, channel: %d.",
|
||||
NRFX_LOG_INFO("Timer id: %d, capture value set: %lu, channel: %d.",
|
||||
p_instance->instance_id,
|
||||
cc_value,
|
||||
cc_channel);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, 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 Nordic Semiconductor ASA 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 NORDIC SEMICONDUCTOR ASA 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>
|
||||
|
||||
#ifdef ADC_PRESENT
|
||||
#include <hal/nrf_adc.h>
|
||||
|
||||
/**
|
||||
* @brief Function for configuring ADC.
|
||||
*
|
||||
* This function powers on ADC and configures it. ADC is in DISABLE state after configuration,
|
||||
* so it should be enabled before using it.
|
||||
*
|
||||
* @param[in] config Requested configuration.
|
||||
*/
|
||||
void nrf_adc_configure(nrf_adc_config_t * config)
|
||||
{
|
||||
uint32_t config_reg = 0;
|
||||
|
||||
config_reg |= ((uint32_t)config->resolution << ADC_CONFIG_RES_Pos) & ADC_CONFIG_RES_Msk;
|
||||
config_reg |= ((uint32_t)config->scaling << ADC_CONFIG_INPSEL_Pos) & ADC_CONFIG_INPSEL_Msk;
|
||||
config_reg |= ((uint32_t)config->reference << ADC_CONFIG_REFSEL_Pos) & ADC_CONFIG_REFSEL_Msk;
|
||||
|
||||
if (config->reference & ADC_CONFIG_EXTREFSEL_Msk)
|
||||
{
|
||||
config_reg |= config->reference & ADC_CONFIG_EXTREFSEL_Msk;
|
||||
}
|
||||
|
||||
/* select input */
|
||||
nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_DISABLED);
|
||||
|
||||
/* set new configuration keeping selected input */
|
||||
NRF_ADC->CONFIG = config_reg | (NRF_ADC->CONFIG & ADC_CONFIG_PSEL_Msk);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Blocking function for executing single ADC conversion.
|
||||
*
|
||||
* This function selects the desired input, starts a single conversion,
|
||||
* waits for it to finish, and returns the result.
|
||||
* ADC is left in STOP state, the given input is selected.
|
||||
* This function does not check if ADC is initialized and powered.
|
||||
*
|
||||
* @param[in] input Requested input to be selected.
|
||||
*
|
||||
* @return Conversion result
|
||||
*/
|
||||
int32_t nrf_adc_convert_single(nrf_adc_config_input_t input)
|
||||
{
|
||||
int32_t val;
|
||||
|
||||
nrf_adc_input_select(input);
|
||||
nrf_adc_start();
|
||||
|
||||
while (!nrf_adc_conversion_finished())
|
||||
{
|
||||
}
|
||||
nrf_adc_conversion_event_clean();
|
||||
val = nrf_adc_result_get();
|
||||
nrf_adc_stop();
|
||||
return val;
|
||||
}
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -55,9 +55,9 @@ typedef enum
|
|||
/** @brief Resolution of the analog-to-digital converter. */
|
||||
typedef enum
|
||||
{
|
||||
NRF_ADC_CONFIG_RES_8BIT = ADC_CONFIG_RES_8bit, /**< 8 bit resolution. */
|
||||
NRF_ADC_CONFIG_RES_9BIT = ADC_CONFIG_RES_9bit, /**< 9 bit resolution. */
|
||||
NRF_ADC_CONFIG_RES_10BIT = ADC_CONFIG_RES_10bit, /**< 10 bit resolution. */
|
||||
NRF_ADC_CONFIG_RES_8BIT = ADC_CONFIG_RES_8bit, /**< 8-bit resolution. */
|
||||
NRF_ADC_CONFIG_RES_9BIT = ADC_CONFIG_RES_9bit, /**< 9-bit resolution. */
|
||||
NRF_ADC_CONFIG_RES_10BIT = ADC_CONFIG_RES_10bit, /**< 10-bit resolution. */
|
||||
} nrf_adc_config_resolution_t;
|
||||
|
||||
|
||||
|
@ -71,6 +71,17 @@ typedef enum
|
|||
NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD = ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling /**< 1/3 of supply. */
|
||||
} nrf_adc_config_scaling_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief External reference selection of the analog-to-digital converter.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRF_ADC_CONFIG_EXTREFSEL_NONE = ADC_CONFIG_EXTREFSEL_None, /**< Analog reference inputs disabled. */
|
||||
NRF_ADC_CONFIG_EXTREFSEL_AREF0 = ADC_CONFIG_EXTREFSEL_AnalogReference0, /**< AREF0 as analog reference. */
|
||||
NRF_ADC_CONFIG_EXTREFSEL_AREF1 = ADC_CONFIG_EXTREFSEL_AnalogReference1 /**< AREF1 as analog reference. */
|
||||
} nrf_adc_config_extref_t;
|
||||
|
||||
/**
|
||||
* @brief Reference selection of the analog-to-digital converter.
|
||||
*/
|
||||
|
@ -79,11 +90,7 @@ typedef enum
|
|||
NRF_ADC_CONFIG_REF_VBG = ADC_CONFIG_REFSEL_VBG, /**< 1.2 V reference. */
|
||||
NRF_ADC_CONFIG_REF_SUPPLY_ONE_HALF = ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling, /**< 1/2 of power supply. */
|
||||
NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling, /**< 1/3 of power supply. */
|
||||
NRF_ADC_CONFIG_REF_EXT_REF0 = ADC_CONFIG_REFSEL_External |
|
||||
ADC_CONFIG_EXTREFSEL_AnalogReference0 <<
|
||||
ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */
|
||||
NRF_ADC_CONFIG_REF_EXT_REF1 = ADC_CONFIG_REFSEL_External |
|
||||
ADC_CONFIG_EXTREFSEL_AnalogReference1 << ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */
|
||||
NRF_ADC_CONFIG_REF_EXT = ADC_CONFIG_REFSEL_External /**< External reference. See @ref nrf_adc_config_extref_t for further configuration.*/
|
||||
} nrf_adc_config_reference_t;
|
||||
|
||||
/** @brief Input selection of the analog-to-digital converter. */
|
||||
|
@ -113,7 +120,7 @@ typedef enum
|
|||
typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
|
||||
{
|
||||
/*lint -save -e30*/
|
||||
NRF_ADC_EVENT_END = offsetof(NRF_ADC_Type, EVENTS_END) /**< End of conversion event. */
|
||||
NRF_ADC_EVENT_END = offsetof(NRF_ADC_Type, EVENTS_END) /**< End of a conversion event. */
|
||||
/*lint -restore*/
|
||||
} nrf_adc_event_t;
|
||||
|
||||
|
@ -123,161 +130,45 @@ typedef struct
|
|||
nrf_adc_config_resolution_t resolution; /**< ADC resolution. */
|
||||
nrf_adc_config_scaling_t scaling; /**< ADC scaling factor. */
|
||||
nrf_adc_config_reference_t reference; /**< ADC reference. */
|
||||
nrf_adc_config_input_t input; /**< ADC input selection. */
|
||||
nrf_adc_config_extref_t extref; /**< ADC external reference selection. */
|
||||
} nrf_adc_config_t;
|
||||
|
||||
/**@brief Analog-to-digital value type. */
|
||||
typedef int16_t nrf_adc_value_t;
|
||||
|
||||
/** Default ADC configuration. */
|
||||
#define NRF_ADC_CONFIG_DEFAULT { NRF_ADC_CONFIG_RES_10BIT, \
|
||||
NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD, \
|
||||
NRF_ADC_CONFIG_REF_VBG }
|
||||
typedef uint16_t nrf_adc_value_t;
|
||||
|
||||
/**
|
||||
* @brief Function for configuring ADC.
|
||||
* @brief Function for activating a specific ADC task.
|
||||
*
|
||||
* This function powers on the analog-to-digital converter and configures it.
|
||||
* After the configuration, the ADC is in DISABLE state and must be
|
||||
* enabled before using it.
|
||||
*
|
||||
* @param[in] config Configuration parameters.
|
||||
* @param[in] task Task to activate.
|
||||
*/
|
||||
void nrf_adc_configure(nrf_adc_config_t * config);
|
||||
|
||||
/**
|
||||
* @brief Blocking function for executing a single ADC conversion.
|
||||
*
|
||||
* This function selects the desired input, starts a single conversion,
|
||||
* waits for it to finish, and returns the result.
|
||||
* After the input is selected, the analog-to-digital converter
|
||||
* is left in STOP state.
|
||||
* The function does not check if the ADC is initialized and powered.
|
||||
*
|
||||
* @param[in] input Input to be selected.
|
||||
*
|
||||
* @return Conversion result.
|
||||
*/
|
||||
int32_t nrf_adc_convert_single(nrf_adc_config_input_t input);
|
||||
|
||||
/**
|
||||
* @brief Function for selecting ADC input.
|
||||
*
|
||||
* This function selects the active input of ADC. Ensure that
|
||||
* the ADC is powered on and in IDLE state before calling this function.
|
||||
*
|
||||
* @param[in] input Input to be selected.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_input_select(nrf_adc_config_input_t input)
|
||||
{
|
||||
NRF_ADC->CONFIG =
|
||||
((uint32_t)input << ADC_CONFIG_PSEL_Pos) | (NRF_ADC->CONFIG & ~ADC_CONFIG_PSEL_Msk);
|
||||
|
||||
if (input != NRF_ADC_CONFIG_INPUT_DISABLED)
|
||||
{
|
||||
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled << ADC_ENABLE_ENABLE_Pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled << ADC_ENABLE_ENABLE_Pos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for retrieving the ADC conversion result.
|
||||
*
|
||||
* This function retrieves and returns the last analog-to-digital conversion result.
|
||||
*
|
||||
* @return Last conversion result.
|
||||
*/
|
||||
__STATIC_INLINE int32_t nrf_adc_result_get(void)
|
||||
{
|
||||
return (int32_t)NRF_ADC->RESULT;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for checking whether the ADC is busy.
|
||||
*
|
||||
* This function checks whether the analog-to-digital converter is busy with a conversion.
|
||||
*
|
||||
* @retval true If the ADC is busy.
|
||||
* @retval false If the ADC is not busy.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_adc_is_busy(void)
|
||||
{
|
||||
return ( (NRF_ADC->BUSY & ADC_BUSY_BUSY_Msk) == ADC_BUSY_BUSY_Msk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function for getting the ADC's enabled interrupts.
|
||||
*
|
||||
* @param[in] mask Mask of interrupts to check.
|
||||
*
|
||||
* @return State of the interrupts selected by the mask.
|
||||
*
|
||||
* @sa nrf_adc_int_enable()
|
||||
* @sa nrf_adc_int_disable()
|
||||
*/
|
||||
__STATIC_INLINE uint32_t nrf_adc_int_get(uint32_t mask)
|
||||
{
|
||||
return (NRF_ADC->INTENSET & mask); // when read this register will return the value of INTEN.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for starting conversion.
|
||||
*
|
||||
* @sa nrf_adc_stop()
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_start(void)
|
||||
{
|
||||
NRF_ADC->TASKS_START = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for stopping conversion.
|
||||
*
|
||||
* If the analog-to-digital converter is in inactive state, power consumption is reduced.
|
||||
*
|
||||
* @sa nrf_adc_start()
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_stop(void)
|
||||
{
|
||||
NRF_ADC->TASKS_STOP = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for checking if the requested ADC conversion has ended.
|
||||
*
|
||||
* @retval true If the task has finished.
|
||||
* @retval false If the task is still running.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_adc_conversion_finished(void)
|
||||
{
|
||||
return ((bool)NRF_ADC->EVENTS_END);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function for clearing the conversion END event.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_conversion_event_clean(void)
|
||||
{
|
||||
NRF_ADC->EVENTS_END = 0;
|
||||
}
|
||||
__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task);
|
||||
|
||||
/**
|
||||
* @brief Function for getting the address of an ADC task register.
|
||||
*
|
||||
* @param[in] adc_task ADC task.
|
||||
* @param[in] task ADC task.
|
||||
*
|
||||
* @return Address of the specified ADC task.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task);
|
||||
__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t task);
|
||||
|
||||
/**
|
||||
* @brief Function for checking the state of an ADC event.
|
||||
*
|
||||
* @param[in] event Event to check.
|
||||
*
|
||||
* @retval true If the event is set.
|
||||
* @retval false If the event is not set.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event);
|
||||
|
||||
/**
|
||||
* @brief Function for clearing an ADC event.
|
||||
*
|
||||
* @param[in] event Event to clear.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event);
|
||||
|
||||
/**
|
||||
* @brief Function for getting the address of a specific ADC event register.
|
||||
|
@ -289,96 +180,88 @@ __STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task);
|
|||
__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event);
|
||||
|
||||
/**
|
||||
* @brief Function for setting the CONFIG register in ADC.
|
||||
*
|
||||
* @param[in] configuration Value to be written to the CONFIG register.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration);
|
||||
|
||||
/**
|
||||
* @brief Function for clearing an ADC event.
|
||||
*
|
||||
* @param[in] event Event to clear.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event);
|
||||
|
||||
/**
|
||||
* @brief Function for checking state of an ADC event.
|
||||
*
|
||||
* @param[in] event Event to check.
|
||||
*
|
||||
* @retval true If the event is set.
|
||||
* @retval false If the event is not set.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event);
|
||||
|
||||
/**
|
||||
* @brief Function for enabling specified interrupts.
|
||||
* @brief Function for enabling the specified interrupts.
|
||||
*
|
||||
* @param[in] int_mask Interrupts to enable.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling specified interrupts.
|
||||
* @brief Function for disabling the specified interrupts.
|
||||
*
|
||||
* @param[in] int_mask Interrupts to disable.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask);
|
||||
|
||||
/**
|
||||
* @brief Function for retrieving the state of a given interrupt.
|
||||
* @brief Function for retrieving the state of the specified ADC interrupts.
|
||||
*
|
||||
* @param[in] int_mask Interrupt to check.
|
||||
* @param[in] int_mask Interrupts to check.
|
||||
*
|
||||
* @retval true If the interrupt is enabled.
|
||||
* @retval false If the interrupt is not enabled.
|
||||
* @retval true If all specified interrupts are enabled.
|
||||
* @retval false If at least one of the given interrupts is not enabled.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask);
|
||||
__STATIC_INLINE bool nrf_adc_int_enable_check(uint32_t int_mask);
|
||||
|
||||
/**
|
||||
* @brief Function for activating a specific ADC task.
|
||||
* @brief Function for checking whether the ADC is busy.
|
||||
*
|
||||
* @param[in] task Task to activate.
|
||||
* This function checks whether the ADC converter is busy with a conversion.
|
||||
*
|
||||
* @retval true If the ADC is busy.
|
||||
* @retval false If the ADC is not busy.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task);
|
||||
__STATIC_INLINE bool nrf_adc_busy_check(void);
|
||||
|
||||
/**
|
||||
* @brief Function for enabling ADC.
|
||||
* @brief Function for enabling the ADC.
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling ADC.
|
||||
* @brief Function for disabling the ADC.
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_disable(void);
|
||||
|
||||
/**
|
||||
* @brief Function for checking if the ADC is enabled.
|
||||
*
|
||||
* @retval true If the ADC is enabled.
|
||||
* @retval false If the ADC is not enabled.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_adc_enable_check(void);
|
||||
|
||||
/**
|
||||
* @brief Function for retrieving the ADC conversion result.
|
||||
*
|
||||
* This function retrieves and returns the last analog-to-digital conversion result.
|
||||
*
|
||||
* @return Last conversion result.
|
||||
*/
|
||||
__STATIC_INLINE nrf_adc_value_t nrf_adc_result_get(void);
|
||||
|
||||
/**
|
||||
* @brief Function for initializing the ADC.
|
||||
*
|
||||
* This function writes data to ADC's CONFIG register. After the configuration,
|
||||
* the ADC is in DISABLE state and must be enabled before using it.
|
||||
*
|
||||
* @param[in] p_config Configuration parameters.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_adc_init(nrf_adc_config_t const * p_config);
|
||||
|
||||
#ifndef SUPPRESS_INLINE_IMPLEMENTATION
|
||||
|
||||
__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task)
|
||||
{
|
||||
*((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)task)) = 0x1UL;
|
||||
}
|
||||
|
||||
__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task)
|
||||
{
|
||||
return (uint32_t)((uint8_t *)NRF_ADC + adc_task);
|
||||
}
|
||||
|
||||
__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event)
|
||||
{
|
||||
return (uint32_t)((uint8_t *)NRF_ADC + adc_event);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration)
|
||||
{
|
||||
NRF_ADC->CONFIG = configuration;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event)
|
||||
{
|
||||
*((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event)) = 0x0UL;
|
||||
#if __CORTEX_M == 0x04
|
||||
volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event));
|
||||
(void)dummy;
|
||||
#endif
|
||||
return (uint32_t)((uint8_t *)NRF_ADC + (uint32_t)adc_task);
|
||||
}
|
||||
|
||||
__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event)
|
||||
|
@ -386,6 +269,16 @@ __STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event)
|
|||
return (bool)*(volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event)
|
||||
{
|
||||
*((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event)) = 0x0UL;
|
||||
}
|
||||
|
||||
__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event)
|
||||
{
|
||||
return (uint32_t)((uint8_t *)NRF_ADC + (uint32_t)adc_event);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask)
|
||||
{
|
||||
NRF_ADC->INTENSET = int_mask;
|
||||
|
@ -396,28 +289,48 @@ __STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask)
|
|||
NRF_ADC->INTENCLR = int_mask;
|
||||
}
|
||||
|
||||
__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask)
|
||||
__STATIC_INLINE bool nrf_adc_int_enable_check(uint32_t int_mask)
|
||||
{
|
||||
return (bool)(NRF_ADC->INTENSET & int_mask);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task)
|
||||
__STATIC_INLINE bool nrf_adc_busy_check(void)
|
||||
{
|
||||
*((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)task)) = 0x1UL;
|
||||
return ((NRF_ADC->BUSY & ADC_BUSY_BUSY_Msk) == (ADC_BUSY_BUSY_Busy << ADC_BUSY_BUSY_Pos));
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_enable(void)
|
||||
{
|
||||
NRF_ADC->ENABLE = 1;
|
||||
NRF_ADC->ENABLE = (ADC_ENABLE_ENABLE_Enabled << ADC_ENABLE_ENABLE_Pos);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_disable(void)
|
||||
{
|
||||
NRF_ADC->ENABLE = 0;
|
||||
NRF_ADC->ENABLE = (ADC_ENABLE_ENABLE_Disabled << ADC_ENABLE_ENABLE_Pos);
|
||||
}
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
__STATIC_INLINE bool nrf_adc_enable_check(void)
|
||||
{
|
||||
return (NRF_ADC->ENABLE == (ADC_ENABLE_ENABLE_Enabled << ADC_ENABLE_ENABLE_Pos));
|
||||
}
|
||||
|
||||
__STATIC_INLINE nrf_adc_value_t nrf_adc_result_get(void)
|
||||
{
|
||||
return (nrf_adc_value_t)NRF_ADC->RESULT;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_adc_init(nrf_adc_config_t const * p_config)
|
||||
{
|
||||
NRF_ADC->CONFIG =
|
||||
((p_config->resolution << ADC_CONFIG_RES_Pos) & ADC_CONFIG_RES_Msk)
|
||||
|((p_config->scaling << ADC_CONFIG_INPSEL_Pos) & ADC_CONFIG_INPSEL_Msk)
|
||||
|((p_config->reference << ADC_CONFIG_REFSEL_Pos) & ADC_CONFIG_REFSEL_Msk)
|
||||
|((p_config->input << ADC_CONFIG_PSEL_Pos) & ADC_CONFIG_PSEL_Msk)
|
||||
|((p_config->extref << ADC_CONFIG_EXTREFSEL_Pos) & ADC_CONFIG_EXTREFSEL_Msk);
|
||||
}
|
||||
|
||||
#endif // SUPPRESS_INLINE_IMPLEMENTATION
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2012 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2012 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -32,7 +32,7 @@
|
|||
//lint -e438
|
||||
|
||||
#include <nrfx.h>
|
||||
#include <nrf_ecb.h>
|
||||
#include "nrf_ecb.h"
|
||||
#include <string.h>
|
||||
|
||||
static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2012 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2012 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -130,6 +130,126 @@ typedef enum
|
|||
*
|
||||
* @returns number of available channels.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t nrf_egu_channel_count(NRF_EGU_Type * NRF_EGUx);
|
||||
|
||||
/**
|
||||
* @brief Function for triggering a specific EGU task.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_task EGU task.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_task_trigger(NRF_EGU_Type * NRF_EGUx, nrf_egu_task_t egu_task);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU task register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_task EGU task.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_task_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_task_t egu_task);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU TRIGGER task register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_task_trigger_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the specific EGU TRIGGER task.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE nrf_egu_task_t nrf_egu_task_trigger_get(NRF_EGU_Type * NRF_EGUx, uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the state of a specific EGU event.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_event EGU event to check.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_egu_event_check(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_event_t egu_event);
|
||||
|
||||
/**
|
||||
* @brief Function for clearing a specific EGU event.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_event EGU event to clear.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_event_clear(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_event_t egu_event);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU event register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_event EGU event.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_event_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_event_t egu_event);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU TRIGGERED event register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_event_triggered_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the specific EGU TRIGGERED event.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE nrf_egu_event_t nrf_egu_event_triggered_get(NRF_EGU_Type * NRF_EGUx,
|
||||
uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief Function for enabling one or more specific EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_int_mask Interrupts to enable.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_int_enable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask);
|
||||
|
||||
/**
|
||||
* @brief Function for retrieving the state of one or more EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_int_mask Interrupts to check.
|
||||
*
|
||||
* @retval true If all of the specified interrupts are enabled.
|
||||
* @retval false If at least one of the specified interrupts is disabled.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_egu_int_enable_check(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling one or more specific EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_int_mask Interrupts to disable.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_int_disable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask);
|
||||
|
||||
/**
|
||||
* @brief Function for retrieving one or more specific EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*
|
||||
* @returns EGU interrupt mask.
|
||||
*/
|
||||
__STATIC_INLINE nrf_egu_int_mask_t nrf_egu_int_get(NRF_EGU_Type * NRF_EGUx, uint8_t channel);
|
||||
|
||||
#ifndef SUPPRESS_INLINE_IMPLEMENTATION
|
||||
|
||||
__STATIC_INLINE uint32_t nrf_egu_channel_count(NRF_EGU_Type * NRF_EGUx)
|
||||
{
|
||||
if (NRF_EGUx == NRF_EGU0){
|
||||
|
@ -155,25 +275,12 @@ __STATIC_INLINE uint32_t nrf_egu_channel_count(NRF_EGU_Type * NRF_EGUx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function for triggering a specific EGU task.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_task EGU task.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_task_trigger(NRF_EGU_Type * NRF_EGUx, nrf_egu_task_t egu_task)
|
||||
{
|
||||
NRFX_ASSERT(NRF_EGUx);
|
||||
*((volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_task)) = 0x1UL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU task register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_task EGU task.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_task_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_task_t egu_task)
|
||||
{
|
||||
|
@ -181,13 +288,6 @@ __STATIC_INLINE uint32_t * nrf_egu_task_address_get(NRF_EGU_Type * NRF_EGUx,
|
|||
return (uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_task);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU TRIGGER task register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_task_trigger_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
uint8_t channel)
|
||||
{
|
||||
|
@ -196,13 +296,6 @@ __STATIC_INLINE uint32_t * nrf_egu_task_trigger_address_get(NRF_EGU_Type * NRF_E
|
|||
return (uint32_t*)&NRF_EGUx->TASKS_TRIGGER[channel];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for returning the specific EGU TRIGGER task.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE nrf_egu_task_t nrf_egu_task_trigger_get(NRF_EGU_Type * NRF_EGUx, uint8_t channel)
|
||||
{
|
||||
NRFX_ASSERT(NRF_EGUx);
|
||||
|
@ -210,13 +303,6 @@ __STATIC_INLINE nrf_egu_task_t nrf_egu_task_trigger_get(NRF_EGU_Type * NRF_EGUx,
|
|||
return (nrf_egu_task_t)((uint32_t) NRF_EGU_TASK_TRIGGER0 + (channel * sizeof(uint32_t)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for returning the state of a specific EGU event.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_event EGU event to check.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_egu_event_check(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_event_t egu_event)
|
||||
{
|
||||
|
@ -224,13 +310,6 @@ __STATIC_INLINE bool nrf_egu_event_check(NRF_EGU_Type * NRF_EGUx,
|
|||
return (bool)*(volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for clearing a specific EGU event.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_event EGU event to clear.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_event_clear(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_event_t egu_event)
|
||||
{
|
||||
|
@ -242,13 +321,6 @@ __STATIC_INLINE void nrf_egu_event_clear(NRF_EGU_Type * NRF_EGUx,
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU event register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_event EGU event.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_event_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
nrf_egu_event_t egu_event)
|
||||
{
|
||||
|
@ -256,13 +328,6 @@ __STATIC_INLINE uint32_t * nrf_egu_event_address_get(NRF_EGU_Type * NRF_EGUx,
|
|||
return (uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific EGU TRIGGERED event register.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_egu_event_triggered_address_get(NRF_EGU_Type * NRF_EGUx,
|
||||
uint8_t channel)
|
||||
{
|
||||
|
@ -271,13 +336,6 @@ __STATIC_INLINE uint32_t * nrf_egu_event_triggered_address_get(NRF_EGU_Type * NR
|
|||
return (uint32_t*)&NRF_EGUx->EVENTS_TRIGGERED[channel];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for returning the specific EGU TRIGGERED event.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*/
|
||||
__STATIC_INLINE nrf_egu_event_t nrf_egu_event_triggered_get(NRF_EGU_Type * NRF_EGUx,
|
||||
uint8_t channel)
|
||||
{
|
||||
|
@ -286,56 +344,24 @@ __STATIC_INLINE nrf_egu_event_t nrf_egu_event_triggered_get(NRF_EGU_Type * NRF_E
|
|||
return (nrf_egu_event_t)((uint32_t) NRF_EGU_EVENT_TRIGGERED0 + (channel * sizeof(uint32_t)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for enabling one or more specific EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_int_mask Interrupts to enable.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_int_enable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask)
|
||||
{
|
||||
NRFX_ASSERT(NRF_EGUx);
|
||||
NRF_EGUx->INTENSET = egu_int_mask;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for retrieving the state of one or more EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_int_mask Interrupts to check.
|
||||
*
|
||||
* @retval true If all of the specified interrupts are enabled.
|
||||
* @retval false If at least one of the specified interrupts is disabled.
|
||||
*/
|
||||
__STATIC_INLINE bool nrf_egu_int_enable_check(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask)
|
||||
{
|
||||
NRFX_ASSERT(NRF_EGUx);
|
||||
return (bool)(NRF_EGUx->INTENSET & egu_int_mask);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function for disabling one or more specific EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param egu_int_mask Interrupts to disable.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_egu_int_disable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask)
|
||||
{
|
||||
NRFX_ASSERT(NRF_EGUx);
|
||||
NRF_EGUx->INTENCLR = egu_int_mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function for retrieving one or more specific EGU interrupts.
|
||||
*
|
||||
* @param NRF_EGUx EGU instance.
|
||||
* @param channel Channel number.
|
||||
*
|
||||
* @returns EGU interrupt mask.
|
||||
*/
|
||||
__STATIC_INLINE nrf_egu_int_mask_t nrf_egu_int_get(NRF_EGU_Type * NRF_EGUx, uint8_t channel)
|
||||
{
|
||||
NRFX_ASSERT(NRF_EGUx);
|
||||
|
@ -343,6 +369,8 @@ __STATIC_INLINE nrf_egu_int_mask_t nrf_egu_int_get(NRF_EGU_Type * NRF_EGUx, uint
|
|||
return (nrf_egu_int_mask_t)((uint32_t) (EGU_INTENSET_TRIGGERED0_Msk << channel));
|
||||
}
|
||||
|
||||
#endif // SUPPRESS_INLINE_IMPLEMENTATION
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -59,7 +59,7 @@ extern "C" {
|
|||
/**
|
||||
* @brief Macro for mapping port and pin numbers to values understandable for nrf_gpio functions.
|
||||
*/
|
||||
#define NRF_GPIO_PIN_MAP(port, pin) ((port << 5) | (pin & 0x1F))
|
||||
#define NRF_GPIO_PIN_MAP(port, pin) (((port) << 5) | ((pin) & 0x1F))
|
||||
|
||||
/**
|
||||
* @brief Pin direction definitions.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2012 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2012 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <nrfx.h>
|
||||
#include <nrf_nvmc.h>
|
||||
#include "nrf_nvmc.h"
|
||||
|
||||
static inline void wait_for_flash_ready(void)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2012 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2012 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -158,11 +158,7 @@ typedef enum
|
|||
* @param[in] channel Channel to enable.
|
||||
*
|
||||
* */
|
||||
__STATIC_INLINE void nrf_ppi_channel_enable(nrf_ppi_channel_t channel)
|
||||
{
|
||||
NRF_PPI->CHENSET = PPI_CHENSET_CH0_Set << ((uint32_t) channel);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_enable(nrf_ppi_channel_t channel);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling a given PPI channel.
|
||||
|
@ -171,11 +167,7 @@ __STATIC_INLINE void nrf_ppi_channel_enable(nrf_ppi_channel_t channel)
|
|||
*
|
||||
* @param[in] channel Channel to disable.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channel_disable(nrf_ppi_channel_t channel)
|
||||
{
|
||||
NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Clear << ((uint32_t) channel);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_disable(nrf_ppi_channel_t channel);
|
||||
|
||||
/**
|
||||
* @brief Function for checking if a given PPI channel is enabled.
|
||||
|
@ -188,36 +180,19 @@ __STATIC_INLINE void nrf_ppi_channel_disable(nrf_ppi_channel_t channel)
|
|||
* @retval NRF_PPI_CHANNEL_DISABLED If the channel is not enabled.
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE nrf_ppi_channel_enable_t nrf_ppi_channel_enable_get(nrf_ppi_channel_t channel)
|
||||
{
|
||||
if (NRF_PPI->CHEN & (PPI_CHEN_CH0_Msk << ((uint32_t) channel)))
|
||||
{
|
||||
return NRF_PPI_CHANNEL_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NRF_PPI_CHANNEL_DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
__STATIC_INLINE nrf_ppi_channel_enable_t nrf_ppi_channel_enable_get(nrf_ppi_channel_t channel);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling all PPI channels.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channel_disable_all(void)
|
||||
{
|
||||
NRF_PPI->CHENCLR = ((uint32_t)0xFFFFFFFFuL);
|
||||
}
|
||||
__STATIC_INLINE void nrf_ppi_channel_disable_all(void);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling multiple PPI channels.
|
||||
*
|
||||
* @param[in] mask Channel mask.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channels_disable(uint32_t mask)
|
||||
{
|
||||
NRF_PPI->CHENCLR = mask;
|
||||
}
|
||||
__STATIC_INLINE void nrf_ppi_channels_disable(uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Function for setting up event and task endpoints for a given PPI channel.
|
||||
|
@ -230,11 +205,7 @@ __STATIC_INLINE void nrf_ppi_channels_disable(uint32_t mask)
|
|||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t eep,
|
||||
uint32_t tep)
|
||||
{
|
||||
NRF_PPI->CH[(uint32_t) channel].EEP = eep;
|
||||
NRF_PPI->CH[(uint32_t) channel].TEP = tep;
|
||||
}
|
||||
uint32_t tep);
|
||||
|
||||
#if defined(PPI_FEATURE_FORKS_PRESENT) || defined(__NRFX_DOXYGEN__)
|
||||
/**
|
||||
|
@ -245,10 +216,7 @@ __STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel,
|
|||
* @param[in] channel Channel to which the given fork endpoint is assigned.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_fork_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t fork_tep)
|
||||
{
|
||||
NRF_PPI->FORK[(uint32_t) channel].TEP = fork_tep;
|
||||
}
|
||||
uint32_t fork_tep);
|
||||
|
||||
/**
|
||||
* @brief Function for setting up event and task endpoints for a given PPI channel and fork.
|
||||
|
@ -264,11 +232,7 @@ __STATIC_INLINE void nrf_ppi_fork_endpoint_setup(nrf_ppi_channel_t channel,
|
|||
__STATIC_INLINE void nrf_ppi_channel_and_fork_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t eep,
|
||||
uint32_t tep,
|
||||
uint32_t fork_tep)
|
||||
{
|
||||
nrf_ppi_channel_endpoint_setup(channel, eep, tep);
|
||||
nrf_ppi_fork_endpoint_setup(channel, fork_tep);
|
||||
}
|
||||
uint32_t fork_tep);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -282,11 +246,7 @@ __STATIC_INLINE void nrf_ppi_channel_and_fork_endpoint_setup(nrf_ppi_channel_t c
|
|||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channel_include_in_group(nrf_ppi_channel_t channel,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] | (PPI_CHG_CH0_Included << ((uint32_t) channel));
|
||||
}
|
||||
nrf_ppi_channel_group_t channel_group);
|
||||
|
||||
/**
|
||||
* @brief Function for including multiple PPI channels in a channel group.
|
||||
|
@ -299,12 +259,7 @@ __STATIC_INLINE void nrf_ppi_channel_include_in_group(nrf_ppi_channel_t ch
|
|||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channels_include_in_group(uint32_t channel_mask,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] | (channel_mask);
|
||||
}
|
||||
|
||||
nrf_ppi_channel_group_t channel_group);
|
||||
|
||||
/**
|
||||
* @brief Function for removing a PPI channel from a channel group.
|
||||
|
@ -316,11 +271,7 @@ __STATIC_INLINE void nrf_ppi_channels_include_in_group(uint32_t c
|
|||
* @param[in] channel_group Channel group.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channel_remove_from_group(nrf_ppi_channel_t channel,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] & ~(PPI_CHG_CH0_Included << ((uint32_t) channel));
|
||||
}
|
||||
nrf_ppi_channel_group_t channel_group);
|
||||
|
||||
/**
|
||||
* @brief Function for removing multiple PPI channels from a channel group.
|
||||
|
@ -332,12 +283,7 @@ __STATIC_INLINE void nrf_ppi_channel_remove_from_group(nrf_ppi_channel_t c
|
|||
* @param[in] channel_group Channel group.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channels_remove_from_group(uint32_t channel_mask,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] & ~(channel_mask);
|
||||
}
|
||||
|
||||
nrf_ppi_channel_group_t channel_group);
|
||||
|
||||
/**
|
||||
* @brief Function for removing all PPI channels from a channel group.
|
||||
|
@ -345,11 +291,7 @@ __STATIC_INLINE void nrf_ppi_channels_remove_from_group(uint32_t
|
|||
* @param[in] group Channel group.
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_channel_group_clear(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) group] = 0;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_group_clear(nrf_ppi_channel_group_t group);
|
||||
|
||||
/**
|
||||
* @brief Function for enabling a channel group.
|
||||
|
@ -357,11 +299,7 @@ __STATIC_INLINE void nrf_ppi_channel_group_clear(nrf_ppi_channel_group_t group)
|
|||
* @param[in] group Channel group.
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_group_enable(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
NRF_PPI->TASKS_CHG[(uint32_t) group].EN = NRF_PPI_TASK_SET;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_group_enable(nrf_ppi_channel_group_t group);
|
||||
|
||||
/**
|
||||
* @brief Function for disabling a channel group.
|
||||
|
@ -369,53 +307,162 @@ __STATIC_INLINE void nrf_ppi_group_enable(nrf_ppi_channel_group_t group)
|
|||
* @param[in] group Channel group.
|
||||
*
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_group_disable(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
NRF_PPI->TASKS_CHG[(uint32_t) group].DIS = NRF_PPI_TASK_SET;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_group_disable(nrf_ppi_channel_group_t group);
|
||||
|
||||
/**
|
||||
* @brief Function for setting a PPI task.
|
||||
*
|
||||
* @param[in] ppi_task PPI task to set.
|
||||
*/
|
||||
__STATIC_INLINE void nrf_ppi_task_trigger(nrf_ppi_task_t ppi_task)
|
||||
{
|
||||
*((volatile uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task)) = NRF_PPI_TASK_SET;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_task_trigger(nrf_ppi_task_t ppi_task);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the address of a specific PPI task register.
|
||||
*
|
||||
* @param[in] ppi_task PPI task.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_address_get(nrf_ppi_task_t ppi_task)
|
||||
{
|
||||
return (uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task);
|
||||
}
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_address_get(nrf_ppi_task_t ppi_task);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the PPI enable task address of a specific group.
|
||||
*
|
||||
* @param[in] group PPI group.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_group_enable_address_get(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
return (uint32_t *) &NRF_PPI->TASKS_CHG[(uint32_t) group].EN;
|
||||
}
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_group_enable_address_get(nrf_ppi_channel_group_t group);
|
||||
|
||||
/**
|
||||
* @brief Function for returning the PPI disable task address of a specific group.
|
||||
*
|
||||
* @param[in] group PPI group.
|
||||
*/
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_group_disable_address_get(nrf_ppi_channel_group_t group);
|
||||
|
||||
|
||||
#ifndef SUPPRESS_INLINE_IMPLEMENTATION
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_enable(nrf_ppi_channel_t channel)
|
||||
{
|
||||
NRF_PPI->CHENSET = PPI_CHENSET_CH0_Set << ((uint32_t) channel);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_disable(nrf_ppi_channel_t channel)
|
||||
{
|
||||
NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Clear << ((uint32_t) channel);
|
||||
}
|
||||
|
||||
__STATIC_INLINE nrf_ppi_channel_enable_t nrf_ppi_channel_enable_get(nrf_ppi_channel_t channel)
|
||||
{
|
||||
if (NRF_PPI->CHEN & (PPI_CHEN_CH0_Msk << ((uint32_t) channel)))
|
||||
{
|
||||
return NRF_PPI_CHANNEL_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NRF_PPI_CHANNEL_DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_disable_all(void)
|
||||
{
|
||||
NRF_PPI->CHENCLR = ((uint32_t)0xFFFFFFFFuL);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channels_disable(uint32_t mask)
|
||||
{
|
||||
NRF_PPI->CHENCLR = mask;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t eep,
|
||||
uint32_t tep)
|
||||
{
|
||||
NRF_PPI->CH[(uint32_t) channel].EEP = eep;
|
||||
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,
|
||||
uint32_t fork_tep)
|
||||
{
|
||||
NRF_PPI->FORK[(uint32_t) channel].TEP = fork_tep;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_and_fork_endpoint_setup(nrf_ppi_channel_t channel,
|
||||
uint32_t eep,
|
||||
uint32_t tep,
|
||||
uint32_t fork_tep)
|
||||
{
|
||||
nrf_ppi_channel_endpoint_setup(channel, eep, tep);
|
||||
nrf_ppi_fork_endpoint_setup(channel, fork_tep);
|
||||
}
|
||||
#endif
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_include_in_group(nrf_ppi_channel_t channel,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] | (PPI_CHG_CH0_Included << ((uint32_t) channel));
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channels_include_in_group(uint32_t channel_mask,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] | (channel_mask);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_remove_from_group(nrf_ppi_channel_t channel,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] & ~(PPI_CHG_CH0_Included << ((uint32_t) channel));
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channels_remove_from_group(uint32_t channel_mask,
|
||||
nrf_ppi_channel_group_t channel_group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] =
|
||||
NRF_PPI->CHG[(uint32_t) channel_group] & ~(channel_mask);
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_channel_group_clear(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
NRF_PPI->CHG[(uint32_t) group] = 0;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_group_enable(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
NRF_PPI->TASKS_CHG[(uint32_t) group].EN = NRF_PPI_TASK_SET;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_group_disable(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
NRF_PPI->TASKS_CHG[(uint32_t) group].DIS = NRF_PPI_TASK_SET;
|
||||
}
|
||||
|
||||
__STATIC_INLINE void nrf_ppi_task_trigger(nrf_ppi_task_t ppi_task)
|
||||
{
|
||||
*((volatile uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task)) = NRF_PPI_TASK_SET;
|
||||
}
|
||||
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_address_get(nrf_ppi_task_t ppi_task)
|
||||
{
|
||||
return (uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task);
|
||||
}
|
||||
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_group_enable_address_get(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
return (uint32_t *) &NRF_PPI->TASKS_CHG[(uint32_t) group].EN;
|
||||
}
|
||||
|
||||
__STATIC_INLINE uint32_t * nrf_ppi_task_group_disable_address_get(nrf_ppi_channel_group_t group)
|
||||
{
|
||||
return (uint32_t *) &NRF_PPI->TASKS_CHG[(uint32_t) group].DIS;
|
||||
}
|
||||
|
||||
#endif // SUPPRESS_INLINE_IMPLEMENTATION
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -68,6 +68,7 @@ typedef enum
|
|||
NRF_QSPI_TASK_READSTART = offsetof(NRF_QSPI_Type, TASKS_READSTART), /**< Start transfer from external flash memory to internal RAM. */
|
||||
NRF_QSPI_TASK_WRITESTART = offsetof(NRF_QSPI_Type, TASKS_WRITESTART), /**< Start transfer from internal RAM to external flash memory. */
|
||||
NRF_QSPI_TASK_ERASESTART = offsetof(NRF_QSPI_Type, TASKS_ERASESTART), /**< Start external flash memory erase operation. */
|
||||
NRF_QSPI_TASK_DEACTIVATE = offsetof(NRF_QSPI_Type, TASKS_DEACTIVATE), /**< Deactivate the QSPI interface. */
|
||||
/*lint -restore*/
|
||||
} nrf_qspi_task_t;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2012 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2012 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -67,7 +67,7 @@ static __INLINE void nrf_temp_init(void)
|
|||
static __INLINE int32_t nrf_temp_read(void)
|
||||
{
|
||||
/**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */
|
||||
return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP);
|
||||
return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (int32_t)(NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -71,7 +71,9 @@ typedef enum
|
|||
/*lint -save -e30*/
|
||||
NRF_UARTE_EVENT_CTS = offsetof(NRF_UARTE_Type, EVENTS_CTS), ///< CTS is activated.
|
||||
NRF_UARTE_EVENT_NCTS = offsetof(NRF_UARTE_Type, EVENTS_NCTS), ///< CTS is deactivated.
|
||||
NRF_UARTE_EVENT_RXDRDY = offsetof(NRF_UARTE_Type, EVENTS_RXDRDY), ///< Data received in RXD (but potentially not yet transferred to Data RAM).
|
||||
NRF_UARTE_EVENT_ENDRX = offsetof(NRF_UARTE_Type, EVENTS_ENDRX), ///< Receive buffer is filled up.
|
||||
NRF_UARTE_EVENT_TXDDY = offsetof(NRF_UARTE_Type, EVENTS_TXDRDY), ///< Data sent from TXD.
|
||||
NRF_UARTE_EVENT_ENDTX = offsetof(NRF_UARTE_Type, EVENTS_ENDTX), ///< Last TX byte transmitted.
|
||||
NRF_UARTE_EVENT_ERROR = offsetof(NRF_UARTE_Type, EVENTS_ERROR), ///< Error detected.
|
||||
NRF_UARTE_EVENT_RXTO = offsetof(NRF_UARTE_Type, EVENTS_RXTO), ///< Receiver timeout.
|
||||
|
@ -87,7 +89,7 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
NRF_UARTE_SHORT_ENDRX_STARTRX = UARTE_SHORTS_ENDRX_STARTRX_Msk, ///< Shortcut between ENDRX event and STARTRX task.
|
||||
NRF_UARTE_SHORT_ENDRX_STOPRX = UARTE_SHORTS_ENDRX_STOPRX_Msk, ///< Shortcut between ENDRX event and STOPRX task.
|
||||
NRF_UARTE_SHORT_ENDRX_STOPRX = UARTE_SHORTS_ENDRX_STOPRX_Msk ///< Shortcut between ENDRX event and STOPRX task.
|
||||
} nrf_uarte_short_t;
|
||||
|
||||
|
||||
|
@ -98,8 +100,10 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
NRF_UARTE_INT_CTS_MASK = UARTE_INTENSET_CTS_Msk, ///< Interrupt on CTS event.
|
||||
NRF_UARTE_INT_NCTSRX_MASK = UARTE_INTENSET_NCTS_Msk, ///< Interrupt on NCTS event.
|
||||
NRF_UARTE_INT_NCTS_MASK = UARTE_INTENSET_NCTS_Msk, ///< Interrupt on NCTS event.
|
||||
NRF_UARTE_INT_RXDRDY_MASK = UARTE_INTENSET_RXDRDY_Msk, ///< Interrupt on RXDRDY event.
|
||||
NRF_UARTE_INT_ENDRX_MASK = UARTE_INTENSET_ENDRX_Msk, ///< Interrupt on ENDRX event.
|
||||
NRF_UARTE_INT_TXDRDY_MASK = UARTE_INTENSET_TXDRDY_Msk, ///< Interrupt on TXDRDY event.
|
||||
NRF_UARTE_INT_ENDTX_MASK = UARTE_INTENSET_ENDTX_Msk, ///< Interrupt on ENDTX event.
|
||||
NRF_UARTE_INT_ERROR_MASK = UARTE_INTENSET_ERROR_Msk, ///< Interrupt on ERROR event.
|
||||
NRF_UARTE_INT_RXTO_MASK = UARTE_INTENSET_RXTO_Msk, ///< Interrupt on RXTO event.
|
||||
|
@ -131,7 +135,7 @@ typedef enum
|
|||
NRF_UARTE_BAUDRATE_250000 = UARTE_BAUDRATE_BAUDRATE_Baud250000, ///< 250000 baud.
|
||||
NRF_UARTE_BAUDRATE_460800 = UARTE_BAUDRATE_BAUDRATE_Baud460800, ///< 460800 baud.
|
||||
NRF_UARTE_BAUDRATE_921600 = UARTE_BAUDRATE_BAUDRATE_Baud921600, ///< 921600 baud.
|
||||
NRF_UARTE_BAUDRATE_1000000 = UARTE_BAUDRATE_BAUDRATE_Baud1M, ///< 1000000 baud.
|
||||
NRF_UARTE_BAUDRATE_1000000 = UARTE_BAUDRATE_BAUDRATE_Baud1M ///< 1000000 baud.
|
||||
} nrf_uarte_baudrate_t;
|
||||
|
||||
/**
|
||||
|
@ -143,7 +147,7 @@ typedef enum
|
|||
NRF_UARTE_ERROR_OVERRUN_MASK = UARTE_ERRORSRC_OVERRUN_Msk, ///< Overrun error.
|
||||
NRF_UARTE_ERROR_PARITY_MASK = UARTE_ERRORSRC_PARITY_Msk, ///< Parity error.
|
||||
NRF_UARTE_ERROR_FRAMING_MASK = UARTE_ERRORSRC_FRAMING_Msk, ///< Framing error.
|
||||
NRF_UARTE_ERROR_BREAK_MASK = UARTE_ERRORSRC_BREAK_Msk, ///< Break error.
|
||||
NRF_UARTE_ERROR_BREAK_MASK = UARTE_ERRORSRC_BREAK_Msk ///< Break error.
|
||||
} nrf_uarte_error_mask_t;
|
||||
|
||||
/**
|
||||
|
@ -153,7 +157,7 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
NRF_UARTE_PARITY_EXCLUDED = UARTE_CONFIG_PARITY_Excluded << UARTE_CONFIG_PARITY_Pos, ///< Parity excluded.
|
||||
NRF_UARTE_PARITY_INCLUDED = UARTE_CONFIG_PARITY_Included << UARTE_CONFIG_PARITY_Pos, ///< Parity included.
|
||||
NRF_UARTE_PARITY_INCLUDED = UARTE_CONFIG_PARITY_Included << UARTE_CONFIG_PARITY_Pos ///< Parity included.
|
||||
} nrf_uarte_parity_t;
|
||||
|
||||
/**
|
||||
|
@ -163,7 +167,7 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
NRF_UARTE_HWFC_DISABLED = UARTE_CONFIG_HWFC_Disabled << UARTE_CONFIG_HWFC_Pos, ///< HW flow control disabled.
|
||||
NRF_UARTE_HWFC_ENABLED = UARTE_CONFIG_HWFC_Enabled << UARTE_CONFIG_HWFC_Pos, ///< HW flow control enabled.
|
||||
NRF_UARTE_HWFC_ENABLED = UARTE_CONFIG_HWFC_Enabled << UARTE_CONFIG_HWFC_Pos ///< HW flow control enabled.
|
||||
} nrf_uarte_hwfc_t;
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
@ -109,7 +109,6 @@ typedef enum
|
|||
NRF_USBD_EVENT_USBEVENT = offsetof(NRF_USBD_Type, EVENTS_USBEVENT ), /**< An event or an error not covered by specific events has occurred, check EVENTCAUSE register to find the cause */
|
||||
NRF_USBD_EVENT_EP0SETUP = offsetof(NRF_USBD_Type, EVENTS_EP0SETUP ), /**< A valid SETUP token has been received (and acknowledged) on the control endpoint */
|
||||
NRF_USBD_EVENT_DATAEP = offsetof(NRF_USBD_Type, EVENTS_EPDATA ), /**< A data transfer has occurred on a data endpoint, indicated by the EPDATASTATUS register */
|
||||
NRF_USBD_EVENT_ACCESSFAULT = offsetof(NRF_USBD_Type, EVENTS_ACCESSFAULT), /**< >Access to an unavailable USB register has been attempted (software or EasyDMA) */
|
||||
/*lint -restore*/
|
||||
}nrf_usbd_event_t;
|
||||
|
||||
|
@ -155,7 +154,6 @@ typedef enum
|
|||
NRF_USBD_INT_USBEVENT_MASK = USBD_INTEN_USBEVENT_Msk , /**< Enable or disable interrupt for USBEVENT event */
|
||||
NRF_USBD_INT_EP0SETUP_MASK = USBD_INTEN_EP0SETUP_Msk , /**< Enable or disable interrupt for EP0SETUP event */
|
||||
NRF_USBD_INT_DATAEP_MASK = USBD_INTEN_EPDATA_Msk , /**< Enable or disable interrupt for EPDATA event */
|
||||
NRF_USBD_INT_ACCESSFAULT_MASK = USBD_INTEN_ACCESSFAULT_Msk, /**< Enable or disable interrupt for ACCESSFAULT event */
|
||||
}nrf_usbd_int_mask_t;
|
||||
|
||||
|
||||
|
@ -540,31 +538,6 @@ typedef enum
|
|||
NRF_USBD_EVENTCAUSE_WUREQ_MASK = (1U << 10) /**< The USBD peripheral has exited Low Power mode */
|
||||
}nrf_usbd_eventcause_mask_t;
|
||||
|
||||
/**
|
||||
* @brief BUSSTATE register bit masks
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NRF_USBD_BUSSTATE_DM_MASK = USBD_BUSSTATE_DM_Msk, /**< Negative line mask */
|
||||
NRF_USBD_BUSSTATE_DP_MASK = USBD_BUSSTATE_DP_Msk, /**< Positive line mask */
|
||||
/** Both lines are low */
|
||||
NRF_USBD_BUSSTATE_DPDM_LL = (USBD_BUSSTATE_DM_Low << USBD_BUSSTATE_DM_Pos) | (USBD_BUSSTATE_DP_Low << USBD_BUSSTATE_DP_Pos),
|
||||
/** Positive line is high, negative line is low */
|
||||
NRF_USBD_BUSSTATE_DPDM_HL = (USBD_BUSSTATE_DM_Low << USBD_BUSSTATE_DM_Pos) | (USBD_BUSSTATE_DP_High << USBD_BUSSTATE_DP_Pos),
|
||||
/** Positive line is low, negative line is high */
|
||||
NRF_USBD_BUSSTATE_DPDM_LH = (USBD_BUSSTATE_DM_High << USBD_BUSSTATE_DM_Pos) | (USBD_BUSSTATE_DP_Low << USBD_BUSSTATE_DP_Pos),
|
||||
/** Both lines are high */
|
||||
NRF_USBD_BUSSTATE_DPDM_HH = (USBD_BUSSTATE_DM_High << USBD_BUSSTATE_DM_Pos) | (USBD_BUSSTATE_DP_High << USBD_BUSSTATE_DP_Pos),
|
||||
/** J state */
|
||||
NRF_USBD_BUSSTATE_J = NRF_USBD_BUSSTATE_DPDM_HL,
|
||||
/** K state */
|
||||
NRF_USBD_BUSSTATE_K = NRF_USBD_BUSSTATE_DPDM_LH,
|
||||
/** Single ended 0 */
|
||||
NRF_USBD_BUSSTATE_SE0 = NRF_USBD_BUSSTATE_DPDM_LL,
|
||||
/** Single ended 1 */
|
||||
NRF_USBD_BUSSTATE_SE1 = NRF_USBD_BUSSTATE_DPDM_HH
|
||||
}nrf_usbd_busstate_t;
|
||||
|
||||
/**
|
||||
* @brief DPDMVALUE register
|
||||
*/
|
||||
|
@ -678,13 +651,6 @@ __STATIC_INLINE void nrf_usbd_eventcause_clear(uint32_t flags);
|
|||
*/
|
||||
__STATIC_INLINE uint32_t nrf_usbd_eventcause_get_and_clear(void);
|
||||
|
||||
/**
|
||||
* @brief Function for getting BUSSTATE register value
|
||||
*
|
||||
* @return The value of BUSSTATE register
|
||||
*/
|
||||
__STATIC_INLINE nrf_usbd_busstate_t nrf_usbd_busstate_get(void);
|
||||
|
||||
/**
|
||||
* @brief Function for getting HALTEDEPIN register value
|
||||
*
|
||||
|
@ -1052,11 +1018,6 @@ uint32_t nrf_usbd_eventcause_get_and_clear(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
nrf_usbd_busstate_t nrf_usbd_busstate_get(void)
|
||||
{
|
||||
return (nrf_usbd_busstate_t)(NRF_USBD->BUSSTATE);
|
||||
}
|
||||
|
||||
uint32_t nrf_usbd_haltedep(uint8_t ep)
|
||||
{
|
||||
uint8_t epnr = NRF_USBD_EP_NR_GET(ep);
|
||||
|
@ -1219,8 +1180,8 @@ void nrf_usbd_dpdmvalue_set(nrf_usbd_dpdmvalue_t val)
|
|||
|
||||
void nrf_usbd_dtoggle_set(uint8_t ep, nrf_usbd_dtoggle_t op)
|
||||
{
|
||||
ASSERT(NRF_USBD_EP_VALIDATE(ep));
|
||||
ASSERT(!NRF_USBD_EPISO_CHECK(ep));
|
||||
NRFX_ASSERT(NRF_USBD_EP_VALIDATE(ep));
|
||||
NRFX_ASSERT(!NRF_USBD_EPISO_CHECK(ep));
|
||||
NRF_USBD->DTOGGLE = ep | (NRF_USBD_DTOGGLE_NOP << USBD_DTOGGLE_VALUE_Pos);
|
||||
__DSB();
|
||||
NRF_USBD->DTOGGLE = ep | (op << USBD_DTOGGLE_VALUE_Pos);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -12,14 +12,14 @@
|
|||
* 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 Nordic Semiconductor ASA nor the names of its
|
||||
* 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved.
|
||||
Copyright (c) 2010 - 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,6 +1,6 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved.
|
||||
Copyright (c) 2010 - 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:
|
||||
|
@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* MDK version */
|
||||
#define MDK_MAJOR_VERSION 8
|
||||
#define MDK_MINOR_VERSION 15
|
||||
#define MDK_MINOR_VERSION 16
|
||||
#define MDK_MICRO_VERSION 0
|
||||
|
||||
/* Redefine "old" too-generic name NRF52 to NRF52832_XXAA to keep backwards compatibility. */
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
* nrf51 from Nordic Semiconductor.
|
||||
*
|
||||
* @version V522
|
||||
* @date 3. October 2017
|
||||
* @date 8. March 2018
|
||||
*
|
||||
* @note Generated with SVDConv V2.81d
|
||||
* from CMSIS SVD File 'nrf51.svd' Version 522,
|
||||
*
|
||||
* @par Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved.
|
||||
* @par Copyright (c) 2010 - 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:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue