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 
11 #pragma once
12 
24 #include "kernel_defines.h"
25 #include "cpu_conf.h"
26 #include "periph_conf.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
44 static inline void nrfx_dcdc_init(void)
45 {
46  if (IS_ACTIVE(MODULE_VDD_LC_FILTER_REG1)) {
47  NRF_POWER->DCDCEN = 1;
48  }
49 
50 #ifdef POWER_DCDCEN0_DCDCEN_Msk
51  /* on CPUs that support high voltage power supply via VDDH and thus use a
52  * two stage regulator, we also try to enable the DC/DC converter for the
53  * first stage */
54  if (IS_ACTIVE(MODULE_VDD_LC_FILTER_REG0) &&
55  (NRF_POWER->MAINREGSTATUS == POWER_MAINREGSTATUS_MAINREGSTATUS_High)) {
56  NRF_POWER->DCDCEN0 = 1;
57  }
58 #endif
59 }
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
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:44