2017-08-31 11:23:55 +02:00
|
|
|
/*
|
|
|
|
* Sample arduino sketch using contiki features.
|
|
|
|
* We turn the LED off
|
|
|
|
* We allow read the moisture sensor
|
|
|
|
* Unfortunately sleeping for long times in loop() isn't currently
|
|
|
|
* possible, something turns off the CPU (including PWM outputs) if a
|
|
|
|
* Proto-Thread is taking too long. We need to find out how to sleep in
|
|
|
|
* a Contiki-compatible way.
|
|
|
|
* Note that for a normal arduino sketch you won't have to include any
|
|
|
|
* of the contiki-specific files here, the sketch should just work.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include "arduino-process.h"
|
|
|
|
#include "rest-engine.h"
|
|
|
|
#include "net/netstack.h"
|
|
|
|
#include "lib/settings.h"
|
2017-09-01 11:18:20 +02:00
|
|
|
#include "shell.h"
|
|
|
|
#include "serial-shell.h"
|
2017-09-05 16:38:55 +02:00
|
|
|
#include "shell-merkur.h"
|
|
|
|
#include "dev/radio.h"
|
|
|
|
#include "extended-rf-api.h"
|
2017-08-31 11:23:55 +02:00
|
|
|
|
|
|
|
extern resource_t res_led, res_battery, res_cputemp;
|
|
|
|
|
|
|
|
uint8_t led_pin=4;
|
|
|
|
uint8_t led_status;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setup (void)
|
|
|
|
{
|
|
|
|
// switch off the led
|
|
|
|
pinMode(led_pin, OUTPUT);
|
|
|
|
digitalWrite(led_pin, HIGH);
|
|
|
|
led_status=0;
|
2017-09-01 11:18:20 +02:00
|
|
|
// Seriell Shell
|
|
|
|
serial_shell_init();
|
|
|
|
shell_ps_init();
|
|
|
|
shell_reboot_init();
|
2017-09-07 11:44:54 +02:00
|
|
|
shell_merkur_init();
|
2017-09-01 11:18:20 +02:00
|
|
|
#if COFFEE
|
2017-09-07 11:44:54 +02:00
|
|
|
shell_coffee_init();
|
|
|
|
shell_file_init();
|
2017-09-01 11:18:20 +02:00
|
|
|
#endif
|
2017-09-05 22:24:56 +02:00
|
|
|
|
2017-08-31 11:23:55 +02:00
|
|
|
// init coap resourcen
|
|
|
|
rest_init_engine ();
|
|
|
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
|
|
|
rest_activate_resource (&res_led, "s/led");
|
|
|
|
rest_activate_resource (&res_battery, "s/battery");
|
|
|
|
rest_activate_resource (&res_cputemp, "s/cputemp");
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
|
|
|
|
// NETSTACK_MAC.off(1);
|
2017-09-01 11:18:20 +02:00
|
|
|
// mcu_sleep_set(128);
|
2017-08-31 11:23:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop (void)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|