Rec & Play Click
Rec&Play Click is a digital voice recorder on a Click board. It is based on the ISD3900, a multi-message record and playback device. It features the ChipCorder technology, offering digital sound compression, smart message management, digitally configurable signal path, and more.
click Product page
Click library
- Author : MikroE Team
- Date : Feb 2020.
- Type : SPI type
Software Support
We provide a library for the RecNPlay 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.
Library Description
This library contains API for RecNPlay Click driver.
Standard key functions :
- Config Object Initialization function.
void recnplay_cfg_setup ( recnplay_cfg_t *cfg );
- Initialization function.
RECNPLAY_RETVAL recnplay_init ( recnplay_t *ctx, recnplay_cfg_t *cfg );
Example key functions :
- Function queries the ISD3900 device status.
RECNPLAY_RETVAL recplay_read_status ( recnplay_t* ctx, uint8_t* interr_status );
- Function erases the message starting at the specified address.
RECNPLAY_RETVAL recplay_erase_msg ( recnplay_t* ctx, uint32_t mem_addr );
- Function initiates a managed record at first available location in memory.
RECNPLAY_RETVAL recplay_record_msg ( recnplay_t* ctx );
Examples Description
This application demonstrates the process of recording a message and playing it back.
The demo application is composed of two sections :
Application Init
Initializes SPI interface in proper mode and performs all the necessary commands to put the device in proper working mode (chip reset, chip power up, chip erasing, clock configuration).
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
log_printf( &logger, "Chip reset...\r\n" );
log_printf( &logger, "Power up...\r\n" );
log_printf( &logger, "Chip Erasing...\r\n" );
log_printf( &logger, "Clock Configuration...\r\n" );
log_printf( &logger, "----------------------------\r\n" );
volume = 0;
Delay_ms ( 1000 );
}
#define RECNPLAY_MAP_MIKROBUS(cfg, mikrobus)
Definition recnplay.h:68
void recplay_reset(recnplay_t *ctx)
ISD3900 Reset Command.
RECNPLAY_RETVAL recplay_pwr_up(recnplay_t *ctx)
Power Up Command.
RECNPLAY_RETVAL recplay_set_clk_cnfg(recnplay_t *ctx, uint8_t clk_cnfg)
Clock Configuration Set Command.
void recnplay_cfg_setup(recnplay_cfg_t *cfg)
Config Object Initialization function.
RECNPLAY_RETVAL recnplay_init(recnplay_t *ctx, recnplay_cfg_t *cfg)
Initialization function.
RECNPLAY_RETVAL recplay_erase_chip(recnplay_t *ctx)
Chip Erase Command.
void application_init(void)
Definition main.c:111
void wait_power_up(void)
Definition main.c:71
void wait_cmd_fin(void)
Definition main.c:50
Click configuration structure definition.
Definition recnplay.h:258
Application Task
Performs the chip configuration for recording message via microphone, then records a message for 8 seconds to specified memory location. After that, it reads the recorded message address with message length and then plays the recorded message. When playback is done it erases the recorded message from memory. Afterwards, it repeats all the operations every 10 seconds.
{
uint8_t cnt;
log_printf( &logger, "Preparing to record a message\r\n" );
for ( cnt = 0; cnt < 32; cnt++ )
{
{
temp_var = config_rec_mic[ cnt ];
}
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "Message recording" );
log_printf( &logger, "End of recording\r\n" );
log_printf( &logger, "Message Address: 0x%lx\r\n", msg_addr );
log_printf( &logger, "Message Length: %u\r\n", msg_len );
Delay_ms ( 1000 );
log_printf( &logger, "Preparing to play a message\r\n" );
for ( cnt = 0; cnt < 32; cnt++ )
{
{
{
temp_var = volume;
}
else
{
temp_var = config_play_pwm_spk[ cnt ];
}
}
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "Message is playing...\r\n" );
log_printf( &logger, "End of playing...\r\n" );
log_printf( &logger, "Status Byte: 0x%x\r\n", ( uint16_t ) status_byte );
log_printf( &logger, "Interrupt byte: 0x%x\r\n", ( uint16_t ) interr_byte );
Delay_ms ( 1000 );
log_printf( &logger, "Message erasing...\r\n" );
log_printf( &logger, "End of erasing\r\n" );
log_printf( &logger, "----------------------------\r\n" );
Delay_ms ( 1000 );
}
#define RECPLAY_CFG03_REG
Definition recnplay.h:156
#define RECPLAY_CFG0A_REG
Definition recnplay.h:163
#define RECPLAY_CFG1C_REG
Definition recnplay.h:181
#define RECPLAY_CFG1E_REG
Definition recnplay.h:183
RECNPLAY_RETVAL recplay_read_msg_addr(recnplay_t *ctx, uint32_t *msg_addr, uint16_t *msg_length)
Recorded Message Address Read Command.
RECNPLAY_RETVAL recplay_erase_msg(recnplay_t *ctx, uint32_t mem_addr)
Message Erase at Address Command.
RECNPLAY_RETVAL recplay_write_cnfg_reg(recnplay_t *ctx, uint8_t reg_addr, uint8_t *cnfg_data, uint8_t n_data)
Configuration Write Command.
RECNPLAY_RETVAL recplay_stop(recnplay_t *ctx)
Stop Command.
RECNPLAY_RETVAL recplay_record_msg_addr(recnplay_t *ctx, uint32_t mem_addr)
Message Record at Address Command.
RECNPLAY_RETVAL recplay_play_msg(recnplay_t *ctx, uint32_t mem_addr, uint16_t sector_offset)
Message Play at Address Command.
void set_volume(uint8_t volume_sel)
Definition main.c:91
void time_record(uint32_t seconds_time)
Definition main.c:81
void application_task(void)
Definition main.c:150
void wait_ready(void)
Definition main.c:61
Note
The ISD3900 must be properly configured to work in record mode every time when user wants to record a message. When user wants to play a recorded message, then ISD3900 must be properly configured, but now to work in play mode.
The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.
Other mikroE Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.RecNPlay
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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.