Skip to content

Commit e46df72

Browse files
authored
Merge branch 'main' into add-wareke-face
2 parents 2b645e5 + 7af5626 commit e46df72

File tree

135 files changed

+12499
-557
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+12499
-557
lines changed

.devcontainer/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
FROM ubuntu:22.10
2-
3-
# TODO: install emscripten (https://emscripten.org/docs/getting_started/downloads.html)
1+
FROM ubuntu:24.04
42

53
# TODO: Clean this up once buildkit is supported gracefully in devcontainers
64
# https://github.com/microsoft/vscode-remote-release/issues/1409
@@ -27,7 +25,9 @@ RUN apt-get update \
2725
# ca certs need to be available for fetching git submodules
2826
ca-certificates \
2927
# python is used to convert binaries to uf2 files
30-
python3 python-is-python3
28+
python3 python-is-python3 \
29+
# emscripten for building simulator
30+
emscripten
3131

3232
# Download and verify both x86-64 and aarch64 toolchains. This is unfortunate and
3333
# slows down the build, but it's a clean-ish option until buildkit can be used.
@@ -47,4 +47,4 @@ RUN /bin/sh -c 'set -ex && \
4747
fi'
4848

4949
RUN rm $X86_64_TOOLCHAIN_FILENAME
50-
RUN rm $AARCH64_TOOLCHAIN_FILENAME
50+
RUN rm $AARCH64_TOOLCHAIN_FILENAME

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
COLOR: BLUE
1111

12-
jobs:
12+
jobs:
1313
build:
1414
container:
1515
image: ghcr.io/armmbed/mbed-os-env:latest
@@ -29,7 +29,7 @@ jobs:
2929
run: make
3030
working-directory: 'movement/make'
3131
- name: Upload UF2
32-
uses: actions/upload-artifact@v2
32+
uses: actions/upload-artifact@v4
3333
with:
3434
name: watch.uf2
3535
path: movement/make/build/watch.uf2
@@ -52,7 +52,7 @@ jobs:
5252
cp watch.html index.html
5353
tar -czf simulator.tar.gz index.html watch.wasm watch.js
5454
- name: Upload simulator build
55-
uses: actions/upload-artifact@v2
55+
uses: actions/upload-artifact@v4
5656
with:
5757
name: simulator.tar.gz
5858
path: movement/make/build-sim/simulator.tar.gz

apps/beats-time/app.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <string.h>
33
#include <math.h>
44
#include "watch.h"
5+
#include "watch_utility.h"
56

