Rationalize board header pin defines, and add partner board headers #192

Merged
kilograham merged 10 commits from board-headers into develop 2021-03-01 09:59:06 -06:00
kilograham commented 2021-02-25 16:27:42 -06:00 (Migrated from github.com)
No description provided.
Wren6991 (Migrated from github.com) reviewed 2021-02-25 16:27:42 -06:00
lurch (Migrated from github.com) reviewed 2021-02-25 17:26:35 -06:00
@ -32,0 +35,4 @@
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
lurch (Migrated from github.com) commented 2021-02-25 17:26:34 -06:00

Do we want to designate "default I2C" pins for Raspberry Pi Pico, given that there's no such designation of default pins on the pinout diagram at https://www.raspberrypi.org/documentation/pico/getting-started/ ? ping also @aallan

Do we _want_ to designate "default I2C" pins for Raspberry Pi Pico, given that there's no such designation of default pins on the pinout diagram at https://www.raspberrypi.org/documentation/pico/getting-started/ ? ping also @aallan
lurch (Migrated from github.com) reviewed 2021-02-25 17:33:49 -06:00
@ -0,0 +1,68 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
lurch (Migrated from github.com) commented 2021-02-25 17:33:48 -06:00

I'm obviously not a legal-expert 😉 but does the BSD-3-Clause require a <YEAR> and <COPYRIGHT HOLDER>? Or is it safe to assume those from the owner-of-the-repo and the date-of-commit?

I'm obviously not a legal-expert :wink: but does the [BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) _require_ a `<YEAR>` and `<COPYRIGHT HOLDER>`? Or is it safe to assume those from the owner-of-the-repo and the date-of-commit?
lurch (Migrated from github.com) reviewed 2021-02-25 17:40:04 -06:00
@ -12,22 +12,6 @@
#ifndef _BOARDS_VGABOARD_H
lurch (Migrated from github.com) commented 2021-02-25 17:40:04 -06:00

Nice 👍
...although I guess replacing #define PICO_DEFAULT_UART_TX_PIN 20 with #include "boards/pico.h" means that any programs built for vgaboard now have a different PICO_DEFAULT_UART_TX_PIN ? (although perhaps this doesn't matter? 🤷 .... although looking at page 26 of https://datasheets.raspberrypi.org/rp2040/hardware-design-with-rp2040.pdf I see that it does break out GPIO20 (as UART1_TX) to a UART header.)

