~aleteoryx/muditaos

ref: 7394811560cb4281018dbf20ba66585791191b85 muditaos/module-bsp/board/rt1051/bsp/lpm/RT1051LPM.hpp -rw-r--r-- 1.3 KiB
73948115 — Maciej Gibowicz [EGD-4809] Add LDO switching 4 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
34
35
36
37
38
39
40
41
42
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#ifndef PUREPHONE_RT1051LPM_HPP
#define PUREPHONE_RT1051LPM_HPP

#include "bsp/lpm/bsp_lpm.hpp"
#include "drivers/gpio/DriverGPIO.hpp"
#include "CpuFreqLPM.hpp"

namespace bsp
{
    class RT1051LPM : public LowPowerMode
    {
      public:
        RT1051LPM();
        int32_t PowerOff() override final;
        int32_t Reboot(RebootType reason) override final;
        void SetCpuFrequency(CpuFrequencyHz freq) final;
        void SetHighestCoreVoltage() final;
        [[nodiscard]] uint32_t GetCpuFrequency() const noexcept final;
        void SwitchOscillatorSource(OscillatorSource source) final;
        void SetBootSuccess() override;

        void EnableDcdcPowerSaveMode() final;
        void DisableDcdcPowerSaveMode() final;

        void DisconnectInternalLoadResistor() final;
        void ConnectInternalLoadResistor() final;

        void SwitchToRegularModeLDO() final;
        void SwitchToLowPowerModeLDO() final;

      private:
        std::shared_ptr<drivers::DriverGPIO> gpio_1;
        std::shared_ptr<drivers::DriverGPIO> gpio_2;
        std::unique_ptr<bsp::CpuFreqLPM> CpuFreq;
    };

} // namespace bsp

#endif // PUREPHONE_RT1051LPM_HPP