~aleteoryx/muditaos

ref: 356114dc9a152d590f1fee2fa075fa407f71c3b8 muditaos/module-sys/SystemManager/PowerManager.hpp -rw-r--r-- 889 bytes
356114dc — Roman Kubiak [EGD-4037] fix phone hardfault when the OS that (#1088) 5 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
43
44
45
46
47
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#ifndef PUREPHONE_POWERMANAGER_HPP
#define PUREPHONE_POWERMANAGER_HPP

#include <functional>

#include "bsp/lpm/bsp_lpm.hpp"

namespace sys
{

    class PowerManager
    {

      public:
        enum class Mode
        {
            FullSpeed,
            LowPowerRun,
            LowPowerIdle,
            Suspend

        };

        PowerManager();
        ~PowerManager();

        int32_t Switch(const Mode mode);
        int32_t PowerOff();
        int32_t Reboot();

        Mode GetCurrentMode()
        {
            return currentPowerMode;
        }

      private:
        std::unique_ptr<bsp::LowPowerMode> lowPowerControl;

        Mode currentPowerMode = Mode ::FullSpeed;
    };

} // namespace sys

#endif // PUREPHONE_POWERMANAGER_HPP