
lab 1 code
Dependencies: CMSIS-DSP_for_STM32F746G BSP_DISCO_F746NG
main.cpp@13:61131aac4031, 2019-12-30 (annotated)
- Committer:
- bmazzeo
- Date:
- Mon Dec 30 17:27:57 2019 +0000
- Revision:
- 13:61131aac4031
- Parent:
- 12:e44766b61346
- Child:
- 14:18f159d48340
All code nicely organized - displays timing and traces.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bmazzeo | 9:f5b37c71856d | 1 | /** |
bmazzeo | 9:f5b37c71856d | 2 | ****************************************************************************** |
bmazzeo | 9:f5b37c71856d | 3 | * @file main.c |
bmazzeo | 9:f5b37c71856d | 4 | * @author Brian Mazzeo |
bmazzeo | 9:f5b37c71856d | 5 | * @brief This file provides a set of code for signal processing in 487. |
bmazzeo | 9:f5b37c71856d | 6 | * Parts are taken from example code from STMIcroelectronics |
bmazzeo | 9:f5b37c71856d | 7 | ****************************************************************************** |
bmazzeo | 9:f5b37c71856d | 8 | * @attention |
bmazzeo | 13:61131aac4031 | 9 | * This code was specifically developed for BYU ECEn 487 course |
bmazzeo | 13:61131aac4031 | 10 | * Introduction to Digital Signal Processing. |
bmazzeo | 9:f5b37c71856d | 11 | * |
bmazzeo | 9:f5b37c71856d | 12 | * |
bmazzeo | 9:f5b37c71856d | 13 | ****************************************************************************** |
bmazzeo | 9:f5b37c71856d | 14 | */ |
bmazzeo | 9:f5b37c71856d | 15 | |
bmazzeo | 9:f5b37c71856d | 16 | |
adustm | 0:da04816fb411 | 17 | #include "mbed.h" |
Jerome Coutant
5:66c230f74325
|
18
|
#include "stm32746g_discovery_audio.h"
|
|
Jerome Coutant
5:66c230f74325
|
19
|
#include "stm32746g_discovery_sdram.h"
|
|
bmazzeo | 6:e689075b04ed | 20 | #include "stm32746g_discovery_lcd.h" |
adustm | 0:da04816fb411 | 21 | |
Jerome Coutant
5:66c230f74325
|
22
|
typedef enum {
|
|
adustm | 0:da04816fb411 | 23 | BUFFER_OFFSET_NONE = 0, |
adustm | 0:da04816fb411 | 24 | BUFFER_OFFSET_HALF = 1, |
adustm | 0:da04816fb411 | 25 | BUFFER_OFFSET_FULL = 2, |
Jerome Coutant
5:66c230f74325
|
26
|
} BUFFER_StateTypeDef;
|
|
Jerome Coutant
5:66c230f74325
|
27
|
|
|
adustm | 0:da04816fb411 | 28 | |
bmazzeo | 12:e44766b61346 | 29 | #define HALF_AUDIO_BLOCK_SIZE ((uint32_t)128) // Number of samples @ Frequency |
bmazzeo | 12:e44766b61346 | 30 | #define AUDIO_BLOCK_SIZE ((uint32_t)256) |
bmazzeo | 6:e689075b04ed | 31 | |
bmazzeo | 9:f5b37c71856d | 32 | #define SDRAM_DEVICE_ADDR_AUDIO_MEM ((uint32_t)0xC0400000) |
bmazzeo | 9:f5b37c71856d | 33 | #define AUDIO_BUFFER_IN SDRAM_DEVICE_ADDR_AUDIO_MEM |
bmazzeo | 9:f5b37c71856d | 34 | #define AUDIO_BUFFER_OUT (AUDIO_BUFFER_IN + (AUDIO_BLOCK_SIZE * 2)) |
Jerome Coutant
5:66c230f74325
|
35
|
|
|
bmazzeo | 8:d1c41eca57f0 | 36 | #define OSC_START_X_POS 20 |
bmazzeo | 6:e689075b04ed | 37 | #define OSC_LINE_SIZE 256 |
bmazzeo | 6:e689075b04ed | 38 | #define L_CHANNEL_Y_POS 120 |
bmazzeo | 6:e689075b04ed | 39 | #define R_CHANNEL_Y_POS 220 |
bmazzeo | 7:e1dfd64eba81 | 40 | #define AUDIO_DRAW_LIMIT 30 |
bmazzeo | 6:e689075b04ed | 41 | |
bmazzeo | 9:f5b37c71856d | 42 | Timer timer; |
bmazzeo | 9:f5b37c71856d | 43 | |
Jerome Coutant
5:66c230f74325
|
44
|
volatile uint32_t audio_rec_buffer_state = BUFFER_OFFSET_NONE;
|
|
bmazzeo | 7:e1dfd64eba81 | 45 | static void Erase_Trace(uint16_t Xpos, uint16_t L_Ypos, uint16_t R_Ypos, uint16_t Length); |
bmazzeo | 8:d1c41eca57f0 | 46 | static void Draw_Trace(uint16_t Xpos, uint16_t L_Ypos, uint16_t R_Ypos, uint16_t* Mem_start, uint16_t Length); |
Jerome Coutant
5:66c230f74325
|
47
|
|
|
bmazzeo | 9:f5b37c71856d | 48 | uint32_t counter = 0; |
bmazzeo | 10:a82b64ea1d11 | 49 | char buf[40]; |
bmazzeo | 13:61131aac4031 | 50 | int first_half_time = 0; |
bmazzeo | 13:61131aac4031 | 51 | int second_half_time = 0; |
bmazzeo | 13:61131aac4031 | 52 | int total_time = 0; |
bmazzeo | 9:f5b37c71856d | 53 | |
adustm | 0:da04816fb411 | 54 | int main() |
adustm | 0:da04816fb411 | 55 | { |
bmazzeo | 13:61131aac4031 | 56 | /* Initialize the LCD Screen and display information */ |
bmazzeo | 6:e689075b04ed | 57 | BSP_LCD_Init(); |
bmazzeo | 6:e689075b04ed | 58 | BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); |
bmazzeo | 6:e689075b04ed | 59 | BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); |
bmazzeo | 6:e689075b04ed | 60 | |
bmazzeo | 6:e689075b04ed | 61 | BSP_LCD_Clear(LCD_COLOR_BLACK); |
bmazzeo | 6:e689075b04ed | 62 | BSP_LCD_SetFont(&LCD_DEFAULT_FONT); |
bmazzeo | 6:e689075b04ed | 63 | |
bmazzeo | 6:e689075b04ed | 64 | BSP_LCD_SetBackColor(LCD_COLOR_BLACK); |
bmazzeo | 6:e689075b04ed | 65 | BSP_LCD_SetTextColor(LCD_COLOR_ORANGE); |
bmazzeo | 7:e1dfd64eba81 | 66 | BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"487 Mic Audio Test Code", LEFT_MODE); |
bmazzeo | 8:d1c41eca57f0 | 67 | BSP_LCD_DisplayStringAt(0, L_CHANNEL_Y_POS, (uint8_t *)"L", LEFT_MODE); |
bmazzeo | 8:d1c41eca57f0 | 68 | BSP_LCD_DisplayStringAt(0, R_CHANNEL_Y_POS, (uint8_t *)"R", LEFT_MODE); |
bmazzeo | 6:e689075b04ed | 69 | |
bmazzeo | 13:61131aac4031 | 70 | |
bmazzeo | 13:61131aac4031 | 71 | /* Initialize the Audio Interface */ |
Jerome Coutant
5:66c230f74325
|
72
|
BSP_AUDIO_IN_OUT_Init(INPUT_DEVICE_DIGITAL_MICROPHONE_2, OUTPUT_DEVICE_HEADPHONE, DEFAULT_AUDIO_IN_FREQ, DEFAULT_AUDIO_IN_BIT_RESOLUTION, DEFAULT_AUDIO_IN_CHANNEL_NBR);
|
|
adustm | 0:da04816fb411 | 73 | |
adustm | 0:da04816fb411 | 74 | /* Initialize SDRAM buffers */ |
Jerome Coutant
5:66c230f74325
|
75
|
BSP_SDRAM_Init();
|
|
Jerome Coutant
5:66c230f74325
|
76
|
memset((uint16_t *)AUDIO_BUFFER_IN, 0, AUDIO_BLOCK_SIZE * 2);
|
|
Jerome Coutant
5:66c230f74325
|
77
|
memset((uint16_t *)AUDIO_BUFFER_OUT, 0, AUDIO_BLOCK_SIZE * 2);
|
|
Jerome Coutant
5:66c230f74325
|
78
|
|
|
adustm | 0:da04816fb411 | 79 | |
adustm | 0:da04816fb411 | 80 | /* Start Recording */ |
bmazzeo | 13:61131aac4031 | 81 | if (BSP_AUDIO_IN_Record((uint16_t *)AUDIO_BUFFER_IN, AUDIO_BLOCK_SIZE) != AUDIO_OK) { printf("BSP_AUDIO_IN_Record error\n"); } |
adustm | 0:da04816fb411 | 82 | |
adustm | 0:da04816fb411 | 83 | /* Start Playback */ |
Jerome Coutant
5:66c230f74325
|
84
|
BSP_AUDIO_OUT_SetAudioFrameSlot(CODEC_AUDIOFRAME_SLOT_02);
|
|
bmazzeo | 13:61131aac4031 | 85 | if (BSP_AUDIO_OUT_Play((uint16_t *)AUDIO_BUFFER_OUT, AUDIO_BLOCK_SIZE * 2) != AUDIO_OK) { printf("BSP_AUDIO_OUT_Play error\n"); } |
bmazzeo | 13:61131aac4031 | 86 | |
adustm | 0:da04816fb411 | 87 | |
bmazzeo | 9:f5b37c71856d | 88 | timer.start(); |
adustm | 0:da04816fb411 | 89 | while (1) { |
bmazzeo | 6:e689075b04ed | 90 | /* First Half */ |
bmazzeo | 13:61131aac4031 | 91 | /* Wait end of half block recording before going on in the first half cycle*/ |
bmazzeo | 11:4256dbbb0c89 | 92 | while (audio_rec_buffer_state != BUFFER_OFFSET_HALF) {} |
bmazzeo | 9:f5b37c71856d | 93 | |
bmazzeo | 13:61131aac4031 | 94 | /* This captures the time of an entire cycle */ |
bmazzeo | 9:f5b37c71856d | 95 | total_time = timer.read_us(); |
bmazzeo | 13:61131aac4031 | 96 | |
bmazzeo | 13:61131aac4031 | 97 | /* Reset the timer counter to zero */ |
bmazzeo | 9:f5b37c71856d | 98 | timer.reset(); |
Jerome Coutant
5:66c230f74325
|
99
|
|
|
bmazzeo | 13:61131aac4031 | 100 | /* Plot traces of first half block recording */ |
bmazzeo | 12:e44766b61346 | 101 | Erase_Trace(OSC_START_X_POS, L_CHANNEL_Y_POS, R_CHANNEL_Y_POS, HALF_AUDIO_BLOCK_SIZE); |
bmazzeo | 12:e44766b61346 | 102 | Draw_Trace(OSC_START_X_POS, L_CHANNEL_Y_POS, R_CHANNEL_Y_POS, (uint16_t *) AUDIO_BUFFER_IN, HALF_AUDIO_BLOCK_SIZE); |
bmazzeo | 9:f5b37c71856d | 103 | |
bmazzeo | 13:61131aac4031 | 104 | /* Copy recorded 1st half block into the audio buffer that goes out */ |
bmazzeo | 13:61131aac4031 | 105 | memcpy((uint16_t *)(AUDIO_BUFFER_OUT), (uint16_t *)(AUDIO_BUFFER_IN), AUDIO_BLOCK_SIZE); |
bmazzeo | 13:61131aac4031 | 106 | |
bmazzeo | 13:61131aac4031 | 107 | /* Capture the timing of the first half processing */ |
bmazzeo | 9:f5b37c71856d | 108 | first_half_time = timer.read_us(); |
bmazzeo | 13:61131aac4031 | 109 | /* End First Half */ |
bmazzeo | 8:d1c41eca57f0 | 110 | |
bmazzeo | 6:e689075b04ed | 111 | /* Second Half */ |
adustm | 0:da04816fb411 | 112 | /* Wait end of one block recording */ |
bmazzeo | 11:4256dbbb0c89 | 113 | while (audio_rec_buffer_state != BUFFER_OFFSET_FULL) {} |
bmazzeo | 9:f5b37c71856d | 114 | |
bmazzeo | 13:61131aac4031 | 115 | /* Plot traces of second half block recording */ |
bmazzeo | 12:e44766b61346 | 116 | Erase_Trace(OSC_START_X_POS+HALF_AUDIO_BLOCK_SIZE, L_CHANNEL_Y_POS, R_CHANNEL_Y_POS, HALF_AUDIO_BLOCK_SIZE); |
bmazzeo | 12:e44766b61346 | 117 | Draw_Trace(OSC_START_X_POS+HALF_AUDIO_BLOCK_SIZE, L_CHANNEL_Y_POS, R_CHANNEL_Y_POS, (uint16_t *) AUDIO_BUFFER_IN + (AUDIO_BLOCK_SIZE), HALF_AUDIO_BLOCK_SIZE); |
bmazzeo | 13:61131aac4031 | 118 | |
bmazzeo | 13:61131aac4031 | 119 | /* Compute important cycle information and display it*/ |
bmazzeo | 6:e689075b04ed | 120 | counter++; |
bmazzeo | 10:a82b64ea1d11 | 121 | sprintf(buf, "Cycles: %9d", counter); |
bmazzeo | 6:e689075b04ed | 122 | BSP_LCD_SetTextColor(LCD_COLOR_RED); |
bmazzeo | 10:a82b64ea1d11 | 123 | BSP_LCD_DisplayStringAt(0, 46, (uint8_t *) buf, LEFT_MODE); |
bmazzeo | 10:a82b64ea1d11 | 124 | sprintf(buf, "1:%6d 2:%6d T:%6d", first_half_time, second_half_time, total_time); |
bmazzeo | 10:a82b64ea1d11 | 125 | BSP_LCD_DisplayStringAt(0, 20, (uint8_t *) buf, LEFT_MODE); |
bmazzeo | 13:61131aac4031 | 126 | |
bmazzeo | 13:61131aac4031 | 127 | /* Copy recorded 2nd half block into audio output buffer */ |
bmazzeo | 13:61131aac4031 | 128 | memcpy((uint16_t *)(AUDIO_BUFFER_OUT + (AUDIO_BLOCK_SIZE)), (uint16_t *)(AUDIO_BUFFER_IN + (AUDIO_BLOCK_SIZE)), AUDIO_BLOCK_SIZE); |
bmazzeo | 13:61131aac4031 | 129 | |
bmazzeo | 13:61131aac4031 | 130 | /* Change the recording buffer state to reflect the status of the buffer */ |
bmazzeo | 13:61131aac4031 | 131 | audio_rec_buffer_state = BUFFER_OFFSET_NONE; |
bmazzeo | 9:f5b37c71856d | 132 | |
bmazzeo | 13:61131aac4031 | 133 | /* Measures the amount of time to process the second half */ |
bmazzeo | 9:f5b37c71856d | 134 | second_half_time = timer.read_us(); |
bmazzeo | 9:f5b37c71856d | 135 | |
bmazzeo | 13:61131aac4031 | 136 | /* End Second Half */ |
adustm | 0:da04816fb411 | 137 | } |
adustm | 0:da04816fb411 | 138 | } |
Jerome Coutant
5:66c230f74325
|
139
|
|
|
bmazzeo | 7:e1dfd64eba81 | 140 | /** |
bmazzeo | 7:e1dfd64eba81 | 141 | * @brief Draws a trace of the data line. |
bmazzeo | 7:e1dfd64eba81 | 142 | * @param Xpos: X position |
bmazzeo | 7:e1dfd64eba81 | 143 | * @param L_Ypos: Left channel Y position |
bmazzeo | 7:e1dfd64eba81 | 144 | * @param R_Ypos: Right channel Y position |
bmazzeo | 7:e1dfd64eba81 | 145 | * @param Mem_start: Start of memory location |
bmazzeo | 7:e1dfd64eba81 | 146 | * @param Length: length of trace |
bmazzeo | 7:e1dfd64eba81 | 147 | * @retval None |
bmazzeo | 7:e1dfd64eba81 | 148 | */ |
bmazzeo | 7:e1dfd64eba81 | 149 | void Erase_Trace(uint16_t Xpos, uint16_t L_Ypos, uint16_t R_Ypos, uint16_t Length) |
bmazzeo | 7:e1dfd64eba81 | 150 | { |
bmazzeo | 7:e1dfd64eba81 | 151 | BSP_LCD_SetTextColor(LCD_COLOR_BROWN); |
bmazzeo | 7:e1dfd64eba81 | 152 | BSP_LCD_FillRect(Xpos, L_Ypos - AUDIO_DRAW_LIMIT, Length, AUDIO_DRAW_LIMIT); |
bmazzeo | 7:e1dfd64eba81 | 153 | BSP_LCD_FillRect(Xpos, L_Ypos+1, Length, AUDIO_DRAW_LIMIT); |
bmazzeo | 7:e1dfd64eba81 | 154 | BSP_LCD_FillRect(Xpos, R_Ypos - AUDIO_DRAW_LIMIT, Length, AUDIO_DRAW_LIMIT); |
bmazzeo | 7:e1dfd64eba81 | 155 | BSP_LCD_FillRect(Xpos, R_Ypos+1, Length, AUDIO_DRAW_LIMIT); |
bmazzeo | 7:e1dfd64eba81 | 156 | |
bmazzeo | 7:e1dfd64eba81 | 157 | BSP_LCD_SetTextColor(LCD_COLOR_BLUE); |
bmazzeo | 8:d1c41eca57f0 | 158 | BSP_LCD_DrawHLine(Xpos, L_CHANNEL_Y_POS, Length); |
bmazzeo | 8:d1c41eca57f0 | 159 | BSP_LCD_DrawHLine(Xpos, R_CHANNEL_Y_POS, Length); |
bmazzeo | 7:e1dfd64eba81 | 160 | |
bmazzeo | 7:e1dfd64eba81 | 161 | } |
bmazzeo | 7:e1dfd64eba81 | 162 | |
Jerome Coutant
5:66c230f74325
|
163
|
|
|
bmazzeo | 6:e689075b04ed | 164 | /** |
bmazzeo | 6:e689075b04ed | 165 | * @brief Draws a trace of the data line. |
bmazzeo | 6:e689075b04ed | 166 | * @param Xpos: X position |
bmazzeo | 7:e1dfd64eba81 | 167 | * @param L_Ypos: Left channel Y position |
bmazzeo | 7:e1dfd64eba81 | 168 | * @param R_Ypos: Right channel Y position |
bmazzeo | 6:e689075b04ed | 169 | * @param Mem_start: Start of memory location |
bmazzeo | 6:e689075b04ed | 170 | * @param Length: length of trace |
bmazzeo | 6:e689075b04ed | 171 | * @retval None |
bmazzeo | 6:e689075b04ed | 172 | */ |
bmazzeo | 8:d1c41eca57f0 | 173 | void Draw_Trace(uint16_t Xpos, uint16_t L_Ypos, uint16_t R_Ypos, uint16_t* Mem_start, uint16_t Length) |
bmazzeo | 6:e689075b04ed | 174 | { |
bmazzeo | 7:e1dfd64eba81 | 175 | uint16_t i; |
bmazzeo | 7:e1dfd64eba81 | 176 | uint32_t data_value; |
bmazzeo | 7:e1dfd64eba81 | 177 | uint32_t* mem_address; |
bmazzeo | 7:e1dfd64eba81 | 178 | char buf[10]; |
bmazzeo | 7:e1dfd64eba81 | 179 | int16_t L_audio_value; |
bmazzeo | 7:e1dfd64eba81 | 180 | int16_t R_audio_value; |
bmazzeo | 6:e689075b04ed | 181 | |
bmazzeo | 7:e1dfd64eba81 | 182 | data_value = *((uint32_t*) Mem_start); |
bmazzeo | 7:e1dfd64eba81 | 183 | L_audio_value = (int16_t) ((data_value >> 16) & 0xFFFF); |
bmazzeo | 7:e1dfd64eba81 | 184 | R_audio_value = (int16_t) (data_value & 0xFFFF); |
bmazzeo | 7:e1dfd64eba81 | 185 | |
bmazzeo | 8:d1c41eca57f0 | 186 | //sprintf(buf, "%12d", data_value); |
bmazzeo | 8:d1c41eca57f0 | 187 | //BSP_LCD_DisplayStringAt(0, 60, (uint8_t *) buf, LEFT_MODE); |
bmazzeo | 8:d1c41eca57f0 | 188 | |
bmazzeo | 7:e1dfd64eba81 | 189 | //sprintf(buf, "%12d", L_audio_value); |
bmazzeo | 7:e1dfd64eba81 | 190 | //BSP_LCD_DisplayStringAt(0, 60, (uint8_t *) buf, LEFT_MODE); |
bmazzeo | 6:e689075b04ed | 191 | |
bmazzeo | 7:e1dfd64eba81 | 192 | //sprintf(buf, "%12d", R_audio_value); |
bmazzeo | 7:e1dfd64eba81 | 193 | //BSP_LCD_DisplayStringAt(0, 80, (uint8_t *) buf, LEFT_MODE); |
bmazzeo | 7:e1dfd64eba81 | 194 | |
bmazzeo | 8:d1c41eca57f0 | 195 | for (i=0; i<Length; i++) |
bmazzeo | 6:e689075b04ed | 196 | { |
bmazzeo | 7:e1dfd64eba81 | 197 | mem_address = (uint32_t*) Mem_start + i; |
bmazzeo | 7:e1dfd64eba81 | 198 | data_value = *((uint32_t*) mem_address); |
bmazzeo | 7:e1dfd64eba81 | 199 | L_audio_value = (int16_t) ((data_value >> 16) & 0xFFFF); |
bmazzeo | 7:e1dfd64eba81 | 200 | R_audio_value = (int16_t) (data_value & 0xFFFF); |
bmazzeo | 7:e1dfd64eba81 | 201 | |
bmazzeo | 7:e1dfd64eba81 | 202 | L_audio_value = L_audio_value / 50; |
bmazzeo | 7:e1dfd64eba81 | 203 | R_audio_value = R_audio_value / 50; |
bmazzeo | 7:e1dfd64eba81 | 204 | |
bmazzeo | 7:e1dfd64eba81 | 205 | //sprintf(buf, "%12d", L_audio_value); |
bmazzeo | 7:e1dfd64eba81 | 206 | //BSP_LCD_DisplayStringAt(0, 60, (uint8_t *) buf, LEFT_MODE); |
bmazzeo | 7:e1dfd64eba81 | 207 | |
bmazzeo | 7:e1dfd64eba81 | 208 | //sprintf(buf, "%12d", R_audio_value); |
bmazzeo | 7:e1dfd64eba81 | 209 | //BSP_LCD_DisplayStringAt(0, 80, (uint8_t *) buf, LEFT_MODE); |
bmazzeo | 7:e1dfd64eba81 | 210 | |
bmazzeo | 7:e1dfd64eba81 | 211 | |
bmazzeo | 7:e1dfd64eba81 | 212 | //L_audio_value = -i; |
bmazzeo | 7:e1dfd64eba81 | 213 | if (L_audio_value > AUDIO_DRAW_LIMIT) {L_audio_value = AUDIO_DRAW_LIMIT;} |
bmazzeo | 7:e1dfd64eba81 | 214 | else if (L_audio_value < -AUDIO_DRAW_LIMIT) {L_audio_value = -AUDIO_DRAW_LIMIT;} |
bmazzeo | 7:e1dfd64eba81 | 215 | |
bmazzeo | 7:e1dfd64eba81 | 216 | if (R_audio_value > AUDIO_DRAW_LIMIT) {R_audio_value = AUDIO_DRAW_LIMIT;} |
bmazzeo | 7:e1dfd64eba81 | 217 | else if (R_audio_value < -AUDIO_DRAW_LIMIT) {R_audio_value = -AUDIO_DRAW_LIMIT;} |
bmazzeo | 7:e1dfd64eba81 | 218 | |
bmazzeo | 7:e1dfd64eba81 | 219 | BSP_LCD_DrawPixel(Xpos + i, (uint16_t) ((int16_t) L_Ypos + L_audio_value), LCD_COLOR_WHITE); |
bmazzeo | 7:e1dfd64eba81 | 220 | BSP_LCD_DrawPixel(Xpos + i, (uint16_t) ((int16_t) R_Ypos + R_audio_value), LCD_COLOR_WHITE); |
bmazzeo | 6:e689075b04ed | 221 | } |
bmazzeo | 6:e689075b04ed | 222 | |
bmazzeo | 6:e689075b04ed | 223 | } |
bmazzeo | 6:e689075b04ed | 224 | |
bmazzeo | 6:e689075b04ed | 225 | /* Read data value from SDRAM memory */ |
bmazzeo | 6:e689075b04ed | 226 | // ret = *(__IO uint32_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))); |
bmazzeo | 6:e689075b04ed | 227 | |
bmazzeo | 6:e689075b04ed | 228 | |
adustm | 0:da04816fb411 | 229 | /*------------------------------------------------------------------------------------- |
adustm | 0:da04816fb411 | 230 | Callbacks implementation: |
adustm | 0:da04816fb411 | 231 | the callbacks API are defined __weak in the stm32746g_discovery_audio.c file |
adustm | 0:da04816fb411 | 232 | and their implementation should be done in the user code if they are needed. |
adustm | 0:da04816fb411 | 233 | Below some examples of callback implementations. |
adustm | 0:da04816fb411 | 234 | -------------------------------------------------------------------------------------*/ |
adustm | 0:da04816fb411 | 235 | /** |
adustm | 0:da04816fb411 | 236 | * @brief Manages the DMA Transfer complete interrupt. |
adustm | 0:da04816fb411 | 237 | * @param None |
adustm | 0:da04816fb411 | 238 | * @retval None |
adustm | 0:da04816fb411 | 239 | */ |
adustm | 0:da04816fb411 | 240 | void BSP_AUDIO_IN_TransferComplete_CallBack(void) |
adustm | 0:da04816fb411 | 241 | { |
Jerome Coutant
5:66c230f74325
|
242
|
audio_rec_buffer_state = BUFFER_OFFSET_FULL;
|
|
adustm | 0:da04816fb411 | 243 | } |
adustm | 0:da04816fb411 | 244 | |
adustm | 0:da04816fb411 | 245 | /** |
adustm | 0:da04816fb411 | 246 | * @brief Manages the DMA Half Transfer complete interrupt. |
adustm | 0:da04816fb411 | 247 | * @param None |
adustm | 0:da04816fb411 | 248 | * @retval None |
adustm | 0:da04816fb411 | 249 | */ |
adustm | 0:da04816fb411 | 250 | void BSP_AUDIO_IN_HalfTransfer_CallBack(void) |
adustm | 0:da04816fb411 | 251 | { |
Jerome Coutant
5:66c230f74325
|
252
|
audio_rec_buffer_state = BUFFER_OFFSET_HALF;
|
|
adustm | 0:da04816fb411 | 253 | } |
adustm | 0:da04816fb411 | 254 | |
Jerome Coutant
5:66c230f74325
|
255
|
/**
|
|
Jerome Coutant
5:66c230f74325
|
256
|
* @brief Audio IN Error callback function.
|
|
Jerome Coutant
5:66c230f74325
|
257
|
* @param None
|
|
Jerome Coutant
5:66c230f74325
|
258
|
* @retval None
|
|
Jerome Coutant
5:66c230f74325
|
259
|
*/
|
|
Jerome Coutant
5:66c230f74325
|
260
|
void BSP_AUDIO_IN_Error_CallBack(void)
|
|
adustm | 0:da04816fb411 | 261 | { |
Jerome Coutant
5:66c230f74325
|
262
|
printf("BSP_AUDIO_IN_Error_CallBack\n");
|
|
adustm | 0:da04816fb411 | 263 | } |