Go to file
joan 3e90383499 V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
EXAMPLES pep8:E711 comparison to None should be `if cond is not None:` 2016-04-27 11:29:01 +02:00
util wave delete comments 2018-02-08 18:48:33 +00:00
.gitignore Add dist, *pyc and .egg-info to .gitignore 2016-12-21 14:39:50 +00:00
MakeRemote V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
Makefile V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
README V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
README.md Update README.md 2017-10-18 22:25:13 +01:00
UNLICENCE V6 2013-12-12 10:27:22 +00:00
command.c V67: use with for Python locks, show_errors flag 2018-03-20 18:39:50 +00:00
command.h V57 2016-10-30 15:30:20 +00:00
custom.cext V26 2015-02-02 21:11:28 +00:00
pig2vcd.1 Docs plus reverse PR #164 flag meaning 2018-02-04 18:59:37 +00:00
pig2vcd.c V6 2013-12-12 10:27:22 +00:00
pigpio.3 V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigpio.c V67: #160 buffer size to 512, improved active test 2018-03-13 13:38:58 +00:00
pigpio.h V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigpio.py V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigpiod.1 Issues #131 and #141 2018-02-06 16:01:45 +00:00
pigpiod.c V65 2018-02-08 21:30:08 +00:00
pigpiod_if.3 V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigpiod_if.c V63 2017-05-13 14:22:02 +01:00
pigpiod_if.h V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigpiod_if2.3 V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigpiod_if2.c V66: #178 update script parameters command PROCU 2018-02-13 09:14:28 +00:00
pigpiod_if2.h V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigs.1 V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigs.c V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
pigs.h V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
setup.py V67: use with for Python locks, show_errors flag 2018-03-20 18:39:50 +00:00
x_pigpio.c wave delete comments 2018-02-08 18:48:33 +00:00
x_pigpio.py V48 2016-03-08 14:28:15 +00:00
x_pigpiod_if.c Corrected test list argument errors 2018-02-06 18:35:49 +00:00
x_pigpiod_if2.c Corrected test list argument errors 2018-02-06 18:35:49 +00:00
x_pigs V66: #178 update script parameters command PROCU 2018-02-13 09:14:28 +00:00
x_pipe V48 2016-03-08 14:28:15 +00:00

README.md

pigpio

pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO).

Features

  • Sampling and time-stamping of GPIO 0-31 between 100,000 and 1,000,000 times per second
  • Provision of PWM on any number of the user GPIO simultaneously
  • Provision of servo pulses on any number of the user GPIO simultaneously
  • Callbacks when any of GPIO 0-31 change state (callbacks receive the time of the event accurate to a few microseconds)
  • Notifications via pipe when any of GPIO 0-31 change state
  • Callbacks at timed intervals
  • Reading/writing all of the GPIO in a bank (0-31, 32-53) as a single operation
  • Individually setting GPIO modes, reading and writing
  • Socket and pipe interfaces for the bulk of the functionality in addition to the underlying C library calls
  • Construction of arbitrary waveforms to give precise timing of output GPIO level changes (accurate to a few microseconds)
  • Software serial links, I2C, and SPI using any user GPIO
  • Rudimentary permission control through the socket and pipe interfaces so users can be prevented from "updating" inappropriate GPIO
  • Creating and running scripts on the pigpio daemon

Interfaces

The library provides a number of control interfaces

  • the C function interface,
  • the /dev/pigpio pipe interface,
  • the socket interface (used by the pigs utility and the Python module).

Utilities

A number of utility programs are provided:

  • the pigpiod daemon,
  • the Python module,
  • the piscope digital waveform viewer,
  • the pigs command line utility,
  • the pig2vcd utility which converts notifications into the value change dump (VCD) format (useful for viewing digital waveforms with GTKWave).

Documentation

See http://abyz.me.uk/rpi/pigpio/

Example programs

See http://abyz.me.uk/rpi/pigpio/examples.html

GPIO

ALL GPIO are identified by their Broadcom number. See http://elinux.org.

There are 54 GPIO in total, arranged in two banks.

Bank 1 contains GPIO 0-31. Bank 2 contains GPIO 32-54.

A user should only manipulate GPIO in bank 1.

There are at least three types of board:

  • Type 1
    • 26 pin header (P1)
    • Hardware revision numbers of 2 and 3
    • User GPIO 0-1, 4, 7-11, 14-15, 17-18, 21-25
  • Type 2
    • 26 pin header (P1) and an additional 8 pin header (P5)
    • Hardware revision numbers of 4, 5, 6, and 15
    • User GPIO 2-4, 7-11, 14-15, 17-18, 22-25, 27-31
  • Type 3
    • 40 pin expansion header (J8)
    • Hardware revision numbers of 16 or greater
    • User GPIO 2-27 (0 and 1 are reserved)

It is safe to read all the GPIO. If you try to write a system GPIO or change its mode you can crash the Pi or corrupt the data on the SD card.