Nice :+1: ...although I guess replacing `#define PICO_DEFAULT_UART_TX_PIN 20` with `#include "boards/pico.h"` means that any programs built for vgaboard now have a different `PICO_DEFAULT_UART_TX_PIN` ? (although perhaps this doesn't matter? :shrug: .... although looking at page 26 of https://datasheets.raspberrypi.org/rp2040/hardware-design-with-rp2040.pdf I see that it _does_ break out GPIO20 (as UART1_TX) to a UART header.)
lurch (Migrated from github.com) reviewed 2021-02-25 17:44:20 -06:00
@ -56,6 +56,16 @@ extern "C" {
#include "pico/stdio_semihosting.h"
#endif
// PICO_CONFIG: PICO_DEFAULT_LED_PIN, Optionally defined a pin that drives a regular LED on the board, default=undefined, group=pico_stdlib
lurch (Migrated from github.com) commented 2021-02-25 17:44:20 -06:00

See e.g. https://github.com/raspberrypi/pico-sdk/pull/183/commits/9b05c241a86e46ad1e8aa8831e159440e23bc232
I wonder if it's better to simply omit default, rather than having default=undefined ?

EDIT: Or I could add special-handling to our workflows for default=undefined if you think that'd work better?

See e.g. https://github.com/raspberrypi/pico-sdk/pull/183/commits/9b05c241a86e46ad1e8aa8831e159440e23bc232 I wonder if it's better to simply omit `default`, rather than having `default=undefined` ? EDIT: Or I could add special-handling to our workflows for `default=undefined` if you think that'd work better?
lurch (Migrated from github.com) reviewed 2021-02-25 17:47:25 -06:00
@ -56,6 +56,16 @@ extern "C" {
#include "pico/stdio_semihosting.h"
#endif
// PICO_CONFIG: PICO_DEFAULT_LED_PIN, Optionally defined a pin that drives a regular LED on the board, default=undefined, group=pico_stdlib
lurch (Migrated from github.com) commented 2021-02-25 17:47:25 -06:00

The comments on #191 kinda imply we might also want an optional boolean PICO_DEFAULT_LED_PIN_ACTIVE_HIGH config-setting? (defaulting to 1, can be set to 0 for those boards with an active-low LED)
EDIT: Now added as PICO_DEFAULT_LED_PIN_INVERTED

The comments on #191 kinda imply we might also want an optional boolean `PICO_DEFAULT_LED_PIN_ACTIVE_HIGH` config-setting? (defaulting to 1, can be set to 0 for those boards with an active-low LED) EDIT: Now added as `PICO_DEFAULT_LED_PIN_INVERTED`
lurch (Migrated from github.com) reviewed 2021-02-25 17:50:08 -06:00
lurch (Migrated from github.com) commented 2021-02-25 17:50:08 -06:00

Why remove the warning? Are we expecting RP2040 boards to appear with no Flash fitted at all?

Why remove the warning? Are we expecting RP2040 boards to appear with no Flash fitted at all?
lurch (Migrated from github.com) reviewed 2021-02-25 17:50:41 -06:00
lurch (Migrated from github.com) commented 2021-02-25 17:50:41 -06:00

LOL :)

LOL :)
lurch (Migrated from github.com) reviewed 2021-02-25 17:56:37 -06:00
lurch (Migrated from github.com) commented 2021-02-25 17:56:36 -06:00

This may be a silly question, but why the separate uart_default define rather than just continuing to use PICO_DEFAULT_UART_INSTANCE ?

This may be a silly question, but why the separate `uart_default` define rather than just continuing to use `PICO_DEFAULT_UART_INSTANCE` ?
kilograham (Migrated from github.com) reviewed 2021-02-25 17:57:56 -06:00
kilograham (Migrated from github.com) commented 2021-02-25 17:57:56 -06:00

just seemed friendlier

just seemed friendlier
kilograham (Migrated from github.com) reviewed 2021-02-25 17:59:18 -06:00
kilograham (Migrated from github.com) commented 2021-02-25 17:59:18 -06:00

I removed it in favor of a warning where it is used

I removed it in favor of a warning where it is used
lurch (Migrated from github.com) reviewed 2021-02-25 18:00:55 -06:00
@ -55,9 +57,9 @@ void stdout_uart_init() {
}
lurch (Migrated from github.com) commented 2021-02-25 18:00:55 -06:00

AFAICT this is "inside" the outer #if defined(uart_default) && ... block, which suggests that the || !defined(uart_default) here is redundant?

AFAICT this is "inside" the outer `#if defined(uart_default) && ...` block, which suggests that the ` || !defined(uart_default)` here is redundant?
lurch commented 2021-02-25 18:15:29 -06:00 (Migrated from github.com)

Something else I was wondering earlier today... would it be possible to have a compile-time #error if you give an invalid combination of UART_DEFAULT settings? e.g. setting {PICO_DEFAULT_UART=0, PICO_DEFAULT_UART_TX_PIN=13} (invalid because GPIO13 is UART0 RX) or (PICO_DEFAULT_UART=1, PICO_DEFAULT_UART_TX_PIN=0) (invalid because GPIO0 is UART0 TX)
(with similar things being done for I2C and SPI) ... hmmm perhaps I should create this as a separate issue for the next SDK release? 🙂

EDIT: Created #204 for this.

Something else I was wondering earlier today... would it be possible to have a compile-time `#error` if you give an invalid combination of UART_DEFAULT settings? e.g. setting {PICO_DEFAULT_UART=0, PICO_DEFAULT_UART_TX_PIN=13} (invalid because GPIO13 is UART0 **RX**) or (PICO_DEFAULT_UART=1, PICO_DEFAULT_UART_TX_PIN=0) (invalid because GPIO0 is **UART0** TX) (with similar things being done for I2C and SPI) ... hmmm perhaps I should create this as a separate issue for the _next_ SDK release? :slightly_smiling_face: EDIT: Created #204 for this.
lurch (Migrated from github.com) reviewed 2021-02-25 18:26:20 -06:00
lurch (Migrated from github.com) commented 2021-02-25 18:26:20 -06:00

The fact that this is tied specifically to the uart_default (rather than taking a uart_inst_t parameter as other functions do) seems a bit limiting, so I did a git grep and this function doesn't actually seem to be used anywhere, so could probably be removed?
...oh, I see it's actually used in https://github.com/raspberrypi/pico-examples/blob/master/clocks/hello_resus/hello_resus.c Does that "make sense" (I know nothing about resus) and does that mean that the hello_resus example won't work if the USB stdio is used instead? 🤷

The fact that this is tied specifically to the `uart_default` (rather than taking a `uart_inst_t` parameter as other functions do) seems a bit limiting, so I did a `git grep` and this function doesn't actually seem to be used anywhere, so could probably be removed? ...oh, I see it's actually used in https://github.com/raspberrypi/pico-examples/blob/master/clocks/hello_resus/hello_resus.c Does that "make sense" (I know nothing about resus) and does that mean that the hello_resus example won't work if the USB stdio is used instead? :shrug:
lurch (Migrated from github.com) reviewed 2021-02-25 18:30:17 -06:00
@ -343,3 +343,3 @@
static inline void sm_config_set_mov_status(pio_sm_config *c, enum pio_mov_status_type status_sel, uint status_n) {
valid_params_if(PIO, join >= STATUS_TX_LESSTHAN && join <= STATUS_RX_LESSTHAN);
valid_params_if(PIO, status_sel >= STATUS_TX_LESSTHAN && status_sel <= STATUS_RX_LESSTHAN);
c->execctrl = (c->execctrl
lurch (Migrated from github.com) commented 2021-02-25 18:30:17 -06:00

OMG, sorry I didn't spot that! ☹️

OMG, sorry I didn't spot that! :frowning_face:
lurch (Migrated from github.com) reviewed 2021-02-25 19:01:56 -06:00
@ -56,6 +56,16 @@ extern "C" {
#include "pico/stdio_semihosting.h"
#endif
lurch (Migrated from github.com) commented 2021-02-25 19:01:56 -06:00

Haha, I suspect PICO_DEFAULT_LED_PIN_PICO_DEFAULT_LED_PIN_INVERTED ought to be just PICO_DEFAULT_LED_PIN_INVERTED 😜

Haha, I suspect `PICO_DEFAULT_LED_PIN_PICO_DEFAULT_LED_PIN_INVERTED` ought to be just `PICO_DEFAULT_LED_PIN_INVERTED` :stuck_out_tongue_winking_eye:
lurch (Migrated from github.com) reviewed 2021-02-26 05:28:35 -06:00
@ -48,6 +48,10 @@ extern "C" {
lurch (Migrated from github.com) commented 2021-02-26 05:28:35 -06:00

IIRC SDA is bidirectional, so I suspect the "I2C TX SDA" here should have been "I2C SDA PIN" ?

IIRC SDA is bidirectional, so I suspect the "I2C TX SDA" here should have been "I2C SDA PIN" ?
kilograham (Migrated from github.com) reviewed 2021-02-26 08:46:05 -06:00
@ -32,0 +35,4 @@
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
kilograham (Migrated from github.com) commented 2021-02-26 08:46:05 -06:00

this is just to indicate an I2C to use by default

this is just to indicate an I2C to use by default
kilograham (Migrated from github.com) reviewed 2021-02-26 08:46:48 -06:00
@ -12,22 +12,6 @@
#ifndef _BOARDS_VGABOARD_H
kilograham (Migrated from github.com) commented 2021-02-26 08:46:48 -06:00

oops

oops
kilograham (Migrated from github.com) reviewed 2021-02-26 08:48:49 -06:00
@ -56,6 +56,16 @@ extern "C" {
#include "pico/stdio_semihosting.h"
#endif
// PICO_CONFIG: PICO_DEFAULT_LED_PIN, Optionally defined a pin that drives a regular LED on the board, default=undefined, group=pico_stdlib
kilograham (Migrated from github.com) commented 2021-02-26 08:48:49 -06:00

the intention here is to indicate that the value is omitted rather than having a default value

the intention here is to indicate that the value is omitted rather than having a default value
kilograham (Migrated from github.com) reviewed 2021-02-26 08:50:00 -06:00
@ -55,9 +57,9 @@ void stdout_uart_init() {
}
kilograham (Migrated from github.com) commented 2021-02-26 08:50:00 -06:00

fixed

fixed
kilograham (Migrated from github.com) reviewed 2021-02-26 08:51:10 -06:00
@ -56,6 +56,16 @@ extern "C" {
#include "pico/stdio_semihosting.h"
#endif
kilograham (Migrated from github.com) commented 2021-02-26 08:51:10 -06:00

fixed

fixed
lurch (Migrated from github.com) reviewed 2021-02-26 09:21:09 -06:00
@ -32,0 +35,4 @@
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
lurch (Migrated from github.com) commented 2021-02-26 09:21:09 -06:00

In that case I wonder if it might be worth highlighting them with a slightly different colour on https://www.raspberrypi.org/documentation/pico/getting-started/static/15243f1ffd3b8ee646a1708bf4c0e866/Pico-R3-Pinout.svg as we do for the UART function on physical pins 1 and 2? 🤷

In that case I wonder if it might be worth highlighting them with a slightly different colour on https://www.raspberrypi.org/documentation/pico/getting-started/static/15243f1ffd3b8ee646a1708bf4c0e866/Pico-R3-Pinout.svg as we do for the UART function on physical pins 1 and 2? :shrug:
kilograham commented 2021-02-27 12:10:09 -06:00 (Migrated from github.com)

fixes #134

fixes #134
lurch commented 2021-03-01 05:32:56 -06:00 (Migrated from github.com)

Needs rebasing as GH is reporting a conflict in src/rp2_common/hardware_flash/include/hardware/flash.h.
And I'm still not convinced about having default=undefined in the PICO_CONFIG lines, but we can address that in a subsequent PR.

Otherwise LGTM 👍

Needs rebasing as GH is reporting a conflict in `src/rp2_common/hardware_flash/include/hardware/flash.h`. And I'm still not convinced about having `default=undefined` in the PICO_CONFIG lines, but we can address that in a subsequent PR. Otherwise LGTM :+1:
Wren6991 (Migrated from github.com) reviewed 2021-03-01 08:19:25 -06:00
@ -0,0 +1,91 @@
/*
Wren6991 (Migrated from github.com) commented 2021-03-01 08:19:25 -06:00

Mistake in the header here -- these GPIOs are both for UART1.

Mistake in the header here -- these GPIOs are both for UART1.
lurch (Migrated from github.com) reviewed 2021-03-01 08:21:53 -06:00
@ -0,0 +1,91 @@
/*
lurch (Migrated from github.com) commented 2021-03-01 08:21:53 -06:00

Ahhh, so perhaps https://github.com/raspberrypi/pico-sdk/pull/192#issuecomment-786318489 wasn't such a crazy idea after all 😉 I'll create an issue for it.

Ahhh, so perhaps https://github.com/raspberrypi/pico-sdk/pull/192#issuecomment-786318489 wasn't such a crazy idea after all :wink: I'll create an issue for it.
Wren6991 (Migrated from github.com) reviewed 2021-03-01 08:32:10 -06:00
Wren6991 (Migrated from github.com) left a comment
No description provided.
Had a read through, happy for this to be merged as is, there are those two issues in partner headers (missing copyright on one, and wrong UART instance on another) but those could be a separate PR, in view of getting 1.0.2 out the door
kilograham (Migrated from github.com) reviewed 2021-03-01 08:44:43 -06:00
kilograham (Migrated from github.com) commented 2021-03-01 08:44:43 -06:00

open a separate PR

open a separate PR
kilograham (Migrated from github.com) reviewed 2021-03-01 08:46:58 -06:00
@ -0,0 +1,68 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
kilograham (Migrated from github.com) commented 2021-03-01 08:46:58 -06:00

fixed

fixed
kilograham (Migrated from github.com) reviewed 2021-03-01 08:47:46 -06:00
@ -0,0 +1,91 @@
/*
kilograham (Migrated from github.com) commented 2021-03-01 08:47:46 -06:00

fixed

fixed
lurch (Migrated from github.com) approved these changes 2021-03-01 08:58:39 -06:00
lurch (Migrated from github.com) left a comment

Copyright years probably ought to be 2021 rather than 2020, but I'm not gonna quibble that as this PR has already seen enough comments.

Copyright years probably ought to be 2021 rather than 2020, but I'm not gonna quibble that as this PR has already seen enough comments.
liamfraser (Migrated from github.com) approved these changes 2021-03-01 09:31:49 -06:00
liamfraser (Migrated from github.com) left a comment

Dates could be 2021 but not critical

Dates could be 2021 but not critical
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!192
No description provided.