recnplay2 2.1.0.0
Main Page

Rec N Play 2 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Ilic
  • Date : Jan 2024.
  • Type : GPIO type

Software Support

We provide a library for the Rec N Play 2 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 Rec N Play 2 Click driver.

Standard key functions :

Example key functions :

  • recnplay2_set_pl_pin This function sets the PL pin on the selected level of Rec N Play 2 click board.
    void recnplay2_set_pl_pin ( recnplay2_t *ctx, uint8_t pin_state );
    void recnplay2_set_pl_pin(recnplay2_t *ctx, uint8_t pin_state)
    Rec N Play 2 PL pin setting function.
  • recnplay2_record_sound This function is used to record sound with Rec N Play 2 click board.
    err_t recnplay2_record_sound ( recnplay2_t *ctx, uint16_t rec_len );
    err_t recnplay2_record_sound(recnplay2_t *ctx, uint16_t rec_len)
    Rec N Play 2 record sound function.
  • recnplay2_play_sound This function is used to play recorded sounds with Rec N Play 2 click board.
    err_t recnplay2_play_sound ( recnplay2_t *ctx, uint16_t play_len );
    err_t recnplay2_play_sound(recnplay2_t *ctx, uint16_t play_len)
    Rec N Play 2 play recorded sounds function.

Example Description

This example demonstrates the use of Rec N Play 2 Click board by

recording and then playing recorded sound.

The demo application is composed of two sections :

Application Init

Initializes the driver, performs the click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
recnplay2_cfg_t recnplay2_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
recnplay2_cfg_setup( &recnplay2_cfg );
RECNPLAY2_MAP_MIKROBUS( recnplay2_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == recnplay2_init( &recnplay2, &recnplay2_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
recnplay2_default_cfg ( &recnplay2 );
log_info( &logger, " Application Task " );
}
#define RECNPLAY2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: recnplay2.h:88
void application_init(void)
Definition: main.c:30

Application Task

Recording sound for 5 seconds, then playing it back.

void application_task ( void )
{
log_printf( &logger, " Recording... \r\n" );
Delay_ms( 1000 );
log_printf( &logger, " Playing... \r\n" );
Delay_ms( 1000 );
}
void application_task(void)
Definition: main.c:62
#define RECORDING_LEN
Definition: main.c:28

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.RecNPlay2

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.