mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 19:31:36 +08:00
drivers/tone_alarm and tune_control small improvements/cleanup
- drivers/tone_alarm: move to ModuleBase and purge CDev (/dev/tone_alarm0) - drivers/tone_alarm: only run on tune_control publication (or scheduled note) rather than continuously - drivers/tone_alarm: use HRT to schedule tone stop (prevents potential disruption) - msg/tune_control: add tune_id numbering - systemcmds/tune_control: add "error" special case tune_id - move all tune_control publication to new uORB::PublicationQueued<> - start tone_alarm immediately after board defaults are loaded to fix potential startup issues - for SITL (or other boards with no TONE output) print common messages (startup, error, etc)
This commit is contained in:
@@ -163,8 +163,9 @@ void init()
|
||||
#endif /* TONE_ALARM_TIMER */
|
||||
}
|
||||
|
||||
void start_note(unsigned frequency)
|
||||
hrt_abstime start_note(unsigned frequency)
|
||||
{
|
||||
hrt_abstime time_started = 0;
|
||||
#if defined(TONE_ALARM_TIMER)
|
||||
float period = 0.5f / frequency;
|
||||
|
||||
@@ -182,8 +183,13 @@ void start_note(unsigned frequency)
|
||||
rCR |= GPT_CR_EN;
|
||||
|
||||
// configure the GPIO to enable timer output
|
||||
irqstate_t flags = enter_critical_section();
|
||||
time_started = hrt_absolute_time();
|
||||
px4_arch_configgpio(GPIO_TONE_ALARM);
|
||||
leave_critical_section(flags);
|
||||
#endif /* TONE_ALARM_TIMER */
|
||||
|
||||
return time_started;
|
||||
}
|
||||
|
||||
void stop_note()
|
||||
|
||||
Reference in New Issue
Block a user