mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 13:48:52 +08:00
@@ -17,6 +17,7 @@ px4_add_board(
|
||||
#magnetometer # all available magnetometer drivers
|
||||
pwm_out_sim
|
||||
#telemetry # all available telemetry drivers
|
||||
tone_alarm_sim
|
||||
vmount
|
||||
|
||||
MODULES
|
||||
|
||||
+1
-3
@@ -31,12 +31,10 @@
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__tonealrmsim
|
||||
MODULE drivers__tone_alarm_sim
|
||||
MAIN tone_alarm
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
tone_alarm.cpp
|
||||
DEPENDS
|
||||
git_driverframework
|
||||
)
|
||||
|
||||
+9
-34
@@ -37,47 +37,24 @@
|
||||
* 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_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 <lib/tunes/tunes.h>
|
||||
#include <uORB/uORB.h>
|
||||
#include <uORB/topics/tune_control.h>
|
||||
|
||||
#include "VirtDevObj.hpp"
|
||||
|
||||
using namespace DriverFramework;
|
||||
|
||||
#if !defined(UNUSED)
|
||||
# define UNUSED(a) ((void)(a))
|
||||
#endif
|
||||
|
||||
#define CBRK_BUZZER_KEY 782097
|
||||
|
||||
class ToneAlarm : public VirtDevObj
|
||||
class ToneAlarm : public cdev::CDev
|
||||
{
|
||||
public:
|
||||
ToneAlarm();
|
||||
@@ -141,7 +118,7 @@ extern "C" __EXPORT int tone_alarm_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
ToneAlarm::ToneAlarm() :
|
||||
VirtDevObj("tone_alarm", TONEALARM0_DEVICE_PATH, nullptr, 0),
|
||||
CDev(TONEALARM0_DEVICE_PATH),
|
||||
_running(false),
|
||||
_should_run(true),
|
||||
_play_tone(false),
|
||||
@@ -164,9 +141,7 @@ ToneAlarm::~ToneAlarm()
|
||||
|
||||
int ToneAlarm::init()
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = VirtDevObj::init();
|
||||
int ret = CDev::init();
|
||||
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
Reference in New Issue
Block a user