Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
contiki-ng
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Admin message
Arrêt du service - 27/06 de 07h45 à 08h00 - Mise à jour de sécurité
Show more breadcrumbs
NATAF Emmanuel
contiki-ng
Commits
25afb832
Commit
25afb832
authored
7 years ago
by
George Oikonomou
Browse files
Options
Downloads
Patches
Plain Diff
Change CC2538 MQTT demo to use the button HAL
parent
04452758
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/platform-specific/cc2538-common/mqtt-demo/mqtt-demo.c
+6
-4
6 additions, 4 deletions
...les/platform-specific/cc2538-common/mqtt-demo/mqtt-demo.c
examples/platform-specific/cc2538-common/mqtt-demo/project-conf.h
+0
-1
0 additions, 1 deletion
.../platform-specific/cc2538-common/mqtt-demo/project-conf.h
with
6 additions
and
5 deletions
examples/platform-specific/cc2538-common/mqtt-demo/mqtt-demo.c
+
6
−
4
View file @
25afb832
...
...
@@ -50,7 +50,7 @@
#include
"sys/etimer.h"
#include
"sys/ctimer.h"
#include
"lib/sensors.h"
#include
"dev/button-
sensor
.h"
#include
"dev/button-
hal
.h"
#include
"dev/leds.h"
#include
"dev/cc2538-sensors.h"
...
...
@@ -138,7 +138,7 @@ static uint8_t state;
#define DEFAULT_RSSI_MEAS_INTERVAL (CLOCK_SECOND * 30)
/*---------------------------------------------------------------------------*/
/* Take a sensor reading on button press */
#define PUBLISH_TRIGGER
&button_sensor
#define PUBLISH_TRIGGER
BUTTON_HAL_ID_USER_BUTTON
/* Payload length of ICMPv6 echo requests used to measure RSSI with def rt */
#define ECHO_REQ_PAYLOAD_LEN 20
...
...
@@ -704,7 +704,8 @@ PROCESS_THREAD(mqtt_demo_process, ev, data)
PROCESS_YIELD
();
if
(
ev
==
sensors_event
&&
data
==
PUBLISH_TRIGGER
)
{
if
(
ev
==
button_hal_release_event
&&
((
button_hal_button_t
*
)
data
)
->
unique_id
==
PUBLISH_TRIGGER
)
{
if
(
state
==
STATE_ERROR
)
{
connect_attempt
=
1
;
state
=
STATE_REGISTERED
;
...
...
@@ -713,7 +714,8 @@ PROCESS_THREAD(mqtt_demo_process, ev, data)
if
((
ev
==
PROCESS_EVENT_TIMER
&&
data
==
&
publish_periodic_timer
)
||
ev
==
PROCESS_EVENT_POLL
||
(
ev
==
sensors_event
&&
data
==
PUBLISH_TRIGGER
))
{
(
ev
==
button_hal_release_event
&&
((
button_hal_button_t
*
)
data
)
->
unique_id
==
PUBLISH_TRIGGER
))
{
state_machine
();
}
...
...
This diff is collapsed.
Click to expand it.
examples/platform-specific/cc2538-common/mqtt-demo/project-conf.h
+
0
−
1
View file @
25afb832
...
...
@@ -45,7 +45,6 @@
/* User configuration */
#define MQTT_DEMO_STATUS_LED LEDS_GREEN
#define MQTT_DEMO_PUBLISH_TRIGGER &button_right_sensor
/* If undefined, the demo will attempt to connect to IBM's quickstart */
#define MQTT_DEMO_BROKER_IP_ADDR "fd00::1"
...
...
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