Exemplo n.º 1
0
/**
  * @brief  DeInitializes the SD card device.
  * @param  SdCard: SD card to be used, that should be SD_CARD1 or SD_CARD2 
  * @retval SD status
  */
uint8_t BSP_SD_DeInitEx(uint32_t SdCard)
{ 
  uint8_t sd_state = MSD_OK;
  
  /* Set back Mfx pin to INPUT mode in case it was in exti */
  UseExtiModeDetection = 0;
  if(SdCard == SD_CARD1)
  {
    uSdHandle.Instance = SDMMC1;    
    /* HAL SD deinitialization */
    if(HAL_SD_DeInit(&uSdHandle) != HAL_OK)
    {
      sd_state = MSD_ERROR;
    }
    
    /* Msp SD deinitialization */
    BSP_SD_MspDeInit(&uSdHandle, NULL);    
    BSP_IO_ConfigPin(SD1_DETECT_PIN, IO_MODE_INPUT_PU);
  }
  else
  {
    uSdHandle2.Instance = SDMMC2;    
    BSP_IO_ConfigPin(SD2_DETECT_PIN, IO_MODE_INPUT_PU); 
    
    /* HAL SD deinitialization */
    if(HAL_SD_DeInit(&uSdHandle2) != HAL_OK)
    {
      sd_state = MSD_ERROR;
    }
    
    /* Msp SD deinitialization */
    BSP_SD_MspDeInit(&uSdHandle2, NULL);
  }  
  return  sd_state;
}
Exemplo n.º 2
0
/**
  * @brief  Audio Application Init.
  * @param  None
  * @retval None
  */
static void AUDIO_InitApplication(void)
{
  /* Configure Key Button */
  BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI);              
  
  /* Configure IO and LED1 */
  BSP_IO_Init();
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED4);
 
  /* Configure Joystick in EXTI mode */
  BSP_JOY_Init(JOY_MODE_EXTI);
  
  /* Camera has to be powered down as some signals use same GPIOs between
   * I2S signals and camera bus. Camera drives its signals to low impedance
   * when powered ON. So the camera is powered off to let its signals
   * in high impedance */

  /* Camera power down sequence */
  BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);

  /* De-assert the camera STANDBY pin (active high) */
  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);

  /* Assert the camera RSTI pin (active low) */
  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);

  /* Initialize the LCD */
  BSP_LCD_Init();
  
  /* LCD Layer Initialization */
  BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); 
  
  /* Select the LCD Layer */
  BSP_LCD_SelectLayer(1);
  
  /* Enable the display */
  BSP_LCD_DisplayOn();
  
  /* Init the LCD Log module */
  LCD_LOG_Init();
  
  LCD_LOG_SetHeader((uint8_t *)"Audio Playback and Record Application");
  
  LCD_UsrLog("USB Host library started.\n"); 
  
  /* Start Audio interface */
  USBH_UsrLog("Starting Audio Demo");
  
  /* Init Audio interface */
  AUDIO_PLAYER_Init();
  
  /* Start Audio interface */
  AUDIO_MenuInit();
}
/**
  * @brief  CAMERA power down
  * @param  None
  * @retval None
  */
void BSP_CAMERA_PwrDown(void)
{
  /* Camera power down sequence */
  BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);

  /* De-assert the camera STANDBY pin (active high) */
  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);

  /* Assert the camera RSTI pin (active low) */
  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);
}
Exemplo n.º 4
0
/**
  * @brief  Configures Interrupt mode for SD detection pin.
  * @param  None
  * @retval IO_OK: if all initializations are OK. Other value if error.
  */
uint8_t BSP_SD_ITConfig(void)
{
  /* Check SD card detect pin */
  if (BSP_IO_ReadPin(SD_DETECT_PIN) != SD_DETECT_PIN)
  {
    return BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_IT_RISING_EDGE_PU);
  }
  else
  {
    return BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_IT_FALLING_EDGE_PU);
  }
}
/**
  * @brief  Configures and enables the touch screen interrupts.
  * @retval TS_OK if all initializations are OK. Other value if error.
  */
