1
0
Fork 0

rm unused boards

jebbatime
ml server 2021-06-14 12:16:18 -06:00
parent ad6883b450
commit 7f47e75b67
12 changed files with 0 additions and 466 deletions

View File

@ -1,13 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
freeze('../..',
(
'drivers/battery.py',
'drivers/signal.py',
'drivers/vibrator.py',
),
opt=3
)
freeze('.', 'watch.py', opt=3)

View File

@ -1,8 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
from machine import RTCounter as RTC
# Start measuring time (and feeding the watchdog)
rtc = RTC(1, mode=RTC.PERIODIC)
rtc.start()

View File

@ -1,34 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
import os, sys
sys.path.append(os.path.dirname(os.getcwd()))
import manifest_240x240
freeze('.', 'watch.py', opt=3)
freeze('../..', manifest_240x240.manifest +
(
'boot.py',
'draw565.py',
'drivers/bma421.py',
'drivers/battery.py',
'drivers/hrs3300.py',
'drivers/nrf_rtc.py',
'drivers/signal.py',
'drivers/st7789.py',
'drivers/touch.py',
'drivers/vibrator.py',
'gadgetbridge.py',
'ppg.py',
'shell.py',
'wasp.py',
),
opt=3
)
freeze('../../drivers/flash',
(
'bdevice.py',
'flash/flash_spi.py'
), opt=3
)

View File

@ -1,141 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
def nop():
pass
schedule = nop
def _callback(obj):
schedule()
# Start measuring time (and feeding the watchdog) before *anything* else
from machine import RTCounter
from drivers.nrf_rtc import RTC
rtc = RTC(RTCounter(1, mode=RTCounter.PERIODIC, period=1, callback=_callback))
rtc.counter.start()
import gc
import os
import time
import draw565
from machine import I2C
from machine import Pin
#from machine import Signal
from machine import SPI
from drivers.battery import Battery
from drivers.bma421 import BMA421
from drivers.touch import TouchButton
from drivers.hrs3300 import HRS3300
from drivers.signal import Signal
from drivers.st7789 import ST7789_SPI
from drivers.vibrator import Vibrator
from flash.flash_spi import FLASH
from ubluepy import uart_connected as connected
class Backlight(object):
lo = Pin("BL_LO", Pin.OUT, value=0)
mid = Pin("BL_MID", Pin.OUT, value=1)
hi = Pin("BL_HI", Pin.OUT, value=1)
def __init__(self, level=1):
self.set(level)
def set(self, level):
"""K9 backlight is very weak so we avoid lo in its own because it is
pointless.
"""
hi = 1
mid = 1
lo = 0
if level >= 3:
hi = 0
mid = 0
elif level == 2:
hi = 0
elif level == 1:
mid = 0
else:
lo = 1
self.hi(hi)
self.mid(mid)
self.lo(lo)
# Setup the display (and manage the backlight)
backlight = Backlight(0)
spi = SPI(0)
spi.init(polarity=1, phase=1, baudrate=8000000)
display = ST7789_SPI(240, 240, spi,
cs=Pin("DISP_CS", Pin.OUT),
dc=Pin("DISP_DC", Pin.OUT),
res=Pin("DISP_RST", Pin.OUT))
drawable = draw565.Draw565(display)
def boot_msg(s):
drawable.string(s, 0, 108, width=240)
if safe_mode:
time.sleep_ms(500)
safe_mode = False
boot_msg("Init button")
button = Pin('BUTTON', Pin.IN)
safe_mode = button.value()
if safe_mode:
backlight.set(2)
time.sleep(1)
try:
# Setup the last few bits and pieces
boot_msg("Init battery")
battery = Battery(
Pin('BATTERY', Pin.IN),
Signal(Pin('CHARGING', Pin.IN), invert=True),
Signal(Pin('USB_PWR', Pin.IN), invert=True))
boot_msg("Init I2C")
i2c = I2C(1, scl='I2C_SCL', sda='I2C_SDA')
boot_msg("Init BMA421")
accel = BMA421(i2c)
boot_msg("Init HRS3300")
hrs = HRS3300(i2c)
boot_msg("Init touch")
touch = TouchButton(Pin('TP_INT', Pin.IN),
Pin('TP_RST', Pin.OUT, value=0), _callback)
boot_msg("Init motor")
vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True)
# Mount the filesystem
boot_msg("Init SPINOR")
flash = FLASH(spi, (Pin('NOR_CS', Pin.OUT, value=1),))
try:
boot_msg("Mount FS")
os.mount(flash, '/flash')
except AttributeError:
# Format the filesystem (and provide a default version of main.py)
boot_msg("Format FS")
os.VfsLfs2.mkfs(flash)
boot_msg("Retry mount FS")
os.mount(flash,'/flash')
boot_msg("Write main.py")
with open('/flash/main.py', 'w') as f:
f.write('''\
#include('main.py')
''')
# Only change directory if the button is not pressed (this will
# allow us access to fix any problems with main.py)!
if not safe_mode:
boot_msg("Enter /flash")
os.chdir('/flash')
boot_msg("main.py")
else:
boot_msg("Safe mode")
except:
drawable.string("FAILED", 0, 136, width=240)
backlight.set(2)
gc.collect()
free = gc.mem_free()

