chiark / gitweb /
Lots of changes here. Added new I2C test code, a new serialTest program,
[wiringPi.git] / gpio / gpio.1
index 7da64b2f9c6b2408f85f9ec84431cbfd052c8429..a83cf9f864a93590116f0ef906e51f5ad39070f7 100644 (file)
@@ -1,31 +1,64 @@
-.TH "GPIO" "14 June 2012" "Command-Line access to Raspberry Pi and PiFace GPIO"
+.TH "GPIO" "21st October 2012" "Command-Line access to Raspberry Pi and PiFace GPIO"
 
 .SH NAME
 gpio \- Command-line access to Raspberry Pi and PiFace GPIO
 
 .SH SYNOPSIS
-.TP
 .B gpio
-.RB [ \-v ]
-.TP
+.B \-v
+.PP
 .B gpio
-.RB [ \-g ]
-.RB < read/write/pwm/mode ...>
-.TP
+.B [ \-g ]
+.B read/write/wb/pwm/mode ...
+.PP
 .B gpio
-.RB [ \-p ]
-.RB < read/write/mode ...>
-.TP
+.B [ \-p ]
+.B read/write/wb
+.B ...
+.PP
+.B gpio
+.B readall
+.PP
+.B gpio
+.B unexportall/exports
+.PP
+.B gpio
+.B export/edge/unexport
+.B ...
+.PP
 .B gpio
-.RB < export/edge/unexport/unexportall/exports ...>
+.B drive
+group value
+.PP
+.B gpio
+.B pwm-bal/pwm-ms
+.PP
+.B gpio
+.B pwmr
+range
+.PP
+.B gpio
+.B load \ i2c/spi
+.PP
+.B gpio
+.B gbr
+channel
+.PP
+.B gpio
+.B gbw
+channel value
 
 .SH DESCRIPTION
 
 .B GPIO
-is a command line tool to allow the user easy access to the GPIO pins
-on the Raspberry Pi. It's designed for simple testing and diagnostic
-purposes, but can be used in shell scripts for general if somewhat slow
-control of the GPIO pins.
+is a swiss army knife of a command line tool to allow the user easy
+access to the GPIO pins on the Raspberry Pi and the SPI A/D and D/A
+converters on the Gertboard. It's designed for simple testing and
+diagnostic purposes, but can be used in shell scripts for general if
+somewhat slow control of the GPIO pins.
+
+It can also control the IO's on the PiFace IO board and load the SPI and I2C
+kernel modules if required.
 
 Additionally, it can be used to set the exports in the \fI/sys/class/gpio\fR
 system directory to allow subsequent programs to use the \fR/sys/class/gpio\fR
@@ -35,35 +68,58 @@ interface without needing to be run as root.
 
 .TP
 .B \-v
-Output the current version
+Output the current version including the board revision of the Raspberry Pi.
 
 .TP
 .B \-g
 Use the BCM_GPIO pins numbers rather than wiringPi pin numbers.
+\fINOTE:\fR The BCM_GPIO pin numbers are always used with the 
+export and edge commands.
 
 .TP
 .B \-p
 Use the PiFace interface board and its corresponding pin numbers.
 
 .TP
-.B read
+.B read <pin>
 Read the digital value of the given pin and print 0 or 1 to represent the
 respective logic levels.
 
 .TP
-.B write
-Write the given value (0 or 1) to the pin.
+.B write <pin> <value>
+Write the given value (0 or 1) to the pin. You need to set the pin
+to output mode first.
+
+.TP
+.B wb <value>
+Write the given byte to the 8 main GPIO pins. You can prefix it with 0x
+to specify a hexadecimal number. You need to set pins to output mode
+first.
+
+.TP
+.B readall
+Output a table of all GPIO pins values. The values represent the actual values read
+if the pin is in input mode, or the last value written if the pin is in output
+mode.
 
 .TP
-.B pwm
+.B pwm <pin> <value>
 Write a PWM value (0-1023) to the given pin.
 
 .TP
-.B mode
+.B mode <pin> <mode>
 Set a pin into \fIinput\fR, \fIoutput\fR or \fIpwm\fR mode. Can also
 use the literals \fIup\fR, \fIdown\fR or \fItri\fR to set the internal
 pull-up, pull-down or tristate (off) controls.
 
