mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-21 19:29:18 +00:00
seedeye powerswitch: update coap
The powerswitch app was using old an older implementation of er-coap. This updates it.
This commit is contained in:
parent
3b6d9e5a64
commit
869768902b
@ -7,42 +7,8 @@ all: remotepowerswitch
|
||||
CONTIKI=../../../
|
||||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
|
||||
|
||||
WITH_COAP=13
|
||||
|
||||
# REST framework, requires WITH_COAP
|
||||
ifeq ($(WITH_COAP), 13)
|
||||
${info INFO: compiling with CoAP-13}
|
||||
CFLAGS += -DWITH_COAP=13
|
||||
CFLAGS += -DREST=coap_rest_implementation
|
||||
CFLAGS += -DUIP_CONF_TCP=0
|
||||
APPS += er-coap-13
|
||||
else ifeq ($(WITH_COAP), 12)
|
||||
${info INFO: compiling with CoAP-12}
|
||||
CFLAGS += -DWITH_COAP=12
|
||||
CFLAGS += -DREST=coap_rest_implementation
|
||||
CFLAGS += -DUIP_CONF_TCP=0
|
||||
APPS += er-coap-12
|
||||
else ifeq ($(WITH_COAP), 7)
|
||||
${info INFO: compiling with CoAP-08}
|
||||
CFLAGS += -DWITH_COAP=7
|
||||
CFLAGS += -DREST=coap_rest_implementation
|
||||
CFLAGS += -DUIP_CONF_TCP=0
|
||||
APPS += er-coap-07
|
||||
else ifeq ($(WITH_COAP), 3)
|
||||
${info INFO: compiling with CoAP-03}
|
||||
CFLAGS += -DWITH_COAP=3
|
||||
CFLAGS += -DREST=coap_rest_implementation
|
||||
CFLAGS += -DUIP_CONF_TCP=0
|
||||
APPS += er-coap-03
|
||||
else
|
||||
${info INFO: compiling with HTTP}
|
||||
CFLAGS += -DWITH_HTTP
|
||||
CFLAGS += -DREST=http_rest_implementation
|
||||
CFLAGS += -DUIP_CONF_TCP=1
|
||||
APPS += er-http-engine
|
||||
endif
|
||||
|
||||
APPS += erbium
|
||||
APPS += er-coap
|
||||
APPS += rest-engine
|
||||
|
||||
CONTIKI_WITH_IPV6 = 1
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Remote Power Switch Example for the Seed-Eye Board
|
||||
* Copyright (c) 2013, Giovanni Pellerano
|
||||
*
|
||||
*
|
||||
* Ownership: Scuola Superiore Sant'Anna (http://www.sssup.it) and
|
||||
* Consorzio Nazionale Interuniversitario per le Telecomunicazioni
|
||||
* (http://www.cnit.it).
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@ -33,7 +33,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup Remote Power Switch Example for the Seed-Eye Board
|
||||
*
|
||||
@ -55,20 +55,21 @@
|
||||
#include "contiki.h"
|
||||
#include "contiki-net.h"
|
||||
|
||||
#include "erbium.h"
|
||||
#include "rest-engine.h"
|
||||
|
||||
#include "dev/leds.h"
|
||||
|
||||
#include <p32xxxx.h>
|
||||
|
||||
RESOURCE(toggle, METHOD_GET | METHOD_PUT | METHOD_POST, "actuators/powerswitch", "title=\"Red LED\";rt=\"Control\"");
|
||||
void
|
||||
toggle_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
leds_toggle(LEDS_RED);
|
||||
|
||||
|
||||
PORTEbits.RE0 = !PORTEbits.RE0;
|
||||
}
|
||||
RESOURCE(resource_toggle, "title=\"Red LED\";rt=\"Control\"", toggle_handler, toggle_handler, toggle_handler, NULL);
|
||||
|
||||
|
||||
PROCESS(remote_power_switch, "Remote Power Switch");
|
||||
|
||||
@ -79,11 +80,11 @@ PROCESS_THREAD(remote_power_switch, ev, data)
|
||||
PROCESS_BEGIN();
|
||||
|
||||
rest_init_engine();
|
||||
|
||||
|
||||
TRISEbits.TRISE0 = 0;
|
||||
PORTEbits.RE0 = 0;
|
||||
|
||||
rest_activate_resource(&resource_toggle);
|
||||
rest_activate_resource(&resource_toggle, "actuators/powerswitch");
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT();
|
||||
|
Loading…
Reference in New Issue
Block a user