Extend the CC26xx web demo to support the LaunchPad

This commit is contained in:
George Oikonomou 2016-01-24 16:54:45 +00:00
parent 54f0a2ecbd
commit 61e619dfcd
4 changed files with 13 additions and 13 deletions

View file

@ -175,7 +175,7 @@ static void
save_config() save_config()
{ {
/* Dump current running config to flash */ /* Dump current running config to flash */
#if BOARD_SENSORTAG #if BOARD_SENSORTAG || BOARD_LAUNCHPAD
int rv; int rv;
cc26xx_web_demo_sensor_reading_t *reading = NULL; cc26xx_web_demo_sensor_reading_t *reading = NULL;
@ -218,7 +218,7 @@ save_config()
static void static void
load_config() load_config()
{ {
#if BOARD_SENSORTAG #if BOARD_SENSORTAG || BOARD_LAUNCHPAD
/* Read from flash into a temp buffer */ /* Read from flash into a temp buffer */
cc26xx_web_demo_config_t tmp_cfg; cc26xx_web_demo_config_t tmp_cfg;
cc26xx_web_demo_sensor_reading_t *reading = NULL; cc26xx_web_demo_sensor_reading_t *reading = NULL;

View file

@ -100,6 +100,8 @@
#if BOARD_SENSORTAG #if BOARD_SENSORTAG
/* Force an MQTT publish on sensor event */ /* Force an MQTT publish on sensor event */
#define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER &reed_relay_sensor #define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER &reed_relay_sensor
#elif BOARD_LAUNCHPAD
#define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER &button_left_sensor
#else #else
#define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER &button_down_sensor #define CC26XX_WEB_DEMO_MQTT_PUBLISH_TRIGGER &button_down_sensor
#endif #endif

View file

@ -63,6 +63,9 @@ extern resource_t res_parent_ip;
extern resource_t res_ble_advd; extern resource_t res_ble_advd;
#endif #endif
extern resource_t res_toggle_red;
extern resource_t res_toggle_green;
/* Board-specific resources */ /* Board-specific resources */
#if BOARD_SENSORTAG #if BOARD_SENSORTAG
extern resource_t res_bmp280_temp; extern resource_t res_bmp280_temp;
@ -78,11 +81,7 @@ extern resource_t res_mpu_acc_z;
extern resource_t res_mpu_gyro_x; extern resource_t res_mpu_gyro_x;
extern resource_t res_mpu_gyro_y; extern resource_t res_mpu_gyro_y;
extern resource_t res_mpu_gyro_z; extern resource_t res_mpu_gyro_z;
extern resource_t res_toggle_red;
extern resource_t res_toggle_green;
#else #else
extern resource_t res_toggle_red;
extern resource_t res_toggle_green;
extern resource_t res_toggle_orange; extern resource_t res_toggle_orange;
extern resource_t res_toggle_yellow; extern resource_t res_toggle_yellow;
#endif #endif
@ -96,6 +95,11 @@ const char *coap_server_supported_msg = "Supported:"
static void static void
start_board_resources(void) start_board_resources(void)
{ {
rest_activate_resource(&res_toggle_green, "lt/g");
rest_activate_resource(&res_toggle_red, "lt/r");
rest_activate_resource(&res_leds, "lt");
#if BOARD_SENSORTAG #if BOARD_SENSORTAG
rest_activate_resource(&res_bmp280_temp, "sen/bar/temp"); rest_activate_resource(&res_bmp280_temp, "sen/bar/temp");
rest_activate_resource(&res_bmp280_press, "sen/bar/pres"); rest_activate_resource(&res_bmp280_press, "sen/bar/pres");
@ -110,14 +114,8 @@ start_board_resources(void)
rest_activate_resource(&res_mpu_gyro_x, "sen/mpu/gyro/x"); rest_activate_resource(&res_mpu_gyro_x, "sen/mpu/gyro/x");
rest_activate_resource(&res_mpu_gyro_y, "sen/mpu/gyro/y"); rest_activate_resource(&res_mpu_gyro_y, "sen/mpu/gyro/y");
rest_activate_resource(&res_mpu_gyro_z, "sen/mpu/gyro/z"); rest_activate_resource(&res_mpu_gyro_z, "sen/mpu/gyro/z");
rest_activate_resource(&res_leds, "lt");
rest_activate_resource(&res_toggle_green, "lt/g");
rest_activate_resource(&res_toggle_red, "lt/r");
#elif BOARD_SMARTRF06EB #elif BOARD_SMARTRF06EB
rest_activate_resource(&res_leds, "lt");
rest_activate_resource(&res_toggle_red, "lt/r");
rest_activate_resource(&res_toggle_yellow, "lt/y"); rest_activate_resource(&res_toggle_yellow, "lt/y");
rest_activate_resource(&res_toggle_green, "lt/g");
rest_activate_resource(&res_toggle_orange, "lt/o"); rest_activate_resource(&res_toggle_orange, "lt/o");
#endif #endif
} }

View file

@ -94,7 +94,7 @@ res_post_put_handler(void *request, void *response, uint8_t *buffer,
* A simple actuator example, depending on the color query parameter and post * A simple actuator example, depending on the color query parameter and post
* variable mode, corresponding led is activated or deactivated * variable mode, corresponding led is activated or deactivated
*/ */
#if BOARD_SENSORTAG #if BOARD_SENSORTAG || BOARD_LAUNCHPAD
#define RESOURCE_PARAMS "r|g" #define RESOURCE_PARAMS "r|g"
#elif BOARD_SMARTRF06EB #elif BOARD_SMARTRF06EB
#define RESOURCE_PARAMS "r|g|y|o" #define RESOURCE_PARAMS "r|g|y|o"