distortos  v0.6.0
object-oriented C++ RTOS for microcontrollers
leds.hpp
Go to the documentation of this file.
1 
15 #ifndef SOURCE_BOARD_ST_STM32F4DISCOVERY_INCLUDE_DISTORTOS_BOARD_LEDS_HPP_
16 #define SOURCE_BOARD_ST_STM32F4DISCOVERY_INCLUDE_DISTORTOS_BOARD_LEDS_HPP_
17 
19 
20 #include <cstddef>
21 
22 #ifdef CONFIG_BOARD_LEDS_LD3_ENABLE
23 #define DISTORTOS_BOARD_LEDS_LD3_ENABLED 1
24 #else // !def CONFIG_BOARD_LEDS_LD3_ENABLE
25 #define DISTORTOS_BOARD_LEDS_LD3_ENABLED 0
26 #endif // !def CONFIG_BOARD_LEDS_LD3_ENABLE
27 
28 #ifdef CONFIG_BOARD_LEDS_LD4_ENABLE
29 #define DISTORTOS_BOARD_LEDS_LD4_ENABLED 1
30 #else // !def CONFIG_BOARD_LEDS_LD4_ENABLE
31 #define DISTORTOS_BOARD_LEDS_LD4_ENABLED 0
32 #endif // !def CONFIG_BOARD_LEDS_LD4_ENABLE
33 
34 #ifdef CONFIG_BOARD_LEDS_LD5_ENABLE
35 #define DISTORTOS_BOARD_LEDS_LD5_ENABLED 1
36 #else // !def CONFIG_BOARD_LEDS_LD5_ENABLE
37 #define DISTORTOS_BOARD_LEDS_LD5_ENABLED 0
38 #endif // !def CONFIG_BOARD_LEDS_LD5_ENABLE
39 
40 #ifdef CONFIG_BOARD_LEDS_LD6_ENABLE
41 #define DISTORTOS_BOARD_LEDS_LD6_ENABLED 1
42 #else // !def CONFIG_BOARD_LEDS_LD6_ENABLE
43 #define DISTORTOS_BOARD_LEDS_LD6_ENABLED 0
44 #endif // !def CONFIG_BOARD_LEDS_LD6_ENABLE
45 
47 #define DISTORTOS_BOARD_LEDS_COUNT (DISTORTOS_BOARD_LEDS_LD3_ENABLED + \
48  DISTORTOS_BOARD_LEDS_LD4_ENABLED + \
49  DISTORTOS_BOARD_LEDS_LD5_ENABLED + \
50  DISTORTOS_BOARD_LEDS_LD6_ENABLED)
51 
52 #if defined(CONFIG_BOARD_LEDS_ENABLE) && DISTORTOS_BOARD_LEDS_COUNT != 0
53 
54 namespace distortos
55 {
56 
57 namespace chip
58 {
59 
60 class ChipOutputPin;
61 
62 } // namespace chip
63 
64 namespace board
65 {
66 
69 
70 /*---------------------------------------------------------------------------------------------------------------------+
71 | indexes of leds
72 +---------------------------------------------------------------------------------------------------------------------*/
73 
74 enum
75 {
76 #ifdef CONFIG_BOARD_LEDS_LD3_ENABLE
79 #endif // def CONFIG_BOARD_LEDS_LD3_ENABLE
80 #ifdef CONFIG_BOARD_LEDS_LD4_ENABLE
83 #endif // def CONFIG_BOARD_LEDS_LD4_ENABLE
84 #ifdef CONFIG_BOARD_LEDS_LD5_ENABLE
87 #endif // def CONFIG_BOARD_LEDS_LD5_ENABLE
88 #ifdef CONFIG_BOARD_LEDS_LD6_ENABLE
91 #endif // def CONFIG_BOARD_LEDS_LD6_ENABLE
92 };
93 
94 /*---------------------------------------------------------------------------------------------------------------------+
95 | alternative indexes of leds
96 +---------------------------------------------------------------------------------------------------------------------*/
97 
98 #ifdef CONFIG_BOARD_LEDS_LD3_ENABLE
99 
101 constexpr size_t ledsOrangeIndex {ledsLd3Index};
102 
103 #endif // def CONFIG_BOARD_LEDS_LD3_ENABLE
104 
105 #ifdef CONFIG_BOARD_LEDS_LD4_ENABLE
106 
108 constexpr size_t ledsGreenIndex {ledsLd4Index};
109 
110 #endif // def CONFIG_BOARD_LEDS_LD4_ENABLE
111 
112 #ifdef CONFIG_BOARD_LEDS_LD5_ENABLE
113 
115 constexpr size_t ledsRedIndex {ledsLd5Index};
116 
117 #endif // def CONFIG_BOARD_LEDS_LD5_ENABLE
118 
119 #ifdef CONFIG_BOARD_LEDS_LD6_ENABLE
120 
122 constexpr size_t ledsBlueIndex {ledsLd6Index};
123 
124 #endif // def CONFIG_BOARD_LEDS_LD6_ENABLE
125 
126 /*---------------------------------------------------------------------------------------------------------------------+
127 | indexed access to leds objects
128 +---------------------------------------------------------------------------------------------------------------------*/
129 
132 
133 } // namespace board
134 
135 } // namespace distortos
136 
137 #endif // defined(CONFIG_BOARD_LEDS_ENABLE) && DISTORTOS_BOARD_LEDS_COUNT != 0
138 
139 #endif // SOURCE_BOARD_ST_STM32F4DISCOVERY_INCLUDE_DISTORTOS_BOARD_LEDS_HPP_
index of Ld3 (Orange) from leds
Definition: leds.hpp:78
constexpr size_t ledsRedIndex
alternative index of Ld5 (Red) from leds
Definition: leds.hpp:115
chip::ChipOutputPin leds[ledsCount]
array with all leds objects
Definition: ST_STM32F4DISCOVERY-leds.cpp:32
#define DISTORTOS_BOARD_LEDS_COUNT
count of leds on the board
Definition: leds.hpp:47
Definition: ChipOutputPin.hpp:31
distortos configuration
index of Ld6 (Blue) from leds
Definition: leds.hpp:90
index of Ld4 (Green) from leds
Definition: leds.hpp:82
constexpr size_t ledsOrangeIndex
alternative index of Ld3 (Orange) from leds
Definition: leds.hpp:101
Top-level namespace of distortos project.
constexpr size_t ledsCount
count of leds on the board
Definition: leds.hpp:68
constexpr size_t ledsGreenIndex
alternative index of Ld4 (Green) from leds
Definition: leds.hpp:108
index of Ld5 (Red) from leds
Definition: leds.hpp:86
constexpr size_t ledsBlueIndex
alternative index of Ld6 (Blue) from leds
Definition: leds.hpp:122