AudioRecord

Dependencies:   STM32L4xx_HAL_Driver CMSIS_DSP_401

Committer:
EricLew
Date:
Thu Nov 26 22:32:56 2015 +0000
Revision:
3:ec7e3c37fe80
Parent:
0:d4e5ad7ad71c
FFT is currently not working and commented out

Who changed what in which revision?

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