STM32746G-Discovery board drivers V1.0.0

Dependents:   DISCO-F746NG_LCDTS_CC3000_NTP DISCO-F746NG_ROPE_WIFI F746_SpectralAnalysis_NoPhoto ecte433 ... more

Committer:
jeromecoutant
Date:
Wed Nov 27 08:29:42 2019 +0000
Revision:
13:85dbcff443aa
Parent:
10:1050c589b2ad
Fix OV9655 Camera Driver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 6:e1d9da7fe856 1 /**
bcostm 6:e1d9da7fe856 2 ******************************************************************************
bcostm 6:e1d9da7fe856 3 * @file wm8994.h
bcostm 6:e1d9da7fe856 4 * @author MCD Application Team
bcostm 6:e1d9da7fe856 5 * @brief This file contains all the functions prototypes for the
bcostm 6:e1d9da7fe856 6 * wm8994.c driver.
bcostm 6:e1d9da7fe856 7 ******************************************************************************
bcostm 6:e1d9da7fe856 8 * @attention
bcostm 6:e1d9da7fe856 9 *
bcostm 6:e1d9da7fe856 10 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
bcostm 6:e1d9da7fe856 11 *
bcostm 6:e1d9da7fe856 12 * Redistribution and use in source and binary forms, with or without modification,
bcostm 6:e1d9da7fe856 13 * are permitted provided that the following conditions are met:
bcostm 6:e1d9da7fe856 14 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 6:e1d9da7fe856 15 * this list of conditions and the following disclaimer.
bcostm 6:e1d9da7fe856 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 6:e1d9da7fe856 17 * this list of conditions and the following disclaimer in the documentation
bcostm 6:e1d9da7fe856 18 * and/or other materials provided with the distribution.
bcostm 6:e1d9da7fe856 19 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 6:e1d9da7fe856 20 * may be used to endorse or promote products derived from this software
bcostm 6:e1d9da7fe856 21 * without specific prior written permission.
bcostm 6:e1d9da7fe856 22 *
bcostm 6:e1d9da7fe856 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 6:e1d9da7fe856 24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 6:e1d9da7fe856 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 6:e1d9da7fe856 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 6:e1d9da7fe856 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 6:e1d9da7fe856 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 6:e1d9da7fe856 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 6:e1d9da7fe856 30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 6:e1d9da7fe856 31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 6:e1d9da7fe856 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 6:e1d9da7fe856 33 *
bcostm 6:e1d9da7fe856 34 ******************************************************************************
bcostm 6:e1d9da7fe856 35 */
bcostm 6:e1d9da7fe856 36
bcostm 6:e1d9da7fe856 37 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 6:e1d9da7fe856 38 #ifndef __WM8994_H
bcostm 6:e1d9da7fe856 39 #define __WM8994_H
bcostm 6:e1d9da7fe856 40
bcostm 6:e1d9da7fe856 41 /* Includes ------------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 42 #include "../Common/audio.h"
bcostm 6:e1d9da7fe856 43
bcostm 6:e1d9da7fe856 44 /** @addtogroup BSP
bcostm 6:e1d9da7fe856 45 * @{
bcostm 6:e1d9da7fe856 46 */
bcostm 6:e1d9da7fe856 47
bcostm 6:e1d9da7fe856 48 /** @addtogroup Component
bcostm 6:e1d9da7fe856 49 * @{
bcostm 6:e1d9da7fe856 50 */
bcostm 6:e1d9da7fe856 51
bcostm 6:e1d9da7fe856 52 /** @addtogroup WM8994
bcostm 6:e1d9da7fe856 53 * @{
bcostm 6:e1d9da7fe856 54 */
bcostm 6:e1d9da7fe856 55
bcostm 6:e1d9da7fe856 56 /** @defgroup WM8994_Exported_Types
bcostm 6:e1d9da7fe856 57 * @{
bcostm 6:e1d9da7fe856 58 */
bcostm 6:e1d9da7fe856 59
bcostm 6:e1d9da7fe856 60 /**
bcostm 6:e1d9da7fe856 61 * @}
bcostm 6:e1d9da7fe856 62 */
bcostm 6:e1d9da7fe856 63
bcostm 6:e1d9da7fe856 64 /** @defgroup WM8994_Exported_Constants
bcostm 6:e1d9da7fe856 65 * @{
bcostm 6:e1d9da7fe856 66 */
bcostm 6:e1d9da7fe856 67
bcostm 6:e1d9da7fe856 68 /******************************************************************************/
bcostm 6:e1d9da7fe856 69 /*************************** Codec User defines ******************************/
bcostm 6:e1d9da7fe856 70 /******************************************************************************/
bcostm 6:e1d9da7fe856 71 /* Codec output DEVICE */
bcostm 6:e1d9da7fe856 72 #define OUTPUT_DEVICE_SPEAKER ((uint16_t)0x0001)
bcostm 6:e1d9da7fe856 73 #define OUTPUT_DEVICE_HEADPHONE ((uint16_t)0x0002)
bcostm 6:e1d9da7fe856 74 #define OUTPUT_DEVICE_BOTH ((uint16_t)0x0003)
bcostm 6:e1d9da7fe856 75 #define OUTPUT_DEVICE_AUTO ((uint16_t)0x0004)
bcostm 6:e1d9da7fe856 76 #define INPUT_DEVICE_DIGITAL_MICROPHONE_1 ((uint16_t)0x0100)
bcostm 6:e1d9da7fe856 77 #define INPUT_DEVICE_DIGITAL_MICROPHONE_2 ((uint16_t)0x0200)
bcostm 6:e1d9da7fe856 78 #define INPUT_DEVICE_INPUT_LINE_1 ((uint16_t)0x0300)
bcostm 6:e1d9da7fe856 79 #define INPUT_DEVICE_INPUT_LINE_2 ((uint16_t)0x0400)
bcostm 6:e1d9da7fe856 80 #define INPUT_DEVICE_DIGITAL_MIC1_MIC2 ((uint16_t)0x0800)
bcostm 6:e1d9da7fe856 81
bcostm 6:e1d9da7fe856 82 /* Volume Levels values */
bcostm 6:e1d9da7fe856 83 #define DEFAULT_VOLMIN 0x00
bcostm 6:e1d9da7fe856 84 #define DEFAULT_VOLMAX 0xFF
bcostm 6:e1d9da7fe856 85 #define DEFAULT_VOLSTEP 0x04
bcostm 6:e1d9da7fe856 86
bcostm 6:e1d9da7fe856 87 #define AUDIO_PAUSE 0
bcostm 6:e1d9da7fe856 88 #define AUDIO_RESUME 1
bcostm 6:e1d9da7fe856 89
bcostm 6:e1d9da7fe856 90 /* Codec POWER DOWN modes */
bcostm 6:e1d9da7fe856 91 #define CODEC_PDWN_HW 1
bcostm 6:e1d9da7fe856 92 #define CODEC_PDWN_SW 2
bcostm 6:e1d9da7fe856 93
bcostm 6:e1d9da7fe856 94 /* MUTE commands */
bcostm 6:e1d9da7fe856 95 #define AUDIO_MUTE_ON 1
bcostm 6:e1d9da7fe856 96 #define AUDIO_MUTE_OFF 0
bcostm 6:e1d9da7fe856 97
bcostm 6:e1d9da7fe856 98 /* AUDIO FREQUENCY */
bcostm 6:e1d9da7fe856 99 #define AUDIO_FREQUENCY_192K ((uint32_t)192000)
bcostm 6:e1d9da7fe856 100 #define AUDIO_FREQUENCY_96K ((uint32_t)96000)
bcostm 6:e1d9da7fe856 101 #define AUDIO_FREQUENCY_48K ((uint32_t)48000)
bcostm 6:e1d9da7fe856 102 #define AUDIO_FREQUENCY_44K ((uint32_t)44100)
bcostm 6:e1d9da7fe856 103 #define AUDIO_FREQUENCY_32K ((uint32_t)32000)
bcostm 6:e1d9da7fe856 104 #define AUDIO_FREQUENCY_22K ((uint32_t)22050)
bcostm 6:e1d9da7fe856 105 #define AUDIO_FREQUENCY_16K ((uint32_t)16000)
bcostm 6:e1d9da7fe856 106 #define AUDIO_FREQUENCY_11K ((uint32_t)11025)
bcostm 6:e1d9da7fe856 107 #define AUDIO_FREQUENCY_8K ((uint32_t)8000)
bcostm 6:e1d9da7fe856 108
bcostm 6:e1d9da7fe856 109 #define VOLUME_CONVERT(Volume) (((Volume) > 100)? 100:((uint8_t)(((Volume) * 63) / 100)))
bcostm 6:e1d9da7fe856 110 #define VOLUME_IN_CONVERT(Volume) (((Volume) >= 100)? 239:((uint8_t)(((Volume) * 240) / 100)))
bcostm 6:e1d9da7fe856 111
bcostm 6:e1d9da7fe856 112 /******************************************************************************/
bcostm 6:e1d9da7fe856 113 /****************************** REGISTER MAPPING ******************************/
bcostm 6:e1d9da7fe856 114 /******************************************************************************/
bcostm 6:e1d9da7fe856 115 /**
bcostm 6:e1d9da7fe856 116 * @brief WM8994 ID
bcostm 6:e1d9da7fe856 117 */
bcostm 6:e1d9da7fe856 118 #define WM8994_ID 0x8994
bcostm 6:e1d9da7fe856 119
bcostm 6:e1d9da7fe856 120 /**
bcostm 6:e1d9da7fe856 121 * @brief Device ID Register: Reading from this register will indicate device
bcostm 6:e1d9da7fe856 122 * family ID 8994h
bcostm 6:e1d9da7fe856 123 */
bcostm 6:e1d9da7fe856 124 #define WM8994_CHIPID_ADDR 0x00
bcostm 6:e1d9da7fe856 125
bcostm 6:e1d9da7fe856 126 /**
bcostm 6:e1d9da7fe856 127 * @}
bcostm 6:e1d9da7fe856 128 */
bcostm 6:e1d9da7fe856 129
bcostm 6:e1d9da7fe856 130 /** @defgroup WM8994_Exported_Macros
bcostm 6:e1d9da7fe856 131 * @{
bcostm 6:e1d9da7fe856 132 */
bcostm 6:e1d9da7fe856 133 /**
bcostm 6:e1d9da7fe856 134 * @}
bcostm 6:e1d9da7fe856 135 */
bcostm 6:e1d9da7fe856 136
bcostm 6:e1d9da7fe856 137 /** @defgroup WM8994_Exported_Functions
bcostm 6:e1d9da7fe856 138 * @{
bcostm 6:e1d9da7fe856 139 */
bcostm 6:e1d9da7fe856 140
bcostm 6:e1d9da7fe856 141 /*------------------------------------------------------------------------------
bcostm 6:e1d9da7fe856 142 Audio Codec functions
bcostm 6:e1d9da7fe856 143 ------------------------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 144 /* High Layer codec functions */
bcostm 6:e1d9da7fe856 145 uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq);
bcostm 6:e1d9da7fe856 146 void wm8994_DeInit(void);
bcostm 6:e1d9da7fe856 147 uint32_t wm8994_ReadID(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 148 uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
bcostm 6:e1d9da7fe856 149 uint32_t wm8994_Pause(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 150 uint32_t wm8994_Resume(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 151 uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t Cmd);
bcostm 6:e1d9da7fe856 152 uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume);
bcostm 6:e1d9da7fe856 153 uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
bcostm 6:e1d9da7fe856 154 uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
bcostm 6:e1d9da7fe856 155 uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq);
bcostm 6:e1d9da7fe856 156 uint32_t wm8994_Reset(uint16_t DeviceAddr);
bcostm 6:e1d9da7fe856 157
bcostm 6:e1d9da7fe856 158 /* AUDIO IO functions */
bcostm 6:e1d9da7fe856 159 void AUDIO_IO_Init(void);
bcostm 6:e1d9da7fe856 160 void AUDIO_IO_DeInit(void);
bcostm 6:e1d9da7fe856 161 void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
bcostm 6:e1d9da7fe856 162 uint8_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg);
bcostm 6:e1d9da7fe856 163 void AUDIO_IO_Delay(uint32_t Delay);
bcostm 6:e1d9da7fe856 164
bcostm 6:e1d9da7fe856 165 /* Audio driver structure */
bcostm 6:e1d9da7fe856 166 extern AUDIO_DrvTypeDef wm8994_drv;
bcostm 6:e1d9da7fe856 167
bcostm 6:e1d9da7fe856 168 #endif /* __WM8994_H */
bcostm 6:e1d9da7fe856 169
bcostm 6:e1d9da7fe856 170 /**
bcostm 6:e1d9da7fe856 171 * @}
bcostm 6:e1d9da7fe856 172 */
bcostm 6:e1d9da7fe856 173
bcostm 6:e1d9da7fe856 174 /**
bcostm 6:e1d9da7fe856 175 * @}
bcostm 6:e1d9da7fe856 176 */
bcostm 6:e1d9da7fe856 177
bcostm 6:e1d9da7fe856 178 /**
bcostm 6:e1d9da7fe856 179 * @}
bcostm 6:e1d9da7fe856 180 */
bcostm 6:e1d9da7fe856 181
bcostm 6:e1d9da7fe856 182 /**
bcostm 6:e1d9da7fe856 183 * @}
bcostm 6:e1d9da7fe856 184 */
bcostm 6:e1d9da7fe856 185
bcostm 6:e1d9da7fe856 186 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/