Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
cm-projects
RIOT
Commits
f4efb5b7
Commit
f4efb5b7
authored
7 years ago
by
Alexandre Abadie
Browse files
Options
Downloads
Patches
Plain Diff
pkg/semtech-loramac: update documentation
parent
378ec103
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/semtech-loramac/doc.txt
+24
-25
24 additions, 25 deletions
pkg/semtech-loramac/doc.txt
with
24 additions
and
25 deletions
pkg/semtech-loramac/doc.txt
+
24
−
25
View file @
f4efb5b7
...
@@ -43,14 +43,12 @@
...
@@ -43,14 +43,12 @@
* In your `main.c`, some header files must be first included:
* In your `main.c`, some header files must be first included:
* ```c
* ```c
* #include "net/loramac.h" /* core loramac definitions */
* #include "net/loramac.h" /* core loramac definitions */
* #include "semtech-loramac.h" /* package API */
* #include "semtech_loramac.h" /* package API */
* #include "sx127x.h" /* SX1272/6 device driver API */
* #include "sx127x_params.h" /* SX1272/6 device driver initialization parameters */
* ```
* ```
*
*
* Then define global variables:
* Then define global variables:
* ```c
* ```c
* s
x127x_t sx127x; /* SX1272/6
device descriptor */
* s
emtech_loramac_t loramac; /* The loramac stack
device descriptor */
* /* define the required keys for OTAA, e.g over-the-air activation (the
* /* define the required keys for OTAA, e.g over-the-air activation (the
* null arrays need to be updated with valid LoRa values) */
* null arrays need to be updated with valid LoRa values) */
* static const uint8_t deveui[LORAMAC_DEVEUI_LEN] = { 0x00, 0x00, 0x00, 0x00, \
* static const uint8_t deveui[LORAMAC_DEVEUI_LEN] = { 0x00, 0x00, 0x00, 0x00, \
...
@@ -64,39 +62,40 @@
...
@@ -64,39 +62,40 @@
* ```
* ```
*
*
* Now in the `main` function:
* Now in the `main` function:
* 1.
setup the radio driver with the initialization parameters (spi bus, pins, etc)
* 1.
initialize the LoRaMAC MAC layer
* 2.
initialize the LoRaMAC MAC layer
* 2.
set the LoRa keys
* 3.
set
the
LoRa keys
* 3.
join
the
network
* 4.
join
the network
* 4.
send some data to
the network
* 5.
send some data to the network
* 5.
wait for any potentially received data
*
*
* ```c
* ```c
* int main(void)
* int main(void)
* {
* {
* /* 1.
setup the radio driv
er */
* /* 1.
initialize the LoRaMAC MAC lay
er */
* s
x127x_setup(&sx127x, &sx127x_params[0]
);
* s
emtech_loramac_init(&loramac
);
*
*
* /* 2. initialize the LoRaMAC MAC layer */
* /* 2. set the keys identifying the device */
* semtech_loramac_init(&sx127x);
* semtech_loramac_set_deveui(&loramac, deveui);
* semtech_loramac_set_appeui(&loramac, appeui);
* semtech_loramac_set_appkey(&loramac, appkey);
*
*
* /* 3. set the device required keys */
* /* 3. join the network */
* semtech_loramac_set_deveui(deveui);
* if (semtech_loramac_join(&loramac, LORAMAC_JOIN_OTAA) != SEMTECH_LORAMAC_JOIN_SUCCEEDED) {
* semtech_loramac_set_appeui(appeui);
* semtech_loramac_set_appkey(appkey);
*
* /* 4. join the network */
* if (semtech_loramac_join(LORAMAC_JOIN_OTAA) != SEMTECH_LORAMAC_JOIN_SUCCEEDED) {
* puts("Join procedure failed");
* puts("Join procedure failed");
* return 1;
* return 1;
* }
* }
* puts("Join procedure succeeded");
* puts("Join procedure succeeded");
*
*
* /* 5. send some data using confirmable mode on port 10 and assuming no
* /* 4. send some data */
* data is received */
* char *message = "This is RIOT";
* char *message = "This is RIOT";
* semtech_loramac_rx_data_t rx_data;
* semtech_loramac_send(&loramac, (uint8_t *)message, strlen(message));
* semtech_loramac_send(LORAMAC_TX_CNF, 10,
*
(uint8_t *)message, strlen(message), &rx_data);
* /* 5. wait for any potentially received data */
* if (semtech_loramac_recv(&loramac) == SEMTECH_LORAMAC_DATA_RECEIVED) {
* loramac.rx_data.payload[loramac.rx_data.payload_len] = 0;
* printf("Data received: %s, port: %d\n",
* (char *)loramac.rx_data.payload, loramac.rx_data.port);
* }
* }
* }
* ```
* ```
*
*
...
...
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