uint8_t BSP_TS_ITConfig(void)
{
  uint8_t ts_status = TS_ERROR;
  uint8_t io_status = IO_ERROR;

  /* Initialize the IO */
  io_status = BSP_IO_Init();
  if(io_status != IO_OK)
  {
    return (ts_status);
  }

  /* Configure TS IT line IO : is active low on FT6206 (see data sheet)                           */
  /* Configure TS_INT_PIN (MFX_IO_14) low level to generate MFX_IRQ_OUT in EXTI on MCU            */
  /* This will call HAL_GPIO_EXTI_Callback() that is setting variable 'mfx_exti_received' to 1b1' */
  io_status = BSP_IO_ConfigPin(TS_INT_PIN, IO_MODE_IT_LOW_LEVEL_PU);
  if(io_status != IO_OK)
  {
    return (ts_status);
  }

  /* Enable the TS in interrupt mode */
  /* In that case the INT output of FT6206 when new touch is available */
  /* is active low and directed on MFX IO14 */
  ts_driver->EnableIT(I2C_Address);

  /* If arrived here : set good status on exit */
  ts_status = TS_OK;

  return (ts_status);
}
/**
  * @brief  Configures Interrupt mode for SD detection pin.
  * @param  None
  * @retval Returns 0
  */
uint8_t BSP_SD_ITConfig(void)
{  
  /* Configure Interrupt mode for SD detection pin */  
  BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_IT_FALLING_EDGE);
  
  return 0;
}
Exemplo n.º 7
0
/**
  * @brief  Initializes the SD Detect pin MSP.
  * @param  hsd: SD handle
  * @param  Params
  * @retval None
  */
static void SD_Detect_MspInit(void)
{
  if (BSP_IO_Init() == IO_ERROR)
  {
    BSP_ErrorHandler();
  }
  BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT_PU);
}
Exemplo n.º 8
0
/**
 * @brief  Detects if SD card is correctly plugged in the memory slot or not.
 * @param  SdCard: SD card to be used, that should be SD_CARD1 or SD_CARD2 
 * @retval Returns if SD is detected or not
 */
uint8_t BSP_SD_IsDetectedEx(uint32_t SdCard)
{
  __IO uint8_t status = SD_PRESENT;
  
  if(SdCard == SD_CARD1)
  {
    /* Check SD card detect pin */
    if((BSP_IO_ReadPin(SD1_DETECT_PIN)&SD1_DETECT_PIN) != SD1_DETECT_PIN)
    {
      if (UseExtiModeDetection)
      {
        BSP_IO_ConfigPin(SD1_DETECT_PIN, IO_MODE_IT_RISING_EDGE_PU);
      }
    }
    else
    {
      status = SD_NOT_PRESENT;
      if (UseExtiModeDetection)
      {
        BSP_IO_ConfigPin(SD1_DETECT_PIN, IO_MODE_IT_FALLING_EDGE_PU);
      }
    }
  }
  else
  {
    /* Check SD card detect pin */
    if((BSP_IO_ReadPin(SD2_DETECT_PIN)&SD2_DETECT_PIN) != SD2_DETECT_PIN)
    {
      if (UseExtiModeDetection)
      {
        BSP_IO_ConfigPin(SD2_DETECT_PIN, IO_MODE_IT_RISING_EDGE_PU);
      }
    }
    else
    {
      status = SD_NOT_PRESENT;
      if (UseExtiModeDetection)
      {
        BSP_IO_ConfigPin(SD2_DETECT_PIN, IO_MODE_IT_FALLING_EDGE_PU);
      }
    }    
  }
  return status;
}
Exemplo n.º 9
0
/**
  * @brief  Get Idd current value.
  * @param  IddValue: Pointer on u32 to store Idd. Value unit is 10 nA.
  * @retval None
  */
void BSP_IDD_GetValue(uint32_t *IddValue)
{
  /* De-activate the OPAMP used ny the MFX to measure the current consumption */
  BSP_IO_ConfigPin(IDD_AMP_CONTROL_PIN, IO_MODE_OUTPUT);
  BSP_IO_WritePin(IDD_AMP_CONTROL_PIN, GPIO_PIN_RESET);

  if (IddDrv->GetValue != NULL)
  {
    IddDrv->GetValue(IDD_I2C_ADDRESS, IddValue);
  }
}
/**
 * @brief  Detects if SD card is correctly plugged in the memory slot or not.
 * @retval Returns if SD is detected or not
 */
