HAL ADF functions

Initialization and de-initialization functions

group ADF_Exported_Functions_Group1

This section provides a set of functions allowing to initialize and deinitialize the ADF peripheral:

Functions

hal_status_t HAL_ADF_Init ( hal_adf_handle_t * hadf , hal_adf_t instance )

Initialize the ADF according to the associated handle.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to HAL ADF handle is NULL.

void HAL_ADF_DeInit ( hal_adf_handle_t * hadf )

De-initialize the ADF.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Common clock generator and features functions

group ADF_Exported_Functions_Group2

This section provides a set of functions allowing to configure common clock generator and features:

This section provides also a set of functions allowing to control common features:

This section provides also a set of functions allowing to process common clock generator:

Functions

hal_status_t HAL_ADF_SetConfig ( hal_adf_handle_t * hadf , uint32_t proc_clock_divider )

Configure processing clock divider.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • proc_clock_divider – Processing clock divider. This parameter must be a number between Min_Data = 1 and Max_Data = 128.

Return values :

HAL_OK – Operation completed successfully.

void HAL_ADF_GetConfig ( const hal_adf_handle_t * hadf , uint32_t * p_proc_clock_divider )

Get the current processing clock divider.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_proc_clock_divider – Pointer to processing clock divider.

hal_status_t HAL_ADF_SetConfigOutputClock ( const hal_adf_handle_t * hadf , hal_adf_output_clock_pins_t pins , uint32_t output_clock_divider )

Configure output clock pins and divider.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • pins – Output clock pins.

  • output_clock_divider – Output clock divider. This parameter must be a number between Min_Data = 1 and Max_Data = 16.

Return values :

HAL_OK – Operation completed successfully.

void HAL_ADF_GetConfigOutputClock ( const hal_adf_handle_t * hadf , hal_adf_output_clock_pins_t * p_pins , uint32_t * p_output_clock_divider )

Get the current output clock pins and divider.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_pins – Pointer to output clock pins.

  • p_output_clock_divider – Pointer to output clock divider.

hal_status_t HAL_ADF_SetConfigOutputClockTrigger ( const hal_adf_handle_t * hadf , hal_adf_output_clock_trigger_source_t source , hal_adf_output_clock_trigger_edge_t edge )

Configure output clock trigger and edge.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • source – Output clock trigger source.

  • edge – Output clock trigger edge.

Return values :

HAL_OK – Operation completed successfully.

void HAL_ADF_GetConfigOutputClockTrigger ( const hal_adf_handle_t * hadf , hal_adf_output_clock_trigger_source_t * p_source , hal_adf_output_clock_trigger_edge_t * p_edge )

Get the current output clock trigger and edge.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_source – Pointer to output clock trigger source.

  • p_edge – Pointer to output clock trigger edge.

hal_status_t HAL_ADF_SetDMA ( hal_adf_handle_t * hadf , hal_adf_block_index_t block_index , hal_dma_handle_t * hdma )

Link DMA handle for a specified block to the ADF handle.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • block_index – Block index.

  • hdma – Pointer to DMA handle.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to DMA handle is NULL.

uint32_t HAL_ADF_GetClockFreq ( const hal_adf_handle_t * hadf )

Get the current ADF kernel clock frequency.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :
  • uint32_t – ADF kernel clock frequency in Hz.

  • 0 – ADF source clock not configured or not ready.

void HAL_ADF_SetUserData ( hal_adf_handle_t * hadf , const void * p_user_data )

Set user data in ADF handle.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_user_data – Pointer to user data structure.

const void * HAL_ADF_GetUserData ( const hal_adf_handle_t * hadf )

Get user data from ADF handle.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

void – Pointer to user data structure.

uint32_t HAL_ADF_GetLastErrorCodes ( const hal_adf_handle_t * hadf , hal_adf_block_index_t block_index )

Get last error codes on a specified block.

Parameters :
Return values :

uint32_t – Last error codes on the specified block. This return value can be a combination of the following values:

hal_status_t HAL_ADF_EnableOutputClock ( const hal_adf_handle_t * hadf , hal_adf_output_clock_pins_t pins )

Enable output clock pins.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_DisableOutputClock ( const hal_adf_handle_t * hadf , hal_adf_output_clock_pins_t pins )

Disable output clock pins.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_adf_output_clock_status_t HAL_ADF_IsEnabledOutputClock ( const hal_adf_handle_t * hadf )

Check output clock pins status.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

hal_adf_output_clock_status_t – Output clock pins status.

