Beispiel #1
0
/**
  * @brief  LCD configuration
  * @param  None
  * @retval None
  */
static void LCD_Config(void)
{
  /* LCD Initialization */ 
  /* Two layers are used in this application but not simultaneously 
     so "LCD_MAX_PCLK" is recommended to programme the maximum PCLK = 25,16 MHz */
  BSP_LCD_Init();

  /* LCD Initialization */ 
  BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
  BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS+(BSP_LCD_GetXSize()*BSP_LCD_GetYSize()*4));

  /* Enable the LCD */ 
  BSP_LCD_DisplayOn(); 
  
  /* Select the LCD Background Layer  */
  BSP_LCD_SelectLayer(0);

  /* Clear the Background Layer */ 
  BSP_LCD_Clear(LCD_COLOR_BLACK);  
  
  /* Select the LCD Foreground Layer  */
  BSP_LCD_SelectLayer(1);

  /* Clear the Foreground Layer */ 
  BSP_LCD_Clear(LCD_COLOR_BLACK);
  
  /* Configure the transparency for foreground and background :
     Increase the transparency */
  BSP_LCD_SetTransparency(0, 0);
  BSP_LCD_SetTransparency(1, 100);
}
Beispiel #2
0
/**
  * @brief  LCD configuration
  * @param  None
  * @retval None
  */
static void LCD_Config(void)
{
	uint8_t lcd_status = LCD_OK;

	/* LCD DSI initialization in mode Video Burst  */
	/* Initialize DSI LCD */
        //  BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT); /* uncomment if Portrait orientation is needed */
        BSP_LCD_Init(); /* Uncomment if default config (landscape orientation) is needed */
        while(lcd_status != LCD_OK);
      
        BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
        BSP_LCD_LayerDefaultInit(1, LCD_BG_LAYER_ADDRESS);   

	/* Select the LCD Background Layer  */
	BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_BACKGROUND);

	/* Clear the Background Layer */
	BSP_LCD_Clear(LCD_COLOR_BLACK);

	/* Select the LCD Foreground Layer  */
	BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_FOREGROUND);

	/* Clear the Foreground Layer */
	BSP_LCD_Clear(LCD_COLOR_BLACK);

	/* Configure the transparency for foreground and background :
     Increase the transparency */
	BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_BACKGROUND, 0);
	BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_FOREGROUND, 100);
}
Beispiel #3
0
/**
  * @brief  LCD configuration.
  * @param  None
  * @retval None
  */
static void LCD_Config(void)
{
  /* LCD Initialization */ 
  BSP_LCD_Init();

  /* LCD Layers Initialization */ 
  BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
  BSP_LCD_LayerDefaultInit(1, (LCD_FB_START_ADDRESS+(BSP_LCD_GetXSize()*BSP_LCD_GetYSize()*4)));
  
  /* Enable the LCD */ 
  BSP_LCD_DisplayOn();

  /* Set LCD Background Layer  */
  BSP_LCD_SelectLayer(0);
  /* Clear the Background Layer */
  BSP_LCD_Clear(LCD_COLOR_WHITE);

  /* Set LCD Foreground Layer  */
  BSP_LCD_SelectLayer(1);
  /* Clear the Foreground Layer */ 
  BSP_LCD_Clear(LCD_COLOR_BLACK); 

  /* Configure and enable the Color Keying feature */
  BSP_LCD_SetColorKeying(1, 0); 

  /* Configure the transparency for foreground: Increase the transparency */
  BSP_LCD_SetTransparency(1, 100);
}
Beispiel #4
0
/**
  * @brief  LCD configuration.
  * @param  None
  * @retval None
  */
static void LCD_Config(void)
{
  uint8_t lcd_status = LCD_OK;


  /* LCD DSI initialization in mode Video Burst  */
  lcd_status = LCD_Init();

  if(lcd_status != LCD_OK)
  {
    Error_Handler();
  }

  /* Activate foreground and background layers */
  BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER_BACKGROUND, LCD_BG_LAYER_ADDRESS);
  BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER_FOREGROUND, LCD_FG_LAYER_ADDRESS);
        
  /* Set LCD Background Layer  */
  BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_BACKGROUND);
  /* Clear the Background Layer */
  BSP_LCD_Clear(LCD_COLOR_WHITE);

  /* Set LCD Foreground Layer  */
  BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_FOREGROUND);
  /* Clear the Foreground Layer */ 
  BSP_LCD_Clear(LCD_COLOR_BLACK); 

  /* Configure and enable the Color Keying feature */
  BSP_LCD_SetColorKeying(1, 0); 

  /* Configure the transparency for foreground: Increase the transparency */
  BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_FOREGROUND, 100);
  
}
Beispiel #5
0
/**
  * @brief  LCD configuration.
  * @param  None
  * @retval None
  */