uint8_t BSP_SD_IsDetected(void)
{
  __IO uint8_t status = SD_PRESENT;
  
  /* Check SD card detect pin */
  if((BSP_IO_ReadPin(SD_DETECT_PIN)&SD_DETECT_PIN) != SD_DETECT_PIN)
  {
     if (UseExtiModeDetection)
      BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_IT_RISING_EDGE_PU);

  }
  else
  {
    status = SD_NOT_PRESENT;
    if (UseExtiModeDetection)
      BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_IT_FALLING_EDGE_PU);
  }

  return status;
}
Exemplo n.º 11
0
/**
  * @brief  Initializes the SD Detect pin MSP.
  * @param  hsd: SD handle
  * @param  Params
  * @retval None
  */
static void SD_Detect_MspDeInit(void)
{
  /* Disable all interrupts */
  /*HAL_NVIC_DisableIRQ(MFX_INT_EXTI_IRQn);*/

  if (BSP_IO_Init() == IO_ERROR)
  {
    BSP_ErrorHandler();
  }
  BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_ANALOG);
}
Exemplo n.º 12
0
/**
  * @brief  Start Measurement campaign
  * @retval None
  */
void BSP_IDD_StartMeasure(void)
{

  /* Activate the OPAMP used ny the MFX to measure the current consumption */
  BSP_IO_ConfigPin(IDD_AMP_CONTROL_PIN, IO_MODE_OUTPUT);
  BSP_IO_WritePin(IDD_AMP_CONTROL_PIN, GPIO_PIN_RESET);

  if (IddDrv->Start != NULL)
  {
    IddDrv->Start(IDD_I2C_ADDRESS);
  }
}
/**
  * @brief  Initializes the camera.
  * @param  Camera: Pointer to the camera configuration structure
  * @retval Camera status
  */
uint8_t BSP_CAMERA_Init(uint32_t Resolution)
{ 
  DCMI_HandleTypeDef *phdcmi;
  
  uint8_t ret = CAMERA_ERROR;
  
  /* Get the DCMI handle structure */
  phdcmi = &hdcmi_eval;
  
  /*** Configures the DCMI to interface with the camera module ***/
  /* DCMI configuration */
  phdcmi->Init.CaptureRate      = DCMI_CR_ALL_FRAME;  
  phdcmi->Init.HSPolarity       = DCMI_HSPOLARITY_LOW;
  phdcmi->Init.SynchroMode      = DCMI_SYNCHRO_HARDWARE;
  phdcmi->Init.VSPolarity       = DCMI_VSPOLARITY_LOW;
  phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
  phdcmi->Init.PCKPolarity      = DCMI_PCKPOLARITY_RISING;
  phdcmi->Instance              = DCMI;  

  /* Configure IO functionalities for camera detect pin */
  BSP_IO_Init(); 
  
  /* Set the camera STANDBY pin */
  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
  BSP_IO_WritePin(XSDN_PIN, SET);
  
  /* Check if the camera is plugged */
  if(BSP_IO_ReadPin(CAM_PLUG_PIN))
  {
    return CAMERA_ERROR;
  }
  
  /* DCMI Initialization */
  DCMI_MspInit();  
  HAL_DCMI_Init(phdcmi);
  
  if(ov2640_ReadID(CAMERA_I2C_ADDRESS) == OV2640_ID)
  { 
    /* Initialize the camera driver structure */
    camera_drv = &ov2640_drv;     
    
    /* Camera Init */   
    camera_drv->Init(CAMERA_I2C_ADDRESS, Resolution);
    
    /* Return CAMERA_OK status */
    ret = CAMERA_OK;
  } 
  
  current_resolution = Resolution;
  
  return ret;
}
Exemplo n.º 14
0
/**
  * @brief  Configures and enables the touch screen interrupts.
  * @retval TS_OK if all initializations are OK. Other value if error.
  */
uint8_t BSP_TS_ITConfig(void)
{
  /* Initialize the IO */
  BSP_IO_Init();
  
  /* Configure TS IT line IO */
  BSP_IO_ConfigPin(TS_INT_PIN, IO_MODE_IT_FALLING_EDGE);
  
  /* Enable the TS ITs */
  tsDriver->EnableIT(I2cAddress);

  return TS_OK;  
}
Exemplo n.º 15
0
/**
  * @brief  Initializes the STM324x9I-EVAL's LCD and LEDs resources.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
  /* Initialize STM324x9I-EVAL's LEDs */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);
  
  /* Init IO Expander */
  BSP_IO_Init();
  /* Enable IO Expander interrupt for ETH MII pin */
  BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);
}
Exemplo n.º 16
0
/**
  * @brief  Initializes the STM324x9I-EVAL's LCD and LEDs resources.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
  /* Configure LED1, LED2, LED3 and LED4 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);
  
  /* Init IO Expander */
  BSP_IO_Init();
  /* Enable IO Expander interrupt for ETH MII pin */
  BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);
}
/**
  * @brief  Initializes the SD card device.
  * @retval SD status
  */