67
const int8_t UTC_OFFSET = 4; // set to your current UTC offset to see correct beats time
78
const uint8_t BEAT_REFRESH_FREQUENCY = 8;
@@ -203,7 +204,6 @@ void set_time_mode_handle_primary_button(void) {
203204

204205
void set_time_mode_handle_secondary_button(void) {
205206
watch_date_time date_time = watch_rtc_get_date_time();
206-
const uint8_t days_in_month[12] = {31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31};
207207

208208
switch (application_state.page) {
209209
case 0: // hour
@@ -224,13 +224,10 @@ void set_time_mode_handle_secondary_button(void) {
224224
break;
225225
case 5: // day
226226
date_time.unit.day = date_time.unit.day + 1;
227-
// can't set to the 29th on a leap year. if it's february 29, set to 11:59 on the 28th.
228-
// and it should roll over.
229-
if (date_time.unit.day > days_in_month[date_time.unit.month - 1]) {
230-
date_time.unit.day = 1;
231-
}
232227
break;
233228
}
229+
if (date_time.unit.day > days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR))
230+
date_time.unit.day = 1;
234231
watch_rtc_set_date_time(date_time);
235232
}
236233

apps/pro-rainbow-test/app.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#include <stdio.h>
2+
#include <string.h>
3+
#include "watch.h"
4+
5+
void app_init(void) {
6+
}
7+
8+
void app_wake_from_backup(void) {
9+
}
10+
11+
void app_setup(void) {
12+
watch_enable_leds();
13+
}
14+
15+
void app_prepare_for_standby(void) {
16+
}
17+
18+
void app_wake_from_standby(void) {
19+
}
20+
21+
bool app_loop(void) {
22+
static uint8_t red = 0;
23+
static uint8_t green = 0;
24+
static uint8_t blue = 255;
25+
static uint8_t phase = 0;
26+
27+
switch (phase) {
28+
case 0:
29+
red++;
30+
if (red == 255) phase = 1;
31+
break;
32+
case 1:
33+
green++;
34+
if (green == 255) phase = 2;
35+
break;
36+
case 2:
37+
red--;
38+
if (red == 0) phase = 3;
39+
break;
40+
case 3:
41+
blue++;
42+
if (blue == 255) phase = 4;
43+
break;
44+
case 4:
45+
green--;
46+
if (green == 0) phase = 5;
47+
break;
48+
case 5:
49+
red++;
50+
if (red == 255) phase = 6;
51+
break;
52+
case 6:
53+
blue--;
54+
if (blue == 0) {
55+
phase = 1;
56+
}
57+
break;
58+
}
59+
60+
watch_set_led_color_rgb(red, green, blue);
61+
delay_ms(2);
62+
63+
return false;
64+
}

apps/pro-rainbow-test/make/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TOP = ../../..
2+
include $(TOP)/make.mk
3+
4+
INCLUDES += \
5+
-I../
6+
7+
SRCS += \
8+
../app.c
9+
10+
include $(TOP)/rules.mk

boards/OSO-FEAL-A1-00/pins.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,8 @@
120120
#define D0 GPIO(GPIO_PORTB, 3)
121121
#define D1 GPIO(GPIO_PORTB, 0)
122122

123+
// interrupt mapping
124+
#define EXT_IRQ_AMOUNT 6
125+
#define CONFIG_EIC_EXTINT_MAP {0, PIN_PB00}, {1, PIN_PB01}, {2, PIN_PA02}, {3, PIN_PB03}, {5, PIN_PB05}, {7, PIN_PA07},
126+
123127
#endif // PINS_H_INCLUDED

boards/OSO-SWAT-A1-02/pins.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,8 @@
8181
#define D0 GPIO(GPIO_PORTB, 3)
8282
#define D1 GPIO(GPIO_PORTB, 0)
8383

84+
// interrupt mapping
85+
#define EXT_IRQ_AMOUNT 6
86+
#define CONFIG_EIC_EXTINT_MAP {0, PIN_PB00}, {1, PIN_PB01}, {2, PIN_PA02}, {3, PIN_PB03}, {6, PIN_PA22}, {7, PIN_PA23},
87+
8488
#endif // PINS_H_INCLUDED

boards/OSO-SWAT-A1-04/pins.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,8 @@
8181
#define D0 GPIO(GPIO_PORTB, 3)
8282
#define D1 GPIO(GPIO_PORTB, 0)
8383

84+
// interrupt mapping
85+
#define EXT_IRQ_AMOUNT 6
86+
#define CONFIG_EIC_EXTINT_MAP {0, PIN_PB00}, {1, PIN_PB01}, {2, PIN_PA02}, {3, PIN_PB03}, {6, PIN_PA22}, {7, PIN_PA23},
87+
8488
#endif // PINS_H_INCLUDED

boards/OSO-SWAT-A1-05/pins.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,8 @@
8181
#define D0 GPIO(GPIO_PORTB, 3)
8282
#define D1 GPIO(GPIO_PORTB, 0)
8383

84+
// interrupt mapping
85+
#define EXT_IRQ_AMOUNT 6
86+
#define CONFIG_EIC_EXTINT_MAP {0, PIN_PB00}, {1, PIN_PB01}, {2, PIN_PA02}, {3, PIN_PB03}, {6, PIN_PA22}, {7, PIN_PA23},
87+
8488
#endif // PINS_H_INCLUDED

boards/OSO-SWAT-C1-00/pins.h

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#ifndef PINS_H_INCLUDED
2+
#define PINS_H_INCLUDED
3+
4+
// Detects if we are on USB power.
5+
#define VBUS_DET GPIO(GPIO_PORTB, 5)
6+
7+
// Buttons
8+
#define BTN_ALARM GPIO(GPIO_PORTA, 2)
9+
#define WATCH_BTN_ALARM_EIC_CHANNEL 2
10+
#define BTN_LIGHT GPIO(GPIO_PORTA, 30)
11+
#define WATCH_BTN_LIGHT_EIC_CHANNEL 10
12+
#define BTN_MODE GPIO(GPIO_PORTA, 31)
13+
#define WATCH_BTN_MODE_EIC_CHANNEL 11
14+
15+
// Buzzer
16+
#define BUZZER GPIO(GPIO_PORTA, 27)
17+
#define WATCH_BUZZER_TCC_PINMUX PINMUX_PA27F_TCC0_WO5
18+
#define WATCH_BUZZER_TCC_CHANNEL 1
19+
20+
// LEDs
21+
#define WATCH_INVERT_LED_POLARITY
22+
23+
#define RED GPIO(GPIO_PORTA, 12)
24+
#define WATCH_RED_TCC_CHANNEL 2
25+
#define WATCH_RED_TCC_PINMUX PINMUX_PA12F_TCC0_WO6
26+
27+
#define BLUE GPIO(GPIO_PORTA, 13)
28+
#define WATCH_BLUE_TCC_CHANNEL 3
29+
#define WATCH_BLUE_TCC_PINMUX PINMUX_PA13F_TCC0_WO7
30+
31+
#define GREEN GPIO(GPIO_PORTA, 22)
32+
#define WATCH_GREEN_TCC_CHANNEL 0
33+
#define WATCH_GREEN_TCC_PINMUX PINMUX_PA22F_TCC0_WO4
34+
35+
// Segment LCD
36+
#define SLCD0 GPIO(GPIO_PORTB, 6)
37+
#define SLCD1 GPIO(GPIO_PORTB, 7)
38+
#define SLCD2 GPIO(GPIO_PORTB, 8)
39+
#define SLCD3 GPIO(GPIO_PORTB, 9)
40+
#define SLCD4 GPIO(GPIO_PORTA, 5)
41+
#define SLCD5 GPIO(GPIO_PORTA, 6)
42+
#define SLCD6 GPIO(GPIO_PORTA, 7)
43+
#define SLCD7 GPIO(GPIO_PORTA, 8)
44+
#define SLCD8 GPIO(GPIO_PORTA, 9)
45+
#define SLCD9 GPIO(GPIO_PORTA, 10)
46+
#define SLCD10 GPIO(GPIO_PORTA, 11)
47+
#define SLCD11 GPIO(GPIO_PORTB, 11)
48+
#define SLCD12 GPIO(GPIO_PORTB, 12)
49+
#define SLCD13 GPIO(GPIO_PORTB, 13)
50+
#define SLCD14 GPIO(GPIO_PORTB, 14)
51+
#define SLCD15 GPIO(GPIO_PORTB, 15)
52+
#define SLCD16 GPIO(GPIO_PORTA, 14)
53+
#define SLCD17 GPIO(GPIO_PORTA, 15)
54+
#define SLCD18 GPIO(GPIO_PORTA, 16)
55+
#define SLCD19 GPIO(GPIO_PORTA, 17)
56+
#define SLCD20 GPIO(GPIO_PORTA, 18)
57+
#define SLCD21 GPIO(GPIO_PORTA, 19)
58+
#define SLCD22 GPIO(GPIO_PORTB, 16)
59+
#define SLCD23 GPIO(GPIO_PORTB, 17)
60+
#define SLCD24 GPIO(GPIO_PORTA, 20)
61+
#define SLCD25 GPIO(GPIO_PORTA, 21)
62+
#define SLCD26 GPIO(GPIO_PORTA, 23)
63+
// This board uses a slightly different pin mapping from the standard watch, and it's not enough to
64+
// just declare the pins. We also have to set the LCD Pin Enable register with the SLCD pins we're
65+
// using. These numbers are not port/pin numbers, but the "SLCD/LP[x]" numbers in the pinmux table.
66+
// If not defined in pins.h, the LCD driver will fall back to the pin mapping in hpl_slcd_config.h.
67+
// LPENL is for pins SLCD/LP[0..31].
68+
#define CONF_SLCD_LPENL (\
69+
(uint32_t)1 << 0 | \
70+
(uint32_t)1 << 1 | \
71+
(uint32_t)1 << 2 | \
72+
(uint32_t)1 << 3 | \
73+
(uint32_t)1 << 5 | \
74+
(uint32_t)1 << 6 | \
75+
(uint32_t)1 << 7 | \
76+
(uint32_t)1 << 11 | \
77+
(uint32_t)1 << 12 | \
78+
(uint32_t)1 << 13 | \
79+
(uint32_t)1 << 14 | \
80+
(uint32_t)1 << 21 | \
81+
(uint32_t)1 << 22 | \
82+
(uint32_t)1 << 23 | \
83+
(uint32_t)1 << 24 | \
84+
(uint32_t)1 << 25 | \
85+
(uint32_t)1 << 30 | \
86+
(uint32_t)1 << 31 | 0)
87+
// LPENH is for pins SLCD/LP[32..51], where bit 0 represents pin 32.
88+
#define CONF_SLCD_LPENH (\
89+
(uint32_t)1 << (32 - 32) | \
90+
(uint32_t)1 << (33 - 32) | \
91+
(uint32_t)1 << (34 - 32) | \
92+
(uint32_t)1 << (35 - 32) | \
93+
(uint32_t)1 << (42 - 32) | \
94+
(uint32_t)1 << (43 - 32) | \
95+
(uint32_t)1 << (48 - 32) | \
96+
(uint32_t)1 << (49 - 32) | \
97+
(uint32_t)1 << (51 - 32) | 0)
98+
99+
100+
// 9-pin connector
101+
#define A0 GPIO(GPIO_PORTB, 4)
102+
#define WATCH_A0_EIC_CHANNEL 4
103+
#define A1 GPIO(GPIO_PORTB, 1)
104+
#define WATCH_A1_EIC_CHANNEL 1
105+
#define A2 GPIO(GPIO_PORTB, 2)
106+
#define WATCH_A2_EIC_CHANNEL 2
107+
#define A3 GPIO(GPIO_PORTB, 3)
108+
#define WATCH_A3_EIC_CHANNEL 3
109+
#define A4 GPIO(GPIO_PORTB, 0)
110+
#define WATCH_A4_EIC_CHANNEL 0
111+
#define SDA GPIO(GPIO_PORTB, 30)
112+
#define SCL GPIO(GPIO_PORTB, 31)
113+
114+
// aliases for as A3/A4; these were mentioned as D0/D1 in early documentation.
115+
#define D0 GPIO(GPIO_PORTB, 3)
116+
#define D1 GPIO(GPIO_PORTB, 0)
117+
118+
// interrupt mapping
119+
#define EXT_IRQ_AMOUNT 6
120+
#define CONFIG_EIC_EXTINT_MAP {0, PIN_PB00}, {1, PIN_PB01}, {2, PIN_PA02}, {3, PIN_PB03}, {10, PIN_PA30}, {11, PIN_PA31},
121+
122+
#endif // PINS_H_INCLUDED

