File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed
m5stack/libs/driver/fpc1020a/fpc1020a Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change 22#
33# SPDX-License-Identifier: MIT
44
5- from machine import UART
5+ import machine
66from micropython import const
7-
8- try :
9- import struct
10- except ImportError :
11- import ustruct as struct
12-
13- try :
14- from typing import Literal , Union
15- except ImportError :
16- pass
17-
7+ import struct
8+ import sys
189import time
1910import binascii
20-
11+ import warnings
2112from . import types as t
2213
14+ if sys .platform != "esp32" :
15+ from typing import Literal , Union
16+
2317
2418class CommandId :
2519 SLEEP = const (0x2C )
@@ -107,15 +101,15 @@ class FPC1020A:
107101 REPEAT_ALLOWED = 0x00
108102 NO_REPETITION = 0x01
109103
110- def __init__ (self , uart : UART , verbose = False ) -> None :
104+ def __init__ (self , uart : machine . UART , verbose = False ) -> None :
111105 self ._uart = uart
112106 self ._verbose = verbose
113107 self ._add_mode = self .NO_REPETITION
114108 self ._match_level = 5
115109 while self ._uart .any ():
116110 self ._uart .read (self ._uart .any ())
117111 if self .get_version () not in ("B1.10.00" , "B1.07.00" ):
118- raise RuntimeError ( "FPC1020A not found" )
112+ warnings . warn ( "Version mismatch or no device found" )
119113
120114 def sleep (self ) -> bool :
121115 """After calling this method successfully, FPC1020A will not be able to
You can’t perform that action at this time.
0 commit comments