Ejemplo n.º 1
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{

  /* STM32F3xx 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 have a system clock = 64 Mhz */
  SystemClock_Config();
  
  /* Check the availability of adafruit 1.8" TFT shield on top of STM32NUCLEO
     board. This is done by reading the state of IO PB.00 pin (mapped to JoyStick
     available on adafruit 1.8" TFT shield). If the state of PB.00 is high then
     the adafruit 1.8" TFT shield is available. */  
  if(TFT_ShieldDetect() == SHIELD_DETECTED)
  {
    /* Initialize the LCD */
    BSP_LCD_Init();
    
    /* Configure SD card */
    SDCard_Config(); 
    
    /* Display on TFT Images existing on SD card */
    TFT_DisplayImages();
  }  
  else /* Shield not mounted */
  {   
    LED2_Blink();
  } 
  
  /* Infinite loop */
  while (1)
  {
  }
}
Ejemplo n.º 2
0
/**
  * @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 100 MHz */
  SystemClock_Config();
  
  /* Check the availability of adafruit 1.8" TFT shield on top of STM32NUCLEO
     board. This is done by reading the state of IO PB.00 pin (mapped to JoyStick
     available on adafruit 1.8" TFT shield). If the state of PB.00 is high then
     the adafruit 1.8" TFT shield is available. */  
  if(TFT_ShieldDetect() == SHIELD_DETECTED)
  {
    /* Initialize the LCD */
    BSP_LCD_Init();
    
    /* Configure SD card */
    SDCard_Config(); 
    
    /* Display on TFT Images existing on SD card */
    TFT_DisplayImages();
  }  
  else /* Shield not mounted */
  {   
    LED2_Blink();
  } 
  
  /* Infinite loop */
  while (1)
  {
  }
}
Ejemplo n.º 3
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
  int main(void)
  {
    uint32_t counter = 0, transparency = 0;
    uint8_t str[30];
     
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       files (startup_stm32f429_439xx.s) before to branch to application main.
     */ 
    
    /* TAMPER button will be used */
    STM_EVAL_PBInit(BUTTON_TAMPER, BUTTON_MODE_GPIO); 
    
    /* SysTick end of count event each 10ms */
    SysTick_Config(SystemCoreClock / 1000);

    /* Configure LCD */
    LCD_Config();
    
    /* SD Card Configuration */
    SDCard_Config();    
        
    /* Configure the File System */
    FileSystem_Config();    
      
    /* Get the BMP file names on root directory */
    ubNumberOfFiles = Storage_GetDirectoryBitmapFiles("/PICT", pDirectoryFiles);
    
    if (ubNumberOfFiles == 0)
    {
      for (counter = 0; counter < MAX_BMP_FILES; counter++)
      {
        free(pDirectoryFiles[counter]);
      }
      LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)"  No Bitmap files...      ");
      while(1)
      {
      }
    }
      
    while(1)
    {     
      counter = 0;
       
      while ((counter) < ubNumberOfFiles)
      {
        /* Step1 : Display on Foreground layer -------------------------------*/ 
        /* Format the string */
        sprintf ((char*)str, "PICT/%-11.11s", pDirectoryFiles[counter]);
         
        if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) 
        {  
          /* Format the string */        
          sprintf ((char*)str, "PICT/%-11.11s", pDirectoryFiles[counter]);
            
          /* Set LCD foreground Layer */
          LCD_SetLayer(LCD_FOREGROUND_LAYER);
            
          /* Open a file and copy its content to an internal buffer */
          Storage_OpenReadFile(uwInternelBuffer, (const char*)str);
            
          /* Write bmp file on LCD frame buffer */
          LCD_WriteBMP(uwInternelBuffer);  
          
          /* Configure the transparency for background layer : Increase the transparency */
          for (transparency = 0; transparency < 255; (transparency++))
          {        
            LCD_SetTransparency(transparency);
            
            /* Insert a delay of display */
            Delay(5);
          }
            
          /* Wait for tamper button pressed */
          while (STM_EVAL_PBGetState(BUTTON_TAMPER) == Bit_SET)
          {
          }
            
          /* Configure the transparency for foreground layer : decrease the transparency */
          for (transparency = 255; transparency > 0; transparency--)
          {        
            LCD_SetTransparency(transparency);
            
            /* Insert a delay of display */
            Delay(5);
          }
           
          /* Jump to the next image */  
          counter++;
          
          /* Step2 : Display on Background layer -----------------------------*/
          /* Format the string */  
          sprintf ((char*)str, "PICT/%-11.11s", pDirectoryFiles[counter]);
          
          if ((Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) || (counter < (ubNumberOfFiles)))
          {         
            /* Connect the Output Buffer to LCD Background Layer  */
            LCD_SetLayer(LCD_BACKGROUND_LAYER);
            
            /* Format the string */  
            sprintf ((char*)str, "PICT/%-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 */
            LCD_WriteBMP(uwInternelBuffer);
              
            /* Configure the transparency for background layer : decrease the transparency */  
            for (transparency = 0; transparency < 255; (transparency++))
            {        
              LCD_SetTransparency(transparency);
              
              /* Insert a delay of display */
              Delay(5);
            }
              
            /* wait for tamper button pressed */
            while (STM_EVAL_PBGetState(BUTTON_TAMPER) == Bit_SET)
            {
            }
            
            /* Step3 : -------------------------------------------------------*/              
            /* Configure the transparency for background layer : Increase the transparency */
            for (transparency = 255; transparency > 0; transparency--)
            {        
              LCD_SetTransparency(transparency);
            
              /* Insert a delay of display */
              Delay(5);
            }
            counter++;   
          }
          else if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0)
          {
            /* Set the Text Color */
            LCD_SetTextColor(LCD_COLOR_RED); 
        
            LCD_DisplayStringLine(LCD_LINE_7, (uint8_t *) str);        
            LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)"    File type not supported. "); 
            while(1)
            {
            }      
          }        
        }  
      }      
    }      
  }
