Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
shift-out.hpp
1 /*
2  Title --- iface/shift-out.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_IFACE_SHIFT_OUT_HPP_
23 #define _RPI_HW_IFACE_SHIFT_OUT_HPP_
24 
25 #include <rpi-hw/types.hpp>
26 #include <rpi-hw/exception.hpp>
27 #include <rpi-hw/math.hpp>
28 #include <rpi-hw/utils.hpp>
29 
30 #include <rpi-hw/iface/base.hpp>
31 #include <rpi-hw/iface/shift-base.hpp>
32 
33 namespace rpihw { // Begin main namespace
34 
35 namespace iface { // Begin interfaces namespace
36 
37 /*!
38  @class shiftOut
39  @brief Shift-out interface.
40 */
41 class shiftOut : public shiftBase {
42 
43 public:
44 
45  /*!
46  @brief Constructor method.
47  @param[in] data_pin The data pin.
48  @param[in] clock_pin The clock pin.
49  @param[in] order The bit order.
50  @param[in] delay The delay time of the clock.
51  */
52  shiftOut( uint8_t data_pin, uint8_t clock_pin, BitOrder order, size_t delay = 0 );
53 
54  //! Destructor method.
55  virtual ~shiftOut();
56 
57  /*!
58  @brief Sets an output pin.
59  @param[in] index The index position of the output pin.
60  @param[in] pin The new GPIO pin.
61  */
62  virtual void setPin( uint8_t index, uint8_t pin );
63 
64  /*!
65  @brief Writes a data on the interface.
66  @param[in] data The data to be written.
67  */
68  virtual void write( uint8_t data );
69 };
70 
71 } // End of interfaces namespace
72 
73 } // End of main namespace
74 
75 
76 // Include inline methods
77 #include <rpi-hw/iface/shift-out-inl.hpp>
78 
79 #endif /* _RPI_HW_IFACE_SHIFT_OUT_HPP_ */
virtual void setPin(uint8_t index, uint8_t pin)
Sets an output pin.
shiftOut(uint8_t data_pin, uint8_t clock_pin, BitOrder order, size_t delay=0)
Constructor method.
Shift-out interface.
Definition: shift-out.hpp:41
virtual void write(uint8_t data)
Writes a data on the interface.
virtual ~shiftOut()
Destructor method.
Shift base interface.
Definition: shift-base.hpp:41