Il y avait des problèmes dans la libraire...
Dependencies: ST_FREQUENCY_DIVIDER ST_I2S USBDEVICE
Fork of X_NUCLEO_CCA02M1 by
Diff: Middlewares/OpenPDM2PCM/OpenPDMFilter.h
- Revision:
- 20:9952bef19da1
- Parent:
- 16:4ab2eac7be21
--- a/Middlewares/OpenPDM2PCM/OpenPDMFilter.h Thu May 04 10:39:39 2017 +0000 +++ b/Middlewares/OpenPDM2PCM/OpenPDMFilter.h Fri May 05 11:34:10 2017 +0000 @@ -44,28 +44,36 @@ /* Definitions ---------------------------------------------------------------*/ -#define HTONS(A) ((((uint16_t)(A) & 0xff00) >> 8) | \ - (((uint16_t)(A) & 0x00ff) << 8)) - - /* * Enable to use a Look-Up Table to improve performances while using more FLASH * and RAM memory. + * Note: Without Look-Up Table up to stereo@16KHz configuration is supported. */ #define USE_LUT +#define SINCN 3 +#define DECIMATION_MAX 128 +#define FILTER_GAIN 16 + +#define HTONS(A) ((((uint16_t)(A) & 0xff00) >> 8) | \ + (((uint16_t)(A) & 0x00ff) << 8)) +#define RoundDiv(a, b) (((a)>0)?(((a)+(b)/2)/(b)):(((a)-(b)/2)/(b))) +#define SaturaLH(N, L, H) (((N)<(L))?(L):(((N)>(H))?(H):(N))) + /* Types ---------------------------------------------------------------------*/ typedef struct { /* Public */ - uint16_t Fs; float LP_HZ; float HP_HZ; - uint16_t In_MicChannels; - uint16_t Out_MicChannels; + uint16_t Fs; + uint8_t In_MicChannels; + uint8_t Out_MicChannels; + uint8_t Decimation; + uint8_t MaxVolume; /* Private */ - uint32_t Coef[5]; + uint32_t Coef[SINCN]; uint16_t FilterLen; int64_t OldOut, OldIn, OldZ; uint16_t LP_ALFA; @@ -78,7 +86,8 @@ /* Exported functions ------------------------------------------------------- */ void Open_PDM_Filter_Init(TPDMFilter_InitStruct *init_struct); -void Open_PDM_Filter(uint8_t* data, uint16_t* data_out, uint16_t mic_gain, TPDMFilter_InitStruct *init_struct); +void Open_PDM_Filter_64(uint8_t* data, uint16_t* data_out, uint16_t mic_gain, TPDMFilter_InitStruct *init_struct); +void Open_PDM_Filter_128(uint8_t* data, uint16_t* data_out, uint16_t mic_gain, TPDMFilter_InitStruct *init_struct); #ifdef __cplusplus }