Ejemplo n.º 4
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  uint32_t counter = 0;
  uint8_t  str[30];

  /*!< At this stage the microcontroller clock setting is already configured,
       this is done through SystemInit() function which is called from startup
       files (startup_stm32f429_439xx.s) before to branch to application main.
     */

  /* Example resources configuration -----------------------------------------*/
  /* Configure LCD */
  LCD_Config();

  /* Configure SD Card */
  SDCard_Config();

  /* Configure the File System */
  FileSystem_Config();

  /* Display Background picture ----------------------------------------------*/

  /* Set Background Layer  */
  LCD_SetLayer(LCD_BACKGROUND_LAYER);

  /* Open directory */
  if (f_opendir(&directory, "/BACK") != FR_OK)
  {
    /* Set the Text Color */
    LCD_SetTextColor(LCD_COLOR_RED);

    LCD_DisplayStringLine(LCD_LINE_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 */
    LCD_WriteBMP(uwInternelBuffer);
  }
  else
  {
    /* Set the Text Color */
    LCD_SetTextColor(LCD_COLOR_RED);

    LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)"    File type not supported. ");
    while(1)
    {
    }
  }


  /* Display Foreground pictures ---------------------------------------------*/
  /* Set Foreground Layer  */
  LCD_SetLayer(LCD_FOREGROUND_LAYER);

  /* Decrease the foreground transprency */
  LCD_SetTransparency(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 */
    LCD_SetTextColor(LCD_COLOR_RED);

    LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)"    No Bitmap files...      ");
    while(1)
    {
    }
  }

  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);

        /* Write bmp file on LCD frame buffer */
        LCD_WriteBMP(uwInternelBuffer);

        /* jump to next image */
        counter++;
      }
      else
      {

        /* Set the Text Color */
        LCD_SetTextColor(LCD_COLOR_RED);

        LCD_DisplayStringLine(LCD_LINE_7, (uint8_t *) str);
        LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)"    File type not supported. ");
        while(1)
        {
        }
      }
    }
  }
}