+.TP
+.B unexportall
+Un-Export all the GPIO pins in the /sys/class/gpio directory.
+
+.TP
+.B exports
+Print a list (if any) of all the exported GPIO pins and their current values.
+
 .TP
 .B export
 Export a GPIO pin in the \fI/sys/class/gpio\fR directory. Use like the
@@ -87,7 +143,7 @@ the direction to input and set the edge interrupt method to \fInone\fR,
 above and note that \fBBCM_GPIO\fR pin number is used not not wiringPi pin
 numbering.
 
-Like the export commands abovem ownership is set to that of the 
+Like the export commands above, ownership is set to that of the 
 calling user, allowing subsequent access from user programs without
 requiring root/sudo.
 
@@ -96,39 +152,78 @@ requiring root/sudo.
 Un-Export a GPIO pin in the /sys/class/gpio directory.
 
 .TP
-.B unexportall
-Un-Export all the GPIO pins in the /sys/class/gpio directory.
+.B drive
+group value
+
+Change the pad driver value for the given pad group to the supplied drive
+value. Group is 0, 1 or 2 and value is 0-7. Do not use unless you are
+absolutely sure you know what you're doing.
 
 .TP
-.B exports
-Print a list (if any) of all the exported GPIO pins and their current values.
+.B pwm-bal/pwm-ms 
+Change the PWM mode to balanced (the default) or mark:space ratio (traditional)
 
-.SH "WiringPi vs. GPIO Pin numbering"
+.TP
+.B pwmr
+Change the PWM range register. The default is 1024.
+
+.TP
+.B load i2c/spi
+This loads the i2c or the spi drivers into the system and changes the permissions on
+the associated /dev/ entries so that the current user has access to them.
+
+.TP
+.B gbr
+channel
+
+This reads the analog to digital converter on the Gertboard on the given
+channel. The board jumpers need to be in-place to do this operation.
+
+.TP
+.B gbw
+channel value
+
+This writes the supplied value to the output channel on the Gertboards
+SPI digital to analogue converter.
+The board jumpers need to be in-place to do this operation.
+
+
+.SH "WiringPi vs. BCM_GPIO Pin numbering"
 
 .PP
 .TS
-r r l.
-WiringPi       GPIO    Function
+r r l.
+WiringPi       GPIO-r1 GPIO-r2 Function
 _
-0      17
-1      18      (PWM)
-2      21
-3      22
-4      23
-5      24
-6      25
-7      4
-8      0       SDA0
-9      1       SCL0
-10     8       SPI CE0
-11     7       SPI CE1
-12     10      SPI MOSI
-13     9       SPI MISO
-14     11      SPI SCLK
-15     14      TxD
-16     15      RxD
+0      17      17
+1      18      18      (PWM)
+2      21      27
+3      22      22
+4      23      23
+5      24      24
+6      25      25
+7      4       4
+8      0       2       I2C: SDA0
+9      1       3       I2C: SCL0
+10     8       8       SPI: CE0
+11     7       7       SPI: CE1
+12     10      10      SPI: MOSI
+13     9       9       SPI: MISO
+14     11      11      SPI: SCLK
+15     14      14      TxD
+16     15      16      RxD
+17     -       28
+18     -       29
+19     -       30
+20     -       31
 .TE
 
+Note that "r1" and "r2" above refers to the board revision. Normally
+wiringPi detects the correct board revision with use for it's own
+numbering scheme, but if you are using a Revision 2 board with some
+of the pins which change numbers between revisions you will need
+to alter your software.
+
 .SH FILES
 
 .TP 2.2i
@@ -170,10 +265,14 @@ Gordon Henderson
 
 .SH "REPORTING BUGS"
 
-Report bugs to <gordon@drogon.net>
+Please report bugs to <projects@drogon.net>
 
 .SH COPYRIGHT
 
 Copyright (c) 2012 Gordon Henderson
 This is free software; see the source for copying conditions. There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+.SH TRADEMARKS AND ACKNOWLEDGEMENTS
+
+Raspberry Pi is a trademark of the Raspberry Pi Foundation.