cleanup code
This commit is contained in:
parent
0556557d8b
commit
79b69334df
|
@ -75,12 +75,7 @@ PROCESS_THREAD(arduino_sketch, ev, data)
|
||||||
if(ev == sensors_event && data == &button_sensor) {
|
if(ev == sensors_event && data == &button_sensor) {
|
||||||
mcu_sleep_off();
|
mcu_sleep_off();
|
||||||
PRINTF("*******BUTTON*******\n");
|
PRINTF("*******BUTTON*******\n");
|
||||||
|
button ();
|
||||||
/* Call the event_handler for this application-specific event. */
|
|
||||||
res_event.trigger();
|
|
||||||
|
|
||||||
/* Also call the separate response example handler. */
|
|
||||||
res_separate.resume();
|
|
||||||
mcu_sleep_on();
|
mcu_sleep_on();
|
||||||
}
|
}
|
||||||
#endif /* PLATFORM_HAS_BUTTON */
|
#endif /* PLATFORM_HAS_BUTTON */
|
||||||
|
|
|
@ -61,6 +61,7 @@ void mcu_sleep_set(uint8_t value);
|
||||||
extern void loop (void);
|
extern void loop (void);
|
||||||
extern void setup (void);
|
extern void setup (void);
|
||||||
extern void arduino_init (void);
|
extern void arduino_init (void);
|
||||||
|
extern void button (void);
|
||||||
|
|
||||||
extern struct process arduino_sketch;
|
extern struct process arduino_sketch;
|
||||||
|
|
||||||
|
|
|
@ -232,16 +232,21 @@ int coap_server_post(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void button (void)
|
||||||
|
{
|
||||||
|
/* Call the event_handler for this application-specific event. */
|
||||||
|
res_event.trigger();
|
||||||
|
|
||||||
|
/* Also call the separate response example handler. */
|
||||||
|
res_separate.resume();
|
||||||
|
|
||||||
|
/* Call the Coap Server */
|
||||||
|
coap_server_post();
|
||||||
|
}
|
||||||
|
|
||||||
void loop (void)
|
void loop (void)
|
||||||
{
|
{
|
||||||
// test caop srever post
|
|
||||||
|
|
||||||
static int buttonstate = 1;
|
|
||||||
|
|
||||||
if(buttonstate != button_sensor.value(0)){
|
|
||||||
coap_server_post();
|
|
||||||
buttonstate=button_sensor.value(0);
|
|
||||||
}
|
|
||||||
// test chainable led
|
// test chainable led
|
||||||
/*
|
/*
|
||||||
static byte power=0;
|
static byte power=0;
|
||||||
|
|
Loading…
Reference in a new issue