本文整理汇总了C++中BSP_SDRAM_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ BSP_SDRAM_Init函数的具体用法?C++ BSP_SDRAM_Init怎么用?C++ BSP_SDRAM_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BSP_SDRAM_Init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: k_BspInit
/**
* @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM.
* @param None
* @retval None
*/
void k_BspInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable CS GPIO clock and Configure GPIO PIN for Gyroscope Chip select */
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStructure.Pin = GPIO_PIN_1;
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Speed = GPIO_SPEED_MEDIUM;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Deselect : Chip Select high */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, GPIO_PIN_SET);
/* Configure LED3 and LED4 */
BSP_LED_Init(LED3);
BSP_LED_Init(LED4);
/* Initialize the SDRAM */
BSP_SDRAM_Init();
/* Initialize the Touch screen */
BSP_TS_Init(240, 320);
/* Enable CRC to Unlock GUI */
__HAL_RCC_CRC_CLK_ENABLE();
/* Enable Back up SRAM */
__HAL_RCC_BKPSRAM_CLK_ENABLE();
}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:38,代码来源:k_bsp.c
示例2: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
HAL_StatusTypeDef hal_status = HAL_OK;
uint8_t lcd_status = LCD_OK;
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization: global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Wait until MFX is ready after reset */
HAL_Delay(100);
/* Configure LED1, LED2 and LED3 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED2);
BSP_LED_Init(LED3);
/*##-1- Initialize the SDRAM ##############################################*/
BSP_SDRAM_Init();
/*##-2- Initialize the LCD #################################################*/
/* Proceed to LTDC, DSI initialization and LCD screen initialization
* with the configuration filled in above */
lcd_status = BSP_LCD_Init();
LCD_LayerDefaultInit(1, (uint32_t)&aBufferResult);
BSP_LCD_SelectLayer(1);
OnError_Handler(lcd_status != LCD_OK);
HAL_Delay(100);
/*##-3- DMA2D configuration ################################################*/
DMA2D_Config();
/*##-4- Start DMA2D transfer ###############################################*/
hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle,
(uint32_t)LCD_COLOR_GREEN, /* Fill the DMA2D output register with this color */
(uint32_t)&aBufferResult, /* DMA2D output register */
LAYER_SIZE_X,
LAYER_SIZE_Y);
OnError_Handler(hal_status != HAL_OK);
while (1)
{
;
}
}
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:64,代码来源:main.c
示例3: SDRAM_demo
/**
* @brief SDRAM Demo
* @param None
* @retval None
*/
void SDRAM_demo (void)
{
SDRAM_SetHint();
/* SDRAM device configuration */
if(BSP_SDRAM_Init() != SDRAM_OK)
{
BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM Initialization : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SDRAM Initialization : OK.", LEFT_MODE);
}
/* Fill the buffer to write */
Fill_Buffer(sdram_aTxBuffer, SDRAM_BUFFER_SIZE, 0xA244250F);
/* Write data to the SDRAM memory */
if(BSP_SDRAM_WriteData(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR_OFFSET, sdram_aTxBuffer, SDRAM_BUFFER_SIZE) != SDRAM_OK)
{
BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : OK.", LEFT_MODE);
}
/* Read back data from the SDRAM memory */
if(BSP_SDRAM_ReadData(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR_OFFSET, sdram_aRxBuffer, SDRAM_BUFFER_SIZE) != SDRAM_OK)
{
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : OK.", LEFT_MODE);
}
if(Buffercmp(sdram_aTxBuffer, sdram_aRxBuffer, SDRAM_BUFFER_SIZE) > 0)
{
BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM COMPARE : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test : OK.", LEFT_MODE);
}
while (1)
{
if(CheckForUserInput() > 0)
{
BSP_SDRAM_DeInit();
return;
}
}
}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:64,代码来源:sdram.c
示例4: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
uint8_t lcd_status = LCD_OK;
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization: global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 180 MHz */
SystemClock_Config();
/* Initialize the SDRAM */
BSP_SDRAM_Init();
/* Initialize the LCD */
lcd_status = LCD_Init();
OnError_Handler(lcd_status != LCD_OK);
/* Initialize LTDC layer 0 iused for Hint */
BSP_LCD_LayerDefaultInit(0, LAYER0_ADDRESS);
BSP_LCD_SelectLayer(0);
/* Display example brief */
LCD_BriefDisplay();
/*Draw first image */
CopyBuffer((uint32_t *)Images[ImageIndex++], (uint32_t *)LAYER0_ADDRESS, 240, 160, 320, 240);
pending_buffer = 0;
/*Refresh the LCD display*/
HAL_DSI_Refresh(&hdsi_eval);
/* Infinite loop */
while (1)
{
if(pending_buffer < 0)
{
CopyBuffer((uint32_t *)Images[ImageIndex++], (uint32_t *)LAYER0_ADDRESS, 240, 160, 320, 240);
if(ImageIndex >= 2)
{
ImageIndex = 0;
}
pending_buffer = 0;
HAL_DSI_Refresh(&hdsi_eval);
}
/* Wait some time before switching to next image */
HAL_Delay(2000);
}
}
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:64,代码来源:main.c
示例5: BSP_LCD_Init
/**
* @brief Initializes the LCD.
* @retval LCD state
*/
uint8_t BSP_LCD_Init(void)
{
/* Select the used LCD */
/* The RK043FN48H LCD 480x272 is selected */
/* Timing Configuration */
hLtdcHandler.Init.HorizontalSync = (RK043FN48H_HSYNC - 1);
hLtdcHandler.Init.VerticalSync = (RK043FN48H_VSYNC - 1);
hLtdcHandler.Init.AccumulatedHBP = (RK043FN48H_HSYNC + RK043FN48H_HBP - 1);
hLtdcHandler.Init.AccumulatedVBP = (RK043FN48H_VSYNC + RK043FN48H_VBP - 1);
hLtdcHandler.Init.AccumulatedActiveH = (RK043FN48H_HEIGHT + RK043FN48H_VSYNC + RK043FN48H_VBP - 1);
hLtdcHandler.Init.AccumulatedActiveW = (RK043FN48H_WIDTH + RK043FN48H_HSYNC + RK043FN48H_HBP - 1);
hLtdcHandler.Init.TotalHeigh = (RK043FN48H_HEIGHT + RK043FN48H_VSYNC + RK043FN48H_VBP + RK043FN48H_VFP - 1);
hLtdcHandler.Init.TotalWidth = (RK043FN48H_WIDTH + RK043FN48H_HSYNC + RK043FN48H_HBP + RK043FN48H_HFP - 1);
/* LCD clock configuration */
BSP_LCD_ClockConfig(&hLtdcHandler, NULL);
/* Initialize the LCD pixel width and pixel height */
hLtdcHandler.LayerCfg->ImageWidth = RK043FN48H_WIDTH;
hLtdcHandler.LayerCfg->ImageHeight = RK043FN48H_HEIGHT;
/* Background value */
hLtdcHandler.Init.Backcolor.Blue = 0;
hLtdcHandler.Init.Backcolor.Green = 0;
hLtdcHandler.Init.Backcolor.Red = 0;
/* Polarity */
hLtdcHandler.Init.HSPolarity = LTDC_HSPOLARITY_AL;
hLtdcHandler.Init.VSPolarity = LTDC_VSPOLARITY_AL;
hLtdcHandler.Init.DEPolarity = LTDC_DEPOLARITY_AL;
hLtdcHandler.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
hLtdcHandler.Instance = LTDC;
if(HAL_LTDC_GetState(&hLtdcHandler) == HAL_LTDC_STATE_RESET)
{
/* Initialize the LCD Msp: this __weak function can be rewritten by the application */
BSP_LCD_MspInit(&hLtdcHandler, NULL);
}
HAL_LTDC_Init(&hLtdcHandler);
/* Assert display enable LCD_DISP pin */
HAL_GPIO_WritePin(LCD_DISP_GPIO_PORT, LCD_DISP_PIN, GPIO_PIN_SET);
/* Assert backlight LCD_BL_CTRL pin */
HAL_GPIO_WritePin(LCD_BL_CTRL_GPIO_PORT, LCD_BL_CTRL_PIN, GPIO_PIN_SET);
#if !defined(DATA_IN_ExtSDRAM)
/* Initialize the SDRAM */
BSP_SDRAM_Init();
#endif
/* Initialize the font */
BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
return LCD_OK;
}
开发者ID:picohari,项目名称:intewa_stm32f7,代码行数:61,代码来源:stm32746g_discovery_lcd.c
示例6: SDRAMDISK_initialize
/**
* @brief Initializes a Drive
* @param lun : not used
* @retval DSTATUS: Operation status
*/
DSTATUS SDRAMDISK_initialize(BYTE lun)
{
Stat = STA_NOINIT;
/* Configure the SDRAM device */
BSP_SDRAM_Init();
Stat &= ~STA_NOINIT;
return Stat;
}
开发者ID:Jegeva,项目名称:STM32F469-Discovery,代码行数:15,代码来源:sdram_diskio.c
示例7: main
int main (void) {
MPU_Config(); /* Configure the MPU */
CPU_CACHE_Enable(); /* Enable the CPU Cache */
HAL_Init(); /* Initialize the HAL Library */
BSP_SDRAM_Init(); /* Initialize BSP SDRAM */
SystemClock_Config(); /* Configure the System Clock */
init_filesystem(); /* Inital rl-flash Librart */
MainTask();
for (;;);
}
开发者ID:jackeyjiang,项目名称:meizi_f7disc,代码行数:12,代码来源:main.c
示例8: k_BspInit
/**
* @brief Initializes LEDs, touch screen, CRC and SRAM.
* @param None
* @retval None
*/
void k_BspInit(void)
{
/* Configure LED1 and LED3 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED3);
BSP_SDRAM_Init();
/* Initialize the Touch screen */
BSP_TS_Init(320, 240);
/* Enable CRC to Unlock GUI */
__HAL_RCC_CRC_CLK_ENABLE();
}
开发者ID:nguyenvuhung,项目名称:STM32Cube_FW_F4,代码行数:19,代码来源:k_bsp.c
示例9: BSP_Config
/**
* @brief Initializes the STM32F429I-DISCO's LCD and LEDs resources.
* @param None
* @retval None
*/
static void BSP_Config(void)
{
/* Initialize STM32F429I-DISCO's LEDs */
BSP_LED_Init(LED3);
BSP_LED_Init(LED4);
/* Initializes the SDRAM device */
BSP_SDRAM_Init();
/* Initialize the Touch screen */
BSP_TS_Init(240, 320);
/* Enable the CRC Module */
__CRC_CLK_ENABLE();
}
开发者ID:EarnestHein89,项目名称:STM32Cube_FW_F4,代码行数:20,代码来源:main.c
示例10: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* This project template calls firstly two functions in order to configure MPU feature
and to enable the CPU Cache, respectively MPU_Config() and CPU_CACHE_Enable().
These functions are provided as template implementation that User may integrate
in his application, to enhance the performance in case of use of AXI interface
with several masters. */
/* Configure the MPU attributes as Write Through */
MPU_Config();
/* Enable the CPU Cache */
CPU_CACHE_Enable();
#ifdef RTE_CMSIS_RTOS // when using CMSIS RTOS
osKernelInitialize(); // initialize CMSIS-RTOS
#endif
/* STM32F7xx HAL library initialization:
- Configure the Flash ART accelerator on ITCM interface
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the System clock to have a frequency of 216 MHz */
SystemClock_Config();
/* Add your application code here
*/
BSP_SDRAM_Init();
Touch_Initialize();
#ifdef RTE_CMSIS_RTOS // when using CMSIS RTOS
Init_Thread1();
Init_Thread2();
osKernelStart(); // start thread execution
#endif
Analyzer_Init();
GUI_Init();
osMutexWait(mid_Thread_Mutex,osWaitForever);
Hello_MSG();
osMutexRelease(mid_Thread_Mutex);
osThreadTerminate(osThreadGetId());
}
开发者ID:AdrK,项目名称:STM32F7_MULTITHREAD,代码行数:53,代码来源:main.c
示例11: k_BspInit
/**
* @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM.
* @param None
* @retval None
*/
void k_BspInit(void)
{
/* Initialize the NOR */
BSP_QSPI_Init();
BSP_QSPI_MemoryMappedMode();
/* Initialize the SDRAM */
BSP_SDRAM_Init();
/* Initialize the Touch screen */
BSP_TS_Init(420, 272);
/* Enable CRC to Unlock GUI */
__HAL_RCC_CRC_CLK_ENABLE();
/* Enable Back up SRAM */
__HAL_RCC_BKPSRAM_CLK_ENABLE();
}
开发者ID:CamelShoko,项目名称:RadioYuN,代码行数:24,代码来源:k_bsp.c
示例12: k_BspInit
/**
* @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM.
* @param None
* @retval None
*/
void k_BspInit(void)
{
/* Configure LED1, LED2, LED3 and LED4 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED2);
BSP_LED_Init(LED3);
BSP_LED_Init(LED4);
/* Initialize the SDRAM */
BSP_SDRAM_Init();
/* Initialize the Touch screen */
BSP_TS_Init(640, 480);
/* Enable CRC to Unlock GUI */
__HAL_RCC_CRC_CLK_ENABLE();
/* Enable Back up SRAM */
__HAL_RCC_BKPSRAM_CLK_ENABLE();
}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:26,代码来源:k_bsp.c
示例13: k_BspInit
/**
* @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM.
* @param None
* @retval None
*/
void k_BspInit(void)
{
BSP_IO_Init();
/* Initialize the NOR */
BSP_NOR_Init();
/* Initialize the SDRAM */
BSP_SDRAM_Init();
/* Initialize the Touch screen */
BSP_TS_Init(640, 480);
/* Enable CRC to Unlock GUI */
__HAL_RCC_CRC_CLK_ENABLE();
/* Enable Back up SRAM */
__HAL_RCC_BKPSRAM_CLK_ENABLE();
}
开发者ID:RadMie,项目名称:STM32F7DiscoveryBase,代码行数:26,代码来源:k_bsp.c
示例14: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the system clock to 180 MHz */
SystemClock_Config();
/*##-1- Initialize the SDRAM ##############################################*/
BSP_SDRAM_Init();
/*##-2- Initialise the LCD #################################################*/
BSP_LCD_Init();
/*##-3- Camera Initialisation and start capture ############################*/
/* Initialize the Camera */
BSP_CAMERA_Init(CAMERA_R320x240);
/* Wait 1s before Camera snapshot */
HAL_Delay(1000);
/* Start the Camera Capture */
BSP_CAMERA_SnapshotStart((uint8_t *)CAMERA_FRAME_BUFFER);
while (1)
{
}
}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:44,代码来源:main.c
示例15: system_init
void system_init(void)
{
SCB_EnableICache();
SCB_EnableDCache();
DBG_INIT();
init_system_clock();
HAL_Init();
BSP_SDRAM_Init();
BSP_LED_Init(LED1);
BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
MX_FATFS_Init();
FRESULT res = f_mount(&ctx.fs, SD_Path, 0);
ASSERT_WARN(res == FR_OK);
gui_init();
}
开发者ID:korzo89,项目名称:st_sid_player,代码行数:22,代码来源:system.c
示例16: main
/**
* @brief Main function. Executes all initialization and terminate its thread.
* @param None
* @retval None
*/
int main(void)
{
///////////////////////////////////////////////////////////////////////////////////////////
/* Configure the MPU attributes as Write Through */
MPU_Config();
/* Enable the CPU Cache */
CPU_CACHE_Enable();
// initialize CMSIS-RTOS
osKernelInitialize();
///////////////////////////////////////////////////////////////////////////////////////////
// Hardware initialize
if( HAL_Init() != HAL_OK)
Error_Handler();
if( ConfigureDMA(&g_DmaHandle, &g_AdcHandle) != HAL_OK)
Error_Handler();
if( ADC_INIT(&g_AdcHandle) != HAL_OK)
Error_Handler();
BSP_SDRAM_Init();
Touch_Initialize();
///////////////////////////////////////////////////////////////////////////////////////////
/* Configure the System clock to have a frequency of 216 MHz */
SystemClock_Config();
// Thread initialization
Init_TH_GUI();
Init_TH_Touch();
// RTOS Start Kernel
osKernelStart(); // start thread execution
// Get Main Thread ID
Main_thID = osThreadGetId();
///////////////////////////////////////////////////////////////////////////////////////////
// Start data acquire
HAL_ADC_Start_DMA(&g_AdcHandle, values, ADC_BUFFER_LENGTH);
///////////////////////////////////////////////////////////////////////////////////////////
// Terminate main thread
osThreadTerminate(Main_thID);
/* Infinite loop */
while (1) { }
}
开发者ID:AdrK,项目名称:STM32F7_ADC_DMA_LCD,代码行数:44,代码来源:main.c
示例17: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
uint8_t lcd_status = LCD_OK;
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization: global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 180 MHz */
SystemClock_Config();
/* Initialize the SDRAM */
BSP_SDRAM_Init();
/* Initialize the LCD */
lcd_status = LCD_Init();
OnError_Handler(lcd_status != LCD_OK);
/* Initialize LTDC layer 0 iused for Hint */
LCD_LayertInit(0, LAYER0_ADDRESS);
BSP_LCD_SelectLayer(0);
HAL_DSI_LongWrite(&hdsi_eval, 0, DSI_DCS_LONG_PKT_WRITE, 4, OTM8009A_CMD_CASET, pColLeft);
HAL_DSI_LongWrite(&hdsi_eval, 0, DSI_DCS_LONG_PKT_WRITE, 4, OTM8009A_CMD_PASET, pPage);
/* Update pitch : the draw is done on the whole physical X Size */
HAL_LTDC_SetPitch(&hltdc_eval, BSP_LCD_GetXSize(), 0);
/* Display example brief */
LCD_BriefDisplay();
/* Show first image */
CopyPicture((uint32_t *)Images[ImageIndex++], (uint32_t *)LAYER0_ADDRESS, 240, 160, 320, 240);
pending_buffer = 0;
active_area = LEFT_AREA;
HAL_DSI_LongWrite(&hdsi_eval, 0, DSI_DCS_LONG_PKT_WRITE, 2, OTM8009A_CMD_WRTESCN, pSyncLeft);
/* Infinite loop */
while (1)
{
if(pending_buffer < 0)
{
CopyPicture((uint32_t *)Images[ImageIndex++], (uint32_t *)LAYER0_ADDRESS, 240, 160, 320, 240);
if(ImageIndex >= 2)
{
ImageIndex = 0;
}
pending_buffer = 1;
HAL_DSI_LongWrite(&hdsi_eval, 0, DSI_DCS_LONG_PKT_WRITE, 2, OTM8009A_CMD_WRTESCN, pSyncLeft);
}
/* Wait some time before switching to next image */
HAL_Delay(2000);
}
}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:71,代码来源:main.c
示例18: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 180 MHz */
SystemClock_Config();
/* Initialize LCD and LEDs */
BSP_Config();
/***********************************************************/
/* Compute the prescaler value to have TIM3 counter clock equal to 10 KHz */
uwPrescalerValue = (uint32_t) ((SystemCoreClock /2) / 10000) - 1;
/* Set TIMx instance */
TimHandle.Instance = TIM3;
/* Initialize TIM3 peripheral as follows:
+ Period = 500 - 1
+ Prescaler = ((SystemCoreClock/2)/10000) - 1
+ ClockDivision = 0
+ Counter direction = Up
*/
TimHandle.Init.Period = 500 - 1;
TimHandle.Init.Prescaler = uwPrescalerValue;
TimHandle.Init.ClockDivision = 0;
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
if(HAL_TIM_Base_Init(&TimHandle) != HAL_OK)
{
while(1)
{
}
}
/*##-2- Start the TIM Base generation in interrupt mode ####################*/
/* Start Channel1 */
if(HAL_TIM_Base_Start_IT(&TimHandle) != HAL_OK)
{
while(1)
{
}
}
/***********************************************************/
/* Init the STemWin GUI Library */
BSP_SDRAM_Init(); /* Initializes the SDRAM device */
__HAL_RCC_CRC_CLK_ENABLE(); /* Enable the CRC Module */
GUI_Init();
GUI_SetFont(&GUI_Font32_ASCII);
GUI_DispStringAt("Starting...", 0, 0);
/* Initialize LCD and LEDs */
GUI_DispStringAt("Initializing lcd...", 0, 32);
/* Activate the use of memory device feature */
WM_SetCreateFlags(WM_CF_MEMDEV);
MainTask();
/* Infinite loop */
for(;;);
}
开发者ID:PaxInstruments,项目名称:STM32CubeF4,代码行数:78,代码来源:main.c
示例19: BSP_LCD_InitEx
/**
* @brief Initializes the LCD.
* @param PclkConfig : pixel clock profile
* @retval LCD state
*/
uint8_t BSP_LCD_InitEx(uint32_t PclkConfig)
{
PCLK_profile = PclkConfig;
/* Select the used LCD */
/* The AMPIRE 480x272 does not contain an ID register then we check the availability
of AMPIRE 480x640 LCD using device ID of the STMPE811 mounted on MB1046 daughter board */
if(stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID)
{
/* The AMPIRE LCD 480x272 is selected */
/* Timing Configuration */
hltdc_eval.Init.HorizontalSync = (AMPIRE480272_HSYNC - 1);
hltdc_eval.Init.VerticalSync = (AMPIRE480272_VSYNC - 1);
hltdc_eval.Init.AccumulatedHBP = (AMPIRE480272_HSYNC + AMPIRE480272_HBP - 1);
hltdc_eval.Init.AccumulatedVBP = (AMPIRE480272_VSYNC + AMPIRE480272_VBP - 1);
hltdc_eval.Init.AccumulatedActiveH = (AMPIRE480272_HEIGHT + AMPIRE480272_VSYNC + AMPIRE480272_VBP - 1);
hltdc_eval.Init.AccumulatedActiveW = (AMPIRE480272_WIDTH + AMPIRE480272_HSYNC + AMPIRE480272_HBP - 1);
hltdc_eval.Init.TotalHeigh = (AMPIRE480272_HEIGHT + AMPIRE480272_VSYNC + AMPIRE480272_VBP + AMPIRE480272_VFP - 1);
hltdc_eval.Init.TotalWidth = (AMPIRE480272_WIDTH + AMPIRE480272_HSYNC + AMPIRE480272_HBP + AMPIRE480272_HFP - 1);
/* Initialize the LCD pixel width and pixel height */
hltdc_eval.LayerCfg->ImageWidth = AMPIRE480272_WIDTH;
hltdc_eval.LayerCfg->ImageHeight = AMPIRE480272_HEIGHT;
}
else
{
/* The LCD AMPIRE 640x480 is selected */
/* Timing configuration */
hltdc_eval.Init.HorizontalSync = (AMPIRE640480_HSYNC - 1);
hltdc_eval.Init.VerticalSync = (AMPIRE640480_VSYNC - 1);
hltdc_eval.Init.AccumulatedHBP = (AMPIRE640480_HSYNC + AMPIRE640480_HBP - 1);
hltdc_eval.Init.AccumulatedVBP = (AMPIRE640480_VSYNC + AMPIRE640480_VBP - 1);
hltdc_eval.Init.AccumulatedActiveH = (AMPIRE640480_HEIGHT + AMPIRE640480_VSYNC + AMPIRE640480_VBP - 1);
hltdc_eval.Init.AccumulatedActiveW = (AMPIRE640480_WIDTH + AMPIRE640480_HSYNC + AMPIRE640480_HBP - 1);
hltdc_eval.Init.TotalHeigh = (AMPIRE640480_HEIGHT + AMPIRE640480_VSYNC + AMPIRE640480_VBP + AMPIRE640480_VFP - 1);
hltdc_eval.Init.TotalWidth = (AMPIRE640480_WIDTH + AMPIRE640480_HSYNC + AMPIRE640480_HBP + AMPIRE640480_HFP - 1);
/* Initialize the LCD pixel width and pixel height */
hltdc_eval.LayerCfg->ImageWidth = AMPIRE640480_WIDTH;
hltdc_eval.LayerCfg->ImageHeight = AMPIRE640480_HEIGHT;
}
/* Background value */
hltdc_eval.Init.Backcolor.Blue = 0;
hltdc_eval.Init.Backcolor.Green = 0;
hltdc_eval.Init.Backcolor.Red = 0;
/* Polarity */
hltdc_eval.Init.HSPolarity = LTDC_HSPOLARITY_AL;
hltdc_eval.Init.VSPolarity = LTDC_VSPOLARITY_AL;
hltdc_eval.Init.DEPolarity = LTDC_DEPOLARITY_AL;
hltdc_eval.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
hltdc_eval.Instance = LTDC;
/* LCD clock configuration */
BSP_LCD_ClockConfig(&hltdc_eval, &PCLK_profile);
MspInit();
HAL_LTDC_Init(&hltdc_eval);
#if !defined(DATA_IN_ExtSDRAM)
/* Initialize the SDRAM */
BSP_SDRAM_Init();
#endif /* DATA_IN_ExtSDRAM */
/* Initialize the font */
BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
return LCD_OK;
}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:75,代码来源:stm324x9i_eval_lcd.c
示例20: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
uint8_t sdram_status = SDRAM_OK;
uint8_t lcd_status = LCD_OK;
uint32_t ts_status = TS_OK;
p_bmp_converted_pixel_data = (uint8_t *)CONVERTED_FRAME_BUFFER;
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 180 MHz */
SystemClock_Config();
/* Configure LED1 and LED3 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED3);
/*##-1- Initialize the SDRAM */
sdram_status = BSP_SDRAM_Init();
if(sdram_status != SDRAM_OK)
{
Error_Handler();
}
/*##-2- LCD Initialization #################################################*/
/* Initialize the LCD DSI */
lcd_status = BSP_LCD_Init() ;
if(lcd_status != LCD_OK)
{
Error_Handler();
}
lcd_status = BSP_LCD_InitEx(LCD_ORIENTATION_LANDSCAPE);
if(lcd_status != LCD_OK)
{
Error_Handler();
}
BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER_BACKGROUND, LCD_FB_START_ADDRESS);
/* Clear the LCD Background layer */
BSP_LCD_Clear(LCD_COLOR_WHITE);
/*##-3- Touch screen initialization ########################################*/
BSP_TS_ResetTouchData(&TS_State);
/* If calibration is not yet done, proceed with calibration */
if (TouchScreen_IsCalibrationDone() == 0)
{
ts_status = Touchscreen_Calibration();
if(ts_status == TS_OK)
{
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 65, (uint8_t *)"Touchscreen calibration success.", CENTER_MODE);
}
} /* of if (TouchScreen_IsCalibrationDone() == 0) */
/*##-4- Link the SD Card disk I/O driver ###################################*/
/* Clear the LCD and display waiting message */
BSP_LCD_Clear(LCD_COLOR_WHITE);
BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
BSP_LCD_SetFont(&Font12);
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 - 27, (uint8_t*)"Please WAIT few seconds", CENTER_MODE);
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 - 12, (uint8_t*)"Creating FAT file system on SD card", CENTER_MODE);
if(FATFS_LinkDriver(&SD_Driver, SDPath) != 0)
{
/* FatFs Initialization Error */
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 3, (uint8_t*)"FAT FS Error !!", CENTER_MODE);
Error_Handler();
}
/*##-4- Register the file system object to the FatFs module ################*/
if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) != FR_OK)
{
/* FatFs Initialization Error */
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 3, (uint8_t*)"FAT FS Error !!", CENTER_MODE);
Error_Handler();
}
/* Create a FAT file system (format) on the logical drive */
if(f_mkfs((TCHAR const*)SDPath, 0, 0) != FR_OK)
{
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 3, (uint8_t*)"FAT FS Error !!", CENTER_MODE);
Error_Handler();
}
/*##-5- Draw the menu ######################################################*/
//.........这里部分代码省略.........
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:101,代码来源:main.c
注:本文中的BSP_SDRAM_Init函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论