A lightweight C library for Raspberry Pi hardware modules.
 All Data Structures Files Functions Groups Pages

pihwm is a collection of lightweight drivers for the hardware peripherals on the Raspberry Pi computer.

Building and installing pihwm

Grab the latest copy of the library from Github:

git clone git://github.com/omerk/pihwm.git
cd pihwm
mkdir build
cd build

Configure the software using the configure script in the main directory.


There are several options available, many of which are standard to GNU configure scripts. Use configure –help to see all the options. The most useful is –prefix to specify a directory for installation of the library.

Build the tool with:

make all

Install the tool with:

make install

This will install the library in prefix/lib, the demo programs in prefix/bin, headers in prefix/include and the documentation in prefix/share, where prefix is the prefix specified when configuring, if any.

The documentation may be created and installed in alternative formats (PDF, Postscript,DVI, HTML) with for example:

make pdf
make install-pdf

Using the library

The library may be used by adding -lpihwm when compiling on the Raspberry Pi. Programs should include pihwm.h and any other hardware specific headers from the include directory as required. Note that if a prefix has been specified when configuring, it may be necessary to specify the location of the library (using the -L flag) and the headers (using the -I flag).

For example, running on the Raspberry Pi:

gcc -I/opt/pihwm/include demo.c -L/opt/pihwm/lib -l pihwm -o demo

A number of examples can be found under the /demo directory.

Reporting errors/bugs

Please report bugs via the issue tracker on the Github project page. Pull requests are also welcome!