Go to file
Guy McSwain 4b2a1efdab
Add 'develop' branch model process.
2020-01-10 00:32:24 -06:00
EXAMPLES pep8:E711 comparison to None should be `if cond is not None:` 2016-04-27 11:29:01 +02:00
util Update pigpiod.service 2020-01-08 12:09:15 -06:00
.gitignore Add dist, *pyc and .egg-info to .gitignore 2016-12-21 14:39:50 +00:00
CMakeLists.txt Added option to build the libraries statically 2019-07-21 14:09:48 +04:00
CONTRIBUTING.md Add 'develop' branch model process. 2020-01-10 00:32:24 -06:00
MakeRemote V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
Makefile Use -pthread when linking shared libraries. 2019-01-10 14:17:59 +00:00
README V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
README.md Update README.md 2019-07-03 11:55:57 +01:00
SUPPORT.md Create SUPPORT.md (#2) 2020-01-01 20:48:41 -06:00
UNLICENCE V6 2013-12-12 10:27:22 +00:00
command.c V69+: BCM2711 PLLD 500->750 MHz Crystal 19.2->54M 2019-07-14 20:47:20 +01:00
command.h V69+: #258 reject and document illegal script commands 2019-07-11 10:09:35 +01:00
custom.cext V26 2015-02-02 21:11:28 +00:00
pig2vcd.1 V72+: new year 2020-01-02 15:01:43 +00:00
pig2vcd.c V6 2013-12-12 10:27:22 +00:00
pigpio.3 V72+: new year 2020-01-02 15:01:43 +00:00
pigpio.c V73: I2C_SLOTS to 512 (from 64) 2020-01-02 15:04:54 +00:00
pigpio.h V73: I2C_SLOTS to 512 (from 64) 2020-01-02 15:04:54 +00:00
pigpio.py V71+: tidy up documentation overviews 2019-11-27 18:44:25 +00:00
pigpiod.1 V72+: new year 2020-01-02 15:01:43 +00:00
pigpiod.c V68+: Changes for Pi4B (base address, default DMA channels, PUD) 2019-07-02 18:04:12 +01:00
pigpiod_if.3 V72+: new year 2020-01-02 15:01:43 +00: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 V72+: new year 2020-01-02 15:01:43 +00:00
pigpiod_if2.c V71+: #268 obey host name setting with env vars 2019-11-27 21:25:35 +00:00
pigpiod_if2.h V71+: tidy up documentation overviews 2019-11-27 18:44:25 +00:00
pigs.1 V72+: new year 2020-01-02 15:01:43 +00:00
pigs.c V69+: #280 SPI/BSC SLAVE peripheral not available on BCM2711 2019-07-07 12:52:44 +01:00
pigs.h V67: #198 added process exit codes for pigs 2018-03-11 13:24:54 +00:00
setup.py V71+: tidy up documentation overviews 2019-11-27 18:44:25 +00:00
x_pigpio.c V71+: change the way DMA is reset to cater for edge case 2019-09-29 10:13:04 +01: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).

At the moment pigpio on the Pi4B is experimental. I am not sure if the DMA channels being used are safe. The Pi4B defaults are primary channel 7, secondary channel 6. If these channels do not work you will have to experiment. You can set the channels used by the pigpio daemon by invoking it with the -d and -e options, e.g. sudo pigpiod -d 5 -e 8 to specify primary 5, secondary 8.

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.