Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Reference Manual

Rpi-hw (short for "Raspberry Pi Hardware") is a free C++ library designed to manage the Raspberry Pi's GPIO connector and its other buses. It allows you to connect several devices to the board (including displays, keypads, stepper motors, and sensors) as you would with Arduino's libraries.

Features

List of supported devices

To-do list

Code examples

Accessing to the GPIO connector:

// Get the GPIO controller
gpio &io = gpio::get();
// Set the mode of GPIO #11
io.setup( 25, OUTPUT );
// Write on GPIO #11
io.write( 25, HIGH );

Reading from 16-keys keypad:

// Define the keymap
std::vector< uint8_t > keymap = {
'1', '2', '3', 'A',
'4', '5', '6', 'B',
'7', '8', '9', 'C',
'*', '0', '#', 'D'
};
// Matrix keypad controller
keypad::matrix dev( { 14, 15, 18, 23 }, { 24, 25, 8, 7 }, keymap );
// Main loop
for ( ;; ) {
// Check the button state
if ( dev.keyPressed('2') || dev.keyPressed('3') )
std::cout << "You have pressed keys '2' or '3'!\n";
// Wait some time
time::msleep( 100 );
}

Writing texts on a Hitachi HD44780-based LCD:

// Display controller
display::hd44780 dev( 14, 18, 4, 17, 21, 22 );
// Initialize the 16x2 display
dev.init( 16, 2 );
// Move the cursor position
dev.move( 2, 0 );
// Write a string at cursor position
dev.write( "Hello World!" );

Documentation

Detailed documentation of Rpi-hw's features and usage can be found on the official wiki.

Also you can find some articles about the library on http://hackyourmind.org/.

License

The library is released under terms of the GNU LGPL v3.

Rpi-hw is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation version 3 of the License.

Rpi-hw is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

See COPYING file for more details.

Bug tracker

Have a bug? Please create an issue on GitHub at https://github.com/Wicker25/Rpi-hw/issues.