library

Dependents:   Aprendendo Final_v3

Committer:
zigdrix
Date:
Mon Oct 19 22:13:50 2020 +0000
Revision:
4:e746cdd3e76a
Parent:
0:0002c86c2220
Projeto Final PI 1

Who changed what in which revision?

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