hal_status_t HAL_ADF_EnableOutputClockTrigger ( const hal_adf_handle_t * hadf )

Enable output clock trigger.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_DisableOutputClockTrigger ( const hal_adf_handle_t * hadf )

Disable output clock trigger.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_adf_output_clock_trigger_status_t HAL_ADF_IsEnabledOutputClockTrigger ( const hal_adf_handle_t * hadf )

Check output clock trigger status.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

hal_adf_output_clock_trigger_status_t – Output clock trigger status.

hal_status_t HAL_ADF_EnableTriggerOutput ( const hal_adf_handle_t * hadf )

Enable trigger output.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_adf_trigger_output_status_t HAL_ADF_IsEnabledTriggerOutput ( const hal_adf_handle_t * hadf )

Check trigger output status.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

hal_adf_trigger_output_status_t – Trigger output status.

hal_status_t HAL_ADF_Start ( hal_adf_handle_t * hadf )

Activate clock generator.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The global state is not HAL_ADF_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_Stop ( hal_adf_handle_t * hadf )

Deactivate clock generator.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

Serial interface functions

group ADF_Exported_Functions_Group3

This section provides a set of functions allowing to configure and process serial interface:

This section provides also a set of functions for clock absence detection feature:

Functions

hal_status_t HAL_ADF_SITF_SetConfig ( hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index , const hal_adf_serial_interface_config_t * p_config )

Configure a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

  • p_config – Pointer to serial interface configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to serial interface configuration structure is NULL.

void HAL_ADF_SITF_GetConfig ( const hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index , hal_adf_serial_interface_config_t * p_config )

Get the current configuration of a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

  • p_config – Pointer to serial interface configuration structure.

hal_status_t HAL_ADF_SITF_Start ( hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index )

Activate a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The serial interface state is not HAL_ADF_SITF_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_SITF_Stop ( hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index )

Deactivate a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_sitf_ckab_status_t HAL_ADF_SITF_IsClockAbsenceDetected ( const hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index )

Check clock absence detection status on a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

hal_adf_sitf_ckab_status_t – Clock absence detection status.

hal_status_t HAL_ADF_SITF_StartClockAbsenceDetect_IT ( const hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index )

Start clock absence detection in interrupt mode on a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_SITF_StopClockAbsenceDetect_IT ( const hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index )

Stop clock absence detection in interrupt mode on a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

HAL_OK – Operation completed successfully.

Bitstream matrix functions

group ADF_Exported_Functions_Group4

This section provides a set of functions allowing to configure bitstream matrix:

Functions

hal_status_t HAL_ADF_BSMX_SetConfig ( const hal_adf_handle_t * hadf , hal_adf_block_index_t bitstream_matrix_index , hal_adf_block_index_t serial_interface_index , hal_adf_bitstream_input_edge_t edge )

Connect a specified bitstream matrix to a specified serial interface and configure input edge.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • bitstream_matrix_index – Bitstream matrix index.

  • serial_interface_index – Serial interface index.

  • edge – Input edge.

Return values :

HAL_OK – Operation completed successfully.

void HAL_ADF_BSMX_GetConfig ( const hal_adf_handle_t * hadf , hal_adf_block_index_t bitstream_matrix_index , hal_adf_block_index_t * p_serial_interface_index , hal_adf_bitstream_input_edge_t * p_edge )

Get the current serial interface connected to a specified bitstream matrix and current input edge.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • bitstream_matrix_index – Bitstream matrix index.

  • p_serial_interface_index – Pointer to serial interface index.

  • p_edge – Pointer to input edge.

Digital filter functions

group ADF_Exported_Functions_Group5

This section provides a set of functions allowing to configure digital filter:

This section provides also a set of functions allowing to control digital filter:

This section provides also a set of functions allowing to process digital filter:

Functions

hal_status_t HAL_ADF_DFLT_SetConfig ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , const hal_adf_digital_filter_config_t * p_config )

Configure a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_config – Pointer to digital filter configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to digital filter configuration structure is NULL.

void HAL_ADF_DFLT_GetConfig ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , hal_adf_digital_filter_config_t * p_config )

Get current configuration of a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_config – Pointer to digital filter configuration structure.

hal_status_t HAL_ADF_DFLT_SetSamplesDelay ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , uint32_t samples_delay )

Set samples delay on a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • samples_delay – Samples delay. This parameter must be a number between Min_Data = 0 and Max_Data = 127.

Return values :

HAL_OK – Operation completed successfully.

