summaryrefslogtreecommitdiffstats
path: root/ledlayout.hpp
blob: 998feb5f8d5da52a38726ecd32a6e81bdd1f590d (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
#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;

        // Needed for inserting elements into sets
        bool operator<(const LedAction& right) const
        {
            if (name == right.name)
            {
                return action < right.action;
            }
            return name < right.name;
        }
    };
} // namespace Layout
} // namespace led
} // namespace phosphor
OpenPOWER on IntegriCloud