11from micropython import const
2- import uos as os
3- import machine , ubinascii
4- import utime as time
5- from utime import ticks_ms
2+ import os , time , machine , ubinascii
63import display as lcd
74import utils
85
9- VERSION = "v0.3.8 "
6+ VERSION = "v0.3.9 "
107
118_BUTTON_A_PIN = const (39 )
129_BUTTON_B_PIN = const (38 )
@@ -37,9 +34,9 @@ def irq_cb(self, pin):
3734 if self ._pin == pin :
3835 # FALLING
3936 if pin_val == 0 :
40- if ticks_ms () - self ._timeshoot > self ._dbtime :
37+ if time . ticks_ms () - self ._timeshoot > self ._dbtime :
4138 self ._lastState = True
42- self ._startTicks = ticks_ms ()
39+ self ._startTicks = time . ticks_ms ()
4340 self ._event |= 0x02 # EVENT_WAS_PRESSED
4441 if self ._wasPressed_cb :
4542 self ._wasPressed_cb ()
@@ -51,11 +48,11 @@ def irq_cb(self, pin):
5148 if self ._wasReleased_cb :
5249 self ._wasReleased_cb ()
5350 if self ._timeout > 0 :
54- if ticks_ms () - self ._startTicks > self ._timeout :
51+ if time . ticks_ms () - self ._startTicks > self ._timeout :
5552 self ._event |= 0x08 # EVENT_RELEASED_FOR
5653 if self ._releasedFor_cb :
5754 self ._releasedFor_cb ()
58- self ._timeshoot = ticks_ms ()
55+ self ._timeshoot = time . ticks_ms ()
5956
6057
6158 def read (self ):
@@ -93,7 +90,7 @@ def wasReleased(self, callback=None):
9390
9491
9592 def pressedFor (self , timeout ):
96- if self ._lastState and ticks_ms () - self ._startTicks > timeout * 1000 :
93+ if self ._lastState and time . ticks_ms () - self ._startTicks > timeout * 1000 :
9794 return True
9895 else :
9996 return False
@@ -156,9 +153,9 @@ def delay(ms):
156153
157154# LCD
158155lcd = lcd .TFT ()
159- lcd .init (lcd .M5STACK , width = 240 , height = 320 , rst_pin = 33 , backl_pin = 32 , miso = 19 , mosi = 23 , clk = 18 , cs = 14 , dc = 27 , bgr = True , backl_on = 1 , invrot = 3 )
156+ lcd .init (lcd .M5STACK , width = 240 , height = 320 , speed = 27000000 , rst_pin = 33 , backl_pin = 32 , miso = 19 , mosi = 23 , clk = 18 , cs = 14 , dc = 27 , bgr = True , backl_on = 1 , invrot = 3 )
160157lcd .clear ()
161- lcd .setBrightness (600 )
158+ lcd .setBrightness (500 )
162159lcd .setColor (0xCCCCCC )
163160lcd .println ('M5Stack MicroPython ' + VERSION , 0 , 0 )
164161lcd .println ('Device ID:' + node_id )
0 commit comments