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 */
|
2024-03-19 14:43:52 +00:00
|
|
|
void furi_hal_speaker_init(void);
|
2022-03-23 17:59:20 +00:00
|
|
|
|
2022-12-16 22:20:10 +00:00
|
|
|
/** Deinit speaker */
|
2024-03-19 14:43:52 +00:00
|
|
|
void furi_hal_speaker_deinit(void);
|
2022-12-16 22:20:10 +00:00
|
|
|
|
|
|
|
/** 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
|
|
|
|
*/
|
2024-03-19 14:43:52 +00:00
|
|
|
void furi_hal_speaker_release(void);
|
2022-12-16 22:20:10 +00:00
|
|
|
|
|
|
|
/** Check current process speaker ownership
|
|
|
|
*
|
|
|
|
* @warning always returns true if called from ISR
|
|
|
|
*
|
|
|
|
* @return bool returns true if process owns speaker
|
|
|
|
*/
|
2024-03-19 14:43:52 +00:00
|
|
|
bool furi_hal_speaker_is_mine(void);
|
2022-12-16 22:20:10 +00:00
|
|
|
|
|
|
|
/** 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
|
|
|
|
*/
|
2024-03-19 14:43:52 +00:00
|
|
|
void furi_hal_speaker_stop(void);
|
2022-03-23 17:59:20 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|