mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 03:36:07 +08:00
Move the tone_alarm driver out of the NuttX configs area and add it as an stm32-specific driver in the PX4 apps space.
Add a new tone_alarm command that can be used to start/stop alarm tones from the shell.
This commit is contained in:
+5
-3
@@ -20,6 +20,11 @@
|
|||||||
set MODE autostart
|
set MODE autostart
|
||||||
set USB autoconnect
|
set USB autoconnect
|
||||||
|
|
||||||
|
#
|
||||||
|
# Start playing the startup tune
|
||||||
|
#
|
||||||
|
tone_alarm start
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try to mount the microSD card.
|
# Try to mount the microSD card.
|
||||||
#
|
#
|
||||||
@@ -31,9 +36,6 @@ else
|
|||||||
echo "[init] no microSD card found"
|
echo "[init] no microSD card found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
usleep 500
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Look for an init script on the microSD card.
|
# Look for an init script on the microSD card.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -57,8 +57,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <arch/board/drv_led.h>
|
#include <arch/board/drv_led.h>
|
||||||
#include <arch/board/up_hrt.h>
|
#include <arch/board/up_hrt.h>
|
||||||
#include <arch/board/drv_tone_alarm.h>
|
|
||||||
#include <arch/board/up_hrt.h>
|
#include <arch/board/up_hrt.h>
|
||||||
|
#include <drivers/drv_tone_alarm.h>
|
||||||
#include "state_machine_helper.h"
|
#include "state_machine_helper.h"
|
||||||
#include "systemlib/systemlib.h"
|
#include "systemlib/systemlib.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|||||||
@@ -63,8 +63,6 @@
|
|||||||
#define _TONE_ALARM_BASE 0x7400
|
#define _TONE_ALARM_BASE 0x7400
|
||||||
#define TONE_SET_ALARM _IOC(_TONE_ALARM_BASE, 1)
|
#define TONE_SET_ALARM _IOC(_TONE_ALARM_BASE, 1)
|
||||||
|
|
||||||
extern int tone_alarm_init(void);
|
|
||||||
|
|
||||||
/* structure describing one note in a tone pattern */
|
/* structure describing one note in a tone pattern */
|
||||||
struct tone_note {
|
struct tone_note {
|
||||||
uint8_t pitch;
|
uint8_t pitch;
|
||||||
@@ -127,4 +125,4 @@ enum tone_pitch {
|
|||||||
TONE_NOTE_MAX
|
TONE_NOTE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DRV_TONE_ALARM_H_ */
|
#endif /* DRV_TONE_ALARM_H_ */
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 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
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
#
|
||||||
|
# Tone alarm driver
|
||||||
|
#
|
||||||
|
|
||||||
|
APPNAME = tone_alarm
|
||||||
|
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||||
|
STACKSIZE = 2048
|
||||||
|
INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common
|
||||||
|
|
||||||
|
include $(APPDIR)/mk/app.mk
|
||||||
+243
-122
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
#include <arch/board/up_hrt.h>
|
#include <arch/board/up_hrt.h>
|
||||||
#include <arch/board/drv_tone_alarm.h>
|
#include <drivers/drv_tone_alarm.h>
|
||||||
|
|
||||||
#include <nuttx/spi.h>
|
#include <nuttx/spi.h>
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ CONFIGURED_APPS += drivers/hmc5883
|
|||||||
CONFIGURED_APPS += drivers/mpu6000
|
CONFIGURED_APPS += drivers/mpu6000
|
||||||
CONFIGURED_APPS += drivers/bma180
|
CONFIGURED_APPS += drivers/bma180
|
||||||
CONFIGURED_APPS += drivers/l3gd20
|
CONFIGURED_APPS += drivers/l3gd20
|
||||||
|
CONFIGURED_APPS += drivers/stm32/tone_alarm
|
||||||
CONFIGURED_APPS += px4/px4io/driver
|
CONFIGURED_APPS += px4/px4io/driver
|
||||||
CONFIGURED_APPS += px4/fmu
|
CONFIGURED_APPS += px4/fmu
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
|
|||||||
CSRCS = up_boot.c up_leds.c up_spi.c up_hrt.c \
|
CSRCS = up_boot.c up_leds.c up_spi.c up_hrt.c \
|
||||||
drv_gpio.c \
|
drv_gpio.c \
|
||||||
drv_led.c drv_eeprom.c \
|
drv_led.c drv_eeprom.c \
|
||||||
drv_tone_alarm.c up_pwm_servo.c up_usbdev.c \
|
up_pwm_servo.c up_usbdev.c \
|
||||||
up_cpuload.c
|
up_cpuload.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
|
|
||||||
#include <arch/board/up_hrt.h>
|
#include <arch/board/up_hrt.h>
|
||||||
#include <arch/board/up_cpuload.h>
|
#include <arch/board/up_cpuload.h>
|
||||||
#include <arch/board/drv_tone_alarm.h>
|
|
||||||
#include <arch/board/up_adc.h>
|
#include <arch/board/up_adc.h>
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
#include <arch/board/drv_led.h>
|
#include <arch/board/drv_led.h>
|
||||||
@@ -277,10 +276,5 @@ int nsh_archinitialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* configure the tone generator */
|
|
||||||
#ifdef CONFIG_TONE_ALARM
|
|
||||||
tone_alarm_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user