Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
base-inl.hpp
1 /*
2  Title --- keypad/base-inl.hpp
3 
4  Copyright (C) 2013 Giacomo Trudu - wicker25[at]gmail[dot]com
5 
6  This file is part of Rpi-hw.
7 
8  Rpi-hw is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation version 3 of the License.
11 
12  Rpi-hw is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with Rpi-hw. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef _RPI_HW_KEYPAD_BASE_INL_HPP_
23 #define _RPI_HW_KEYPAD_BASE_INL_HPP_
24 
25 namespace rpihw { // Begin main namespace
26 
27 namespace keypad { // Begin keypads namespace
28 
29 inline void
31 
32  // Set the keypad event listener
33  m_event_listener = listener;
34 }
35 
36 inline void
37 base::setRefreshRate( float frequency ) {
38 
39  // Set the frequency with which buttons are read
40  m_frequency = frequency;
41 }
42 
43 inline float
45 
46  // Returns the frequency with which buttons are read
47  return m_frequency;
48 }
49 
50 inline const std::vector< bool > &
51 base::state() const {
52 
53  // Return the list of button states
54  return m_keystate;
55 }
56 
57 inline size_t
58 base::numOfKeys() const {
59 
60  // Return the number of keys
61  return m_nkeys;
62 }
63 
64 } // End of keypads namespace
65 
66 } // End of main namespace
67 
68 #endif /* _RPI_HW_KEYPAD_BASE_INL_HPP_ */
virtual size_t numOfKeys() const
Returns the number of keys.
Definition: base-inl.hpp:58
virtual void addEventListener(T_EventListener listener)
Sets the keypad event listener.
Definition: base-inl.hpp:30
std::function< void(keypad::base &) > T_EventListener
The type of the keypad event listener.
Definition: base.hpp:50
virtual const std::vector< bool > & state() const
Returns the list of button states.
Definition: base-inl.hpp:51
size_t m_nkeys
Number of the keys.
Definition: base.hpp:174
virtual float getRefreshRate() const
Returns the frequency with which buttons are read.
Definition: base-inl.hpp:44
float m_frequency
The refresh rate.
Definition: base.hpp:192
T_EventListener m_event_listener
The keypad event listener.
Definition: base.hpp:201
virtual void setRefreshRate(float frequency)
Sets the frequency with which buttons are read.
Definition: base-inl.hpp:37
std::vector< bool > m_keystate
Button states (0 = up, 1 = down).
Definition: base.hpp:183