not connected. rm sim bits
parent
091ea48b50
commit
2dbfd10b31
|
@ -25,29 +25,6 @@ from drivers.cst816s import CST816S
|
||||||
from drivers.st7789 import ST7789_SPI
|
from drivers.st7789 import ST7789_SPI
|
||||||
from drivers.vibrator import Vibrator
|
from drivers.vibrator import Vibrator
|
||||||
|
|
||||||
class Accelerometer:
|
|
||||||
"""Simulated accelerometer.
|
|
||||||
|
|
||||||
Accelerometers such as BMA421 are complex and most of the driver
|
|
||||||
is written in C. For that reason we simulate the accelerometer
|
|
||||||
rather than emulate (by comparison we emulate the ST7789).
|
|
||||||
"""
|
|
||||||
def reset(self):
|
|
||||||
self._steps = 3
|
|
||||||
|
|
||||||
@property
|
|
||||||
def steps(self):
|
|
||||||
"""Report the number of steps counted."""
|
|
||||||
if self._steps < 10000:
|
|
||||||
self._steps = int(self._steps * 1.34)
|
|
||||||
else:
|
|
||||||
self._steps += 1
|
|
||||||
return self._steps
|
|
||||||
|
|
||||||
@steps.setter
|
|
||||||
def steps(self, value):
|
|
||||||
self.reset()
|
|
||||||
|
|
||||||
class Backlight(object):
|
class Backlight(object):
|
||||||
def __init__(self, level=1):
|
def __init__(self, level=1):
|
||||||
pass
|
pass
|
||||||
|
@ -142,15 +119,11 @@ display = ST7789_SPI(240, 240, spi,
|
||||||
res=Pin("DISP_RST", Pin.OUT, quiet=True))
|
res=Pin("DISP_RST", Pin.OUT, quiet=True))
|
||||||
drawable = draw565.Draw565(display)
|
drawable = draw565.Draw565(display)
|
||||||
|
|
||||||
accel = Accelerometer()
|
|
||||||
battery = Battery()
|
battery = Battery()
|
||||||
button = Pin('BUTTON', Pin.IN, quiet=True)
|
button = Pin('BUTTON', Pin.IN, quiet=True)
|
||||||
rtc = RTC()
|
rtc = RTC()
|
||||||
touch = CST816S(I2C(0), Pin('TP_INT', Pin.IN, quiet=True), Pin('TP_RST', Pin.OUT, quiet=True))
|
touch = CST816S(I2C(0), Pin('TP_INT', Pin.IN, quiet=True), Pin('TP_RST', Pin.OUT, quiet=True))
|
||||||
vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True)
|
vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True)
|
||||||
|
|
||||||
def connected():
|
|
||||||
return not (int(rtc.uptime / 30) & 1)
|
|
||||||
|
|
||||||
# Free memory cannot be measured on the simulator
|
# Free memory cannot be measured on the simulator
|
||||||
free = 0
|
free = 0
|
||||||
|
|
|
@ -136,13 +136,7 @@ class NotificationBar:
|
||||||
draw = watch.drawable
|
draw = watch.drawable
|
||||||
(x, y) = self._pos
|
(x, y) = self._pos
|
||||||
|
|
||||||
if wasp.watch.connected():
|
|
||||||
if wasp.system.notifications:
|
if wasp.system.notifications:
|
||||||
draw.blit(icons.notification, x+22, y,
|
|
||||||
fg=wasp.system.theme('notify-icon'))
|
|
||||||
else:
|
|
||||||
draw.fill(0, x+22, y, 30, 32)
|
|
||||||
elif wasp.system.notifications:
|
|
||||||
draw.blit(icons.notification, x, y,
|
draw.blit(icons.notification, x, y,
|
||||||
fg=wasp.system.theme('notify-icon'))
|
fg=wasp.system.theme('notify-icon'))
|
||||||
draw.fill(0, x+30, y, 22, 32)
|
draw.fill(0, x+30, y, 22, 32)
|
||||||
|
|
Loading…
Reference in New Issue