FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Raspberry/PiGateway.cpp at master · aliasdoc/Raspberry · GitHub
aliasdoc
/
Raspberry
Public
forked from
mysensors/Raspberry
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Raspberry
/
PiGateway.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (36 loc) · 917 Bytes
Breadcrumbs
Raspberry
/
PiGateway.cpp
Copy path
File metadata and controls
47 lines (36 loc) · 917 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
The MySensors library adds a new layer on top of the RF24 library.
It handles radio network routing, relaying and ids.
Created by OUJABER Mohamed <m.oujaber@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/
#
include
<
stdio.h
>
#
include
"
MyGateway.h
"
#
include
<
RF24.h
>
MyGateway *gw;
void
msgCallback
(
char
*msg){
printf
(
"
[CALLBACK]%s
"
, msg);
}
void
setup
(
void
)
{
printf
(
"
Starting Gateway...
\n
"
);
gw =
new
MyGateway
(
RPI_V2_GPIO_P1_22
,
RPI_V2_GPIO_P1_24
,
BCM2835_SPI_SPEED_8MHZ
,
30000
);
if
(gw ==
NULL
)
{
printf
(
"
gw is null!
"
);
}
gw->
begin
(
RF24_PA_LEVEL_GW
,
RF24_CHANNEL
,
RF24_DATARATE
, &msgCallback);
}
void
loop
(
void
)
{
gw->
processRadioMessage
();
}
int
main
(
int
argc,
char
** argv)
{
setup
();
while
(
1
)
loop
();
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL