AudioRecord
Dependencies: STM32L4xx_HAL_Driver CMSIS_DSP_401
main.h@3:ec7e3c37fe80, 2015-11-26 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:d4e5ad7ad71c | 1 | /** |
EricLew | 0:d4e5ad7ad71c | 2 | ****************************************************************************** |
EricLew | 0:d4e5ad7ad71c | 3 | * @file BSP/Inc/main.h |
EricLew | 0:d4e5ad7ad71c | 4 | * @author MCD Application Team |
EricLew | 0:d4e5ad7ad71c | 5 | * @version V1.1.0 |
EricLew | 0:d4e5ad7ad71c | 6 | * @date 16-September-2015 |
EricLew | 0:d4e5ad7ad71c | 7 | * @brief Header for main.c module |
EricLew | 0:d4e5ad7ad71c | 8 | ****************************************************************************** |
EricLew | 0:d4e5ad7ad71c | 9 | * @attention |
EricLew | 0:d4e5ad7ad71c | 10 | * |
EricLew | 0:d4e5ad7ad71c | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
EricLew | 0:d4e5ad7ad71c | 12 | * |
EricLew | 0:d4e5ad7ad71c | 13 | * Redistribution and use in source and binary forms, with or without modification, |
EricLew | 0:d4e5ad7ad71c | 14 | * are permitted provided that the following conditions are met: |
EricLew | 0:d4e5ad7ad71c | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
EricLew | 0:d4e5ad7ad71c | 16 | * this list of conditions and the following disclaimer. |
EricLew | 0:d4e5ad7ad71c | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
EricLew | 0:d4e5ad7ad71c | 18 | * this list of conditions and the following disclaimer in the documentation |
EricLew | 0:d4e5ad7ad71c | 19 | * and/or other materials provided with the distribution. |
EricLew | 0:d4e5ad7ad71c | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
EricLew | 0:d4e5ad7ad71c | 21 | * may be used to endorse or promote products derived from this software |
EricLew | 0:d4e5ad7ad71c | 22 | * without specific prior written permission. |
EricLew | 0:d4e5ad7ad71c | 23 | * |
EricLew | 0:d4e5ad7ad71c | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
EricLew | 0:d4e5ad7ad71c | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
EricLew | 0:d4e5ad7ad71c | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
EricLew | 0:d4e5ad7ad71c | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
EricLew | 0:d4e5ad7ad71c | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
EricLew | 0:d4e5ad7ad71c | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
EricLew | 0:d4e5ad7ad71c | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EricLew | 0:d4e5ad7ad71c | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EricLew | 0:d4e5ad7ad71c | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EricLew | 0:d4e5ad7ad71c | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EricLew | 0:d4e5ad7ad71c | 34 | * |
EricLew | 0:d4e5ad7ad71c | 35 | ****************************************************************************** |
EricLew | 0:d4e5ad7ad71c | 36 | */ |
EricLew | 0:d4e5ad7ad71c | 37 | |
EricLew | 0:d4e5ad7ad71c | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 39 | #ifndef __MAIN_H |
EricLew | 0:d4e5ad7ad71c | 40 | #define __MAIN_H |
EricLew | 0:d4e5ad7ad71c | 41 | |
EricLew | 0:d4e5ad7ad71c | 42 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 43 | #include "stdio.h" |
EricLew | 0:d4e5ad7ad71c | 44 | #include "string.h" |
EricLew | 0:d4e5ad7ad71c | 45 | #include "stm32l4xx_hal.h" |
EricLew | 0:d4e5ad7ad71c | 46 | #include "stm32l476g_discovery.h" |
EricLew | 0:d4e5ad7ad71c | 47 | |
EricLew | 0:d4e5ad7ad71c | 48 | |
EricLew | 0:d4e5ad7ad71c | 49 | #include "stm32l476g_discovery_glass_lcd.h" |
EricLew | 0:d4e5ad7ad71c | 50 | #include "stm32l476g_discovery_audio.h" |
EricLew | 0:d4e5ad7ad71c | 51 | #include "stm32l476g_discovery_qspi.h" |
EricLew | 0:d4e5ad7ad71c | 52 | |
EricLew | 0:d4e5ad7ad71c | 53 | /* Exported constants --------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 54 | #define DEMO_NAME_CHAR_NB 20 |
EricLew | 0:d4e5ad7ad71c | 55 | |
EricLew | 0:d4e5ad7ad71c | 56 | /* Defines for the Audio playing process */ |
EricLew | 0:d4e5ad7ad71c | 57 | #define PAUSE_STATUS ((uint32_t)0x00) /* Audio Player in Pause Status */ |
EricLew | 0:d4e5ad7ad71c | 58 | #define RESUME_STATUS ((uint32_t)0x01) /* Audio Player in Resume Status */ |
EricLew | 0:d4e5ad7ad71c | 59 | #define IDLE_STATUS ((uint32_t)0x02) /* Audio Player in Idle Status */ |
EricLew | 0:d4e5ad7ad71c | 60 | |
EricLew | 0:d4e5ad7ad71c | 61 | /* Exported types ------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 62 | typedef enum |
EricLew | 0:d4e5ad7ad71c | 63 | { |
EricLew | 0:d4e5ad7ad71c | 64 | IDD_RUN = 0x00, |
EricLew | 0:d4e5ad7ad71c | 65 | IDD_SLEEP = 0x01, |
EricLew | 0:d4e5ad7ad71c | 66 | IDD_LPR_2MHZ = 0x02, |
EricLew | 0:d4e5ad7ad71c | 67 | IDD_LPR_SLEEP = 0x03, |
EricLew | 0:d4e5ad7ad71c | 68 | IDD_STOP2 = 0x04, |
EricLew | 0:d4e5ad7ad71c | 69 | IDD_STANDBY = 0x05, |
EricLew | 0:d4e5ad7ad71c | 70 | IDD_SHUTDOWN = 0x06, |
EricLew | 0:d4e5ad7ad71c | 71 | IDD_TEST_NB = 0x07, |
EricLew | 0:d4e5ad7ad71c | 72 | } Idd_StateTypeDef; |
EricLew | 0:d4e5ad7ad71c | 73 | |
EricLew | 0:d4e5ad7ad71c | 74 | typedef struct |
EricLew | 0:d4e5ad7ad71c | 75 | { |
EricLew | 0:d4e5ad7ad71c | 76 | void (*DemoFunc)(void); |
EricLew | 0:d4e5ad7ad71c | 77 | uint8_t DemoName[DEMO_NAME_CHAR_NB]; |
EricLew | 0:d4e5ad7ad71c | 78 | uint32_t DemoIndex; |
EricLew | 0:d4e5ad7ad71c | 79 | }BSP_DemoTypedef; |
EricLew | 0:d4e5ad7ad71c | 80 | |
EricLew | 0:d4e5ad7ad71c | 81 | typedef enum { |
EricLew | 0:d4e5ad7ad71c | 82 | AUDIO_DEMO_NONE = 0, |
EricLew | 0:d4e5ad7ad71c | 83 | AUDIO_DEMO_PLAYBACK, |
EricLew | 0:d4e5ad7ad71c | 84 | AUDIO_DEMO_RECORD |
EricLew | 0:d4e5ad7ad71c | 85 | } Audio_DemoTypeDef; |
EricLew | 0:d4e5ad7ad71c | 86 | |
EricLew | 0:d4e5ad7ad71c | 87 | /* Exported variables --------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 88 | /* Variable indicating which audio demo is currently running (playback v.s. record) */ |
EricLew | 0:d4e5ad7ad71c | 89 | extern Audio_DemoTypeDef AudioDemo; |
EricLew | 0:d4e5ad7ad71c | 90 | |
EricLew | 0:d4e5ad7ad71c | 91 | /* Flag indicating that audio playback must be paused or resumed */ |
EricLew | 0:d4e5ad7ad71c | 92 | extern __IO uint32_t PauseResumeStatus; |
EricLew | 0:d4e5ad7ad71c | 93 | |
EricLew | 0:d4e5ad7ad71c | 94 | /* Flag indicating that audio playback must be exited */ |
EricLew | 0:d4e5ad7ad71c | 95 | extern __IO uint8_t AudioPlaybackExit; |
EricLew | 0:d4e5ad7ad71c | 96 | |
EricLew | 0:d4e5ad7ad71c | 97 | /* Flag indicating that audio playback volume level must be changed */ |
EricLew | 0:d4e5ad7ad71c | 98 | extern __IO uint8_t VolumeChange; |
EricLew | 0:d4e5ad7ad71c | 99 | |
EricLew | 0:d4e5ad7ad71c | 100 | /* Actual audio playback volume level */ |
EricLew | 0:d4e5ad7ad71c | 101 | extern __IO uint8_t Volume; |
EricLew | 0:d4e5ad7ad71c | 102 | |
EricLew | 0:d4e5ad7ad71c | 103 | /* Flag indicating that audio record must be exited */ |
EricLew | 0:d4e5ad7ad71c | 104 | extern __IO uint8_t AudioRecordExit; |
EricLew | 0:d4e5ad7ad71c | 105 | |
EricLew | 0:d4e5ad7ad71c | 106 | /* Flag indicating that record sample rate has been selected */ |
EricLew | 0:d4e5ad7ad71c | 107 | extern __IO uint8_t AudioRecordSampleRateSelected; |
EricLew | 0:d4e5ad7ad71c | 108 | |
EricLew | 0:d4e5ad7ad71c | 109 | /* Flag indicating that record sample rate must be changed changed */ |
EricLew | 0:d4e5ad7ad71c | 110 | extern __IO uint8_t AudioRecordSampleRateChange; |
EricLew | 0:d4e5ad7ad71c | 111 | |
EricLew | 0:d4e5ad7ad71c | 112 | /* Index within SamplesRates[] */ |
EricLew | 0:d4e5ad7ad71c | 113 | extern __IO uint8_t SampleRateIndex; |
EricLew | 0:d4e5ad7ad71c | 114 | |
EricLew | 0:d4e5ad7ad71c | 115 | /* Exported macro ------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 116 | #define COUNT_OF_EXAMPLE(x) (sizeof(x)/sizeof(BSP_DemoTypedef)) |
EricLew | 0:d4e5ad7ad71c | 117 | #define ABS(x) (x < 0) ? (-x) : x |
EricLew | 0:d4e5ad7ad71c | 118 | |
EricLew | 0:d4e5ad7ad71c | 119 | /* Exported functions ------------------------------------------------------- */ |
EricLew | 0:d4e5ad7ad71c | 120 | void AudioPlay_demo(void); |
EricLew | 0:d4e5ad7ad71c | 121 | void AudioRecord_demo(void); |
EricLew | 0:d4e5ad7ad71c | 122 | void Idd_demo(void); |
EricLew | 0:d4e5ad7ad71c | 123 | void Gyro_demo(void); |
EricLew | 0:d4e5ad7ad71c | 124 | void Joystick_demo (void); |
EricLew | 0:d4e5ad7ad71c | 125 | void LCDGlass_demo(void); |
EricLew | 0:d4e5ad7ad71c | 126 | void Led_demo(void); |
EricLew | 0:d4e5ad7ad71c | 127 | void QSPI_demo(void); |
EricLew | 0:d4e5ad7ad71c | 128 | uint8_t CheckForUserInput(void); |
EricLew | 0:d4e5ad7ad71c | 129 | void SystemClock_Config(void); |
EricLew | 0:d4e5ad7ad71c | 130 | void SystemLowClock_Config(void); |
EricLew | 0:d4e5ad7ad71c | 131 | void SystemHardwareInit(void); |
EricLew | 0:d4e5ad7ad71c | 132 | void SystemHardwareDeInit(void); |
EricLew | 0:d4e5ad7ad71c | 133 | uint32_t SystemRtcBackupRead(void); |
EricLew | 0:d4e5ad7ad71c | 134 | void SystemRtcBackupWrite(uint32_t SaveIndex); |
EricLew | 0:d4e5ad7ad71c | 135 | void fibonacci_flash(int n); |
EricLew | 0:d4e5ad7ad71c | 136 | |
EricLew | 0:d4e5ad7ad71c | 137 | void Error_Handler(void); |
EricLew | 0:d4e5ad7ad71c | 138 | void Convert_IntegerIntoChar(uint32_t number, uint16_t *p_tab); |
EricLew | 0:d4e5ad7ad71c | 139 | |
EricLew | 0:d4e5ad7ad71c | 140 | #endif /* __MAIN_H */ |
EricLew | 0:d4e5ad7ad71c | 141 | |
EricLew | 0:d4e5ad7ad71c | 142 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:d4e5ad7ad71c | 143 |