Skip to content

Commit 0623cde

Browse files
committed
添加了machine OneWire的接口
1 parent dbd7fab commit 0623cde

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

quecpython_stubs/machine.pyi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,3 +849,42 @@ class KeyPad(object):
849849
850850
:return: 0 - Successful execution; -1 - Failed execution
851851
"""
852+
853+
854+
class OneWire(object):
855+
"""Single-Wire Bus Communication
856+
857+
https://developer.quectel.com/doc/quecpython/API_reference/zh/peripherals/machine.OneWire.html
858+
859+
This class provides single-wire (1-Wire) communication functionality.
860+
Currently only supported on EC200U/EC600U/EG912U/EG915U series modules.
861+
"""
862+
863+
def __init__(self, GPIO):
864+
"""
865+
Create a OneWire object.
866+
867+
:param GPIO: int type. The GPIO pin number to use (e.g., OneWire.GPIO19).
868+
"""
869+
870+
def reset(self):
871+
"""Reset the bus and check device response
872+
873+
Usage note: This method must be called before any read/write operations.
874+
875+
:return: Integer value. 0 indicates proper response from device, -1 indicates no response.
876+
"""
877+
878+
def read(self, len):
879+
"""Read data from the bus
880+
881+
:param len: int type. Length of data to read.
882+
:return: bytes object containing the read data.
883+
"""
884+
885+
def write(self, data):
886+
"""Write data to the bus
887+
888+
:param data: bytes type. Data to be written.
889+
:return: Integer value 0.
890+
"""

0 commit comments

Comments
 (0)