Skip to content

Commit 931c7c1

Browse files
committed
Add Bangle.js 2, JDI memory displays and ACeP epd
This 2-in-1 PR started with the goal of support the Bangle.js 2 smartwatch with *no USB*. * Adds "secure" DFU build support with a committed private key. * Adds 3-bit color support with one dummy bit for the JDI memory display * Allows nrf boards to have a board_background_task() run in RUN_BACKGROUND_TASK. This is needed because the Bangle.js 2 uses the watchdog to reset. * Renamed port_background_task() to port_background_tick() to indicate it runs on tick, not RUN_BACKGROUND_TASK. * Marks serial connected when the display terminal is inited. This means that safe mode messages show up on the display. ACep, 7-color epaper displays also pack 3 bits in 4. So, I added that support as well. * Adds 3-bit ACeP color support for 7-color e-paper displays. (Not watch related but similar due to color depth.) * Allows a refresh sequence instead of a single int command. The 7" ACeP display requires a data byte for refresh. * Adds optional delay after resetting the display. The ACeP displays need this. (Probably to load LUTs from flash.) * Adds a cleaning phase for ACeP displays before the real refresh. For both: * Add dither support to Palette. * Palette no longer converts colors when set. Instead, it caches converted colors at each index. * ColorConverter now caches the last converted color. It should make conversions faster for repeated colors (not dithering.)
1 parent ca24cff commit 931c7c1

Some content is hidden

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

53 files changed

+752
-194
lines changed

.github/actions/deps/external/action.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ runs:
3737

3838
# arm
3939
- name: Get arm toolchain
40-
if: inputs.platform == 'aarch' || inputs.platform == 'arm'
40+
if: inputs.platform == 'aarch' || inputs.platform == 'arm' || inputs.platform == 'nrf'
4141
uses: carlosperate/arm-none-eabi-gcc-action@v1
4242
with:
4343
release: '10-2020-q4'
@@ -65,6 +65,22 @@ runs:
6565
echo >> $GITHUB_PATH "$PATH"
6666
shell: bash
6767

68+
# nrf
69+
- name: Get nrfutil 7+
70+
if: inputs.platform == 'nrf'
71+
run: |
72+
wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
73+
chmod +x nrfutil
74+
./nrfutil install nrf5sdk-tools
75+
mkdir -p $HOME/.local/bin
76+
mv nrfutil $HOME/.local/bin
77+
echo "$HOME/.local/bin" >> $GITHUB_PATH
78+
shell: bash
79+
- name: Print nrfutil version
80+
if: inputs.platform == 'nrf'
81+
run: nrfutil -V
82+
shell: bash
83+
6884
# riscv
6985
- name: Get riscv toolchain
7086
if: inputs.platform == 'riscv'

.github/workflows/build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }}
2626
boards-arm: ${{ steps.set-matrix.outputs.boards-arm }}
2727
boards-esp: ${{ steps.set-matrix.outputs.boards-esp }}
28+
boards-nrf: ${{ steps.set-matrix.outputs.boards-nrf }}
2829
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
2930
boards-rpi: ${{ steps.set-matrix.outputs.boards-rpi }}
3031
cp-version: ${{ steps.set-up-submodules.outputs.version }}
@@ -252,6 +253,16 @@ jobs:
252253
boards: ${{ needs.scheduler.outputs.boards-esp }}
253254
cp-version: ${{ needs.scheduler.outputs.cp-version }}
254255

256+
nrf:
257+
needs: [scheduler, mpy-cross, tests]
258+
if: ${{ needs.scheduler.outputs.boards-nrf != '[]' }}
259+
uses: ./.github/workflows/build-boards.yml
260+
secrets: inherit
261+
with:
262+
platform: nrf
263+
boards: ${{ needs.scheduler.outputs.boards-nrf }}
264+
cp-version: ${{ needs.scheduler.outputs.cp-version }}
265+
255266
riscv:
256267
needs: [scheduler, mpy-cross, tests]
257268
if: ${{ needs.scheduler.outputs.boards-riscv != '[]' }}