uint32_t HAL_ADF_DFLT_GetSamplesDelay ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get current samples delay on a specified digital filter.

Parameters :
Return values :

uint32_t – Samples delay.

hal_status_t HAL_ADF_DFLT_SetGain ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , int32_t gain )

Set gain on a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • gain – Gain in step of around 3db (from -48db to 72dB). This parameter must be a number between Min_Data = -16 and Max_Data = 24.

Return values :

HAL_OK – Operation completed successfully.

int32_t HAL_ADF_DFLT_GetGain ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get current gain on a specified digital filter.

Parameters :
Return values :

int32_t – Gain in step of around 3db (from -48db to 72dB). This parameter is a number between Min_Data = -16 and Max_Data = 24.

hal_status_t HAL_ADF_DFLT_SetFifoThreshold ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , hal_adf_dflt_fifo_threshold_t fifo_threshold )

Set FIFO threshold on a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • fifo_threshold – FIFO threshold.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_dflt_fifo_threshold_t HAL_ADF_DFLT_GetFifoThreshold ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get current FIFO threshold on a specified digital filter.

Parameters :
Return values :

hal_adf_dflt_fifo_threshold_t – FIFO threshold.

hal_status_t HAL_ADF_DFLT_SetDiscardSamples ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , uint32_t discard_samples )

Set discard samples on a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • discard_samples – Discard samples. This parameter must be a number between Min_Data = 0 and Max_Data = 255.

Return values :

HAL_OK – Operation completed successfully.

uint32_t HAL_ADF_DFLT_GetDiscardSamples ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get current discard samples on a specified digital filter.

Parameters :
Return values :

uint32_t – Discard samples.

hal_status_t HAL_ADF_DFLT_EnableReshapeFilter ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , hal_adf_dflt_rsf_decimation_ratio_t decimation_ratio )

Enable reshape filter on a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • decimation_ratio – Reshape filter decimation ratio.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_DFLT_DisableReshapeFilter ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Disable reshape filter on a specified digital filter.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_adf_dflt_rsf_status_t HAL_ADF_DFLT_IsEnabledReshapeFilter ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Check reshape filter status on a specified digital filter.

Parameters :
Return values :

hal_adf_dflt_rsf_status_t – Reshape filter status.

hal_adf_dflt_rsf_decimation_ratio_t HAL_ADF_DFLT_GetReshapeFilterDecimationRatio ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get current reshape filter decimation ratio on a specified digital filter.

Parameters :
Return values :

hal_adf_dflt_rsf_decimation_ratio_t – Reshape filter decimation ratio.

hal_status_t HAL_ADF_DFLT_EnableHighPassFilter ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , hal_adf_dflt_hpf_cut_off_frequency_t cut_off_frequency )

Enable high-pass filter on a specified digital filter.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • cut_off_frequency – High-pass filter cut-off frequency.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_DFLT_DisableHighPassFilter ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Disable high-pass filter on a specified digital filter.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_adf_dflt_hpf_status_t HAL_ADF_DFLT_IsEnabledHighPassFilter ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Check high-pass filter status on a specified digital filter.

Parameters :
Return values :

hal_adf_dflt_hpf_status_t – High-pass filter status.

hal_adf_dflt_hpf_cut_off_frequency_t HAL_ADF_DFLT_GetHighPassFilterCutOffFrequency ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get current high-pass filter cut-off frequency on a specified digital filter.

Parameters :
Return values :

hal_adf_dflt_hpf_cut_off_frequency_t – High-pass filter cut-off frequency.

hal_status_t HAL_ADF_DFLT_StartAcq ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Start acquisition on a specified digital filter in polling mode.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The digital filter state is not HAL_ADF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_DFLT_StopAcq ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Stop acquisition on a specified digital filter in polling mode.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_DFLT_PollForAcq ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , uint32_t timeout_ms )

Wait available acquisition on a specified digital filter in polling mode.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • timeout_ms – Acquisition timeout value.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_TIMEOUT – Operation exceeds user timeout.

int32_t HAL_ADF_DFLT_GetAcqValue ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get acquisition value on a specified digital filter.

Parameters :
Return values :

int32_t – Acquisition value.

hal_status_t HAL_ADF_DFLT_StartAcq_IT ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Start acquisition on a specified digital filter in interrupt mode.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The digital filter state is not HAL_ADF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_DFLT_StopAcq_IT ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Stop acquisition on a specified digital filter in interrupt mode.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_DFLT_StartAcq_IT_Opt ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , uint32_t interruptions )

