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
b9a4fc67
Commit
b9a4fc67
authored
Nov 07, 2016
by
TMRh20
Committed by
GitHub
Nov 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #301 from campenr/master
fixed output and made it consistent with output from Ardunio version.
parents
8ea51270
b233ea17
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
46 deletions
+44
-46
examples/scanner/scanner.ino
examples/scanner/scanner.ino
+4
-3
examples_linux/extra/scanner.cpp
examples_linux/extra/scanner.cpp
+40
-43
No files found.
examples/scanner/scanner.ino
View file @
b9a4fc67
...
@@ -62,6 +62,8 @@ void setup(void)
...
@@ -62,6 +62,8 @@ void setup(void)
radio
.
startListening
();
radio
.
startListening
();
radio
.
stopListening
();
radio
.
stopListening
();
radio
.
printDetails
();
// Print out header, high then low digit
// Print out header, high then low digit
int
i
=
0
;
int
i
=
0
;
while
(
i
<
num_channels
)
while
(
i
<
num_channels
)
...
@@ -102,14 +104,13 @@ void loop(void)
...
@@ -102,14 +104,13 @@ void loop(void)
// Listen for a little
// Listen for a little
radio
.
startListening
();
radio
.
startListening
();
delayMicroseconds
(
225
);
delayMicroseconds
(
128
);
radio
.
stopListening
();
// Did we get a carrier?
// Did we get a carrier?
if
(
radio
.
testCarrier
()
){
if
(
radio
.
testCarrier
()
){
++
values
[
i
];
++
values
[
i
];
}
}
radio
.
stopListening
();
}
}
}
}
...
...
examples_linux/extra/scanner.cpp
View file @
b9a4fc67
...
@@ -42,8 +42,10 @@ using namespace std;
...
@@ -42,8 +42,10 @@ using namespace std;
//RF24 radio(RPI_V2_GPIO_P1_15, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_4MHZ);
//RF24 radio(RPI_V2_GPIO_P1_15, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_4MHZ);
// Setup for GPIO 22 CE and CE1 CSN with SPI Speed @ 8Mhz
// Setup for GPIO 22 CE and CE1 CSN with SPI Speed @ 8Mhz
RF24
radio
(
RPI_V2_GPIO_P1_15
,
RPI_V2_GPIO_P1_24
,
BCM2835_SPI_SPEED_8MHZ
);
//
RF24 radio(RPI_V2_GPIO_P1_15, RPI_V2_GPIO_P1_24, BCM2835_SPI_SPEED_8MHZ);
// Generic setup
RF24
radio
(
22
,
0
);
//
//
// Channel info
// Channel info
...
@@ -99,34 +101,30 @@ int main(int argc, char** argv)
...
@@ -99,34 +101,30 @@ int main(int argc, char** argv)
// forever loop
// forever loop
while
(
1
)
while
(
1
)
{
if
(
reset_array
==
1
)
{
{
// Clear measurement values
// Clear measurement values
memset
(
values
,
0
,
sizeof
(
values
));
memset
(
values
,
0
,
sizeof
(
values
));
printf
(
"
\n
"
);
}
// Scan all channels num_reps times
// Scan all channels num_reps times
int
rep_counter
=
num_reps
;
while
(
rep_counter
--
)
{
int
i
=
num_channels
;
int
i
=
num_channels
;
while
(
i
--
)
while
(
i
--
)
{
{
// Select this channel
// Select this channel
radio
.
setChannel
(
i
);
radio
.
setChannel
(
i
);
// Listen for a little
// Listen for a little
radio
.
startListening
();
radio
.
startListening
();
delayMicroseconds
(
128
);
delayMicroseconds
(
128
);
//
radio.stopListening();
radio
.
stopListening
();
// Did we get a carrier?
// Did we get a carrier?
if
(
radio
.
testCarrier
()
)
if
(
radio
.
testCarrier
()
)
++
values
[
i
];
++
values
[
i
];
if
(
values
[
i
]
==
0xf
)
{
reset_array
=
2
;
}
}
radio
.
stopListening
();
}
}
// Print out channel measurements, clamped to a single hex digit
// Print out channel measurements, clamped to a single hex digit
...
@@ -136,7 +134,6 @@ int main(int argc, char** argv)
...
@@ -136,7 +134,6 @@ int main(int argc, char** argv)
printf
(
"%x"
,
min
(
0xf
,(
values
[
i
]
&
0xf
)));
printf
(
"%x"
,
min
(
0xf
,(
values
[
i
]
&
0xf
)));
++
i
;
++
i
;
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
...
...
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