locale/circuitpython.pot

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ msgstr ""
202202
msgid "%q out of range"
203203
msgstr ""
204204

205-
#: ports/atmel-samd/common-hal/microcontroller/Pin.c
206-
msgid "%q pin invalid"
207-
msgstr ""
208-
209205
#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c
210206
msgid "%q step cannot be zero"
211207
msgstr ""
@@ -1210,9 +1206,11 @@ msgid "Internal watchdog timer expired."
12101206
msgstr ""
12111207

12121208
#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c
1209+
#: shared-bindings/displayio/EPaperDisplay.c
12131210
msgid "Invalid %q"
12141211
msgstr ""
12151212

1213+
#: ports/atmel-samd/common-hal/microcontroller/Pin.c
12161214
#: shared-bindings/microcontroller/Pin.c
12171215
msgid "Invalid %q pin"
12181216
msgstr ""

ports/atmel-samd/background.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ void port_finish_background_task(void) {
5757
}
5858
#endif
5959

60+
void port_background_tick(void) {
61+
}
62+
6063
void port_background_task(void) {
6164
}

ports/atmel-samd/boards/openbook_m4/board.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ uint8_t stop_sequence[] = {
5252
0x02, 0x80, 0xf0 // Power off
5353
};
5454

55+
uint8_t refresh_sequence[] = {
56+
0x12, 0x00
57+
};
58+
5559
void board_init(void) {
5660
busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus;
5761
common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false);
@@ -74,6 +78,7 @@ void board_init(void) {
7478
bus,
7579
start_sequence,
7680
sizeof(start_sequence),
81+
0, // start up time
7782
stop_sequence,
7883
sizeof(stop_sequence),
7984
300, // width
@@ -92,13 +97,15 @@ void board_init(void) {
9297
NO_COMMAND, // write_color_ram_command (can add this for grayscale eventually)
9398
false, // color_bits_inverted
9499
0x000000, // highlight_color
95-
0x12, // refresh_display_command
100+
refresh_sequence, // refresh_display_sequence
101+
sizeof(refresh_sequence),
96102
40, // refresh_time
97103
&pin_PA01, // busy_pin
98104
false, // busy_state
99105
5, // seconds_per_frame
100106
false, // chip_select (don't always toggle chip select)
101107
false, // grayscale
108+
false, // acep
102109
false); // two_byte_sequence_length
103110
}
104111

ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,10 @@ CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf
5353

5454
# Override optimization to keep binary small
5555
OPTIMIZATION_FLAGS = -Os
56+
57+
# We don't have room for the fonts for terminalio for certain languages,
58+
# so turn off terminalio and force a clean build.
59+
ifneq (,$(filter $(TRANSLATION),ja ko ru))
60+
CIRCUITPY_TERMINALIO = 0
61+
RELEASE_NEEDS_CLEAN_BUILD = 1
62+
endif

ports/atmel-samd/common-hal/microcontroller/Pin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,5 @@ mcu_pin_function_t *mcu_find_pin_function(mcu_pin_function_t *table, const mcu_p
211211
return table;
212212
}
213213
}
214-
mp_raise_ValueError_varg(translate("%q pin invalid"), name);
214+
mp_raise_ValueError_varg(translate("Invalid %q pin"), name);
215215
}

ports/broadcom/background.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ void port_start_background_task(void) {
3333
void port_finish_background_task(void) {
3434
}
3535

36+
void port_background_tick(void) {
37+
}
38+
3639
void port_background_task(void) {
3740
}

ports/cxd56/background.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "supervisor/filesystem.h"
3131
#include "supervisor/shared/stack.h"
3232

33+
void port_background_tick(void) {
34+
}
3335
void port_background_task(void) {
3436
}
3537
void port_start_background_task(void) {

0 commit comments

Comments
 (0)