You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/22 03:26:00 UTC
[45/51] [abbrv] [partial] incubator-mynewt-core git commit: Remove
non-Apache-compatible Nordic SDK files.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h
deleted file mode 100644
index 8fc4bbb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h
+++ /dev/null
@@ -1,669 +0,0 @@
-/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-/**
- * @defgroup nrf_pwm_hal PWM HAL
- * @{
- * @ingroup nrf_pwm
- *
- * @brief @tagAPI52 Hardware access layer for managing the Pulse Width Modulation (PWM)
- * peripheral.
- */
-
-#ifndef NRF_PWM_H__
-#define NRF_PWM_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-#include "nrf_assert.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This value can be provided as a parameter for the @ref nrf_pwm_pins_set
- * function call to specify that a given output channel shall not be
- * connected to a physical pin.
- */
-#define NRF_PWM_PIN_NOT_CONNECTED 0xFFFFFFFF
-
-/**
- * @brief Number of channels in each PWM instance.
- */
-#define NRF_PWM_CHANNEL_COUNT 4
-
-
-/**
- * @brief PWM tasks.
- */
-typedef enum
-{
- /*lint -save -e30*/
- NRF_PWM_TASK_STOP = offsetof(NRF_PWM_Type, TASKS_STOP), ///< Stops PWM pulse generation on all channels at the end of the current PWM period, and stops the sequence playback.
- NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]), ///< Starts playback of sequence 0.
- NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]), ///< Starts playback of sequence 1.
- NRF_PWM_TASK_NEXTSTEP = offsetof(NRF_PWM_Type, TASKS_NEXTSTEP) ///< Steps by one value in the current sequence if the decoder is set to @ref NRF_PWM_STEP_TRIGGERED mode.
- /*lint -restore*/
-} nrf_pwm_task_t;
-
-/**
- * @brief PWM events.
- */
-typedef enum
-{
- /*lint -save -e30*/
- NRF_PWM_EVENT_STOPPED = offsetof(NRF_PWM_Type, EVENTS_STOPPED), ///< Response to STOP task, emitted when PWM pulses are no longer generated.
- NRF_PWM_EVENT_SEQSTARTED0 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[0]), ///< First PWM period started on sequence 0.
- NRF_PWM_EVENT_SEQSTARTED1 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[1]), ///< First PWM period started on sequence 1.
- NRF_PWM_EVENT_SEQEND0 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[0]), ///< Emitted at the end of every sequence 0 when its last value has been read from RAM.
- NRF_PWM_EVENT_SEQEND1 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[1]), ///< Emitted at the end of every sequence 1 when its last value has been read from RAM.
- NRF_PWM_EVENT_PWMPERIODEND = offsetof(NRF_PWM_Type, EVENTS_PWMPERIODEND), ///< Emitted at the end of each PWM period.
- NRF_PWM_EVENT_LOOPSDONE = offsetof(NRF_PWM_Type, EVENTS_LOOPSDONE) ///< Concatenated sequences have been played the requested number of times.
- /*lint -restore*/
-} nrf_pwm_event_t;
-
-/**
- * @brief PWM interrupts.
- */
-typedef enum
-{
- NRF_PWM_INT_STOPPED_MASK = PWM_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event.
- NRF_PWM_INT_SEQSTARTED0_MASK = PWM_INTENSET_SEQSTARTED0_Msk, ///< Interrupt on SEQSTARTED[0] event.
- NRF_PWM_INT_SEQSTARTED1_MASK = PWM_INTENSET_SEQSTARTED1_Msk, ///< Interrupt on SEQSTARTED[1] event.
- NRF_PWM_INT_SEQEND0_MASK = PWM_INTENSET_SEQEND0_Msk, ///< Interrupt on SEQEND[0] event.
- NRF_PWM_INT_SEQEND1_MASK = PWM_INTENSET_SEQEND1_Msk, ///< Interrupt on SEQEND[1] event.
- NRF_PWM_INT_PWMPERIODEND_MASK = PWM_INTENSET_PWMPERIODEND_Msk, ///< Interrupt on PWMPERIODEND event.
- NRF_PWM_INT_LOOPSDONE_MASK = PWM_INTENSET_LOOPSDONE_Msk ///< Interrupt on LOOPSDONE event.
-} nrf_pwm_int_mask_t;
-
-/**
- * @brief PWM shortcuts.
- */
-typedef enum
-{
- NRF_PWM_SHORT_SEQEND0_STOP_MASK = PWM_SHORTS_SEQEND0_STOP_Msk, ///< Shortcut between SEQEND[0] event and STOP task.
- NRF_PWM_SHORT_SEQEND1_STOP_MASK = PWM_SHORTS_SEQEND1_STOP_Msk, ///< Shortcut between SEQEND[1] event and STOP task.
- NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk, ///< Shortcut between LOOPSDONE event and SEQSTART[0] task.
- NRF_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART1_Msk, ///< Shortcut between LOOPSDONE event and SEQSTART[1] task.
- NRF_PWM_SHORT_LOOPSDONE_STOP_MASK = PWM_SHORTS_LOOPSDONE_STOP_Msk ///< Shortcut between LOOPSDONE event and STOP task.
-} nrf_pwm_short_mask_t;
-
-/**
- * @brief PWM modes of operation.
- */
-typedef enum
-{
- NRF_PWM_MODE_UP = PWM_MODE_UPDOWN_Up, ///< Up counter (edge-aligned PWM duty cycle).
- NRF_PWM_MODE_UP_AND_DOWN = PWM_MODE_UPDOWN_UpAndDown, ///< Up and down counter (center-aligned PWM duty cycle).
-} nrf_pwm_mode_t;
-
-/**
- * @brief PWM base clock frequencies.
- */
-typedef enum
-{
- NRF_PWM_CLK_16MHz = PWM_PRESCALER_PRESCALER_DIV_1, ///< 16 MHz / 1 = 16 MHz.
- NRF_PWM_CLK_8MHz = PWM_PRESCALER_PRESCALER_DIV_2, ///< 16 MHz / 2 = 8 MHz.
- NRF_PWM_CLK_4MHz = PWM_PRESCALER_PRESCALER_DIV_4, ///< 16 MHz / 4 = 4 MHz.
- NRF_PWM_CLK_2MHz = PWM_PRESCALER_PRESCALER_DIV_8, ///< 16 MHz / 8 = 2 MHz.
- NRF_PWM_CLK_1MHz = PWM_PRESCALER_PRESCALER_DIV_16, ///< 16 MHz / 16 = 1 MHz.
- NRF_PWM_CLK_500kHz = PWM_PRESCALER_PRESCALER_DIV_32, ///< 16 MHz / 32 = 500 kHz.
- NRF_PWM_CLK_250kHz = PWM_PRESCALER_PRESCALER_DIV_64, ///< 16 MHz / 64 = 250 kHz.
- NRF_PWM_CLK_125kHz = PWM_PRESCALER_PRESCALER_DIV_128 ///< 16 MHz / 128 = 125 kHz.
-} nrf_pwm_clk_t;
-
-/**
- * @brief PWM decoder load modes.
- *
- * The selected mode determines how the sequence data is read from RAM and
- * spread to the compare registers.
- */
-typedef enum
-{
- NRF_PWM_LOAD_COMMON = PWM_DECODER_LOAD_Common, ///< 1st half word (16-bit) used in all PWM channels (0-3).
- NRF_PWM_LOAD_GROUPED = PWM_DECODER_LOAD_Grouped, ///< 1st half word (16-bit) used in channels 0 and 1; 2nd word in channels 2 and 3.
- NRF_PWM_LOAD_INDIVIDUAL = PWM_DECODER_LOAD_Individual, ///< 1st half word (16-bit) used in channel 0; 2nd in channel 1; 3rd in channel 2; 4th in channel 3.
- NRF_PWM_LOAD_WAVE_FORM = PWM_DECODER_LOAD_WaveForm ///< 1st half word (16-bit) used in channel 0; 2nd in channel 1; ... ; 4th as the top value for the pulse generator counter.
-} nrf_pwm_dec_load_t;
-
-/**
- * @brief PWM decoder next step modes.
- *
- * The selected mode determines when the next value from the active sequence
- * is loaded.
- */
-typedef enum
-{
- NRF_PWM_STEP_AUTO = PWM_DECODER_MODE_RefreshCount, ///< Automatically after the current value is played and repeated the requested number of times.
- NRF_PWM_STEP_TRIGGERED = PWM_DECODER_MODE_NextStep ///< When the @ref NRF_PWM_TASK_NEXTSTEP task is triggered.
-} nrf_pwm_dec_step_t;
-
-
-/**
- * @brief Type used for defining duty cycle values for a sequence
- * loaded in @ref NRF_PWM_LOAD_COMMON mode.
- */
-typedef uint16_t nrf_pwm_values_common_t;
-
-/**
- * @brief Structure for defining duty cycle values for a sequence
- * loaded in @ref NRF_PWM_LOAD_GROUPED mode.
- */
-typedef struct {
- uint16_t group_0; ///< Duty cycle value for group 0 (channels 0 and 1).
- uint16_t group_1; ///< Duty cycle value for group 1 (channels 2 and 3).
-} nrf_pwm_values_grouped_t;
-
-/**
- * @brief Structure for defining duty cycle values for a sequence
- * loaded in @ref NRF_PWM_LOAD_INDIVIDUAL mode.
- */
-typedef struct
-{
- uint16_t channel_0; ///< Duty cycle value for channel 0.
- uint16_t channel_1; ///< Duty cycle value for channel 1.
- uint16_t channel_2; ///< Duty cycle value for channel 2.
- uint16_t channel_3; ///< Duty cycle value for channel 3.
-} nrf_pwm_values_individual_t;
-
-/**
- * @brief Structure for defining duty cycle values for a sequence
- * loaded in @ref NRF_PWM_LOAD_WAVE_FORM mode.
- */
-typedef struct {
- uint16_t channel_0; ///< Duty cycle value for channel 0.
- uint16_t channel_1; ///< Duty cycle value for channel 1.
- uint16_t channel_2; ///< Duty cycle value for channel 2.
- uint16_t counter_top; ///< Top value for the pulse generator counter.
-} nrf_pwm_values_wave_form_t;
-
-/**
- * @brief Union grouping pointers to arrays of duty cycle values applicable to
- * various loading modes.
- */
-typedef union {
- nrf_pwm_values_common_t const * p_common; ///< Pointer to be used in @ref NRF_PWM_LOAD_COMMON mode.
- nrf_pwm_values_grouped_t const * p_grouped; ///< Pointer to be used in @ref NRF_PWM_LOAD_GROUPED mode.
- nrf_pwm_values_individual_t const * p_individual; ///< Pointer to be used in @ref NRF_PWM_LOAD_INDIVIDUAL mode.
- nrf_pwm_values_wave_form_t const * p_wave_form; ///< Pointer to be used in @ref NRF_PWM_LOAD_WAVE_FORM mode.
- uint16_t const * p_raw; ///< Pointer providing raw access to the values.
-} nrf_pwm_values_t;
-
-/**
- * @brief Structure for defining a sequence of PWM duty cycles.
- *
- * When the sequence is set (by a call to @ref nrf_pwm_sequence_set), the
- * provided duty cycle values are not copied. The @p values pointer is stored
- * in the peripheral's internal register, and the values are loaded from RAM
- * during the sequence playback. Therefore, you must ensure that the values
- * do not change before and during the sequence playback (for example,
- * the values cannot be placed in a local variable that is allocated on stack).
- * If the sequence is played in a loop and the values should be updated
- * before the next iteration, it is safe to modify them when the corresponding
- * event signaling the end of sequence occurs (@ref NRF_PWM_EVENT_SEQEND0
- * or @ref NRF_PWM_EVENT_SEQEND1, respectively).
- *
- * @note The @p repeats and @p end_delay values (which are written to the
- * SEQ[n].REFRESH and SEQ[n].ENDDELAY registers in the peripheral,
- * respectively) are ignored at the end of a complex sequence
- * playback, indicated by the LOOPSDONE event.
- * See the @linkProductSpecification52 for more information.
- */
-typedef struct
-{
- nrf_pwm_values_t values; ///< Pointer to an array with duty cycle values. This array must be in Data RAM.
- /**< This field is defined as an union of pointers
- * to provide a convenient way to define duty
- * cycle values in various loading modes
- * (see @ref nrf_pwm_dec_load_t).
- * In each value, the most significant bit (15)
- * determines the polarity of the output and the
- * others (14-0) compose the 15-bit value to be
- * compared with the pulse generator counter. */
- uint16_t length; ///< Number of 16-bit values in the array pointed by @p values.
- uint32_t repeats; ///< Number of times that each duty cycle should be repeated (after being played once). Ignored in @ref NRF_PWM_STEP_TRIGGERED mode.
- uint32_t end_delay; ///< Additional time (in PWM periods) that the last duty cycle is to be kept after the sequence is played. Ignored in @ref NRF_PWM_STEP_TRIGGERED mode.
-} nrf_pwm_sequence_t;
-
-/**
- * @brief Helper macro for calculating the number of 16-bit values in specified
- * array of duty cycle values.
- */
-#define NRF_PWM_VALUES_LENGTH(array) (sizeof(array)/sizeof(uint16_t))
-
-
-/**
- * @brief Function for activating a specific PWM task.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] task Task to activate.
- */
-__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm,
- nrf_pwm_task_t task);
-
-/**
- * @brief Function for getting the address of a specific PWM task register.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] task Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm,
- nrf_pwm_task_t task);
-
-/**
- * @brief Function for clearing a specific PWM event.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] event Event to clear.
- */
-__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm,
- nrf_pwm_event_t event);
-
-/**
- * @brief Function for checking the state of a specific PWM event.
- *
- * @param[in] p_pwm PWM instance.
- * @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_pwm_event_check(NRF_PWM_Type const * p_pwm,
- nrf_pwm_event_t event);
-
-/**
- * @brief Function for getting the address of a specific PWM event register.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] event Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm,
- nrf_pwm_event_t event);
-
-/**
- * @brief Function for enabling specified shortcuts.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] pwm_shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_shorts_mask);
-
-/**
- * @brief Function for disabling specified shortcuts.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] pwm_shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_shorts_mask);
-
-/**
- * @brief Function for setting the configuration of PWM shortcuts.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] pwm_shorts_mask Shortcuts configuration to set.
- */
-__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm,
- uint32_t pwm_shorts_mask);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] pwm_int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] pwm_int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_int_mask);
-
-/**
- * @brief Function for setting the configuration of PWM interrupts.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] pwm_int_mask Interrupts configuration to set.
- */
-__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm,
- uint32_t pwm_int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] pwm_int Interrupt to check.
- *
- * @retval true If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm,
- nrf_pwm_int_mask_t pwm_int);
-
-/**
- * @brief Function for enabling the PWM peripheral.
- *
- * @param[in] p_pwm PWM instance.
- */
-__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm);
-
-/**
- * @brief Function for disabling the PWM peripheral.
- *
- * @param[in] p_pwm PWM instance.
- */
-__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm);
-
-/**
- * @brief Function for assigning pins to PWM output channels.
- *
- * Usage of all PWM output channels is optional. If a given channel is not
- * needed, pass the @ref NRF_PWM_PIN_NOT_CONNECTED value instead of its pin
- * number.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] out_pins Array with pin numbers for individual PWM output channels.
- */
-__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm,
- uint32_t out_pins[NRF_PWM_CHANNEL_COUNT]);
-
-/**
- * @brief Function for configuring the PWM peripheral.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] base_clock Base clock frequency.
- * @param[in] mode Operating mode of the pulse generator counter.
- * @param[in] top_value Value up to which the pulse generator counter counts.
- */
-__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm,
- nrf_pwm_clk_t base_clock,
- nrf_pwm_mode_t mode,
- uint16_t top_value);
-
-/**
- * @brief Function for defining a sequence of PWM duty cycles.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] seq_id Identifier of the sequence (0 or 1).
- * @param[in] p_seq Pointer to the sequence definition.
- */
-__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- nrf_pwm_sequence_t const * p_seq);
-
-/**
- * @brief Function for modifying the pointer to the duty cycle values
- * in the specified sequence.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] seq_id Identifier of the sequence (0 or 1).
- * @param[in] p_values Pointer to an array with duty cycle values.
- */
-__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint16_t const * p_values);
-
-/**
- * @brief Function for modifying the total number of duty cycle values
- * in the specified sequence.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] seq_id Identifier of the sequence (0 or 1).
- * @param[in] length Number of duty cycle values.
- */
-__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint16_t length);
-
-/**
- * @brief Function for modifying the additional number of PWM periods spent
- * on each duty cycle value in the specified sequence.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] seq_id Identifier of the sequence (0 or 1).
- * @param[in] refresh Number of additional PWM periods for each duty cycle value.
- */
-__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint32_t refresh);
-
-/**
- * @brief Function for modifying the additional time added after the sequence
- * is played.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] seq_id Identifier of the sequence (0 or 1).
- * @param[in] end_delay Number of PWM periods added at the end of the sequence.
- */
-__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint32_t end_delay);
-
-/**
- * @brief Function for setting the mode of loading sequence data from RAM
- * and advancing the sequence.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] dec_load Mode of loading sequence data from RAM.
- * @param[in] dec_step Mode of advancing the active sequence.
- */
-__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm,
- nrf_pwm_dec_load_t dec_load,
- nrf_pwm_dec_step_t dec_step);
-
-/**
- * @brief Function for setting the number of times the sequence playback
- * should be performed.
- *
- * This function applies to two-sequence playback (concatenated sequence 0 and 1).
- * A single sequence can be played back only once.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] loop_count Number of times to perform the sequence playback.
- */
-__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm,
- uint16_t loop_count);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm,
- nrf_pwm_task_t task)
-{
- *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm,
- nrf_pwm_task_t task)
-{
- return ((uint32_t)p_pwm + (uint32_t)task);
-}
-
-__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm,
- nrf_pwm_event_t event)
-{
- *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_pwm,
- nrf_pwm_event_t event)
-{
- return (bool)*(volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm,
- nrf_pwm_event_t event)
-{
- return ((uint32_t)p_pwm + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_shorts_mask)
-{
- p_pwm->SHORTS |= pwm_shorts_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_shorts_mask)
-{
- p_pwm->SHORTS &= ~(pwm_shorts_mask);
-}
-
-__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm,
- uint32_t pwm_shorts_mask)
-{
- p_pwm->SHORTS = pwm_shorts_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_int_mask)
-{
- p_pwm->INTENSET = pwm_int_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm,
- uint32_t pwm_int_mask)
-{
- p_pwm->INTENCLR = pwm_int_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm,
- uint32_t pwm_int_mask)
-{
- p_pwm->INTEN = pwm_int_mask;
-}
-
-__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm,
- nrf_pwm_int_mask_t pwm_int)
-{
- return (bool)(p_pwm->INTENSET & pwm_int);
-}
-
-__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm)
-{
- p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Enabled << PWM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm)
-{
- p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Disabled << PWM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm,
- uint32_t out_pins[NRF_PWM_CHANNEL_COUNT])
-{
- uint8_t i;
- for (i = 0; i < NRF_PWM_CHANNEL_COUNT; ++i)
- {
- p_pwm->PSEL.OUT[i] = out_pins[i];
- }
-}
-
-__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm,
- nrf_pwm_clk_t base_clock,
- nrf_pwm_mode_t mode,
- uint16_t top_value)
-{
- ASSERT(top_value <= PWM_COUNTERTOP_COUNTERTOP_Msk);
-
- p_pwm->PRESCALER = base_clock;
- p_pwm->MODE = mode;
- p_pwm->COUNTERTOP = top_value;
-}
-
-__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- nrf_pwm_sequence_t const * p_seq)
-{
- ASSERT(p_seq != NULL);
-
- nrf_pwm_seq_ptr_set( p_pwm, seq_id, p_seq->values.p_raw);
- nrf_pwm_seq_cnt_set( p_pwm, seq_id, p_seq->length);
- nrf_pwm_seq_refresh_set( p_pwm, seq_id, p_seq->repeats);
- nrf_pwm_seq_end_delay_set(p_pwm, seq_id, p_seq->end_delay);
-}
-
-__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint16_t const * p_values)
-{
- ASSERT(seq_id <= 1);
- ASSERT(p_values != NULL);
- p_pwm->SEQ[seq_id].PTR = (uint32_t)p_values;
-}
-
-__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint16_t length)
-{
- ASSERT(seq_id <= 1);
- ASSERT(length != 0);
- ASSERT(length <= PWM_SEQ_CNT_CNT_Msk);
- p_pwm->SEQ[seq_id].CNT = length;
-}
-
-__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint32_t refresh)
-{
- ASSERT(seq_id <= 1);
- ASSERT(refresh <= PWM_SEQ_REFRESH_CNT_Msk);
- p_pwm->SEQ[seq_id].REFRESH = refresh;
-}
-
-__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm,
- uint8_t seq_id,
- uint32_t end_delay)
-{
- ASSERT(seq_id <= 1);
- ASSERT(end_delay <= PWM_SEQ_ENDDELAY_CNT_Msk);
- p_pwm->SEQ[seq_id].ENDDELAY = end_delay;
-}
-
-__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm,
- nrf_pwm_dec_load_t dec_load,
- nrf_pwm_dec_step_t dec_step)
-{
- p_pwm->DECODER = ((uint32_t)dec_load << PWM_DECODER_LOAD_Pos) |
- ((uint32_t)dec_step << PWM_DECODER_MODE_Pos);
-}
-
-__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm,
- uint16_t loop_count)
-{
- p_pwm->LOOP = loop_count;
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_PWM_H__
-
-/** @} */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_qdec.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_qdec.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_qdec.h
deleted file mode 100644
index 499df98..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_qdec.h
+++ /dev/null
@@ -1,476 +0,0 @@
-/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-#ifndef NRF_QDEC_H__
-#define NRF_QDEC_H__
-
-#include <stddef.h>
-#include "nrf_error.h"
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*lint ++flb "Enter library region" */
-
-/**
- * @defgroup nrf_qdec_hal QDEC HAL
- * @{
- * @ingroup nrf_qdec
- * @brief Hardware access layer for accessing the quadrature decoder (QDEC) peripheral.
- */
-
-/**
- * @enum nrf_qdec_task_t
- * @brief QDEC tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
- NRF_QDEC_TASK_START = offsetof(NRF_QDEC_Type, TASKS_START), /**< Starting the quadrature decoder. */
- NRF_QDEC_TASK_STOP = offsetof(NRF_QDEC_Type, TASKS_STOP), /**< Stopping the quadrature decoder. */
- NRF_QDEC_TASK_READCLRACC = offsetof(NRF_QDEC_Type, TASKS_READCLRACC) /**< Reading and clearing ACC and ACCDBL registers. */
-} nrf_qdec_task_t;
-
-/**
- * @enum nrf_qdec_event_t
- * @brief QDEC events.
- */
-typedef enum
-{
- NRF_QDEC_EVENT_SAMPLERDY = offsetof(NRF_QDEC_Type, EVENTS_SAMPLERDY), /**< Event generated for every new sample. */
- NRF_QDEC_EVENT_REPORTRDY = offsetof(NRF_QDEC_Type, EVENTS_REPORTRDY), /**< Event generated for every new report. */
- NRF_QDEC_EVENT_ACCOF = offsetof(NRF_QDEC_Type, EVENTS_ACCOF) /**< Event generated for every accumulator overflow. */
-} nrf_qdec_event_t; /*lint -restore */
-
-/**
- * @enum nrf_qdec_short_mask_t
- * @brief QDEC shortcuts.
- */
-typedef enum
-{
- NRF_QDEC_SHORT_REPORTRDY_READCLRACC_MASK = QDEC_SHORTS_REPORTRDY_READCLRACC_Msk, /**< Shortcut between REPORTRDY event and READCLRACC task. */
- NRF_QDEC_SHORT_SAMPLERDY_STOP_MASK = QDEC_SHORTS_SAMPLERDY_STOP_Msk /**< Shortcut between SAMPLERDY event and STOP task. */
-} nrf_qdec_short_mask_t;
-
-/**
- * @enum nrf_qdec_int_mask_t
- * @brief QDEC interrupts.
- */
-typedef enum
-{
- NRF_QDEC_INT_SAMPLERDY_MASK = QDEC_INTENSET_SAMPLERDY_Msk, /**< Mask for enabling or disabling an interrupt on SAMPLERDY event. */
- NRF_QDEC_INT_REPORTRDY_MASK = QDEC_INTENSET_REPORTRDY_Msk, /**< Mask for enabling or disabling an interrupt on REPORTRDY event. */
- NRF_QDEC_INT_ACCOF_MASK = QDEC_INTENSET_ACCOF_Msk /**< Mask for enabling or disabling an interrupt on ACCOF event. */
-} nrf_qdec_int_mask_t;
-
-/**
- * @enum nrf_qdec_enable_t
- * @brief States of the enable bit.
- */
-typedef enum
-{
- NRF_QDEC_DISABLE = QDEC_ENABLE_ENABLE_Disabled, /**< Mask for disabling the QDEC periperal. When disabled, the QDEC decoder pins are not active. */
- NRF_QDEC_ENABLE = QDEC_ENABLE_ENABLE_Enabled /**< Mask for enabling the QDEC periperal. When enabled, the QDEC pins are active. */
-} nrf_qdec_enable_t;
-
-
-/**
- * @enum nrf_qdec_dbfen_t
- * @brief States of the debounce filter enable bit.
- */
-typedef enum
-{
- NRF_QDEC_DBFEN_DISABLE = QDEC_DBFEN_DBFEN_Disabled, /**< Mask for disabling the debounce filter. */
- NRF_QDEC_DBFEN_ENABLE = QDEC_DBFEN_DBFEN_Enabled /**< Mask for enabling the debounce filter. */
-} nrf_qdec_dbfen_t;
-
-/**
- * @enum nrf_qdec_ledpol_t
- * @brief Active LED polarity.
- */
-typedef enum
-{
- NRF_QDEC_LEPOL_ACTIVE_LOW = QDEC_LEDPOL_LEDPOL_ActiveLow, /**< QDEC LED active on output pin low. */
- NRF_QDEC_LEPOL_ACTIVE_HIGH = QDEC_LEDPOL_LEDPOL_ActiveHigh /**< QDEC LED active on output pin high. */
-} nrf_qdec_ledpol_t;
-
-
-/**
- * @enum nrf_qdec_sampleper_t
- * @brief Available sampling periods.
- */
-typedef enum
-{
- NRF_QDEC_SAMPLEPER_128us = QDEC_SAMPLEPER_SAMPLEPER_128us, /**< QDEC sampling period 128 microseconds. */
- NRF_QDEC_SAMPLEPER_256us = QDEC_SAMPLEPER_SAMPLEPER_256us, /**< QDEC sampling period 256 microseconds. */
- NRF_QDEC_SAMPLEPER_512us = QDEC_SAMPLEPER_SAMPLEPER_512us, /**< QDEC sampling period 512 microseconds. */
- NRF_QDEC_SAMPLEPER_1024us = QDEC_SAMPLEPER_SAMPLEPER_1024us, /**< QDEC sampling period 1024 microseconds. */
- NRF_QDEC_SAMPLEPER_2048us = QDEC_SAMPLEPER_SAMPLEPER_2048us, /**< QDEC sampling period 2048 microseconds. */
- NRF_QDEC_SAMPLEPER_4096us = QDEC_SAMPLEPER_SAMPLEPER_4096us, /**< QDEC sampling period 4096 microseconds. */
- NRF_QDEC_SAMPLEPER_8192us = QDEC_SAMPLEPER_SAMPLEPER_8192us, /**< QDEC sampling period 8192 microseconds. */
- NRF_QDEC_SAMPLEPER_16384us = QDEC_SAMPLEPER_SAMPLEPER_16384us /**< QDEC sampling period 16384 microseconds. */
-} nrf_qdec_sampleper_t;
-
-/**
- * @enum nrf_qdec_reportper_t
- * @brief Available report periods.
- */
-typedef enum
-{
- NRF_QDEC_REPORTPER_10 = QDEC_REPORTPER_REPORTPER_10Smpl, /**< QDEC report period 10 samples. */
- NRF_QDEC_REPORTPER_40 = QDEC_REPORTPER_REPORTPER_40Smpl, /**< QDEC report period 40 samples. */
- NRF_QDEC_REPORTPER_80 = QDEC_REPORTPER_REPORTPER_80Smpl, /**< QDEC report period 80 samples. */
- NRF_QDEC_REPORTPER_120 = QDEC_REPORTPER_REPORTPER_120Smpl, /**< QDEC report period 120 samples. */
- NRF_QDEC_REPORTPER_160 = QDEC_REPORTPER_REPORTPER_160Smpl, /**< QDEC report period 160 samples. */
- NRF_QDEC_REPORTPER_200 = QDEC_REPORTPER_REPORTPER_200Smpl, /**< QDEC report period 200 samples. */
- NRF_QDEC_REPORTPER_240 = QDEC_REPORTPER_REPORTPER_240Smpl, /**< QDEC report period 240 samples. */
- NRF_QDEC_REPORTPER_280 = QDEC_REPORTPER_REPORTPER_280Smpl, /**< QDEC report period 280 samples. */
- NRF_QDEC_REPORTPER_DISABLED /**< QDEC reporting disabled. */
-} nrf_qdec_reportper_t;
-
-/**
- * @brief Function for enabling QDEC.
- */
-__STATIC_INLINE void nrf_qdec_enable(void)
-{
- NRF_QDEC->ENABLE = NRF_QDEC_ENABLE;
-}
-
-
-/**
- * @brief Function for disabling QDEC.
- */
-__STATIC_INLINE void nrf_qdec_disable(void)
-{
- NRF_QDEC->ENABLE = NRF_QDEC_DISABLE;
-}
-
-
-/**
- * @brief Function for returning the enable state of QDEC.
- * @return State of the register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_enable_get(void)
-{
- return NRF_QDEC->ENABLE;
-}
-
-
-/**
- * @brief Function for enabling QDEC interrupts by mask.
- * @param[in] qdec_int_mask Sources of the interrupts to enable.
- */
-__STATIC_INLINE void nrf_qdec_int_enable(uint32_t qdec_int_mask)
-{
- NRF_QDEC->INTENSET = qdec_int_mask; // writing 0 has no effect
-}
-
-
-/**
- * @brief Function for disabling QDEC interrupts by mask.
- * @param[in] qdec_int_mask Sources of the interrupts to disable.
- *
- */
-__STATIC_INLINE void nrf_qdec_int_disable(uint32_t qdec_int_mask)
-{
- NRF_QDEC->INTENCLR = qdec_int_mask; // writing 0 has no effect
-}
-
-
-/**
- * @brief Function for getting the enabled interrupts of the QDEC.
- */
-__STATIC_INLINE uint32_t nrf_qdec_int_enable_check(nrf_qdec_int_mask_t qdec_int_mask)
-{
- return NRF_QDEC->INTENSET & qdec_int_mask; // when read this register will return the value of INTEN.
-}
-
-
-/**
- * @brief Function for enabling the debouncing filter of the QED.
- */
-__STATIC_INLINE void nrf_qdec_dbfen_enable(void)
-{
- NRF_QDEC->DBFEN = NRF_QDEC_DBFEN_ENABLE;
-}
-
-
-/**
- * @brief Function for disabling the debouncing filter of the QED.
- */
-__STATIC_INLINE void nrf_qdec_dbfen_disable(void)
-{
- NRF_QDEC->DBFEN = NRF_QDEC_DBFEN_DISABLE;
-}
-
-
-/**
- * @brief Function for getting the state of the QDEC's debouncing filter.
- * @retval NRF_QDEC_DBFEN_DISABLE If the debouncing filter is disabled.
- * @retval NRF_QDEC_DBFEN_ENABLE If the debouncing filter is enabled.
- */
-__STATIC_INLINE uint32_t nrf_qdec_dbfen_get(void)
-{
- return NRF_QDEC->DBFEN;
-}
-
-
-/**
- * @brief Function for assigning QDEC pins.
- * @param[in] psela Pin number.
- * @param[in] pselb Pin number.
- * @param[in] pselled Pin number.
- */
-__STATIC_INLINE void nrf_qdec_pio_assign( uint32_t psela, uint32_t pselb, uint32_t pselled)
-{
-#ifdef NRF51
- NRF_QDEC->PSELA = psela;
- NRF_QDEC->PSELB = pselb;
- NRF_QDEC->PSELLED = pselled;
-#elif defined NRF52
- NRF_QDEC->PSEL.A = psela;
- NRF_QDEC->PSEL.B = pselb;
- NRF_QDEC->PSEL.LED = pselled;
-#endif
-}
-
-/**
- * @brief Function for setting a specific QDEC task.
- * @param[in] qdec_task QDEC task to be set.
- */
-__STATIC_INLINE void nrf_qdec_task_trigger(nrf_qdec_task_t qdec_task)
-{
- *( (volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_task) ) = 1;
-}
-
-
-/**
- * @brief Function for retrieving the address of a QDEC task register.
- * @param[in] qdec_task QDEC task.
- */
-__STATIC_INLINE uint32_t * nrf_qdec_task_address_get(nrf_qdec_task_t qdec_task)
-{
- return (uint32_t *)( (uint8_t *)NRF_QDEC + qdec_task);
-}
-
-
-/**
- * @brief Function for clearing a specific QDEC event.
- * @param[in] qdec_event QDEC event to clear.
- */
-__STATIC_INLINE void nrf_qdec_event_clear(nrf_qdec_event_t qdec_event)
-{
- *( (volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event) ) = 0;
-}
-
-
-/**
- * @brief Function for retrieving the state of a specific QDEC event.
- * @return State of the QDEC event.
- */
-__STATIC_INLINE uint32_t nrf_qdec_event_check(nrf_qdec_event_t qdec_event)
-{
- return *(volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event);
-}
-
-
-/**
- * @brief Function for retrieving the address of a specific QDEC event register.
- * @param[in] qdec_event QDEC event.
- * @return Address of the specified QDEC event.
- */
-__STATIC_INLINE uint32_t * nrf_qdec_event_address_get(nrf_qdec_event_t qdec_event)
-{
- return (uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event);
-}
-
-
-/**
- * @brief Function for setting QDEC shortcuts.
- * @param[in] qdec_short_mask QDEC shortcut by mask.
- */
-__STATIC_INLINE void nrf_qdec_shorts_enable(uint32_t qdec_short_mask)
-{
- NRF_QDEC->SHORTS |= qdec_short_mask;
-}
-
-
-/**
- * @brief Function for clearing shortcuts of the QDEC by mask.
- * @param[in] qdec_short_mask QDEC shortcute to be cleared.
- */
-__STATIC_INLINE void nrf_qdec_shorts_disable(uint32_t qdec_short_mask)
-{
- NRF_QDEC->SHORTS &= ~qdec_short_mask;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's SAMPLEPER register.
- * @return Value of the SAMPLEPER register.
- */
-__STATIC_INLINE int32_t nrf_qdec_sampleper_reg_get(void)
-{
- return NRF_QDEC->SAMPLEPER;
-}
-
-
-/**
- * @brief Function for converting the value of QDEC's SAMPLE PERIOD to microseconds.
- * @retval sampling period in microseconds.
- */
-__STATIC_INLINE uint32_t nrf_qdec_sampleper_to_value(uint32_t sampleper)
-{
- return (1 << (7+sampleper));
-}
-
-/**
- * @brief Function for setting the value of QDEC's SAMPLEPER register.
- * @param[in] sample_per Sampling period.
- */
-__STATIC_INLINE void nrf_qdec_sampleper_set(nrf_qdec_sampleper_t sample_per)
-{
- NRF_QDEC->SAMPLEPER = sample_per;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's SAMPLE register.
- * @return Value of the SAMPLE register.
- */
-__STATIC_INLINE int32_t nrf_qdec_sample_get(void)
-{
- return NRF_QDEC->SAMPLE;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACC register.
- * @return Value of the ACC register.
- */
-__STATIC_INLINE int32_t nrf_qdec_acc_get(void)
-{
- return NRF_QDEC->ACC;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACCREAD register.
- * @return Value of the ACCREAD register.
- */
-__STATIC_INLINE int32_t nrf_qdec_accread_get(void)
-{
- return NRF_QDEC->ACCREAD;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACCDBL register.
- * @return Value of the ACCDBL register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_accdbl_get(void)
-{
- return NRF_QDEC->ACCDBL;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACCDBLREAD register.
- * @return Value of the ACCDBLREAD register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_accdblread_get(void)
-{
- return NRF_QDEC->ACCDBLREAD;
-}
-
-
-/**
- * @brief Function for setting how long the LED is switched on before sampling.
- * @param[in] time_us Time (in microseconds) how long the LED is switched on before sampling.
- */
-__STATIC_INLINE void nrf_qdec_ledpre_set(uint32_t time_us)
-{
- NRF_QDEC->LEDPRE = time_us;
-}
-
-
-/**
- * @brief Function for retrieving how long the LED is switched on before sampling.
- * @retval time_us Time (in microseconds) how long the LED is switched on before sampling.
- */
-__STATIC_INLINE uint32_t nrf_qdec_ledpre_get(void)
-{
- return NRF_QDEC->LEDPRE;
-}
-
-
-/**
- * @brief Function for setting the report period (in samples).
- * @param[in] reportper Number of samples.
- */
-__STATIC_INLINE void nrf_qdec_reportper_set(nrf_qdec_reportper_t reportper)
-{
- NRF_QDEC->REPORTPER = reportper;
-}
-
-
-/**
- * @brief Function for retrieving the report period.
- * @retval reportper Number of samples as encoded in the register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_reportper_reg_get(void)
-{
- return NRF_QDEC->REPORTPER;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's SAMPLEPER register.
- * @param [in] reportper Reportper to be converted to amount of samples per report.
-
- */
-__STATIC_INLINE uint32_t nrf_qdec_reportper_to_value(uint32_t reportper)
-{
- return (reportper == NRF_QDEC_REPORTPER_10) ? 10 : reportper*40;
-}
-
-
-/**
- * @brief Function for setting the active level for the LED.
- * @param[in] pol Active level for the LED.
- */
-__STATIC_INLINE void nrf_qdec_ledpol_set(nrf_qdec_ledpol_t pol)
-{
- NRF_QDEC->LEDPOL = pol;
-}
-
-
-/**
- * @brief Function for retrieving the active level for the LED.
- * @return Active level for the LED.
- */
-__STATIC_INLINE uint32_t nrf_qdec_ledpol_get(void)
-{
- return NRF_QDEC->LEDPOL;
-}
-
-
-/**
- *@}
- **/
-
-/*lint --flb "Leave library region" */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rng.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rng.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rng.h
deleted file mode 100644
index 415fad6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rng.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-/**
- * @file
- * @brief RNG HAL API.
- */
-
-#ifndef NRF_RNG_H__
-#define NRF_RNG_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_rng_hal RNG HAL
- * @{
- * @ingroup nrf_rng
- * @brief Hardware access layer for managing the random number generator (RNG).
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include "nrf.h"
-
-#define NRF_RNG_TASK_SET (1UL)
-#define NRF_RNG_EVENT_CLEAR (0UL)
-/**
- * @enum nrf_rng_task_t
- * @brief RNG tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
- NRF_RNG_TASK_START = offsetof(NRF_RNG_Type, TASKS_START), /**< Start the random number generator. */
- NRF_RNG_TASK_STOP = offsetof(NRF_RNG_Type, TASKS_STOP) /**< Stop the random number generator. */
-} nrf_rng_task_t; /*lint -restore */
-
-/**
- * @enum nrf_rng_event_t
- * @brief RNG events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
- NRF_RNG_EVENT_VALRDY = offsetof(NRF_RNG_Type, EVENTS_VALRDY) /**< New random number generated event. */
-} nrf_rng_event_t; /*lint -restore */
-
-/**
- * @enum nrf_rng_int_mask_t
- * @brief RNG interrupts.
- */
-typedef enum
-{
- NRF_RNG_INT_VALRDY_MASK = RNG_INTENSET_VALRDY_Msk /**< Mask for enabling or disabling an interrupt on VALRDY event. */
-} nrf_rng_int_mask_t;
-
-/**
- * @enum nrf_rng_short_mask_t
- * @brief Types of RNG shortcuts.
- */
-typedef enum
-{
- NRF_RNG_SHORT_VALRDY_STOP_MASK = RNG_SHORTS_VALRDY_STOP_Msk /**< Mask for setting shortcut between EVENT_VALRDY and TASK_STOP. */
-} nrf_rng_short_mask_t;
-
-/**
- * @brief Function for enabling interrupts.
- *
- * @param[in] rng_int_mask Mask of interrupts.
- */
-__STATIC_INLINE void nrf_rng_int_enable(uint32_t rng_int_mask)
-{
- NRF_RNG->INTENSET = rng_int_mask;
-}
-
-/**
- * @brief Function for disabling interrupts.
- *
- * @param[in] rng_int_mask Mask of interrupts.
- */
-__STATIC_INLINE void nrf_rng_int_disable(uint32_t rng_int_mask)
-{
- NRF_RNG->INTENCLR = rng_int_mask;
-}
-
-/**
- * @brief Function for getting the state of a specific interrupt.
- *
- * @param[in] rng_int_mask Interrupt.
- *
- * @retval true If the interrupt is not enabled.
- * @retval false If the interrupt is enabled.
- */
-__STATIC_INLINE bool nrf_rng_int_get(nrf_rng_int_mask_t rng_int_mask)
-{
- return (bool)(NRF_RNG->INTENCLR & rng_int_mask);
-}
-
-/**
- * @brief Function for getting the address of a specific task.
- *
- * This function can be used by the PPI module.
- *
- * @param[in] rng_task Task.
- */
-__STATIC_INLINE uint32_t * nrf_rng_task_address_get(nrf_rng_task_t rng_task)
-{
- return (uint32_t *)((uint8_t *)NRF_RNG + rng_task);
-}
-
-/**
- * @brief Function for setting a specific task.
- *
- * @param[in] rng_task Task.
- */
-__STATIC_INLINE void nrf_rng_task_trigger(nrf_rng_task_t rng_task)
-{
- *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_task)) = NRF_RNG_TASK_SET;
-}
-
-/**
- * @brief Function for getting address of a specific event.
- *
- * This function can be used by the PPI module.
- *
- * @param[in] rng_event Event.
- */
-__STATIC_INLINE uint32_t * nrf_rng_event_address_get(nrf_rng_event_t rng_event)
-{
- return (uint32_t *)((uint8_t *)NRF_RNG + rng_event);
-}
-
-/**
- * @brief Function for clearing a specific event.
- *
- * @param[in] rng_event Event.
- */
-__STATIC_INLINE void nrf_rng_event_clear(nrf_rng_event_t rng_event)
-{
- *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event)) = NRF_RNG_EVENT_CLEAR;
-}
-
-/**
- * @brief Function for getting the state of a specific event.
- *
- * @param[in] rng_event Event.
- *
- * @retval true If the event is not set.
- * @retval false If the event is set.
- */
-__STATIC_INLINE bool nrf_rng_event_get(nrf_rng_event_t rng_event)
-{
- return (bool)*((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event));
-}
-
-/**
- * @brief Function for setting shortcuts.
- *
- * @param[in] rng_short_mask Mask of shortcuts.
- *
- */
-__STATIC_INLINE void nrf_rng_shorts_enable(uint32_t rng_short_mask)
-{
- NRF_RNG->SHORTS |= rng_short_mask;
-}
-
-/**
- * @brief Function for clearing shortcuts.
- *
- * @param[in] rng_short_mask Mask of shortcuts.
- *
- */
-__STATIC_INLINE void nrf_rng_shorts_disable(uint32_t rng_short_mask)
-{
- NRF_RNG->SHORTS &= ~rng_short_mask;
-}
-
-/**
- * @brief Function for getting the previously generated random value.
- *
- * @return Previously generated random value.
- */
-__STATIC_INLINE uint8_t nrf_rng_random_value_get(void)
-{
- return (uint8_t)(NRF_RNG->VALUE & RNG_VALUE_VALUE_Msk);
-}
-
-/**
- * @brief Function for enabling digital error correction.
- */
-__STATIC_INLINE void nrf_rng_error_correction_enable(void)
-{
- NRF_RNG->CONFIG |= RNG_CONFIG_DERCEN_Msk;
-}
-
-/**
- * @brief Function for disabling digital error correction.
- */
-__STATIC_INLINE void nrf_rng_error_correction_disable(void)
-{
- NRF_RNG->CONFIG &= ~RNG_CONFIG_DERCEN_Msk;
-}
-/**
- *@}
- **/
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_RNG_H__ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rtc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rtc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rtc.h
deleted file mode 100644
index ad05f61..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rtc.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-/**
- * @file
- * @brief RTC HAL API.
- */
-
-#ifndef NRF_RTC_H
-#define NRF_RTC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_rtc_hal RTC HAL
- * @{
- * @ingroup nrf_rtc
- * @brief Hardware access layer for managing the real time counter (RTC).
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include "nrf.h"
-#include "nrf_assert.h"
-
-/**
- * @brief Macro for getting the number of compare channels available
- * in a given RTC instance.
- */
-#ifdef NRF51
- #define NRF_RTC_CC_CHANNEL_COUNT(id) 4
-#else
- #define NRF_RTC_CC_CHANNEL_COUNT(id) ((id) == 0 ? 3 : 4)
-#endif
-
-#define RTC_INPUT_FREQ 32768 /**< Input frequency of the RTC instance. */
-
-/**< Macro for wrapping values to RTC capacity. */
-#define RTC_WRAP(val) (val & RTC_COUNTER_COUNTER_Msk)
-
-#define RTC_CHANNEL_INT_MASK(ch) ((uint32_t)NRF_RTC_INT_COMPARE0_MASK << ch)
-#define RTC_CHANNEL_EVENT_ADDR(ch) (nrf_rtc_event_t)(NRF_RTC_EVENT_COMPARE_0 + ch*sizeof(uint32_t))
-/**
- * @enum nrf_rtc_task_t
- * @brief RTC tasks.
- */
-typedef enum
-{
- /*lint -save -e30*/
- NRF_RTC_TASK_START = offsetof(NRF_RTC_Type,TASKS_START), /**< Start. */
- NRF_RTC_TASK_STOP = offsetof(NRF_RTC_Type,TASKS_STOP), /**< Stop. */
- NRF_RTC_TASK_CLEAR = offsetof(NRF_RTC_Type,TASKS_CLEAR), /**< Clear. */
- NRF_RTC_TASK_TRIGGER_OVERFLOW = offsetof(NRF_RTC_Type,TASKS_TRIGOVRFLW),/**< Trigger overflow. */
- /*lint -restore*/
-} nrf_rtc_task_t;
-
-/**
- * @enum nrf_rtc_event_t
- * @brief RTC events.
- */
-typedef enum
-{
- /*lint -save -e30*/
- NRF_RTC_EVENT_TICK = offsetof(NRF_RTC_Type,EVENTS_TICK), /**< Tick event. */
- NRF_RTC_EVENT_OVERFLOW = offsetof(NRF_RTC_Type,EVENTS_OVRFLW), /**< Overflow event. */
- NRF_RTC_EVENT_COMPARE_0 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[0]), /**< Compare 0 event. */
- NRF_RTC_EVENT_COMPARE_1 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[1]), /**< Compare 1 event. */
- NRF_RTC_EVENT_COMPARE_2 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[2]), /**< Compare 2 event. */
- NRF_RTC_EVENT_COMPARE_3 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[3]) /**< Compare 3 event. */
- /*lint -restore*/
-} nrf_rtc_event_t;
-
-/**
- * @enum nrf_rtc_int_t
- * @brief RTC interrupts.
- */
-typedef enum
-{
- NRF_RTC_INT_TICK_MASK = RTC_INTENSET_TICK_Msk, /**< RTC interrupt from tick event. */
- NRF_RTC_INT_OVERFLOW_MASK = RTC_INTENSET_OVRFLW_Msk, /**< RTC interrupt from overflow event. */
- NRF_RTC_INT_COMPARE0_MASK = RTC_INTENSET_COMPARE0_Msk, /**< RTC interrupt from compare event on channel 0. */
- NRF_RTC_INT_COMPARE1_MASK = RTC_INTENSET_COMPARE1_Msk, /**< RTC interrupt from compare event on channel 1. */
- NRF_RTC_INT_COMPARE2_MASK = RTC_INTENSET_COMPARE2_Msk, /**< RTC interrupt from compare event on channel 2. */
- NRF_RTC_INT_COMPARE3_MASK = RTC_INTENSET_COMPARE3_Msk /**< RTC interrupt from compare event on channel 3. */
-} nrf_rtc_int_t;
-
-/**@brief Function for setting a compare value for a channel.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] ch Channel.
- * @param[in] cc_val Compare value to set.
- */
-__STATIC_INLINE void nrf_rtc_cc_set(NRF_RTC_Type * p_rtc, uint32_t ch, uint32_t cc_val);
-
-/**@brief Function for returning the compare value for a channel.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] ch Channel.
- *
- * @return COMPARE[ch] value.
- */
-__STATIC_INLINE uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch);
-
-/**@brief Function for enabling interrupts.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] mask Interrupt mask to be enabled.
- */
-__STATIC_INLINE void nrf_rtc_int_enable(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for disabling interrupts.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] mask Interrupt mask to be disabled.
- */
-__STATIC_INLINE void nrf_rtc_int_disable(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for checking if interrupts are enabled.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] mask Mask of interrupt flags to check.
- *
- * @return Mask with enabled interrupts.
- */
-__STATIC_INLINE uint32_t nrf_rtc_int_is_enabled(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for returning the status of currently enabled interrupts.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- *
- * @return Value in INTEN register.
- */
-__STATIC_INLINE uint32_t nrf_rtc_int_get(NRF_RTC_Type * p_rtc);
-
-/**@brief Function for checking if an event is pending.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] event Address of the event.
- *
- * @return Mask of pending events.
- */
-__STATIC_INLINE uint32_t nrf_rtc_event_pending(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event);
-
-/**@brief Function for clearing an event.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] event Event to clear.
- */
-__STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event);
-
-/**@brief Function for returning a counter value.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- *
- * @return Counter value.
- */
-__STATIC_INLINE uint32_t nrf_rtc_counter_get(NRF_RTC_Type * p_rtc);
-
-/**@brief Function for setting a prescaler value.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] val Value to set the prescaler to.
- */
-__STATIC_INLINE void nrf_rtc_prescaler_set(NRF_RTC_Type * p_rtc, uint32_t val);
-
-/**@brief Function for returning the address of an event.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] event Requested event.
- *
- * @return Address of the requested event register.
- */
-__STATIC_INLINE uint32_t nrf_rtc_event_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event);
-
-/**@brief Function for returning the address of a task.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] task Requested task.
- *
- * @return Address of the requested task register.
- */
-__STATIC_INLINE uint32_t nrf_rtc_task_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task);
-
-/**@brief Function for starting a task.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] task Requested task.
- */
-__STATIC_INLINE void nrf_rtc_task_trigger(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task);
-
-/**@brief Function for enabling events.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] mask Mask of event flags to enable.
- */
-__STATIC_INLINE void nrf_rtc_event_enable(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for disabling an event.
- *
- * @param[in] p_rtc Pointer to the instance register structure.
- * @param[in] event Requested event.
- */
-__STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t event);
-
-/**
- *@}
- **/
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_rtc_cc_set(NRF_RTC_Type * p_rtc, uint32_t ch, uint32_t cc_val)
-{
- p_rtc->CC[ch] = cc_val;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch)
-{
- return p_rtc->CC[ch];
-}
-
-__STATIC_INLINE void nrf_rtc_int_enable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
- p_rtc->INTENSET = mask;
-}
-
-__STATIC_INLINE void nrf_rtc_int_disable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
- p_rtc->INTENCLR = mask;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_int_is_enabled(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
- return (p_rtc->INTENSET & mask);
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_int_get(NRF_RTC_Type * p_rtc)
-{
- return p_rtc->INTENSET;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_event_pending(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event)
-{
- return *(volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event)
-{
- *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event)) = 0;
-#if __CORTEX_M == 0x04
- volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event));
- (void)dummy;
-#endif
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_counter_get(NRF_RTC_Type * p_rtc)
-{
- return p_rtc->COUNTER;
-}
-
-__STATIC_INLINE void nrf_rtc_prescaler_set(NRF_RTC_Type * p_rtc, uint32_t val)
-{
- ASSERT(val <= (RTC_PRESCALER_PRESCALER_Msk >> RTC_PRESCALER_PRESCALER_Pos));
- p_rtc->PRESCALER = val;
-}
-__STATIC_INLINE uint32_t rtc_prescaler_get(NRF_RTC_Type * p_rtc)
-{
- return p_rtc->PRESCALER;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_event_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event)
-{
- return (uint32_t)p_rtc + event;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_task_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task)
-{
- return (uint32_t)p_rtc + task;
-}
-
-__STATIC_INLINE void nrf_rtc_task_trigger(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task)
-{
- *(__IO uint32_t *)((uint32_t)p_rtc + task) = 1;
-}
-
-__STATIC_INLINE void nrf_rtc_event_enable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
- p_rtc->EVTENSET = mask;
-}
-__STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
- p_rtc->EVTENCLR = mask;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_RTC_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.c
deleted file mode 100644
index 849c3bd..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-/**
- * @file
- * @brief SAADC HAL implementation
- */
-
-#include "nrf_saadc.h"
-
-void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config)
-{
- NRF_SAADC->CH[channel].CONFIG =
- ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk)
- | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk)
- | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk)
- | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk)
- | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk)
- | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk);
- nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n);
- return;
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.h
deleted file mode 100644
index f2b6805..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.h
+++ /dev/null
@@ -1,562 +0,0 @@
-/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-
-#ifndef NRF_SAADC_H_
-#define NRF_SAADC_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_saadc_hal SAADC HAL
- * @{
- * @ingroup nrf_saadc
- *
- * @brief @tagAPI52 Hardware access layer for accessing the SAADC peripheral.
- */
-
-#include <stdbool.h>
-#include <stddef.h>
-#include "nrf.h"
-#include "nrf_assert.h"
-
-#define NRF_SAADC_CHANNEL_COUNT 8
-
-/**
- * @brief Resolution of the analog-to-digital converter.
- */
-typedef enum
-{
- NRF_SAADC_RESOLUTION_8BIT = SAADC_RESOLUTION_VAL_8bit, ///< 8 bit resolution.
- NRF_SAADC_RESOLUTION_10BIT = SAADC_RESOLUTION_VAL_10bit, ///< 10 bit resolution.
- NRF_SAADC_RESOLUTION_12BIT = SAADC_RESOLUTION_VAL_12bit, ///< 12 bit resolution.
- NRF_SAADC_RESOLUTION_14BIT = SAADC_RESOLUTION_VAL_14bit ///< 14 bit resolution.
-} nrf_saadc_resolution_t;
-
-
-/**
- * @brief Input selection for the analog-to-digital converter.
- */
-typedef enum
-{
- NRF_SAADC_INPUT_DISABLED = SAADC_CH_PSELP_PSELP_NC, ///< Not connected.
- NRF_SAADC_INPUT_AIN0 = SAADC_CH_PSELP_PSELP_AnalogInput0, ///< Analog input 0 (AIN0).
- NRF_SAADC_INPUT_AIN1 = SAADC_CH_PSELP_PSELP_AnalogInput1, ///< Analog input 1 (AIN1).
- NRF_SAADC_INPUT_AIN2 = SAADC_CH_PSELP_PSELP_AnalogInput2, ///< Analog input 2 (AIN2).
- NRF_SAADC_INPUT_AIN3 = SAADC_CH_PSELP_PSELP_AnalogInput3, ///< Analog input 3 (AIN3).
- NRF_SAADC_INPUT_AIN4 = SAADC_CH_PSELP_PSELP_AnalogInput4, ///< Analog input 4 (AIN4).
- NRF_SAADC_INPUT_AIN5 = SAADC_CH_PSELP_PSELP_AnalogInput5, ///< Analog input 5 (AIN5).
- NRF_SAADC_INPUT_AIN6 = SAADC_CH_PSELP_PSELP_AnalogInput6, ///< Analog input 6 (AIN6).
- NRF_SAADC_INPUT_AIN7 = SAADC_CH_PSELP_PSELP_AnalogInput7, ///< Analog input 7 (AIN7).
- NRF_SAADC_INPUT_VDD = SAADC_CH_PSELP_PSELP_VDD ///< VDD as input.
-} nrf_saadc_input_t;
-
-
-/**
- * @brief Analog-to-digital converter oversampling mode.
- */
-typedef enum
-{
- NRF_SAADC_OVERSAMPLE_DISABLED = SAADC_OVERSAMPLE_OVERSAMPLE_Bypass, ///< No oversampling.
- NRF_SAADC_OVERSAMPLE_2X = SAADC_OVERSAMPLE_OVERSAMPLE_Over2x, ///< Oversample 2x.
- NRF_SAADC_OVERSAMPLE_4X = SAADC_OVERSAMPLE_OVERSAMPLE_Over4x, ///< Oversample 4x.
- NRF_SAADC_OVERSAMPLE_8X = SAADC_OVERSAMPLE_OVERSAMPLE_Over8x, ///< Oversample 8x.
- NRF_SAADC_OVERSAMPLE_16X = SAADC_OVERSAMPLE_OVERSAMPLE_Over16x, ///< Oversample 16x.
- NRF_SAADC_OVERSAMPLE_32X = SAADC_OVERSAMPLE_OVERSAMPLE_Over32x, ///< Oversample 32x.
- NRF_SAADC_OVERSAMPLE_64X = SAADC_OVERSAMPLE_OVERSAMPLE_Over64x, ///< Oversample 64x.
- NRF_SAADC_OVERSAMPLE_128X = SAADC_OVERSAMPLE_OVERSAMPLE_Over128x, ///< Oversample 128x.
- NRF_SAADC_OVERSAMPLE_256X = SAADC_OVERSAMPLE_OVERSAMPLE_Over256x ///< Oversample 256x.
-} nrf_saadc_oversample_t;
-
-
-/**
- * @brief Analog-to-digital converter channel resistor control.
- */
-typedef enum
-{
- NRF_SAADC_RESISTOR_DISABLED = SAADC_CH_CONFIG_RESP_Bypass, ///< Bypass resistor ladder.
- NRF_SAADC_RESISTOR_PULLDOWN = SAADC_CH_CONFIG_RESP_Pulldown, ///< Pull-down to GND.
- NRF_SAADC_RESISTOR_PULLUP = SAADC_CH_CONFIG_RESP_Pullup, ///< Pull-up to VDD.
- NRF_SAADC_RESISTOR_VDD1_2 = SAADC_CH_CONFIG_RESP_VDD1_2 ///< Set input at VDD/2.
-} nrf_saadc_resistor_t;
-
-
-/**
- * @brief Gain factor of the analog-to-digital converter input.
- */
-typedef enum
-{
- NRF_SAADC_GAIN1_6 = SAADC_CH_CONFIG_GAIN_Gain1_6, ///< Gain factor 1/6.
- NRF_SAADC_GAIN1_5 = SAADC_CH_CONFIG_GAIN_Gain1_5, ///< Gain factor 1/5.
- NRF_SAADC_GAIN1_4 = SAADC_CH_CONFIG_GAIN_Gain1_4, ///< Gain factor 1/4.
- NRF_SAADC_GAIN1_3 = SAADC_CH_CONFIG_GAIN_Gain1_3, ///< Gain factor 1/3.
- NRF_SAADC_GAIN1_2 = SAADC_CH_CONFIG_GAIN_Gain1_2, ///< Gain factor 1/2.
- NRF_SAADC_GAIN1 = SAADC_CH_CONFIG_GAIN_Gain1, ///< Gain factor 1.
- NRF_SAADC_GAIN2 = SAADC_CH_CONFIG_GAIN_Gain2, ///< Gain factor 2.
- NRF_SAADC_GAIN4 = SAADC_CH_CONFIG_GAIN_Gain4, ///< Gain factor 4.
-} nrf_saadc_gain_t;
-
-
-/**
- * @brief Reference selection for the analog-to-digital converter.
- */
-typedef enum
-{
- NRF_SAADC_REFERENCE_INTERNAL = SAADC_CH_CONFIG_REFSEL_Internal, ///< Internal reference (0.6 V).
- NRF_SAADC_REFERENCE_VDD4 = SAADC_CH_CONFIG_REFSEL_VDD1_4 ///< VDD/4 as reference.
-} nrf_saadc_reference_t;
-
-
-/**
- * @brief Analog-to-digital converter acquisition time.
- */
-typedef enum
-{
- NRF_SAADC_ACQTIME_3US = SAADC_CH_CONFIG_TACQ_3us, ///< 3 us.
- NRF_SAADC_ACQTIME_5US = SAADC_CH_CONFIG_TACQ_5us, ///< 5 us.
- NRF_SAADC_ACQTIME_10US = SAADC_CH_CONFIG_TACQ_10us, ///< 10 us.
- NRF_SAADC_ACQTIME_15US = SAADC_CH_CONFIG_TACQ_15us, ///< 15 us.
- NRF_SAADC_ACQTIME_20US = SAADC_CH_CONFIG_TACQ_20us, ///< 20 us.
- NRF_SAADC_ACQTIME_40US = SAADC_CH_CONFIG_TACQ_40us ///< 40 us.
-} nrf_saadc_acqtime_t;
-
-
-/**
- * @brief Analog-to-digital converter channel mode.
- */
-typedef enum
-{
- NRF_SAADC_MODE_SINGLE_ENDED = SAADC_CH_CONFIG_MODE_SE, ///< Single ended, PSELN will be ignored, negative input to ADC shorted to GND.
- NRF_SAADC_MODE_DIFFERENTIAL = SAADC_CH_CONFIG_MODE_Diff ///< Differential mode.
-} nrf_saadc_mode_t;
-
-
-/**
- * @brief Analog-to-digital converter tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
- NRF_SAADC_TASK_START = offsetof(NRF_SAADC_Type, TASKS_START), ///< Start the ADC and prepare the result buffer in RAM.
- NRF_SAADC_TASK_SAMPLE = offsetof(NRF_SAADC_Type, TASKS_SAMPLE), ///< Take one ADC sample. If scan is enabled, all channels are sampled.
- NRF_SAADC_TASK_STOP = offsetof(NRF_SAADC_Type, TASKS_STOP), ///< Stop the ADC and terminate any on-going conversion.
- NRF_SAADC_TASK_CALIBRATEOFFSET = offsetof(NRF_SAADC_Type, TASKS_CALIBRATEOFFSET), ///< Starts offset auto-calibration.
-} nrf_saadc_task_t;
-
-
-/**
- * @brief Analog-to-digital converter events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
- NRF_SAADC_EVENT_STARTED = offsetof(NRF_SAADC_Type, EVENTS_STARTED), ///< The ADC has started.
- NRF_SAADC_EVENT_END = offsetof(NRF_SAADC_Type, EVENTS_END), ///< The ADC has filled up the result buffer.
- NRF_SAADC_EVENT_CALIBRATEDONE = offsetof(NRF_SAADC_Type, EVENTS_CALIBRATEDONE), ///< Calibration is complete.
- NRF_SAADC_EVENT_STOPPED = offsetof(NRF_SAADC_Type, EVENTS_STOPPED), ///< The ADC has stopped.
- NRF_SAADC_EVENT_CH0_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITH), ///< Last result is equal or above CH[0].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH0_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITL), ///< Last result is equal or below CH[0].LIMIT.LOW.
- NRF_SAADC_EVENT_CH1_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITH), ///< Last result is equal or above CH[1].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH1_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITL), ///< Last result is equal or below CH[1].LIMIT.LOW.
- NRF_SAADC_EVENT_CH2_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITH), ///< Last result is equal or above CH[2].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH2_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITL), ///< Last result is equal or below CH[2].LIMIT.LOW.
- NRF_SAADC_EVENT_CH3_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITH), ///< Last result is equal or above CH[3].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH3_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITL), ///< Last result is equal or below CH[3].LIMIT.LOW.
- NRF_SAADC_EVENT_CH4_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITH), ///< Last result is equal or above CH[4].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH4_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITL), ///< Last result is equal or below CH[4].LIMIT.LOW.
- NRF_SAADC_EVENT_CH5_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITH), ///< Last result is equal or above CH[5].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH5_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITL), ///< Last result is equal or below CH[5].LIMIT.LOW.
- NRF_SAADC_EVENT_CH6_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITH), ///< Last result is equal or above CH[6].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH6_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITL), ///< Last result is equal or below CH[6].LIMIT.LOW.
- NRF_SAADC_EVENT_CH7_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITH), ///< Last result is equal or above CH[7].LIMIT.HIGH.
- NRF_SAADC_EVENT_CH7_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITL) ///< Last result is equal or below CH[7].LIMIT.LOW.
-} nrf_saadc_event_t;
-
-
-/**
- * @brief Analog-to-digital converter interrupt masks.
- */
-typedef enum
-{
- NRF_SAADC_INT_STARTED = SAADC_INTENSET_STARTED_Msk, ///< Interrupt on EVENTS_STARTED event.
- NRF_SAADC_INT_END = SAADC_INTENSET_END_Msk, ///< Interrupt on EVENTS_END event.
- NRF_SAADC_INT_STOPPED = SAADC_INTENSET_STOPPED_Msk, ///< Interrupt on EVENTS_STOPPED event.
- NRF_SAADC_INT_CH0LIMITH = SAADC_INTENSET_CH0LIMITH_Msk, ///< Interrupt on EVENTS_CH[0].LIMITH event.
- NRF_SAADC_INT_CH0LIMITL = SAADC_INTENSET_CH0LIMITL_Msk, ///< Interrupt on EVENTS_CH[0].LIMITL event.
- NRF_SAADC_INT_CH1LIMITH = SAADC_INTENSET_CH1LIMITH_Msk, ///< Interrupt on EVENTS_CH[1].LIMITH event.
- NRF_SAADC_INT_CH1LIMITL = SAADC_INTENSET_CH1LIMITL_Msk, ///< Interrupt on EVENTS_CH[1].LIMITL event.
- NRF_SAADC_INT_CH2LIMITH = SAADC_INTENSET_CH2LIMITH_Msk, ///< Interrupt on EVENTS_CH[2].LIMITH event.
- NRF_SAADC_INT_CH2LIMITL = SAADC_INTENSET_CH2LIMITL_Msk, ///< Interrupt on EVENTS_CH[2].LIMITL event.
- NRF_SAADC_INT_CH3LIMITH = SAADC_INTENSET_CH3LIMITH_Msk, ///< Interrupt on EVENTS_CH[3].LIMITH event.
- NRF_SAADC_INT_CH3LIMITL = SAADC_INTENSET_CH3LIMITL_Msk, ///< Interrupt on EVENTS_CH[3].LIMITL event.
- NRF_SAADC_INT_CH4LIMITH = SAADC_INTENSET_CH4LIMITH_Msk, ///< Interrupt on EVENTS_CH[4].LIMITH event.
- NRF_SAADC_INT_CH4LIMITL = SAADC_INTENSET_CH4LIMITL_Msk, ///< Interrupt on EVENTS_CH[4].LIMITL event.
- NRF_SAADC_INT_CH5LIMITH = SAADC_INTENSET_CH5LIMITH_Msk, ///< Interrupt on EVENTS_CH[5].LIMITH event.
- NRF_SAADC_INT_CH5LIMITL = SAADC_INTENSET_CH5LIMITL_Msk, ///< Interrupt on EVENTS_CH[5].LIMITL event.
- NRF_SAADC_INT_CH6LIMITH = SAADC_INTENSET_CH6LIMITH_Msk, ///< Interrupt on EVENTS_CH[6].LIMITH event.
- NRF_SAADC_INT_CH6LIMITL = SAADC_INTENSET_CH6LIMITL_Msk, ///< Interrupt on EVENTS_CH[6].LIMITL event.
- NRF_SAADC_INT_CH7LIMITH = SAADC_INTENSET_CH7LIMITH_Msk, ///< Interrupt on EVENTS_CH[7].LIMITH event.
- NRF_SAADC_INT_CH7LIMITL = SAADC_INTENSET_CH7LIMITL_Msk, ///< Interrupt on EVENTS_CH[7].LIMITL event.
- NRF_SAADC_INT_ALL = 0x7FFFFFFFUL ///< Mask of all interrupts.
-} nrf_saadc_int_mask_t;
-
-
-/**
- * @brief Analog-to-digital converter value limit type.
- */
-typedef enum
-{
- NRF_SAADC_LIMIT_LOW = 0,
- NRF_SAADC_LIMIT_HIGH = 1
-} nrf_saadc_limit_t;
-
-
-typedef int16_t nrf_saadc_value_t; ///< Type of a single ADC conversion result.
-
-
-/**
- * @brief Analog-to-digital converter configuration structure.
- */
-typedef struct
-{
- nrf_saadc_resolution_t resolution;
- nrf_saadc_oversample_t oversample;
- nrf_saadc_value_t * buffer;
- uint32_t buffer_size;
-} nrf_saadc_config_t;
-
-
-/**
- * @brief Analog-to-digital converter channel configuration structure.
- */
-typedef struct
-{
- nrf_saadc_resistor_t resistor_p;
- nrf_saadc_resistor_t resistor_n;
- nrf_saadc_gain_t gain;
- nrf_saadc_reference_t reference;
- nrf_saadc_acqtime_t acq_time;
- nrf_saadc_mode_t mode;
- nrf_saadc_input_t pin_p;
- nrf_saadc_input_t pin_n;
-} nrf_saadc_channel_config_t;
-
-
-/**
- * @brief Function for triggering a specific SAADC task.
- *
- * @param[in] saadc_task SAADC task.
- */
-__STATIC_INLINE void nrf_saadc_task_trigger(nrf_saadc_task_t saadc_task)
-{
- *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_task)) = 0x1UL;
-}
-
-
-/**
- * @brief Function for getting the address of a specific SAADC task register.
- *
- * @param[in] saadc_task SAADC task.
- *
- * @return Address of the specified SAADC task.
- */
-__STATIC_INLINE uint32_t nrf_saadc_task_address_get(nrf_saadc_task_t saadc_task)
-{
- return (uint32_t)((uint8_t *)NRF_SAADC + (uint32_t)saadc_task);
-}
-
-
-/**
- * @brief Function for getting the state of a specific SAADC event.
- *
- * @param[in] saadc_event SAADC event.
- *
- * @return State of the specified SAADC event.
- */
-__STATIC_INLINE bool nrf_saadc_event_check(nrf_saadc_event_t saadc_event)
-{
- return (bool)*(volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event);
-}
-
-
-/**
- * @brief Function for clearing the specific SAADC event.
- *
- * @param[in] saadc_event SAADC event.
- */
-__STATIC_INLINE void nrf_saadc_event_clear(nrf_saadc_event_t saadc_event)
-{
- *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event)) = 0x0UL;
-}
-
-
-/**
- * @brief Function for getting the address of a specific SAADC event register.
- *
- * @param[in] saadc_event SAADC event.
- *
- * @return Address of the specified SAADC event.
- */
-__STATIC_INLINE volatile uint32_t * nrf_saadc_event_address_get(nrf_saadc_event_t saadc_event)
-{
- return (volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event);
-}
-
-
-/**
- * @brief Function for getting the address of a specific SAADC limit event register.
- *
- * @param[in] channel Channel number.
- * @param[in] limit_type Low limit or high limit.
- *
- * @return Address of the specified SAADC limit event.
- */
-__STATIC_INLINE volatile uint32_t * nrf_saadc_event_limit_address_get(uint8_t channel, nrf_saadc_limit_t limit_type)
-{
- ASSERT(channel < NRF_SAADC_CHANNEL_COUNT);
- if (limit_type == NRF_SAADC_LIMIT_HIGH)
- {
- return &NRF_SAADC->EVENTS_CH[channel].LIMITH;
- }
- else
- {
- return &NRF_SAADC->EVENTS_CH[channel].LIMITL;
- }
-}
-
-
-/**
- * @brief Function for getting the SAADC channel monitoring limit events.
- *
- * @param[in] channel Channel number.
- * @param[in] limit_type Low limit or high limit.
- */
-__STATIC_INLINE nrf_saadc_event_t nrf_saadc_event_limit_get(uint8_t channel, nrf_saadc_limit_t limit_type)
-{
- if (limit_type == NRF_SAADC_LIMIT_HIGH)
- {
- return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITH +
- (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITH - NRF_SAADC_EVENT_CH0_LIMITH)
- * (uint32_t) channel );
- }
- else
- {
- return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITL +
- (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITL - NRF_SAADC_EVENT_CH0_LIMITL)
- * (uint32_t) channel );
- }
-}
-
-
-/**
- * @brief Function for configuring the input pins for a specific SAADC channel.
- *
- * @param[in] channel Channel number.
- * @param[in] pselp Positive input.
- * @param[in] pseln Negative input. Set to NRF_SAADC_INPUT_DISABLED in single ended mode.
- */
-__STATIC_INLINE void nrf_saadc_channel_input_set(uint8_t channel,
- nrf_saadc_input_t pselp,
- nrf_saadc_input_t pseln)
-{
- NRF_SAADC->CH[channel].PSELN = pseln;
- NRF_SAADC->CH[channel].PSELP = pselp;
-}
-
-
-/**
- * @brief Function for setting the SAADC channel monitoring limits.
- *
- * @param[in] channel Channel number.
- * @param[in] low Low limit.
- * @param[in] high High limit.
- */
-__STATIC_INLINE void nrf_saadc_channel_limits_set(uint8_t channel, int16_t low, int16_t high)
-{
- NRF_SAADC->CH[channel].LIMIT = (
- (((uint32_t) low << SAADC_CH_LIMIT_LOW_Pos) & SAADC_CH_LIMIT_LOW_Msk)
- | (((uint32_t) high << SAADC_CH_LIMIT_HIGH_Pos) & SAADC_CH_LIMIT_HIGH_Msk));
-}
-
-
-/**
- * @brief Function for enabling specified SAADC interrupts.
- *
- * @param[in] saadc_int_mask Interrupt(s) to enable.
- */
-__STATIC_INLINE void nrf_saadc_int_enable(uint32_t saadc_int_mask)
-{
- NRF_SAADC->INTENSET = saadc_int_mask;
-}
-
-
-/**
- * @brief Function for retrieving the state of specified SAADC interrupts.
- *
- * @param[in] saadc_int_mask Interrupt(s) to check.
- *
- * @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_saadc_int_enable_check(uint32_t saadc_int_mask)
-{
- return (bool)(NRF_SAADC->INTENSET & saadc_int_mask);
-}
-
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param saadc_int_mask Interrupt(s) to disable.
- */
-__STATIC_INLINE void nrf_saadc_int_disable(uint32_t saadc_int_mask)
-{
- NRF_SAADC->INTENCLR = saadc_int_mask;
-}
-
-
-/**
- * @brief Function for generating masks for SAADC channel limit interrupts.
- *
- * @param[in] channel SAADC channel number.
- * @param[in] limit_type Limit type.
- *
- * @returns Interrupt mask.
- */
-__STATIC_INLINE uint32_t nrf_saadc_limit_int_get(uint8_t channel, nrf_saadc_limit_t limit_type)
-{
- ASSERT(channel < NRF_SAADC_CHANNEL_COUNT);
- uint32_t mask = (limit_type == NRF_SAADC_LIMIT_LOW) ? NRF_SAADC_INT_CH0LIMITL : NRF_SAADC_INT_CH0LIMITH;
- return mask << (channel * 2);
-}
-
-
-/**
- * @brief Function for checking whether the SAADC is busy.
- *
- * This function checks whether the analog-to-digital converter is busy with a conversion.
- *
- * @retval true If the SAADC is busy.
- * @retval false If the SAADC is not busy.
- */
-__STATIC_INLINE bool nrf_saadc_busy_check(void)
-{
- //return ((NRF_SAADC->STATUS & SAADC_STATUS_STATUS_Msk) == SAADC_STATUS_STATUS_Msk);
- //simplified for performance
- return NRF_SAADC->STATUS;
-}
-
-
-/**
- * @brief Function for enabling the SAADC.
- *
- * The analog-to-digital converter must be enabled before use.
- */
-__STATIC_INLINE void nrf_saadc_enable(void)
-{
- NRF_SAADC->ENABLE = (SAADC_ENABLE_ENABLE_Enabled << SAADC_ENABLE_ENABLE_Pos);
-}
-
-
-/**
- * @brief Function for disabling the SAADC.
- */
-__STATIC_INLINE void nrf_saadc_disable(void)
-{
- NRF_SAADC->ENABLE = (SAADC_ENABLE_ENABLE_Disabled << SAADC_ENABLE_ENABLE_Pos);
-}
-
-
-/**
- * @brief Function for checking if the SAADC is enabled.
- *
- * @retval true If the SAADC is enabled.
- * @retval false If the SAADC is not enabled.
- */
-__STATIC_INLINE bool nrf_saadc_enable_check(void)
-{
- //simplified for performance
- return NRF_SAADC->ENABLE;
-}
-
-
-/**
- * @brief Function for initializing the SAADC result buffer.
- *
- * @param[in] buffer Pointer to the result buffer.
- * @param[in] num Size of buffer in words.
- */
-__STATIC_INLINE void nrf_saadc_buffer_init(nrf_saadc_value_t * buffer, uint32_t num)
-{
- NRF_SAADC->RESULT.PTR = (uint32_t)buffer;
- NRF_SAADC->RESULT.MAXCNT = num;
-}
-
-/**
- * @brief Function for getting the number of buffer words transferred since last START operation.
- *
- * @returns Number of words transferred.
- */
-__STATIC_INLINE uint16_t nrf_saadc_amount_get(void)
-{
- return NRF_SAADC->RESULT.AMOUNT;
-}
-
-
-/**
- * @brief Function for setting the SAADC sample resolution.
- *
- * @param[in] resolution Bit resolution.
- */
-__STATIC_INLINE void nrf_saadc_resolution_set(nrf_saadc_resolution_t resolution)
-{
- NRF_SAADC->RESOLUTION = resolution;
-}
-
-
-/**
- * @brief Function for configuring the oversampling feature.
- *
- * @param[in] oversample Oversampling mode.
- */
-__STATIC_INLINE void nrf_saadc_oversample_set(nrf_saadc_oversample_t oversample)
-{
- NRF_SAADC->OVERSAMPLE = oversample;
-}
-
-/**
- * @brief Function for getting the oversampling feature configuration.
- *
- * @return Oversampling configuration.
- */
-__STATIC_INLINE nrf_saadc_oversample_t nrf_saadc_oversample_get(void)
-{
- return (nrf_saadc_oversample_t)NRF_SAADC->OVERSAMPLE;
-}
-
-/**
- * @brief Function for initializing the SAADC channel.
- *
- * @param[in] channel Channel number.
- * @param[in] config Pointer to the channel configuration structure.
- */
-void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config);
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_SAADC_H_ */