10000 fluff_m0: add pin aliases by deshipu · Pull Request #3209 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

fluff_m0: add pin aliases 8000 #3209

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 2 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 24 additions & 0 deletions ports/atmel-samd/boards/fluff_m0/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,27 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

// There is no port B
#define IGNORE_PIN_PB00 1
#define IGNORE_PIN_PB01 1
#define IGNORE_PIN_PB02 1
#define IGNORE_PIN_PB03 1
#define IGNORE_PIN_PB04 1
#define IGNORE_PIN_PB05 1
#define IGNORE_PIN_PB06 1
#define IGNORE_PIN_PB07 1
#define IGNORE_PIN_PB08 1
#define IGNORE_PIN_PB09 1
#define IGNORE_PIN_PB10 1
#define IGNORE_PIN_PB11 1
#define IGNORE_PIN_PB12 1
#define IGNORE_PIN_PB13 1
#define IGNORE_PIN_PB14 1
#define IGNORE_PIN_PB15 1
#define IGNORE_PIN_PB16 1
#define IGNORE_PIN_PB17 1
#define IGNORE_PIN_PB22 1
#define IGNORE_PIN_PB23 1
#define IGNORE_PIN_PB30 1
#define IGNORE_PIN_PB31 1
Copy link
Collaborator
@dhalbert dhalbert Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out this is not necessary, because ports/atmel-samd/asf4/samd21/include/pio/samd21e18a.h does not even #define the PBnn pins. The checks in ports/atmel-samd/peripherals/samd/samd21/pins.c are of the form:

#if defined(PIN_PXnn) && !defined(IGNORE_PIN_PXnn)

so if the ASF4 include files don't even define a pin, you don't need to explicitly ignore it. (It doesn't hurt, of course.)

I discovered this by coincidence because I'm defining a new board also with SAMD21E18A, and wondered if I had to ignore non-existent pins. The answer is no. I checked by looking at the image size, which doesn't change whether or not the IGNORE... lines are there. (Note that it's a little bit tricky to compare the sizes, because the version string will change length depending on the last commit. and whether you've made changes since the last commit.)

I'll go back and clean up the other SAMD21E18A boards sooner or later. I plan to add a comment like:

// PBnn pins do not need to be ignored because they are not defined for this chip package.

3 changes: 3 additions & 0 deletions ports/atmel-samd/boards/fluff_m0/pins.c
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {

{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA31) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_SDO), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA30) },
{ MP_ROM_QSTR(MP_QSTR_SDI), MP_ROM_PTR(&pin_PA30) },

{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
Expand All @@ -31,6 +33,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_EN), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA28) },

{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
Expand Down
0