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
efb8ed1f
Commit
efb8ed1f
authored
Nov 06, 2016
by
campenr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed output and made it consistent with output from Ardunio version.
parent
8ea51270
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
43 deletions
+40
-43
examples_linux/extra/scanner.cpp
examples_linux/extra/scanner.cpp
+40
-43
No files found.
examples_linux/extra/scanner.cpp
View file @
efb8ed1f
...
@@ -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
...
@@ -97,49 +99,44 @@ int main(int argc, char** argv)
...
@@ -97,49 +99,44 @@ int main(int argc, char** argv)
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
// forever loop
// forever loop
while
(
1
)
while
(
1
)
{
{
if
(
reset_array
==
1
)
// Clear measurement values
{
memset
(
values
,
0
,
sizeof
(
values
));
// Clear measurement values
memset
(
values
,
0
,
sizeof
(
values
));
// Scan all channels num_reps times
printf
(
"
\n
"
);
int
rep_counter
=
num_reps
;
}
while
(
rep_counter
--
)
{
// Scan all channels num_reps times
int
i
=
num_channels
;
int
i
=
num_channels
;
while
(
i
--
)
while
(
i
--
)
{
{
// Select this channel
radio
.
setChannel
(
i
);
// Select this channel
radio
.
setChannel
(
i
);
// Listen for a little
radio
.
startListening
();
// Listen for a little
delayMicroseconds
(
128
);
radio
.
startListening
();
//radio.stopListening();
delayMicroseconds
(
128
);
radio
.
stopListening
();
// Did we get a carrier?
if
(
radio
.
testCarrier
()
)
// Did we get a carrier?
++
values
[
i
];
if
(
radio
.
testCarrier
()
)
++
values
[
i
];
if
(
values
[
i
]
==
0xf
)
}
{
}
reset_array
=
2
;
}
// Print out channel measurements, clamped to a single hex digit
radio
.
stopListening
();
i
=
0
;
}
while
(
i
<
num_channels
)
{
// Print out channel measurements, clamped to a single hex digit
printf
(
"%x"
,
min
(
0xf
,(
values
[
i
]
&
0xf
)));
i
=
0
;
++
i
;
while
(
i
<
num_channels
)
}
{
printf
(
"
\n
"
);
printf
(
"%x"
,
min
(
0xf
,(
values
[
i
]
&
0xf
)));
}
++
i
;
}
printf
(
"
\n
"
);
}
return
0
;
return
0
;
}
}
...
...
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