distortos  v0.6.0
object-oriented C++ RTOS for microcontrollers
buttons.hpp
Go to the documentation of this file.
1 
15 #ifndef SOURCE_BOARD_ST_STM32F4DISCOVERY_INCLUDE_DISTORTOS_BOARD_BUTTONS_HPP_
16 #define SOURCE_BOARD_ST_STM32F4DISCOVERY_INCLUDE_DISTORTOS_BOARD_BUTTONS_HPP_
17 
19 
20 #include <cstddef>
21 
22 #ifdef CONFIG_BOARD_BUTTONS_B1_ENABLE
23 #define DISTORTOS_BOARD_BUTTONS_B1_ENABLED 1
24 #else // !def CONFIG_BOARD_BUTTONS_B1_ENABLE
25 #define DISTORTOS_BOARD_BUTTONS_B1_ENABLED 0
26 #endif // !def CONFIG_BOARD_BUTTONS_B1_ENABLE
27 
29 #define DISTORTOS_BOARD_BUTTONS_COUNT (DISTORTOS_BOARD_BUTTONS_B1_ENABLED)
30 
31 #if defined(CONFIG_BOARD_BUTTONS_ENABLE) && DISTORTOS_BOARD_BUTTONS_COUNT != 0
32 
33 namespace distortos
34 {
35 
36 namespace chip
37 {
38 
39 class ChipInputPin;
40 
41 } // namespace chip
42 
43 namespace board
44 {
45 
48 
49 /*---------------------------------------------------------------------------------------------------------------------+
50 | indexes of buttons
51 +---------------------------------------------------------------------------------------------------------------------*/
52 
53 enum
54 {
55 #ifdef CONFIG_BOARD_BUTTONS_B1_ENABLE
58 #endif // def CONFIG_BOARD_BUTTONS_B1_ENABLE
59 };
60 
61 /*---------------------------------------------------------------------------------------------------------------------+
62 | alternative indexes of buttons
63 +---------------------------------------------------------------------------------------------------------------------*/
64 
65 #ifdef CONFIG_BOARD_BUTTONS_B1_ENABLE
66 
68 constexpr size_t buttonsUserIndex {buttonsB1Index};
69 
70 #endif // def CONFIG_BOARD_BUTTONS_B1_ENABLE
71 
72 /*---------------------------------------------------------------------------------------------------------------------+
73 | indexed access to buttons objects
74 +---------------------------------------------------------------------------------------------------------------------*/
75 
78 
79 } // namespace board
80 
81 } // namespace distortos
82 
83 #endif // defined(CONFIG_BOARD_BUTTONS_ENABLE) && DISTORTOS_BOARD_BUTTONS_COUNT != 0
84 
85 #endif // SOURCE_BOARD_ST_STM32F4DISCOVERY_INCLUDE_DISTORTOS_BOARD_BUTTONS_HPP_
constexpr size_t buttonsUserIndex
alternative index of B1 (User) from buttons
Definition: buttons.hpp:68
const chip::ChipInputPin buttons[buttonsCount]
array with all buttons objects
Definition: ST_STM32F4DISCOVERY-buttons.cpp:32
#define DISTORTOS_BOARD_BUTTONS_COUNT
count of buttons on the board
Definition: buttons.hpp:29
index of B1 (User) from buttons
Definition: buttons.hpp:57
distortos configuration
Top-level namespace of distortos project.
Definition: ChipInputPin.hpp:31
constexpr size_t buttonsCount
count of buttons on the board
Definition: buttons.hpp:47