uint8_t BSP_SD_Init(void)
{
  uint8_t sd_state = MSD_OK;

  /* PLLSAI is dedicated to LCD periph. Do not use it to get 48MHz*/

  /* uSD device interface configuration */
  uSdHandle.Instance = SDIO;

  uSdHandle.Init.ClockEdge           = SDIO_CLOCK_EDGE_RISING;
  uSdHandle.Init.ClockBypass         = SDIO_CLOCK_BYPASS_DISABLE;
  uSdHandle.Init.ClockPowerSave      = SDIO_CLOCK_POWER_SAVE_DISABLE;
  uSdHandle.Init.BusWide             = SDIO_BUS_WIDE_1B;
  uSdHandle.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_ENABLE;
  uSdHandle.Init.ClockDiv            = SDIO_TRANSFER_CLK_DIV;

  /* Configure IO functionalities for SD detect pin */
  BSP_IO_Init();

  /* Check if the SD card is plugged in the slot */
  BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT_PU);
  if(BSP_SD_IsDetected() != SD_PRESENT)
  {
    return MSD_ERROR_SD_NOT_PRESENT;
  }
  
  /* Msp SD initialization */
  BSP_SD_MspInit(&uSdHandle, NULL);

  /* HAL SD initialization */
  if(HAL_SD_Init(&uSdHandle, &uSdCardInfo) != SD_OK)
  {
    sd_state = MSD_ERROR;
  }

  /* Configure SD Bus width */
  if(sd_state == MSD_OK)
  {
    /* Enable wide operation */
    if(HAL_SD_WideBusOperation_Config(&uSdHandle, SDIO_BUS_WIDE_4B) != SD_OK)
    {
      sd_state = MSD_ERROR;
    }
    else
    {
      sd_state = MSD_OK;
    }
  }
  return  sd_state;
}
Exemplo n.º 18
0
/**
  * @brief  Initializes the STM324x9I-EVAL's LCD and LEDs resources.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
#ifdef USE_LCD
  uint8_t lcd_status = LCD_OK;
#endif /* USE_LCD */


  /* Configure LED1, LED2, LED3 and LED4 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);
  
  /* Init MFX IO Expander */
  BSP_IO_Init();
  
  /* Enable MFX IO Expander interrupt for ETH MII pin */
  BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);
  
#ifdef USE_LCD

  /* Initialize and start the LCD display in mode 'lcd_mode'
   *  Using LCD_FB_START_ADDRESS as frame buffer displayed contents.
   *  This buffer is modified by the BSP (draw fonts, objects depending on BSP calls).
   */

  /* Set Portrait orientation if needed, by default orientation is set to
     Landscape */
  
  /* 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_SetFont(&LCD_DEFAULT_FONT);
  
  /* Initialize LCD Log module */
  LCD_LOG_Init();
  
  /* Show Header and Footer texts */
  LCD_LOG_SetHeader((uint8_t *)"Webserver Application Netconn API");
  LCD_LOG_SetFooter((uint8_t *)"STM32469I-EVAL board");
  
  LCD_UsrLog ((char *)"  State: Ethernet Initialization ...\n");

#endif /* USE_LCD */
}
/**
  * @brief  Configures and enables the touch screen interrupts.
  * @param  None
  * @retval TS_OK: if ITconfig is OK. Other value if error.
  */
uint8_t BSP_TS_ITConfig(void)
{
  uint8_t ret = TS_ERROR;

  /* Initialize the IO */
  ret = BSP_IO_Init();
  
  /* Configure TS IT line IO */
  BSP_IO_ConfigPin(TS_INT_PIN, IO_MODE_IT_FALLING_EDGE);
  
  /* Enable the TS ITs */
  TsDrv->EnableIT(TS_I2C_ADDRESS);

  return ret;  
}
Exemplo n.º 20
0
/**
  * @brief  Configures joystick GPIO and EXTI modes.
  * @param  Joy_Mode: Button mode.
  *          This parameter can be one of the following values:
  *            @arg  JOY_MODE_GPIO: Joystick pins will be used as simple IOs
  *            @arg  JOY_MODE_EXTI: Joystick pins will be connected to EXTI line 
  *                                 with interrupt generation capability  
  * @retval IO_OK: if all initializations are OK. Other value if error.
  */
uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode)
{
  uint8_t ret = 0;
     
  /* Initialize the IO functionalities */
  ret = BSP_IO_Init();
  
  if (ret == IO_OK)
  {
    /* Configure joystick pins in IT mode */
    if(Joy_Mode == JOY_MODE_EXTI)
    {
      /* MFX pins init for Joystick */
      /* Configure IO interrupt acquisition mode */
      BSP_IO_ConfigPin(JOY_ALL_PINS, IO_MODE_IT_LOW_LEVEL_PU);
    }
    else
    {
      BSP_IO_ConfigPin(JOY_ALL_PINS, IO_MODE_INPUT_PU);
    }
  }
  
  return ret; 
}
/**
  * @brief  CAMERA hardware reset
  * @param  None
  * @retval None
  */
void BSP_CAMERA_HwReset(void)
{
  /* Camera sensor RESET sequence */
  BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);

  /* Assert the camera STANDBY pin (active high)  */
  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_SET);

  /* Assert the camera RSTI pin (active low) */
  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);

  HAL_Delay(100);   /* RST and XSDN signals asserted during 100ms */

  /* De-assert the camera STANDBY pin (active high) */
  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);

  HAL_Delay(3);     /* RST de-asserted and XSDN asserted during 3ms */

  /* De-assert the camera RSTI pin (active low) */
  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_SET);

  HAL_Delay(6);     /* RST de-asserted during 3ms */
}
Exemplo n.º 22
0
/**
  * @brief  Configurates the BSP.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
  /* Configure LED1, LED2, LED3 and LED4 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);
  
  /* Set Systick Interrupt to the highest priority */
  HAL_NVIC_SetPriority(SysTick_IRQn, 0x0, 0x0);
  
  /* Init IO Expander */
  BSP_IO_Init();
  /* Enable IO Expander interrupt for ETH MII pin */
  BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);
}
Exemplo n.º 23
0
/**
  * @brief  Configures joystick GPIO and EXTI modes.
  * @param  Joy_Mode: Button mode.
  *          This parameter can be one of the following values:
  *            @arg  JOY_MODE_GPIO: Joystick pins will be used as simple IOs
  *            @arg  JOY_MODE_EXTI: Joystick pins will be connected to EXTI line 
  *                                 with interrupt generation capability  
  * @retval IO_OK: if all initializations are OK. Other value if error.
  */
uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode)
{
  uint8_t ret = 0;
  
  /* Initialize the IO functionalities */
  ret = BSP_IO_Init();
  
  /* Configure joystick pins in IT mode */
  if(Joy_Mode == JOY_MODE_EXTI)
  {
    /* Configure joystick pins in IT mode */
    BSP_IO_ConfigPin(JOY_ALL_PINS, IO_MODE_IT_FALLING_EDGE);
  }
  
  return ret; 
}
Exemplo n.º 24
0
/**
  * @brief  Configurates the BSP.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
  /* Initialize STM324x9I-EVAL's LEDs */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);

  /* Initialize Key button */
  BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI);
  
  /* Set Systick Interrupt to the highest priority */
  HAL_NVIC_SetPriority(SysTick_IRQn, 0x0, 0x0);
  
  /* Init IO Expander */
  BSP_IO_Init();
  /* Enable IO Expander interrupt for ETH MII pin */
  BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);
}
Exemplo n.º 25
0
/**
  * @brief  Resets the audio codec. It restores the default configuration of the 
  *         codec (this function shall be called before initializing the codec).
  * @note   This function calls an external driver function: The IO Expander driver.
  * @param  None
  * @retval None
  */
