Select one of the symbols to view example projects that use it.
 
Outline
#include "pico.h"
#include "hardware/vreg.h"
vreg_set_voltage(enum vreg_voltage)
vreg_disable_voltage_limit()
Files
loading...
SourceVuRaspberry Pi Pico SDK and ExamplesPicoSDKsrc/rp2_common/hardware_vreg/vreg.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause *//* ... */ #include "pico.h" #include "hardware/vreg.h" void vreg_set_voltage(enum vreg_voltage voltage) { #if PICO_RP2040 hw_write_masked( &vreg_and_chip_reset_hw->vreg, ((uint)voltage) << VREG_AND_CHIP_RESET_VREG_VSEL_LSB, VREG_AND_CHIP_RESET_VREG_VSEL_BITS ); /* ... */ #elif PICO_RP2350 hw_set_bits(&powman_hw->vreg_ctrl, POWMAN_PASSWORD_BITS | POWMAN_VREG_CTRL_UNLOCK_BITS); // Wait for any prior change to finish before making a new change while (powman_hw->vreg & POWMAN_VREG_UPDATE_IN_PROGRESS_BITS) tight_loop_contents(); hw_write_masked( &powman_hw->vreg, POWMAN_PASSWORD_BITS | ((uint)voltage << POWMAN_VREG_VSEL_LSB), POWMAN_PASSWORD_BITS | POWMAN_VREG_VSEL_BITS ); while (powman_hw->vreg & POWMAN_VREG_UPDATE_IN_PROGRESS_BITS) tight_loop_contents(); /* ... */ #else panic_unsupported(); #endif }{ ... } void vreg_disable_voltage_limit(void) { #if PICO_RP2040 // The voltage limit can't be disabled on RP2040 (was implemented by // hardwiring the LDO controls) return;/* ... */ #elif PICO_RP2350 hw_set_bits(&powman_hw->vreg_ctrl, POWMAN_PASSWORD_BITS | POWMAN_VREG_CTRL_DISABLE_VOLTAGE_LIMIT_BITS); #else panic_unsupported(); #endif }{ ... }
Details