Skip to content

Commit 754c36b

Browse files
authored
Merge pull request #867 from dhalbert/fix_pirkey_apa102
3.0 pirkey build including appropriate frozen modules
2 parents e1762f5 + 052a9ff commit 754c36b

File tree

9 files changed

+95
-8
lines changed

9 files changed

+95
-8
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@
6161
[submodule "ports/atmel-samd/Adafruit_CircuitPython_seesaw"]
6262
path = frozen/Adafruit_CircuitPython_seesaw
6363
url = https://github.com/adafruit/Adafruit_CircuitPython_seesaw.git
64+
[submodule "frozen/Adafruit_CircuitPython_IRRemote"]
65+
path = frozen/Adafruit_CircuitPython_IRRemote
66+
url = https://github.com/adafruit/Adafruit_CircuitPython_IRRemote.git
67+
[submodule "frozen/Adafruit_CircuitPython_DotStar"]
68+
path = frozen/Adafruit_CircuitPython_DotStar
69+
url = https://github.com/adafruit/Adafruit_CircuitPython_DotStar.git
Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#define MICROPY_HW_BOARD_NAME "Adafruit pIRKey M0"
22
#define MICROPY_HW_MCU_NAME "samd21e18"
33

4-
// #define MICROPY_HW_APA102_MOSI (&pin_PA00)
5-
// #define MICROPY_HW_APA102_SCK (&pin_PA01)
4+
#define MICROPY_HW_APA102_MOSI (&pin_PA00)
5+
#define MICROPY_HW_APA102_SCK (&pin_PA01)
66

77
// #define CIRCUITPY_BITBANG_APA102
88

@@ -12,6 +12,58 @@
1212

1313
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
1414

15+
// A number of modules are removed for pIRKey to make room for frozen libraries.
16+
#define PIRKEY_M0 (1)
17+
1518
#include "internal_flash.h"
1619

1720
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
21+
22+
#define IGNORE_PIN_PA02 1
23+
#define IGNORE_PIN_PA03 1
24+
#define IGNORE_PIN_PA04 1
25+
#define IGNORE_PIN_PA05 1
26+
#define IGNORE_PIN_PA06 1
27+
#define IGNORE_PIN_PA07 1
28+
#define IGNORE_PIN_PA08 1
29+
#define IGNORE_PIN_PA09 1
30+
#define IGNORE_PIN_PA10 1
31+
#define IGNORE_PIN_PA11 1
32+
#define IGNORE_PIN_PA12 1
33+
#define IGNORE_PIN_PA13 1
34+
#define IGNORE_PIN_PA14 1
35+
#define IGNORE_PIN_PA15 1
36+
#define IGNORE_PIN_PA16 1
37+
#define IGNORE_PIN_PA17 1
38+
#define IGNORE_PIN_PA18 1
39+
#define IGNORE_PIN_PA19 1
40+
#define IGNORE_PIN_PA20 1
41+
#define IGNORE_PIN_PA21 1
42+
#define IGNORE_PIN_PA22 1
43+
#define IGNORE_PIN_PA24 1
44+
#define IGNORE_PIN_PA25 1
45+
#define IGNORE_PIN_PA27 1
46+
#define IGNORE_PIN_PA30 1
47+
#define IGNORE_PIN_PA31 1
48+
#define IGNORE_PIN_PB00 1
49+
#define IGNORE_PIN_PB01 1
50+
#define IGNORE_PIN_PB02 1
51+
#define IGNORE_PIN_PB03 1
52+
#define IGNORE_PIN_PB04 1
53+
#define IGNORE_PIN_PB05 1
54+
#define IGNORE_PIN_PB06 1
55+
#define IGNORE_PIN_PB07 1
56+
#define IGNORE_PIN_PB08 1
57+
#define IGNORE_PIN_PB09 1
58+
#define IGNORE_PIN_PB10 1
59+
#define IGNORE_PIN_PB11 1
60+
#define IGNORE_PIN_PB12 1
61+
#define IGNORE_PIN_PB13 1
62+
#define IGNORE_PIN_PB14 1
63+
#define IGNORE_PIN_PB15 1
64+
#define IGNORE_PIN_PB16 1
65+
#define IGNORE_PIN_PB17 1
66+
#define IGNORE_PIN_PB22 1
67+
#define IGNORE_PIN_PB23 1
68+
#define IGNORE_PIN_PB30 1
69+
#define IGNORE_PIN_PB31 1

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ LONGINT_IMPL = NONE
99

1010
CHIP_VARIANT = SAMD21E18A
1111
CHIP_FAMILY = samd21
12+
13+
# Include these Python libraries in firmware.
14+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar
15+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID
16+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IRRemote

ports/atmel-samd/mpconfigport.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,23 @@ extern const struct _mp_obj_module_t usb_hid_module;
247247
#define TOUCHIO_MODULE
248248
#endif
249249

250+
// A pIRKey has minimal I/O needs. Remove unneeded modules to make room
251+
// for frozen modules. math is very large and is also removed.
252+
#ifdef PIRKEY_M0
253+
#define MICROPY_PORT_BUILTIN_MODULES \
254+
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
255+
{ MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, \
256+
{ MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module }, \
257+
{ MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)&microcontroller_module }, \
258+
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module }, \
259+
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module }, \
260+
{ MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module }, \
261+
{ MP_OBJ_NEW_QSTR(MP_QSTR_storage), (mp_obj_t)&storage_module }, \
262+
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&struct_module }, \
263+
{ MP_OBJ_NEW_QSTR(MP_QSTR_supervisor), (mp_obj_t)&supervisor_module }, \
264+
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
265+
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module },
266+
#else
250267
#define MICROPY_PORT_BUILTIN_MODULES \
251268
{ MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, \
252269
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
@@ -267,6 +284,7 @@ extern const struct _mp_obj_module_t usb_hid_module;
267284
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module }, \
268285
TOUCHIO_MODULE \
269286
EXTRA_BUILTIN_MODULES
287+
#endif
270288

271289
#define MICROPY_PORT_BUILTIN_DEBUG_MODULES \
272290
{ MP_OBJ_NEW_QSTR(MP_QSTR_uheap),(mp_obj_t)&uheap_module }, \

ports/atmel-samd/supervisor/port.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ safe_mode_t port_init(void) {
190190

191191
// Configure millisecond timer initialization.
192192
tick_init();
193+
194+
#ifndef PIRKEY_M0
193195
rtc_init();
196+
#endif
194197

195198
init_shared_dma();
196199
#ifdef CIRCUITPY_CANARY_WORD
@@ -243,18 +246,19 @@ void reset_port(void) {
243246
pulsein_reset();
244247
pulseout_reset();
245248
pwmout_reset();
249+
250+
#ifndef PIRKEY_M0
251+
analogin_reset();
252+
analogout_reset();
246253
rtc_reset();
254+
#endif
247255

248256
reset_gclks();
249257

250-
analogin_reset();
251-
252258
#ifdef CIRCUITPY_GAMEPAD_TICKS
253259
gamepad_reset();
254260
#endif
255261

256-
analogout_reset();
257-
258262
reset_event_system();
259263

260264
reset_all_pins();

0 commit comments

Comments
 (0)