~aleteoryx/muditaos

ref: ff18f17e525114f527be6bfc1caa166dad1942dc muditaos/module-bsp/bsp/lpm/bsp_lpm.cpp -rw-r--r-- 811 bytes
ff18f17e — Dawid Wojtas [BH-1700] Add date and time to logs at the startup 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
34
35
36
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "bsp_lpm.hpp"


#if defined(TARGET_RT1051)
#include <bsp/lpm/RT1051LPM.hpp>
#elif defined(TARGET_Linux)
#include "board/linux/lpm/LinuxLPM.h"
#else
#error "Unsupported target"
#endif

namespace bsp{

    std::optional<std::unique_ptr<LowPowerMode>> LowPowerMode::Create() {

        std::unique_ptr<LowPowerMode> inst;

#if defined(TARGET_RT1051)
        inst = std::make_unique<bsp::RT1051LPM>();
#elif defined(TARGET_Linux)
        inst = std::make_unique<bsp::LinuxLPM>();
#else
#error "Unsupported target"
#endif

        return inst;
    }

    CpuFrequencyMHz LowPowerMode::GetCurrentFrequencyLevel() const noexcept
    {
    	return currentFrequency;
    }
}