Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Arduino Core for SAMD21 CPU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
Arduino Core for SAMD21 CPU
Commits
5ad078fa
Commit
5ad078fa
authored
10 years ago
by
Jonathan BAUDIN
Browse files
Options
Downloads
Patches
Plain Diff
Fixing UART (sercom0)
parent
4ebee7db
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cores/arduino/Uart.cpp
+7
-4
7 additions, 4 deletions
cores/arduino/Uart.cpp
cores/arduino/Uart.h
+4
-1
4 additions, 1 deletion
cores/arduino/Uart.h
with
11 additions
and
5 deletions
cores/arduino/Uart.cpp
+
7
−
4
View file @
5ad078fa
...
...
@@ -2,11 +2,11 @@
#include
"WVariant.h"
#include
"wiring_digital.h"
Uart
::
Uart
(
SERCOM
*
s
,
uint8_t
pinRX
,
uint8_t
pinTX
)
Uart
::
Uart
(
SERCOM
*
_
s
,
uint8_t
_
pinRX
,
uint8_t
_
pinTX
)
{
sercom
=
s
;
pinPeripheral
(
pinRX
,
g_APinDescription
[
pinRX
].
ulPinType
)
;
pinPeripheral
(
pinTX
,
g_APinDescription
[
pinTX
].
ulPinType
)
;
sercom
=
_
s
;
uc_pinRX
=
_pinRX
;
uc_pinTX
=
_pinTX
;
}
void
Uart
::
begin
(
unsigned
long
baudrate
)
...
...
@@ -16,6 +16,9 @@ void Uart::begin(unsigned long baudrate)
void
Uart
::
begin
(
unsigned
long
baudrate
,
uint8_t
config
)
{
pinPeripheral
(
uc_pinRX
,
g_APinDescription
[
uc_pinRX
].
ulPinType
);
pinPeripheral
(
uc_pinTX
,
g_APinDescription
[
uc_pinTX
].
ulPinType
);
sercom
->
initUART
(
UART_INT_CLOCK
,
SAMPLE_RATE_x16
,
baudrate
);
sercom
->
initFrame
(
extractCharSize
(
config
),
LSB_FIRST
,
extractParity
(
config
),
extractNbStopBit
(
config
));
sercom
->
initPads
(
UART_TX_PAD_2
,
SERCOM_RX_PAD_3
);
...
...
This diff is collapsed.
Click to expand it.
cores/arduino/Uart.h
+
4
−
1
View file @
5ad078fa
...
...
@@ -11,7 +11,7 @@
class
Uart
:
public
HardwareSerial
{
public:
Uart
(
SERCOM
*
s
,
uint8_t
pinRX
,
uint8_t
pinTX
);
Uart
(
SERCOM
*
_
s
,
uint8_t
_
pinRX
,
uint8_t
_
pinTX
);
void
begin
(
unsigned
long
baudRate
);
void
begin
(
unsigned
long
baudrate
,
uint8_t
config
);
void
end
();
...
...
@@ -29,6 +29,9 @@ class Uart : public HardwareSerial
private
:
SERCOM
*
sercom
;
RingBuffer
rxBuffer
;
uint8_t
uc_pinRX
;
uint8_t
uc_pinTX
;
SercomNumberStopBit
extractNbStopBit
(
uint8_t
config
);
SercomUartCharSize
extractCharSize
(
uint8_t
config
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment