Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ardupilot
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
Ardupilot
Commits
afcc3c73
Commit
afcc3c73
authored
12 years ago
by
Pat Hickey
Browse files
Options
Downloads
Patches
Plain Diff
FastSerial: add extra example sketch MultiFastSerial to test multiple ports
parent
b9372826
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/FastSerial/examples/MultiFastSerial/Makefile
+2
-0
2 additions, 0 deletions
libraries/FastSerial/examples/MultiFastSerial/Makefile
libraries/FastSerial/examples/MultiFastSerial/MultiFastSerial.pde
+83
-0
83 additions, 0 deletions
...s/FastSerial/examples/MultiFastSerial/MultiFastSerial.pde
with
85 additions
and
0 deletions
libraries/FastSerial/examples/MultiFastSerial/Makefile
0 → 100644
+
2
−
0
View file @
afcc3c73
BOARD
=
mega
include
../../../AP_Common/Arduino.mk
This diff is collapsed.
Click to expand it.
libraries/FastSerial/examples/MultiFastSerial/MultiFastSerial.pde
0 → 100644
+
83
−
0
View file @
afcc3c73
// -*- Mode: C++; c-basic-offset: 8; indent-tabs-mode: nil -*-
//
// Example code for the FastSerial driver.
//
// This code is placed into the public domain.
//
//
// Include the FastSerial library header.
//
// Note that this causes the standard Arduino Serial* driver to be
// disabled.
//
#include
<FastSerial.h>
#include
<AP_Common.h>
/* Not required by this sketch, but required by AP_Common */
#include
<AP_Math.h>
//
// Create a FastSerial driver that looks just like the stock Arduino
// driver, on each serial port.
//
FastSerialPort0
(
Serial
);
FastSerialPort1
(
Serial1
);
FastSerialPort2
(
Serial2
);
FastSerialPort3
(
Serial3
);
void
setup
(
void
)
{
//
// Set the speed for our replacement serial port.
//
Serial
.
begin
(
115200
);
Serial1
.
begin
(
115200
);
Serial2
.
begin
(
115200
);
Serial3
.
begin
(
115200
);
//
// Test printing things
//
Serial
.
print
(
"test"
);
Serial
.
println
(
" begin"
);
Serial
.
println
(
1000
);
Serial
.
println
(
1000
,
8
);
Serial
.
println
(
1000
,
10
);
Serial
.
println
(
1000
,
16
);
Serial
.
println_P
(
PSTR
(
"progmem"
));
Serial
.
printf
(
"printf %d %u %#x %p %f %S
\n
"
,
-
1000
,
1000
,
1000
,
1000
,
1.2345
,
PSTR
(
"progmem"
));
Serial
.
printf_P
(
PSTR
(
"printf_P %d %u %#x %p %f %S
\n
"
),
-
1000
,
1000
,
1000
,
1000
,
1.2345
,
PSTR
(
"progmem"
));
Serial
.
println
(
"done"
);
Serial1
.
println
(
"hello serial1"
);
Serial2
.
println
(
"hello serial2"
);
Serial3
.
println
(
"hello serial3"
);
}
void
loop
(
void
)
{
int
c
;
//
// Perform a simple loopback operation on each port.
//
c
=
Serial
.
read
();
if
(
-
1
!=
c
)
Serial
.
write
(
c
);
c
=
Serial1
.
read
();
if
(
-
1
!=
c
)
Serial1
.
write
(
c
);
c
=
Serial2
.
read
();
if
(
-
1
!=
c
)
Serial2
.
write
(
c
);
c
=
Serial3
.
read
();
if
(
-
1
!=
c
)
Serial3
.
write
(
c
);
}
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