Skip to content

Commit a93cbb2

Browse files
committed
Merge remote-tracking branch 'origin/main' into ssl-anything
2 parents 879f241 + 87a400a commit a93cbb2

File tree

26 files changed

+456
-89
lines changed

26 files changed

+456
-89
lines changed

conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@
110110
autoapi_python_class_content = "both"
111111
autoapi_python_use_implicit_namespaces = True
112112
autoapi_root = "shared-bindings"
113+
114+
# Suppress cache warnings to prevent "unpickable" [sic] warning
115+
# about autoapi_prepare_jinja_env() from sphinx >= 7.3.0.
116+
# See https://github.com/sphinx-doc/sphinx/issues/12300
117+
suppress_warnings = ["config.cache"]
118+
113119
def autoapi_prepare_jinja_env(jinja_env):
114120
jinja_env.globals['support_matrix_reverse'] = modules_support_matrix_reverse
115121

locale/en_GB.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: PACKAGE VERSION\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"PO-Revision-Date: 2024-03-06 21:41+0000\n"
10+
"PO-Revision-Date: 2024-04-18 21:03+0000\n"
1111
"Last-Translator: Andi Chandler <andi@gowling.com>\n"
1212
"Language-Team: none\n"
1313
"Language: en_GB\n"
@@ -105,7 +105,7 @@ msgstr "%q and %q must share a clock unit"
105105

106106
#: ports/nordic/common-hal/watchdog/WatchDogTimer.c
107107
msgid "%q cannot be changed once mode is set to %q"
108-
msgstr ""
108+
msgstr "%q cannot be changed once mode is set to %q"
109109

110110
#: shared-bindings/microcontroller/Pin.c
111111
msgid "%q contains duplicate pins"
@@ -2327,7 +2327,7 @@ msgstr "You pressed the BOOT button at start up"
23272327
#: ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
23282328
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
23292329
msgid "You pressed the BOOT button at start up."
2330-
msgstr ""
2330+
msgstr "You pressed the BOOT button at start up."
23312331

23322332
#: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h
23332333
msgid "You pressed the GPIO0 button at start up."
@@ -4070,12 +4070,12 @@ msgstr "timeout must be < 655.35 secs"
40704070

40714071
#: ports/raspberrypi/common-hal/floppyio/__init__.c
40724072
msgid "timeout waiting for flux"
4073-
msgstr ""
4073+
msgstr "timeout waiting for flux"
40744074

40754075
#: ports/raspberrypi/common-hal/floppyio/__init__.c
40764076
#: shared-module/floppyio/__init__.c
40774077
msgid "timeout waiting for index pulse"
4078-
msgstr ""
4078+
msgstr "timeout waiting for index pulse"
40794079

40804080
#: shared-module/sdcardio/SDCard.c
40814081
msgid "timeout waiting for v1 card"

main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ STATIC bool maybe_run_list(const char *const *filenames, size_t n_filenames) {
299299
if (_current_executing_filename == NULL) {
300300
return false;
301301
}
302-
mp_hal_stdout_tx_str(line_clear);
302+
303+
// This function is used for `boot.py` and is thus logged to `boot_out.txt`.
304+
// We do not want the line clear to be logged.
305+
// The function `serial_write` is the only function that isn't logged into the file.
306+
serial_write(line_clear);
303307
mp_hal_stdout_tx_str(_current_executing_filename);
304308
serial_write_compressed(MP_ERROR_TEXT(" output:\n"));
305309

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "supervisor/board.h"
28+
29+
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#define MICROPY_HW_BOARD_NAME "Adafruit Pixel Trinkey M0"
2+
#define MICROPY_HW_MCU_NAME "samd21e18"
3+
4+
#define MICROPY_HW_NEOPIXEL (&pin_PA01)
5+
#define MICROPY_HW_NEOPIXEL_COUNT (1)
6+
7+
#define CIRCUITPY_BOARD_SPI (1)
8+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_PA05, .mosi = &pin_PA04, .miso = &pin_PA06}}
9+
10+
#define IGNORE_PIN_PA00 1
11+
12+
#define IGNORE_PIN_PA03 1
13+
14+
#define IGNORE_PIN_PA07 1
15+
#define IGNORE_PIN_PA08 1
16+
#define IGNORE_PIN_PA09 1
17+
#define IGNORE_PIN_PA10 1
18+
#define IGNORE_PIN_PA11 1
19+
// no PA12
20+
// no PA13
21+
#define IGNORE_PIN_PA14 1
22+
#define IGNORE_PIN_PA15 1
23+
#define IGNORE_PIN_PA16 1
24+
#define IGNORE_PIN_PA17 1
25+
#define IGNORE_PIN_PA18 1
26+
#define IGNORE_PIN_PA19 1
27+
// no PA20
28+
// no PA21
29+
#define IGNORE_PIN_PA22 1
30+
#define IGNORE_PIN_PA23 1
31+
// USB is always used internally so skip the pin objects for it.
32+
#define IGNORE_PIN_PA24 1
33+
#define IGNORE_PIN_PA25 1
34+
// no PA26
35+
#define IGNORE_PIN_PA27 1
36+
#define IGNORE_PIN_PA28 1
37+
// no PA29
38+
#define IGNORE_PIN_PA30 1
39+
#define IGNORE_PIN_PA31 1
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
USB_VID = 0x239A
2+
USB_PID = 0x8156
3+
USB_PRODUCT = "Pixel Trinkey M0"
4+
USB_MANUFACTURER = "Adafruit Industries LLC"
5+
6+
CHIP_VARIANT = SAMD21E18A
7+
CHIP_FAMILY = samd21
8+
9+
INTERNAL_FLASH_FILESYSTEM = 1
10+
LONGINT_IMPL = NONE
11+
12+
CIRCUITPY_FULL_BUILD = 0
13+
14+
CIRCUITPY_AUDIOCORE = 0
15+
CIRCUITPY_BUSIO_I2C = 0
16+
CIRCUITPY_PULSEIO = 1
17+
CIRCUITPY_PULSEIO_PULSEOUT = 0
18+
CIRCUITPY_PWMIO = 1
19+
CIRCUITPY_ROTARYIO = 0
20+
CIRCUITPY_RTC = 0
21+
CIRCUITPY_TOUCHIO = 0
22+
23+
CIRCUITPY_PIXELBUF = 1
24+
25+
# Include these Python libraries in firmware.
26+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
27+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include "shared-bindings/board/__init__.h"
2+
3+
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
4+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
5+
6+
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA01) },
7+
8+
// 10K-10K voltage divider
9+
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA02) },
10+
11+
// GPIO on 3-pin JST SH
12+
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA06) },
13+
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA06) },
14+
15+
{ MP_ROM_QSTR(MP_QSTR_DATA), MP_ROM_PTR(&pin_PA04) },
16+
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA04) },
17+
18+
{ MP_ROM_QSTR(MP_QSTR_CLOCK), MP_ROM_PTR(&pin_PA05) },
19+
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) },
20+
21+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
22+
};
23+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/nordic/common-hal/analogio/AnalogIn.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
7676
// Something else might have used the ADC in a different way,
7777
// so we completely re-initialize it.
7878

79-
nrf_saadc_value_t value = -1;
79+
nrf_saadc_value_t value = 0;
8080

