The "GR-PEACH_Audio_Playback_7InchLCD_Sample" is a sample code that can provides high-resolution audio playback of FLAC format files. It also allows the user to audio-playback control functions such as play, pause, and stop by manipulating key switches.

Dependencies:   GR-PEACH_video R_BSP TLV320_RBSP USBHost_custom

Fork of GR-PEACH_Audio_Playback_Sample by Renesas

Note

For a sample program of without LCD Board, please refer to GR-PEACH_Audio_Playback_Sample.

Introduction

The "GR-PEACH_Audio_Playback_7InchLCD_Sample" is a sample code that can provides high-resolution audio playback of FLAC format files. It also allows the user to audio-playback control functions such as play, pause, and stop by manipulating key switches.

1. Overview of the Sample Code

1.1 Software Block Diagram

Figure 1.1 shows the software block diagram.

/media/uploads/1050186/lcd_figure1_1.png

1.2 Pin Definitions

Table 1.1 shows the pins used in this sample code.

/media/uploads/1050186/lcd_table1_1.png

2. Sample Code Operating Environment

In order to operate this sample code, GR-PEACH, Audio Camera Shield and 7.1 inch LCD Shield must be needed. For details on Audio Camera Shield and 7.1 inch LCD Shield, please refer to the following links, respectively:

In this section, it is described that how board is configured and to control audio playback via command line and touch screen.

2.1 Operating Environment

Figure 2.1 shows the overview of the operating environment for this sample code.

/media/uploads/1050186/lcd_figure2_1.png

Figure 2.2 and 2.3 show how to configure GR-PEACH, Audio Camera Shield and 7.1 inch LCD shield when using USB0 and USB1, respectively.

/media/uploads/1050186/lcd_figure2_2.png /media/uploads/1050186/lcd_figure2_3.png

Table 2.1 lists the overview of Graphical User Interface (GUI) of this sample code.

/media/uploads/1050186/lcd_table2_1.png

2.2 List of User Operations

Table 2.2 shows the relationship among Audio Playback, Command Line and Onboard Switch.

/media/uploads/1050186/lcd_table2_2.png

3. Function Outline

Table 3.1, 3.2 and 3.3 shows the overview of functions implemented in this sample code.

/media/uploads/1050186/lcd_table3_1.png /media/uploads/1050186/lcd_table3_2.png /media/uploads/1050186/lcd_table3_3.png /media/uploads/1050186/lcd_figure3_1.png

3.1 Playback Control

This sample program supports the operation "play", "pause", "stop", "play next song" and "play previous song".

3.2 Trick Play Control

In order to enable/disable Repeat Mode, user need to type "repeat" on command line or click the corresponding icon shown in Table 2.2. By derault, Repeat Mode is enabled. When Repeat Mode is enabled, the first song is played back after the playback of the last song is finished. Otherwise, the playback is shopped when finishing to play back the last song.

3.3 How to see Song Information

The information of the song being played back can be seen by typing playinfo on command line. Table 3.4 lists the items user can see on the terminal.

/media/uploads/dkato/audioplayback_table3_4.png

3.4 How to analyze the folder structure in USB stick

In this sample code, the folder structure in USB stick is analyzed in the breadth-first order. Table 3.5 shows how the files in USB stick are numbered.

/media/uploads/dkato/audioplayback_table3_5.png

4.Others

4.1 Serial Communication Setting

With respect to the default serial communication related setting on mbed, please refer to the follwing link:
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication
Please set up the terminal software you would like to use on your PC in consideration of the above. For example, 9600 should be specified for the baud rate on the terminal in order to control this sample via command line.

4.2 Necessary modification when using GCC ARM Embedded

If you would like to use GCC ARM Embedded, you must revise the following linker script incorporated in mbed OS 5 package as follows:

  • Linker Script to be modified
    $(PROJECT_ROOT)/mbed-os/targets/TARGET_RENESAS/TARGET_RZ_A1H/device/TOOLCHAIN_GCC_ARM/RZA1H.ld

    Please note that $(PROJECT_ROOT) in the above denotes the root directory of this sample code

  • Before Modification

RZA1H.ld

/* Linker script for mbed RZ_A1H */

/* Linker script to configure memory regions. */
MEMORY
{
  ROM   (rx)  : ORIGIN = 0x00000000, LENGTH = 0x02000000
  BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000 
  SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000 
  L_TTB (rw)  : ORIGIN = 0x20000000, LENGTH = 0x00004000 
  RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x00700000
  RAM_NC (rwx) : ORIGIN = 0x20900000, LENGTH = 0x00100000
}
(snip)
  • After Modification

RZA1H.ld

/* Linker script for mbed RZ_A1H */

