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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers disp_tft.h Source File

disp_tft.h

00001 /*******************************************************************************
00002 * DISCLAIMER
00003 * This software is supplied by Renesas Electronics Corporation and is only
00004 * intended for use with Renesas products. No other uses are authorized. This
00005 * software is owned by Renesas Electronics Corporation and is protected under
00006 * all applicable laws, including copyright laws.
00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
00016 * Renesas reserves the right, without notice, to make changes to this software
00017 * and to discontinue the availability of this software. By using this software,
00018 * you agree to the additional terms and conditions found by accessing the
00019 * following link:
00020 * http://www.renesas.com/disclaimer*
00021 * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 
00024 #ifndef DISP_TFT_H
00025 #define DISP_TFT_H
00026 
00027 #include "r_typedefs.h"
00028 #include "display.h"
00029 #include "disp_graphics.h"
00030 
00031 /*--- Macro definition ---*/
00032 /* Display size */
00033 #define DSP_TFT_WIDTH                   (800u)
00034 #define DSP_TFT_HEIGHT                  (480u)
00035 
00036 /* Graphics layer */
00037 #define DSP_TFT_LAYER_0                 (0u)
00038 #define DSP_TFT_LAYER_1                 (1u)
00039 #define DSP_TFT_LAYER_NUM               (2u)
00040 #define DSP_TFT_LAYER_NON               (0xFFFFu)
00041 
00042 #define DSP_TFT_M2_AUDIO_BUF_SIZE       (400u)
00043 #define DSP_TFT_M3_AUDIO_BUF_SIZE       (800u)
00044 
00045 #define DSP_TFT_M3_PROC_COUNT_PER_SEC      (10u) /* Processing number per 1 second */
00046                                                  /* in the case of the display mode 3. */
00047 #define DSP_TFT_M3_AUDIO_SAMPLE_PER_100MS  (4u)  /* Sample number of the audio data per 100ms */
00048                                                  /* in the case of the display mode 3. */
00049 #define DSP_TFT_M3_AUDIO_SAMPLE_PER_SEC    (DSP_TFT_M3_PROC_COUNT_PER_SEC * DSP_TFT_M3_AUDIO_SAMPLE_PER_100MS)
00050 
00051 /*--- User defined types ---*/
00052 typedef struct {
00053     uint32_t        pic_pos_x;          /* Display X position of the key picture. */
00054     uint32_t        pic_pos_y;          /* Display Y position of the key picture. */
00055     uint32_t        pic_siz_x;          /* Width size of the key picture. */
00056     uint32_t        pic_siz_y;          /* Height size of the key picture. */
00057     SYS_KeyCode     key_code;           /* Key code of the key picture. */
00058 } dsp_cnv_key_t;
00059 
00060 typedef struct {
00061     uint32_t        req_cyc_cnt;        /* Cycle counter of audio data acquisition. */
00062     uint32_t        m2_buf_cnt;         /* Data counter in the buffer for TFT display mode 2. */
00063     uint32_t        m3_buf_cnt;         /* Data counter in the buffer for TFT display mode 3. */
00064     int16_t         req_buf[DSP_TFT_M2_AUDIO_BUF_SIZE]; /* Buffer for audio data acquisition. */
00065     int16_t         m2_buf[DSP_TFT_M2_AUDIO_BUF_SIZE];  /* Buffer for TFT display mode 2. */
00066     int16_t         m3_buf[DSP_TFT_M3_AUDIO_BUF_SIZE];  /* Buffer for TFT display mode 3. */
00067     uint32_t        m3_sample_cnt;      /* Data counter in the audio sample */
00068     uint32_t        m3_target_cnt;      /* Data counter in the time correction */
00069     bool            m3_pause_flag;      /* Pause decision flag */
00070 } dsp_audio_t;
00071 
00072 /* Control data of display thread */
00073 /* These data are used only in the TFT module. */
00074 typedef struct {
00075     int32_t         disp_phase_no;      /* The making phase of the display image */
00076     dsp_audio_t     audio_data;         /* Audio data for the display */
00077     SYS_KeyCode     key_code;
00078     dsp_tftlayer_t  tft_info[DSP_TFT_LAYER_NUM];/* VRAM structure of each display layer */
00079 } dsp_tft_ctrl_t;
00080 
00081 /** Initialises tft control module
00082  *
00083  */
00084 void dsp_init_tft(dsp_tft_ctrl_t * const p_tft);
00085 
00086 /** Executes the main processing of tft control module
00087  *
00088  *  @param mail_id Mail ID.
00089  *  @param p_com Pointer to common data in all display module.
00090  *  @param p_tft Pointer to management data of TFT module.
00091  */
00092 void dsp_output_tft(const DSP_MAIL_ID mail_id, 
00093                     const dsp_com_ctrl_t * const p_com, dsp_tft_ctrl_t * const p_tft);
00094 
00095 /** This function converts the touch position of current screen into the key code.
00096  *
00097  *  @param disp_mode Display mode
00098  *  @param pos_x Touch X position
00099  *  @param pos_y Touch Y position
00100  *
00101  *  @returns 
00102  *    If touch position is on the picture of key, this function returns key code.
00103  *    Otherwise this function returns "SYS_KEYCODE_NON".
00104  */
00105 SYS_KeyCode dsp_convert_key_tft(const uint32_t disp_mode, 
00106                                     const uint32_t pos_x, const uint32_t pos_y);
00107 
00108 /** This function clears the audio data to use by TFT display.
00109  *
00110  *  @param p_tft Pointer to management data of TFT module.
00111  */
00112 void dsp_clear_tft_audio_data(dsp_tft_ctrl_t * const p_tft);
00113 
00114 #endif /* DISP_TFT_H */