Start acquisition on a specified digital filter in interrupt mode with optional interruptions.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The digital filter state is not HAL_ADF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_DFLT_StartAcq_DMA ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , const hal_adf_dma_config_t * p_dma_config )

Start acquisition on a specified digital filter in DMA mode.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_dma_config – Pointer to DMA configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_ERROR – Operation error.

  • HAL_INVALID_PARAM – Pointer to DMA configuration structure is NULL.

  • HAL_BUSY – The digital filter state is not HAL_ADF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_DFLT_StopAcq_DMA ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Stop acquisition on a specified digital filter in DMA mode.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_DFLT_StartAcq_DMA_Opt ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index , const hal_adf_dma_config_t * p_dma_config , uint32_t interruptions )

Start acquisition on a specified digital filter in DMA mode with optional interruptions.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_ERROR – Operation error.

  • HAL_INVALID_PARAM – Pointer to DMA configuration structure is NULL.

  • HAL_BUSY – The digital filter state is not HAL_ADF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

Sound activity detector functions

group ADF_Exported_Functions_Group6

This section provides a set of functions allowing to configure sound activity detector:

This section provides also a set of functions allowing to control sound activity detector:

This section provides also a set of functions allowing to process sound activity detector:

Functions

hal_status_t HAL_ADF_SAD_SetConfig ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , const hal_adf_sad_config_t * p_config )

Configure a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • p_config – Pointer to sound activity detector configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to sound activity detector configuration structure is NULL.

void HAL_ADF_SAD_GetConfig ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , hal_adf_sad_config_t * p_config )

Get the current configuration of a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • p_config – Pointer to sound activity detector configuration structure.

hal_status_t HAL_ADF_SAD_SetFrameSize ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , hal_adf_sad_frame_size_t frame_size )

Set frame size on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • frame_size – Frame size.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_sad_frame_size_t HAL_ADF_SAD_GetFrameSize ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Get current frame size on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

hal_adf_sad_frame_size_t – Frame size.

hal_status_t HAL_ADF_SAD_SetLearningFrames ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , hal_adf_sad_learning_frames_t learning_frames )

Set learning frames on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • learning_frames – Learning frames.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_sad_learning_frames_t HAL_ADF_SAD_GetLearningFrames ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Get learning frames on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

hal_adf_sad_learning_frames_t – Learning frames.

hal_status_t HAL_ADF_SAD_SetSignalToNoiseThreshold ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , hal_adf_sad_signal_to_noise_threshold_t threshold )

Set signal to noise threshold on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • threshold – Signal to noise threshold.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_sad_signal_to_noise_threshold_t HAL_ADF_SAD_GetSignalToNoiseThreshold ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Get signal to noise threshold on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

hal_adf_sad_signal_to_noise_threshold_t – Signal to noise threshold.

hal_status_t HAL_ADF_SAD_SetAmbientNoiseSlope ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , uint32_t ambient_noise_slope )

Set ambient noise slope on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • ambient_noise_slope – Ambient noise slope. This parameter must be a number between Min_Data = 0 and Max_Data = 7.

Return values :

HAL_OK – Operation completed successfully.

uint32_t HAL_ADF_SAD_GetAmbientNoiseSlope ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Get ambient noise slope on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

uint32_t – Ambient noise slope.

hal_status_t HAL_ADF_SAD_SetHangoverTimeWindow ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , hal_adf_sad_hangover_time_window_t hangover_time_window )

Set hangover time window on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • hangover_time_window – Hangover time window.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_sad_hangover_time_window_t HAL_ADF_SAD_GetHangoverTimeWindow ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Get hangover time window on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

hal_adf_sad_hangover_time_window_t – Hangover time window.

hal_status_t HAL_ADF_SAD_EnableHysteresis ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Enable hysteresis on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_SAD_DisableHysteresis ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Disable hysteresis on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_sad_hysteresis_status_t HAL_ADF_SAD_IsEnabledHysteresis ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Check hysteresis status on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

hal_adf_sad_hysteresis_status_t – Hysteresis status.

hal_status_t HAL_ADF_SAD_Start ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Activate a specified sound activity detector in polling mode.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The sound activity detector state is not HAL_ADF_SAD_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_SAD_Stop ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Deactivate a specified sound activity detector in polling mode.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_adf_sad_status_t HAL_ADF_SAD_IsDetected ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Check detection status on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

hal_adf_sad_status_t – Sound activity detection status.

