nrfx_riot.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Freie Universität Berlin
3  * SPDX-FileCopyrightText: 2020 Inria
4  * SPDX-FileCopyrightText: 2020 Koen Zandberg <koen@bergzand.net>
5  * SPDX-License-Identifier: LGPL-2.1-only
6  */
7 
8 #pragma once
9 
21 #include "kernel_defines.h"
22 #include "cpu_conf.h"
23 #include "periph_conf.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
41 static inline void nrfx_dcdc_init(void)
42 {
43  if (IS_ACTIVE(MODULE_VDD_LC_FILTER_REG1)) {
44  NRF_POWER->DCDCEN = 1;
45  }
46 
47 #ifdef POWER_DCDCEN0_DCDCEN_Msk
48  /* on CPUs that support high voltage power supply via VDDH and thus use a
49  * two stage regulator, we also try to enable the DC/DC converter for the
50  * first stage */
51  if (IS_ACTIVE(MODULE_VDD_LC_FILTER_REG0) &&
52  (NRF_POWER->MAINREGSTATUS == POWER_MAINREGSTATUS_MAINREGSTATUS_High)) {
53  NRF_POWER->DCDCEN0 = 1;
54  }
55 #endif
56 }
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
Common macros and compiler attributes/pragmas configuration.
#define IS_ACTIVE(macro)
Allows to verify a macro definition outside the preprocessor.
Definition: modules.h:59
static void nrfx_dcdc_init(void)
Enable the internal DC/DC power converter for the NRF5x MCU.
Definition: nrfx_riot.h:41