Skip to content

Latest commit

 

History

History
694 lines (336 loc) · 12 KB

cl-wiringpi2.org

File metadata and controls

694 lines (336 loc) · 12 KB

The CL-WIRINGPI2 package

Internal Package: cl-wiringpi2

Description

Not documented.

External Symbols

External Constants


Constant: +high+

Value
1

Type: bit

Description

Not documented.


Constant: +low+

Value
0

Type: bit

Description

Not documented.

External Functions


Function: analog-read

Syntax
(analog-read pin)
Description

Returns the value on the analog input `PIN’. Note, apparently there are no analog pins on the Raspberry Pi itself; read will return a dummy value there.


Function: analog-write

Syntax
(analog-write pin value)
Description

Writes the given `VALUE’ to the supplied analog `PIN’. Note, apparently there are no analog pins on the Raspberry Pi itself - the write will be non-effective there.


Function: delay

Syntax
(delay milliseconds)
Description

Pause the execution for at least `MILLISECONDS’ milliseconds. Maximum delay is approximately 49 days.


Function: delay-microseconds

Syntax
(delay-microseconds microseconds)
Description

Pause the execution for at least `MICROSECONDS’ microseconds. Maximum delay is approximately 71 minutes.


Function: digital-read

Syntax
(digital-read pin)
Description

Read the state of `PIN’. Returns numeric value of the pin state; compare with constants `+LOW+’ and `+HIGH+’.


Function: digital-write

Syntax
(digital-write pin value)
Description

Write `VALUE’ to `PIN’. Use constants `+LOW+’ and `+HIGH+’ for `VALUE’.


Function: microseconds

Syntax
(microseconds)
Description

Returns the number of microseconds since the call to setup function. Note that the number will wrap around after around 71 minutes.


Function: milliseconds

Syntax
(milliseconds)
Description

Returns the number of milliseconds since the call to setup function. Note that the number will wrap around after around 49 days.


Function: pi-board-info

Syntax
(pi-board-info)
Description

Returns the hardware information of Raspberry Pi board. Result is an plist with following keys:

  • :MODEL - keyword describing the Raspberry Pi model
  • :REVISION - number describing the Raspberry Pi revision (see `PI-BOARD-REVISION’)
  • :MEMORY - number of megabytes of RAM the board has
  • :MAKER - keyword identifying the maker of the board
  • :OVERVOLTED - `T’ if the board was overclocked; `NIL’ otherwise.

Models: :A, :B, :B+, :CM, :ALPHA, :2, :3, :ZERO, :07, :UNKNOWN

Makers: :SONY :EGOMAN :MBEST :UNKNOWN


Function: pi-board-info*

Syntax
(pi-board-info*)
Description

Like `PI-BOARD-INFO’, but gives the raw values returned from the Wiring Pi library. They are, in sequence: model id, revision id, memory, maker id, overvolted state.


Function: pi-board-revision

Syntax
(pi-board-revision)
Description

Returns the board version of the Raspberry Pi. It will be either 1 or 2.

Revision 1 means early Model A and B’s. Revision 2 is everything else - B, B+, CM, Pi 2, Pi Zero, Pi3. Some of the pins in Broadcom numeration change their numbers depending on the board revision.


Function: pin-mode

Syntax
(pin-mode pin)
Description

Try to get the mode `PIN’ is in. Returns either :INPUT or :OUTPUT for valid I/O modes, or :ALT-0 - :ALT-5 for 6 different ‘alternate functions’.

See also `(SETF PIN-MODE)’, `PIN-MODE*’.

Function: (pin-mode)

Syntax
(setf (pin-mode pin) mode)
Description

Try to set `PIN’ to `MODE’. Available modes are:

  • :INPUT
  • :OUTPUT
  • :PWM-OUTPUT
  • :GPIO-CLOCK

This function has no effect in :SYS mode.


Function: pin-mode*

Syntax
(pin-mode* pin)
Description

Returns the raw bits of `PIN’ mode as an integer.


Function: pwm-write

Syntax
(pwm-write pin value)
Description

Write `VALUE’ to PWM register for the given `PIN’. The range for `VALUE’ is 0-1024 for Raspberry Pi’s on-board PWM pin (pin 1, BMC_GPIO 18, physical: 12).


Function: set-pull-resistor-mode

Syntax
(set-pull-resistor-mode pin mode)
Description

Set the mode of pull-up / pull-down resistors on the `PIN’. Available modes are:

  • :OFF - no pull up / down
  • :PULL-UP - pull up (to 3.3V)
  • :PULL-DOWN - pull down (pull to ground)

`PIN’ should be set to input.


Function: setup

Syntax
(setup &key (mode wiring-pi) (terminate-on-error nil))
Description

Initialize the Wiring Pi library. `MODE’ determines the type of initialization:

  • :WIRING-PI - use Wiring Pi pin numeration
  • :PHYS - use physical pin numeration
  • :GPIO, :BROADCOM - use Broadcom pin numeration
  • :SYS - use the /sys/class/gpio interface instead of accessing the hardware directly

Note that all modes except :SYS require the program to be run with superuser privileges. Pin numeration under :SYS mode is the same as in :GPIO/:BROADCOM mode.

You should call this function only once per execution of the program. For convenience, calling it again with the same `MODE’ will be ignored; otherwise an error will be signalled.

Set `TERMINATE-ON-ERROR’ to `NIL’ to restore the default behaviour of Wiring Pi 2 causing the process to terminate if setup function fails.

Internal Symbols

Internal Global Variables


Variable: *setup-mode*

Value
NIL

Type: null

Description

Mode in which Wiring Pi was initialized.

Internal Functions


Function: in-sys-mode

Syntax
(in-sys-mode)
Description

Check if initialization was done in :SYS mode.


Function: initializedp

Syntax
(initializedp)
Description

Check if the WiringPi library was initialized.


Function: setenv

Syntax
(setenv variable value &optional (overwritep t))
Description

Not documented.

Index

A D I M P S NONALPHABETIC

Nonalphabetic

A

D

I

M

P

S

Colophon

This documentation was generated from Common Lisp source code using CLOD, version 1.0. The latest version of CLOD is available here.