Audio Demo with DISCO Board, takes control samples, waits for user input, samples regularly.
Dependencies: CMSIS_DSP_401 STM32L4xx_HAL_Driver mbed-src_DISO_AUDIO_DEMO
pdm_filter.h@0:3eee9435dd17, 2015-12-13 (annotated)
- Committer:
- EricLew
- Date:
- Sun Dec 13 19:12:11 2015 +0000
- Revision:
- 0:3eee9435dd17
Audio Demo using DISCO Board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:3eee9435dd17 | 1 | /** |
EricLew | 0:3eee9435dd17 | 2 | ****************************************************************************** |
EricLew | 0:3eee9435dd17 | 3 | * @file pdm_filter.h |
EricLew | 0:3eee9435dd17 | 4 | * @author MCD Application Team |
EricLew | 0:3eee9435dd17 | 5 | * @version V2.0.1 |
EricLew | 0:3eee9435dd17 | 6 | * @date 17-December-2013 |
EricLew | 0:3eee9435dd17 | 7 | * @brief Header file for PDM audio software decoding Library. |
EricLew | 0:3eee9435dd17 | 8 | * This Library is used to decode and reconstruct the audio signal |
EricLew | 0:3eee9435dd17 | 9 | * produced by ST MEMS microphone (MP45Dxxx, MP34Dxxx). |
EricLew | 0:3eee9435dd17 | 10 | * For more details about this Library, please refer to document |
EricLew | 0:3eee9435dd17 | 11 | * "PDM audio software decoding on STM32 microcontrollers (AN3998)". |
EricLew | 0:3eee9435dd17 | 12 | ****************************************************************************** |
EricLew | 0:3eee9435dd17 | 13 | * @attention |
EricLew | 0:3eee9435dd17 | 14 | * |
EricLew | 0:3eee9435dd17 | 15 | * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> |
EricLew | 0:3eee9435dd17 | 16 | * |
EricLew | 0:3eee9435dd17 | 17 | * Licensed under MCD-ST Image SW License Agreement V2, (the "License"); |
EricLew | 0:3eee9435dd17 | 18 | * You may not use this file except in compliance with the License. |
EricLew | 0:3eee9435dd17 | 19 | * You may obtain a copy of the License at: |
EricLew | 0:3eee9435dd17 | 20 | * |
EricLew | 0:3eee9435dd17 | 21 | * http://www.st.com/software_license_agreement_image_v2 |
EricLew | 0:3eee9435dd17 | 22 | * |
EricLew | 0:3eee9435dd17 | 23 | * Unless required by applicable law or agreed to in writing, software |
EricLew | 0:3eee9435dd17 | 24 | * distributed under the License is distributed on an "AS IS" BASIS, |
EricLew | 0:3eee9435dd17 | 25 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
EricLew | 0:3eee9435dd17 | 26 | * See the License for the specific language governing permissions and |
EricLew | 0:3eee9435dd17 | 27 | * limitations under the License. |
EricLew | 0:3eee9435dd17 | 28 | * |
EricLew | 0:3eee9435dd17 | 29 | ****************************************************************************** |
EricLew | 0:3eee9435dd17 | 30 | */ |
EricLew | 0:3eee9435dd17 | 31 | |
EricLew | 0:3eee9435dd17 | 32 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:3eee9435dd17 | 33 | #ifndef __PDM_FILTER_H |
EricLew | 0:3eee9435dd17 | 34 | #define __PDM_FILTER_H |
EricLew | 0:3eee9435dd17 | 35 | |
EricLew | 0:3eee9435dd17 | 36 | #ifdef __cplusplus |
EricLew | 0:3eee9435dd17 | 37 | extern "C" { |
EricLew | 0:3eee9435dd17 | 38 | #endif |
EricLew | 0:3eee9435dd17 | 39 | |
EricLew | 0:3eee9435dd17 | 40 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:3eee9435dd17 | 41 | #include <stdint.h> |
EricLew | 0:3eee9435dd17 | 42 | |
EricLew | 0:3eee9435dd17 | 43 | |
EricLew | 0:3eee9435dd17 | 44 | /* Exported types ------------------------------------------------------------*/ |
EricLew | 0:3eee9435dd17 | 45 | typedef struct { |
EricLew | 0:3eee9435dd17 | 46 | uint16_t Fs; |
EricLew | 0:3eee9435dd17 | 47 | float LP_HZ; |
EricLew | 0:3eee9435dd17 | 48 | float HP_HZ; |
EricLew | 0:3eee9435dd17 | 49 | uint16_t In_MicChannels; |
EricLew | 0:3eee9435dd17 | 50 | uint16_t Out_MicChannels; |
EricLew | 0:3eee9435dd17 | 51 | char InternalFilter[34]; |
EricLew | 0:3eee9435dd17 | 52 | } PDMFilter_InitStruct; |
EricLew | 0:3eee9435dd17 | 53 | |
EricLew | 0:3eee9435dd17 | 54 | /* Exported constants --------------------------------------------------------*/ |
EricLew | 0:3eee9435dd17 | 55 | /* Exported macros -----------------------------------------------------------*/ |
EricLew | 0:3eee9435dd17 | 56 | #define HTONS(A) ((((uint16_t)(A) & 0xff00) >> 8) | \ |
EricLew | 0:3eee9435dd17 | 57 | (((uint16_t)(A) & 0x00ff) << 8)) |
EricLew | 0:3eee9435dd17 | 58 | |
EricLew | 0:3eee9435dd17 | 59 | /* Exported functions ------------------------------------------------------- */ |
EricLew | 0:3eee9435dd17 | 60 | void PDM_Filter_Init(PDMFilter_InitStruct * Filter); |
EricLew | 0:3eee9435dd17 | 61 | |
EricLew | 0:3eee9435dd17 | 62 | int32_t PDM_Filter_64_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); |
EricLew | 0:3eee9435dd17 | 63 | int32_t PDM_Filter_80_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); |
EricLew | 0:3eee9435dd17 | 64 | int32_t PDM_Filter_128_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); |
EricLew | 0:3eee9435dd17 | 65 | int32_t PDM_Filter_64_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); |
EricLew | 0:3eee9435dd17 | 66 | int32_t PDM_Filter_80_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); |
EricLew | 0:3eee9435dd17 | 67 | int32_t PDM_Filter_128_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); |
EricLew | 0:3eee9435dd17 | 68 | |
EricLew | 0:3eee9435dd17 | 69 | #ifdef __cplusplus |
EricLew | 0:3eee9435dd17 | 70 | } |
EricLew | 0:3eee9435dd17 | 71 | #endif |
EricLew | 0:3eee9435dd17 | 72 | |
EricLew | 0:3eee9435dd17 | 73 | #endif /* __PDM_FILTER_H */ |
EricLew | 0:3eee9435dd17 | 74 | |
EricLew | 0:3eee9435dd17 | 75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:3eee9435dd17 | 76 | |
EricLew | 0:3eee9435dd17 | 77 |