2022-03-23 17:59:20 +00:00
|
|
|
/**
|
|
|
|
* @file furi_hal_speaker.h
|
|
|
|
* Speaker HAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2022-12-16 22:20:10 +00:00
|
|
|
#include <furi.h>
|
|
|
|
|
2022-03-23 17:59:20 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-12-16 22:20:10 +00:00
|
|
|
/** Init speaker */
|
2022-03-23 17:59:20 +00:00
|
|
|
void furi_hal_speaker_init();
|
|
|
|
|
2022-12-16 22:20:10 +00:00
|
|
|
/** 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
|
|
|
|
*/
|
2022-03-23 17:59:20 +00:00
|
|
|
void furi_hal_speaker_start(float frequency, float volume);
|
|
|
|
|
2022-12-16 22:20:10 +00:00
|
|
|
/** Set volume
|
|
|
|
*
|
|
|
|
* @warning no ownership check if called from ISR
|
|
|
|
*
|
|
|
|
* @param volume The volume
|
|
|
|
*/
|
2022-05-05 09:49:59 +00:00
|
|
|
void furi_hal_speaker_set_volume(float volume);
|
|
|
|
|
2022-12-16 22:20:10 +00:00
|
|
|
/** Stop playback
|
|
|
|
*
|
|
|
|
* @warning no ownership check if called from ISR
|
|
|
|
*/
|
2022-03-23 17:59:20 +00:00
|
|
|
void furi_hal_speaker_stop();
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|