4D Systems Sound Module Library

Dependents:   STM32F030R8_SOMO-14D

SOMO-14D

The SOMO-14D is a tiny Audio-Sound module that can play back pre-stored audio files such as voice and music from a micro-SD memory card. The module supports 4-bit ADPCM audio files with sample rates from 6Khz up to 32Khz. By using the freely available software tool, any WAVE(.wav) or MP3(.mp3) file can be easily converted to the ADPCM(.ad4) format which can then be can be saved to a micro-SD memory card. The compact 14pin drop-in-module takes up very minimal board space and is ideal for any application that requires embedded audio.

The SERIAL-MODE provides a simple 2-wire interface to any micro-controller via its DATA and CLK lines. Audio operations such as PLAY, PAUSE,STOP and VOLUME control functions are all available to the host micro via simple serial commands.

SOMO-14D Library

The SOMO library handles all basic functions that access the hardware to set the commands that ensure SERIAL-MODE interfacing.

Some of the functions can make control of: - Initialization - Activity - Command

Initialization Function

  • void SOMO14DInit(void (*pfunc)(void));

Activity Function

  • INT8U SOMO14DisBusy(void);

Commanding Functions

  • void SOMO14DSerialOut(INT16U SOMO14Duint16);
  • void SOMO14DPause(void);
  • void SOMO14DStop(void);
  • void SOMO14DSetVol(INT8U *SOMO14DVol);
  • void SOMO14DSetAudio(INT16U SOMO14DAudioFileNo);

For check the function by capability please check the "functions" wiki

SOMO14D.h

Committer:
issaiass
Date:
2015-03-14
Revision:
2:673ecbaff67b
Parent:
0:41f21e0cf86f

File content as of revision 2:673ecbaff67b:

/*
*******************************************************************************
*                               CERES CONTROLS
*                         PANAMA, REPULIC OF PANAMA
*
*  File          : SOMO14D.h
*  Programmer(s) : Rangel Alvarado
*  Language      : ANSI-C
*  Description   : SOMO14D is an acronym of SOund MOdule 1 4D SYSTEMS INC.
*                  The file mlist all public functions which can be called on
*                  your application.
*
*  Note          : Dependancies of mbed libraries...
*                  - InterruptIn
*                  - DigitalOut
*
*  ----------------------------------------------------------------------------
*  HISTORY
*   DD MM AA
*   09 03 15    Created.
*   09 03 15    Modified.
*   12 03 15    Import to mbed platform.
*   13 03 15    Moved a function to a private state.
*******************************************************************************
*/


/*
*******************************************************************************
*                         CONSTANTS AND MACROS
*******************************************************************************
*/

#define SOMO_BUSY_PIN          PC_0      /* BUSY signal. Active HIGH output.  */
#define SOMO_DATA_PIN          PC_1      /* Serial DATA input from host MCU   */
#define SOMO_CLK_PIN           PC_2      /* Serial Clock input from host MCU  */
#define SOMO_RESET_PIN         PC_3      /* Master Reset. Active LOW trigger. */
#define SOMO_WAIT_BIT          0.01      /* Wait between bits, base = 1 sec.  */
#define SOMO_WAIT_IDLE         0.05      /* Wait between idle, base = 1 sec.  */


#define SOMO_SONG_CMD_MAX      0x01FF    /* 0x0000 = first; 0x01FF = last     */
#define SOMO_VOL_CMD_OFFSET    0xFFF0    /* 0xFFF0 = Vol 0; 0xFFF7 = Vol 7    */
#define SOMO_PAUSE_CMD_OFFSET  0xFFFE    /* Hold or pause/play command        */
#define SOMO_STOP_CMD_OFFSET   0xFFFF    /* Stop audio command                */
#define SOMO_VOL_UNF           0xFF      /* Volume underflow (app specific)   */
#define SOMO_VOL_MIN           0         /* Volume minimun                    */
#define SOMO_VOL_MAX           7         /* Volume maximum                    */


/*
*******************************************************************************
*                         FUNCTION PROTOTYPES
*******************************************************************************
*/

INT8U SOMO14DisBusy(void);               /* Check if SOMO is doing something */
void  SOMO14DInit(void (*pfunc)(void));  /* Initialize the sound module      */
void  SOMO14DPause(void);                /* Hold the current song            */
void  SOMO14DStop(void);                 /* Stop audio and go to sleep mode  */
void  SOMO14DSetVol(INT8U *SOMO14DVol);  /* Increase/Decrease the volume     */
void  SOMO14DSetAudio(INT16U SOMO14DAudioFileNo); /* Set audio file          */