LibDriver LD3320
Loading...
Searching...
No Matches
ld3320 basic driver function

ld3320 basic driver modules More...

Collaboration diagram for ld3320 basic driver function:

Data Structures

struct  ld3320_handle_s
 ld3320 handle structure definition More...
struct  ld3320_info_s
 ld3320 information structure definition More...

Macros

#define LD3320_CYSTAL_MHZ   22.1184f /* 22.1184 MHz */
 ld3320 crystal frequency definition

Typedefs

typedef struct ld3320_handle_s ld3320_handle_t
 ld3320 handle structure definition
typedef struct ld3320_info_s ld3320_info_t
 ld3320 information structure definition

Enumerations

enum  ld3320_mode_t { LD3320_MODE_ASR = 0x01 , LD3320_MODE_MP3 = 0x02 }
 ld3320 mode enumeration definition More...
enum  ld3320_mic_gain_t { LD3320_MIC_GAIN_COMMON = 0x43 , LD3320_MIC_GAIN_NOISE = 0x2F }
 ld3320 mic gain enumeration definition More...
enum  ld3320_vad_t { LD3320_VAD_COMMON = 0x12 , LD3320_VAD_FAR = 0x0A }
 ld3320 vad enumeration definition More...
enum  ld3320_status_t {
  LD3320_STATUS_NONE = 0x00 , LD3320_STATUS_ASR_RUNNING = 0x01 , LD3320_STATUS_ASR_FOUND_OK = 0x02 , LD3320_STATUS_ASR_FOUND_ZERO = 0x03 ,
  LD3320_STATUS_ASR_ERROR = 0x04 , LD3320_STATUS_MP3_RUNNING = 0x05 , LD3320_STATUS_MP3_LOAD = 0x06 , LD3320_STATUS_MP3_END = 0x07 ,
  LD3320_STATUS_MP3_ERROR = 0x08
}
 ld3320 asr status enumeration definition More...

Functions

uint8_t ld3320_info (ld3320_info_t *info)
 get chip's information
uint8_t ld3320_irq_handler (ld3320_handle_t *handle)
 irq handler
uint8_t ld3320_init (ld3320_handle_t *handle)
 initialize the chip
uint8_t ld3320_deinit (ld3320_handle_t *handle)
 deinit the chip
uint8_t ld3320_start (ld3320_handle_t *handle)
 start the process
uint8_t ld3320_stop (ld3320_handle_t *handle)
 stop the process
uint8_t ld3320_configure_mp3 (ld3320_handle_t *handle, char *name)
 configure the mp3
uint8_t ld3320_set_mode (ld3320_handle_t *handle, ld3320_mode_t mode)
 set the chip mode
uint8_t ld3320_get_mode (ld3320_handle_t *handle, ld3320_mode_t *mode)
 get the chip mode
uint8_t ld3320_set_key_words (ld3320_handle_t *handle, char text[50][50], uint8_t len)
 set the key words
uint8_t ld3320_get_key_words (ld3320_handle_t *handle, char text[50][50], uint8_t *len)
 get the key words
uint8_t ld3320_set_mic_gain (ld3320_handle_t *handle, ld3320_mic_gain_t gain)
 set the microphone gain
uint8_t ld3320_get_mic_gain (ld3320_handle_t *handle, ld3320_mic_gain_t *gain)
 get the microphone gain
uint8_t ld3320_set_vad (ld3320_handle_t *handle, ld3320_vad_t vad)
 set the vad
uint8_t ld3320_get_vad (ld3320_handle_t *handle, ld3320_vad_t *vad)
 get the vad
uint8_t ld3320_get_status (ld3320_handle_t *handle, ld3320_status_t *status)
 get the status
uint8_t ld3320_set_speaker_volume (ld3320_handle_t *handle, uint8_t volume)
 set the speaker volume
uint8_t ld3320_get_speaker_volume (ld3320_handle_t *handle, uint8_t *volume)
 get the speaker volume
uint8_t ld3320_set_headset_volume (ld3320_handle_t *handle, uint8_t volume_left, uint8_t volume_right)
 set the headset volume
uint8_t ld3320_get_headset_volume (ld3320_handle_t *handle, uint8_t *volume_left, uint8_t *volume_right)
 get the headset volume

Detailed Description

ld3320 basic driver modules

Macro Definition Documentation

