Python: module Mock.GPIO

Mock.GPIO | index /home/aananth/workspace/github/Mock.GPIO/Mock/GPIO.py

`Mock Library for RPi.GPIO`

Modules
`` |  |
time |  |  |

Classes
`` |  | Channel PWM
class Channel
`` |  | Methods defined here: __init__(self, channel, direction, initial=0, pull_up_down=20)
class PWM
`` |  | Methods defined here: ChangeDutyCycle(self, dutycycle) `Change the duty cycle dutycycle - between 0.0 and 100.0` ChangeFrequency(self, frequency) `Change the frequency frequency - frequency in Hz (freq > 1.0)` __init__(self, channel, frequency) `x.__init__(...) initializes x; see help(type(x)) for signature` start(self, dutycycle) `Start software PWM dutycycle - the duty cycle (0.0 to 100.0)` stop(self) `# stop PWM generation`

Functions
`` |  | add_event_callback(channel, callback) `Add a callback for an event already defined using add_event_detect() channel - either board pin number or BCM number depending on which mode is set. callback - a callback function` add_event_detect(channel, edge, callback, bouncetime) `Enable edge detection events for a particular GPIO channel. channel - either board pin number or BCM number depending on which mode is set. edge - RISING, FALLING or BOTH [callback] - A callback function for the event (optional) [bouncetime] - Switch bounce timeout in ms for callback` cleanup(channel=None) `Clean up by resetting all GPIO channels that have been used by this program to INPUT with no pullup/pulldown and no event detection [channel] - individual channel or list/tuple of channels to clean up. Default - clean every channel that has been used.` event_detected(channel) `Returns True if an edge has occurred on a given GPIO. You need to enable edge detection using add_event_detect() first. channel - either board pin number or BCM number depending on which mode is set.` getmode() `Get numbering mode used for channel numbers. Returns BOARD, BCM or None` gpio_function(channel) `Return the current GPIO function (IN, OUT, PWM, SERIAL, I2C, SPI) channel - either board pin number or BCM number depending on which mode is set.` input(channel) `Input from a GPIO channel. Returns HIGH=1=True or LOW=0=False channel - either board pin number or BCM number depending on which mode is set.` output(channel, value) `Output to a GPIO channel or list of channels channel - either board pin number or BCM number depending on which mode is set. value - 0/1 or False/True or LOW/HIGH` remove_event_detect(channel) `Remove edge detection for a particular GPIO channel channel - either board pin number or BCM number depending on which mode is set.` setmode(mode) `Set up numbering mode to use for channels. BOARD - Use Raspberry Pi board numbers BCM - Use Broadcom GPIO 00..nn numbers` setup(channel, direction, initial=0, pull_up_down=20) `Set up a GPIO channel or list of channels with a direction and (optional) pull/up down control channel - either board pin number or BCM number depending on which mode is set. direction - IN or OUT [pull_up_down] - PUD_OFF (default), PUD_UP or PUD_DOWN [initial] - Initial value for an output channel` setwarnings(flag) `Enable or disable warning messages` wait_for_edge(channel, edge, bouncetime, timeout) `Wait for an edge. Returns the channel number or None on timeout. channel - either board pin number or BCM number depending on which mode is set. edge - RISING, FALLING or BOTH [bouncetime] - time allowed between calls to allow for switchbounce [timeout] - timeout in ms`

Data
`` |  | BCM = 11 BOARD = 10 BOTH = 33 FALLING = 32 HARD_PWM = 43 HIGH = 1 I2C = 42 IN = 1 LOW = 0 OUT = 0 PUD_DOWN = 21 PUD_OFF = 20 PUD_UP = 22 RISING = 31 RPI_INFO = {'MANUFACTURER': 'Sony', 'P1_REVISION': 3, 'PROCESSOR': 'BCM2837', 'RAM': '1G', 'REVISION': 'a020d3', 'TYPE': 'Pi 3 Model B+'} RPI_REVISION = 3 SERIAL = 40 SPI = 41 UNKNOWN = -1 VERSION = '0.7.0' channel_config = {} setModeDone = False