2019-08-05 13:14:59 +01:00

133 lines
4.8 KiB
C

/**
******************************************************************************
* @file BSP/Inc/main.h
* @author MCD Application Team
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stdio.h"
#include "stm32f7508_discovery.h"
#include "stm32f7508_discovery_ts.h"
#include "stm32f7508_discovery_lcd.h"
#include "stm32f7508_discovery_sdram.h"
#include "stm32f7508_discovery_sd.h"
#include "stm32f7508_discovery_eeprom.h"
#include "stm32f7508_discovery_camera.h"
#include "stm32f7508_discovery_audio.h"
#include "stm32f7508_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 0x90080000 /* 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 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/