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

View file

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

View file

@ -63,6 +63,9 @@ extern resource_t res_parent_ip;
extern resource_t res_ble_advd;
#endif
extern resource_t res_toggle_red;
extern resource_t res_toggle_green;
/* Board-specific resources */
#if BOARD_SENSORTAG
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_y;
extern resource_t res_mpu_gyro_z;
extern resource_t res_toggle_red;
extern resource_t res_toggle_green;
#else
extern resource_t res_toggle_red;
extern resource_t res_toggle_green;
extern resource_t res_toggle_orange;
extern resource_t res_toggle_yellow;
#endif
@ -96,6 +95,11 @@ const char *coap_server_supported_msg = "Supported:"
static 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
rest_activate_resource(&res_bmp280_temp, "sen/bar/temp");
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_y, "sen/mpu/gyro/y");
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
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_green, "lt/g");
rest_activate_resource(&res_toggle_orange, "lt/o");
#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
* variable mode, corresponding led is activated or deactivated
*/
#if BOARD_SENSORTAG
#if BOARD_SENSORTAG || BOARD_LAUNCHPAD
#define RESOURCE_PARAMS "r|g"
#elif BOARD_SMARTRF06EB
#define RESOURCE_PARAMS "r|g|y|o"