mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
@@ -17,6 +17,7 @@ px4_add_board(
|
|||||||
#magnetometer # all available magnetometer drivers
|
#magnetometer # all available magnetometer drivers
|
||||||
pwm_out_sim
|
pwm_out_sim
|
||||||
#telemetry # all available telemetry drivers
|
#telemetry # all available telemetry drivers
|
||||||
|
tone_alarm_sim
|
||||||
vmount
|
vmount
|
||||||
|
|
||||||
MODULES
|
MODULES
|
||||||
|
|||||||
+1
-3
@@ -31,12 +31,10 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
px4_add_module(
|
px4_add_module(
|
||||||
MODULE platforms__posix__drivers__tonealrmsim
|
MODULE drivers__tone_alarm_sim
|
||||||
MAIN tone_alarm
|
MAIN tone_alarm
|
||||||
COMPILE_FLAGS
|
|
||||||
SRCS
|
SRCS
|
||||||
tone_alarm.cpp
|
tone_alarm.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
git_driverframework
|
git_driverframework
|
||||||
)
|
)
|
||||||
|
|
||||||
+9
-34
@@ -37,47 +37,24 @@
|
|||||||
* timer HW
|
* timer HW
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <circuit_breaker/circuit_breaker.h>
|
||||||
|
#include <drivers/device/device.h>
|
||||||
|
#include <drivers/drv_hrt.h>
|
||||||
|
#include <drivers/drv_tone_alarm.h>
|
||||||
|
#include <lib/cdev/CDev.hpp>
|
||||||
|
#include <lib/tunes/tunes.h>
|
||||||
#include <px4_config.h>
|
#include <px4_config.h>
|
||||||
#include <px4_posix.h>
|
#include <px4_posix.h>
|
||||||
|
|
||||||
#include <drivers/device/device.h>
|
|
||||||
#include <drivers/drv_tone_alarm.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include <board_config.h>
|
|
||||||
#include <drivers/drv_hrt.h>
|
|
||||||
|
|
||||||
#include <systemlib/err.h>
|
|
||||||
#include <circuit_breaker/circuit_breaker.h>
|
|
||||||
|
|
||||||
#include <px4_workqueue.h>
|
#include <px4_workqueue.h>
|
||||||
|
|
||||||
#include <lib/tunes/tunes.h>
|
|
||||||
#include <uORB/uORB.h>
|
|
||||||
#include <uORB/topics/tune_control.h>
|
#include <uORB/topics/tune_control.h>
|
||||||
|
|
||||||
#include "VirtDevObj.hpp"
|
|
||||||
|
|
||||||
using namespace DriverFramework;
|
|
||||||
|
|
||||||
#if !defined(UNUSED)
|
#if !defined(UNUSED)
|
||||||
# define UNUSED(a) ((void)(a))
|
# define UNUSED(a) ((void)(a))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CBRK_BUZZER_KEY 782097
|
#define CBRK_BUZZER_KEY 782097
|
||||||
|
|
||||||
class ToneAlarm : public VirtDevObj
|
class ToneAlarm : public cdev::CDev
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ToneAlarm();
|
ToneAlarm();
|
||||||
@@ -141,7 +118,7 @@ extern "C" __EXPORT int tone_alarm_main(int argc, char *argv[]);
|
|||||||
|
|
||||||
|
|
||||||
ToneAlarm::ToneAlarm() :
|
ToneAlarm::ToneAlarm() :
|
||||||
VirtDevObj("tone_alarm", TONEALARM0_DEVICE_PATH, nullptr, 0),
|
CDev(TONEALARM0_DEVICE_PATH),
|
||||||
_running(false),
|
_running(false),
|
||||||
_should_run(true),
|
_should_run(true),
|
||||||
_play_tone(false),
|
_play_tone(false),
|
||||||
@@ -164,9 +141,7 @@ ToneAlarm::~ToneAlarm()
|
|||||||
|
|
||||||
int ToneAlarm::init()
|
int ToneAlarm::init()
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = CDev::init();
|
||||||
|
|
||||||
ret = VirtDevObj::init();
|
|
||||||
|
|
||||||
if (ret != OK) {
|
if (ret != OK) {
|
||||||
return ret;
|
return ret;
|
||||||
Reference in New Issue
Block a user