1
0
Fork 0

Compare commits

...

27 Commits

Author SHA1 Message Date
jebba 537f42f726 patchlet for ppc64le micropython 2021-06-15 17:36:59 -06:00
jebba 9bbd4e2ce1 rustc on bullseye, upgrade pip3 2021-06-15 17:20:09 -06:00
jebba 6df7ae418b local PATH 2021-06-15 17:09:16 -06:00
jebba 186221703d scriptlet to install python deps 2021-06-15 16:58:53 -06:00
jebba 70dcec6b19 A few notes on Pinetime OS 2021-06-15 16:56:47 -06:00
jebba ccdfbdf2cc softdevice os notes 2021-06-15 00:09:03 -06:00
jebba 76b6e35f97 spreadsheet of Pinetime OS/distros 2021-06-15 00:00:38 -06:00
jebba e656bf25e9 move docs/ etc to upstream dir 2021-06-14 23:46:37 -06:00
ml server 230eefb092 get latest submodules + urls 2021-06-14 17:52:22 -06:00
ml server e8beec6814 use jebbatime-bootloader 2021-06-14 17:42:52 -06:00
ml server fa16152edc rm bootloader mirror 2021-06-14 17:41:49 -06:00
ml server ac7f695f54 use https for micropython submodule 2021-06-14 16:52:38 -06:00
ml server a0b394cf5f rm micropython ssh url 2021-06-14 16:48:53 -06:00
ml server 9d23e8ba6b Use jebbatime micropython fork 2021-06-14 16:46:07 -06:00
ml server b31ae87ffe rm daniel thompson's fork of micropython submodule 2021-06-14 16:42:50 -06:00
jebba f142166178 non-free bits 2021-06-14 15:04:27 -06:00
ml server c253c9598b scriptlets to cat main.py over ble 2021-06-14 14:57:43 -06:00
ml server 3e2c687b27 rm some P8 2021-06-14 14:41:33 -06:00
ml server 13a2d54609 clean build script 2021-06-14 14:41:19 -06:00
ml server 4991a6adde cruft up make 2021-06-14 14:14:55 -06:00
ml server 874ed31c38 non-free 2021-06-14 14:04:56 -06:00
ml server 2dbfd10b31 not connected. rm sim bits 2021-06-14 13:52:05 -06:00
ml server 091ea48b50 rm some ble 2021-06-14 13:38:47 -06:00
ml server ada48a8715 rm heartrate driver, maybe break sim 2021-06-14 13:13:58 -06:00
jebba 4e24fe518a same license 2021-06-14 13:04:00 -06:00
jebba 21a0285901 rm'd 2021-06-14 12:59:38 -06:00
ml server 592c08f9cb Update download url for v1.1 2021-06-14 12:53:17 -06:00
49 changed files with 118 additions and 212 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ attic/
wasp/boards/*/watch.py
.idea
.vscode
.~lock.*.ods#

14
.gitmodules vendored
View File

@ -1,11 +1,3 @@
[submodule "bootloader"]
path = bootloader
# url = https://github.com/daniel-thompson/wasp-bootloader
url = https://mirrors.spacecruft.org/daniel-thompson/wasp-bootloader
[submodule "micropython"]
path = micropython
# url = https://github.com/daniel-thompson/micropython
url = https://mirrors.spacecruft.org/daniel-thompson/micropython
[submodule "tools/intelhex"]
path = tools/intelhex
# url = https://github.com/python-intelhex/intelhex
@ -38,3 +30,9 @@
# path = wasp/modules/bma42x-upy
## url = https://github.com/daniel-thompson/bma42x-upy
# url = https://mirrors.spacecruft.org/daniel-thompson/bma42x-upy
[submodule "micropython"]
path = micropython
url = https://spacecruft.org/jebbatime/micropython.git
[submodule "bootloader"]
path = bootloader
url = https://spacecruft.org/jebbatime/jebbatime-bootloader.git

View File

@ -32,8 +32,9 @@ submodules :
(cd micropython/ports/nrf; $(MAKE) submodules)
(cd reloader; git submodule update --init)
# XXX non-free
bootloader: build-$(BOARD_SAFE)
$(RM) bootloader/_build-$(BOARD)_nrf52832//$(BOARD)_nrf52832_bootloader-*-nosd.hex
$(RM) bootloader/_build-$(BOARD)_nrf52832/$(BOARD)_nrf52832_bootloader-*-nosd.hex
$(MAKE) -C bootloader/ BOARD=$(BOARD)_nrf52832 all genhex
$(PYTHON) tools/hexmerge.py \
bootloader/_build-$(BOARD)_nrf52832/$(BOARD)_nrf52832_bootloader-*-nosd.hex \
@ -42,7 +43,7 @@ bootloader: build-$(BOARD_SAFE)
$(PYTHON) tools/hex2c.py build-$(BOARD)/bootloader.hex > \
reloader/src/boards/$(BOARD)/bootloader.h
$(PYTHON) -m nordicsemi dfu genpkg \
--bootloader bootloader/_build-$(BOARD)_nrf52832//$(BOARD)_nrf52832_bootloader-*-nosd.hex \
--bootloader bootloader/_build-$(BOARD)_nrf52832/$(BOARD)_nrf52832_bootloader-*-nosd.hex \
--softdevice bootloader/lib/softdevice/s132_nrf52_6.1.1/s132_nrf52_6.1.1_softdevice.hex \
build-$(BOARD)/bootloader-daflasher.zip
@ -50,6 +51,7 @@ reloader: bootloader build-$(BOARD_SAFE)
$(MAKE) -C reloader/ BOARD=$(BOARD)
cp reloader/build-$(BOARD)/reloader*.zip build-$(BOARD)
# XXX non-free
softdevice:
micropython/ports/nrf/drivers/bluetooth/download_ble_stack.sh
@ -109,9 +111,7 @@ check:
.PHONY: bootloader reloader docs micropython
dist: DIST=../wasp-os-$(VERSION)
dist: k9
k9: p8
p8: pinetime
dist: pinetime
pinetime : mrproper
mrproper :
$(RM) -r \
@ -121,7 +121,7 @@ mrproper :
reloader/src/boards/*/bootloader.h \
micropython/mpy-cross/build \
micropython/ports/nrf/build-*
k9 p8 pinetime:
pinetime:
$(RM) wasp/boards/$@/watch.py
$(MAKE) BOARD=$@ all
dist: docs
@ -134,3 +134,4 @@ dist: docs
find $(DIST) -name __pycache__ | xargs $(RM) -r
tar -C .. -zcf $(DIST).tar.gz $(notdir $(DIST))
(cd ..; zip -9r $(DIST).zip $(notdir $(DIST)))

View File

@ -32,7 +32,7 @@ sudo apt install \
Add to `~/.bashrc`:
```
PATH=/usr/lib/ccache:$PATH
PATH=~/.local/bin:/usr/lib/ccache:$PATH
```
### Source
@ -43,16 +43,28 @@ git clone git@spacecruft.org:jebbatime/jebbatime.git
# Or
git clone https://spacecruft.org/jebbatime/jebbatime.git
cd jebbatime
./scripts/jebbatime-install-deb-deps
./scripts/jebbatime-install-py-deps
```
### Python
Install Python dependencies with `pip`.
Manually, install Python dependencies with `pip`.
```
pip3 install --user -r wasp/requirements.txt
pip3 install --user freetype-py
```
## Bullseye
Debian Bullseye (11) on ppc64le wants `rustc` to build/install `pip`
package `cryptography`.
```
./scripts/jebbatime-install-deb-deps
sudo apt -y install rustc
./scripts/jebbatime-install-py-deps
```
### Submodules
Some submodules are mirrored.
@ -107,6 +119,7 @@ Basic scripts are in `scripts/`.
## Fork
jebbatime is a lesser fork of Daniel Thompson's Wasp-os.
* Same licenses.
* Renamed.
* Removed more than added.
* Removing bits not used on Pinetime.
@ -122,8 +135,22 @@ Upstream source code:
* https://github.com/daniel-thompson/wasp-os
## Non-free bits
# Non-free bits
XXX Appears to include non-free "5-Clause Nordic License". `:|`
* https://wasp-os.readthedocs.io/en/latest/five-clause-nordic.html
* https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_nrf52%2Fstruct%2Fnrf52_softdevices.html
"A SoftDevice is a precompiled and linked binary software implementing a wireless protocol developed by Nordic Semiconductor."
* Non-free code gets pulled in via this build script:
`micropython/ports/nrf/drivers/bluetooth/download_ble_stack.sh`
* In `micropython/ports/nrf/drivers/bluetooth/`
```
4. This software, with or without modification, must only be used with a
Nordic Semiconductor ASA integrated circuit.
```

View File

@ -6,14 +6,18 @@
* Remove status bar.
* Battery app with numeric readout.
* Date app.
* Version app.
* Remove unused drivers.
* Remove unused bits in general.
* Mirrors of all submodules.
* Graphics, e.g. `logo.py`.
* rm accelerometer, Bosch BMA421.
* Set default time and enable Alarm.
* Multiple alarms.
# Time
* Accurate within a couple seconds. `;)`
* Accurate within a couple seconds.
It keeps accruate time, just doesn't display it. `;)`
* BLE sync...
* NTP sync.
* GPS sync.
* WWVB sync.

@ -1 +1 @@
Subproject commit 1d128f1311c084c23a662cb68263df9b187ebf94
Subproject commit dd7f0d2772f4c425468bf9940cb9904fc052b703

@ -1 +1 @@
Subproject commit 048bb2da83d0cbe73a829e461bd4f22b86c282bc
Subproject commit 79034e2b52e36248848fc76e2ee8c667926124cf

View File

@ -0,0 +1,13 @@
diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile
index 2116cc670..2269bc1c3 100644
--- a/mpy-cross/Makefile
+++ b/mpy-cross/Makefile
@@ -43,6 +43,7 @@ else
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
+LDFLAGS += -no-pie
# source files
SRC_C = \

BIN
pinetime-os.ods 100644

Binary file not shown.

View File

@ -9,7 +9,9 @@ cd $JEBBATIMEGITROOT
make mrproper
make clean BOARD=pinetime
git submodule sync
git submodule update --init
make submodules
make all BOARD=pinetime
make -j`nproc` all BOARD=pinetime

View File

@ -0,0 +1,10 @@
#!/bin/bash
# Get config
. ~/.config/jebbatime.conf
cd $JEBBATIMEGITROOT
make mrproper
make clean BOARD=pinetime

View File

@ -0,0 +1,12 @@
#!/bin/bash
# Get config
. ~/.config/jebbatime.conf
cd $JEBBATIMEGITROOT
./tools/wasptool \
--exec wasp/main.py \
--eval "from shell import * ; cd('/flash') ; cat('main.py')" \
--device $JEBBATIMEMAC

View File

@ -0,0 +1,12 @@
#!/bin/bash
# Get config
. ~/.config/jebbatime.conf
cd $JEBBATIMEGITROOT
./tools/wasptool \
--exec wasp/main.py \
--eval "from shell import * ; cd('/flash') ; cat('main.py')" \
--device $JEBBATIMEDEVMAC

View File

@ -8,7 +8,7 @@ cd $JEBBATIMEGITROOT
# Download latest release. XXX better link to latest.
rm -f /tmp/micropython-dev.zip
wget -O /tmp/micropython-dev.zip \
https://spacecruft.org/attachments/cdfc3e81-75b0-4e10-9f96-05462f1a919c
https://spacecruft.org/attachments/84fb3527-4ef1-47e4-8a55-ef55688ed05f
# Reboot thang into bootloader
echo "Rebooting development PineTime watch into bootloader..."

View File

@ -8,7 +8,7 @@ cd $JEBBATIMEGITROOT
# Download latest release. XXX better link to latest.
rm -f /tmp/micropython.zip
wget -O /tmp/micropython.zip \
https://spacecruft.org/attachments/cdfc3e81-75b0-4e10-9f96-05462f1a919c
https://spacecruft.org/attachments/84fb3527-4ef1-47e4-8a55-ef55688ed05f
# Reboot thang into bootloader
echo "Rebooting development PineTime watch into bootloader..."

View File

@ -0,0 +1,11 @@
#!/bin/bash
# Debian Buster (10)
set -x
pip3 install --upgrade pip
echo "Add ~/.local/bin to PATH"
~/.local/bin/pip3 install --user -r wasp/requirements.txt
~/.local/bin/pip3 install --user freetype-py

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -13,7 +13,6 @@ freeze('../..', manifest_240x240.manifest +
'draw565.py',
'drivers/battery.py',
'drivers/cst816s.py',
'drivers/hrs3300.py',
'drivers/nrf_rtc.py',
'drivers/signal.py',
'drivers/st7789.py',

View File

@ -21,19 +21,15 @@ 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.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)
@ -89,7 +85,6 @@ try:
Signal(Pin('CHARGING', Pin.IN), invert=True),
Signal(Pin('USB_PWR', Pin.IN), invert=True))
i2c = I2C(1, scl='I2C_SCL', sda='I2C_SDA')
hrs = HRS3300(i2c)
touch = CST816S(i2c,
Pin('TP_INT', Pin.IN), Pin('TP_RST', Pin.OUT, value=0),
_callback)

View File

@ -17,7 +17,6 @@ wasp.system.blank_after = 3600
# Adopt a basic all-orange theme
#wasp.system.set_theme(
# b'\xff\x00' # ble
# b'\xff\x00' # scroll-indicator
# b'\xff\x00' # battery
# b'\xff\x00' # status-clock

View File

@ -25,29 +25,6 @@ from drivers.cst816s import CST816S
from drivers.st7789 import ST7789_SPI
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):
def __init__(self, level=1):
pass
@ -133,47 +110,6 @@ class RTC(object):
def get_uptime_ms(self):
return int(self.uptime * 1000)
class HRS():
DATA = (
9084,9084,9025,9025,9009,9009,9009,9015,9015,9024,9024,9024,9073,9073,9074,9074,
9074,9100,9100,9097,9097,9097,9045,9045,9023,9023,9023,9035,9035,9039,9039,9039,
9049,9049,9052,9052,9052,9066,9066,9070,9070,9070,9078,9078,9081,9081,9081,9092,
9092,9093,9093,9093,9094,9094,9108,9108,9108,9124,9124,9122,9122,9122,9100,9100,
9110,9110,9110,9112,9112,9118,9118,9118,9127,9127,9136,9136,9136,9147,9147,9154,
9154,9154,9156,9156,9153,9153,9153,9152,9152,9156,9156,9156,9161,9161,9161,9177,
9177,9186,9186,9196,9196,9196,9201,9201,9201,9189,9189,9176,9176,9176,9176,9176,
9175,9175,9175,9175,9175,9180,9180,9180,9189,9189,9202,9202,9202,9207,9207,9181,
9181,9181,9167,9167,9169,9169,9169,9163,9163,9164,9164,9164,9165,9165,9172,9172,
9172,9180,9180,9192,9192,9192,9178,9178,9161,9161,9161,9163,9163,9173,9173,9173,
9170,9170,9179,9179,9183,9183,9183,9196,9196,9207,9207,9207,9208,9208,9186,9186,
9186,9182,9182,9193,9193,9193,9197,9197,9188,9204,9204,9212,9212,9212,9223,9223,
9228,9228,9228,9235,9235,9215,9215,9215,9217,9217,9225,9225,9225,9230,9230,9237,
9237,9237,9246,9246,9260,9260,9260,9270,9270,9269,9269,9269,9256,9256,9256,9256,
9256,9263,9263,9274,9274,9274,9288,9288,9292,9292,9292,9307,9307,9310
)
def __init__(self):
self._i = 0
self._step = 1
def enable(self):
pass
def disable(self):
pass
def read_hrs(self):
d = self.DATA[self._i]
self._i += self._step
if self._i >= len(self.DATA):
self._i -= 1
self._step = -1
elif self._i < 0:
self._i += 1
self._step = 1
return d
backlight = Backlight()
spi = SPI(0)
spi.init(polarity=1, phase=1, baudrate=8000000)
@ -183,16 +119,11 @@ display = ST7789_SPI(240, 240, spi,
res=Pin("DISP_RST", Pin.OUT, quiet=True))
drawable = draw565.Draw565(display)
accel = Accelerometer()
battery = Battery()
button = Pin('BUTTON', Pin.IN, quiet=True)
hrs = HRS()
rtc = RTC()
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)
def connected():
return not (int(rtc.uptime / 30) & 1)
# Free memory cannot be measured on the simulator
free = 0

View File

@ -1,97 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
"""HRS3300 driver
~~~~~~~~~~~~~~~~~
"""
from micropython import const
_I2CADDR = const(0x44)
_ID = const(0x00)
_ENABLE = const(0x01)
_ENABLE_HEN = const(0x80)
_C1DATAM = const(0x08)
_C0DATAM = const(0x09)
_C0DATAH = const(0x0a)
_PDRIVER = const(0x0c)
_C1DATAH = const(0x0d)
_C1DATAL = const(0x0e)
_C0DATAL = const(0x0f)
_RES = const(0x16)
_HGAIN = const(0x17)
class HRS3300:
def __init__(self, i2c):
self._i2c = i2c
def init(self):
w = self.write_reg
# HRS disabled, 12.5 ms wait time between cycles, (partly) 20mA drive
w(_ENABLE, 0x60)
# (partly) 20mA drive, power on, "magic" (datasheet says both
# "reserved" and "set low nibble to 8" but 0xe gives better results
# and is used by at least two other HRS3300 drivers
w(_PDRIVER, 0x6e)
# HRS and ALS both in 16-bit mode
w(_RES, 0x88)
# 64x gain
w(_HGAIN, 0x10)
def read_reg(self, addr):
return self._i2c.readfrom_mem(_I2CADDR, addr, 1)[0]
def write_reg(self, addr, val):
self._i2c.writeto_mem(_I2CADDR, addr, bytes((val,)))
def enable(self):
self.init()
enable = self.read_reg(_ENABLE)
enable |= _ENABLE_HEN
self.write_reg(_ENABLE, enable)
def disable(self):
enable = self.read_reg(_ENABLE)
enable &= ~_ENABLE_HEN
self.write_reg(_ENABLE, enable)
def read_hrs(self):
# TODO: Try fusing the read of H & L
m = self.read_reg(_C0DATAM)
h = self.read_reg(_C0DATAH)
l = self.read_reg(_C0DATAL)
return (m << 8) | ((h & 0x0f) << 4) | (l & 0x0f) | ((l & 0x30) << 12)
def read_als(self):
# TODO: Try fusing the read of H & L
m = self.read_reg(_C1DATAM)
h = self.read_reg(_C1DATAH)
l = self.read_reg(_C1DATAL)
return (m << 3) | ((h & 0x3f) << 11) | (l & 0x07)
def set_gain(self, gain):
if gain > 64:
gain = 64
hgain = 0
while (1 << hgain) < gain:
hgain += 1
self.write_reg(_HGAIN, hgain << 2)
def set_drive(self, drive):
en = self.read_reg(_ENABLE)
pd = self.read_reg(_PDRIVER)
en = (en & 0xf7) | ((drive & 2) << 2)
pd = (pd & 0xbf) | ((drive & 1) << 6)
self.write_reg(_ENABLE, en)
self.write_reg(_PDRIVER, pd)

View File

@ -115,7 +115,6 @@ class Manager():
self.notifications = {}
self._theme = (
b'\x7b\xef' # ble
b'\x7b\xef' # scroll-indicator
b'\x7b\xef' # battery
b'\xe7\x3c' # status-clock
@ -133,10 +132,7 @@ class Manager():
self._alarms = []
self._brightness = 3
self._notifylevel = 3
if 'P8' in watch.os.uname().machine:
self._nfylevels = [0, 225, 450]
else:
self._nfylevels = [0, 40, 80]
self._nfylevels = [0, 40, 80]
self._nfylev_ms = self._nfylevels[self._notifylevel - 1]
self._button = PinHandler(watch.button)
self._charging = True
@ -555,8 +551,7 @@ class Manager():
def theme(self, theme_part: str) -> int:
"""Returns the relevant part of theme. For more see ../tools/themer.py"""
theme_parts = ("ble",
"scroll-indicator",
theme_parts = ("scroll-indicator",
"battery",
"status-clock",
"notify-icon",

View File

@ -136,14 +136,7 @@ class NotificationBar:
draw = watch.drawable
(x, y) = self._pos
if wasp.watch.connected():
draw.blit(icons.blestatus, x, y, fg=wasp.system.theme('ble'))
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:
if wasp.system.notifications:
draw.blit(icons.notification, x, y,
fg=wasp.system.theme('notify-icon'))
draw.fill(0, x+30, y, 22, 32)