nrfx_riot.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Freie Universität Berlin
3  * Copyright (C) 2020 Inria
4  * Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
22 #ifndef NRFX_RIOT_H
23 #define NRFX_RIOT_H
24 
25 #include "kernel_defines.h"
26 #include "cpu_conf.h"
27 #include "periph_conf.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
45 static inline void nrfx_dcdc_init(void)
46 {
47  if (IS_ACTIVE(MODULE_VDD_LC_FILTER_REG1)) {
48  NRF_POWER->DCDCEN = 1;
49  }
50 
51 #ifdef POWER_DCDCEN0_DCDCEN_Msk
52  /* on CPUs that support high voltage power supply via VDDH and thus use a
53  * two stage regulator, we also try to enable the DC/DC converter for the
54  * first stage */
55  if (IS_ACTIVE(MODULE_VDD_LC_FILTER_REG0) &&
56  (NRF_POWER->MAINREGSTATUS == POWER_MAINREGSTATUS_MAINREGSTATUS_High)) {
57  NRF_POWER->DCDCEN0 = 1;
58  }
59 #endif
60 }
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* NRFX_RIOT_H */
Common macros and compiler attributes/pragmas configuration.
#define IS_ACTIVE(macro)
Allows to verify a macro definition outside the preprocessor.
Definition: modules.h:60
static void nrfx_dcdc_init(void)
Enable the internal DC/DC power converter for the NRF5x MCU.
Definition: nrfx_riot.h:45