make.mk

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ BUILD = ./build-sim
66
endif
77
BIN = watch
88

9-
ifndef BOARD
9+
ifndef COLOR
10+
$(error Set the COLOR variable to RED, BLUE, GREEN or PRO depending on what board you have.)
11+
endif
12+
13+
COLOR_VALID := $(filter $(COLOR),RED BLUE GREEN PRO)
14+
15+
ifeq ($(COLOR_VALID),)
16+
$(error COLOR must be RED, BLUE, GREEN or PRO)
17+
endif
18+
19+
ifeq ($(COLOR), PRO)
20+
override BOARD = OSO-SWAT-C1-00
21+
else
1022
override BOARD = OSO-SWAT-A1-05
1123
endif
1224

@@ -121,6 +133,7 @@ SRCS += \
121133
$(TOP)/watch-library/hardware/watch/watch_storage.c \
122134
$(TOP)/watch-library/hardware/watch/watch_deepsleep.c \
123135
$(TOP)/watch-library/hardware/watch/watch_private.c \
136+
$(TOP)/watch-library/hardware/watch/watch_private_cdc.c \
124137
$(TOP)/watch-library/hardware/watch/watch.c \
125138
$(TOP)/watch-library/hardware/hal/src/hal_atomic.c \
126139
$(TOP)/watch-library/hardware/hal/src/hal_delay.c \
@@ -153,7 +166,6 @@ SRCS += \
153166
$(TOP)/watch-library/shared/driver/lis2dw.c \
154167
$(TOP)/watch-library/shared/driver/opt3001.c \
155168
$(TOP)/watch-library/shared/driver/spiflash.c \
156-
$(TOP)/watch-library/shared/watch/watch_private_buzzer.c \
157169
$(TOP)/watch-library/shared/watch/watch_private_display.c \
158170
$(TOP)/watch-library/shared/watch/watch_utility.c \
159171

