fixed leds

This commit is contained in:
Marcus Priesch 2017-07-30 00:19:07 +02:00
parent 181e2c436e
commit 1384aad51a
3 changed files with 10 additions and 8 deletions

View file

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

View file

@ -43,13 +43,13 @@
#include <string.h> #include <string.h>
#include "contiki.h" #include "contiki.h"
#include "rest-engine.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); 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, RESOURCE(res_toggle,
"title=\"Red LED\";rt=\"Control\"", "title=\"LED\";rt=\"Control\"",
NULL, NULL,
res_post_handler, res_post_handler,
NULL, NULL,
@ -58,6 +58,6 @@ RESOURCE(res_toggle,
static void static void
res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) 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 */ #endif /* PLATFORM_HAS_LEDS */

View file

@ -14,8 +14,8 @@
#define LED_GREEN_TOGGLE() LED_OUT ^= BIT_GREEN #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); void leds_arch_init(void);