mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 16:13:33 +08:00
samv7 adc and tone_alarm move to cdev lib
This commit is contained in:
@@ -99,7 +99,7 @@
|
|||||||
# define rCCR REG(STM32_ADC_CCR_OFFSET)
|
# define rCCR REG(STM32_ADC_CCR_OFFSET)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class ADC : public device::CDev
|
class ADC : public cdev::CDev
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ADC(uint32_t channels);
|
ADC(uint32_t channels);
|
||||||
@@ -145,7 +145,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
ADC::ADC(uint32_t channels) :
|
ADC::ADC(uint32_t channels) :
|
||||||
CDev("adc", ADC0_DEVICE_PATH),
|
CDev(ADC0_DEVICE_PATH),
|
||||||
_sample_perf(perf_alloc(PC_ELAPSED, "adc_samples")),
|
_sample_perf(perf_alloc(PC_ELAPSED, "adc_samples")),
|
||||||
_channel_count(0),
|
_channel_count(0),
|
||||||
_samples(nullptr),
|
_samples(nullptr),
|
||||||
|
|||||||
@@ -208,7 +208,7 @@
|
|||||||
|
|
||||||
#define CBRK_BUZZER_KEY 782097
|
#define CBRK_BUZZER_KEY 782097
|
||||||
|
|
||||||
class ToneAlarm : public device::CDev
|
class ToneAlarm : public cdev::CDev
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ToneAlarm();
|
ToneAlarm();
|
||||||
@@ -313,7 +313,7 @@ extern "C" __EXPORT int tone_alarm_main(int argc, char *argv[]);
|
|||||||
|
|
||||||
|
|
||||||
ToneAlarm::ToneAlarm() :
|
ToneAlarm::ToneAlarm() :
|
||||||
CDev("tone_alarm", TONEALARM0_DEVICE_PATH),
|
CDev(TONEALARM0_DEVICE_PATH),
|
||||||
_default_tune_number(0),
|
_default_tune_number(0),
|
||||||
_user_tune(nullptr),
|
_user_tune(nullptr),
|
||||||
_tune(nullptr),
|
_tune(nullptr),
|
||||||
@@ -393,7 +393,7 @@ ToneAlarm::init()
|
|||||||
/* make sure the timer is running */
|
/* make sure the timer is running */
|
||||||
rCR1 = GTIM_CR1_CEN;
|
rCR1 = GTIM_CR1_CEN;
|
||||||
#endif
|
#endif
|
||||||
DEVICE_DEBUG("ready");
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,14 +803,14 @@ ToneAlarm::ioctl(file *filp, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
int result = OK;
|
int result = OK;
|
||||||
|
|
||||||
DEVICE_DEBUG("ioctl %i %u", cmd, arg);
|
PX4_DEBUG("ioctl %i %u", cmd, arg);
|
||||||
|
|
||||||
// irqstate_t flags = enter_critical_section();
|
// irqstate_t flags = enter_critical_section();
|
||||||
|
|
||||||
/* decide whether to increase the alarm level to cmd or leave it alone */
|
/* decide whether to increase the alarm level to cmd or leave it alone */
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case TONE_SET_ALARM:
|
case TONE_SET_ALARM:
|
||||||
DEVICE_DEBUG("TONE_SET_ALARM %u", arg);
|
PX4_DEBUG("TONE_SET_ALARM %u", arg);
|
||||||
|
|
||||||
if (arg < TONE_NUMBER_OF_TUNES) {
|
if (arg < TONE_NUMBER_OF_TUNES) {
|
||||||
if (arg == TONE_STOP_TUNE) {
|
if (arg == TONE_STOP_TUNE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user