static void CODEC_Reset(void)
{
  /* Configure the IO Expander (to use the Codec Reset pin mapped on the IOExpander) */
  BSP_IO_Init();
  
  BSP_IO_ConfigPin(AUDIO_RESET_PIN, IO_MODE_OUTPUT);
  
  /* Power Down the codec */
  BSP_IO_WritePin(AUDIO_RESET_PIN, RESET);

  /* Wait for a delay to insure registers erasing */
  HAL_Delay(CODEC_RESET_DELAY); 
  
  /* Power on the codec */
  BSP_IO_WritePin(AUDIO_RESET_PIN, SET);
   
  /* Wait for a delay to insure registers erasing */
  HAL_Delay(CODEC_RESET_DELAY); 
}
Exemplo n.º 26
0
/**
  * @brief  Setup the BSP.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
  /* Configure LED1, LED2, LED3 and LED4 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);

  /* Configure Key Button */
  BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI);
  
  /* Set Systick Interrupt to the highest priority */
  HAL_NVIC_SetPriority(SysTick_IRQn, 0x0, 0x0);
  
  /* Init MFX */
  BSP_IO_Init();
  
  /* Enable MFX interrupt for ETH MII pin */
  BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);
}
Exemplo n.º 27
0
/**
  * @brief  Configurates the BSP.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
  /* Configure LED1, LED2, LED3 and LED4 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED4);
  
  /* Set Systick Interrupt to the highest priority */
  HAL_NVIC_SetPriority(SysTick_IRQn, 0x0, 0x0);
  
  /* Init IO Expander */
  BSP_IO_Init();
  
  /* Enable IO Expander interrupt for ETH MII pin */
  BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);

#ifdef USE_LCD

  /* Initialize the LCD */
  BSP_LCD_Init();
  
  /* Initialize the LCD Layers */
  BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS);
  
  /* Set LCD Foreground Layer  */
  BSP_LCD_SelectLayer(1);
  
  BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
  
  /* Initialize LCD Log module */
  LCD_LOG_Init();
  
  /* Show Header and Footer texts */
  LCD_LOG_SetHeader((uint8_t *)"Ethernet IAP Application");
  LCD_LOG_SetFooter((uint8_t *)"STM324x9I-EVAL board");
  
  LCD_UsrLog ("  State: Ethernet Initialization ...\n");

#endif
}
/**
  * @brief  DeInitializes the SD card device.
  * @retval SD status
  */
uint8_t BSP_SD_DeInit(void)
{ 
  uint8_t sd_state = MSD_OK;
 
  uSdHandle.Instance = SDIO;
  
  /* Set back Mfx pin to INPUT mode in case it was in exti */
  UseExtiModeDetection = 0;
  BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT_PU);

  /* HAL SD deinitialization */
  if(HAL_SD_DeInit(&uSdHandle) != HAL_OK)
  {
    sd_state = MSD_ERROR;
  }

  /* Msp SD deinitialization */
  uSdHandle.Instance = SDIO;
  BSP_SD_MspDeInit(&uSdHandle, NULL);
  
  return  sd_state;
}
Exemplo n.º 29
0
/**
  * @brief  Initializes the STM32756G-EVAL's LCD and LEDs resources.
  * @param  None
  * @retval None
  */
static void BSP_Config(void)
{
    /* Configure LED1, LED2, LED3 and LED4 */
    BSP_LED_Init(LED1);
    BSP_LED_Init(LED2);
    BSP_LED_Init(LED3);
    BSP_LED_Init(LED4);

    /* Init MFX */
    BSP_IO_Init();

    /* Enable MFX interrupt for ETH MII pin */
    BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE);

#ifdef USE_LCD

    /* Initialize the LCD */
    BSP_LCD_Init();

    /* Initialize the LCD Layers */
    BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS);

    /* Set LCD Foreground Layer  */
    BSP_LCD_SelectLayer(1);

    BSP_LCD_SetFont(&LCD_DEFAULT_FONT);

    /* Initialize LCD Log module */
    LCD_LOG_Init();

    /* Show Header and Footer texts */
    LCD_LOG_SetHeader((uint8_t *)"Webserver Application Socket API");
    LCD_LOG_SetFooter((uint8_t *)"STM32756G-EVAL board");

    LCD_UsrLog ("  State: Ethernet Initialization ...\n");

#endif
}
/**
  * @brief  Stop the CAMERA capture 
  * @param  None
  * @retval Camera status
  */
uint8_t BSP_CAMERA_Stop(void) 
{
  DCMI_HandleTypeDef *phdcmi;
  
  uint8_t ret = CAMERA_ERROR;
  
  /* Get the DCMI handle structure */
  phdcmi = &hdcmi_eval;
  
  if(HAL_DCMI_Stop(phdcmi) == HAL_OK)
  {
    ret = CAMERA_OK;
  }
  
  /* Initialize IO */
  BSP_IO_Init();
  
  /* Reset the camera STANDBY pin */
  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
  BSP_IO_WritePin(XSDN_PIN, RESET);  
  
  return ret;
}