/* Linker script to configure memory regions. */
MEMORY
{
  ROM   (rx)  : ORIGIN = 0x00000000, LENGTH = 0x02000000
  BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000 
  SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000 
  L_TTB (rw)  : ORIGIN = 0x20000000, LENGTH = 0x00004000 
  RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x00180000
  RAM_NC (rwx) : ORIGIN = 0x20200000, LENGTH = 0x00680000
}
(snip)
Committer:
Osamu Nakamura
Date:
Tue Apr 11 12:42:10 2017 +0900
Revision:
6:a957aaa284f0
Parent:
4:2672de88a46b
Update R-BSP from rev. cbb9d60c8748 to fb9eda52224e so that this program can be compiled with IAR toolchain.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
1050186 4:2672de88a46b 1 /*******************************************************************************
1050186 4:2672de88a46b 2 * DISCLAIMER
1050186 4:2672de88a46b 3 * This software is supplied by Renesas Electronics Corporation and is only
1050186 4:2672de88a46b 4 * intended for use with Renesas products. No other uses are authorized. This
1050186 4:2672de88a46b 5 * software is owned by Renesas Electronics Corporation and is protected under
1050186 4:2672de88a46b 6 * all applicable laws, including copyright laws.
1050186 4:2672de88a46b 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
1050186 4:2672de88a46b 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
1050186 4:2672de88a46b 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
1050186 4:2672de88a46b 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
1050186 4:2672de88a46b 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
1050186 4:2672de88a46b 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
1050186 4:2672de88a46b 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
1050186 4:2672de88a46b 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
1050186 4:2672de88a46b 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
1050186 4:2672de88a46b 16 * Renesas reserves the right, without notice, to make changes to this software
1050186 4:2672de88a46b 17 * and to discontinue the availability of this software. By using this software,
1050186 4:2672de88a46b 18 * you agree to the additional terms and conditions found by accessing the
1050186 4:2672de88a46b 19 * following link:
1050186 4:2672de88a46b 20 * http://www.renesas.com/disclaimer*
1050186 4:2672de88a46b 21 * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved.
1050186 4:2672de88a46b 22 *******************************************************************************/
1050186 4:2672de88a46b 23
1050186 4:2672de88a46b 24 #include "disp_graphics.h"
1050186 4:2672de88a46b 25 #include "disp_tft.h"
1050186 4:2672de88a46b 26 #include "disp_tft_scrn.h"
1050186 4:2672de88a46b 27 #include "img_tbl.h"
1050186 4:2672de88a46b 28 #include "system.h"
1050186 4:2672de88a46b 29
1050186 4:2672de88a46b 30 /*--- Macro definition ---*/
1050186 4:2672de88a46b 31 /*-- The making phase of the display image --*/
1050186 4:2672de88a46b 32 #define SCRN_PHASE_INIT1 (0) /* 1st phase of the initialization process. */
1050186 4:2672de88a46b 33 #define SCRN_PHASE_INIT2 (1) /* 2nd phase of the initialization process. */
1050186 4:2672de88a46b 34 #define SCRN_PHASE_INIT3 (2) /* 3rd phase of the initialization process. */
1050186 4:2672de88a46b 35 #define SCRN_PHASE_INIT4 (3) /* 4th phase of the initialization process. */
1050186 4:2672de88a46b 36 #define SCRN_PHASE_INIT5 (4) /* 5th phase of the initialization process. */
1050186 4:2672de88a46b 37 #define SCRN_PHASE_INIT6 (5) /* 6th phase of the initialization process. */
1050186 4:2672de88a46b 38 #define SCRN_PHASE_INIT7 (6) /* 7th phase of the initialization process. */
1050186 4:2672de88a46b 39 #define SCRN_PHASE_INIT8 (7) /* 8th phase of the initialization process. */
1050186 4:2672de88a46b 40 #define SCRN_PHASE_INIT9 (8) /* 9th phase of the initialization process. */
1050186 4:2672de88a46b 41 #define SCRN_PHASE_INIT10 (9) /* 10th phase of the initialization process. */
1050186 4:2672de88a46b 42 #define SCRN_PHASE_INIT11 (10) /* 11th phase of the initialization process. */
1050186 4:2672de88a46b 43 #define SCRN_PHASE_INIT12 (11) /* 12th phase of the initialization process. */
1050186 4:2672de88a46b 44 #define SCRN_PHASE_INIT13 (12) /* 13th phase of the initialization process. */
1050186 4:2672de88a46b 45 #define SCRN_PHASE_INIT14 (13) /* 14th phase of the initialization process. */
1050186 4:2672de88a46b 46 #define SCRN_PHASE_INIT15 (14) /* 15th phase of the initialization process. */
1050186 4:2672de88a46b 47 #define SCRN_PHASE_INIT16 (15) /* 16th phase of the initialization process. */
1050186 4:2672de88a46b 48 #define SCRN_PHASE_INIT17 (16) /* 17th phase of the initialization process. */
1050186 4:2672de88a46b 49 #define SCRN_PHASE_INIT18 (17) /* 18th phase of the initialization process. */
1050186 4:2672de88a46b 50 #define SCRN_PHASE_INIT19 (18) /* 19th phase of the initialization process. */
1050186 4:2672de88a46b 51 #define SCRN_PHASE_INIT20 (19) /* 20th phase of the initialization process. */
1050186 4:2672de88a46b 52 #define SCRN_PHASE_INIT21 (20) /* 21th phase of the initialization process. */
1050186 4:2672de88a46b 53 #define SCRN_PHASE_INIT22 (21) /* 22th phase of the initialization process. */
1050186 4:2672de88a46b 54 #define SCRN_PHASE_INIT23 (22) /* 23th phase of the initialization process. */
1050186 4:2672de88a46b 55 #define SCRN_PHASE_INIT24 (23) /* 24th phase of the initialization process. */
1050186 4:2672de88a46b 56 #define SCRN_PHASE_NORM1 (24) /* 1st phase of the normal process. */
1050186 4:2672de88a46b 57 #define SCRN_PHASE_NORM2 (25) /* 2nd phase of the normal process. */
1050186 4:2672de88a46b 58 #define SCRN_PHASE_NORM3 (26) /* 3rd phase of the normal process. */
1050186 4:2672de88a46b 59 #define SCRN_PHASE_NORM4 (27) /* 4th phase of the normal process. */
1050186 4:2672de88a46b 60 #define SCRN_PHASE_NORM5 (28) /* 5th phase of the normal process. */
1050186 4:2672de88a46b 61 #define SCRN_PHASE_NORM6 (29) /* 6th phase of the normal process. */
1050186 4:2672de88a46b 62
1050186 4:2672de88a46b 63 /*-- Display position of the picture --*/
1050186 4:2672de88a46b 64 /* DSP_IMG_ID_BACK1 */
1050186 4:2672de88a46b 65 #define XPOS_BACK1 ( 0)
1050186 4:2672de88a46b 66 #define YPOS_BACK1 ( 0)
1050186 4:2672de88a46b 67
1050186 4:2672de88a46b 68 /* DSP_IMG_ID_BACK2 */
1050186 4:2672de88a46b 69 #define XPOS_BACK2 (XPOS_BACK1)
1050186 4:2672de88a46b 70 #define YPOS_BACK2 (YPOS_BACK1 + (int32_t)DSP_IMG_HS_BACK1)
1050186 4:2672de88a46b 71
1050186 4:2672de88a46b 72 /* DSP_IMG_ID_BACK3 */
1050186 4:2672de88a46b 73 #define XPOS_BACK3 (XPOS_BACK2)
1050186 4:2672de88a46b 74 #define YPOS_BACK3 (YPOS_BACK2 + (int32_t)DSP_IMG_HS_BACK2)
1050186 4:2672de88a46b 75
1050186 4:2672de88a46b 76 /* DSP_IMG_ID_BACK4 */
1050186 4:2672de88a46b 77 #define XPOS_BACK4 (XPOS_BACK3)
1050186 4:2672de88a46b 78 #define YPOS_BACK4 (YPOS_BACK3 + (int32_t)DSP_IMG_HS_BACK3)
1050186 4:2672de88a46b 79
1050186 4:2672de88a46b 80 /* DSP_IMG_ID_BACK5 */
1050186 4:2672de88a46b 81 #define XPOS_BACK5 (XPOS_BACK4)
1050186 4:2672de88a46b 82 #define YPOS_BACK5 (YPOS_BACK4 + (int32_t)DSP_IMG_HS_BACK4)
1050186 4:2672de88a46b 83
1050186 4:2672de88a46b 84 /* DSP_IMG_ID_BACK6 */
1050186 4:2672de88a46b 85 #define XPOS_BACK6 (XPOS_BACK5)
1050186 4:2672de88a46b 86 #define YPOS_BACK6 (YPOS_BACK5 + (int32_t)DSP_IMG_HS_BACK5)
1050186 4:2672de88a46b 87
1050186 4:2672de88a46b 88 /* DSP_IMG_ID_AUDIO */
1050186 4:2672de88a46b 89 #define XPOS_AUDIO ( 20)
1050186 4:2672de88a46b 90 #define YPOS_AUDIO ( 25)
1050186 4:2672de88a46b 91
1050186 4:2672de88a46b 92 /* DSP_IMG_ID_RENESAS */
1050186 4:2672de88a46b 93 #define XPOS_RENESAS (260)
1050186 4:2672de88a46b 94 #define YPOS_RENESAS ( 25)
1050186 4:2672de88a46b 95
1050186 4:2672de88a46b 96 /* DSP_IMG_ID_AUDIO_BUTTON1 */
1050186 4:2672de88a46b 97 #define XPOS_BUTTON1 (230)
1050186 4:2672de88a46b 98 #define YPOS_BUTTON1 (410)
1050186 4:2672de88a46b 99
1050186 4:2672de88a46b 100 /* DSP_IMG_ID_AUDIO_BUTTON2 */
1050186 4:2672de88a46b 101 #define XPOS_BUTTON2 (370)
1050186 4:2672de88a46b 102 #define YPOS_BUTTON2 (YPOS_BUTTON1)
1050186 4:2672de88a46b 103
1050186 4:2672de88a46b 104 /* DSP_IMG_ID_AUDIO_BUTTON3 */
1050186 4:2672de88a46b 105 #define XPOS_BUTTON3 (510)
1050186 4:2672de88a46b 106 #define YPOS_BUTTON3 (YPOS_BUTTON1)
1050186 4:2672de88a46b 107
1050186 4:2672de88a46b 108 /* DSP_IMG_ID_AUDIO_BUTTON4 */
1050186 4:2672de88a46b 109 #define XPOS_BUTTON4 (650)
1050186 4:2672de88a46b 110 #define YPOS_BUTTON4 (YPOS_BUTTON1)
1050186 4:2672de88a46b 111
1050186 4:2672de88a46b 112 /* DSP_IMG_ID_AUDIO_BAR */
1050186 4:2672de88a46b 113 #define XPOS_AUDIO_BAR (240)
1050186 4:2672de88a46b 114 #define YPOS_AUDIO_BAR (385)
1050186 4:2672de88a46b 115
1050186 4:2672de88a46b 116 /* DSP_IMG_ID_AUDIO_WINDOW1 */
1050186 4:2672de88a46b 117 #define XPOS_AUDIO_WINDOW1 (0)
1050186 4:2672de88a46b 118 #define YPOS_AUDIO_WINDOW1 (105)
1050186 4:2672de88a46b 119
1050186 4:2672de88a46b 120 /* DSP_IMG_ID_AUDIO_WINDOW2 */
1050186 4:2672de88a46b 121 #define XPOS_AUDIO_WINDOW2 (XPOS_AUDIO_WINDOW1)
1050186 4:2672de88a46b 122 #define YPOS_AUDIO_WINDOW2 (YPOS_AUDIO_WINDOW1 + (int32_t)DSP_IMG_HS_AUDIO_WINDOW1)
1050186 4:2672de88a46b 123
1050186 4:2672de88a46b 124 /* DSP_IMG_ID_AUDIO_WINDOW3 */
1050186 4:2672de88a46b 125 #define XPOS_AUDIO_WINDOW3 (XPOS_AUDIO_WINDOW2)
1050186 4:2672de88a46b 126 #define YPOS_AUDIO_WINDOW3 (YPOS_AUDIO_WINDOW2 + (int32_t)DSP_IMG_HS_AUDIO_WINDOW2)
1050186 4:2672de88a46b 127
1050186 4:2672de88a46b 128 /* DSP_IMG_ID_AUDIO_WINDOW4 */
1050186 4:2672de88a46b 129 #define XPOS_AUDIO_WINDOW4 (XPOS_AUDIO_WINDOW3)
1050186 4:2672de88a46b 130 #define YPOS_AUDIO_WINDOW4 (YPOS_AUDIO_WINDOW3 + (int32_t)DSP_IMG_HS_AUDIO_WINDOW3)
1050186 4:2672de88a46b 131
1050186 4:2672de88a46b 132 /* DSP_IMG_ID_MODE */
1050186 4:2672de88a46b 133 #define XPOS_MODE (30)
1050186 4:2672de88a46b 134 #define YPOS_MODE (380)
1050186 4:2672de88a46b 135
1050186 4:2672de88a46b 136 /* DSP_IMG_ID_TV */
1050186 4:2672de88a46b 137 #define XPOS_TV (60)
1050186 4:2672de88a46b 138 #define YPOS_TV (400)
1050186 4:2672de88a46b 139
1050186 4:2672de88a46b 140 /* Mode Number */
1050186 4:2672de88a46b 141 #define XPOS_MODE_NUMBER (90)
1050186 4:2672de88a46b 142 #define YPOS_MODE_NUMBER (410)
1050186 4:2672de88a46b 143 #define MSG_FORM_MODE "%ld"
1050186 4:2672de88a46b 144
1050186 4:2672de88a46b 145 /* DSP_IMG_ID_BAR_LEFT */
1050186 4:2672de88a46b 146 #define OFFSET_BAR_FROM_AUDIO_BAR (2) /* offset level from audio bar */
1050186 4:2672de88a46b 147
1050186 4:2672de88a46b 148 #define XPOS_BAR_LEFT (XPOS_AUDIO_BAR + OFFSET_BAR_FROM_AUDIO_BAR)
1050186 4:2672de88a46b 149 #define YPOS_BAR_LEFT (YPOS_AUDIO_BAR + OFFSET_BAR_FROM_AUDIO_BAR)
1050186 4:2672de88a46b 150
1050186 4:2672de88a46b 151 /* DSP_IMG_ID_BAR_MID */
1050186 4:2672de88a46b 152 #define XPOS_BAR_MID (int32_t)((uint32_t)XPOS_BAR_LEFT + DSP_IMG_WS_BAR_LEFT)
1050186 4:2672de88a46b 153 #define YPOS_BAR_MID (YPOS_BAR_LEFT)
1050186 4:2672de88a46b 154
1050186 4:2672de88a46b 155 /* DSP_IMG_ID_BAR_RIGHT */
1050186 4:2672de88a46b 156 #define XPOS_BAR_RIGHT (XPOS_BAR_MID)
1050186 4:2672de88a46b 157 #define YPOS_BAR_RIGHT (YPOS_BAR_MID)
1050186 4:2672de88a46b 158
1050186 4:2672de88a46b 159 /* The range of the bar movement on the audio-bar. */
1050186 4:2672de88a46b 160 #define MOV_RANGE_BAR \
1050186 4:2672de88a46b 161 ((DSP_IMG_WS_AUDIO_BAR - (DSP_IMG_WS_BAR_LEFT + DSP_IMG_WS_BAR_RIGHT)) - \
1050186 4:2672de88a46b 162 (OFFSET_BAR_FROM_AUDIO_BAR + OFFSET_BAR_FROM_AUDIO_BAR))
1050186 4:2672de88a46b 163
1050186 4:2672de88a46b 164 /* Display position of text in the case of display mode 1. */
1050186 4:2672de88a46b 165 /* File Number */
1050186 4:2672de88a46b 166 #define M1_XPOS_FILE_NUM (15)
1050186 4:2672de88a46b 167 #define M1_YPOS_FILE_NUM (130)
1050186 4:2672de88a46b 168 #define M1_MSG_FORM_FILE_NUM "T%03ld"
1050186 4:2672de88a46b 169
1050186 4:2672de88a46b 170 /* Playback Time */
1050186 4:2672de88a46b 171 #define M1_XPOS_PLAY_TIME (165)
1050186 4:2672de88a46b 172 #define M1_YPOS_PLAY_TIME (M1_YPOS_FILE_NUM)
1050186 4:2672de88a46b 173 #define M1_MSG_FORM_PLAY_TIME "%3ld:%02ld:%02ld"
1050186 4:2672de88a46b 174
1050186 4:2672de88a46b 175 /* Total playback Time */
1050186 4:2672de88a46b 176 #define M1_XPOS_TOTAL_TIME (435)
1050186 4:2672de88a46b 177 #define M1_YPOS_TOTAL_TIME (M1_YPOS_FILE_NUM)
1050186 4:2672de88a46b 178 #define M1_MSG_FORM_TOTAL_TIME " / %3ld:%02ld:%02ld"
1050186 4:2672de88a46b 179
1050186 4:2672de88a46b 180 /* EIGHTH NOTE */
1050186 4:2672de88a46b 181 #define M1_XPOS_EIGHTH_NOTE (15)
1050186 4:2672de88a46b 182 #define M1_YPOS_EIGHTH_NOTE (210)
1050186 4:2672de88a46b 183
1050186 4:2672de88a46b 184 /* FILE NAME */
1050186 4:2672de88a46b 185 #define M1_XPOS_FILE_NAME (45)
1050186 4:2672de88a46b 186 #define M1_YPOS_FILE_NAME (M1_YPOS_EIGHTH_NOTE)
1050186 4:2672de88a46b 187
1050186 4:2672de88a46b 188 /* PLAY INFO */
1050186 4:2672de88a46b 189 #define M1_XPOS_PLAY_INFO (15)
1050186 4:2672de88a46b 190 #define M1_YPOS_PLAY_INFO (290)
1050186 4:2672de88a46b 191 #define M1_MSG_FORM_PLAY_INFO "FLAC %5ld Hz, %s"
1050186 4:2672de88a46b 192
1050186 4:2672de88a46b 193 /* Channel number */
1050186 4:2672de88a46b 194 #define M1_STR_CHANNEL_MONO "Mono"
1050186 4:2672de88a46b 195 #define M1_STR_CHANNEL_STEREO "Stereo"
1050186 4:2672de88a46b 196
1050186 4:2672de88a46b 197 /* Display position of text in the case of display mode 2. */
1050186 4:2672de88a46b 198 /* File Number */
1050186 4:2672de88a46b 199 #define M2_XPOS_FILE_NUM (150)
1050186 4:2672de88a46b 200 #define M2_YPOS_FILE_NUM (320)
1050186 4:2672de88a46b 201 #define M2_MSG_FORM_FILE_NUM "T%03ld"
1050186 4:2672de88a46b 202
1050186 4:2672de88a46b 203 /* Playback Time */
1050186 4:2672de88a46b 204 #define M2_XPOS_PLAY_TIME (450)
1050186 4:2672de88a46b 205 #define M2_YPOS_PLAY_TIME (M2_YPOS_FILE_NUM)
1050186 4:2672de88a46b 206 #define M2_MSG_FORM_PLAY_TIME "%3ld:%02ld:%02ld"
1050186 4:2672de88a46b 207
1050186 4:2672de88a46b 208 /* L-ch */
1050186 4:2672de88a46b 209 #define M2_XPOS_TEXT_LCH (150)
1050186 4:2672de88a46b 210 #define M2_YPOS_TEXT_LCH (130)
1050186 4:2672de88a46b 211 #define M2_STR_TEXT_LCH "L-ch"
1050186 4:2672de88a46b 212 #define M2_XPOS_AUDIO_LCH (0)
1050186 4:2672de88a46b 213 #define M2_YPOS_AUDIO_LCH (238)
1050186 4:2672de88a46b 214 #define M2_XSIZE_AUDIO_LCH (1)
1050186 4:2672de88a46b 215 #define M2_COL_AUDIO_LCH (0xFF00FF00u)
1050186 4:2672de88a46b 216
1050186 4:2672de88a46b 217 /* R-ch */
1050186 4:2672de88a46b 218 #define M2_XPOS_TEXT_RCH (530)
1050186 4:2672de88a46b 219 #define M2_YPOS_TEXT_RCH (M2_YPOS_TEXT_LCH)
1050186 4:2672de88a46b 220 #define M2_STR_TEXT_RCH "R-ch"
1050186 4:2672de88a46b 221 #define M2_XPOS_AUDIO_RCH (401)
1050186 4:2672de88a46b 222 #define M2_YPOS_AUDIO_RCH (M2_YPOS_AUDIO_LCH)
1050186 4:2672de88a46b 223 #define M2_XSIZE_AUDIO_RCH (M2_XSIZE_AUDIO_LCH)
1050186 4:2672de88a46b 224 #define M2_COL_AUDIO_RCH (0xFF0000FFu)
1050186 4:2672de88a46b 225
1050186 4:2672de88a46b 226 /* Center of the vertical line */
1050186 4:2672de88a46b 227 #define M2_XPOS_VLINE (399)
1050186 4:2672de88a46b 228 #define M2_YPOS_VLINE (110)
1050186 4:2672de88a46b 229 #define M2_XSIZE_VLINE (2)
1050186 4:2672de88a46b 230 #define M2_YSIZE_VLINE (256)
1050186 4:2672de88a46b 231 #define M2_COL_VLINE (DSP_IMG_FONT_FG_COL)
1050186 4:2672de88a46b 232
1050186 4:2672de88a46b 233 /* Center of the horizontal line */
1050186 4:2672de88a46b 234 #define M2_XPOS_HLINE (M2_XPOS_AUDIO_LCH)
1050186 4:2672de88a46b 235 #define M2_YPOS_HLINE (M2_YPOS_AUDIO_LCH)
1050186 4:2672de88a46b 236 #define M2_XSIZE_HLINE (800)
1050186 4:2672de88a46b 237 #define M2_YSIZE_HLINE (1)
1050186 4:2672de88a46b 238 #define M2_COL_HLINE (0xFFF02020u)
1050186 4:2672de88a46b 239
1050186 4:2672de88a46b 240 /* Display position of text in the case of display mode 3. */
1050186 4:2672de88a46b 241 /* File Number */
1050186 4:2672de88a46b 242 #define M3_XPOS_FILE_NUM (15)
1050186 4:2672de88a46b 243 #define M3_YPOS_FILE_NUM (130)
1050186 4:2672de88a46b 244 #define M3_MSG_FORM_FILE_NUM "T%03ld"
1050186 4:2672de88a46b 245
1050186 4:2672de88a46b 246 /* Playback Time */
1050186 4:2672de88a46b 247 #define M3_XPOS_PLAY_TIME (0)
1050186 4:2672de88a46b 248 #define M3_YPOS_PLAY_TIME (335)
1050186 4:2672de88a46b 249 #define M3_MSG_FORM_PLAY_TIME "%3ld:%02ld:%02ld"
1050186 4:2672de88a46b 250
1050186 4:2672de88a46b 251 /* L-ch + R-ch */
1050186 4:2672de88a46b 252 #define M3_XPOS_AUDIO (0)
1050186 4:2672de88a46b 253 #define M3_YPOS_AUDIO (238)
1050186 4:2672de88a46b 254 #define M3_XSIZE_AUDIO (1)
1050186 4:2672de88a46b 255 #define M3_COL_AUDIO (0xFF00FF00u)
1050186 4:2672de88a46b 256
1050186 4:2672de88a46b 257 /* Center of the vertical line */
1050186 4:2672de88a46b 258 #define M3_XPOS_VLINE (M3_XPOS_PLAY_TIME)
1050186 4:2672de88a46b 259 #define M3_YPOS_VLINE (110)
1050186 4:2672de88a46b 260 #define M3_XSIZE_VLINE (2)
1050186 4:2672de88a46b 261 #define M3_YSIZE_VLINE (256)
1050186 4:2672de88a46b 262 #define M3_COL_VLINE (DSP_IMG_FONT_FG_COL)
1050186 4:2672de88a46b 263
1050186 4:2672de88a46b 264 /* Center of the horizontal line */
1050186 4:2672de88a46b 265 #define M3_XPOS_HLINE (M3_XPOS_AUDIO)
1050186 4:2672de88a46b 266 #define M3_YPOS_HLINE (M3_YPOS_AUDIO)
1050186 4:2672de88a46b 267 #define M3_XSIZE_HLINE (800)
1050186 4:2672de88a46b 268 #define M3_YSIZE_HLINE (1)
1050186 4:2672de88a46b 269 #define M3_COL_HLINE (0xFFF02020u)
1050186 4:2672de88a46b 270
1050186 4:2672de88a46b 271 /* Interval in the seconds between the vertical line. */
1050186 4:2672de88a46b 272 #define M3_INTERVAL_TIME_SEC (5u)
1050186 4:2672de88a46b 273 #define M3_INTERVAL_VLINE (M3_INTERVAL_TIME_SEC * DSP_TFT_M3_AUDIO_SAMPLE_PER_SEC)
1050186 4:2672de88a46b 274 /* Maximum number of the drawing process of the vertical line. */
1050186 4:2672de88a46b 275 #define M3_MAX_DRAW_NUM_VLINE ((DSP_TFT_WIDTH / M3_INTERVAL_VLINE) + 1u)
1050186 4:2672de88a46b 276
1050186 4:2672de88a46b 277 /* Fixed character string. */
1050186 4:2672de88a46b 278 /* The maximum length of the file name in case of the display. */
1050186 4:2672de88a46b 279 #define FILE_NAME_MAX_LEN (25)
1050186 4:2672de88a46b 280
1050186 4:2672de88a46b 281 /* The mark of eighth note */
1050186 4:2672de88a46b 282 #define STR_EIGHTH_NOTE "\x1"
1050186 4:2672de88a46b 283
1050186 4:2672de88a46b 284 /* The number of key picture */
1050186 4:2672de88a46b 285 #define KEY_PIC_NUM (5)
1050186 4:2672de88a46b 286
1050186 4:2672de88a46b 287 /* Converts the playback time. */
1050186 4:2672de88a46b 288 #define HOUR_TO_SEC (3600u) /* Coefficient for conversion from hour to seconds. */
1050186 4:2672de88a46b 289 #define MIN_TO_SEC (60u) /* Coefficient for conversion from minute to seconds. */
1050186 4:2672de88a46b 290
1050186 4:2672de88a46b 291 static uint32_t get_time_hour(const uint32_t play_time);
1050186 4:2672de88a46b 292 static uint32_t get_time_min(const uint32_t play_time);
1050186 4:2672de88a46b 293 static uint32_t get_time_sec(const uint32_t play_time);
1050186 4:2672de88a46b 294 static uint32_t make_scrn_mode(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 295 const dsp_tft_ctrl_t * const p_tft);
1050186 4:2672de88a46b 296 static uint32_t make_scrn_mode1(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 297 const dsp_tft_ctrl_t * const p_tft);
1050186 4:2672de88a46b 298 static uint32_t make_scrn_mode2(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 299 const dsp_tft_ctrl_t * const p_tft);
1050186 4:2672de88a46b 300 static uint32_t make_scrn_mode3(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 301 const dsp_tft_ctrl_t * const p_tft);
1050186 4:2672de88a46b 302 static void draw_audio_wave(const dsp_tftlayer_t * const p_info, const int32_t start_x,
1050186 4:2672de88a46b 303 const int32_t start_y, const int32_t size_x, const int16_t audio_value, const uint32_t col_data);
1050186 4:2672de88a46b 304 static bool is_playbar_output(const SYS_PlayStat stat);
1050186 4:2672de88a46b 305
1050186 4:2672de88a46b 306 void dsp_init_tft_scrn(dsp_tft_ctrl_t * const p_tft)
1050186 4:2672de88a46b 307 {
1050186 4:2672de88a46b 308 if (p_tft != NULL) {
1050186 4:2672de88a46b 309 p_tft->disp_phase_no = SCRN_PHASE_INIT1;
1050186 4:2672de88a46b 310 dsp_clear_tft_audio_data(p_tft);
1050186 4:2672de88a46b 311 }
1050186 4:2672de88a46b 312 }
1050186 4:2672de88a46b 313
1050186 4:2672de88a46b 314 uint32_t dsp_make_tft_scrn(const dsp_com_ctrl_t * const p_com, dsp_tft_ctrl_t * const p_tft)
1050186 4:2672de88a46b 315 {
1050186 4:2672de88a46b 316 uint32_t ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 317 int32_t img_id;
1050186 4:2672de88a46b 318 uint32_t cnt_x;
1050186 4:2672de88a46b 319 uint32_t offset_x;
1050186 4:2672de88a46b 320 char_t str[DSP_DISP_STR_MAX_LEN];
1050186 4:2672de88a46b 321
1050186 4:2672de88a46b 322 if ((p_com != NULL) && (p_tft != NULL)) {
1050186 4:2672de88a46b 323 switch (p_tft->disp_phase_no) {
1050186 4:2672de88a46b 324 case SCRN_PHASE_INIT1:
1050186 4:2672de88a46b 325 case SCRN_PHASE_INIT13:
1050186 4:2672de88a46b 326 /* Outputs the picture. */
1050186 4:2672de88a46b 327 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_BACK1,
1050186 4:2672de88a46b 328 YPOS_BACK1, DSP_IMG_ID_BACK1, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 329 break;
1050186 4:2672de88a46b 330 case SCRN_PHASE_INIT2:
1050186 4:2672de88a46b 331 case SCRN_PHASE_INIT14:
1050186 4:2672de88a46b 332 /* Outputs the picture. */
1050186 4:2672de88a46b 333 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_BACK2,
1050186 4:2672de88a46b 334 YPOS_BACK2, DSP_IMG_ID_BACK2, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 335 break;
1050186 4:2672de88a46b 336 case SCRN_PHASE_INIT3:
1050186 4:2672de88a46b 337 case SCRN_PHASE_INIT15:
1050186 4:2672de88a46b 338 /* Outputs the picture. */
1050186 4:2672de88a46b 339 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_BACK3,
1050186 4:2672de88a46b 340 YPOS_BACK3, DSP_IMG_ID_BACK3, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 341 break;
1050186 4:2672de88a46b 342 case SCRN_PHASE_INIT4:
1050186 4:2672de88a46b 343 case SCRN_PHASE_INIT16:
1050186 4:2672de88a46b 344 /* Outputs the picture. */
1050186 4:2672de88a46b 345 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_BACK4,
1050186 4:2672de88a46b 346 YPOS_BACK4, DSP_IMG_ID_BACK4, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 347 break;
1050186 4:2672de88a46b 348 case SCRN_PHASE_INIT5:
1050186 4:2672de88a46b 349 case SCRN_PHASE_INIT17:
1050186 4:2672de88a46b 350 /* Outputs the picture. */
1050186 4:2672de88a46b 351 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_BACK5,
1050186 4:2672de88a46b 352 YPOS_BACK5, DSP_IMG_ID_BACK5, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 353 break;
1050186 4:2672de88a46b 354 case SCRN_PHASE_INIT6:
1050186 4:2672de88a46b 355 case SCRN_PHASE_INIT18:
1050186 4:2672de88a46b 356 /* Outputs the picture. */
1050186 4:2672de88a46b 357 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_BACK6,
1050186 4:2672de88a46b 358 YPOS_BACK6, DSP_IMG_ID_BACK6, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 359 break;
1050186 4:2672de88a46b 360 case SCRN_PHASE_INIT7:
1050186 4:2672de88a46b 361 case SCRN_PHASE_INIT19:
1050186 4:2672de88a46b 362 /* Outputs the picture. */
1050186 4:2672de88a46b 363 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_AUDIO_WINDOW1,
1050186 4:2672de88a46b 364 YPOS_AUDIO_WINDOW1, DSP_IMG_ID_AUDIO_WINDOW1, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 365 break;
1050186 4:2672de88a46b 366 case SCRN_PHASE_INIT8:
1050186 4:2672de88a46b 367 case SCRN_PHASE_INIT20:
1050186 4:2672de88a46b 368 /* Outputs the picture. */
1050186 4:2672de88a46b 369 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_AUDIO_WINDOW2,
1050186 4:2672de88a46b 370 YPOS_AUDIO_WINDOW2, DSP_IMG_ID_AUDIO_WINDOW2, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 371 break;
1050186 4:2672de88a46b 372 case SCRN_PHASE_INIT9:
1050186 4:2672de88a46b 373 case SCRN_PHASE_INIT21:
1050186 4:2672de88a46b 374 /* Outputs the picture. */
1050186 4:2672de88a46b 375 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_AUDIO_WINDOW3,
1050186 4:2672de88a46b 376 YPOS_AUDIO_WINDOW3, DSP_IMG_ID_AUDIO_WINDOW3, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 377 break;
1050186 4:2672de88a46b 378 case SCRN_PHASE_INIT10:
1050186 4:2672de88a46b 379 case SCRN_PHASE_INIT22:
1050186 4:2672de88a46b 380 /* Outputs the picture. */
1050186 4:2672de88a46b 381 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_AUDIO_WINDOW4,
1050186 4:2672de88a46b 382 YPOS_AUDIO_WINDOW4, DSP_IMG_ID_AUDIO_WINDOW4, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 383 break;
1050186 4:2672de88a46b 384 case SCRN_PHASE_INIT11:
1050186 4:2672de88a46b 385 case SCRN_PHASE_INIT23:
1050186 4:2672de88a46b 386 /* Outputs the picture. */
1050186 4:2672de88a46b 387 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_AUDIO_BAR,
1050186 4:2672de88a46b 388 YPOS_AUDIO_BAR, DSP_IMG_ID_AUDIO_BAR, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 389 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_MODE,
1050186 4:2672de88a46b 390 YPOS_MODE, DSP_IMG_ID_MODE, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 391 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_TV,
1050186 4:2672de88a46b 392 YPOS_TV, DSP_IMG_ID_TV, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 393
1050186 4:2672de88a46b 394 dsp_clear_all(&p_tft->tft_info[DSP_TFT_LAYER_1]);
1050186 4:2672de88a46b 395 ret = DSP_TFT_LAYER_1;
1050186 4:2672de88a46b 396 break;
1050186 4:2672de88a46b 397 case SCRN_PHASE_INIT12:
1050186 4:2672de88a46b 398 case SCRN_PHASE_INIT24:
1050186 4:2672de88a46b 399 /* Outputs the picture. */
1050186 4:2672de88a46b 400 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_AUDIO,
1050186 4:2672de88a46b 401 YPOS_AUDIO, DSP_IMG_ID_AUDIO, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 402 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_0], XPOS_RENESAS,
1050186 4:2672de88a46b 403 YPOS_RENESAS, DSP_IMG_ID_RENESAS, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 404 ret = DSP_TFT_LAYER_0;
1050186 4:2672de88a46b 405 break;
1050186 4:2672de88a46b 406 case SCRN_PHASE_NORM1:
1050186 4:2672de88a46b 407 /* Outputs the picture. */
1050186 4:2672de88a46b 408 /* Prev key */
1050186 4:2672de88a46b 409 if (p_tft->key_code == SYS_KEYCODE_PREV) {
1050186 4:2672de88a46b 410 img_id = DSP_IMG_ID_AUDIO_BUTTON1D;
1050186 4:2672de88a46b 411 } else {
1050186 4:2672de88a46b 412 img_id = DSP_IMG_ID_AUDIO_BUTTON1;
1050186 4:2672de88a46b 413 }
1050186 4:2672de88a46b 414 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_BUTTON1,
1050186 4:2672de88a46b 415 YPOS_BUTTON1, img_id, DSP_IMG_FORM_ARGB8888_NO_BLEND);
1050186 4:2672de88a46b 416 break;
1050186 4:2672de88a46b 417 case SCRN_PHASE_NORM2:
1050186 4:2672de88a46b 418 /* Outputs the picture. */
1050186 4:2672de88a46b 419 /* Play/Pause key */
1050186 4:2672de88a46b 420 if (p_tft->key_code == SYS_KEYCODE_PLAYPAUSE) {
1050186 4:2672de88a46b 421 img_id = DSP_IMG_ID_AUDIO_BUTTON2D;
1050186 4:2672de88a46b 422 } else {
1050186 4:2672de88a46b 423 img_id = DSP_IMG_ID_AUDIO_BUTTON2;
1050186 4:2672de88a46b 424 }
1050186 4:2672de88a46b 425 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_BUTTON2,
1050186 4:2672de88a46b 426 YPOS_BUTTON2, img_id, DSP_IMG_FORM_ARGB8888_NO_BLEND);
1050186 4:2672de88a46b 427 break;
1050186 4:2672de88a46b 428 case SCRN_PHASE_NORM3:
1050186 4:2672de88a46b 429 /* Outputs the picture. */
1050186 4:2672de88a46b 430 /* Next key */
1050186 4:2672de88a46b 431 if (p_tft->key_code == SYS_KEYCODE_NEXT) {
1050186 4:2672de88a46b 432 img_id = DSP_IMG_ID_AUDIO_BUTTON3D;
1050186 4:2672de88a46b 433 } else {
1050186 4:2672de88a46b 434 img_id = DSP_IMG_ID_AUDIO_BUTTON3;
1050186 4:2672de88a46b 435 }
1050186 4:2672de88a46b 436 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_BUTTON3,
1050186 4:2672de88a46b 437 YPOS_BUTTON3, img_id, DSP_IMG_FORM_ARGB8888_NO_BLEND);
1050186 4:2672de88a46b 438 break;
1050186 4:2672de88a46b 439 case SCRN_PHASE_NORM4:
1050186 4:2672de88a46b 440 /* Outputs the picture. */
1050186 4:2672de88a46b 441 /* Repeat key */
1050186 4:2672de88a46b 442 if (p_tft->key_code == SYS_KEYCODE_REPEAT) {
1050186 4:2672de88a46b 443 img_id = DSP_IMG_ID_AUDIO_BUTTON4D;
1050186 4:2672de88a46b 444 } else {
1050186 4:2672de88a46b 445 img_id = DSP_IMG_ID_AUDIO_BUTTON4;
1050186 4:2672de88a46b 446 }
1050186 4:2672de88a46b 447 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_BUTTON4,
1050186 4:2672de88a46b 448 YPOS_BUTTON4, img_id, DSP_IMG_FORM_ARGB8888_NO_BLEND);
1050186 4:2672de88a46b 449 break;
1050186 4:2672de88a46b 450 case SCRN_PHASE_NORM5:
1050186 4:2672de88a46b 451 /* Clears the img_audio_window picture area. */
1050186 4:2672de88a46b 452 dsp_clear_area(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_AUDIO_WINDOW1,
1050186 4:2672de88a46b 453 YPOS_AUDIO_WINDOW1, DSP_IMG_WS_AUDIO_WINDOW, DSP_IMG_HS_AUDIO_WINDOW);
1050186 4:2672de88a46b 454 /* Outputs the picture of the play bar. */
1050186 4:2672de88a46b 455 if (is_playbar_output(p_com->play_stat) == true) {
1050186 4:2672de88a46b 456 /* The bar indicates the position of current playback time */
1050186 4:2672de88a46b 457 /* in total playback time. */
1050186 4:2672de88a46b 458 if (p_com->total_time != 0u) {
1050186 4:2672de88a46b 459 offset_x = (MOV_RANGE_BAR * p_com->play_time) / p_com->total_time;
1050186 4:2672de88a46b 460 } else {
1050186 4:2672de88a46b 461 offset_x = 0u;
1050186 4:2672de88a46b 462 }
1050186 4:2672de88a46b 463 /* LEFT */
1050186 4:2672de88a46b 464 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_BAR_LEFT,
1050186 4:2672de88a46b 465 YPOS_BAR_LEFT, DSP_IMG_ID_BAR_LEFT, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 466 /* MID */
1050186 4:2672de88a46b 467 for (cnt_x = 0; cnt_x < offset_x; cnt_x += DSP_IMG_WS_BAR_MID) {
1050186 4:2672de88a46b 468 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_BAR_MID + (int32_t)cnt_x,
1050186 4:2672de88a46b 469 YPOS_BAR_MID, DSP_IMG_ID_BAR_MID, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 470 }
1050186 4:2672de88a46b 471 /* RIGHT */
1050186 4:2672de88a46b 472 dsp_draw_picture(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_BAR_RIGHT + (int32_t)offset_x,
1050186 4:2672de88a46b 473 YPOS_BAR_RIGHT, DSP_IMG_ID_BAR_RIGHT, DSP_IMG_FORM_AUTOSEL);
1050186 4:2672de88a46b 474 }
1050186 4:2672de88a46b 475
1050186 4:2672de88a46b 476 ret = make_scrn_mode(p_com, p_tft);
1050186 4:2672de88a46b 477 break;
1050186 4:2672de88a46b 478 case SCRN_PHASE_NORM6:
1050186 4:2672de88a46b 479 /* Clears the img_tv picture area. */
1050186 4:2672de88a46b 480 dsp_clear_area(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_TV,
1050186 4:2672de88a46b 481 YPOS_TV, DSP_IMG_WS_TV, DSP_IMG_HS_TV);
1050186 4:2672de88a46b 482 /* Outputs a display mode number. */
1050186 4:2672de88a46b 483 (void) sprintf(str, MSG_FORM_MODE, p_com->disp_mode);
1050186 4:2672de88a46b 484 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1], XPOS_MODE_NUMBER, YPOS_MODE_NUMBER, str);
1050186 4:2672de88a46b 485
1050186 4:2672de88a46b 486 ret = make_scrn_mode(p_com, p_tft);
1050186 4:2672de88a46b 487 break;
1050186 4:2672de88a46b 488 default:
1050186 4:2672de88a46b 489 ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 490 break;
1050186 4:2672de88a46b 491 }
1050186 4:2672de88a46b 492
1050186 4:2672de88a46b 493 if (p_tft->disp_phase_no < SCRN_PHASE_NORM6) {
1050186 4:2672de88a46b 494 p_tft->disp_phase_no++;
1050186 4:2672de88a46b 495 } else {
1050186 4:2672de88a46b 496 p_tft->disp_phase_no = SCRN_PHASE_NORM1;
1050186 4:2672de88a46b 497 }
1050186 4:2672de88a46b 498 }
1050186 4:2672de88a46b 499 return ret;
1050186 4:2672de88a46b 500 }
1050186 4:2672de88a46b 501
1050186 4:2672de88a46b 502 SYS_KeyCode dsp_convert_key_tft_scrn(const uint32_t pos_x, const uint32_t pos_y)
1050186 4:2672de88a46b 503 {
1050186 4:2672de88a46b 504 static const dsp_cnv_key_t cnv_tbl[KEY_PIC_NUM] = {
1050186 4:2672de88a46b 505 { /* Prev key */
1050186 4:2672de88a46b 506 XPOS_BUTTON1, /* X position */
1050186 4:2672de88a46b 507 YPOS_BUTTON1, /* Y position */
1050186 4:2672de88a46b 508 DSP_IMG_WS_AUDIO_BUTTON1, /* Width size */
1050186 4:2672de88a46b 509 DSP_IMG_HS_AUDIO_BUTTON1, /* Height size */
1050186 4:2672de88a46b 510 SYS_KEYCODE_PREV /* Key code */
1050186 4:2672de88a46b 511 },
1050186 4:2672de88a46b 512 { /* Play/Pause key */
1050186 4:2672de88a46b 513 XPOS_BUTTON2, /* X position */
1050186 4:2672de88a46b 514 YPOS_BUTTON2, /* Y position */
1050186 4:2672de88a46b 515 DSP_IMG_WS_AUDIO_BUTTON2, /* Width size */
1050186 4:2672de88a46b 516 DSP_IMG_HS_AUDIO_BUTTON2, /* Height size */
1050186 4:2672de88a46b 517 SYS_KEYCODE_PLAYPAUSE /* Key code */
1050186 4:2672de88a46b 518 },
1050186 4:2672de88a46b 519 { /* Next key */
1050186 4:2672de88a46b 520 XPOS_BUTTON3, /* X position */
1050186 4:2672de88a46b 521 YPOS_BUTTON3, /* Y position */
1050186 4:2672de88a46b 522 DSP_IMG_WS_AUDIO_BUTTON3, /* Width size */
1050186 4:2672de88a46b 523 DSP_IMG_HS_AUDIO_BUTTON3, /* Height size */
1050186 4:2672de88a46b 524 SYS_KEYCODE_NEXT /* Key code */
1050186 4:2672de88a46b 525 },
1050186 4:2672de88a46b 526 { /* Repeat key */
1050186 4:2672de88a46b 527 XPOS_BUTTON4, /* X position */
1050186 4:2672de88a46b 528 YPOS_BUTTON4, /* Y position */
1050186 4:2672de88a46b 529 DSP_IMG_WS_AUDIO_BUTTON4, /* Width size */
1050186 4:2672de88a46b 530 DSP_IMG_HS_AUDIO_BUTTON4, /* Height size */
1050186 4:2672de88a46b 531 SYS_KEYCODE_REPEAT /* Key code */
1050186 4:2672de88a46b 532 },
1050186 4:2672de88a46b 533 { /* Mode key */
1050186 4:2672de88a46b 534 XPOS_MODE, /* X position */
1050186 4:2672de88a46b 535 YPOS_MODE, /* Y position */
1050186 4:2672de88a46b 536 DSP_IMG_WS_MODE, /* Width size */
1050186 4:2672de88a46b 537 DSP_IMG_HS_MODE, /* Height size */
1050186 4:2672de88a46b 538 SYS_KEYCODE_MODE /* Key code */
1050186 4:2672de88a46b 539 }
1050186 4:2672de88a46b 540 };
1050186 4:2672de88a46b 541 int32_t i;
1050186 4:2672de88a46b 542 SYS_KeyCode ret;
1050186 4:2672de88a46b 543
1050186 4:2672de88a46b 544 ret = SYS_KEYCODE_NON;
1050186 4:2672de88a46b 545 for (i = 0; (i < KEY_PIC_NUM) && (ret == SYS_KEYCODE_NON); i++) {
1050186 4:2672de88a46b 546 /* Is X position within the picture of key? */
1050186 4:2672de88a46b 547 if ((pos_x >= cnv_tbl[i].pic_pos_x) &&
1050186 4:2672de88a46b 548 (pos_x <= (cnv_tbl[i].pic_pos_x + cnv_tbl[i].pic_siz_x))) {
1050186 4:2672de88a46b 549 /* Is Y position within the picture of key? */
1050186 4:2672de88a46b 550 if ((pos_y >= cnv_tbl[i].pic_pos_y) &&
1050186 4:2672de88a46b 551 (pos_y <= (cnv_tbl[i].pic_pos_y + cnv_tbl[i].pic_siz_y))) {
1050186 4:2672de88a46b 552 /* Decides the key code. */
1050186 4:2672de88a46b 553 ret = cnv_tbl[i].key_code;
1050186 4:2672de88a46b 554 }
1050186 4:2672de88a46b 555 }
1050186 4:2672de88a46b 556 }
1050186 4:2672de88a46b 557 return ret;
1050186 4:2672de88a46b 558 }
1050186 4:2672de88a46b 559
1050186 4:2672de88a46b 560 /** Creates the display image of playback screen.
1050186 4:2672de88a46b 561 *
1050186 4:2672de88a46b 562 * @param p_com Pointer to common data in all module.
1050186 4:2672de88a46b 563 * @param p_tft Pointer to management data of TFT module.
1050186 4:2672de88a46b 564 *
1050186 4:2672de88a46b 565 * @returns
1050186 4:2672de88a46b 566 * Returns the number of the display layer to update.
1050186 4:2672de88a46b 567 */
1050186 4:2672de88a46b 568 static uint32_t make_scrn_mode(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 569 const dsp_tft_ctrl_t * const p_tft)
1050186 4:2672de88a46b 570 {
1050186 4:2672de88a46b 571 uint32_t ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 572
1050186 4:2672de88a46b 573 if ((p_com != NULL) && (p_tft != NULL)) {
1050186 4:2672de88a46b 574 switch (p_com->disp_mode) {
1050186 4:2672de88a46b 575 case DSP_DISPMODE_1:
1050186 4:2672de88a46b 576 ret = make_scrn_mode1(p_com, p_tft);
1050186 4:2672de88a46b 577 break;
1050186 4:2672de88a46b 578 case DSP_DISPMODE_2:
1050186 4:2672de88a46b 579 ret = make_scrn_mode2(p_com, p_tft);
1050186 4:2672de88a46b 580 break;
1050186 4:2672de88a46b 581 case DSP_DISPMODE_3:
1050186 4:2672de88a46b 582 ret = make_scrn_mode3(p_com, p_tft);
1050186 4:2672de88a46b 583 break;
1050186 4:2672de88a46b 584 default:
1050186 4:2672de88a46b 585 ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 586 break;
1050186 4:2672de88a46b 587 }
1050186 4:2672de88a46b 588 }
1050186 4:2672de88a46b 589 return ret;
1050186 4:2672de88a46b 590 }
1050186 4:2672de88a46b 591
1050186 4:2672de88a46b 592 /** Creates the display image of TFT display mode 1.
1050186 4:2672de88a46b 593 *
1050186 4:2672de88a46b 594 * @param p_com Pointer to common data in all module.
1050186 4:2672de88a46b 595 * @param p_tft Pointer to management data of TFT module.
1050186 4:2672de88a46b 596 *
1050186 4:2672de88a46b 597 * @returns
1050186 4:2672de88a46b 598 * Returns the number of the display layer to update.
1050186 4:2672de88a46b 599 */
1050186 4:2672de88a46b 600 static uint32_t make_scrn_mode1(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 601 const dsp_tft_ctrl_t * const p_tft)
1050186 4:2672de88a46b 602 {
1050186 4:2672de88a46b 603 uint32_t ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 604 uint32_t time_h;
1050186 4:2672de88a46b 605 uint32_t time_m;
1050186 4:2672de88a46b 606 uint32_t time_s;
1050186 4:2672de88a46b 607 char_t str[DSP_DISP_STR_MAX_LEN];
1050186 4:2672de88a46b 608 const char_t *p_str;
1050186 4:2672de88a46b 609
1050186 4:2672de88a46b 610 if ((p_com != NULL) && (p_tft != NULL)) {
1050186 4:2672de88a46b 611 switch (p_tft->disp_phase_no) {
1050186 4:2672de88a46b 612 case SCRN_PHASE_NORM5:
1050186 4:2672de88a46b 613 /* Outputs the mark of eighth note. */
1050186 4:2672de88a46b 614 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 615 M1_XPOS_EIGHTH_NOTE, M1_YPOS_EIGHTH_NOTE, STR_EIGHTH_NOTE);
1050186 4:2672de88a46b 616
1050186 4:2672de88a46b 617 /* Outputs a file name in less than 25 characters. */
1050186 4:2672de88a46b 618 (void) strncpy(str, p_com->file_name, FILE_NAME_MAX_LEN);
1050186 4:2672de88a46b 619 str[FILE_NAME_MAX_LEN] = '\0';
1050186 4:2672de88a46b 620 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 621 M1_XPOS_FILE_NAME, M1_YPOS_FILE_NAME, str);
1050186 4:2672de88a46b 622 break;
1050186 4:2672de88a46b 623 case SCRN_PHASE_NORM6:
1050186 4:2672de88a46b 624 /* Outputs the file number. */
1050186 4:2672de88a46b 625 (void) sprintf(str, M1_MSG_FORM_FILE_NUM, p_com->track_id);
1050186 4:2672de88a46b 626 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 627 M1_XPOS_FILE_NUM, M1_YPOS_FILE_NUM, str);
1050186 4:2672de88a46b 628
1050186 4:2672de88a46b 629 /* Outputs the playback time. */
1050186 4:2672de88a46b 630 time_h = get_time_hour(p_com->play_time);
1050186 4:2672de88a46b 631 time_m = get_time_min(p_com->play_time);
1050186 4:2672de88a46b 632 time_s = get_time_sec(p_com->play_time);
1050186 4:2672de88a46b 633 (void) sprintf(str, M1_MSG_FORM_PLAY_TIME, time_h, time_m, time_s);
1050186 4:2672de88a46b 634 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 635 M1_XPOS_PLAY_TIME, M1_YPOS_PLAY_TIME, str);
1050186 4:2672de88a46b 636
1050186 4:2672de88a46b 637 /* Outputs the total playback time. */
1050186 4:2672de88a46b 638 time_h = get_time_hour(p_com->total_time);
1050186 4:2672de88a46b 639 time_m = get_time_min(p_com->total_time);
1050186 4:2672de88a46b 640 time_s = get_time_sec(p_com->total_time);
1050186 4:2672de88a46b 641 (void) sprintf(str, M1_MSG_FORM_TOTAL_TIME, time_h, time_m, time_s);
1050186 4:2672de88a46b 642 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 643 M1_XPOS_TOTAL_TIME, M1_YPOS_TOTAL_TIME, str);
1050186 4:2672de88a46b 644
1050186 4:2672de88a46b 645 /* Outputs the playback information. */
1050186 4:2672de88a46b 646 if ((p_com->channel > 0u) && (p_com->samp_freq > 0u)) {
1050186 4:2672de88a46b 647 if (p_com->channel == 1u) {
1050186 4:2672de88a46b 648 p_str = M1_STR_CHANNEL_MONO;
1050186 4:2672de88a46b 649 } else {
1050186 4:2672de88a46b 650 p_str = M1_STR_CHANNEL_STEREO;
1050186 4:2672de88a46b 651 }
1050186 4:2672de88a46b 652 (void) sprintf(str, M1_MSG_FORM_PLAY_INFO, p_com->samp_freq, p_str);
1050186 4:2672de88a46b 653 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 654 M1_XPOS_PLAY_INFO, M1_YPOS_PLAY_INFO, str);
1050186 4:2672de88a46b 655 }
1050186 4:2672de88a46b 656 ret = DSP_TFT_LAYER_1;
1050186 4:2672de88a46b 657 break;
1050186 4:2672de88a46b 658 default:
1050186 4:2672de88a46b 659 ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 660 break;
1050186 4:2672de88a46b 661 }
1050186 4:2672de88a46b 662 }
1050186 4:2672de88a46b 663 return ret;
1050186 4:2672de88a46b 664 }
1050186 4:2672de88a46b 665
1050186 4:2672de88a46b 666 /** Creates the display image of TFT display mode 2.
1050186 4:2672de88a46b 667 *
1050186 4:2672de88a46b 668 * @param p_com Pointer to common data in all module.
1050186 4:2672de88a46b 669 * @param p_tft Pointer to management data of TFT module.
1050186 4:2672de88a46b 670 *
1050186 4:2672de88a46b 671 * @returns
1050186 4:2672de88a46b 672 * Returns the number of the display layer to update.
1050186 4:2672de88a46b 673 */
1050186 4:2672de88a46b 674 static uint32_t make_scrn_mode2(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 675 const dsp_tft_ctrl_t * const p_tft)
1050186 4:2672de88a46b 676 {
1050186 4:2672de88a46b 677 uint32_t ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 678 uint32_t time_h;
1050186 4:2672de88a46b 679 uint32_t time_m;
1050186 4:2672de88a46b 680 uint32_t time_s;
1050186 4:2672de88a46b 681 int32_t xpos_offset;
1050186 4:2672de88a46b 682 int32_t buf_id;
1050186 4:2672de88a46b 683 char_t str[DSP_DISP_STR_MAX_LEN];
1050186 4:2672de88a46b 684 const dsp_audio_t *p_aud;
1050186 4:2672de88a46b 685
1050186 4:2672de88a46b 686 if ((p_com != NULL) && (p_tft != NULL)) {
1050186 4:2672de88a46b 687 switch (p_tft->disp_phase_no) {
1050186 4:2672de88a46b 688 case SCRN_PHASE_NORM5:
1050186 4:2672de88a46b 689 /* Outputs the audio wave. */
1050186 4:2672de88a46b 690 p_aud = &p_tft->audio_data;
1050186 4:2672de88a46b 691 buf_id = 0;
1050186 4:2672de88a46b 692 while (buf_id < (int32_t)p_aud->m2_buf_cnt) {
1050186 4:2672de88a46b 693 xpos_offset = buf_id;
1050186 4:2672de88a46b 694 /* L-ch */
1050186 4:2672de88a46b 695 draw_audio_wave(&p_tft->tft_info[DSP_TFT_LAYER_1], M2_XPOS_AUDIO_LCH + xpos_offset,
1050186 4:2672de88a46b 696 M2_YPOS_AUDIO_LCH, M2_XSIZE_AUDIO_LCH, p_aud->m2_buf[buf_id], M2_COL_AUDIO_LCH);
1050186 4:2672de88a46b 697 buf_id++;
1050186 4:2672de88a46b 698 /* R-ch */
1050186 4:2672de88a46b 699 draw_audio_wave(&p_tft->tft_info[DSP_TFT_LAYER_1], M2_XPOS_AUDIO_RCH + xpos_offset,
1050186 4:2672de88a46b 700 M2_YPOS_AUDIO_RCH, M2_XSIZE_AUDIO_RCH, p_aud->m2_buf[buf_id], M2_COL_AUDIO_RCH);
1050186 4:2672de88a46b 701 buf_id++;
1050186 4:2672de88a46b 702 }
1050186 4:2672de88a46b 703 /* Outputs the center line. */
1050186 4:2672de88a46b 704 dsp_fill_rect(&p_tft->tft_info[DSP_TFT_LAYER_1], M2_XPOS_VLINE,
1050186 4:2672de88a46b 705 M2_YPOS_VLINE, M2_XSIZE_VLINE, M2_YSIZE_VLINE, M2_COL_VLINE);
1050186 4:2672de88a46b 706 dsp_fill_rect(&p_tft->tft_info[DSP_TFT_LAYER_1], M2_XPOS_HLINE,
1050186 4:2672de88a46b 707 M2_YPOS_HLINE, M2_XSIZE_HLINE, M2_YSIZE_HLINE, M2_COL_HLINE);
1050186 4:2672de88a46b 708 break;
1050186 4:2672de88a46b 709 case SCRN_PHASE_NORM6:
1050186 4:2672de88a46b 710 /* Outputs the text of the channel. */
1050186 4:2672de88a46b 711 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 712 M2_XPOS_TEXT_LCH, M2_YPOS_TEXT_LCH, M2_STR_TEXT_LCH);
1050186 4:2672de88a46b 713 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 714 M2_XPOS_TEXT_RCH, M2_YPOS_TEXT_RCH, M2_STR_TEXT_RCH);
1050186 4:2672de88a46b 715
1050186 4:2672de88a46b 716 /* Outputs the file number. */
1050186 4:2672de88a46b 717 (void) sprintf(str, M2_MSG_FORM_FILE_NUM, p_com->track_id);
1050186 4:2672de88a46b 718 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 719 M2_XPOS_FILE_NUM, M2_YPOS_FILE_NUM, str);
1050186 4:2672de88a46b 720
1050186 4:2672de88a46b 721 /* Outputs the playback time. */
1050186 4:2672de88a46b 722 time_h = get_time_hour(p_com->play_time);
1050186 4:2672de88a46b 723 time_m = get_time_min(p_com->play_time);
1050186 4:2672de88a46b 724 time_s = get_time_sec(p_com->play_time);
1050186 4:2672de88a46b 725 (void) sprintf(str, M2_MSG_FORM_PLAY_TIME, time_h, time_m, time_s);
1050186 4:2672de88a46b 726 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 727 M2_XPOS_PLAY_TIME, M2_YPOS_PLAY_TIME, str);
1050186 4:2672de88a46b 728 ret = DSP_TFT_LAYER_1;
1050186 4:2672de88a46b 729 break;
1050186 4:2672de88a46b 730 default:
1050186 4:2672de88a46b 731 ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 732 break;
1050186 4:2672de88a46b 733 }
1050186 4:2672de88a46b 734 }
1050186 4:2672de88a46b 735 return ret;
1050186 4:2672de88a46b 736 }
1050186 4:2672de88a46b 737
1050186 4:2672de88a46b 738 /** Creates the display image of TFT display mode 3.
1050186 4:2672de88a46b 739 *
1050186 4:2672de88a46b 740 * @param p_com Pointer to common data in all module.
1050186 4:2672de88a46b 741 * @param p_tft Pointer to management data of TFT module.
1050186 4:2672de88a46b 742 *
1050186 4:2672de88a46b 743 * @returns
1050186 4:2672de88a46b 744 * Returns the number of the display layer to update.
1050186 4:2672de88a46b 745 */
1050186 4:2672de88a46b 746 static uint32_t make_scrn_mode3(const dsp_com_ctrl_t * const p_com,
1050186 4:2672de88a46b 747 const dsp_tft_ctrl_t * const p_tft)
1050186 4:2672de88a46b 748 {
1050186 4:2672de88a46b 749 uint32_t ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 750 uint32_t i;
1050186 4:2672de88a46b 751 uint32_t time_h;
1050186 4:2672de88a46b 752 uint32_t time_m;
1050186 4:2672de88a46b 753 uint32_t time_s;
1050186 4:2672de88a46b 754 uint32_t xpos_time;
1050186 4:2672de88a46b 755 int32_t xpos_offset;
1050186 4:2672de88a46b 756 int32_t mod;
1050186 4:2672de88a46b 757 char_t str[DSP_DISP_STR_MAX_LEN];
1050186 4:2672de88a46b 758 const dsp_audio_t *p_aud;
1050186 4:2672de88a46b 759
1050186 4:2672de88a46b 760 if ((p_com != NULL) && (p_tft != NULL)) {
1050186 4:2672de88a46b 761 switch (p_tft->disp_phase_no) {
1050186 4:2672de88a46b 762 case SCRN_PHASE_NORM5:
1050186 4:2672de88a46b 763 p_aud = &p_tft->audio_data;
1050186 4:2672de88a46b 764 for (i = 0u; i < p_aud->m3_buf_cnt; i++) {
1050186 4:2672de88a46b 765 draw_audio_wave(&p_tft->tft_info[DSP_TFT_LAYER_1], M3_XPOS_AUDIO + (int32_t) i,
1050186 4:2672de88a46b 766 M3_YPOS_AUDIO, M3_XSIZE_AUDIO, p_aud->m3_buf[i], M3_COL_AUDIO);
1050186 4:2672de88a46b 767 }
1050186 4:2672de88a46b 768 /* Calculates the display position. */
1050186 4:2672de88a46b 769 if (p_aud->m3_sample_cnt < DSP_TFT_M3_AUDIO_BUF_SIZE) {
1050186 4:2672de88a46b 770 xpos_offset = 0;
1050186 4:2672de88a46b 771 xpos_time = 0u;
1050186 4:2672de88a46b 772 } else {
1050186 4:2672de88a46b 773 mod = (int32_t) (p_aud->m3_sample_cnt % M3_INTERVAL_VLINE);
1050186 4:2672de88a46b 774 xpos_offset = -mod;
1050186 4:2672de88a46b 775 /* Calculates the current time. */
1050186 4:2672de88a46b 776 time_s = (p_aud->m3_sample_cnt - DSP_TFT_M3_AUDIO_BUF_SIZE) - (uint32_t) mod;
1050186 4:2672de88a46b 777 xpos_time = time_s / DSP_TFT_M3_AUDIO_SAMPLE_PER_SEC;
1050186 4:2672de88a46b 778 }
1050186 4:2672de88a46b 779 for (i = 0u; i < M3_MAX_DRAW_NUM_VLINE; i++) {
1050186 4:2672de88a46b 780 /* Outputs the vertical line. */
1050186 4:2672de88a46b 781 dsp_fill_rect(&p_tft->tft_info[DSP_TFT_LAYER_1], M3_XPOS_VLINE + xpos_offset,
1050186 4:2672de88a46b 782 M3_YPOS_VLINE, M3_XSIZE_VLINE, M3_YSIZE_VLINE, M3_COL_VLINE);
1050186 4:2672de88a46b 783 /* Outputs the playback time. */
1050186 4:2672de88a46b 784 time_h = get_time_hour(xpos_time);
1050186 4:2672de88a46b 785 time_m = get_time_min(xpos_time);
1050186 4:2672de88a46b 786 time_s = get_time_sec(xpos_time);
1050186 4:2672de88a46b 787 (void) sprintf(str, M3_MSG_FORM_PLAY_TIME, time_h, time_m, time_s);
1050186 4:2672de88a46b 788 dsp_draw_text15x17(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 789 M3_XPOS_PLAY_TIME + xpos_offset, M3_YPOS_PLAY_TIME, str);
1050186 4:2672de88a46b 790 xpos_offset += (int32_t) M3_INTERVAL_VLINE;
1050186 4:2672de88a46b 791 xpos_time += M3_INTERVAL_TIME_SEC;
1050186 4:2672de88a46b 792 }
1050186 4:2672de88a46b 793 break;
1050186 4:2672de88a46b 794 case SCRN_PHASE_NORM6:
1050186 4:2672de88a46b 795 /* Outputs the horizontal line. */
1050186 4:2672de88a46b 796 dsp_fill_rect(&p_tft->tft_info[DSP_TFT_LAYER_1], M3_XPOS_HLINE,
1050186 4:2672de88a46b 797 M3_YPOS_HLINE, M3_XSIZE_HLINE, M3_YSIZE_HLINE, M3_COL_HLINE);
1050186 4:2672de88a46b 798 /* Outputs the file number. */
1050186 4:2672de88a46b 799 (void) sprintf(str, M3_MSG_FORM_FILE_NUM, p_com->track_id);
1050186 4:2672de88a46b 800 dsp_draw_text30x34(&p_tft->tft_info[DSP_TFT_LAYER_1],
1050186 4:2672de88a46b 801 M3_XPOS_FILE_NUM, M3_YPOS_FILE_NUM, str);
1050186 4:2672de88a46b 802 ret = DSP_TFT_LAYER_1;
1050186 4:2672de88a46b 803 break;
1050186 4:2672de88a46b 804 default:
1050186 4:2672de88a46b 805 ret = DSP_TFT_LAYER_NON;
1050186 4:2672de88a46b 806 break;
1050186 4:2672de88a46b 807 }
1050186 4:2672de88a46b 808 }
1050186 4:2672de88a46b 809
1050186 4:2672de88a46b 810 return ret;
1050186 4:2672de88a46b 811 }
1050186 4:2672de88a46b 812
1050186 4:2672de88a46b 813 /** Draws the audio wave to VRAM.
1050186 4:2672de88a46b 814 *
1050186 4:2672de88a46b 815 * @param p_info Pointer to VRAM structure
1050186 4:2672de88a46b 816 * @param start_x Display position X of the picture
1050186 4:2672de88a46b 817 * @param start_y Display position Y of the picture
1050186 4:2672de88a46b 818 * @param size_x The width of the audio wave
1050186 4:2672de88a46b 819 * @param audio_value The value of the audio wave
1050186 4:2672de88a46b 820 * @param col_data Color data of ARGB8888 format
1050186 4:2672de88a46b 821 */
1050186 4:2672de88a46b 822 static void draw_audio_wave(const dsp_tftlayer_t * const p_info, const int32_t start_x,
1050186 4:2672de88a46b 823 const int32_t start_y, const int32_t size_x, const int16_t audio_value, const uint32_t col_data)
1050186 4:2672de88a46b 824 {
1050186 4:2672de88a46b 825 int32_t pos_y;
1050186 4:2672de88a46b 826 int32_t draw_size;
1050186 4:2672de88a46b 827
1050186 4:2672de88a46b 828 if (p_info != NULL) {
1050186 4:2672de88a46b 829 if (audio_value >= 0) {
1050186 4:2672de88a46b 830 pos_y = start_y - audio_value;
1050186 4:2672de88a46b 831 draw_size = audio_value;
1050186 4:2672de88a46b 832 } else {
1050186 4:2672de88a46b 833 pos_y = start_y;
1050186 4:2672de88a46b 834 draw_size = -audio_value;
1050186 4:2672de88a46b 835 }
1050186 4:2672de88a46b 836 dsp_fill_rect(p_info, start_x, pos_y, size_x, draw_size, col_data);
1050186 4:2672de88a46b 837 }
1050186 4:2672de88a46b 838 }
1050186 4:2672de88a46b 839
1050186 4:2672de88a46b 840 /** Gets the playback time. (Hours)
1050186 4:2672de88a46b 841 *
1050186 4:2672de88a46b 842 * @param play_time Playback time
1050186 4:2672de88a46b 843 *
1050186 4:2672de88a46b 844 * @returns
1050186 4:2672de88a46b 845 * Hours
1050186 4:2672de88a46b 846 */
1050186 4:2672de88a46b 847 static uint32_t get_time_hour(const uint32_t play_time)
1050186 4:2672de88a46b 848 {
1050186 4:2672de88a46b 849 return (play_time / HOUR_TO_SEC);
1050186 4:2672de88a46b 850 }
1050186 4:2672de88a46b 851
1050186 4:2672de88a46b 852 /** Gets the playback time. (Minutes)
1050186 4:2672de88a46b 853 *
1050186 4:2672de88a46b 854 * @param play_time Playback time
1050186 4:2672de88a46b 855 *
1050186 4:2672de88a46b 856 * @returns
1050186 4:2672de88a46b 857 * Minutes
1050186 4:2672de88a46b 858 */
1050186 4:2672de88a46b 859 static uint32_t get_time_min(const uint32_t play_time)
1050186 4:2672de88a46b 860 {
1050186 4:2672de88a46b 861 return ((play_time % HOUR_TO_SEC) / MIN_TO_SEC);
1050186 4:2672de88a46b 862 }
1050186 4:2672de88a46b 863
1050186 4:2672de88a46b 864 /** Gets the playback time. (Seconds)
1050186 4:2672de88a46b 865 *
1050186 4:2672de88a46b 866 * @param play_time Playback time
1050186 4:2672de88a46b 867 *
1050186 4:2672de88a46b 868 * @returns
1050186 4:2672de88a46b 869 * Seconds
1050186 4:2672de88a46b 870 */
1050186 4:2672de88a46b 871 static uint32_t get_time_sec(const uint32_t play_time)
1050186 4:2672de88a46b 872 {
1050186 4:2672de88a46b 873 return (play_time % MIN_TO_SEC);
1050186 4:2672de88a46b 874 }
1050186 4:2672de88a46b 875
1050186 4:2672de88a46b 876 /** Checks the output status of play bar.
1050186 4:2672de88a46b 877 *
1050186 4:2672de88a46b 878 * @param stat Playback status
1050186 4:2672de88a46b 879 *
1050186 4:2672de88a46b 880 * @returns
1050186 4:2672de88a46b 881 * true = output the play bar, false = don't output the play bar
1050186 4:2672de88a46b 882 */
1050186 4:2672de88a46b 883 static bool is_playbar_output(const SYS_PlayStat stat)
1050186 4:2672de88a46b 884 {
1050186 4:2672de88a46b 885 bool ret;
1050186 4:2672de88a46b 886
1050186 4:2672de88a46b 887 switch (stat) {
1050186 4:2672de88a46b 888 case SYS_PLAYSTAT_PLAY:
1050186 4:2672de88a46b 889 case SYS_PLAYSTAT_PAUSE:
1050186 4:2672de88a46b 890 ret = true;
1050186 4:2672de88a46b 891 break;
1050186 4:2672de88a46b 892 case SYS_PLAYSTAT_STOP:
1050186 4:2672de88a46b 893 default:
1050186 4:2672de88a46b 894 ret = false;
1050186 4:2672de88a46b 895 break;
1050186 4:2672de88a46b 896 }
1050186 4:2672de88a46b 897 return ret;
1050186 4:2672de88a46b 898 }