diff --git a/docs/Mock.GPIO.html b/docs/Mock.GPIO.html index a9647bd..ce69b88 100644 --- a/docs/Mock.GPIO.html +++ b/docs/Mock.GPIO.html @@ -1,118 +1,144 @@ - - -Python: module Mock.GPIO + + + - +Python: module Mock.GPIO + - - -
 
- 
Mock.GPIO
index
/home/aananth/workspace/github/Mock.GPIO/Mock/GPIO.py
-

Mock Library for RPi.GPIO

+ + + +
 
Mock.GPIO
index
/Users/aananth.k/workspace/personal/github/Mock.GPIO/Mock/GPIO.py
+

Mock Library for RPi.GPIO

+Copyright (c) 2025 codenio ( Aananth K )
+SPDX-License-Identifier: GPL-3.0-only

- - - +
 
-Modules
+ + - -
 
Modules
       
time
-

- - - + +
 
-Classes
       
logging
+
os
+

+ + + - - +
 
Classes
       
-
Channel -
PWM -
+
       
+
builtins.object +
+
+
Channel +
PWM +
+
+

- - - +
 
-class Channel
+ + - - + + +
 
class Channel(builtins.object)
    Methods defined here:
-
__init__(self, channel, direction, initial=0, pull_up_down=20)
+
   Channel(channel, direction, initial=0, pull_up_down=20)

+
 
 Methods defined here:
+
__init__(self, channel, direction, initial=0, pull_up_down=20)
Initialize self.  See help(type(self)) for accurate signature.
+
+Data descriptors defined here:
+
__dict__
+
dictionary for instance variables
+
+
__weakref__
+
list of weak references to the object
+

- - - +
 
-class PWM
+ + - - + + +
 
class PWM(builtins.object)
    Methods defined here:
-
ChangeDutyCycle(self, dutycycle)
Change the duty cycle
-dutycycle - between 0.0 and 100.0
+
   PWM(channel, frequency)

+
 
 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)
+
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
+
__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)
+
start(self, dutycycle)
Start software PWM
+dutycycle - the duty cycle (0.0 to 100.0)
-
stop(self)
# stop PWM generation
+
stop(self)
# stop PWM generation
+
+Data descriptors defined here:
+
__dict__
+
dictionary for instance variables
+
+
__weakref__
+
list of weak references to the object
+

- - - +
 
-Functions
+ + - - +
 
Functions
       
add_event_callback(channel, callback)
Add a callback for an event already defined using add_event_detect()
+
       
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.
+callback     - a callback function
+
add_event_detect(channel, edge, callback=None, bouncetime=None)
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.
+[bouncetime] - Switch bounce timeout in ms for callback
+
cleanup(channels=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
+[channels] - 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(channels, values)
Output to a GPIO channel or list of channels
+channels - either board pin number or BCM number depending on which mode is set.
+values   - 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.
+BCM   - Use Broadcom GPIO 00..nn numbers
+
setup(channels, 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
+channels        - 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.
+[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
+[timeout]    - timeout in ms

- - - +
 
-Data
+ + - - +
 
Data
       BCM = 11
+
       BCM = 11
BOARD = 10
BOTH = 33
FALLING = 32
@@ -133,5 +159,9 @@ UNKNOWN = -1
VERSION = '0.7.0'
channel_config = {}
-setModeDone = False
+log_level = None
+logger = <Logger Mock.GPIO (ERROR)>
+setModeDone = False
+stream_formatter = <logging.Formatter object>
+stream_handler = <StreamHandler <stderr> (NOTSET)> \ No newline at end of file diff --git a/setup.py b/setup.py index 8ff40e9..af34db9 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +from pathlib import Path from distutils.util import convert_path from setuptools import setup, find_packages @@ -5,48 +6,7 @@ # Copyright (c) 2025 codenio ( Aananth K ) # SPDX-License-Identifier: GPL-3.0-only - -long_description = """ -# GPIOEmulator - -The easiest way to use this package is to install using pip3 for python 3 - -```bash -$ sudo pip3 install Mock.GPIO -``` - -To use the emulator just type the following at the beginning of your script. - -```python -from Mock.GPIO import GPIO -``` - -## Works with - -- [python 3.6.8](https://www.python.org/downloads/release/3.6.8) - -## Simulation - -This library simulates the following functions which are used in the RPi.GPIO library. - -- GPIO.setmode() -- GPIO.getmode() -- GPIO.setwarnings() -- GPIO.setup() -- GPIO.output() -- GPIO.input() -- GPIO.wait_for_edge() -- GPIO.add_event_detect() -- GPIO.event_detected() -- GPIO.add_event_callback() -- GPIO.remove_event_detect() -- GPIO.gpio_function() -- GPIO.start() -- GPIO.ChangeFrequency() -- GPIO.ChangeDutyCycle() -- GPIO.stop() -- GPIO.cleanup() -""" +readme = Path(__file__).with_name("README.md").read_text(encoding="utf-8") pkg_ns = {} @@ -58,7 +18,7 @@ name="Mock.GPIO", version=pkg_ns["__version__"], description="Mock Library for RPi.GPIO", - url="https://github.com/codenio/", + url="https://github.com/codenio/Mock.GPIO", author="Aananth K", author_email="aananthraj1995@gmail.com", license="GPL-3.0", @@ -66,5 +26,5 @@ install_requires=[], zip_safe=False, long_description_content_type="text/markdown", - long_description=long_description, + long_description=readme, )