static void LCD_Config(void)
{
  /* LCD Initialization */ 
  /* Two layers are used in this application simultaneously 
     so "LCD_MIN_PCLK" is recommended to programme the PCLK at 20 MHz */  
  BSP_LCD_InitEx(LCD_MIN_PCLK);
  
  /* LCD Layers Initialization */ 
  BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
  BSP_LCD_LayerDefaultInit(1, (LCD_FB_START_ADDRESS+(BSP_LCD_GetXSize()*BSP_LCD_GetYSize()*4)));
  
  /* Enable the LCD */ 
  BSP_LCD_DisplayOn();

  /* Set LCD Background Layer  */
  BSP_LCD_SelectLayer(0);
  /* Clear the Background Layer */
  BSP_LCD_Clear(LCD_COLOR_WHITE);

  /* Set LCD Foreground Layer  */
  BSP_LCD_SelectLayer(1);
  /* Clear the Foreground Layer */ 
  BSP_LCD_Clear(LCD_COLOR_BLACK); 

  /* Configure and enable the Color Keying feature */
  BSP_LCD_SetColorKeying(1, 0); 

  /* Configure the transparency for foreground: Increase the transparency */
  BSP_LCD_SetTransparency(1, 100);
}
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
//   uint8_t R;
   uint8_t buf[10];
   uint8_t buf_1[10];
   uint8_t buf_2[10];
   float pdd[3];
  /* 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
       - Low Level Initialization
     */
  HAL_Init();
  SystemClock_Config();
  BSP_LCD_Init();
  BSP_LCD_LayerDefaultInit(LCD_FOREGROUND_LAYER, (LCD_FRAME_BUFFER + BUFFER_OFFSET));
  /* Configure the transparency for foreground : Increase the transprency */
  BSP_LCD_SetTransparency(LCD_BACKGROUND_LAYER, 0);
  BSP_LCD_SelectLayer(LCD_FOREGROUND_LAYER);
  BSP_GYRO_Init();
	//R=BSP_GYRO_ReadID();
	
	/* Configure the System clock to have a frequency of 180 MHz */
  SystemClock_Config();
	Delaimes(20);
	BSP_GYRO_Init();
	Delaimes(4);
	BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
  BSP_LCD_Clear(LCD_COLOR_BLACK );
	BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
 	Delaimes(4);	

  /* Infinite loop */
  while (1)
  {
		BSP_GYRO_GetXYZ(pdd);	 
  sprintf(buf,"%.3f",pdd[0]);	
	sprintf(buf_1,"%.3f",pdd[1]);
	sprintf(buf_2,"%.3f",pdd[2]);		
	BSP_LCD_DisplayStringAtLine(0,buf);
	BSP_LCD_DisplayStringAtLine(1,buf_1);
	BSP_LCD_DisplayStringAtLine(2,buf_2);
	Delaimes(200);
  }
}
Beispiel #7
0
/**
  * @brief  LCD configuration.
  * @param  None
  * @retval None
  */
