diff --git a/examples/platform-specific/cc2538-common/mqtt-demo/mqtt-demo.c b/examples/platform-specific/cc2538-common/mqtt-demo/mqtt-demo.c index b818b88ca5a22293fb54ff3d7f0d3624a92d44ac..5ed836cc1d38f71043caedf07aa930bb46490f51 100644 --- a/examples/platform-specific/cc2538-common/mqtt-demo/mqtt-demo.c +++ b/examples/platform-specific/cc2538-common/mqtt-demo/mqtt-demo.c @@ -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(); } diff --git a/examples/platform-specific/cc2538-common/mqtt-demo/project-conf.h b/examples/platform-specific/cc2538-common/mqtt-demo/project-conf.h index a3cc4073b3498c40a93d8f9305123397ed397169..ac86990c60226b8b09c6feb80468b706602a725e 100644 --- a/examples/platform-specific/cc2538-common/mqtt-demo/project-conf.h +++ b/examples/platform-specific/cc2538-common/mqtt-demo/project-conf.h @@ -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"