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

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?

UserRevisionLine numberNew contents of line
EricLew 0:3eee9435dd17 1 /**
EricLew 0:3eee9435dd17 2 ******************************************************************************
EricLew 0:3eee9435dd17 3 * @file stm32l4xx.h
EricLew 0:3eee9435dd17 4 * @author MCD Application Team
EricLew 0:3eee9435dd17 5 * @version V1.0.1
EricLew 0:3eee9435dd17 6 * @date 16-September-2015
EricLew 0:3eee9435dd17 7 * @brief CMSIS STM32L4xx Device Peripheral Access Layer Header File.
EricLew 0:3eee9435dd17 8 *
EricLew 0:3eee9435dd17 9 * The file is the unique include file that the application programmer
EricLew 0:3eee9435dd17 10 * is using in the C source code, usually in main.c. This file contains:
EricLew 0:3eee9435dd17 11 * - Configuration section that allows to select:
EricLew 0:3eee9435dd17 12 * - The STM32L4xx device used in the target application
EricLew 0:3eee9435dd17 13 * - To use or not the peripheral�s drivers in application code(i.e.
EricLew 0:3eee9435dd17 14 * code will be based on direct access to peripheral�s registers
EricLew 0:3eee9435dd17 15 * rather than drivers API), this option is controlled by
EricLew 0:3eee9435dd17 16 * "#define USE_HAL_DRIVER"
EricLew 0:3eee9435dd17 17 *
EricLew 0:3eee9435dd17 18 ******************************************************************************
EricLew 0:3eee9435dd17 19 * @attention
EricLew 0:3eee9435dd17 20 *
EricLew 0:3eee9435dd17 21 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
EricLew 0:3eee9435dd17 22 *
EricLew 0:3eee9435dd17 23 * Redistribution and use in source and binary forms, with or without modification,
EricLew 0:3eee9435dd17 24 * are permitted provided that the following conditions are met:
EricLew 0:3eee9435dd17 25 * 1. Redistributions of source code must retain the above copyright notice,
EricLew 0:3eee9435dd17 26 * this list of conditions and the following disclaimer.
EricLew 0:3eee9435dd17 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
EricLew 0:3eee9435dd17 28 * this list of conditions and the following disclaimer in the documentation
EricLew 0:3eee9435dd17 29 * and/or other materials provided with the distribution.
EricLew 0:3eee9435dd17 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
EricLew 0:3eee9435dd17 31 * may be used to endorse or promote products derived from this software
EricLew 0:3eee9435dd17 32 * without specific prior written permission.
EricLew 0:3eee9435dd17 33 *
EricLew 0:3eee9435dd17 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
EricLew 0:3eee9435dd17 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
EricLew 0:3eee9435dd17 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
EricLew 0:3eee9435dd17 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
EricLew 0:3eee9435dd17 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
EricLew 0:3eee9435dd17 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
EricLew 0:3eee9435dd17 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
EricLew 0:3eee9435dd17 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
EricLew 0:3eee9435dd17 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
EricLew 0:3eee9435dd17 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EricLew 0:3eee9435dd17 44 *
EricLew 0:3eee9435dd17 45 ******************************************************************************
EricLew 0:3eee9435dd17 46 */
EricLew 0:3eee9435dd17 47
EricLew 0:3eee9435dd17 48 /** @addtogroup CMSIS
EricLew 0:3eee9435dd17 49 * @{
EricLew 0:3eee9435dd17 50 */
EricLew 0:3eee9435dd17 51
EricLew 0:3eee9435dd17 52 /** @addtogroup stm32l4xx
EricLew 0:3eee9435dd17 53 * @{
EricLew 0:3eee9435dd17 54 */
EricLew 0:3eee9435dd17 55
EricLew 0:3eee9435dd17 56 #ifndef __STM32L4xx_H
EricLew 0:3eee9435dd17 57 #define __STM32L4xx_H
EricLew 0:3eee9435dd17 58
EricLew 0:3eee9435dd17 59 #ifdef __cplusplus
EricLew 0:3eee9435dd17 60 extern "C" {
EricLew 0:3eee9435dd17 61 #endif /* __cplusplus */
EricLew 0:3eee9435dd17 62
EricLew 0:3eee9435dd17 63 /** @addtogroup Library_configuration_section
EricLew 0:3eee9435dd17 64 * @{
EricLew 0:3eee9435dd17 65 */
EricLew 0:3eee9435dd17 66
EricLew 0:3eee9435dd17 67 /**
EricLew 0:3eee9435dd17 68 * @brief STM32 Family
EricLew 0:3eee9435dd17 69 */
EricLew 0:3eee9435dd17 70 #if !defined (STM32L4)
EricLew 0:3eee9435dd17 71 #define STM32L4
EricLew 0:3eee9435dd17 72 #endif /* STM32L4 */
EricLew 0:3eee9435dd17 73
EricLew 0:3eee9435dd17 74 /* Uncomment the line below according to the target STM32L4 device used in your
EricLew 0:3eee9435dd17 75 application
EricLew 0:3eee9435dd17 76 */
EricLew 0:3eee9435dd17 77
EricLew 0:3eee9435dd17 78 #if !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx)
EricLew 0:3eee9435dd17 79 /* #define STM32L471xx */ /*!< STM32L471xx Devices */
EricLew 0:3eee9435dd17 80 /* #define STM32L475xx */ /*!< STM32L475xx Devices */
EricLew 0:3eee9435dd17 81 #define STM32L476xx !< STM32L476xx Devices
EricLew 0:3eee9435dd17 82 /* #define STM32L485xx */ /*!< STM32L485xx Devices */
EricLew 0:3eee9435dd17 83 /* #define STM32L486xx */ /*!< STM32L486xx Devices */
EricLew 0:3eee9435dd17 84 #endif
EricLew 0:3eee9435dd17 85
EricLew 0:3eee9435dd17 86 /* Tip: To avoid modifying this file each time you need to switch between these
EricLew 0:3eee9435dd17 87 devices, you can define the device in your toolchain compiler preprocessor.
EricLew 0:3eee9435dd17 88 */
EricLew 0:3eee9435dd17 89 #if !defined (USE_HAL_DRIVER)
EricLew 0:3eee9435dd17 90 /**
EricLew 0:3eee9435dd17 91 * @brief Comment the line below if you will not use the peripherals drivers.
EricLew 0:3eee9435dd17 92 In this case, these drivers will not be included and the application code will
EricLew 0:3eee9435dd17 93 be based on direct access to peripherals registers
EricLew 0:3eee9435dd17 94 */
EricLew 0:3eee9435dd17 95 /*#define USE_HAL_DRIVER */
EricLew 0:3eee9435dd17 96 #endif /* USE_HAL_DRIVER */
EricLew 0:3eee9435dd17 97
EricLew 0:3eee9435dd17 98 /**
EricLew 0:3eee9435dd17 99 * @brief CMSIS Device version number V1.0.1
EricLew 0:3eee9435dd17 100 */
EricLew 0:3eee9435dd17 101 #define __STM32L4xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
EricLew 0:3eee9435dd17 102 #define __STM32L4xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
EricLew 0:3eee9435dd17 103 #define __STM32L4xx_CMSIS_DEVICE_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
EricLew 0:3eee9435dd17 104 #define __STM32L4xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
EricLew 0:3eee9435dd17 105 #define __STM32L4xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
EricLew 0:3eee9435dd17 106 |(__CMSIS_DEVICE_VERSION_SUB1 << 16)\
EricLew 0:3eee9435dd17 107 |(__CMSIS_DEVICE_VERSION_SUB2 << 8 )\
EricLew 0:3eee9435dd17 108 |(__CMSIS_DEVICE_VERSION_RC))
EricLew 0:3eee9435dd17 109
EricLew 0:3eee9435dd17 110 /**
EricLew 0:3eee9435dd17 111 * @}
EricLew 0:3eee9435dd17 112 */
EricLew 0:3eee9435dd17 113
EricLew 0:3eee9435dd17 114 /** @addtogroup Device_Included
EricLew 0:3eee9435dd17 115 * @{
EricLew 0:3eee9435dd17 116 */
EricLew 0:3eee9435dd17 117
EricLew 0:3eee9435dd17 118 #if defined(STM32L471xx)
EricLew 0:3eee9435dd17 119 #include "stm32l471xx.h"
EricLew 0:3eee9435dd17 120 #elif defined(STM32L475xx)
EricLew 0:3eee9435dd17 121 #include "stm32l475xx.h"
EricLew 0:3eee9435dd17 122 #elif defined(STM32L476xx)
EricLew 0:3eee9435dd17 123 #include "stm32l476xx.h"
EricLew 0:3eee9435dd17 124 #elif defined(STM32L485xx)
EricLew 0:3eee9435dd17 125 #include "stm32l485xx.h"
EricLew 0:3eee9435dd17 126 #elif defined(STM32L486xx)
EricLew 0:3eee9435dd17 127 #include "stm32l486xx.h"
EricLew 0:3eee9435dd17 128 #else
EricLew 0:3eee9435dd17 129 #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)"
EricLew 0:3eee9435dd17 130 #endif
EricLew 0:3eee9435dd17 131
EricLew 0:3eee9435dd17 132 /**
EricLew 0:3eee9435dd17 133 * @}
EricLew 0:3eee9435dd17 134 */
EricLew 0:3eee9435dd17 135
EricLew 0:3eee9435dd17 136 /** @addtogroup Exported_types
EricLew 0:3eee9435dd17 137 * @{
EricLew 0:3eee9435dd17 138 */
EricLew 0:3eee9435dd17 139 typedef enum
EricLew 0:3eee9435dd17 140 {
EricLew 0:3eee9435dd17 141 RESET = 0,
EricLew 0:3eee9435dd17 142 SET = !RESET
EricLew 0:3eee9435dd17 143 } FlagStatus, ITStatus;
EricLew 0:3eee9435dd17 144
EricLew 0:3eee9435dd17 145 typedef enum
EricLew 0:3eee9435dd17 146 {
EricLew 0:3eee9435dd17 147 DISABLE = 0,
EricLew 0:3eee9435dd17 148 ENABLE = !DISABLE
EricLew 0:3eee9435dd17 149 } FunctionalState;
EricLew 0:3eee9435dd17 150 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
EricLew 0:3eee9435dd17 151
EricLew 0:3eee9435dd17 152 typedef enum
EricLew 0:3eee9435dd17 153 {
EricLew 0:3eee9435dd17 154 ERROR = 0,
EricLew 0:3eee9435dd17 155 SUCCESS = !ERROR
EricLew 0:3eee9435dd17 156 } ErrorStatus;
EricLew 0:3eee9435dd17 157
EricLew 0:3eee9435dd17 158 /**
EricLew 0:3eee9435dd17 159 * @}
EricLew 0:3eee9435dd17 160 */
EricLew 0:3eee9435dd17 161
EricLew 0:3eee9435dd17 162
EricLew 0:3eee9435dd17 163 /** @addtogroup Exported_macros
EricLew 0:3eee9435dd17 164 * @{
EricLew 0:3eee9435dd17 165 */
EricLew 0:3eee9435dd17 166 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
EricLew 0:3eee9435dd17 167
EricLew 0:3eee9435dd17 168 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
EricLew 0:3eee9435dd17 169
EricLew 0:3eee9435dd17 170 #define READ_BIT(REG, BIT) ((REG) & (BIT))
EricLew 0:3eee9435dd17 171
EricLew 0:3eee9435dd17 172 #define CLEAR_REG(REG) ((REG) = (0x0))
EricLew 0:3eee9435dd17 173
EricLew 0:3eee9435dd17 174 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
EricLew 0:3eee9435dd17 175
EricLew 0:3eee9435dd17 176 #define READ_REG(REG) ((REG))
EricLew 0:3eee9435dd17 177
EricLew 0:3eee9435dd17 178 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
EricLew 0:3eee9435dd17 179
EricLew 0:3eee9435dd17 180 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
EricLew 0:3eee9435dd17 181
EricLew 0:3eee9435dd17 182
EricLew 0:3eee9435dd17 183 /**
EricLew 0:3eee9435dd17 184 * @}
EricLew 0:3eee9435dd17 185 */
EricLew 0:3eee9435dd17 186
EricLew 0:3eee9435dd17 187 #if defined (USE_HAL_DRIVER)
EricLew 0:3eee9435dd17 188 #include "stm32l4xx_hal.h"
EricLew 0:3eee9435dd17 189 #endif /* USE_HAL_DRIVER */
EricLew 0:3eee9435dd17 190
EricLew 0:3eee9435dd17 191 #ifdef __cplusplus
EricLew 0:3eee9435dd17 192 }
EricLew 0:3eee9435dd17 193 #endif /* __cplusplus */
EricLew 0:3eee9435dd17 194
EricLew 0:3eee9435dd17 195 #endif /* __STM32L4xx_H */
EricLew 0:3eee9435dd17 196 /**
EricLew 0:3eee9435dd17 197 * @}
EricLew 0:3eee9435dd17 198 */
EricLew 0:3eee9435dd17 199
EricLew 0:3eee9435dd17 200 /**
EricLew 0:3eee9435dd17 201 * @}
EricLew 0:3eee9435dd17 202 */
EricLew 0:3eee9435dd17 203
EricLew 0:3eee9435dd17 204
EricLew 0:3eee9435dd17 205
EricLew 0:3eee9435dd17 206
EricLew 0:3eee9435dd17 207 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
EricLew 0:3eee9435dd17 208