Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
rpi-hw.hpp
1 /*
2  Title --- rpi-hw.hpp [main]
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_HPP_
23 #define _RPI_HW_HPP_
24 
25 /*!
26 
27 @mainpage Reference Manual
28 
29 <a href="http://hackyourmind.org/projects/rpi-hw">Rpi-hw</a> (short for "Raspberry Pi Hardware") is a free C++ library
30 designed to manage the Raspberry Pi's GPIO connector and its other buses.
31 It allows you to connect several devices to the board (including displays, keypads, stepper motors, and sensors) as you would with Arduino's libraries.
32 
33 @section features Features
34 
35 @li Low-level access to the GPIO Connector and SPI, I2C, UART buses
36 @li High-level input/output interfaces
37 @li Support for I/O expander ICs
38 @li Support for many devices, including displays, keypads, stepper motors, and sensors (see "List of supported devices" section)
39 @li Unicode support (built-in)
40 @li Support for standard fonts (using FreeType) (optional)
41 @li Support for multiple image formats (using Magick++ API) (optional)
42 @li Drawing functions
43 
44 @section list_of_supported_devices List of supported devices
45 
46 @li 8-bit I/O expander with I2C/SPI (MCP23008, MCP23S08)
47 @li 16-bit I/O expander with I2C/SPI (MCP23017, MCP23S17)
48 @li Character LCDs (Hitachi HD44780)
49 @li Graphical LCDs (Philips PCD8544)
50 @li Single and multiple 7-segments diplays
51 @li Matrix keypads
52 @li Ultrasonic distance sensor (HC-SR04)
53 @li Stepper motors
54 
55 @section to_do_list To-do list
56 
57 @li Support for UART interface
58 
59 @section code_examples Code examples
60 
61 Accessing to the GPIO connector:
62 
63 @code{.cpp}
64 // Get the GPIO controller
65 gpio &io = gpio::get();
66 
67 // Set the mode of GPIO #11
68 io.setup( 25, OUTPUT );
69 
70 // Write on GPIO #11
71 io.write( 25, HIGH );
72 @endcode
73 
74 Reading from 16-keys keypad:
75 
76 @code{.cpp}
77 // Define the keymap
78 std::vector< uint8_t > keymap = {
79 
80  '1', '2', '3', 'A',
81  '4', '5', '6', 'B',
82  '7', '8', '9', 'C',
83  '*', '0', '#', 'D'
84 };
85 
86 // Matrix keypad controller
87 keypad::matrix dev( { 14, 15, 18, 23 }, { 24, 25, 8, 7 }, keymap );
88 
89 // Main loop
90 for ( ;; ) {
91 
92  // Check the button state
93  if ( dev.keyPressed('2') || dev.keyPressed('3') )
94  std::cout << "You have pressed keys '2' or '3'!\n";
95 
96  // Wait some time
97  time::msleep( 100 );
98 }
99 @endcode
100 
101 Writing texts on a Hitachi HD44780-based LCD:
102 
103 @code{.cpp}
104 // Display controller
105 display::hd44780 dev( 14, 18, 4, 17, 21, 22 );
106 
107 // Initialize the 16x2 display
108 dev.init( 16, 2 );
109 
110 // Move the cursor position
111 dev.move( 2, 0 );
112 
113 // Write a string at cursor position
114 dev.write( "Hello World!" );
115 @endcode
116 
117 @section documentation Documentation
118 
119 Detailed documentation of Rpi-hw's features and usage can be found on the <a href="https://github.com/Wicker25/Rpi-hw/wiki">official wiki</a>.
120 
121 @li <a href="https://github.com/Wicker25/Rpi-hw/wiki/Download%20and%20install">Download and install</a>
122 @li <a href="https://github.com/Wicker25/Rpi-hw/wiki/Getting%20started">Getting started</a>
123 @li <a href="http://hackyourmind.org/rpi-hw/">Reference manual</a>
124 
125 Also you can find <a href="http://hackyourmind.org/tag/rpi-hw">some articles</a> about the library on <a href="http://hackyourmind.org/">http://hackyourmind.org/</a>.
126 
127 @section license License
128 
129 The library is released under terms of the <a href="http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License">GNU LGPL v3</a>.
130 
131 @verbatim
132 Rpi-hw is free software: you can redistribute it and/or modify
133 it under the terms of the GNU Lesser General Public License as published by
134 the Free Software Foundation version 3 of the License.
135 
136 Rpi-hw is distributed in the hope that it will be useful,
137 but WITHOUT ANY WARRANTY; without even the implied warranty of
138 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
139 GNU Lesser General Public License for more details.
140 @endverbatim
141 
142 See COPYING file for more details.
143 
144 @section bug_tracker Bug tracker
145 
146 Have a bug? Please create an issue on GitHub at <a href="https://github.com/Wicker25/Rpi-hw/issues">https://github.com/Wicker25/Rpi-hw/issues</a>.
147 
148 */
149 
150 /*!
151  @namespace rpihw
152  @brief Main namespace of the library.
153 */
154 
155 // Includes some Rpi-hw header files
156 #include <rpi-hw/rpi.hpp>
157 #include <rpi-hw/config.hpp>
158 #include <rpi-hw/version.hpp>
159 #include <rpi-hw/types.hpp>
160 
161 #endif /* _RPI_HW_HPP_ */