View File

@ -1,14 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
freeze('../..',
(
'drivers/battery.py',
'drivers/signal.py',
'drivers/st7789.py',
'drivers/vibrator.py',
),
opt=3
)
freeze('.', 'watch.py', opt=3)

View File

@ -1,8 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
from machine import RTCounter as RTC
# Start measuring time (and feeding the watchdog)
rtc = RTC(1, mode=RTC.PERIODIC)
rtc.start()

View File

@ -1,34 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
import os, sys
sys.path.append(os.path.dirname(os.getcwd()))
import manifest_240x240
freeze('.', 'watch.py', opt=3)
freeze('../..', manifest_240x240.manifest +
(
'boot.py',
'draw565.py',
'drivers/bma421.py',
'drivers/battery.py',
'drivers/cst816s.py',
'drivers/hrs3300.py',
'drivers/nrf_rtc.py',
'drivers/signal.py',
'drivers/st7789.py',
'drivers/vibrator.py',
'gadgetbridge.py',
'ppg.py',
'shell.py',
'wasp.py',
),
opt=3
)
freeze('../../drivers/flash',
(
'bdevice.py',
'flash/flash_spi.py'
), opt=3
)

View File

@ -1,129 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
def nop():
pass
schedule = nop
def _callback(obj):
schedule()
# Start measuring time (and feeding the watchdog) before *anything* else
from machine import RTCounter
from drivers.nrf_rtc import RTC
rtc = RTC(RTCounter(1, mode=RTCounter.PERIODIC, period=1, callback=_callback))
rtc.counter.start()
import gc
import os
import time
import draw565
from machine import I2C
from machine import Pin
#from machine import Signal
from machine import SPI
from drivers.battery import Battery
from drivers.bma421 import BMA421
from drivers.cst816s import CST816S
from drivers.hrs3300 import HRS3300
from drivers.signal import Signal
from drivers.st7789 import ST7789_SPI
from drivers.vibrator import Vibrator
from flash.flash_spi import FLASH
from ubluepy import uart_connected as connected
class Backlight(object):
lo = Pin("BL_LO", Pin.OUT, value=0)
mid = Pin("BL_MID", Pin.OUT, value=1)
hi = Pin("BL_HI", Pin.OUT, value=1)
def __init__(self, level=1):
self.set(level)
def set(self, level):
hi = 1
mid = 1
lo = 1
if level >= 3:
hi = 0
elif level == 2:
mid = 0
elif level == 1:
lo = 0
self.hi(hi)
self.mid(mid)
self.lo(lo)
# Setup the display (and manage the backlight)
backlight = Backlight(0)
spi = SPI(0)
spi.init(polarity=1, phase=1, baudrate=8000000)
display = ST7789_SPI(240, 240, spi,
cs=Pin("DISP_CS", Pin.OUT),
dc=Pin("DISP_DC", Pin.OUT),
res=Pin("DISP_RST", Pin.OUT))
drawable = draw565.Draw565(display)
def boot_msg(s):
drawable.string(s, 0, 108, width=240)
if safe_mode:
time.sleep_ms(500)
safe_mode = False
boot_msg("Init button")
button = Pin('BUTTON', Pin.IN)
safe_mode = button.value()
if safe_mode:
backlight.set(1)
time.sleep(1)
try:
# Setup the last few bits and pieces
boot_msg("Init hardware")
usb_pwr = Signal(Pin('USB_PWR', Pin.IN), invert=True)
battery = Battery(Pin('BATTERY', Pin.IN), usb_pwr, usb_pwr)
i2c = I2C(1, scl='I2C_SCL', sda='I2C_SDA')
accel = BMA421(i2c)
hrs = HRS3300(i2c)
touch = CST816S(i2c,
Pin('TP_INT', Pin.IN), Pin('TP_RST', Pin.OUT, value=0),
_callback)
vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True)
# Mount the filesystem
boot_msg("Init SPINOR")
flash = FLASH(spi, (Pin('NOR_CS', Pin.OUT, value=1),))
try:
boot_msg("Mount FS")
os.mount(flash, '/flash')
except AttributeError:
# Format the filesystem (and provide a default version of main.py)
boot_msg("Format FS")
os.VfsLfs2.mkfs(flash)
boot_msg("Retry mount FS")
os.mount(flash,'/flash')
boot_msg("Write main.py")
with open('/flash/main.py', 'w') as f:
f.write('''\
#include('main.py')
''')
# Only change directory if the button is not pressed (this will
# allow us access to fix any problems with main.py)!
if not safe_mode:
boot_msg("Enter /flash")
os.chdir('/flash')
boot_msg("main.py")
else:
boot_msg("Safe mode")
except:
drawable.string("FAILED", 0, 136, width=240)
backlight.set(1)
gc.collect()
free = gc.mem_free()

