summaryrefslogtreecommitdiffstats
path: root/ledlayout.hpp
blob: 90b333ce9076f340252291cbd1bbd3ee7e226cd6 (plain)
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
51
52
53
54
55
56
57
#pragma once

#include <map>
#include <set>

namespace phosphor
{
namespace led
{
/** @namespace Layout
 *  @brief Depicts the LED and their mappings and group actions
 */
namespace Layout
{
/** @brief Define possible actions on a given LED.
 *  For the BLINK operation, follow 50-50 duty cycle
 */
enum Action
{
    Off,
    On,
    Blink,
};

/** @brief Name of the LED and it's proposed action.
 *  This structure is supplied as configuration at build time
 */
struct LedAction
{
    std::string name;
    Action action;
    uint8_t dutyOn;
    uint16_t period;
    Action priority;

    // Order LEDs such that same LEDs are grouped next to
    // each other and the same LEDs are in priority order
    // with the highest priority coming first
    bool operator<(const LedAction& right) const
    {
        if (name == right.name)
        {
            if (action == right.action)
            {
                return false;
            }
            else if (action == priority)
            {
                return true;
            }
        }
        return name < right.name;
    }
};
} // namespace Layout
} // namespace led
} // namespace phosphor
OpenPOWER on IntegriCloud