Metadata-Version: 2.1
Name: e220_900t22s
Version: 1.0.0
Summary: E220-900T22S Python Library for Raspberry Pi.
Project-URL: Homepage, https://github.com/taogya/RPi_E220-900T22S_LoRa_library
Project-URL: Bug Tracker, https://github.com/taogya/RPi_E220-900T22S_LoRa_library/issues
Author-email: Taogya <132679709+taogya@users.noreply.github.com>
License: BSD 3-Clause License
        
        Copyright (c) 2023, Taogya
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
        
        ===== e220_900t22s/base_enums.py ==================================================
        Target
           class Promise
           class ChoicesMeta(enum.EnumMeta)
           class Choices(enum.Enum, metaclass=ChoicesMeta)
           class IntegerChoices(int, Choices)
           class TextChoices(str, Choices)
        License
           Copyright (c) Django Software Foundation and individual contributors.
           All rights reserved.
           
           Redistribution and use in source and binary forms, with or without modification,
           are permitted provided that the following conditions are met:
           
               1. Redistributions of source code must retain the above copyright notice,
                  this list of conditions and the following disclaimer.
           
               2. Redistributions in binary form must reproduce the above copyright
                  notice, this list of conditions and the following disclaimer in the
                  documentation and/or other materials provided with the distribution.
           
               3. Neither the name of Django nor the names of its contributors may be used
                  to endorse or promote products derived from this software without
                  specific prior written permission.
           
           THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
           ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
           WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
           DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
           ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
           (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
           LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
           ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
           (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
           SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
        =============================================================
License-File: LICENSE
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: pyserial>=3.5
Requires-Dist: rpi-gpio-helper>=2.2.1
Description-Content-Type: text/markdown

# RPi_E220-900T22S_LoRa_library
E220-900T22S Python Library for Raspberry Pi

# Installation
```
pip install rpi-e220-900t22s-lora-library
```

# Example
```sh
# uart setup
sudo usermod -aG dialout <username>
sudo usermod -aG gpio <username>
sudo raspi-config
    -> Interface Options
    -> Serial Port
    -> PC serial: no
    -> Hardware serial: yes
    -> ok
# reboot
```
```python
from e220_900t22s.module import E220_900T22S
from e220_900t22s.register import Register
from e220_900t22s.enums import (SerialPortRateChoices, AirDataRateChoices, 
                                SubPacketLengthChoices, TxPowerChoices, 
                                TxMethodChoices, WORCycleChoices, Mode)
from RPi_GPIO_Helper import GPIO

# Port Initialize
dev = '/dev/ttyS0'
m0 = 23
m1 = 24
aux = 25
GPIO.cleanup(m0)
GPIO.cleanup(m1)
GPIO.cleanup(aux)
GPIO.setmode(GPIO.BCM)

# Register Setting
reg = Register(
    address=0x0000,
    serial_port_rate=SerialPortRateChoices.BPS9600,
    air_data_rate=AirDataRateChoices.BPS1758_SF9_BW125KHZ,
    sub_packet_length=SubPacketLengthChoices.BYTE200,
    rssi_noise_enable=True,
    tx_power=TxPowerChoices.DBM13,
    channel=0,
    rssi_byte_enable=True,
    tx_method=TxMethodChoices.FIX,
    wor_cycle=WORCycleChoices.MS2000,
    crypt_key=0x0000,
)
module = E220_900T22S.create(reg, dev, m0, m1, aux)
module.configure()
module.change_mode(Mode.NORMAL)

# Sender
ret = module.send(0x0000, 0, bytes('Hello world'))

# Receiver
ret = module.read()
print(ret)

module.change_mode(Mode.SLEEP)
module.close()
```
