Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ArduinoCore-megaAVR
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ArduinoCore-megaAVR
Commits
6d515555
Commit
6d515555
authored
Nov 17, 2020
by
Martino Facchin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serial: add bind() API for transparent passthrough
parent
c8a1dd99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
cores/arduino/UART.h
cores/arduino/UART.h
+3
-0
cores/arduino/UART_private.h
cores/arduino/UART_private.h
+3
-0
No files found.
cores/arduino/UART.h
View file @
6d515555
...
@@ -168,11 +168,14 @@ class UartClass : public HardwareSerial
...
@@ -168,11 +168,14 @@ class UartClass : public HardwareSerial
using
Print
::
write
;
// pull in write(str) and write(buf, size) from Print
using
Print
::
write
;
// pull in write(str) and write(buf, size) from Print
explicit
operator
bool
()
{
return
true
;
}
explicit
operator
bool
()
{
return
true
;
}
void
bind
(
UartClass
&
ser
)
{
bound
=
&
ser
;
}
// Interrupt handlers - Not intended to be called externally
// Interrupt handlers - Not intended to be called externally
inline
void
_rx_complete_irq
(
void
);
inline
void
_rx_complete_irq
(
void
);
void
_tx_data_empty_irq
(
void
);
void
_tx_data_empty_irq
(
void
);
private:
private:
void
_poll_tx_data_empty
(
void
);
void
_poll_tx_data_empty
(
void
);
UartClass
*
bound
=
NULL
;
};
};
#if defined(HWSERIAL0)
#if defined(HWSERIAL0)
...
...
cores/arduino/UART_private.h
View file @
6d515555
...
@@ -66,6 +66,9 @@ void UartClass::_rx_complete_irq(void)
...
@@ -66,6 +66,9 @@ void UartClass::_rx_complete_irq(void)
_rx_buffer
[
_rx_buffer_head
]
=
c
;
_rx_buffer
[
_rx_buffer_head
]
=
c
;
_rx_buffer_head
=
i
;
_rx_buffer_head
=
i
;
}
}
if
(
bound
!=
NULL
)
{
bound
->
write
(
c
);
}
}
else
{
}
else
{
// Parity error, read byte but discard it
// Parity error, read byte but discard it
(
*
_hwserial_module
).
RXDATAL
;
(
*
_hwserial_module
).
RXDATAL
;
...
...
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