fixed leds

This commit is contained in:
Marcus Priesch 2017-07-30 00:19:07 +02:00
parent 77671a4832
commit 88a360b32c
3 changed files with 10 additions and 8 deletions

View file

@ -71,7 +71,7 @@ extern resource_t
res_event,
res_sub;
#if PLATFORM_HAS_LEDS
#include "dev/leds.h"
#include "dev/leds-arch.h"
extern resource_t res_leds, res_toggle;
#endif
#if PLATFORM_HAS_LIGHT
@ -89,11 +89,13 @@ extern resource_t res_radio;
#endif
*/
void
hw_init()
{
#if defined (PLATFORM_HAS_LEDS)
leds_off(LEDS_RED);
leds_arch_init();
LEDS_OFF();
#endif
}

View file

@ -43,13 +43,13 @@
#include <string.h>
#include "contiki.h"
#include "rest-engine.h"
#include "dev/leds.h"
#include "dev/leds-arch.h"
static void res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
/* A simple actuator example. Toggles the red led */
/* A simple actuator example. Toggles the led */
RESOURCE(res_toggle,
"title=\"Red LED\";rt=\"Control\"",
"title=\"LED\";rt=\"Control\"",
NULL,
res_post_handler,
NULL,
@ -58,6 +58,6 @@ RESOURCE(res_toggle,
static void
res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{
leds_toggle(LEDS_RED);
LED_GREEN_TOGGLE ();
}
#endif /* PLATFORM_HAS_LEDS */

View file

@ -14,8 +14,8 @@
#define LED_GREEN_TOGGLE() LED_OUT ^= BIT_GREEN
#define LEDS_OFF() LED_OUT &= ~BIT_GREEN
#define LEDS_ON() LED_OUT |= BIT_GREEN
#define LEDS_ON() LED_OUT &= ~BIT_GREEN
#define LEDS_OFF() LED_OUT |= BIT_GREEN
void leds_arch_init(void);