forked from Archive/PX4-Autopilot
Enabled leds on FMU again
This commit is contained in:
parent
44df8db984
commit
296a19072d
|
@ -14,6 +14,7 @@ MODULES += drivers/device
|
|||
MODULES += drivers/stm32
|
||||
MODULES += drivers/stm32/adc
|
||||
MODULES += drivers/stm32/tone_alarm
|
||||
MODULES += drivers/led
|
||||
MODULES += drivers/px4io
|
||||
MODULES += drivers/px4fmu
|
||||
MODULES += drivers/boards/px4fmu
|
||||
|
|
|
@ -6,4 +6,5 @@ SRCS = px4fmu_can.c \
|
|||
px4fmu_init.c \
|
||||
px4fmu_pwm_servo.c \
|
||||
px4fmu_spi.c \
|
||||
px4fmu_usb.c
|
||||
px4fmu_usb.c \
|
||||
px4fmu_led.c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -91,6 +91,19 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ideally we'd be able to get these from up_internal.h,
|
||||
* but since we want to be able to disable the NuttX use
|
||||
* of leds for system indication at will and there is no
|
||||
* separate switch, we need to build independent of the
|
||||
* CONFIG_ARCH_LEDS configuration switch.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void led_init();
|
||||
extern void led_on(int led);
|
||||
extern void led_off(int led);
|
||||
__END_DECLS
|
||||
|
||||
/****************************************************************************
|
||||
* Protected Functions
|
||||
****************************************************************************/
|
||||
|
@ -114,7 +127,7 @@ __EXPORT void stm32_boardinitialize(void)
|
|||
/* configure SPI interfaces */
|
||||
stm32_spiinitialize();
|
||||
|
||||
/* configure LEDs */
|
||||
/* configure LEDs (empty call to NuttX' ledinit) */
|
||||
up_ledinit();
|
||||
}
|
||||
|
||||
|
@ -178,11 +191,11 @@ __EXPORT int nsh_archinitialize(void)
|
|||
(hrt_callout)stm32_serial_dma_poll,
|
||||
NULL);
|
||||
|
||||
// initial LED state
|
||||
// drv_led_start();
|
||||
up_ledoff(LED_BLUE);
|
||||
up_ledoff(LED_AMBER);
|
||||
up_ledon(LED_BLUE);
|
||||
/* initial LED state */
|
||||
drv_led_start();
|
||||
led_off(LED_AMBER);
|
||||
led_on(LED_BLUE);
|
||||
|
||||
|
||||
/* Configure SPI-based devices */
|
||||
|
||||
|
|
|
@ -39,19 +39,27 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "stm32_internal.h"
|
||||
#include "px4fmu_internal.h"
|
||||
|
||||
__EXPORT void up_ledinit()
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/*
|
||||
* Ideally we'd be able to get these from up_internal.h,
|
||||
* but since we want to be able to disable the NuttX use
|
||||
* of leds for system indication at will and there is no
|
||||
* separate switch, we need to build independent of the
|
||||
* CONFIG_ARCH_LEDS configuration switch.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void led_init();
|
||||
extern void led_on(int led);
|
||||
extern void led_off(int led);
|
||||
__END_DECLS
|
||||
|
||||
__EXPORT void led_init()
|
||||
{
|
||||
/* Configure LED1-2 GPIOs for output */
|
||||
|
||||
|
@ -59,7 +67,7 @@ __EXPORT void up_ledinit()
|
|||
stm32_configgpio(GPIO_LED2);
|
||||
}
|
||||
|
||||
__EXPORT void up_ledon(int led)
|
||||
__EXPORT void led_on(int led)
|
||||
{
|
||||
if (led == 0)
|
||||
{
|
||||
|
@ -73,7 +81,7 @@ __EXPORT void up_ledon(int led)
|
|||
}
|
||||
}
|
||||
|
||||
__EXPORT void up_ledoff(int led)
|
||||
__EXPORT void led_off(int led)
|
||||
{
|
||||
if (led == 0)
|
||||
{
|
||||
|
|
|
@ -41,12 +41,17 @@
|
|||
#include <drivers/device/device.h>
|
||||
#include <drivers/drv_led.h>
|
||||
|
||||
/* Ideally we'd be able to get these from up_internal.h */
|
||||
//#include <up_internal.h>
|
||||
/*
|
||||
* Ideally we'd be able to get these from up_internal.h,
|
||||
* but since we want to be able to disable the NuttX use
|
||||
* of leds for system indication at will and there is no
|
||||
* separate switch, we need to build independent of the
|
||||
* CONFIG_ARCH_LEDS configuration switch.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void up_ledinit();
|
||||
extern void up_ledon(int led);
|
||||
extern void up_ledoff(int led);
|
||||
extern void led_init();
|
||||
extern void led_on(int led);
|
||||
extern void led_off(int led);
|
||||
__END_DECLS
|
||||
|
||||
class LED : device::CDev
|
||||
|
@ -74,7 +79,7 @@ int
|
|||
LED::init()
|
||||
{
|
||||
CDev::init();
|
||||
up_ledinit();
|
||||
led_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -86,11 +91,11 @@ LED::ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||
|
||||
switch (cmd) {
|
||||
case LED_ON:
|
||||
up_ledon(arg);
|
||||
led_on(arg);
|
||||
break;
|
||||
|
||||
case LED_OFF:
|
||||
up_ledoff(arg);
|
||||
led_off(arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue