Go to file
Guy McSwain 8f4eff9694 Fix issue#400 PI_CMD_EVT is unused in pigpiod_if2.c 2020-12-18 20:32:16 -06:00
DOC Reworked paulvee example and link. 2020-12-18 15:57:25 -06:00
EXAMPLES pep8:E711 comparison to None should be `if cond is not None:` 2016-04-27 11:29:01 +02:00
cmake optimized python setup 2019-08-26 12:00:09 +02:00
util Fix issue #274 - Delay on reboot/shutdown. 2020-08-30 10:23:16 -05:00
.gitignore Bump version and generate docs. 2020-06-26 16:20:36 -05:00
CMakeLists.txt Moved option like option to actual option 2019-08-26 12:08:08 +02: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 Allow creation of two waves with 50% padding using gpioWaveCreatePad. 2020-03-12 09:44:41 -05: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 Update docs 2020-06-28 14:36:20 -05:00
pigpio.c Fix issue#397 gpioSetTimerFunc NULL cancel error 2020-12-18 20:23:52 -06:00
pigpio.h PR#415 fix simple type receieve -> receive 2020-12-18 19:48:49 -06:00
pigpio.py PR#415 fix simple type receieve -> receive 2020-12-18 19:48:49 -06: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 Misc plus fix for #373 2020-08-30 10:15:52 -05:00
pigpiod_if.h V67+: tided up I2C/SPI documentation 2018-10-21 08:54:37 +01:00
pigpiod_if2.3 PR#413 Update doc: return current PWM dutycycle instead of 0 2020-12-18 19:41:57 -06:00
pigpiod_if2.c Fix issue#400 PI_CMD_EVT is unused in pigpiod_if2.c 2020-12-18 20:32:16 -06:00
pigpiod_if2.h PR#415 fix simple type receieve -> receive 2020-12-18 19:48:49 -06:00
pigs.1 Bump version and generate docs. 2020-06-26 16:20:36 -05: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 Sync versions for next release (78). 2020-09-29 10:19:49 -05:00
x_pigpio.c Add test cases to x_* for padded waves. 2020-04-29 11:25:02 -05:00
x_pigpio.py Add test cases to x_* for padded waves. 2020-04-29 11:25:02 -05:00
x_pigpiod_if.c Corrected test list argument errors 2018-02-06 18:35:49 +00:00
x_pigpiod_if2.c Modify pigpio_start arguments 2020-09-18 23:28:18 +02:00
x_pigs Add test cases to x_* for padded waves. 2020-04-29 11:25:02 -05: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.