◆ LD3320_CYSTAL_MHZ

#define LD3320_CYSTAL_MHZ   22.1184f /* 22.1184 MHz */

ld3320 crystal frequency definition

Definition at line 63 of file driver_ld3320.h.

Typedef Documentation

◆ ld3320_handle_t

ld3320 handle structure definition

◆ ld3320_info_t

typedef struct ld3320_info_s ld3320_info_t

ld3320 information structure definition

Enumeration Type Documentation

◆ ld3320_mic_gain_t

ld3320 mic gain enumeration definition

Enumerator
LD3320_MIC_GAIN_COMMON 

common

LD3320_MIC_GAIN_NOISE 

noise

Definition at line 78 of file driver_ld3320.h.

◆ ld3320_mode_t

ld3320 mode enumeration definition

Enumerator
LD3320_MODE_ASR 

asr mode

LD3320_MODE_MP3 

mp3 mode

Definition at line 69 of file driver_ld3320.h.

◆ ld3320_status_t

ld3320 asr status enumeration definition

Enumerator
LD3320_STATUS_NONE 

none

LD3320_STATUS_ASR_RUNNING 

asr running

LD3320_STATUS_ASR_FOUND_OK 

asr found ok

LD3320_STATUS_ASR_FOUND_ZERO 

asr found zero

LD3320_STATUS_ASR_ERROR 

asr error

LD3320_STATUS_MP3_RUNNING 

mp3 running

LD3320_STATUS_MP3_LOAD 

mp3 load

LD3320_STATUS_MP3_END 

mp3 end

LD3320_STATUS_MP3_ERROR 

mp3 error

Definition at line 96 of file driver_ld3320.h.

◆ ld3320_vad_t

ld3320 vad enumeration definition

Enumerator
LD3320_VAD_COMMON 

common

LD3320_VAD_FAR 

far

Definition at line 87 of file driver_ld3320.h.

Function Documentation

◆ ld3320_configure_mp3()

uint8_t ld3320_configure_mp3 ( ld3320_handle_t * handle,
char * name )

configure the mp3

Parameters
[in]*handlepointer to an ld3320 handle structure
[in]*namepointer to a name buffer
Returns
status code
  • 0 success
  • 1 configure mp3 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 2215 of file driver_ld3320.c.

◆ ld3320_deinit()

uint8_t ld3320_deinit ( ld3320_handle_t * handle)

deinit the chip

Parameters
[in]*handlepointer to an ld3320 handle structure
Returns
status code
  • 0 success
  • 1 deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio deinit failed
  • 5 spi deinit failed
  • 6 mp3 deinit failed
Note
none

Definition at line 1870 of file driver_ld3320.c.

◆ ld3320_get_headset_volume()

uint8_t ld3320_get_headset_volume ( ld3320_handle_t * handle,
uint8_t * volume_left,
uint8_t * volume_right )

get the headset volume

Parameters
[in]*handlepointer to an ld3320 handle structure
[out]*volume_leftpointer to a left volume buffer
[out]*volume_rightpointer to a right volume buffer
Returns
status code
  • 0 success
  • 1 get headset volume
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 2166 of file driver_ld3320.c.

◆ ld3320_get_key_words()

uint8_t ld3320_get_key_words ( ld3320_handle_t * handle,
char text[50][50],
uint8_t * len )

get the key words

Parameters
[in]*handlepointer to an ld3320 handle structure
[out]**textpointer to a text buffer
[out]*lenpointer to a key words length buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1129 of file driver_ld3320.c.

◆ ld3320_get_mic_gain()

uint8_t ld3320_get_mic_gain ( ld3320_handle_t * handle,
ld3320_mic_gain_t * gain )

get the microphone gain

Parameters
[in]*handlepointer to an ld3320 handle structure
[out]*gainpointer to a microphone gain buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1187 of file driver_ld3320.c.

◆ ld3320_get_mode()

uint8_t ld3320_get_mode ( ld3320_handle_t * handle,
ld3320_mode_t * mode )

get the chip mode

Parameters
[in]*handlepointer to an ld3320 handle structure
[out]*modepointer to a chip mode buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1069 of file driver_ld3320.c.

◆ ld3320_get_speaker_volume()

uint8_t ld3320_get_speaker_volume ( ld3320_handle_t * handle,
uint8_t * volume )