@@ -198,7 +210,6 @@ SRCS += \
198210
$(TOP)/watch-library/simulator/watch/watch.c \
199211
$(TOP)/watch-library/shared/driver/thermistor_driver.c \
200212
$(TOP)/watch-library/shared/driver/opt3001.c \
201-
$(TOP)/watch-library/shared/watch/watch_private_buzzer.c \
202213
$(TOP)/watch-library/shared/watch/watch_private_display.c \
203214
$(TOP)/watch-library/shared/watch/watch_utility.c \
204215

@@ -212,6 +223,12 @@ ifndef COLOR
212223
$(error Set the COLOR variable to RED, BLUE, or GREEN depending on what board you have.)
213224
endif
214225

226+
COLOR_VALID := $(filter $(COLOR),RED BLUE GREEN)
227+
228+
ifeq ($(COLOR_VALID),)
229+
$(error COLOR must be RED, BLUE, or GREEN)
230+
endif
231+
215232
ifeq ($(COLOR), BLUE)
216233
CFLAGS += -DWATCH_IS_BLUE_BOARD
217234
endif
@@ -229,3 +246,9 @@ endif
229246
ifeq ($(BOARD), OSO-FEAL-A1-00)
230247
CFLAGS += -DCRYSTALLESS
231248
endif
249+
250+
# Build options to customize movement and faces
251+
252+
ifdef CLOCK_FACE_24H_ONLY
253+
CFLAGS += -DCLOCK_FACE_24H_ONLY
254+
endif

0 commit comments

Comments
 (0)