-
Notifications
You must be signed in to change notification settings - Fork 196
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
Move selection of UART interface and baudrate to picoprobe_config.h #7
Conversation
@@ -30,5 +30,7 @@ | |||
// UART config | |||
#define PICOPROBE_UART_TX 4 | |||
#define PICOPROBE_UART_RX 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refers to the base code too, but what is the benefit in general of not using
PICO_DEFAULT_UART_BAUD_RATE (_TX_PIN, RX_PIN etc) as the default values for PICOPROBE values unless they are defined by the user
i;.e
#ifndef PICOPROBE_UART_TX
#define PICOPROBE_UART_TX PICO_DEFAULT_UART_TX_PIN
#endif
which i'd prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the answer to that depends on why @liamfraser opted to use UART pins 4 and 5 in the first place, instead of just sticking to the default 0 and 1 ? 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if picoprobe_config.h switches to using
#ifndef PICOPROBE_UART_TX
#define PICOPROBE_UART_TX PICO_DEFAULT_UART_TX_PIN
#endif
where does the definition of a non-default PICOPROBE_UART_TX move to? CMakeLists.txt? Only allow it to be specified on the cmake
command line? (I'm not being facetious, I'm genuinely curious)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it would from CMakeLists.txt (which could (should) choose to pick it up from the command line or environment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason it is done like this is so you can use the default uart as a debug uart and uart1 as the uart that binds to usb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never written any CMake before. But poking around in some of the other cmake files, would I want to do something like this?
if (DEFINED ENV{PICOPROBE_UART_TX} AND (NOT PICOPROBE_UART_TX))
set(PICOPROBE_UART_TX $ENV{PICOPROBE_UART_TX})
message("Using PICOPROBE_UART_TX from environment (${PICOPROBE_UART_TX})")
else ()
set(PICOPROBE_UART_TX 4)
endif ()
🤷
Fixes #1