dtmfdecoder  2.0.0.0
Main Page

DTMF Decoder click

DTMF Decoder Click is a compact add-on board that contains an integrated DTMF receiver with enhanced sensitivity. This board features the MT8870D, a complete DTMF receiver integrating the band-split filter and digital decoder functions from Microchip Technology.

click Product page


Click library

  • Author : Stefan Nikolic
  • Date : jan 2021.
  • Type : I2C type

Software Support

We provide a library for the DTMFDecoder Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Library Description

This library contains API for DTMFDecoder Click driver.

Standard key functions :

Example key functions :

Example Description

This example shows the basic tone capture of DTMF frequencies, decoding and representing them on the UART LOG.

The demo application is composed of two sections :

Application Init

Initializes I2C and UART LOG drivers and powers on the device.

void application_init ( void ) {
log_cfg_t log_cfg;
dtmfdecoder_cfg_t dtmfdecoder_cfg;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 115200;
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
dtmfdecoder_cfg_setup( &dtmfdecoder_cfg );
DTMFDECODER_MAP_MIKROBUS( dtmfdecoder_cfg, MIKROBUS_1 );
err_t init_flag = dtmfdecoder_init( &dtmfdecoder, &dtmfdecoder_cfg );
if ( init_flag == I2C_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
dtmfdecoder_default_cfg ( &dtmfdecoder );
Delay_ms( 100 );
log_info( &logger, " Application Task " );
}

Application Task

Checks the delayed steering for incoming tones and decoding them on the UART LOG. Holding the same key will recognize multiple tone generation, the tone register delay constant can be set to adjust the tolerance.

void application_task ( void ) {
uint8_t result;
if ( dtmfdecoder_delayed_steering_check( &dtmfdecoder ) ) {
result = dtmfdecoder_tone_read( &dtmfdecoder );
log_printf( &logger, " Detected key tone:\t%c\r\n", result );
Delay_ms( tone_register_delay );
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.DTMFDecoder

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all Mikroelektronika compilers.


dtmfdecoder_init
err_t dtmfdecoder_init(dtmfdecoder_t *ctx, dtmfdecoder_cfg_t *cfg)
DTMF Decoder initialization function.
dtmfdecoder_tone_read
uint8_t dtmfdecoder_tone_read(dtmfdecoder_t *ctx)
DTMF Decoder read tone function.
dtmfdecoder_cfg_setup
void dtmfdecoder_cfg_setup(dtmfdecoder_cfg_t *cfg)
DTMF Decoder configuration object setup function.
dtmfdecoder_delayed_steering_check
uint8_t dtmfdecoder_delayed_steering_check(dtmfdecoder_t *ctx)
DTMF Decoder check delayed steering function.
dtmfdecoder_default_cfg
void dtmfdecoder_default_cfg(dtmfdecoder_t *ctx)
DTMF Decoder default configuration function.
application_task
void application_task(void)
Definition: main.c:65
dtmfdecoder_cfg_t
DTMF Decoder Click configuration object.
Definition: dtmfdecoder.h:133
dtmfdecoder_powerdown_off
void dtmfdecoder_powerdown_off(dtmfdecoder_t *ctx)
DTMF Decoder power down off function.
DTMFDECODER_MAP_MIKROBUS
#define DTMFDECODER_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: dtmfdecoder.h:94
dtmfdecoder_t
DTMF Decoder Click context object.
Definition: dtmfdecoder.h:108
application_init
void application_init(void)
Definition: main.c:36