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