smartmic 2.0.0.0
smartmic.h File Reference

This file contains API for Smart Mic Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  smartmic_s
 Smart Mic Click context object. More...
 
struct  smartmic_cfg_t
 Smart Mic Click configuration object. More...
 

Macros

#define SMARTMIC_NO_RESPONSE_BIT   0x1000
 Smart Mic API commands for IA611.
 
#define SMARTMIC_CMD_SYNC   0x8000
 
#define SMARTMIC_CMD_SET_AUDIO_DATA_PORT   0x8004
 
#define SMARTMIC_CMD_GET_DEVICE_PARAM   0x800B
 
#define SMARTMIC_CMD_SET_DEVICE_PARAM_ID   0x800C
 
#define SMARTMIC_CMD_SET_DEVICE_PARAM   0x800D
 
#define SMARTMIC_CMD_GET_CHIP_ID   0x800E
 
#define SMARTMIC_CMD_SET_POWER_STATE   ( 0x8010 | SMARTMIC_NO_RESPONSE_BIT )
 
#define SMARTMIC_CMD_SET_CLOCK_SOURCE   0x8011
 
#define SMARTMIC_CMD_SET_UART_STOP_BITS   0x8012
 
#define SMARTMIC_CMD_GET_SIG_RMS   0x8013
 
#define SMARTMIC_CMD_GET_SIG_PEAK   0x8014
 
#define SMARTMIC_CMD_SET_DIG_GAIN   0x8015
 
#define SMARTMIC_CMD_GET_ALGO_PARAM   0x8016
 
#define SMARTMIC_CMD_SET_ALGO_PARAM_ID   0x8017
 
#define SMARTMIC_CMD_SET_ALGO_PARAM   0x8018
 
#define SMARTMIC_CMD_UART_RATE_REQUEST   0x8019
 
#define SMARTMIC_CMD_SET_EVENT_RESP   0x801A
 
#define SMARTMIC_CMD_SET_DIAG_CONFIG   0x801C
 
#define SMARTMIC_CMD_GET_DIG_GAIN   0x801D
 
#define SMARTMIC_CMD_OUTPUT_KNOWN_SIG   0x801E
 
#define SMARTMIC_CMD_GET_FIRST_BUILD_STR   0x8020
 
#define SMARTMIC_CMD_GET_NEXT_BUILD_STR   0x8021
 
#define SMARTMIC_CMD_GET_INFO   0x8022
 
#define SMARTMIC_CMD_SET_SPI_SAMPLE_CFG   0x8023
 
#define SMARTMIC_CMD_SET_STREAMING   0x8025
 
#define SMARTMIC_CMD_GET_BAF_INFO   0x8027
 
#define SMARTMIC_CMD_SELECT_STREAMING   0x8028
 
#define SMARTMIC_CMD_CONFIG_DATA_PORT   0x802C
 
#define SMARTMIC_CMD_READ_DATA_BLOCK   0x802E
 
#define SMARTMIC_CMD_WRITE_DATA_BLOCK   0x802F
 
#define SMARTMIC_CMD_SET_SAMPLE_RATE   0x8030
 
#define SMARTMIC_CMD_SET_PRESET   0x8031
 
#define SMARTMIC_CMD_SELECT_ROUTE   0x8032
 
#define SMARTMIC_CMD_STOP_ROUTE   0x8033
 
#define SMARTMIC_CMD_SET_BUFF_DATA_FORMAT   0x8034
 
#define SMARTMIC_CMD_SET_FRAME_SIZE   0x8035
 
#define SMARTMIC_CMD_PDM_BYPASS_MODE   0x8040
 
#define SMARTMIC_CMD_SET_AUDIO_PORT_CLK_F   0x8042
 
#define SMARTMIC_CMD_POWER_DOWN_INT_OSC   0x8043
 
#define SMARTMIC_CMD_SET_DIG_HW_PT   0x8052
 
#define SMARTMIC_CMD_ENABLE_DISABLE_JTAG   0x8061
 
#define SMARTMIC_CMD_SET_PAD_CONTROL   0x8062
 
#define SMARTMIC_CMD_GET_EVENT   0x806D
 
#define SMARTMIC_VQ_CMD_VS_PROCESSING_MODE   0x5003
 Smart Mic API set algo param commands.
 
#define SMARTMIC_VQ_CMD_OEM_SENSITIVITY   0x5008
 
#define SMARTMIC_VQ_CMD_UTK_SENSITIVITY   0x5009
 
#define SMARTMIC_VQ_CMD_VID_SENSITIVITY   0x500D
 
#define SMARTMIC_VQ_CMD_RESET   0x500E
 
#define SMARTMIC_VS_PROCESSING_MODE_KW   0x0000
 Smart Mic API set algo param settings.
 
#define SMARTMIC_OEM_SENSITIVITY_5   0x0005
 
#define SMARTMIC_UTK_SENSITIVITY_0   0x0000
 
#define SMARTMIC_VID_SENSITIVITY_2   0x0002
 
#define SMARTMIC_RESET   0x0001
 
#define SMARTMIC_SYNC_BYTE   0xB7
 Smart Mic API settings.
 
#define SMARTMIC_BOOT_BYTE   0x01
 
