mirror of https://github.com/ARMmbed/mbed-os.git
Ported analogin and pwm_out for IOTDEV-1573.
Also addressed: - removed dependency on legacy config (excluded apply_old_config.h) - removed legacy pwm and saadc headers - Arm Compiler 5 linking issue (a band-aid for now... needs to be properly addressed for peripheral sharing) - added missing header in SoftDevice filepull/10652/head
parent
9ac7fe7ac9
commit
cc54611f02
|
@ -46,7 +46,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
// <h> nRF_BLE
|
||||
// <h> nRF_BLE
|
||||
|
||||
//==========================================================
|
||||
// <q> BLE_ADVERTISING_ENABLED - ble_advertising - Advertising module
|
||||
|
@ -187,7 +187,7 @@
|
|||
// <4=> Yellow
|
||||
// <5=> Blue
|
||||
// <6=> Magenta
|
||||
// <7=> Cyan
|
||||
// <7=> Cyan
|
||||
// <8=> White
|
||||
|
||||
#ifndef BLE_BAS_CONFIG_INFO_COLOR
|
||||
|
@ -1862,7 +1862,7 @@
|
|||
// <e> NRFX_GPIOTE_ENABLED - nrfx_gpiote - GPIOTE peripheral driver
|
||||
//==========================================================
|
||||
#ifndef NRFX_GPIOTE_ENABLED
|
||||
#define NRFX_GPIOTE_ENABLED 0
|
||||
#define NRFX_GPIOTE_ENABLED 1
|
||||
#endif
|
||||
// <o> NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins
|
||||
#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
|
||||
|
@ -2463,34 +2463,34 @@
|
|||
// <e> NRFX_PWM_ENABLED - nrfx_pwm - PWM peripheral driver
|
||||
//==========================================================
|
||||
#ifndef NRFX_PWM_ENABLED
|
||||
#define NRFX_PWM_ENABLED 0
|
||||
#define NRFX_PWM_ENABLED 1
|
||||
#endif
|
||||
// <q> NRFX_PWM0_ENABLED - Enable PWM0 instance
|
||||
|
||||
|
||||
|
||||
#ifndef NRFX_PWM0_ENABLED
|
||||
#define NRFX_PWM0_ENABLED 0
|
||||
#define NRFX_PWM0_ENABLED 1
|
||||
#endif
|
||||
|
||||
// <q> NRFX_PWM1_ENABLED - Enable PWM1 instance
|
||||
|
||||
|
||||
|
||||
#ifndef NRFX_PWM1_ENABLED
|
||||
#define NRFX_PWM1_ENABLED 0
|
||||
#define NRFX_PWM1_ENABLED 1
|
||||
#endif
|
||||
|
||||
// <q> NRFX_PWM2_ENABLED - Enable PWM2 instance
|
||||
|
||||
|
||||
#ifndef NRFX_PWM2_ENABLED
|
||||
#define NRFX_PWM2_ENABLED 0
|
||||
#define NRFX_PWM2_ENABLED 1
|
||||
#endif
|
||||
|
||||
// <q> NRFX_PWM3_ENABLED - Enable PWM3 instance
|
||||
|
||||
|
||||
|
||||
#ifndef NRFX_PWM3_ENABLED
|
||||
#define NRFX_PWM3_ENABLED 0
|
||||
#define NRFX_PWM3_ENABLED 1
|
||||
#endif
|
||||
|
||||
// <o> NRFX_PWM_DEFAULT_CONFIG_OUT0_PIN - Out0 pin <0-31>
|
||||
|
@ -3114,7 +3114,7 @@
|
|||
// <e> NRFX_SAADC_ENABLED - nrfx_saadc - SAADC peripheral driver
|
||||
//==========================================================
|
||||
#ifndef NRFX_SAADC_ENABLED
|
||||
#define NRFX_SAADC_ENABLED 0
|
||||
#define NRFX_SAADC_ENABLED 1
|
||||
#endif
|
||||
// <o> NRFX_SAADC_CONFIG_RESOLUTION - Resolution
|
||||
|
||||
|
@ -3454,14 +3454,14 @@
|
|||
|
||||
|
||||
#ifndef NRFX_SPI0_ENABLED
|
||||
#define NRFX_SPI0_ENABLED 1
|
||||
#define NRFX_SPI0_ENABLED 0
|
||||
#endif
|
||||
|
||||
// <q> NRFX_SPI1_ENABLED - Enable SPI1 instance
|
||||
|
||||
|
||||
|
||||
#ifndef NRFX_SPI1_ENABLED
|
||||
#define NRFX_SPI1_ENABLED 0
|
||||
#define NRFX_SPI1_ENABLED 1
|
||||
#endif
|
||||
|
||||
// <q> NRFX_SPI2_ENABLED - Enable SPI2 instance
|
||||
|
@ -5026,7 +5026,7 @@
|
|||
#endif
|
||||
|
||||
// <q> RTC1_ENABLED - Enable RTC1 instance
|
||||
|
||||
|
||||
|
||||
#ifndef RTC1_ENABLED
|
||||
#define RTC1_ENABLED 0
|
||||
|
@ -5049,7 +5049,7 @@
|
|||
// <e> SAADC_ENABLED - nrf_drv_saadc - SAADC peripheral driver - legacy layer
|
||||
//==========================================================
|
||||
#ifndef SAADC_ENABLED
|
||||
#define SAADC_ENABLED 0
|
||||
#define SAADC_ENABLED 1
|
||||
#endif
|
||||
// <o> SAADC_CONFIG_RESOLUTION - Resolution
|
||||
|
||||
|
@ -6114,7 +6114,7 @@
|
|||
// <e> FDS_ENABLED - fds - Flash data storage module
|
||||
//==========================================================
|
||||
#ifndef FDS_ENABLED
|
||||
#define FDS_ENABLED 0
|
||||
#define FDS_ENABLED 1
|
||||
#endif
|
||||
// <h> Pages - Virtual page settings
|
||||
|
||||
|
@ -6158,7 +6158,7 @@
|
|||
// <2=> NRF_FSTORAGE_SD
|
||||
|
||||
#ifndef FDS_BACKEND
|
||||
#define FDS_BACKEND 2
|
||||
#define FDS_BACKEND 1
|
||||
#endif
|
||||
|
||||
// </h>
|
||||
|
@ -6650,7 +6650,7 @@
|
|||
// <e> NRF_FSTORAGE_ENABLED - nrf_fstorage - Flash abstraction library
|
||||
//==========================================================
|
||||
#ifndef NRF_FSTORAGE_ENABLED
|
||||
#define NRF_FSTORAGE_ENABLED 0
|
||||
#define NRF_FSTORAGE_ENABLED 1
|
||||
#endif
|
||||
// <h> nrf_fstorage - Common settings
|
||||
|
||||
|
|
|
@ -15,23 +15,27 @@
|
|||
*/
|
||||
|
||||
#if DEVICE_ANALOGIN
|
||||
|
||||
#include "hal/analogin_api.h"
|
||||
|
||||
#include "pinmap.h"
|
||||
#include "PeripheralPins.h"
|
||||
|
||||
#include "nrf_drv_saadc.h"
|
||||
#include "nrfx_saadc.h"
|
||||
#include "nrfx_errors.h"
|
||||
#include "sdk_config.h"
|
||||
|
||||
#define ADC_12BIT_RANGE 0x0FFF
|
||||
#define ADC_16BIT_RANGE 0xFFFF
|
||||
|
||||
/* Unused event handler but driver requires one. */
|
||||
static void analog_in_event_handler(nrf_drv_saadc_evt_t const *p_event)
|
||||
static void analog_in_event_handler(nrfx_saadc_evt_t const *p_event)
|
||||
{
|
||||
(void) p_event;
|
||||
|
||||
}
|
||||
|
||||
/* Interrupt handler implemented in nrf_drv_saadc.c. */
|
||||
/* Interrupt handler implemented in nrfx_saadc.c. */
|
||||
void SAADC_IRQHandler(void);
|
||||
|
||||
/** Initialize the analogin peripheral
|
||||
|
@ -41,7 +45,7 @@ void SAADC_IRQHandler(void);
|
|||
* @param pin The analogin pin name
|
||||
*/
|
||||
void analogin_init(analogin_t *obj, PinName pin)
|
||||
{
|
||||
{
|
||||
MBED_ASSERT(obj);
|
||||
|
||||
/* Only initialize SAADC on first pin. */
|
||||
|
@ -52,21 +56,21 @@ void analogin_init(analogin_t *obj, PinName pin)
|
|||
first_init = false;
|
||||
|
||||
/* Use configuration from sdk_config.h.
|
||||
* Default is:
|
||||
* Default is:
|
||||
* - 12 bit.
|
||||
* - No oversampling.
|
||||
* - Priority 7 (lowest).
|
||||
* - No low power mode.
|
||||
*/
|
||||
nrf_drv_saadc_config_t adc_config = {
|
||||
nrfx_saadc_config_t adc_config = {
|
||||
.resolution = (nrf_saadc_resolution_t)SAADC_CONFIG_RESOLUTION,
|
||||
.oversample = (nrf_saadc_oversample_t)SAADC_CONFIG_OVERSAMPLE,
|
||||
.interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY,
|
||||
.low_power_mode = SAADC_CONFIG_LP_MODE
|
||||
};
|
||||
|
||||
ret_code_t result = nrf_drv_saadc_init(&adc_config, analog_in_event_handler);
|
||||
MBED_ASSERT(result == NRF_SUCCESS);
|
||||
ret_code_t result = nrfx_saadc_init(&adc_config, analog_in_event_handler);
|
||||
MBED_ASSERT(result == NRFX_SUCCESS);
|
||||
|
||||
/* Register interrupt handler in vector table. */
|
||||
NVIC_SetVector(SAADC_IRQn, (uint32_t)SAADC_IRQHandler);
|
||||
|
@ -94,8 +98,8 @@ void analogin_init(analogin_t *obj, PinName pin)
|
|||
.pin_n = NRF_SAADC_INPUT_DISABLED
|
||||
};
|
||||
|
||||
ret_code_t result = nrf_drv_saadc_channel_init(channel, &channel_config);
|
||||
MBED_ASSERT(result == NRF_SUCCESS);
|
||||
ret_code_t result = nrfx_saadc_channel_init(channel, &channel_config);
|
||||
MBED_ASSERT(result == NRFX_SUCCESS);
|
||||
|
||||
/* Store channel in ADC object. */
|
||||
obj->channel = channel;
|
||||
|
@ -116,10 +120,10 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
|
||||
/* Read single channel, blocking. */
|
||||
nrf_saadc_value_t value = { 0 };
|
||||
ret_code_t result = nrf_drv_saadc_sample_convert(obj->channel, &value);
|
||||
ret_code_t result = nrfx_saadc_sample_convert(obj->channel, &value);
|
||||
|
||||
/* nrf_saadc_value_t is a signed integer. Only take the absolute value. */
|
||||
if ((result == NRF_SUCCESS) && (value > 0)) {
|
||||
if ((result == NRFX_SUCCESS) && (value > 0)) {
|
||||
|
||||
/* Normalize 12 bit ADC value to 16 bit Mbed ADC range. */
|
||||
uint32_t normalized = value;
|
||||
|
|
|
@ -588,7 +588,8 @@ static void i2c_configure_driver_instance(i2c_t *obj)
|
|||
* deinitialize on object destruction.
|
||||
*/
|
||||
NRFX_IRQ_DISABLE((nrfx_get_irq_number((void const*)nordic_nrf5_twi_register[instance])));
|
||||
// RF - there doesn't appear to be a replacement for nrf_drv_common_per_res_release() !
|
||||
// RF - there doesn't appear to be a replacement for nrf_drv_common_per_res_release()
|
||||
// RF - check how this is now handled
|
||||
// nrf_drv_common_per_res_release(nordic_nrf5_twi_register[instance]);
|
||||
|
||||
/* Configure driver with new settings. */
|
||||
|
@ -606,24 +607,24 @@ static void i2c_configure_driver_instance(i2c_t *obj)
|
|||
if (config->handler) {
|
||||
|
||||
/* Initialze driver in non-blocking mode. */
|
||||
nrf_drv_twi_init(&nordic_nrf5_instance[instance],
|
||||
&twi_config,
|
||||
nordic_nrf5_twi_event_handler,
|
||||
obj);
|
||||
nrfx_twi_init(&nordic_nrf5_instance[instance],
|
||||
&twi_config,
|
||||
nordic_nrf5_twi_event_handler,
|
||||
obj);
|
||||
} else {
|
||||
|
||||
/* Initialze driver in blocking mode. */
|
||||
nrf_drv_twi_init(&nordic_nrf5_instance[instance],
|
||||
&twi_config,
|
||||
NULL,
|
||||
NULL);
|
||||
nrfx_twi_init(&nordic_nrf5_instance[instance],
|
||||
&twi_config,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
#else
|
||||
/* Initialze driver in blocking mode. */
|
||||
nrf_drv_twi_init(&nordic_nrf5_instance[instance],
|
||||
&twi_config,
|
||||
NULL,
|
||||
NULL);
|
||||
nrfx_twi_init(&nordic_nrf5_instance[instance],
|
||||
&twi_config,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
/* Enable peripheral. */
|
||||
|
|
|
@ -39,10 +39,8 @@
|
|||
#if DEVICE_PWMOUT
|
||||
|
||||
#include "hal/pwmout_api.h"
|
||||
|
||||
#include "pinmap_ex.h"
|
||||
#include "nrf_drv_pwm.h"
|
||||
#include "PeripheralPins.h"
|
||||
#include "nrfx_pwm.h"
|
||||
|
||||
#if 0
|
||||
#define DEBUG_PRINTF(...) do { printf(__VA_ARGS__); } while(0)
|
||||
|
@ -62,7 +60,7 @@
|
|||
#define SEQ_POLARITY_BIT (0x8000)
|
||||
|
||||
/* Allocate PWM instances. */
|
||||
static nrf_drv_pwm_t nordic_nrf5_pwm_instance[] = {
|
||||
static nrfx_pwm_t nordic_nrf5_pwm_instance[] = {
|
||||
#if PWM0_ENABLED
|
||||
NRF_DRV_PWM_INSTANCE(0),
|
||||
#endif
|
||||
|
@ -87,12 +85,12 @@ static void nordic_pwm_init(pwmout_t *obj)
|
|||
* 1 pin per instance, otherwise they would share base count.
|
||||
* 1 MHz clock source to match the 1 us resolution.
|
||||
*/
|
||||
nrf_drv_pwm_config_t config = {
|
||||
nrfx_pwm_config_t config = {
|
||||
.output_pins = {
|
||||
obj->pin,
|
||||
NRF_DRV_PWM_PIN_NOT_USED,
|
||||
NRF_DRV_PWM_PIN_NOT_USED,
|
||||
NRF_DRV_PWM_PIN_NOT_USED,
|
||||
NRFX_PWM_PIN_NOT_USED,
|
||||
NRFX_PWM_PIN_NOT_USED,
|
||||
NRFX_PWM_PIN_NOT_USED,
|
||||
},
|
||||
.irq_priority = PWM_DEFAULT_CONFIG_IRQ_PRIORITY,
|
||||
.base_clock = NRF_PWM_CLK_1MHz,
|
||||
|
@ -102,12 +100,15 @@ static void nordic_pwm_init(pwmout_t *obj)
|
|||
.step_mode = NRF_PWM_STEP_AUTO,
|
||||
};
|
||||
|
||||
/* Initialize instance with new configuration. */
|
||||
ret_code_t result = nrf_drv_pwm_init(&nordic_nrf5_pwm_instance[obj->instance],
|
||||
&config,
|
||||
NULL);
|
||||
/* Make sure PWM instance is not running before making changes. */
|
||||
nrfx_pwm_uninit(&nordic_nrf5_pwm_instance[obj->instance]);
|
||||
|
||||
MBED_ASSERT(result == NRF_SUCCESS);
|
||||
/* Initialize instance with new configuration. */
|
||||
ret_code_t result = nrfx_pwm_init(&nordic_nrf5_pwm_instance[obj->instance],
|
||||
&config,
|
||||
NULL);
|
||||
|
||||
MBED_ASSERT(result == NRFX_SUCCESS);
|
||||
}
|
||||
|
||||
/* Helper function for reinitializing the PWM instance and setting the duty-cycle. */
|
||||
|
@ -122,12 +123,12 @@ static void nordic_pwm_restart(pwmout_t *obj)
|
|||
nordic_pwm_init(obj);
|
||||
|
||||
/* Set duty-cycle from object. */
|
||||
ret_code_t result = nrf_drv_pwm_simple_playback(&nordic_nrf5_pwm_instance[obj->instance],
|
||||
&obj->sequence,
|
||||
1,
|
||||
NRF_DRV_PWM_FLAG_LOOP);
|
||||
ret_code_t result = nrfx_pwm_simple_playback(&nordic_nrf5_pwm_instance[obj->instance],
|
||||
&obj->sequence,
|
||||
1,
|
||||
NRFX_PWM_FLAG_LOOP);
|
||||
|
||||
MBED_ASSERT(result == NRF_SUCCESS);
|
||||
MBED_ASSERT(result == NRFX_SUCCESS);
|
||||
}
|
||||
|
||||
/** Initialize the pwm out peripheral and configure the pin
|
||||
|
@ -144,7 +145,7 @@ void pwmout_init(pwmout_t *obj, PinName pin)
|
|||
/* Get hardware instance from pinmap. */
|
||||
int instance = pin_instance_pwm(pin);
|
||||
|
||||
MBED_ASSERT(instance < (int) (sizeof(nordic_nrf5_pwm_instance) / sizeof(nrf_drv_pwm_t)));
|
||||
MBED_ASSERT(instance < (int)(sizeof(nordic_nrf5_pwm_instance) / sizeof(nrfx_pwm_t)));
|
||||
|
||||
/* Populate PWM object with default values. */
|
||||
obj->instance = instance;
|
||||
|
@ -175,7 +176,7 @@ void pwmout_free(pwmout_t *obj)
|
|||
MBED_ASSERT(obj);
|
||||
|
||||
/* Uninitialize PWM instance. */
|
||||
nrf_drv_pwm_uninit(&nordic_nrf5_pwm_instance[obj->instance]);
|
||||
nrfx_pwm_uninit(&nordic_nrf5_pwm_instance[obj->instance]);
|
||||
}
|
||||
|
||||
/** Set the output duty-cycle in range <0.0f, 1.0f>
|
||||
|
@ -201,12 +202,12 @@ void pwmout_write(pwmout_t *obj, float percent)
|
|||
obj->percent = percent;
|
||||
|
||||
/* Set new duty-cycle. */
|
||||
ret_code_t result = nrf_drv_pwm_simple_playback(&nordic_nrf5_pwm_instance[obj->instance],
|
||||
&obj->sequence,
|
||||
1,
|
||||
NRF_DRV_PWM_FLAG_LOOP);
|
||||
ret_code_t result = nrfx_pwm_simple_playback(&nordic_nrf5_pwm_instance[obj->instance],
|
||||
&obj->sequence,
|
||||
1,
|
||||
NRFX_PWM_FLAG_LOOP);
|
||||
|
||||
MBED_ASSERT(result == NRF_SUCCESS);
|
||||
MBED_ASSERT(result == NRFX_SUCCESS);
|
||||
}
|
||||
|
||||
/** Read the current float-point output duty-cycle
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "pinmap_ex.h"
|
||||
#include "PeripheralPins.h"
|
||||
|
||||
#include "nrf_drv_spi.h"
|
||||
#include "nrfx_spi.h"
|
||||
|
||||
/* Pre-allocate instances and share them globally. */
|
||||
static const nrf_drv_spi_t nordic_nrf5_spi_instance[3] = {
|
||||
|
@ -105,13 +105,13 @@ static void spi_configure_driver_instance(spi_t *obj)
|
|||
#if DEVICE_SPI_ASYNCH
|
||||
/* Set callback handler in asynchronous mode. */
|
||||
if (spi_inst->handler) {
|
||||
nrf_drv_spi_init(&nordic_nrf5_spi_instance[instance], &(spi_inst->config), nordic_nrf5_spi_event_handler, obj);
|
||||
nrfx_spi_init(&nordic_nrf5_spi_instance[instance], &(spi_inst->config), nordic_nrf5_spi_event_handler, obj);
|
||||
} else {
|
||||
nrf_drv_spi_init(&nordic_nrf5_spi_instance[instance], &(spi_inst->config), NULL, NULL);
|
||||
nrfx_spi_init(&nordic_nrf5_spi_instance[instance], &(spi_inst->config), NULL, NULL);
|
||||
}
|
||||
#else
|
||||
/* Set callback handler to NULL in synchronous mode. */
|
||||
nrf_drv_spi_init(&nordic_nrf5_spi_instance[instance], &(spi_inst->config), NULL, NULL);
|
||||
nrfx_spi_init(&nordic_nrf5_spi_instance[instance], &(spi_inst->config), NULL, NULL);
|
||||
#endif
|
||||
|
||||
/* Mark instance as initialized. */
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
*
|
||||
*/
|
||||
#include "ble_radio_notification.h"
|
||||
#include "nrf_nvic.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, 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.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NRF_DRV_PWM_H__
|
||||
#define NRF_DRV_PWM_H__
|
||||
|
||||
#include <nrfx_pwm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup nrf_drv_pwm PWM driver - legacy layer
|
||||
* @{
|
||||
* @ingroup nrf_pwm
|
||||
*
|
||||
* @brief @tagAPI52 Layer providing compatibility with the former API.
|
||||
*/
|
||||
|
||||
/** @brief Type definition for forwarding the new implementation. */
|
||||
typedef nrfx_pwm_t nrf_drv_pwm_t;
|
||||
/** @brief Type definition for forwarding the new implementation. */
|
||||
typedef nrfx_pwm_config_t nrf_drv_pwm_config_t;
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_INSTANCE NRFX_PWM_INSTANCE
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_PIN_NOT_USED NRFX_PWM_PIN_NOT_USED
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_PIN_INVERTED NRFX_PWM_PIN_INVERTED
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_DEFAULT_CONFIG NRFX_PWM_DEFAULT_CONFIG
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_FLAG_STOP NRFX_PWM_FLAG_STOP
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_FLAG_LOOP NRFX_PWM_FLAG_LOOP
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ0 NRFX_PWM_FLAG_SIGNAL_END_SEQ0
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ1 NRFX_PWM_FLAG_SIGNAL_END_SEQ1
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_FLAG_NO_EVT_FINISHED NRFX_PWM_FLAG_NO_EVT_FINISHED
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_FLAG_START_VIA_TASK NRFX_PWM_FLAG_START_VIA_TASK
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_flag_t nrfx_pwm_flag_t
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_EVT_FINISHED NRFX_PWM_EVT_FINISHED
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_EVT_END_SEQ0 NRFX_PWM_EVT_END_SEQ0
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_EVT_END_SEQ1 NRFX_PWM_EVT_END_SEQ1
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_PWM_EVT_STOPPED NRFX_PWM_EVT_STOPPED
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_evt_type_t nrfx_pwm_evt_type_t
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_handler_t nrfx_pwm_handler_t
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_init nrfx_pwm_init
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_uninit nrfx_pwm_uninit
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_simple_playback nrfx_pwm_simple_playback
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_complex_playback nrfx_pwm_complex_playback
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_step nrfx_pwm_step
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_stop nrfx_pwm_stop
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_is_stopped nrfx_pwm_is_stopped
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_sequence_update nrfx_pwm_sequence_update
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_sequence_values_update nrfx_pwm_sequence_values_update
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_sequence_length_update nrfx_pwm_sequence_length_update
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_sequence_repeats_update nrfx_pwm_sequence_repeats_update
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_sequence_end_delay_update nrfx_pwm_sequence_end_delay_update
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_task_address_get nrfx_pwm_task_address_get
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_pwm_event_address_get nrfx_pwm_event_address_get
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRF_DRV_PWM_H__
|
|
@ -1,143 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, 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.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NRF_DRV_SAADC_H__
|
||||
#define NRF_DRV_SAADC_H__
|
||||
|
||||
#include <nrfx_saadc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup nrf_drv_saadc SAADC driver - legacy layer
|
||||
* @{
|
||||
* @ingroup nrf_saadc
|
||||
*
|
||||
* @brief @tagAPI52 Layer providing compatibility with the former API.
|
||||
*/
|
||||
|
||||
/** @brief Type definition for forwarding the new implementation. */
|
||||
typedef nrfx_saadc_config_t nrf_drv_saadc_config_t;
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_EVT_DONE NRFX_SAADC_EVT_DONE
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_EVT_LIMIT NRFX_SAADC_EVT_LIMIT
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_EVT_CALIBRATEDONE NRFX_SAADC_EVT_CALIBRATEDONE
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_evt_type_t nrfx_saadc_evt_type_t
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_done_evt_t nrfx_saadc_done_evt_t
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_limit_evt_t nrfx_saadc_limit_evt_t
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_evt_t nrfx_saadc_evt_t
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_event_handler_t nrfx_saadc_event_handler_t
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_LIMITH_DISABLED NRFX_SAADC_LIMITH_DISABLED
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_LIMITL_DISABLED NRFX_SAADC_LIMITL_DISABLED
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_DEFAULT_CONFIG NRFX_SAADC_DEFAULT_CONFIG
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE \
|
||||
NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL \
|
||||
NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_uninit nrfx_saadc_uninit
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_channel_init nrfx_saadc_channel_init
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_channel_uninit nrfx_saadc_channel_uninit
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_sample nrfx_saadc_sample
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_sample_convert nrfx_saadc_sample_convert
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_buffer_convert nrfx_saadc_buffer_convert
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_calibrate_offset nrfx_saadc_calibrate_offset
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_is_busy nrfx_saadc_is_busy
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_abort nrfx_saadc_abort
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_limits_set nrfx_saadc_limits_set
|
||||
|
||||
/** @brief Macro for forwarding the new implementation. */
|
||||
#define nrf_drv_saadc_sample_task_get nrfx_saadc_sample_task_get
|
||||
|
||||
/**
|
||||
* @brief Function for initializing the SAADC.
|
||||
*
|
||||
* @param[in] p_config Pointer to the structure with initial configuration.
|
||||
* If NULL, the default one is used.
|
||||
* @param[in] event_handler Event handler provided by the user.
|
||||
*
|
||||
* @retval NRF_SUCCESS If initialization was successful.
|
||||
* @retval NRF_ERROR_INVALID_STATE If the driver is already initialized.
|
||||
* @retval NRF_ERROR_INVALID_PARAM If event_handler is NULL.
|
||||
*/
|
||||
__STATIC_INLINE ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config,
|
||||
nrf_drv_saadc_event_handler_t event_handler)
|
||||
{
|
||||
if (p_config == NULL)
|
||||
{
|
||||
static const nrfx_saadc_config_t default_config = NRFX_SAADC_DEFAULT_CONFIG;
|
||||
p_config = &default_config;
|
||||
}
|
||||
return nrfx_saadc_init(p_config, event_handler);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRF_DRV_SAADC_H__
|
|
@ -54,7 +54,7 @@ extern "C" {
|
|||
* the needs of the host environment into which @em nrfx is integrated.
|
||||
*/
|
||||
|
||||
#include <legacy/apply_old_config.h>
|
||||
//#include <legacy/apply_old_config.h>
|
||||
#include <soc/nrfx_irqs.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
@ -664,12 +664,14 @@ void nrfx_spim_0_irq_handler(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if NRFX_CHECK(NRFX_SPIM1_ENABLED)
|
||||
void nrfx_spim_1_irq_handler(void)
|
||||
{
|
||||
irq_handler(NRF_SPIM1, &m_cb[NRFX_SPIM1_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIM2_ENABLED)
|
||||
void nrfx_spim_2_irq_handler(void)
|
||||
|
|
|
@ -706,18 +706,22 @@ static void twi_irq_handler(NRF_TWI_Type * p_twi, twi_control_block_t * p_cb)
|
|||
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if NRFX_CHECK(NRFX_TWI0_ENABLED)
|
||||
void nrfx_twi_0_irq_handler(void)
|
||||
{
|
||||
twi_irq_handler(NRF_TWI0, &m_cb[NRFX_TWI0_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if NRFX_CHECK(NRFX_TWI1_ENABLED)
|
||||
void nrfx_twi_1_irq_handler(void)
|
||||
{
|
||||
twi_irq_handler(NRF_TWI1, &m_cb[NRFX_TWI1_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // NRFX_CHECK(NRFX_TWI_ENABLED)
|
||||
|
|
|
@ -647,18 +647,22 @@ static void twim_irq_handler(NRF_TWIM_Type * p_twim, twim_control_block_t * p_cb
|
|||
p_cb->handler(&event, p_cb->p_context);
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if NRFX_CHECK(NRFX_TWIM0_ENABLED)
|
||||
void nrfx_twim_0_irq_handler(void)
|
||||
{
|
||||
twim_irq_handler(NRF_TWIM0, &m_cb[NRFX_TWIM0_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if NRFX_CHECK(NRFX_TWIM1_ENABLED)
|
||||
void nrfx_twim_1_irq_handler(void)
|
||||
{
|
||||
twim_irq_handler(NRF_TWIM1, &m_cb[NRFX_TWIM1_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // NRFX_CHECK(NRFX_TWIM_ENABLED)
|
||||
|
|
|
@ -5012,6 +5012,7 @@
|
|||
"PORTINOUT",
|
||||
"PORTOUT",
|
||||
"PWMOUT",
|
||||
"RTC",
|
||||
"SERIAL",
|
||||
"SERIAL_ASYNCH",
|
||||
"SERIAL_FC",
|
||||
|
|
Loading…
Reference in New Issue