Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit b623a62

Browse files
committed
Add Audio library
2 examples - Player - recorder Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent caa56d4 commit b623a62

File tree

13 files changed

+3677
-5
lines changed

13 files changed

+3677
-5
lines changed

cores/arduino/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ int main( void )
4040
#if defined(USBCON)
4141
usbd_interface_init();
4242
#endif
43+
// Set MIC Connected to CODEC
44+
pinMode(MIC_SEL, OUTPUT);
45+
digitalWrite(MIC_SEL, CODEC);
4346

4447
setup();
4548

libraries/Audio/src/Audio.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* Copyright (c) 2012 by Cristian Maglie <c.maglie@arduino.cc>
3-
* Audio library for Arduino Due.
3+
* Audio library.
4+
*
5+
* Modified by Frederic Pillon <frederic.pillon@st.com>
46
*
57
* This file is free software; you can redistribute it and/or modify
68
* it under the terms of either the GNU General Public License version 2
@@ -9,7 +11,7 @@
911
*/
1012

1113
#include "Audio.h"
12-
#include "otto_audio_inout.h"
14+
//#include "bsp_audio_inout.h"
1315

1416
AudioClass Audio;
1517

libraries/Audio/src/Audio.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* Copyright (c) 2012 by Cristian Maglie <c.maglie@arduino.cc>
3-
* Audio library for Arduino Due.
3+
* Audio library.
4+
*
5+
* Modified by Frederic Pillon <frederic.pillon@st.com>
46
*
57
* This file is free software; you can redistribute it and/or modify
68
* it under the terms of either the GNU General Public License version 2
@@ -14,8 +16,8 @@
1416
#include <Arduino.h>
1517
#include <Print.h>
1618
#include "Wave.h"
17-
/* otto includes component */
18-
#include "otto_audio_inout.h"
19+
/* BSP includes component */
20+
#include "bsp_audio_inout.h"
1921

2022
#define AUDIO_IN_BUFFER_SIZE 4*2304
2123

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/**
2+
******************************************************************************
3+
* @file audio.h
4+
* @author MCD Application Team
5+
* @version V4.0.1
6+
* @date 21-July-2015
7+
* @brief This header file contains the common defines and functions prototypes
8+
* for the Audio driver.
9+
******************************************************************************
10+
* @attention
11+
*
12+
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
13+
*
14+
* Redistribution and use in source and binary forms, with or without modification,
15+
* are permitted provided that the following conditions are met:
16+
* 1. Redistributions of source code must retain the above copyright notice,
17+
* this list of conditions and the following disclaimer.
18+
* 2. Redistributions in binary form must reproduce the above copyright notice,
19+
* this list of conditions and the following disclaimer in the documentation
20+
* and/or other materials provided with the distribution.
21+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
22+
* may be used to endorse or promote products derived from this software
23+
* without specific prior written permission.
24+
*
25+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35+
*
36+
******************************************************************************
37+
*/
38+
39+
/* Define to prevent recursive inclusion -------------------------------------*/
40+
#ifndef __AUDIO_H
41+
#define __AUDIO_H
42+
43+
#ifdef __cplusplus
44+
extern "C" {
45+
#endif
46+
47+
/* Includes ------------------------------------------------------------------*/
48+
#include <stdint.h>
49+
50+
/** @addtogroup BSP
51+
* @{
52+
*/
53+
54+
/** @addtogroup Components
55+
* @{
56+
*/
57+
58+
/** @addtogroup AUDIO
59+
* @{
60+
*/
61+
62+
/** @defgroup AUDIO_Exported_Constants
63+
* @{
64+
*/
65+
66+
/* Codec audio Standards */
67+
#define CODEC_STANDARD 0x04
68+
#define I2S_STANDARD I2S_STANDARD_PHILIPS
69+
70+
/**
71+
* @}
72+
*/
73+
74+
/** @defgroup AUDIO_Exported_Types
75+
* @{
76+
*/
77+
78+
/** @defgroup AUDIO_Driver_structure Audio Driver structure
79+
* @{
80+
*/
81+
typedef struct
82+
{
83+
uint32_t (*Init)(uint16_t, uint16_t, uint8_t, uint32_t);
84+
void (*DeInit)(void);
85+
uint32_t (*ReadID)(uint16_t);
86+
uint32_t (*Play)(uint16_t, uint16_t*, uint16_t);
87+
uint32_t (*Pause)(uint16_t);
88+
uint32_t (*Resume)(uint16_t);
89+
uint32_t (*Stop)(uint16_t, uint32_t);
90+
uint32_t (*SetFrequency)(uint16_t, uint32_t);
91+
uint32_t (*SetVolume)(uint16_t, uint8_t);
92+
uint32_t (*SetMute)(uint16_t, uint32_t);
93+
uint32_t (*SetOutputMode)(uint16_t, uint8_t);
94+
uint32_t (*Reset)(uint16_t);
95+
}AUDIO_DrvTypeDef;
96+
/**
97+
* @}
98+
*/
99+
100+
/**
101+
* @}
102+
*/
103+
104+
/**
105+
* @}
106+
*/
107+
108+
/**
109+
* @}
110+
*/
111+
112+
/**
113+
* @}
114+
*/
115+
116+
#ifdef __cplusplus
117+
}
118+
#endif
119+
120+
#endif /* __AUDIO_H */
121+
122+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)