furi_hal_speaker.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @file furi_hal_speaker.h
  3. * Speaker HAL
  4. */
  5. #pragma once
  6. #include <furi.h>
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /** Init speaker */
  11. void furi_hal_speaker_init();
  12. /** Deinit speaker */
  13. void furi_hal_speaker_deinit();
  14. /** Acquire speaker ownership
  15. *
  16. * @warning You must acquire speaker ownership before use
  17. *
  18. * @param timeout Timeout during which speaker ownership must be acquired
  19. *
  20. * @return bool returns true on success
  21. */
  22. FURI_WARN_UNUSED bool furi_hal_speaker_acquire(uint32_t timeout);
  23. /** Release speaker ownership
  24. *
  25. * @warning You must release speaker ownership after use
  26. */
  27. void furi_hal_speaker_release();
  28. /** Check current process speaker ownership
  29. *
  30. * @warning always returns true if called from ISR
  31. *
  32. * @return bool returns true if process owns speaker
  33. */
  34. bool furi_hal_speaker_is_mine();
  35. /** Play a note
  36. *
  37. * @warning no ownership check if called from ISR
  38. *
  39. * @param frequency The frequency
  40. * @param volume The volume
  41. */
  42. void furi_hal_speaker_start(float frequency, float volume);
  43. /** Set volume
  44. *
  45. * @warning no ownership check if called from ISR
  46. *
  47. * @param volume The volume
  48. */
  49. void furi_hal_speaker_set_volume(float volume);
  50. /** Stop playback
  51. *
  52. * @warning no ownership check if called from ISR
  53. */
  54. void furi_hal_speaker_stop();
  55. #ifdef __cplusplus
  56. }
  57. #endif