#define SMARTMIC_SAMPLE_RATE_16K   0x0001
 
#define SMARTMIC_FRAME_SIZE_16MS   0x0010
 
#define SMARTMIC_BUFF_DATA_FORMAT_16BIT   0x0002
 
#define SMARTMIC_ROUTE_6   0x0006
 
#define SMARTMIC_DIGITAL_GAIN_20   0x0C14
 
#define SMARTMIC_END_POINT_ID   0x0C00
 
#define SMARTMIC_LOW_POWER_MODE_RT6   0x0002
 
#define SMARTMIC_IA611_INT_RISING_EDGE   0x04
 
#define SMARTMIC_IA611_INT_FALLING_EDGE   0x03
 
#define SMARTMIC_IA611_INT_LOW_LEVEL   0x01
 
#define SMARTMIC_WDB_SIZE_NO_HEADER   508
 
#define SMARTMIC_WDB_SIZE   512
 
#define SMARTMIC_UART_EVENT_HEADER   0xFE
 
#define SMARTMIC_NO_KWD_DETECTED   0
 
#define SMARTMIC_OEM1_KWD_DETECTED   1
 
#define SMARTMIC_OEM2_KWD_DETECTED   2
 
#define SMARTMIC_OEM3_KWD_DETECTED   3
 
#define SMARTMIC_OEM4_KWD_DETECTED   4
 
#define SMARTMIC_DRIVER_UART   0
 Smart Mic Click driver selector.
 
#define SMARTMIC_DRIVER_SPI   1
 
#define SMARTMIC_DRIVER_I2C   2
 
#define SMARTMIC_DRIVER_SELECTOR   SMARTMIC_DRIVER_I2C
 
#define SMARTMIC_SYS_CFG_6SEC_TO   0
 Smart Mic Click system config selector.
 
#define SMARTMIC_SYS_CFG_6SEC_TO_UTK   1
 
#define SMARTMIC_SYS_CFG_6SEC_TO_VID   2
 
#define SMARTMIC_SYS_CFG_SELECTOR   SMARTMIC_SYS_CFG_6SEC_TO
 
#define SMARTMIC_DEVICE_ADDRESS_0   0x3E
 Smart Mic device address setting.
 
#define SMARTMIC_DEVICE_ADDRESS_1   0x3F
 
#define SMARTMIC_DEVICE_ADDRESS_2   0x38
 
#define SMARTMIC_DEVICE_ADDRESS_3   0x39
 
#define SMARTMIC_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define SMARTMIC_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DRV_BUFFER_SIZE   256
 Smart Mic driver buffer size.
 
#define SMARTMIC_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef struct smartmic_s smartmic_t
 Smart Mic Click context object.
 

Enumerations

enum  smartmic_return_value_t { SMARTMIC_OK = 0 , SMARTMIC_ERROR = -1 , SMARTMIC_FIRMWARE_OK = 2 }
 Smart Mic Click return value data. More...
 

Functions

void smartmic_cfg_setup (smartmic_cfg_t *cfg)
 Smart Mic configuration object setup function.
 
err_t smartmic_init (smartmic_t *ctx, smartmic_cfg_t *cfg)
 Smart Mic initialization function.
 
err_t smartmic_default_cfg (smartmic_t *ctx)
 Smart Mic default configuration function.
 
err_t smartmic_write_data (smartmic_t *ctx, uint8_t *data_in, uint16_t len)
 Smart Mic write data function.
 
err_t smartmic_read_data (smartmic_t *ctx, uint8_t *data_out, uint16_t len)
 Smart Mic read data function.
 
err_t smartmic_send_command (smartmic_t *ctx, uint16_t cmd, uint16_t data_in, uint16_t *response)
 Smart Mic send command function.
 
err_t smartmic_download_bin (smartmic_t *ctx, uint8_t *data_in, uint32_t len)
 Smart Mic download bin function.
 
err_t smartmic_download_config (smartmic_t *ctx)
 Smart Mic download config function.
 
err_t smartmic_download_firmware (smartmic_t *ctx)
 Smart Mic download firmware function.
 
err_t smartmic_download_keyword (smartmic_t *ctx, uint16_t *data_in, uint16_t len)
 Smart Mic download keyword function.
 
err_t smartmic_voice_make (smartmic_t *ctx)
 Smart Mic voice make function.
 
err_t smartmic_wait_keyword (smartmic_t *ctx)
 Smart Mic wait keyword function.
 
void smartmic_enable_device (smartmic_t *ctx)
 Smart Mic enable device function.
 
void smartmic_disable_device (smartmic_t *ctx)
 Smart Mic disable device function.
 
uint8_t smartmic_get_irq_pin (smartmic_t *ctx)
 Smart Mic get irq pin function.
 

Detailed Description

This file contains API for Smart Mic Click Driver.

Typedef Documentation

◆ smartmic_t

typedef struct smartmic_s smartmic_t

Smart Mic Click context object.

Context object definition of Smart Mic Click driver.

Enumeration Type Documentation

◆ smartmic_return_value_t

Smart Mic Click return value data.

Predefined enum values for driver return values.

Enumerator
SMARTMIC_OK 
SMARTMIC_ERROR 
SMARTMIC_FIRMWARE_OK