Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-pico
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-pico
Commits
85d39cf2
Unverified
Commit
85d39cf2
authored
Sep 04, 2022
by
Earle F. Philhower, III
Committed by
GitHub
Sep 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore GPIO functions on SerialUART::end (#836)
Fix #834
parent
2d777acc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
cores/rp2040/SerialUART.cpp
cores/rp2040/SerialUART.cpp
+15
-0
cores/rp2040/SerialUART.h
cores/rp2040/SerialUART.h
+1
-0
No files found.
cores/rp2040/SerialUART.cpp
View file @
85d39cf2
...
...
@@ -171,12 +171,16 @@ void SerialUART::begin(unsigned long baud, uint16_t config) {
break
;
}
uart_set_format
(
_uart
,
bits
,
stop
,
parity
);
_fcnTx
=
gpio_get_function
(
_tx
);
_fcnRx
=
gpio_get_function
(
_rx
);
gpio_set_function
(
_tx
,
GPIO_FUNC_UART
);
gpio_set_function
(
_rx
,
GPIO_FUNC_UART
);
if
(
_rts
!=
UART_PIN_NOT_DEFINED
)
{
_fcnRts
=
gpio_get_function
(
_rts
);
gpio_set_function
(
_rts
,
GPIO_FUNC_UART
);
}
if
(
_cts
!=
UART_PIN_NOT_DEFINED
)
{
_fcnCts
=
gpio_get_function
(
_cts
);
gpio_set_function
(
_cts
,
GPIO_FUNC_UART
);
}
uart_set_hw_flow
(
_uart
,
_rts
!=
UART_PIN_NOT_DEFINED
,
_cts
!=
UART_PIN_NOT_DEFINED
);
...
...
@@ -211,6 +215,7 @@ void SerialUART::end() {
irq_set_enabled
(
UART1_IRQ
,
false
);
}
}
// Paranoia - ensure nobody else is using anything here at the same time
mutex_enter_blocking
(
&
_mutex
);
mutex_enter_blocking
(
&
_fifoMutex
);
...
...
@@ -219,6 +224,16 @@ void SerialUART::end() {
// Reset the mutexes once all is off/cleaned up
mutex_exit
(
&
_fifoMutex
);
mutex_exit
(
&
_mutex
);
// Restore pin functions
gpio_set_function
(
_tx
,
_fcnTx
);
gpio_set_function
(
_rx
,
_fcnRx
);
if
(
_rts
!=
UART_PIN_NOT_DEFINED
)
{
gpio_set_function
(
_rts
,
_fcnRts
);
}
if
(
_cts
!=
UART_PIN_NOT_DEFINED
)
{
gpio_set_function
(
_cts
,
_fcnCts
);
}
}
void
SerialUART
::
_pumpFIFO
()
{
...
...
cores/rp2040/SerialUART.h
View file @
85d39cf2
...
...
@@ -71,6 +71,7 @@ private:
uart_inst_t
*
_uart
;
pin_size_t
_tx
,
_rx
;
pin_size_t
_rts
,
_cts
;
enum
gpio_function
_fcnTx
,
_fcnRx
,
_fcnRts
,
_fcnCts
;
int
_baud
;
mutex_t
_mutex
;
bool
_polling
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment