Metadata-Version: 2.1
Name: gpiod
Version: 0.6.0
Summary: UNKNOWN
Home-page: https://github.com/hhk7734/python3-gpiod
Author: Hyeonki Hong
Author-email: hhk7734@gmail.com
License: MIT
Project-URL: Source, https://github.com/hhk7734/python3-gpiod.git
Description: ![license](https://img.shields.io/github/license/hhk7734/python3-gpiod)
        ![pypi](https://img.shields.io/pypi/v/gpiod)
        ![language](https://img.shields.io/github/languages/top/hhk7734/python3-gpiod)
        
        # python3-gpiod
        
        Ref: <a href="https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git" target=_blank>https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git</a>
        
        ## Installation
        
        ```shell
        sudo apt update \
        && sudo apt install -y python3 python3-dev python3-pip pkg-config \
            gpiod libgpiod-dev
        ```
        
        ```shell
        python3 -m pip install -U --user pip gpiod
        ```
        
        If you see **"OSError: pkg-config: Failed to find libgpiodcxx."**, you need to install libgpiodcxx manually.
        
        ```shell
        sudo apt purge -y gpiod libgpiod-dev
        ```
        
        ```shell
        sudo apt install -y git libtool autoconf-archive
        ```
        
        ```shell
        git clone git://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git \
        && cd libgpiod
        ```
        
        If the kernel version is 5.4 or lower, use **`git checkout v1.4.2`** to change the version.(Change it to v1.1 or more and less than v1.5)
        
        ```shell
        ./autogen.sh --enable-tools=yes --prefix=/usr --enable-bindings-cxx \
        && make \
        && sudo make install
        ```
        
        ```shell
        python3 -m pip install -U --user gpiod
        ```
        
        ## help command
        
        ```python
        >>> import gpiod
        >>> help(gpiod)
        >>> help(gpiod.chip)
        >>> help(gpiod.chip.get_line)
        
        Help on instancemethod in module gpiod._gpiod:
        
        get_line(...)
            get_line(self: gpiod._gpiod.chip, offset: int) -> gpiod::line
        
            /**
             * @brief Get the line exposed by this chip at given offset.
             * @param offset Offset of the line.
             * @return Line object.
             */
        ```
        
        ## Test
        
        ```shell
        python3 -m gpiod.test.blink <chip> <line offset>
        python3 -m gpiod.test.blinks <chip> <line offset1> [<line offset2> ...]
        python3 -m gpiod.test.sequential_blink <chip> <line offset1> \
            [<line offset2> ...]
        python3 -m gpiod.test.button <chip> <line offset> [rising|falling|both]
        ```
        
        ## Blink example
        
        ### Python3
        
        ```python
        import gpiod
        import sys
        import time
        
        if len(sys.argv) > 2:
            LED_CHIP = sys.argv[1]
            LED_LINE_OFFSET = int(sys.argv[2])
        else:
            print('''Usage:
            python3 blink.py <chip> <line offset>''')
            sys.exit()
        
        chip = gpiod.chip(LED_CHIP)
        led = chip.get_line(LED_LINE_OFFSET)
        
        config = gpiod.line_request()
        config.consumer = "Blink"
        config.request_type = gpiod.line_request.DIRECTION_OUTPUT
        
        led.request(config)
        
        while True:
            led.set_value(0)
            time.sleep(0.1)
            led.set_value(1)
            time.sleep(0.1)
        ```
        
        ### C++
        
        ```c++
        #include <chrono>
        #include <cstdlib>
        #include <gpiod.hpp>
        #include <iostream>
        #include <string>
        #include <thread>
        
        int main(int argc, char **argv) {
            std::string LED_CHIP;
            int         LED_LINE_OFFSET;
        
            if(argc > 2) {
                LED_CHIP        = argv[1];
                LED_LINE_OFFSET = std::stoi(argv[2]);
            } else {
                std::cout << "Usage:" << std::endl
                          << "    ./blink <chip> <line offset>" << std::endl;
                std::exit(0);
            }
        
            gpiod::chip chip(LED_CHIP);
            gpiod::line led = chip.get_line(LED_LINE_OFFSET);
        
            gpiod::line_request config;
            config.consumer     = "Blink";
            config.request_type = gpiod::line_request::DIRECTION_OUTPUT;
        
            led.request(config);
        
            while(1) {
                led.set_value(0);
                std::this_thread::sleep_for(std::chrono::milliseconds(100));
                led.set_value(1);
                std::this_thread::sleep_for(std::chrono::milliseconds(100));
            }
        }
        ```
        
        ```shell
        g++ -o blink test.cpp -lgpiodcxx
        ```
        
        ## Changelog
        
        Ref: CHANGELOG
        
        python3-gpiod (0.6.0) unstable; urgency=medium
        
          * Fix issue where 'setup.py clean' is not executed
          * Correct error messages to be noticeable
          * Fix iterator in line_bulk class
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Thu, 02 Apr 2020 14:55:17 +0900
        
        python3-gpiod (0.5.4) unstable; urgency=medium
        
          * Update README.md
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Mon, 30 Mar 2020 20:04:10 +0900
        
        python3-gpiod (0.5.3) unstable; urgency=medium
        
          * Add std::bitset<32> type caster
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Thu, 26 Mar 2020 11:39:33 +0900
        
        python3-gpiod (0.5.2) unstable; urgency=medium
        
          * Add documentation for tested methods
          * Add test code
          * Update README.md
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Fri, 20 Mar 2020 13:17:41 +0900
        
        python3-gpiod (0.5.1) unstable; urgency=medium
        
          * Move xxx class into xxx_wrapper.h
          * Add blink test module
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Fri, 20 Mar 2020 00:58:05 +0900
        
        python3-gpiod (0.5.0) unstable; urgency=medium
        
          * Add pybind11/chrono.h for std::chrono
          * Prevent installation if libgpiodcxx v1.0 or lower
          * Add xxx_lines into chip class
          * Add operators
          * Add MAX_LINES attribute
          * Fix issue where 'setup.py sdist' is not executed
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Sat, 14 Mar 2020 02:37:13 +0900
        
        python3-gpiod (0.4.1) unstable; urgency=medium
        
          * Fix issue where pip does not install dependencies
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Thu, 12 Mar 2020 19:11:24 +0900
        
        python3-gpiod (0.4.0) unstable; urgency=medium
        
          * Add libgpiodcxx version check
          * Remove -std=c++11 option
          * Add line_bulk, chip_iter, line_iter classes
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Thu, 12 Mar 2020 14:18:16 +0900
        
        python3-gpiod (0.3.0) unstable; urgency=medium
        
          * Add open, reset function
          * Add LICENSE
          * Create README.md
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Wed, 11 Mar 2020 18:58:14 +0900
        
        python3-gpiod (0.2.0) unstable; urgency=medium
        
          * Add chip, line_request, line, line_event class
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Wed, 11 Mar 2020 13:28:45 +0900
        
        python3-gpiod (0.1.0) unstable; urgency=medium
        
          * Add initial setup files
        
         -- Hyeonki Hong <hhk7734@gmail.com>  Tue, 10 Mar 2020 15:40:13 +0900
        
Keywords: GPIO,gpiod
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: Topic :: System :: Hardware
Description-Content-Type: text/markdown
