Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RF24
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
RF24
Commits
85495668
Commit
85495668
authored
Jul 06, 2011
by
maniacbug
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified printing, ok to do just from the irq handler
parent
d3fff68a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
23 deletions
+4
-23
examples/pingpair_irq/pingpair_irq.pde
examples/pingpair_irq/pingpair_irq.pde
+4
-23
No files found.
examples/pingpair_irq/pingpair_irq.pde
View file @
85495668
...
...
@@ -56,10 +56,6 @@ const char* role_friendly_name[] = { "invalid", "Sender", "Receiver"};
// The role of the current running sketch
role_e
role
;
// Message buffer to allow interrupt handler to print messages
bool
message_ready
;
char
message
[
100
];
// Interrupt handler, check the radio because we got an IRQ
void
check_radio
(
void
);
...
...
@@ -150,7 +146,7 @@ void loop(void)
{
// Take the time, and send it.
unsigned
long
time
=
millis
();
printf
(
"Now sending %lu
...
"
,
time
);
printf
(
"Now sending %lu
\n\r
"
,
time
);
radio
.
startWrite
(
&
time
,
sizeof
(
unsigned
long
)
);
// Try again soon
...
...
@@ -185,14 +181,6 @@ void loop(void)
}
}
//
// Message handler. Display messages from the interrupt
//
if
(
message_ready
)
{
message_ready
=
false
;
Serial
.
println
(
message
);
}
}
void
check_radio
(
void
)
...
...
@@ -201,29 +189,22 @@ void check_radio(void)
bool
tx
,
fail
,
rx
;
radio
.
whatHappened
(
tx
,
fail
,
rx
);
char
*
messageptr
=
message
;
message_ready
=
true
;
sprintf
(
message
,
"Unknown"
);
if
(
tx
)
{
radio
.
powerDown
();
sprintf
(
messageptr
,
"Send:OK "
);
messageptr
+=
strlen
(
messageptr
);
printf
(
"Send:OK
\n\r
"
);
}
if
(
fail
)
{
radio
.
powerDown
();
sprintf
(
messageptr
,
"Send:Failed "
);
messageptr
+=
strlen
(
messageptr
);
printf
(
"Send:Failed
\n\r
"
);
}
if
(
rx
)
{
radio
.
read
(
&
message_count
,
sizeof
(
message_count
));
sprintf
(
messageptr
,
"Ack:%lu "
,
message_count
);
messageptr
+=
strlen
(
messageptr
);
printf
(
"Ack:%lu
\n\r
"
,
message_count
);
}
}
...
...
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