131 lines
4.6 KiB
C
131 lines
4.6 KiB
C
/**
|
|
******************************************************************************
|
|
* @file BSP/Inc/main.h
|
|
* @author MCD Application Team
|
|
* @brief Header for main.c module
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2016 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef __MAIN_H
|
|
#define __MAIN_H
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "stdio.h"
|
|
#include "stm32746g_discovery.h"
|
|
#include "stm32746g_discovery_ts.h"
|
|
#include "stm32746g_discovery_lcd.h"
|
|
#include "stm32746g_discovery_sdram.h"
|
|
#include "stm32746g_discovery_sd.h"
|
|
#include "stm32746g_discovery_eeprom.h"
|
|
#include "stm32746g_discovery_camera.h"
|
|
#include "stm32746g_discovery_audio.h"
|
|
#include "stm32746g_discovery_qspi.h"
|
|
|
|
/* Macros --------------------------------------------------------------------*/
|
|
#ifdef USE_FULL_ASSERT
|
|
/* Assert activated */
|
|
#define ASSERT(__condition__) do { if(__condition__) \
|
|
{ assert_failed(__FILE__, __LINE__); \
|
|
while(1); \
|
|
} \
|
|
}while(0)
|
|
#else
|
|
/* Assert not activated : macro has no effect */
|
|
#define ASSERT(__condition__) do { if(__condition__) \
|
|
{ ErrorCounter++; \
|
|
} \
|
|
}while(0)
|
|
#endif /* USE_FULL_ASSERT */
|
|
|
|
#define RGB565_BYTE_PER_PIXEL 2
|
|
#define ARBG8888_BYTE_PER_PIXEL 4
|
|
|
|
/* Camera have a max resolution of VGA : 640x480 */
|
|
#define CAMERA_RES_MAX_X 640
|
|
#define CAMERA_RES_MAX_Y 480
|
|
|
|
/**
|
|
* @brief LCD FB_StartAddress
|
|
* LCD Frame buffer start address : starts at beginning of SDRAM
|
|
*/
|
|
#define LCD_FRAME_BUFFER SDRAM_DEVICE_ADDR
|
|
|
|
/**
|
|
* @brief Camera frame buffer start address
|
|
* Assuming LCD frame buffer is of size 480x800 and format ARGB8888 (32 bits per pixel).
|
|
*/
|
|
#define CAMERA_FRAME_BUFFER ((uint32_t)(LCD_FRAME_BUFFER + (RK043FN48H_WIDTH * RK043FN48H_HEIGHT * ARBG8888_BYTE_PER_PIXEL)))
|
|
|
|
/**
|
|
* @brief SDRAM Write read buffer start address after CAM Frame buffer
|
|
* Assuming Camera frame buffer is of size 640x480 and format RGB565 (16 bits per pixel).
|
|
*/
|
|
#define SDRAM_WRITE_READ_ADDR ((uint32_t)(CAMERA_FRAME_BUFFER + (CAMERA_RES_MAX_X * CAMERA_RES_MAX_Y * RGB565_BYTE_PER_PIXEL)))
|
|
|
|
#define SDRAM_WRITE_READ_ADDR_OFFSET ((uint32_t)0x0800)
|
|
#define SRAM_WRITE_READ_ADDR_OFFSET SDRAM_WRITE_READ_ADDR_OFFSET
|
|
|
|
#define AUDIO_REC_START_ADDR SDRAM_WRITE_READ_ADDR
|
|
|
|
/* The Audio file is flashed with ST-Link Utility @ flash address = AUDIO_SRC_FILE_ADDRESS */
|
|
#define AUDIO_SRC_FILE_ADDRESS 0x08080000 /* Audio file address in flash */
|
|
|
|
/* Exported types ------------------------------------------------------------*/
|
|
typedef struct
|
|
{
|
|
void (*DemoFunc)(void);
|
|
uint8_t DemoName[50];
|
|
uint32_t DemoIndex;
|
|
}BSP_DemoTypedef;
|
|
|
|
typedef enum {
|
|
AUDIO_ERROR_NONE = 0,
|
|
AUDIO_ERROR_NOTREADY,
|
|
AUDIO_ERROR_IO,
|
|
AUDIO_ERROR_EOF,
|
|
}AUDIO_ErrorTypeDef;
|
|
|
|
extern const unsigned char stlogo[];
|
|
/* Exported variables ---------------------------------------------------*/
|
|
extern uint8_t NbLoop;
|
|
extern uint8_t MfxExtiReceived;
|
|
#ifndef USE_FULL_ASSERT
|
|
extern uint32_t ErrorCounter;
|
|
#endif
|
|
/* Exported constants --------------------------------------------------------*/
|
|
/* Exported macro ------------------------------------------------------------*/
|
|
|
|
#define COUNT_OF_EXAMPLE(x) (sizeof(x)/sizeof(BSP_DemoTypedef))
|
|
/* Exported functions ------------------------------------------------------- */
|
|
void AudioPlay_demo (void);
|
|
void AudioRec_demo (void);
|
|
void AudioLoopback_demo (void);
|
|
void Touchscreen_demo (void);
|
|
void LCD_demo (void);
|
|
void Log_demo(void);
|
|
void SDRAM_demo(void);
|
|
void SDRAM_DMA_demo(void);
|
|
void SD_demo (void);
|
|
void EEPROM_demo(void);
|
|
void Camera_demo(void);
|
|
uint8_t AUDIO_Process(void);
|
|
void QSPI_demo(void);
|
|
uint8_t CheckForUserInput(void);
|
|
void BSP_LCD_DMA2D_IRQHandler(void);
|
|
#ifdef USE_FULL_ASSERT
|
|
void assert_failed(uint8_t* file, uint32_t line);
|
|
#endif
|
|
#endif /* __MAIN_H */
|
|
|