smartmic 2.0.0.0
Smart Mic Click Driver

API for configuring and manipulating Smart Mic Click driver. More...

Topics

 Smart Mic Registers List
 List of registers of Smart Mic Click driver.
 
 Smart Mic Registers Settings
 Settings for registers of Smart Mic Click driver.
 
 Smart Mic MikroBUS Map
 MikroBUS pin mapping of Smart Mic Click driver.
 

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

API for configuring and manipulating Smart Mic Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ smartmic_cfg_setup()

void smartmic_cfg_setup ( smartmic_cfg_t * cfg)

Smart Mic configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See smartmic_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ smartmic_default_cfg()

err_t smartmic_default_cfg ( smartmic_t * ctx)

Smart Mic default configuration function.

This function executes a default configuration of Smart Mic click board.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ smartmic_disable_device()

void smartmic_disable_device ( smartmic_t * ctx)

Smart Mic disable device function.

This function disables the device by setting the EN pin to low logic state.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ smartmic_download_bin()

err_t smartmic_download_bin ( smartmic_t * ctx,
uint8_t * data_in,
uint32_t len )

Smart Mic download bin function.

This function downloads system config or firmware binary to the module.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 2 - Firmware download success (for UART communication only),
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_download_config()

err_t smartmic_download_config ( smartmic_t * ctx)

Smart Mic download config function.

This function downloads system config to the module. The system config image must be named as smartmic_system_config.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_download_firmware()

err_t smartmic_download_firmware ( smartmic_t * ctx)

Smart Mic download firmware function.

This function downloads firmware to the module. The firmware image must be named as smartmic_firmware.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
  • 2 - Firmware download success (for UART communication only),
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_download_keyword()

err_t smartmic_download_keyword ( smartmic_t * ctx,
uint16_t * data_in,
uint16_t len )

Smart Mic download keyword function.

This function downloads keyword models to the module.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_enable_device()

void smartmic_enable_device ( smartmic_t * ctx)

Smart Mic enable device function.

This function enables the device by setting the EN pin to high logic state.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ smartmic_get_irq_pin()

uint8_t smartmic_get_irq_pin ( smartmic_t * ctx)

Smart Mic get irq pin function.

This function returns the IRQ pin logic state.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ smartmic_init()

err_t smartmic_init ( smartmic_t * ctx,
smartmic_cfg_t * cfg )

Smart Mic initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See smartmic_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See smartmic_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_read_data()

err_t smartmic_read_data ( smartmic_t * ctx,
uint8_t * data_out,
uint16_t len )

Smart Mic read data function.

This function reads a desired number of data bytes from the module.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_send_command()

err_t smartmic_send_command ( smartmic_t * ctx,
uint16_t cmd,
uint16_t data_in,
uint16_t * response )

Smart Mic send command function.

This function sends a command word and a data word to the module and waits for a response. If no response is expected from the module then the SMARTMIC_NO_RESPONSE_BIT bit in command word should be set.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
[in]cmd: Command word to send to the module.
[in]data_in: Data word to send to the module.
[out]response: Response word from the module in case the SMARTMIC_NO_RESPONSE_BIT is not set.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_voice_make()

err_t smartmic_voice_make ( smartmic_t * ctx)

Smart Mic voice make function.

This function performs voice make feature. It stops the route, then sets digital gain to 20db, sample rate to 16K, frame size to 16 ms, and finally it selects route 6 and configures algorithm parameters.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartmic_wait_keyword()

err_t smartmic_wait_keyword ( smartmic_t * ctx)

Smart Mic wait keyword function.

This function waits for a keyword event and then reads it and returns the keyword ID number.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
A voice make and set low power mode features will be performed after event read.

◆ smartmic_write_data()

err_t smartmic_write_data ( smartmic_t * ctx,
uint8_t * data_in,
uint16_t len )

Smart Mic write data function.

This function writes the specified number of data bytes to the module.

Parameters
[in]ctx: Click context object. See smartmic_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.