2018-05-24 11:35:24 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Freie Universität Berlin
|
2020-03-07 17:04:06 +01:00
|
|
|
* Copyright (C) 2020 Inria
|
|
|
|
* Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
|
2018-05-24 11:35:24 +02:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup cpu_nrf5x_common
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief nrfx compatibility layer
|
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
2020-03-07 17:04:06 +01:00
|
|
|
* @author Koen Zandberg <koen@bergzand.net>
|
2018-05-24 11:35:24 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NRFX_H
|
|
|
|
#define NRFX_H
|
|
|
|
|
|
|
|
#include "cpu_conf.h"
|
2020-03-07 17:04:06 +01:00
|
|
|
#include "periph_conf.h"
|
2018-05-24 11:35:24 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-03-07 17:04:06 +01:00
|
|
|
/**
|
|
|
|
* @brief Enable the internal DC/DC power converter for the NRF5x MCU.
|
|
|
|
*
|
|
|
|
* The internal DC/DC converter is more efficient compared to the LDO regulator.
|
|
|
|
* The downside of the DC/DC converter is that it requires an external inductor
|
|
|
|
* to be present on the board. Enabling the DC/DC converter is guarded with
|
|
|
|
* NRF5X_ENABLE_DCDC, this macro must be defined if the DC/DC converter is to be
|
|
|
|
* enabled.
|
|
|
|
*/
|
|
|
|
static inline void nrfx_dcdc_init(void)
|
|
|
|
{
|
|
|
|
#ifdef NRF5X_ENABLE_DCDC
|
|
|
|
NRF_POWER->DCDCEN = 1;
|
2021-01-20 12:41:32 +01:00
|
|
|
|
|
|
|
/* on CPUs that support high voltage power supply via VDDH and thus use a
|
|
|
|
* two stage regulator, we also enable the DC/DC converter for the first
|
|
|
|
* state. */
|
2021-02-14 00:06:34 +01:00
|
|
|
#ifdef POWER_DCDCEN0_DCDCEN_Msk
|
2021-01-20 12:41:32 +01:00
|
|
|
if (NRF_POWER->MAINREGSTATUS == POWER_MAINREGSTATUS_MAINREGSTATUS_High) {
|
|
|
|
NRF_POWER->DCDCEN0 = 1;
|
|
|
|
}
|
|
|
|
#endif
|
2020-03-07 17:04:06 +01:00
|
|
|
#endif
|
|
|
|
}
|
2018-05-24 11:35:24 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* NRFX_H */
|
|
|
|
/** @} */
|