View File

@ -1,13 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
battery = 'Default battery icon'
bomb = 'Small bomb icon'
app = 'Default application icon'
clock = 'Default digital clock icon'
software = 'Default software application icon'
headset = 'Default music player icon'
settings = 'Default settings icon'
torch = 'Default torch or flashlight icon'
up_arrow = 'Small (16x9) up arrow'
down_arrow = 'Small (16x9) down arrow'

View File

@ -1,11 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
class ADC():
pass
class Pin():
pass
class PWM():
pass

View File

@ -1 +0,0 @@
../simulator/micropython.py

View File

@ -1,60 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
"""Watch driver instances
~~~~~~~~~~~~~~~~~~~~~~~~~
.. data:: watch.backlight
Backlight driver, typically a board specific driver with a single
:py:meth:`set` method.
.. data:: watch.battery
Battery driver, typically the generic metering driver,
:py:class:`drivers.battery.Battery`.
.. data:: watch.button
An instance of machine.Pin (or a signal) that an application can use
to poll the state of the hardware button.
.. data:: watch.display
Display driver, typically :py:class:`drivers.st7789.ST7789_SPI`.
.. data:: watch.drawable
Drawing library for :py:data:`watch.display`. It will be adapted to match the
bit depth of the display, :py:class:`draw565.Draw565` for example.
.. data:: watch.rtc
RTC driver, typically :py:class:`drivers.nrf_rtc.RTC`.
.. data:: watch.touch
Touchscreen driver, for example :py:class:`drivers.cst816s.CST816S`.
.. data:: watch.vibrator
Vibration motor driver, typically :py:class:`drivers.vibrator.Vibrator`.
"""
import time
def sleep_ms(ms):
time.sleep(ms / 1000)
time.sleep_ms = sleep_ms
import os
class Accel():
def reset(self):
pass
class Pin():
def value(v=None):
pass
accel = Accel()
button = Pin()