示例#1
0
/**
  * @brief  Initializes LEDs, touch screen, CRC and SRAM.
  * @param  None
  * @retval None
  */
void k_BspInit(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;

  /* Configure LED1, LED2, LED3 and LED4 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);

  /* Initialize the SRAM */
  BSP_SRAM_Init();

  /* Initialize the Touch screen */
  BSP_TS_Init(320, 240);

  /* Enable CRC to Unlock GUI */
  __HAL_RCC_CRC_CLK_ENABLE();

  /* Enable Back up SRAM */
  __HAL_RCC_BKPSRAM_CLK_ENABLE();


  /* reconfigure FSMC NE3 pin */
  GPIO_InitStructure.Mode      = GPIO_MODE_AF_PP;
  GPIO_InitStructure.Pull      = GPIO_PULLUP;
  GPIO_InitStructure.Speed     = GPIO_SPEED_HIGH;
  GPIO_InitStructure.Alternate = GPIO_AF12_FSMC;
  GPIO_InitStructure.Pin   = GPIO_PIN_10;

  HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
}
示例#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 168 MHz */
  SystemClock_Config();

  /*##-1- Initialize the SRAM ################################################*/
  BSP_SRAM_Init();

  /*##-2- Initialize the LCD #################################################*/
  BSP_LCD_Init();

  /*##-3- Camera Initialization and start capture ############################*/
  /* Initialize the Camera */
  BSP_CAMERA_Init(CAMERA_R320x240);

  /* Start the Camera Capture */
  BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER);

  /* Infinite loop */
  while (1)
  {
  }
}
示例#3
0
/**
  * @brief  Prepares the picture to be saved in microSD.
  * @param  None
  * @retval None
  */
static void Prepare_Picture(void) 
{ 
  uint32_t x_counter = 0, y_counter = 0;
  uint32_t address = SRAM_DEVICE_ADDR;
  uint16_t tmp = 0;
  
  /* Bypass the bitmap header */
  address += (((BSP_LCD_GetXSize() - 80) * (BSP_LCD_GetYSize() - 81)) * 2);  
  
  BSP_SRAM_Init();
  
  /* Prepare picture */
  for(y_counter = 10; y_counter < (BSP_LCD_GetYSize() - 70); y_counter++)
  { 
    for(x_counter = 70; x_counter < (BSP_LCD_GetXSize() - 10); x_counter++)
    {      
      /* Write data to the SRAM memory */
      tmp = BSP_LCD_ReadPixel(x_counter, y_counter);
      
      BSP_SRAM_WriteData(address, &tmp, 1);
      
      /* Increment the source and destination buffers */
      address += 2;      
    }
    address -= 4*(BSP_LCD_GetXSize() - 80);
  }
}
/**
  * @brief  Initializes a Drive
  * @param  lun : not used
  * @retval DSTATUS: Operation status
  */
DSTATUS SRAMDISK_initialize(BYTE lun)
{
  Stat = STA_NOINIT;

  /* Configure the SRAM device */
  BSP_SRAM_Init();

  Stat &= ~STA_NOINIT;
  return Stat;
}
示例#5
0
/**
  * @brief  SRAM Demo
  * @param  None
  * @retval None
  */
void SRAM_demo (void)
{ 
  SRAM_SetHint();
     
  /* Disable the LCD to avoid the refrech from the SDRAM */
  BSP_LCD_DisplayOff();

  /*##-1- Configure the SRAM device ##########################################*/
  /* SRAM device configuration */ 
  if(BSP_SRAM_Init() != SRAM_OK)
  {
    ubSramInit++;
  }
  
  /*##-2- SRAM memory read/write access ######################################*/  
  /* Fill the buffer to write */
  Fill_Buffer(sram_aTxBuffer, BUFFER_SIZE, 0xC20F);   
  
  /* Write data to the SRAM memory */
  if(BSP_SRAM_WriteData(SRAM_DEVICE_ADDR + WRITE_READ_ADDR, sram_aTxBuffer, BUFFER_SIZE) != SRAM_OK)
  {
    ubSramWrite++;
  }   
  
  /* Read back data from the SRAM memory */
  if(BSP_SRAM_ReadData(SRAM_DEVICE_ADDR + WRITE_READ_ADDR, sram_aRxBuffer, BUFFER_SIZE) != SRAM_OK)
  {
    ubSramRead++;
  }  
  
  /*##-3- Checking data integrity ############################################*/
  /* Enable the LCD */
  BSP_LCD_DisplayOn();  

  if(ubSramInit != 0)
  {
    BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SRAM Initialization : FAILED.", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SRAM Test Aborted.", LEFT_MODE);
  }
  else
  {
    BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SRAM Initialization : OK.", LEFT_MODE);
  }
  if(ubSramWrite != 0)
  {
    BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SRAM WRITE : FAILED.", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SRAM Test Aborted.", LEFT_MODE);
  }
  else
  {
    BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SRAM WRITE : OK.", LEFT_MODE);
  }
  if(ubSramRead != 0)
  {
    BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SRAM READ : FAILED.", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SRAM Test Aborted.", LEFT_MODE);
  }
  else
  {
    BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SRAM READ : OK.", LEFT_MODE);
  }
  
  if(Buffercmp(sram_aRxBuffer, sram_aTxBuffer, BUFFER_SIZE) > 0)
  {
    BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SRAM COMPARE : FAILED.", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SRAM Test Aborted.", LEFT_MODE);
  }
  else
  {    
    BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SRAM Test : OK.", LEFT_MODE);
  }
  
  while (1)
  {    
    if(CheckForUserInput() > 0)
    {
      return;
    }
  }
}
示例#6
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 168 MHz */
  SystemClock_Config();
  
  /* Configure LED1 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED3);
  
  /*##-1- Init Host Library ##################################################*/
  USBH_Init(&hUSB_Host, USBH_UserProcess, 0);
  
  /* Add Supported Class */
  USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS);
  
  /* Start Host Process */
  USBH_Start(&hUSB_Host);
  
  /*##-2- Configure Tamper button ############################################*/
  BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO);
  
  /*##-3- Link the USB Host disk I/O driver ##################################*/
  FATFS_LinkDriver(&USBH_Driver, MSC_Path);

  /*##-4- Initialize the SRAM and LCD ########################################*/ 
  BSP_LCD_Init(); 
  BSP_SRAM_Init();
  
  /*##-5- Camera Initialization and start capture ############################*/
  /* Initialize the Camera */
  BSP_CAMERA_Init(RESOLUTION_R320x240);
  
  /* Start the Camera Capture */
  BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER);
   
  /*##-6- Run Application ####################################################*/
  while (1)
  { 
    /* USB Host Background task */
    USBH_Process(&hUSB_Host);

    switch(Appli_state)
    {
    case STORAGE_READY:
      CAMERA_Capture();
      break;
        
    case STORAGE_IDLE:
    default:
      break;      
    } 
  }
}