Skip to content

Add Bangle.js 2, JDI memory displays and ACeP epd #7497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/deps/ports/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ runs:
- name: Set up espressif port
if: steps.board-to-port.outputs.port == 'espressif'
uses: ./.github/actions/deps/ports/espressif

- name: Set up nrf port
if: steps.board-to-port.outputs.port == 'nrf'
uses: ./.github/actions/deps/ports/nrf
17 changes: 17 additions & 0 deletions .github/actions/deps/ports/nrf/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Fetch nrf port deps

runs:
using: composite
steps:
- name: Get nrfutil 7+
run: |
wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
chmod +x nrfutil
./nrfutil install nrf5sdk-tools
mkdir -p $HOME/.local/bin
mv nrfutil $HOME/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Print nrfutil version
run: nrfutil -V
shell: bash
12 changes: 12 additions & 0 deletions lib/oofatfs/ff.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ typedef struct {


/* SBCS up-case tables (\x80-\xFF) */
// Optimize the 437-only case with a truncated lookup table.
#if FF_CODE_PAGE == 437
#define TBL_CT437 {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \
0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
0x41,0x49,0x4F,0x55,0xA5}
#else
#define TBL_CT437 {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \
0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \
Expand All @@ -286,6 +292,7 @@ typedef struct {
0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, \
0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
#endif
#define TBL_CT720 {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, \
Expand Down Expand Up @@ -2887,7 +2894,12 @@ static FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not
}
#elif FF_CODE_PAGE < 900 /* SBCS cfg */
wc = ff_uni2oem(wc, CODEPAGE); /* Unicode ==> ANSI/OEM code */
// Optimize the 437-only case with a truncated lookup table.
#if FF_CODE_PAGE == 437
if (wc & 0x80 && wc < (0xA5 - 0x80)) wc = ExCvt[wc & 0x7F]; /* Convert extended character to upper (SBCS) */
#else
if (wc & 0x80) wc = ExCvt[wc & 0x7F]; /* Convert extended character to upper (SBCS) */
#endif
#else /* DBCS cfg */
wc = ff_uni2oem(ff_wtoupper(wc), CODEPAGE); /* Unicode ==> Upper convert ==> ANSI/OEM code */
#endif
Expand Down
8 changes: 8 additions & 0 deletions lib/oofatfs/ffunicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,13 @@ DWORD ff_wtoupper ( /* Returns up-converted code point */
DWORD uni /* Unicode code point to be up-converted */
)
{
#if FF_FS_CASE_INSENSITIVE_COMPARISON_ASCII_ONLY
// Only uppercase ASCII characters. Everything else will require the user to
// pass in an uppercase version.
if ('a' <= uni && uni <= 'z') {
uni -= 32;
}
#else
const WORD *p;
WORD uc, bc, nc, cmd;
static const WORD cvt1[] = { /* Compressed up conversion table for U+0000 - U+0FFF */
Expand Down Expand Up @@ -619,6 +626,7 @@ DWORD ff_wtoupper ( /* Returns up-converted code point */
}
uni = uc;
}
#endif

return uni;
}
Expand Down
6 changes: 2 additions & 4 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@ msgstr ""
msgid "%q out of range"
msgstr ""

#: ports/atmel-samd/common-hal/microcontroller/Pin.c
msgid "%q pin invalid"
msgstr ""

#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c
msgid "%q step cannot be zero"
msgstr ""
Expand Down Expand Up @@ -1221,9 +1217,11 @@ msgid "Interrupt error."
msgstr ""

#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c
#: shared-bindings/displayio/EPaperDisplay.c
msgid "Invalid %q"
msgstr ""

#: ports/atmel-samd/common-hal/microcontroller/Pin.c
#: shared-bindings/microcontroller/Pin.c
msgid "Invalid %q pin"
msgstr ""
Expand Down
3 changes: 3 additions & 0 deletions ports/atmel-samd/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ void port_finish_background_task(void) {
}
#endif

void port_background_tick(void) {
}

void port_background_task(void) {
}
9 changes: 8 additions & 1 deletion ports/atmel-samd/boards/openbook_m4/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ uint8_t stop_sequence[] = {
0x02, 0x80, 0xf0 // Power off
};

uint8_t refresh_sequence[] = {
0x12, 0x00
};

