Skip to content

Commit d9f3664

Browse files
committed
libs/module/nbiot.py: Add NBIOT Module support.
Signed-off-by: lbuque <[email protected]>
1 parent 8977e3f commit d9f3664

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

m5stack/libs/module/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"LoRaWANModule": "lorawan",
1717
"LoRaWAN868Module": "lorawan868",
1818
"Module4In8Out": "module_4in8out",
19+
"NBIOTModule": "nbiot",
1920
"PLUSModule": "plus",
2021
"PPSModule": "pps",
2122
"RCAModule": "rca",

m5stack/libs/module/manifest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"mbus.py",
2020
"module_4in8out.py",
2121
"module_helper.py",
22+
"nbiot.py",
2223
"plus.py",
2324
"pps.py",
2425
"rca.py",

m5stack/libs/module/nbiot.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
import machine
6+
from driver.simcom.sim7020 import SIM7020
7+
import sys
8+
9+
if sys.platform != "esp32":
10+
from typing import Literal
11+
12+
13+
class NBIOTModule(SIM7020):
14+
def __init__(self, id: Literal[0, 1, 2], tx: int, rx: int) -> None:
15+
self.uart = machine.UART(
16+
id, tx=tx, rx=rx, baudrate=115200, bits=8, parity=None, stop=1, rxbuf=1024
17+
)
18+
super().__init__(uart=self.uart)
19+
if not self.check_modem_is_ready():
20+
raise Exception("NBIOT module not found in mbus")
21+
self.set_command_echo_mode(0)

0 commit comments

Comments
 (0)