Files
python-gpiozero/docs/api_exc.rst
Dave Jones 759a6a58e6 Fix #140, fix #69, fix #185
This PR adds a software SPI implementation. Firstly this removes the
absolute necessity for spidev (#140), which also means when it's not
present things still work (effectively fixes #185), and also enables any
four pins to be used for SPI devices (which don't require the hardware
implementation).

The software implementation is simplistic but still supports clock
polarity and phase, select-high, and variable bits per word. However it
doesn't allow precise speeds to be implemented because it just wibbles
the clock as fast as it can (which being pure Python isn't actually that
fast).

Finally, because this PR involves creating a framework for "shared"
devices (like SPI devices with multiple channels), it made sense to bung
Energenie (#69) in as wells as this is a really simple shared device.
2016-04-01 12:57:17 +01:00

107 lines
2.2 KiB
ReStructuredText

==========
Exceptions
==========
.. currentmodule:: gpiozero
The following exceptions are defined by GPIO Zero. Please note that multiple
inheritance is heavily used in the exception hierarchy to make testing for
exceptions easier. For example, to capture any exception generated by GPIO
Zero's code::
from gpiozero import *
led = PWMLED(17)
try:
led.value = 2
except GPIOZeroError:
print('A GPIO Zero error occurred')
Since all GPIO Zero's exceptions descend from :exc:`GPIOZeroError`, this will
work. However, certain specific errors have multiple parents. For example, in
the case that an out of range value is passed to :attr:`OutputDevice.value` you
would expect a :exc:`ValueError` to be raised. In fact, a
:exc:`OutputDeviceBadValue` error will be raised. However, note that this
descends from both :exc:`GPIOZeroError` (indirectly) and from :exc:`ValueError`
so you can still do::
from gpiozero import *
led = PWMLED(17)
try:
led.value = 2
except ValueError:
print('Bad value specified')
Errors
======
.. autoexception:: GPIOZeroError
.. autoexception:: DeviceClosed
.. autoexception:: CompositeDeviceError
.. autoexception:: CompositeDeviceBadName
.. autoexception:: EnergenieSocketMissing
.. autoexception:: EnergenieBadSocket
.. autoexception:: SPIError
.. autoexception:: SPIBadArgs
.. autoexception:: GPIODeviceError
.. autoexception:: GPIODeviceClosed
.. autoexception:: GPIOPinInUse
.. autoexception:: GPIOPinMissing
.. autoexception:: GPIOBadQueueLen
.. autoexception:: GPIOBadSampleWait
.. autoexception:: InputDeviceError
.. autoexception:: OutputDeviceError
.. autoexception:: OutputDeviceBadValue
.. autoexception:: PinError
.. autoexception:: PinFixedFunction
.. autoexception:: PinInvalidFunction
.. autoexception:: PinInvalidState
.. autoexception:: PinInvalidPull
.. autoexception:: PinInvalidEdges
.. autoexception:: PinSetInput
.. autoexception:: PinFixedPull
.. autoexception:: PinEdgeDetectUnsupported
.. autoexception:: PinPWMError
.. autoexception:: PinPWMUnsupported
.. autoexception:: PinPWMFixedValue
Warnings
========
.. autoexception:: GPIOZeroWarning
.. autoexception:: SPIWarning
.. autoexception:: SPISoftwareFallback