8181
const nrf_saadc_channel_config_t config = {
8282
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,
@@ -120,6 +120,17 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
120120

121121
nrf_saadc_disable(NRF_SAADC);
122122

123+
// Adding the "asm volatile" memory fence here or anywhere after the declaration of `value`
124+
// fixes an issue with gcc13 which causes `value` to always be zero.
125+
// Compiling with gcc10 or gcc12 is fine.
126+
// It can also be fixed by declaring `value` to be static.
127+
// I think I'd like to declare `value` as volatile, but that causes type errors.
128+
asm volatile ("" : : : "memory");
129+
130+
// Disconnect ADC from pin.
131+
nrf_saadc_channel_input_set(NRF_SAADC, CHANNEL_NO, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED);
132+
133+
// value is signed and might be (slightly) < 0, even on single-ended conversions, so force to 0.
123134
if (value < 0) {
124135
value = 0;
125136
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#include "supervisor/board.h"
2+
3+
4+
#include "mpconfigboard.h"
5+
#include "shared-module/displayio/__init__.h"
6+
#include "shared-module/displayio/mipi_constants.h"
7+
#include "shared-bindings/board/__init__.h"
8+
9+
#define DELAY 0x80
10+
11+
fourwire_fourwire_obj_t board_display_obj;
12+
13+
// display init sequence according to https://github.com/adafruit/Adafruit_CircuitPython_ST7789
14+
uint8_t display_init_sequence[] = {
15+
0x01, 0 | DELAY, 0x96, // _SWRESET and Delay 150ms
16+
0x11, 0 | DELAY, 0xFF, // _SLPOUT and Delay 500ms
17+
0x3A, 0x81, 0x55, 0x0A, // _COLMOD and Delay 10ms
18+
0x36, 0x01, 0x08, // _MADCTL
19+
0x21, 0 | DELAY, 0x0A, // _INVON Hack and Delay 10ms
20+
0x13, 0 | DELAY, 0x0A, // _NORON and Delay 10ms
21+
0x36, 0x01, 0xC0, // _MADCTL
22+
0x29, 0 | DELAY, 0xFF, // _DISPON and Delay 500ms
23+
};
24+
25+
static void display_init(void) {
26+
27+
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
28+
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
29+
30+
bus->base.type = &fourwire_fourwire_type;
31+
32+
common_hal_fourwire_fourwire_construct(
33+
bus,
34+
spi,
35+
&pin_GPIO8, // TFT_DC
36+
&pin_GPIO9, // TFT_CS
37+
&pin_GPIO12, // TFT_RST
38+
50000000, // Baudrate
39+
0, // Polarity
40+
0 // Phase
41+
42+
);
43+
44+
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
45+
display->base.type = &busdisplay_busdisplay_type;
46+
47+
common_hal_busdisplay_busdisplay_construct(
48+
display,
49+
bus,
50+
240, // Width
51+
135, // Height
52+
53, // column start
53+
40, // row start
54+
270, // rotation
55+
16, // Color depth
56+
false, // Grayscale
57+
false, // Pixels in a byte share a row
58+
1, // bytes per cell
59+
false, // reverse_pixels_in_byte
60+
true, // reverse_pixels_in_word
61+
MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
62+
MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
63+
MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
64+
display_init_sequence,
65+
sizeof(display_init_sequence),
66+
&pin_GPIO25, // backlight pin
67+
NO_BRIGHTNESS_COMMAND,
68+
1.0f, // brightness
69+
false, // single_byte_bounds
70+
false, // data_as_commands
71+
true, // auto_refresh
72+
60, // native_frames_per_second
73+
true, // backlight_on_high
74+
false, // SH1107_addressing
75+
1000 // backlight pwm frequency
76+
);
77+
}
78+
79+
void board_init(void) {
80+
display_init();
81+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
// Micropython setup
28+
#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-GEEK"
29+
#define MICROPY_HW_MCU_NAME "rp2040"
30+
31+
#define CIRCUITPY_BOARD_I2C (1)
32+
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO29, .sda = &pin_GPIO28}}
33+
34+
#define CIRCUITPY_BOARD_SPI (2)
35+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO10, .mosi = &pin_GPIO11}, \
36+
{.clock = &pin_GPIO18, .mosi = &pin_GPIO19, .miso = &pin_GPIO20}}
37+
38+
#define CIRCUITPY_BOARD_UART (1)
39+
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO4, .rx = &pin_GPIO5}}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
USB_VID = 0x2E8A
2+
USB_PID = 0x1056
3+
USB_PRODUCT = "RP2040-GEEK"
4+
USB_MANUFACTURER = "Waveshare Electronics"
5+
6+
CHIP_VARIANT = RP2040
7+
CHIP_FAMILY = rp2
8+
9+
EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"
10+
11+
CIRCUITPY__EVE = 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Put board-specific pico-sdk definitions here. This file must exist.

0 commit comments

Comments
 (0)