void board_init(void) {
busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus;
common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false);
Expand All @@ -74,6 +78,7 @@ void board_init(void) {
bus,
start_sequence,
sizeof(start_sequence),
0, // start up time
stop_sequence,
sizeof(stop_sequence),
300, // width
Expand All @@ -92,13 +97,15 @@ void board_init(void) {
NO_COMMAND, // write_color_ram_command (can add this for grayscale eventually)
false, // color_bits_inverted
0x000000, // highlight_color
0x12, // refresh_display_command
refresh_sequence, // refresh_display_sequence
sizeof(refresh_sequence),
40, // refresh_time
&pin_PA01, // busy_pin
false, // busy_state
5, // seconds_per_frame
false, // chip_select (don't always toggle chip select)
false, // grayscale
false, // acep
false); // two_byte_sequence_length
}

Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/microcontroller/Pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,5 @@ mcu_pin_function_t *mcu_find_pin_function(mcu_pin_function_t *table, const mcu_p
return table;
}
}
mp_raise_ValueError_varg(translate("%q pin invalid"), name);
mp_raise_ValueError_varg(translate("Invalid %q pin"), name);
}
3 changes: 3 additions & 0 deletions ports/broadcom/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ void port_start_background_task(void) {
void port_finish_background_task(void) {
}

void port_background_tick(void) {
}

void port_background_task(void) {
}
2 changes: 2 additions & 0 deletions ports/cxd56/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "supervisor/filesystem.h"
#include "supervisor/shared/stack.h"

void port_background_tick(void) {
}
void port_background_task(void) {
}
void port_start_background_task(void) {
Expand Down
5 changes: 4 additions & 1 deletion ports/espressif/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@
#include "common-hal/pulseio/PulseIn.h"
#endif

void port_background_task(void) {
void port_background_tick(void) {
// Zero delay in case FreeRTOS wants to switch to something else.
vTaskDelay(0);
#if CIRCUITPY_PULSEIO
pulsein_background();
#endif
}

void port_background_task(void) {
}

void port_start_background_task(void) {
}

Expand Down
8 changes: 7 additions & 1 deletion ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ const uint8_t display_stop_sequence[] = {
0x02, 0x00 // Power off
};

const uint8_t refresh_sequence[] = {
0x12, 0x00
};

void board_init(void) {
// Debug UART
#ifdef DEBUG
Expand Down Expand Up @@ -137,6 +141,7 @@ void board_init(void) {
display,
bus,
display_start_sequence, sizeof(display_start_sequence),
0, // start up time
display_stop_sequence, sizeof(display_stop_sequence),
296, // width
128, // height
Expand All @@ -154,13 +159,14 @@ void board_init(void) {
0x13, // write_color_ram_command
false, // color_bits_inverted
0x000000, // highlight_color
0x12, // refresh_display_command
refresh_sequence, sizeof(refresh_sequence),
1.0, // refresh_time
&pin_GPIO5, // busy_pin
false, // busy_state
5.0, // seconds_per_frame
false, // always_toggle_chip_select
true, // grayscale
false, // acep
false); // two_byte_sequence_length
}

Expand Down
2 changes: 2 additions & 0 deletions ports/litex/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

void port_background_task(void) {
}
void port_background_tick(void) {
}
void port_start_background_task(void) {
}
void port_finish_background_task(void) {
Expand Down
4 changes: 4 additions & 0 deletions ports/mimxrt10xx/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
#include "supervisor/port.h"

void port_background_task(void) {
}

void port_background_tick(void) {
#if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO
audio_dma_background();
#endif
}

void port_start_background_task(void) {
}
void port_finish_background_task(void) {
Expand Down
12 changes: 9 additions & 3 deletions ports/nrf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ endif
#####################
.phony: dfu-gen dfu-flash

NRFUTIL = adafruit-nrfutil
NRFUTIL = nrfutil
ADAFRUIT_NRFUTIL = adafruit-nrfutil

ifeq ($(MCU_SUB_VARIANT),nrf52840)
DFU_TOUCH = --touch 1200
Expand All @@ -293,14 +294,19 @@ __check_defined = \
## Flash with DFU serial
dfu-flash: $(BUILD)/dfu-package.zip
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
$(NRFUTIL) --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank $(DFU_TOUCH)
$(ADAFRUIT_NRFUTIL) --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank $(DFU_TOUCH)

## Create DFU package file
dfu-gen: $(BUILD)/dfu-package.zip

$(BUILD)/dfu-package.zip: $(BUILD)/firmware.hex
$(NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip
$(ADAFRUIT_NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip

# Espruino DFU
$(BUILD)/firmware.espruino.zip: $(BUILD)/firmware.hex
$(Q)$(NRFUTIL) pkg generate $(BUILD)/firmware.espruino.zip --application $^ --application-version 0xff --hw-version 52 --sd-req 0xa9,0xae,0xb6 --key-file espruino_dfu_private_key.pem

espruino-dfu-gen: $(BUILD)/firmware.espruino.zip

include $(TOP)/py/mkrules.mk

Expand Down
13 changes: 12 additions & 1 deletion ports/nrf/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* THE SOFTWARE.
*/

#include "background.h"

#include "py/runtime.h"
#include "supervisor/filesystem.h"
#include "supervisor/port.h"
Expand All @@ -44,14 +46,23 @@

void port_start_background_task(void) {
}

void port_finish_background_task(void) {
}

void port_background_task(void) {
void port_background_tick(void) {
#if CIRCUITPY_AUDIOPWMIO
audiopwmout_background();
#endif
#if CIRCUITPY_AUDIOBUSIO
i2s_background();
#endif
}

// Allow boards to override this.
MP_WEAK void board_background_task(void) {
}

void port_background_task(void) {
board_background_task();
}
2 changes: 2 additions & 0 deletions ports/nrf/background.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
#ifndef MICROPY_INCLUDED_NRF_BACKGROUND_H
#define MICROPY_INCLUDED_NRF_BACKGROUND_H

void board_background_task(void);

#endif // MICROPY_INCLUDED_NRF_BACKGROUND_H
Loading