mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-18 00:33:09 +00:00
2dea6969fe
* Furi_hal_speaker: multiple resource usage * Furi_hal_speaker: fix multiple resource usage * Furi_hal_speaker: fix music_player_worker * Furi_hal_speaker: fix mutex release queue handling * SubGhz: add furi_hal_subghz_set_debug_pin * SubGhz: add sound SubGhz Read, SubGhz Read RAW * furi_hal_speaker: add __attribute__((warn_unused_result)) for furi_hal_speaker_acquire() * Furi_hal_speaker: fix review comments * SubGhz: cleanup naming and locking timings * SubGhz,FuriHal: fix speaker deinit logic and subghz speaker release sequence * FuriHal: crash on speaker acquire/release from IRQ * Furi, FuriHal: FURI_WARN_UNUSED and documentation update * Bump api symbols version: fix broken speaker Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
68 lines
1.3 KiB
C
68 lines
1.3 KiB
C
/**
|
|
* @file furi_hal_speaker.h
|
|
* Speaker HAL
|
|
*/
|
|
#pragma once
|
|
|
|
#include <furi.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** Init speaker */
|
|
void furi_hal_speaker_init();
|
|
|
|
/** Deinit speaker */
|
|
void furi_hal_speaker_deinit();
|
|
|
|
/** Acquire speaker ownership
|
|
*
|
|
* @warning You must acquire speaker ownership before use
|
|
*
|
|
* @param timeout Timeout during which speaker ownership must be acquired
|
|
*
|
|
* @return bool returns true on success
|
|
*/
|
|
FURI_WARN_UNUSED bool furi_hal_speaker_acquire(uint32_t timeout);
|
|
|
|
/** Release speaker ownership
|
|
*
|
|
* @warning You must release speaker ownership after use
|
|
*/
|
|
void furi_hal_speaker_release();
|
|
|
|
/** Check current process speaker ownership
|
|
*
|
|
* @warning always returns true if called from ISR
|
|
*
|
|
* @return bool returns true if process owns speaker
|
|
*/
|
|
bool furi_hal_speaker_is_mine();
|
|
|
|
/** Play a note
|
|
*
|
|
* @warning no ownership check if called from ISR
|
|
*
|
|
* @param frequency The frequency
|
|
* @param volume The volume
|
|
*/
|
|
void furi_hal_speaker_start(float frequency, float volume);
|
|
|
|
/** Set volume
|
|
*
|
|
* @warning no ownership check if called from ISR
|
|
*
|
|
* @param volume The volume
|
|
*/
|
|
void furi_hal_speaker_set_volume(float volume);
|
|
|
|
/** Stop playback
|
|
*
|
|
* @warning no ownership check if called from ISR
|
|
*/
|
|
void furi_hal_speaker_stop();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|