Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-gpio Reference Manual, version 1.1.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:09:33 2018 GMT+0.
• Introduction: | What cl-gpio is all about | |
• Systems: | The systems documentation | |
• Files: | The files documentation | |
• Packages: | The packages documentation | |
• Definitions: | The symbols documentation | |
• Indexes: | Concepts, functions, variables and data types |
This is a bindings library for the Linux GPIO kernel module as described on https://www.kernel.org/doc/Documentation/gpio/sysfs.txt. It provides both primitive access and more sophisticated constructs to work with interrupts and such.
Enumerate a list of all available GPIO pins on your system:
(gpio:pins)
You can then access the direction, edge, and active-low of each pin:
(setf (gpio:direction 0) :out)
(gpio:active-low 0)
If you try to read or set a PIN's value, its direction is automatically adjusted as necessary:
(gpio:value 0)
(setf (gpio:value 0) T)
On SBCL you can also wait for values:
(progn (gpio:await-value 0)
(format T "Whoah, 0's edge is ~a to ~:[0~;1~]" (edge 0) (value 0)))
Or even install handlers:
(defun pin-value-handler (pin value)
(format T "~& ~a changed value to ~a." pin value))
(gpio:with-pin-handler (#'pin-value-handler 0 :falling)
(format T "Waiting for a change on 0...")
(loop (sleep 0.001)))
Naturally you'll have to refer to your particular board/system's specification to be able to tell which pins are supposed to be used for what. For the Raspberry Pi 2/3, it would be:
(Source)
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The cl-gpio system: |
Nicolas Hafner <shinmera@tymoon.eu>
Nicolas Hafner <shinmera@tymoon.eu>
Artistic
A library for the Linux GPIO kernel module as used on hobby kits such as the Raspberry Pi
1.1.0
cl-gpio.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files: |
• The cl-gpio.asd file: | ||
• The cl-gpio/package.lisp file: | ||
• The cl-gpio/low-level.lisp file: | ||
• The cl-gpio/wrapper.lisp file: | ||
• The cl-gpio/documentation.lisp file: |
Next: The cl-gpio/package<dot>lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
cl-gpio.asd
cl-gpio (system)
Next: The cl-gpio/low-level<dot>lisp file, Previous: The cl-gpio<dot>asd file, Up: Lisp files [Contents][Index]
cl-gpio (system)
package.lisp
Next: The cl-gpio/wrapper<dot>lisp file, Previous: The cl-gpio/package<dot>lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
cl-gpio (system)
low-level.lisp
Next: The cl-gpio/documentation<dot>lisp file, Previous: The cl-gpio/low-level<dot>lisp file, Up: Lisp files [Contents][Index]
low-level.lisp (file)
cl-gpio (system)
wrapper.lisp
Previous: The cl-gpio/wrapper<dot>lisp file, Up: Lisp files [Contents][Index]
wrapper.lisp (file)
cl-gpio (system)
documentation.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The cl-gpio package: | ||
• The cl-gpio-lli package: |
Next: The cl-gpio-lli package, Previous: Packages, Up: Packages [Contents][Index]
package.lisp (file)
common-lisp
Previous: The cl-gpio package, Up: Packages [Contents][Index]
package.lisp (file)
org.shirakumo.gpio.lli
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions: | ||
• Internal definitions: |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables: | ||
• Exported macros: | ||
• Exported compiler macros: | ||
• Exported functions: | ||
• Exported structures: |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
The root directory of the GPIO system devices. Should be /sys/class/gpio/
low-level.lisp (file)
Next: Exported compiler macros, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Shorthand to call a handler function on PIN value change during the evaluation of BODY.
See CALL-WITH-PIN-HANDLER
wrapper.lisp (file)
Next: Exported functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
wrapper.lisp (file)
Next: Exported structures, Previous: Exported compiler macros, Up: Exported definitions [Contents][Index]
Accesses the pin’s I/O active-low.
If the pin does not yet exist or is not exported, it will be. The system GPIO’s value is not adjusted if the cached value is already the same as the value attempted to be set with this.
See ENSURE-PIN
See CL-GPIO-LLI:ACTIVE-LOW
See PIN-ACTIVE-LOW
wrapper.lisp (file)
(setf active-low) (function)
wrapper.lisp (file)
active-low (function)
Accessor to whether the GPIO pin has an active low.
The value should be either NIL or T.
low-level.lisp (file)
(setf active-low) (function)
low-level.lisp (file)
active-low (function)
Returns a list of PIN instances for all pins on the system.
See CL-GPIO-LLI:AVAILABLE-PINS
See ENSURE-PIN
wrapper.lisp (file)
Return a list of all available GPIO pins on the system.
Note that the pins are not necessarily accessible; they may need to be exported first.
low-level.lisp (file)
Wait until the pin has a value that we can read.
If TIMEOUT is specified and reached before a value becomes accessible, NIL is returned. Otherwise, true is returned.
This function is available on the following implementations:
* SBCL
See ENSURE-PIN
wrapper.lisp (file)
Return the GPIO chip’s base pin number.
low-level.lisp (file)
Make the HANDLER function be called if the PIN changes value during the evaluation of FUNCTION.
The HANDLER is called with the corresponding PIN instance
and the new value as arguments.
This function is available on the following implementations:
* SBCL
See ENSURE-PIN
See EDGE
See ACTIVE-LOW
wrapper.lisp (file)
Returns the pin’s chip device name.
See PIN-CHIP
wrapper.lisp (file)
Returns a file for the specified GPIO chip.
See GPIO-FILE
low-level.lisp (file)
Return a list of GPIO pin numbers on the chip.
low-level.lisp (file)
Returns a list of known GPIO chips.
low-level.lisp (file)
Accesses the pin’s I/O direction.
If the pin does not yet exist or is not exported, it will be. The system GPIO’s value is not adjusted if the cached value is already the same as the value attempted to be set with this.
See ENSURE-PIN
See CL-GPIO-LLI:DIRECTION
See PIN-DIRECTION
wrapper.lisp (file)
(setf direction) (function)
wrapper.lisp (file)
direction (function)
Accessor to the GPIO pin’s direction.
The value should be either :IN or :OUT.
low-level.lisp (file)
(setf direction) (function)
low-level.lisp (file)
direction (function)
Accesses the pin’s I/O edge.
If the pin does not yet exist or is not exported, it will be. The system GPIO’s value is not adjusted if the cached value is already the same as the value attempted to be set with this.
See ENSURE-PIN
See CL-GPIO-LLI:EDGE
See PIN-EDGE
wrapper.lisp (file)
(setf edge) (function)
wrapper.lisp (file)
edge (function)
Accessor to the GPIO pin’s interrupt edge.
The value should be one of :NONE :RISING :FALLING :BOTH
low-level.lisp (file)
(setf edge) (function)
low-level.lisp (file)
edge (function)
Ensure to get a PIN instance in return.
Accepts either a pin’s name/id number or a pin instance. If REFRESH is true, a fresh PIN instance is returned that has its values taken from the system’s GPIO values.
See *PIN-CACHE*
See MAKE-PIN
See PIN
wrapper.lisp (file)
Export the specified pins and return a list of according PIN instances.
See ENSURE-PIN
See CL-GPIO-LLI:EXPORT-PIN
wrapper.lisp (file)
Export the specified pins so that they may be accessed from userspace.
low-level.lisp (file)
Returns a list of GPIO pins that are accessible.
low-level.lisp (file)
Returns an absolute path to the requested gpio file.
See *GPIO-ROOT*
low-level.lisp (file)
Return the GPIO chip’s label.
low-level.lisp (file)
Returns the pin’s name or ID.
See PIN-NAME
wrapper.lisp (file)
Return the number of GPIO pins on the chip.
low-level.lisp (file)
Returns a file for the specified GPIO pin.
See GPIO-FILE
low-level.lisp (file)
Returns a list of available/exported PIN instances.
See CL-GPIO-LLI:EXPORTED-PINS
See ENSURE-PIN
wrapper.lisp (file)
Unexport the specified pins and invalidate their cache.
See *PIN-CACHE*
See CL-GPIO-LLI:UNEXPORT-PIN
wrapper.lisp (file)
Unexport the specified pins so that they can no longer be accessed from userspace.
low-level.lisp (file)
Accesses the pin’s I/O value.
If the pin does not yet exist or is not exported, it will be.
The pin’s I/O direction is automatically adjusted if necessary
depending on whether the value is read or set by setf.
The value returned by this is never cached.
See ENSURE-PIN
See CL-GPIO-LLI:VALUE
wrapper.lisp (file)
(setf value) (function)
wrapper.lisp (file)
value (function)
Accessor to the GPIO pin’s value.
When reading, the pin’s direction should be :IN When setting, the pin’s direction should be :OUT
The value should be either NIL or T.
low-level.lisp (file)
(setf value) (function)
low-level.lisp (file)
value (function)
Previous: Exported functions, Up: Exported definitions [Contents][Index]
Representative type to encapsulate a GPIO pin.
This will cache current pin properties. Note that it will
not be updated automatically should changes to the pin
occur from elsewhere in the system. Only updates done
through this high-level interface will be tracked.
See MAKE-PIN
See ENSURE-PIN
See NAME
See CHIP
See DIRECTION
See EDGE
See ACTIVE-LOW
See VALUE
wrapper.lisp (file)
structure-object (structure)
print-object (method)
integer
-1
pin-name (function)
(setf pin-name) (function)
string
""
pin-chip (function)
(setf pin-chip) (function)
(member :in :out)
:in
pin-direction (function)
(setf pin-direction) (function)
(member :none :rising :falling :both)
:none
pin-edge (function)
(setf pin-edge) (function)
boolean
pin-active-low (function)
(setf pin-active-low) (function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables: | ||
• Internal macros: | ||
• Internal compiler macros: | ||
• Internal functions: |
Next: Internal macros, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Hash table to store cached PIN instances.
See PIN
See ENSURE-PIN
wrapper.lisp (file)
Next: Internal compiler macros, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
Wrapper to define an accessor function for a GPIO pin property.
low-level.lisp (file)
Next: Internal functions, Previous: Internal macros, Up: Internal definitions [Contents][Index]
low-level.lisp (file)
Previous: Internal compiler macros, Up: Internal definitions [Contents][Index]
Direct constructor to make a PIN instance.
See PIN
See MAKE-PIN
wrapper.lisp (file)
low-level.lisp (file)
low-level.lisp (file)
low-level.lisp (file)
wrapper.lisp (file)
low-level.lisp (file)
low-level.lisp (file)
Returns the name of the topmost directory, if any.
low-level.lisp (file)
low-level.lisp (file)
Construct a new PIN instance.
If the pin has not been exported yet, it will be. If the pin does not exist, an error is signalled. The GPIO pin’s current properties are read out and stored into the respective slots of the pin instance.
See CL-GPIO-LLI:LABEL
See CL-GPIO-LLI:DIRECTION
See CL-GPIO-LLI:EDGE
See CL-GPIO-LLI:ACTIVE-LOW
wrapper.lisp (file)
Direct accessor to the pin’s active-low.
Value must be a boolean.
See PIN
See ACTIVE-LOW
wrapper.lisp (file)
(setf pin-active-low) (function)
wrapper.lisp (file)
pin-active-low (function)
Direct reader for the pin’s chip (or its label).
Value must be a string.
See PIN
See CHIP
wrapper.lisp (file)
Direct accessor to the pin’s I/O direction.
Value must be one of :IN :OUT
See PIN
See DIRECTION
wrapper.lisp (file)
(setf pin-direction) (function)
wrapper.lisp (file)
pin-direction (function)
Direct accessor to the pin’s edge.
Value must be one of :NONE :RISING :FALLING :BOTH
See PIN
See EDGE
wrapper.lisp (file)
(setf pin-edge) (function)
wrapper.lisp (file)
pin-edge (function)
Direct reader for the pin’s ID or name.
Value must be an integer.
See PIN
See NAME
wrapper.lisp (file)
wrapper.lisp (file)
wrapper.lisp (file)
low-level.lisp (file)
Read the file into a string, trimmed from whitespace.
low-level.lisp (file)
Write the sequence to the specified file.
low-level.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index: | ||
• Function index: | ||
• Variable index: | ||
• Data type index: |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | C F L |
---|
Jump to: | C F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | %
(
A B C D E F G L M N P R U V W |
---|
Jump to: | %
(
A B C D E F G L M N P R U V W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
A C D E N S |
---|
Jump to: | *
A C D E N S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C P S |
---|
Jump to: | C P S |
---|