hal_status_t HAL_ADF_SAD_PollForSoundLevel ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , uint32_t timeout_ms )

Wait available sound level on a specified sound activity detector in polling mode.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • timeout_ms – Timeout value.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_TIMEOUT – Operation exceeds user timeout.

void HAL_ADF_SAD_GetSoundAndAmbientNoiseLevels ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , uint32_t * p_sound_level , uint32_t * p_ambient_noise_level )

Get sound level and ambient noise level on a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

  • p_sound_level – Pointer on sound level value.

  • p_ambient_noise_level – Pointer on ambient noise level value.

hal_status_t HAL_ADF_SAD_Start_IT ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Activate a specified sound activity detector in interrupt mode.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The sound activity detector state is not HAL_ADF_SAD_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_ADF_SAD_Stop_IT ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Deactivate a specified sound activity detector in interrupt mode.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ADF_SAD_Start_IT_Opt ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index , uint32_t interruptions )

Activate a specified sound activity detector in interrupt mode with optional interruptions.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The sound activity detector state is not HAL_ADF_SAD_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

IRQ handler and callback functions

group ADF_Exported_Functions_Group7

This section provides function allowing to handle the ADF interrupt request on blocks, HAL_ADF_IRQHandler() .

This section provides also a set of functions allowing to handle callbacks:

This section provides also a set of functions allowing to register callbacks:

Functions

void HAL_ADF_IRQHandler ( hal_adf_handle_t * hadf , hal_adf_block_index_t block_index )

Handle the ADF interrupt request on a specified block.

Parameters :
void HAL_ADF_DFLT_AcqCpltCallback ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Acquisition complete callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :
void HAL_ADF_DFLT_AcqHalfCpltCallback ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Acquisition half complete callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :
void HAL_ADF_DFLT_AcqStopCpltCallback ( hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Acquisition stop callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :
void HAL_ADF_SAD_SoundLevelCallback ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Sound level callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

void HAL_ADF_SAD_SoundActivityCallback ( hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Sound activity callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

void HAL_ADF_ErrorCallback ( hal_adf_handle_t * hadf , hal_adf_block_index_t block_index )

Error callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :
hal_status_t HAL_ADF_DFLT_RegisterAcqCpltCallback ( hal_adf_handle_t * hadf , hal_adf_cb_t p_callback )

Register a user acquisition complete callback.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_ADF_DFLT_RegisterAcqHalfCpltCallback ( hal_adf_handle_t * hadf , hal_adf_cb_t p_callback )

Register a user acquisition half complete callback.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_ADF_DFLT_RegisterAcqStopCpltCallback ( hal_adf_handle_t * hadf , hal_adf_cb_t p_callback )

Register a user acquisition stop callback.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_ADF_SAD_RegisterSoundLevelCallback ( hal_adf_handle_t * hadf , hal_adf_cb_t p_callback )

Register a user sound level callback.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_ADF_SAD_RegisterSoundActivityCallback ( hal_adf_handle_t * hadf , hal_adf_cb_t p_callback )

Register a user sound activity callback.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_ADF_RegisterErrorCallback ( hal_adf_handle_t * hadf , hal_adf_cb_t p_callback )

Register a user error callback.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

State functions

group ADF_Exported_Functions_Group8

This section provides a set of functions allowing to get all current states:

Functions

hal_adf_state_t HAL_ADF_GetState ( const hal_adf_handle_t * hadf )

Get the current global state.

Parameters :

hadf – Pointer to a hal_adf_handle_t .

Return values :

hal_adf_state_t – Global state.

hal_adf_serial_interface_state_t HAL_ADF_SITF_GetState ( const hal_adf_handle_t * hadf , hal_adf_block_index_t serial_interface_index )

Get the current state of a specified serial interface.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

hal_adf_serial_interface_state_t – Serial interface state.

hal_adf_digital_filter_state_t HAL_ADF_DFLT_GetState ( const hal_adf_handle_t * hadf , hal_adf_block_index_t digital_filter_index )

Get the current state of a specified digital filter.

Parameters :
Return values :

hal_adf_digital_filter_state_t – Digital filter state.

hal_adf_sad_state_t HAL_ADF_SAD_GetState ( const hal_adf_handle_t * hadf , hal_adf_block_index_t sound_activity_detector_index )

Get the current state of a specified sound activity detector.

Parameters :
  • hadf – Pointer to a hal_adf_handle_t .

  • sound_activity_detector_index – Sound activity detector index.

Return values :

hal_adf_sad_state_t – Sound activity detector state.