Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ST_FREQUENCY_DIVIDER ST_I2S USBDEVICE
Fork of X_NUCLEO_CCA02M1 by
Revision 6:9b8bc842aeb3, committed 2017-04-21
- Comitter:
- davide.aliprandi@st.com
- Date:
- Fri Apr 21 19:39:27 2017 +0200
- Parent:
- 4:0e1435fe1634
- Child:
- 7:9d6a4a53e640
- Commit message:
- Closed PDM2PCM library removed.
Changed in this revision
--- a/BSP/PDM2PCMAudio.h Fri Apr 21 11:22:02 2017 +0200 +++ b/BSP/PDM2PCMAudio.h Fri Apr 21 19:39:27 2017 +0200 @@ -42,16 +42,11 @@ #define __PDM2PCM_AUDIO_CLASS_H -/* Definitions ---------------------------------------------------------------*/ - -#define USE_OPEN_PDM2PCM_LIBRARY -#define PDM2PCM_AUDIO_DEBUG - - /* Includes ------------------------------------------------------------------*/ #include "mbed.h" #include "component_def.h" +#include "XNucleoCCA02M1_config.h" #ifdef USE_OPEN_PDM2PCM_LIBRARY #include "OpenPDMFilter.h" #else
--- a/BSP/XNucleoCCA02M1.cpp Fri Apr 21 11:22:02 2017 +0200
+++ b/BSP/XNucleoCCA02M1.cpp Fri Apr 21 19:39:27 2017 +0200
@@ -105,7 +105,7 @@
_PDM_buffer_one_ms = (uint16_t *) calloc(_PDM_samples_one_ms, sizeof(uint16_t));
/* Starting the I2S frequency divider, if needed. */
- if (_channels != 1) {
+ if (_channels == 2) {
FrequencyDivider *divider = new FrequencyDivider();
divider->start();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP/XNucleoCCA02M1_config.h Fri Apr 21 19:39:27 2017 +0200 @@ -0,0 +1,78 @@ +/** + ****************************************************************************** + * @file XNucleoCCA02M1_config.h + * @author AST / Software Platforms and Cloud + * @version V1.0 + * @date November 3rd, 2015 + * @brief Configuration header file for the X_NUCLEO_CCA02M1 expansion board. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + +/* Generated with STM32CubeTOO -----------------------------------------------*/ + + +/* Define to prevent recursive inclusion -------------------------------------*/ + +#ifndef __X_NUCLEO_CCA02M1_CONFIG_H +#define __X_NUCLEO_CCA02M1_CONFIG_H + + +/* Definitions ---------------------------------------------------------------*/ + +/* ACTION --------------------------------------------------------------------* + * Specify here a configuration for I/O and interrupts' pins. * + * * + * Example: * + * // I2C. * + * #define EXPANSIONBOARD_PIN_I2C_SCL (D15) * + * #define EXPANSIONBOARD_PIN_I2C_SDA (D14) * + * * + * // SPI. * + * #define EXPANSIONBOARD_PIN_SPI_MOSI (D11) * + * #define EXPANSIONBOARD_PIN_SPI_MISO (D12) * + * #define EXPANSIONBOARD_PIN_SPI_SCLK (D13) * + * * + * // Interrupts. * + * #define EXPANSIONBOARD_PIN_INT_1 (A2) * + *----------------------------------------------------------------------------*/ +/** + * Enable to use the OpenPDM2PCM library, which can handle one microphone at + * 16KHz maximum. + */ +#define USE_OPEN_PDM2PCM_LIBRARY + +/** + * Enable to signal the duration of the PDM2PCM library utilization, which can + * be seen through an oscilloscope. + */ +//#define PDM2PCM_AUDIO_DEBUG + +#endif /* __X_NUCLEO_CCA02M1_CONFIG_H */
--- a/Middlewares/OpenPDM2PCM/OpenPDMFilter.c Fri Apr 21 11:22:02 2017 +0200
+++ b/Middlewares/OpenPDM2PCM/OpenPDMFilter.c Fri Apr 21 19:39:27 2017 +0200
@@ -64,31 +64,30 @@
uint32_t Kernel[/* KernelLen */], unsigned short KernelLen,
uint32_t Result[/* SignalLen + KernelLen - 1 */]);
-int64_t filterTable(uint8_t *data, uint8_t table, TPDMFilter_InitStruct *Param)
+inline int64_t filterTable(uint8_t *data, uint8_t table, TPDMFilter_InitStruct *Param)
{
- uint16_t contatore = 0;
+ uint16_t counter = 0;
int64_t F = 0;
uint8_t c;
uint8_t i;
- uint16_t internalBit = Param->bit[table];
- uint16_t internalBit_copy = internalBit;
+ uint16_t internal_bit = Param->bit[table];
uint16_t In_Mic = Param->In_MicChannels;
c = data[0];
- for(i=0; i<Param->Decimation;i++)
+ for (i=0; i<Param->Decimation; i++)
{
- if (c & (1<<((7-internalBit))))
+ if (c & (1<<((7-internal_bit))))
F += coef[table][i];
- internalBit++;
- if(internalBit==8)
+ internal_bit++;
+ if (internal_bit==8)
{
- contatore+=In_Mic;
- internalBit = 0;
- c = data[contatore];
+ counter += In_Mic;
+ internal_bit = 0;
+ c = data[counter];
}
}
- Param->bit[table] = internalBit;
- Param->byte = contatore;
+ Param->bit[table] = internal_bit;
+ Param->byte = counter;
return F;
}
Binary file Middlewares/PDM2PCM/libPDMFilter_CM4_GCC.a has changed
--- a/Middlewares/PDM2PCM/pdm_filter.h Fri Apr 21 11:22:02 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/**
- ******************************************************************************
- * @file pdm_filter.h
- * @author MCD Application Team
- * @version V2.0.1
- * @date 17-December-2013
- * @brief Header file for PDM audio software decoding Library.
- * This Library is used to decode and reconstruct the audio signal
- * produced by ST MEMS microphone (MP45Dxxx, MP34Dxxx).
- * For more details about this Library, please refer to document
- * "PDM audio software decoding on STM32 microcontrollers (AN3998)".
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Image SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_image_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __PDM_FILTER_H
-#define __PDM_FILTER_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
-/* Includes ------------------------------------------------------------------*/
-#include <stdint.h>
-
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct {
- uint16_t Fs;
- float LP_HZ;
- float HP_HZ;
- uint16_t In_MicChannels;
- uint16_t Out_MicChannels;
- char InternalFilter[34];
-} PDMFilter_InitStruct;
-
-/* Exported constants --------------------------------------------------------*/
-/* Exported macros -----------------------------------------------------------*/
-#define HTONS(A) ((((uint16_t)(A) & 0xff00) >> 8) | \
- (((uint16_t)(A) & 0x00ff) << 8))
-
-/* Exported functions ------------------------------------------------------- */
-void PDM_Filter_Init(PDMFilter_InitStruct * Filter);
-int32_t PDM_Filter_64_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
-int32_t PDM_Filter_80_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
-int32_t PDM_Filter_128_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
-int32_t PDM_Filter_64_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
-int32_t PDM_Filter_80_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
-int32_t PDM_Filter_128_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __PDM_FILTER_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
Binary file Middlewares/PDM2PCM/software_license_agreement_image_v2.pdf has changed
