MP3 2 Click
MP3 2 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : MikroE Team
- Date : Jun 2020.
- Type : UART type
Software Support
Example Description
This example demonstates the use of MP3 2 Click board.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.Mp32
Example Key Functions
- mp32_cfg_setup Config Object Initialization function.
void mp32_cfg_setup(mp32_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition mp32.h:206
- mp32_init Initialization function.
MP32_RETVAL mp32_init(mp32_t *ctx, mp32_cfg_t *cfg)
Initialization function.
Click ctx object definition.
Definition mp32.h:188
- mp32_hw_reset Reset the device function.
void mp32_hw_reset(mp32_t *ctx)
Reset the device function.
- mp32_rx_cmd Received response data function.
void mp32_rx_cmd(mp32_t *ctx, uint8_t *rd_data, uint8_t len)
Received response data function.
- mp32_tx_cmd Write command function.
void mp32_tx_cmd(mp32_t *ctx, uint8_t cmd, uint16_t spec_data)
Write command function.
Application Init
Initializes the driver and enables the Click board. Then sets the device to play songs from SD Card, and after that sets volume, and equalizer.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
Delay_ms ( 500 );
log_printf( &logger, "-------------------------\r\n" );
log_printf( &logger, " MP3 2 Click \r\n" );
log_printf( &logger, "-------------------------\r\n" );
Delay_100ms( );
Delay_ms ( 100 );
Delay_ms ( 100 );
}
#define MP32_SDCARD
Definition mp32.h:159
#define MP32_EQ_NORMAL
Definition mp32.h:146
#define MP32_MAP_MIKROBUS(cfg, mikrobus)
Definition mp32.h:67
void mp32_set_device(mp32_t *ctx, uint8_t device)
Set device function.
void mp32_set_eq(mp32_t *ctx, uint8_t eq)
Set equalizer mode function.
void mp32_set_volume(mp32_t *ctx, uint8_t perc)
Set Volume function.
void application_init(void)
Definition main.c:39
Application Task
Demonstrates the use of play, play next, and pause modes. Each step will be logged on the USB UART where you can track the program flow.
{
log_printf( &logger, " >>> Play\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " >>> Next song\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " >>> Pause\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
void mp32_play_mode(mp32_t *ctx)
Play mode function.
void mp32_play_next(mp32_t *ctx)
Play previous command function.
void mp32_pause_mode(mp32_t *ctx)
Pause mode function.
void application_task(void)
Definition main.c:79
Note
A valid microSD Card that contains at least one mp3 sound on it needs to be inserted into the Click board.
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.