get the speaker volume

Parameters
[in]*handlepointer to an ld3320 handle structure
[out]*volumepointer to a speaker volume buffer
Returns
status code
  • 0 success
  • 1 get speaker volume
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 2062 of file driver_ld3320.c.

◆ ld3320_get_status()

uint8_t ld3320_get_status ( ld3320_handle_t * handle,
ld3320_status_t * status )

get the status

Parameters
[in]*handlepointer to an ld3320 handle structure
[out]*statuspointer to a status buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1265 of file driver_ld3320.c.

◆ ld3320_get_vad()

uint8_t ld3320_get_vad ( ld3320_handle_t * handle,
ld3320_vad_t * vad )

get the vad

Parameters
[in]*handlepointer to an ld3320 handle structure
[out]*vadpointer to a vad param buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1239 of file driver_ld3320.c.

◆ ld3320_info()

uint8_t ld3320_info ( ld3320_info_t * info)

get chip's information

Parameters
[out]*infopointer to an ld3320 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 2300 of file driver_ld3320.c.

◆ ld3320_init()

uint8_t ld3320_init ( ld3320_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an ld3320 handle structure
Returns
status code
  • 0 success
  • 1 spi initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 reset failed
Note
none

Definition at line 1292 of file driver_ld3320.c.

◆ ld3320_irq_handler()

uint8_t ld3320_irq_handler ( ld3320_handle_t * handle)

irq handler

Parameters
[in]*handlepointer to an ld3320 handle structure
Returns
status code
  • 0 success
  • 1 run failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 mode is invalid
Note
none

Definition at line 1421 of file driver_ld3320.c.

◆ ld3320_set_headset_volume()

uint8_t ld3320_set_headset_volume ( ld3320_handle_t * handle,
uint8_t volume_left,
uint8_t volume_right )

set the headset volume

Parameters
[in]*handlepointer to an ld3320 handle structure
[in]volume_leftleft volume
[in]volume_rightright volume
Returns
status code
  • 0 success
  • 1 set headset volume
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 volume is invalid
Note
none

Definition at line 2102 of file driver_ld3320.c.

◆ ld3320_set_key_words()

uint8_t ld3320_set_key_words ( ld3320_handle_t * handle,
char text[50][50],
uint8_t len )

set the key words

Parameters
[in]*handlepointer to an ld3320 handle structure
[in]**textpointer to a text buffer
[in]lenkey words length
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1096 of file driver_ld3320.c.

◆ ld3320_set_mic_gain()

uint8_t ld3320_set_mic_gain ( ld3320_handle_t * handle,
ld3320_mic_gain_t gain )

set the microphone gain

Parameters
[in]*handlepointer to an ld3320 handle structure
[in]gainmicrophone gain
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1161 of file driver_ld3320.c.

◆ ld3320_set_mode()

uint8_t ld3320_set_mode ( ld3320_handle_t * handle,
ld3320_mode_t mode )

set the chip mode

Parameters
[in]*handlepointer to an ld3320 handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1043 of file driver_ld3320.c.

◆ ld3320_set_speaker_volume()

uint8_t ld3320_set_speaker_volume ( ld3320_handle_t * handle,
uint8_t volume )

set the speaker volume

Parameters
[in]*handlepointer to an ld3320 handle structure
[in]volumespeaker volume
Returns
status code
  • 0 success
  • 1 set speaker volume
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 volume is invalid
Note
volume <= 15

Definition at line 2013 of file driver_ld3320.c.

◆ ld3320_set_vad()

uint8_t ld3320_set_vad ( ld3320_handle_t * handle,
ld3320_vad_t vad )

set the vad

Parameters
[in]*handlepointer to an ld3320 handle structure
[in]vadvad param
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1213 of file driver_ld3320.c.

◆ ld3320_start()

uint8_t ld3320_start ( ld3320_handle_t * handle)

start the process

Parameters
[in]*handlepointer to an ld3320 handle structure
Returns
status code
  • 0 success
  • 1 start failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1739 of file driver_ld3320.c.

◆ ld3320_stop()

uint8_t ld3320_stop ( ld3320_handle_t * handle)

stop the process

Parameters
[in]*handlepointer to an ld3320 handle structure
Returns
status code
  • 0 success
  • 1 stop failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1958 of file driver_ld3320.c.