![]() |
BSB Developer Docs
|
HAL APIs for Serial Audio Interface (SAI). More...
#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Typedefs | |
| typedef void(* | FuriHalSaiCallback) (FuriHalSaiEvent event, void *context) |
| SAI event callback type. | |
Enumerations | |
| enum | FuriHalSaiEvent { FuriHalSaiEventHalfTransfer , FuriHalSaiEventTransferComplete } |
| Enumeration of SAI events. More... | |
Functions | |
| bool | furi_hal_sai_init (void) |
| Initialise the SAI peripheral. | |
| void | furi_hal_sai_set_buffer (const int16_t *buffer, uint32_t buffer_depth) |
| Set the circular buffer pointer and depth. | |
| void | furi_hal_sai_set_callback (FuriHalSaiCallback callback, void *context) |
| Set the callback function to be called upon SAI events. | |
| void | furi_hal_sai_enable_amplifier (void) |
| Enables the DAC/amplifier unit. | |
| void | furi_hal_sai_disable_amplifier (void) |
| Disables the DAC/amplifier unit. | |
| void | furi_hal_sai_start (void) |
| Start transferring sample data via SAI. | |
| void | furi_hal_sai_stop (void) |
| Stop transferring sample data via SAI. | |
HAL APIs for Serial Audio Interface (SAI).
Data format expected by SAI:
Once started, it will output the data in a circular manner, providing two events: Half Transfer and Transfer complete to indicate which portion of the buffer can be updated by the application code.
| typedef void(* FuriHalSaiCallback) (FuriHalSaiEvent event, void *context) |
SAI event callback type.
| [in] | event | one of FuriHalSaiEvent values to indicate the occurred event |
| [in,out] | context | pointer to a user-specific object |
| enum FuriHalSaiEvent |
| void furi_hal_sai_enable_amplifier | ( | void | ) |
Enables the DAC/amplifier unit.
It must be enabled for any sound to come out. If any non-zero data is fed into it within 100 ms after enabling, the output will be distorted with clicks.
| bool furi_hal_sai_init | ( | void | ) |
Initialise the SAI peripheral.
The application code doesn't need to call this function, as it is done in furi_hal_init().
| void furi_hal_sai_set_buffer | ( | const int16_t * | buffer, |
| uint32_t | buffer_depth ) |
Set the circular buffer pointer and depth.
The application code must fill the buffer with sample data in a timely manner in accordance to the events produced by the SAI.
| [in] | buffer | pointer to the sample buffer |
| [in] | buffer_depth | buffer depth in samples (NOT bytes) |
| void furi_hal_sai_set_callback | ( | FuriHalSaiCallback | callback, |
| void * | context ) |
Set the callback function to be called upon SAI events.
| [in] | callback | |
| [in,out] | context | pointer to a user-specific object (will be passed as context param in callback) |
| void furi_hal_sai_start | ( | void | ) |
Start transferring sample data via SAI.
| void furi_hal_sai_stop | ( | void | ) |
Stop transferring sample data via SAI.
Data transfer stops immediately after calling this function.