static void LCD_Config(void)
{
  /* LCD Initialization */ 
  BSP_LCD_Init();

  /* LCD Layers Initialization */ 
  BSP_LCD_LayerDefaultInit(LCD_FOREGROUND_LAYER, (LCD_FRAME_BUFFER + BUFFER_OFFSET));
  
  /* Configure the transparency for foreground : Increase the transparency */
  BSP_LCD_SetTransparency(LCD_BACKGROUND_LAYER, 0);
  BSP_LCD_SelectLayer(LCD_FOREGROUND_LAYER);

  /* LCD Log initialization */
  LCD_LOG_Init(); 

  LCD_LOG_SetHeader((uint8_t *)"LTDC Application");
  LCD_UsrLog("> USB Host library started.\n"); 
  LCD_LOG_SetFooter ((uint8_t *)"     USB Host Library V3.2.0" );
}
Beispiel #8
0
static void LCD_Config(void)
{
  /* LCD Initialization */
  BSP_LCD_Init();

  /* LCD Initialization */
  BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);

  /* Enable the LCD */
  BSP_LCD_DisplayOn();

  /* Select the LCD Background Layer  */
  BSP_LCD_SelectLayer(0);

  /* Clear the Background Layer */
  BSP_LCD_Clear(LCD_COLOR_BLACK);

  /* Configure the transparency for background */
  BSP_LCD_SetTransparency(0, 100);
}
Beispiel #9
0
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
        system_stm32f4xx.c file
     */
    SystemClock_Config();
    uint8_t  lcd_status = LCD_OK;
    HAL_MspInit();
    HAL_Init();
    BSP_SDRAM_Init();
    //  uint32_t i;
    int i;
    
    __HAL_RCC_GPIOD_CLK_ENABLE();
    __HAL_RCC_GPIOG_CLK_ENABLE();
    __HAL_RCC_GPIOK_CLK_ENABLE();
    GPIO_InitTypeDef GPIO_InitStructure;
   
  
    GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStructure.Speed =  GPIO_SPEED_HIGH;
    GPIO_InitStructure.Pull = GPIO_NOPULL; //GPIO_PULLDOWN;//GPIO_PULLUP;// 

    GUI_Conf.border=8;
    

    GPIO_InitStructure.Pin = GPIO_PIN_6;
    HAL_GPIO_Init(GPIOG,&GPIO_InitStructure);
    GPIO_InitStructure.Pin = GPIO_PIN_5;
    HAL_GPIO_Init(GPIOD,&GPIO_InitStructure);
    GPIO_InitStructure.Pin = 	GPIO_PIN_4;
    HAL_GPIO_Init(GPIOD,&GPIO_InitStructure);
    GPIO_InitStructure.Pin = GPIO_PIN_3;
    HAL_GPIO_Init(GPIOK,&GPIO_InitStructure);


    BSP_LCD_Reset(); BSP_LCD_MspInit();
    //lcd_status = BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT);
    //lcd_status = BSP_LCD_InitEx(LCD_ORIENTATION_LANDSCAPE);
    lcd_status = BSP_LCD_Init();

   
    
    
    BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);   
    BSP_LCD_SelectLayer(0);
    BSP_LCD_DisplayOn();
    BSP_LCD_SetTransparency(0,0xff);
    if(lcd_status!=LCD_OK)
	f_error();
    BSP_LCD_Clear(LCD_COLOR_BLACK);
 
   
    BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
    BSP_LCD_FillRect(0, 0,BSP_LCD_GetXSize(),BSP_LCD_GetYSize());
    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
    BSP_LCD_FillRect(GUI_Conf.border, GUI_Conf.border,BSP_LCD_GetXSize()-2*GUI_Conf.border,BSP_LCD_GetYSize()-2*GUI_Conf.border);
    BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
    BSP_LCD_SetFont(&Font16);
    BSP_LCD_SetBackColor(LCD_COLOR_TRANSPARENT);
    BSP_LCD_DisplayStringAtLine(1, (uint8_t *)"  FAT SD");

  
    
     
 
    

    
    while(1){

	Delay(1000);
	switch(i%4){
	case 0:
	    HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_6);
	    break;
	    
	case 1: 
	    HAL_GPIO_TogglePin(GPIOD,GPIO_PIN_4);
	    break;
	case 2:
	    HAL_GPIO_TogglePin(GPIOD,GPIO_PIN_5);
	    break;
	case 3:
	    HAL_GPIO_TogglePin(GPIOK,GPIO_PIN_3);
	    break;
	}
	i++;
	if(! i%4)
	    i=0;
	
	
	
    }
    
    
}
Beispiel #10
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{  
  uwInternelBuffer = (uint8_t *)0xC0260000;
  uint32_t counter = 0;
  uint8_t str[30];
  
  /* 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 175 MHz */
  SystemClock_Config();
  
  /* Configure LED3 */
  BSP_LED_Init(LED3);
  
  /*##-1- Configure LCD ######################################################*/
  LCD_Config();  
  
  /*##-2- Link the SD Card disk I/O driver ###################################*/
  if(FATFS_LinkDriver(&SD_Driver, SD_Path) != 0)
  {
    Error_Handler();
  }
  else
  {
    /*##-3- Initialize the Directory Files pointers (heap) ###################*/
    for (counter = 0; counter < MAX_BMP_FILES; counter++)
    {
      pDirectoryFiles[counter] = malloc(MAX_BMP_FILE_NAME);
      if(pDirectoryFiles[counter] == NULL)
      {
        /* Set the Text Color */
        BSP_LCD_SetTextColor(LCD_COLOR_RED);
        
        BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"  Cannot allocate memory ");
        while(1)
        {
        }       
      }
    }
    
    /*##-4- Display Background picture #######################################*/
    /* Select Background Layer  */
    BSP_LCD_SelectLayer(0);
    
    /* Register the file system object to the FatFs module */
    if(f_mount(&SD_FatFs, (TCHAR const*)SD_Path, 0) != FR_OK)
    {
      /* FatFs Initialization Error */
      /* Set the Text Color */
      BSP_LCD_SetTextColor(LCD_COLOR_RED);
      
      BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"  FatFs Initialization Error ");
    }
    else
    {    
      /* Open directory */
      if (f_opendir(&directory, (TCHAR const*)"/BACK") != FR_OK)
      {
        /* Set the Text Color */
        BSP_LCD_SetTextColor(LCD_COLOR_RED);
        
        BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"    Open directory.. fails");
        while(1)
        {
        } 
      }
    }
    
    if (Storage_CheckBitmapFile("BACK/image.bmp", &uwBmplen) == 0)
    {
      /* Format the string */
      Storage_OpenReadFile(uwInternelBuffer, "BACK/image.bmp");
      /* Write bmp file on LCD frame buffer */
      BSP_LCD_DrawBitmap(0, 0, uwInternelBuffer);
    }
    else
    {
      /* Set the Text Color */
      BSP_LCD_SetTextColor(LCD_COLOR_RED);
      
      BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"    File type not supported. "); 
      while(1)
      {
      }  
    }        
    
    /*##-5- Display Foreground picture #######################################*/
    /* Select Foreground Layer  */
    BSP_LCD_SelectLayer(1);
    
    /* Decrease the foreground transprency */
    BSP_LCD_SetTransparency(1, 200); 
    
    /* Get the BMP file names on root directory */
    ubNumberOfFiles = Storage_GetDirectoryBitmapFiles("/TOP", pDirectoryFiles);
    
    if (ubNumberOfFiles == 0)
    {
      for (counter = 0; counter < MAX_BMP_FILES; counter++)
      {
        free(pDirectoryFiles[counter]);
      }
      /* Set the Text Color */
      BSP_LCD_SetTextColor(LCD_COLOR_RED);
      
      BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"    No Bitmap files...      ");
      while(1)
      {
      } 
    } 
  }
  
  /* Infinite loop */
  while(1)
  { 
    counter = 0;
    
    while (counter < ubNumberOfFiles)
    {
      /* Format the string */
      sprintf ((char*)str, "TOP/%-11.11s", pDirectoryFiles[counter]); 
      
      if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0)
      {
        /* Format the string */
        sprintf ((char*)str, "TOP/%-11.11s", pDirectoryFiles[counter]);
        
        /* Open a file and copy its content to a buffer */
        Storage_OpenReadFile(uwInternelBuffer, (const char*)str);
        
        HAL_Delay(100);
        
        /* Write bmp file on LCD frame buffer */
        BSP_LCD_DrawBitmap(0, 0, uwInternelBuffer);
        
        /* Jump to next image */
        counter++;   
      }
      else
      {
        /* Set the Text Color */
        BSP_LCD_SetTextColor(LCD_COLOR_RED); 
        
        BSP_LCD_DisplayStringAtLine(7, (uint8_t *) str);        
        BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"    File type not supported. "); 
        while(1)
        {
        }    
      }
    }
  }
}
Beispiel #11
0
void initializeGUI(void) {

    BSP_LCD_Init();

    BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);

    BSP_LCD_DisplayOn();

    BSP_LCD_SelectLayer(0);

    BSP_LCD_Clear(LCD_COLOR_WHITE);

    BSP_LCD_SetTransparency(0, 200);

    BSP_LCD_SetFont(&Font20);

    button_home.x_pos = 5;
    button_home.y_pos = 5;
    button_home.hasBeenAcknowledged = 0;
    button_home.isEnabled = 1;
    button_home.isPushed = 0;
    memcpy(button_home.title, "<Home", 6);
    button_home.buttonEventHandler = backToHomeScreen;

    buttons[BUTTON_E0].x_pos = E0_BUTTON_X;
    buttons[BUTTON_E0].y_pos = E0_BUTTON_Y;
    buttons[BUTTON_E0].isPushed = 0;
    buttons[BUTTON_E0].hasBeenAcknowledged = 0;
    buttons[BUTTON_E0].isEnabled = 0;
    buttons[BUTTON_E0].buttonEventHandler = eventHandlerE0;
    memcpy(buttons[BUTTON_E0].title, "0xE0\0", 5);

    buttons[BUTTON_E1].x_pos = E1_BUTTON_X;
    buttons[BUTTON_E1].y_pos = E1_BUTTON_Y;
    buttons[BUTTON_E1].isPushed = 0;
    buttons[BUTTON_E1].hasBeenAcknowledged = 0;
    buttons[BUTTON_E1].buttonEventHandler = eventHandlerE1;
    memcpy(buttons[BUTTON_E1].title, "0xE1\0", 5);
    buttons[BUTTON_E1].isEnabled = 0;

    buttons[BUTTON_01].x_pos = O1_BUTTON_X;
    buttons[BUTTON_01].y_pos = O1_BUTTON_Y;
    buttons[BUTTON_01].isPushed = 0;
    buttons[BUTTON_01].isEnabled = 0;
    buttons[BUTTON_01].hasBeenAcknowledged = 0;
    buttons[BUTTON_01].buttonEventHandler = eventHandlerAdjust;
    memcpy(buttons[BUTTON_01].title, "0x01\0", 5);

    buttons[BUTTON_05].x_pos = O5_BUTTON_X;
    buttons[BUTTON_05].y_pos = O5_BUTTON_Y;
    buttons[BUTTON_05].isPushed = 0;
    buttons[BUTTON_05].hasBeenAcknowledged = 0;
    buttons[BUTTON_05].isEnabled = 0;
    buttons[BUTTON_05].buttonEventHandler = eventHandlerConfirm;
    memcpy(buttons[BUTTON_05].title, "0x05\0", 5);

    buttons[BUTTON_C8].x_pos = C8_BUTTON_X;
    buttons[BUTTON_C8].y_pos = C8_BUTTON_Y;
    buttons[BUTTON_C8].isPushed = 0;
    buttons[BUTTON_C8].hasBeenAcknowledged = 0;
    buttons[BUTTON_C8].isEnabled = 0;
    buttons[BUTTON_C8].buttonEventHandler = eventHandlerC8;
    memcpy(buttons[BUTTON_C8].title, "0xC8\0", 5);

    buttons[BUTTON_C9].x_pos = C9_BUTTON_X;
    buttons[BUTTON_C9].y_pos = C9_BUTTON_Y;
    buttons[BUTTON_C9].isPushed = 0;
    buttons[BUTTON_C9].hasBeenAcknowledged = 0;
    buttons[BUTTON_C9].isEnabled = 0;
    buttons[BUTTON_C9].buttonEventHandler = eventHandlerC9;
    memcpy(buttons[BUTTON_C9].title, "0xC9\0", 5);

    buttons[BUTTON_CB].x_pos = CB_BUTTON_X;
    buttons[BUTTON_CB].y_pos = CB_BUTTON_Y;
    buttons[BUTTON_CB].isPushed = 0;
    buttons[BUTTON_CB].hasBeenAcknowledged = 0;
    buttons[BUTTON_CB].isEnabled = 0;
    buttons[BUTTON_CB].buttonEventHandler = eventHandlerCB;
    memcpy(buttons[BUTTON_CB].title, "0xCB\0", 5);

    buttons[BUTTON_CC].x_pos = CC_BUTTON_X;
    buttons[BUTTON_CC].y_pos = CC_BUTTON_Y;
    buttons[BUTTON_CC].isPushed = 0;
    buttons[BUTTON_CC].hasBeenAcknowledged = 0;
    buttons[BUTTON_CC].isEnabled = 0;
    buttons[BUTTON_CC].buttonEventHandler = eventHandlerCC;
    memcpy(buttons[BUTTON_CC].title, "0xCC\0", 5);

    buttons[BUTTON_CONNECT].x_pos = CONNECT_BUTTON_X;
    buttons[BUTTON_CONNECT].y_pos = CONNECT_BUTTON_Y;
    buttons[BUTTON_CONNECT].isPushed = 0;
    buttons[BUTTON_CONNECT].hasBeenAcknowledged = 0;
    buttons[BUTTON_CONNECT].buttonEventHandler = buttonConnectPressed;
    buttons[BUTTON_CONNECT].isEnabled = 1;
    memcpy(buttons[BUTTON_CONNECT].title, "Conn.\0", 6);

    buttons_ramp_cycle[0].x_pos = 400;
    buttons_ramp_cycle[0].y_pos = 205;
    buttons_ramp_cycle[0].isPushed = 0;
    buttons_ramp_cycle[0].hasBeenAcknowledged= 0;
    buttons_ramp_cycle[0].isEnabled = 0;
    buttons_ramp_cycle[0].buttonEventHandler = decreaseRampID;
    memcpy(buttons_ramp_cycle[0].title, "<<", 2);

    buttons_ramp_cycle[1].x_pos = 440;
    buttons_ramp_cycle[1].y_pos = 205;
    buttons_ramp_cycle[1].isPushed = 0;
    buttons_ramp_cycle[1].isEnabled = 0;
    buttons_ramp_cycle[1].hasBeenAcknowledged= 0;
    buttons_ramp_cycle[1].buttonEventHandler = increaseRampID;
    memcpy(buttons_ramp_cycle[1].title, ">>", 2);

    buttons_ramp_cycle[2].x_pos = 400;
    buttons_ramp_cycle[2].y_pos = 235;
    buttons_ramp_cycle[2].isPushed = 0;
    buttons_ramp_cycle[2].hasBeenAcknowledged= 0;
    buttons_ramp_cycle[2].buttonEventHandler = decreaseCycleID;
    buttons_ramp_cycle[2].isEnabled = 0;
    memcpy(buttons_ramp_cycle[2].title, "<<", 2);

    buttons_ramp_cycle[3].x_pos = 440;
    buttons_ramp_cycle[3].y_pos = 235;
    buttons_ramp_cycle[3].isPushed = 0;
    buttons_ramp_cycle[3].isEnabled = 0;
    buttons_ramp_cycle[3].hasBeenAcknowledged= 0;
    buttons_ramp_cycle[3].buttonEventHandler = increaseCycleID;
    memcpy(buttons_ramp_cycle[3].title, ">>", 2);

    buttons_ramp_cycle[4].x_pos = 400;
    buttons_ramp_cycle[4].y_pos = 145;
    buttons_ramp_cycle[4].isPushed = 0;
    buttons_ramp_cycle[4].hasBeenAcknowledged = 0;
    buttons_ramp_cycle[4].buttonEventHandler = decreaseAnalogInput;
    buttons_ramp_cycle[4].isEnabled = 0;
    memcpy(buttons_ramp_cycle[4].title, "<<", 2);

    buttons_ramp_cycle[5].x_pos = 440;
    buttons_ramp_cycle[5].y_pos = 145;
    buttons_ramp_cycle[5].isPushed = 0;
    buttons_ramp_cycle[5].isEnabled = 0;
    buttons_ramp_cycle[5].hasBeenAcknowledged= 0;
    buttons_ramp_cycle[5].buttonEventHandler = increaseAnalogInput;
    memcpy(buttons_ramp_cycle[5].title, ">>", 2);

    buttons_ramp_cycle[6].x_pos = 400;
    buttons_ramp_cycle[6].y_pos = 175;
    buttons_ramp_cycle[6].isPushed = 0;
    buttons_ramp_cycle[6].hasBeenAcknowledged = 0;
    buttons_ramp_cycle[6].buttonEventHandler = decreaseDigitalInput;
    buttons_ramp_cycle[6].isEnabled = 0;
    memcpy(buttons_ramp_cycle[6].title, "<<", 2);

    buttons_ramp_cycle[7].x_pos = 440;
    buttons_ramp_cycle[7].y_pos = 175;
    buttons_ramp_cycle[7].isPushed = 0;
    buttons_ramp_cycle[7].isEnabled = 0;
    buttons_ramp_cycle[7].hasBeenAcknowledged= 0;
    buttons_ramp_cycle[7].buttonEventHandler = increaseDigitalInput;
    memcpy(buttons_ramp_cycle[7].title, ">>", 2);

    pboards_c = 0;
    for (int i = 0; i < NUMBER_OF_BOARDS; i++) {
        pboards[i].board.module = NONE;

        pboards[i].isEnabled = 0;
        pboards[i].isPushed = 0;
        pboards[i].order = (uint8_t) i;
    }

    pboards[0].x = 25;
    pboards[0].y = 90;

    pboards[1].x = 25;
    pboards[1].y = 180;

    pboards[2].x = 240;
    pboards[2].y = 90;

    pboards[3].x = 240;
    pboards[3].y = 180;

    BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize());

    aScreen = BOARD_SELECTION;

    drawHomeScreen();

    isReady = 0;
}
Beispiel #12
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  uint32_t counter = 0, transparency = 0;
  uint8_t str[30];
  uwInternelBuffer = (uint8_t *)0xC0260000;

  /* Enable the CPU Cache */
  CPU_CACHE_Enable();

  /* 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
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();
  
  /* Configure the system clock to 200 MHz */
  SystemClock_Config();
  
  /* Configure LED3 */
  BSP_LED_Init(LED3);
  
  /*##-1- Configure LCD ######################################################*/
  LCD_Config(); 
  
  /* Configure TAMPER Button */
  BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO);   

  BSP_SD_Init();

  while(BSP_SD_IsDetected() != SD_PRESENT)
  {
        BSP_LCD_SetTextColor(LCD_COLOR_RED);
        BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"  Please insert SD Card                  ");
  }
  
  BSP_LCD_Clear(LCD_COLOR_BLACK);
  
  /*##-2- Link the SD Card disk I/O driver ###################################*/
  if(FATFS_LinkDriver(&SD_Driver, SD_Path) == 0)
  {
    /*##-3- Initialize the Directory Files pointers (heap) ###################*/
    for (counter = 0; counter < MAX_BMP_FILES; counter++)
    {
      pDirectoryFiles[counter] = malloc(MAX_BMP_FILE_NAME);
      if(pDirectoryFiles[counter] == NULL)
      {
        /* Set the Text Color */
        BSP_LCD_SetTextColor(LCD_COLOR_RED);
        
        BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"  Cannot allocate memory ");
        
        while(1)
        {
        }       
      }
    }
    
    /* Get the BMP file names on root directory */
    ubNumberOfFiles = Storage_GetDirectoryBitmapFiles("/Media", pDirectoryFiles);
    
    if (ubNumberOfFiles == 0)
    {
      for (counter = 0; counter < MAX_BMP_FILES; counter++)
      {
        free(pDirectoryFiles[counter]);
      }
      BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"  No Bitmap files...      ");
      while(1)
      {
      }
    }
  }
  else
  {
    /* FatFs Initialization Error */
    Error_Handler();    
  }
  while(1)
  {     
    counter = 0;
    
    while ((counter) < ubNumberOfFiles)
    {
      /* Step1 : Display on Foreground layer -------------------------------*/ 
      /* Format the string */
      sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);
      
      if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) 
      {  
        /* Format the string */        
        sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);
        
        /* Set LCD foreground Layer */
        BSP_LCD_SelectLayer(1);
        
        /* Open a file and copy its content to an internal buffer */
        Storage_OpenReadFile(uwInternelBuffer, (const char*)str);
        
        /* Write bmp file on LCD frame buffer */
        BSP_LCD_DrawBitmap(0, 0, uwInternelBuffer);  
        
        /* Configure the transparency for background layer : Increase the transparency */
        for (transparency = 0; transparency < 255; (transparency++))
        {        
          BSP_LCD_SetTransparency(1, transparency);
          
          /* Insert a delay of display */
          HAL_Delay(2);
        }
        
        /* Wait for tamper button pressed */
        while (BSP_PB_GetState(BUTTON_TAMPER) == RESET)
        {
        }
        
        /* Configure the transparency for foreground layer : decrease the transparency */
        for (transparency = 255; transparency > 0; transparency--)
        {        
          BSP_LCD_SetTransparency(1, transparency);
          
          /* Insert a delay of display */
          HAL_Delay(2);
        }

        /* Clear the Foreground Layer */ 
        BSP_LCD_Clear(LCD_COLOR_BLACK);
        
        /* Jump to the next image */  
        counter++;
        
        /* Step2 : Display on Background layer -----------------------------*/
        /* Format the string */  
        sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);
        
        if ((Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) || (counter < (ubNumberOfFiles)))
        {         
          /* Connect the Output Buffer to LCD Background Layer  */
          BSP_LCD_SelectLayer(0);
          
          /* Format the string */  
          sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);
          
          /* Open a file and copy its content to an internal buffer */
          Storage_OpenReadFile(uwInternelBuffer, (const char*)str);
          
          /* Write bmp file on LCD frame buffer */
          BSP_LCD_DrawBitmap(0, 0, uwInternelBuffer);
          
          /* Configure the transparency for background layer : decrease the transparency */  
          for (transparency = 0; transparency < 255; (transparency++))
          {        
            BSP_LCD_SetTransparency(0, transparency);
            
            /* Insert a delay of display */
            HAL_Delay(2);
          }
          
          /* wait for tamper button pressed */
          while (BSP_PB_GetState(BUTTON_TAMPER) == RESET)
          {
          }
          
          /* Step3 : -------------------------------------------------------*/              
          /* Configure the transparency for background layer : Increase the transparency */
          for (transparency = 255; transparency > 0; transparency--)
          {        
            BSP_LCD_SetTransparency(0, transparency);
            
            /* Insert a delay of display */
            HAL_Delay(2);
          }

          /* Clear the Background Layer */
          BSP_LCD_Clear(LCD_COLOR_BLACK);

          counter++;   
        }
        else if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0)
        {
          /* Set the Text Color */
          BSP_LCD_SetTextColor(LCD_COLOR_RED); 
          
          BSP_LCD_DisplayStringAtLine(7, (uint8_t *) str);        
          BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"    File type not supported. "); 
          while(1)
          {
          }      
        }        
      }  
    }      
  }
}
Beispiel #13
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  uint32_t counter = 0, transparency = 0;
  uint8_t str[30];
  uwInternalBuffer = (uint8_t *)INTERNAL_BUFFER_START_ADDRESS;

	/* 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 200 MHz */
  SystemClock_Config();

  /* Configure LED3 */
  BSP_LED_Init(LED3);

  /*##-1- Configure LCD ######################################################*/
  LCD_Config();

  /*##-2- Link the SD Card disk I/O driver ###################################*/
  if(FATFS_LinkDriver(&SD_Driver, SD_Path) == 0)
  {
    /*##-3- Initialize the Directory Files pointers (heap) ###################*/
    for (counter = 0; counter < MAX_BMP_FILES; counter++)
    {
      pDirectoryFiles[counter] = malloc(MAX_BMP_FILE_NAME);
      if(pDirectoryFiles[counter] == NULL)
      {
        /* Set the Text Color */
        BSP_LCD_SetTextColor(LCD_COLOR_RED);

        BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"  Cannot allocate memory ");
        while(1) { ; }
      }
    }

    /* Get the BMP file names on root directory */
    ubNumberOfFiles = Storage_GetDirectoryBitmapFiles("/Media", pDirectoryFiles);

    if (ubNumberOfFiles == 0)
    {
      for (counter = 0; counter < MAX_BMP_FILES; counter++)
      {
        free(pDirectoryFiles[counter]);
      }
      BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"  No Bitmap files...      ");
      while(1) { ; }
    }
  }
  else
  {
    /* FatFs Initialization Error */
    Error_Handler();
  }

  /* Main infinite loop */
  while(1)
  {
    counter = 0;

    while ((counter) < ubNumberOfFiles)
    {
      /* Step1 : Display on Foreground layer -------------------------------*/
      /* Format the string */
      sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);

      if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0)
      {
        /* Format the string */
        sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);

        /* Set LCD foreground Layer */
        BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_FOREGROUND);

        /* Open a file and copy its content to an internal buffer */
        Storage_OpenReadFile(uwInternalBuffer, (const char*)str);

        /* Write bmp file on LCD frame buffer */
        BSP_LCD_DrawBitmap(0, 0, uwInternalBuffer);

        /* Configure the transparency for background layer : Increase the transparency */
        for (transparency = 0; transparency < 255; (transparency++))
        {
          BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_FOREGROUND, transparency);

          /* Insert a delay of display */
          HAL_Delay(10);
        }

        /* Configure the transparency for foreground layer : decrease the transparency */
        for (transparency = 255; transparency > 0; transparency--)
        {
          BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_FOREGROUND, transparency);

          /* Insert a delay of display */
          HAL_Delay(10);
        }

        HAL_Delay(1000);

        /* Clear the Foreground Layer */
        BSP_LCD_Clear(LCD_COLOR_BLACK);

        /* Jump to the next image */
        counter++;

        /* Step2 : Display on Background layer -----------------------------*/
        /* Format the string */
        sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);

        if ((Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) || (counter < (ubNumberOfFiles)))
        {
          /* Connect the Output Buffer to LCD Background Layer  */
          BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_BACKGROUND);

          /* Format the string */
          sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]);

          /* Open a file and copy its content to an internal buffer */
          Storage_OpenReadFile(uwInternalBuffer, (const char*)str);

          /* Write bmp file on LCD frame buffer */
          BSP_LCD_DrawBitmap(0, 0, uwInternalBuffer);

          /* Configure the transparency for background layer : decrease the transparency */
          for (transparency = 0; transparency < 255; (transparency++))
          {
            BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_BACKGROUND, transparency);

            /* Insert a delay of display */
            HAL_Delay(10);
          }

          HAL_Delay(1000);

          /* Step3 : -------------------------------------------------------*/
          /* Configure the transparency for background layer : Increase the transparency */
          for (transparency = 255; transparency > 0; transparency--)
          {
            BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_BACKGROUND, transparency);

            /* Insert a delay of display */
            HAL_Delay(10);
          }

          HAL_Delay(1000);

          /* Clear the Background Layer */
          BSP_LCD_Clear(LCD_COLOR_BLACK);

          counter++;
        }
        else if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0)
        {
          /* Set the Text Color */
          BSP_LCD_SetTextColor(LCD_COLOR_RED);

          BSP_LCD_DisplayStringAtLine(7, (uint8_t *) str);
          BSP_LCD_DisplayStringAtLine(8, (uint8_t*)"    File type not supported. ");
          while(1) { ; }
        }
      }
    }
  }
}
Beispiel #14
0
void LCD_DISCO_F469NI::SetTransparency(uint32_t LayerIndex, uint8_t Transparency)
{
  BSP_LCD_SetTransparency(LayerIndex, Transparency);
}