From c0a4cd7b9587f73abd4eab49f5f317f6e399a0a5 Mon Sep 17 00:00:00 2001 From: IAMLIUBO Date: Thu, 14 Jan 2021 10:32:07 +0800 Subject: [PATCH 1/3] TTN frequency plan support China 470. --- adafruit_tinylora/adafruit_tinylora.py | 4 +++ adafruit_tinylora/ttn_cn.py | 37 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 adafruit_tinylora/ttn_cn.py diff --git a/adafruit_tinylora/adafruit_tinylora.py b/adafruit_tinylora/adafruit_tinylora.py index 61255da..acad8e7 100755 --- a/adafruit_tinylora/adafruit_tinylora.py +++ b/adafruit_tinylora/adafruit_tinylora.py @@ -185,6 +185,10 @@ def __init__(self, spi, cs, irq, rst, ttn_config, channel=None): elif ttn_config.country == "EU": from adafruit_tinylora.ttn_eu import TTN_FREQS + self._frequencies = TTN_FREQS + elif ttn_config.country == "CN": + from adafruit_tinylora.ttn_cn import TTN_FREQS + self._frequencies = TTN_FREQS else: raise TypeError("Country Code Incorrect/Unsupported") diff --git a/adafruit_tinylora/ttn_cn.py b/adafruit_tinylora/ttn_cn.py new file mode 100644 index 0000000..7f9606a --- /dev/null +++ b/adafruit_tinylora/ttn_cn.py @@ -0,0 +1,37 @@ +# The MIT License (MIT) +# +# Copyright (c) 2018 Brent Rubell for Adafruit +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`ttn_cn.py` +====================================================== +The Things Network Frequency Plans - CN470 +* Author(s): IAMLIUBO +""" +TTN_FREQS = { + 0: (0x79, 0x93, 0x33), # 486.3 MHz + 1: (0x79, 0xA0, 0x00), # 486.5 MHz + 2: (0x79, 0xAC, 0xCC), # 486.7 MHz + 3: (0x79, 0xB9, 0x99), # 486.9 MHz + 4: (0x79, 0xC6, 0x66), # 487.1 MHz + 5: (0x79, 0xD3, 0x33), # 487.3 MHz + 6: (0x79, 0xE0, 0x00), # 487.5 MHz + 7: (0x79, 0xEC, 0xCC), +} # 487.7 MHz From e2f8ea17d7fc86e28051c5c927614973fcd869c0 Mon Sep 17 00:00:00 2001 From: IAMLIUBO Date: Fri, 15 Jan 2021 22:38:00 +0800 Subject: [PATCH 2/3] Modified ttn_cn.py License. --- adafruit_tinylora/ttn_cn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_tinylora/ttn_cn.py b/adafruit_tinylora/ttn_cn.py index 7f9606a..0d76a7f 100644 --- a/adafruit_tinylora/ttn_cn.py +++ b/adafruit_tinylora/ttn_cn.py @@ -1,6 +1,7 @@ # The MIT License (MIT) # # Copyright (c) 2018 Brent Rubell for Adafruit +# Modified by IAMLIUBO, 2021 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From 4da105a3c60805f50ecfd3a285d05c5e22acace8 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 21 Jan 2021 21:23:28 -0500 Subject: [PATCH 3/3] Added licensing information to ttn_cn.py --- adafruit_tinylora/ttn_cn.py | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/adafruit_tinylora/ttn_cn.py b/adafruit_tinylora/ttn_cn.py index 0d76a7f..32c2fcf 100644 --- a/adafruit_tinylora/ttn_cn.py +++ b/adafruit_tinylora/ttn_cn.py @@ -1,25 +1,8 @@ -# The MIT License (MIT) +# SPDX-FileCopyrightText: 2018 Brent Rubell for Adafruit Industries +# SPDX-FileCopyrightText: 2021 IAMLIUBO # -# Copyright (c) 2018 Brent Rubell for Adafruit -# Modified by IAMLIUBO, 2021 -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# SPDX-License-Identifier: MIT + """ `ttn_cn.py` ======================================================