~aleteoryx/muditaos

ref: 90b02520600fc34f094dfd1b51bc426b4060aef8 muditaos/module-bsp/board/rt1051/bellpx/brownout.cpp -rw-r--r-- 1.1 KiB
90b02520 — Dawid Wojtas [BH-1708] Fix buttons behavior 2 years ago
                                                                                
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
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <cstdint>
#include <fsl_common.h>
#include <fsl_pmu.h>

namespace bsp
{
    namespace
    {
        constexpr std::uint32_t OutputVoltage1P1 = 0x19; // 1.275V
        constexpr std::uint32_t OutputVoltage2P5 = 0x1F; // 2.875V

        constexpr std::uint32_t OffsetVoltage1P1 = 0x05; // 5*25mv
        constexpr std::uint32_t OffsetVoltage2P5 = 0x03; // 3*25mv
    }                                                    // namespace

    void Brownout_init()
    {
        // Config LDO Regulatorsand config Brownout voltage offsets
        PMU_1P1EnableBrownout(PMU, true);
        PMU_1P1SetRegulatorOutputVoltage(PMU, OutputVoltage1P1);
        PMU_1P1SetBrownoutOffsetVoltage(PMU, OffsetVoltage1P1);
        PMU_1P1EnableOutput(PMU, true);

        PMU_2P5nableBrownout(PMU, true);
        PMU_2P5SetRegulatorOutputVoltage(PMU, OutputVoltage2P5);
        PMU_2P5SetBrownoutOffsetVoltage(PMU, OffsetVoltage2P5);
        PMU_2P5EnableOutput(PMU, true);
    }

} // namespace bsp