当前位置: 首页>>代码示例>>C++>>正文


C++ BSP_IO_WritePin函数代码示例

本文整理汇总了C++中BSP_IO_WritePin函数的典型用法代码示例。如果您正苦于以下问题:C++ BSP_IO_WritePin函数的具体用法?C++ BSP_IO_WritePin怎么用?C++ BSP_IO_WritePin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BSP_IO_WritePin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: USBH_LL_DriverVBUS

/**
  * @brief  Drives VBUS.
  * @param  phost: Host handle
  * @param  state: VBUS state
  *          This parameter can be one of these values:
  *           0: VBUS Active 
  *           1: VBUS Inactive
  * @retval USBH Status
  */
USBH_StatusTypeDef USBH_LL_DriverVBUS(USBH_HandleTypeDef *phost, uint8_t state)
{
#ifdef USE_USB_FS   
  
  if(state == 0)
  {
    /* Configure Low Charge pump */
    BSP_IO_WritePin(OTG_FS1_POWER_SWITCH_PIN, BSP_IO_PIN_RESET);
  }
  else
  {
    /* Drive High Charge pump */
    BSP_IO_WritePin(OTG_FS1_POWER_SWITCH_PIN, BSP_IO_PIN_SET);
  }
  
#endif
   
#ifdef USE_USB_HS_IN_FS
  if(state == 0)
  {
    /* Configure Low Charge pump */
    BSP_IO_WritePin(OTG_FS2_POWER_SWITCH_PIN, BSP_IO_PIN_RESET);
  }
  else
  {
    /* Drive High Charge pump */
    BSP_IO_WritePin(OTG_FS2_POWER_SWITCH_PIN, BSP_IO_PIN_SET);
  } 
#endif  
  HAL_Delay(200);
  return USBH_OK;  
}
开发者ID:MrZANE42,项目名称:verisure1512,代码行数:41,代码来源:usbh_conf.c

示例2: AUDIO_InitApplication

/**
  * @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();
}
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:61,代码来源:main.c

示例3: BSP_CAMERA_PwrDown

/**
  * @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);
}
开发者ID:QuantumDeveloper,项目名称:AvalonStudio,代码行数:17,代码来源:stm32446e_eval_camera.c

示例4: BSP_AUDIO_OUT_Stop

/**
  * @brief  Stops audio playing and Power down the Audio Codec. 
  * @param  Option: could be one of the following parameters 
  *           - CODEC_PDWN_HW: completely shut down the codec (physically). 
  *                            Then need to reconfigure the Codec after power on.  
  * @retval AUDIO_OK if correct communication, else wrong communication
  */
uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option)
{
  /* Call DMA Stop to disable DMA stream before stopping codec */
  HAL_I2S_DMAStop(&hAudioOutI2s);
  
  /* Call Audio Codec Stop function */
  if(pAudioDrv->Stop(AUDIO_I2C_ADDRESS, Option) != 0)
  {
    return AUDIO_ERROR;
  }
  else
  {
    if(Option == CODEC_PDWN_HW)
    { 
      /* Wait at least 100us */
      HAL_Delay(1);
  
      /* Power Down the codec */
      BSP_IO_WritePin(AUDIO_RESET_PIN, GPIO_PIN_RESET);
  
    }
    /* Return AUDIO_OK when all operations are correctly done */
    return AUDIO_OK;
  }
}
开发者ID:Lembed,项目名称:STM32CubeF1-mirrors,代码行数:32,代码来源:stm3210c_eval_audio.c

示例5: BSP_AUDIO_OUT_Stop

/**
  * @brief  Stops audio playing and Power down the Audio Codec. 
  * @param  Option: could be one of the following parameters 
  *           - CODEC_PDWN_SW: for software power off (by writing registers). 
  *                            Then no need to reconfigure the Codec after power on.
  *           - CODEC_PDWN_HW: completely shut down the codec (physically). 
  *                            Then need to reconfigure the Codec after power on.  
  * @retval AUDIO_OK if correct communication, else wrong communication
  */
uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option)
{
  /* Call the Media layer stop function */
  HAL_I2S_DMAStop(&haudio_i2s);
  
  /* Call Audio Codec Stop function */
  if(audio_drv->Stop(AUDIO_I2C_ADDRESS, Option) != 0)
  {
    return AUDIO_ERROR;
  }
  else
  {
    if(Option == CODEC_PDWN_HW)
    { 
      /* Wait at least 1ms */
      HAL_Delay(1);
      
      /* Reset the pin */
      BSP_IO_WritePin(AUDIO_RESET_PIN, RESET);
    }
    
    /* Return AUDIO_OK when all operations are correctly done */
    return AUDIO_OK;
  }
}
开发者ID:BradleyConn,项目名称:stm32f429,代码行数:34,代码来源:stm324xg_eval_audio.c

示例6: CODEC_Reset

/**
  * @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); 
}
开发者ID:BradleyConn,项目名称:stm32f429,代码行数:26,代码来源:stm324xg_eval_audio.c

示例7: BSP_IDD_GetValue

/**
  * @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);
  }
}
开发者ID:cyysu,项目名称:AliOS-Things,代码行数:16,代码来源:stm32l496g_discovery_idd.c

示例8: BSP_IDD_StartMeasure

/**
  * @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);
  }
}
开发者ID:cyysu,项目名称:AliOS-Things,代码行数:16,代码来源:stm32l496g_discovery_idd.c

示例9: BSP_CAMERA_Init

/**
  * @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;
}
开发者ID:PaulingZhou,项目名称:RM2016_0X3_SystemBoard,代码行数:57,代码来源:stm324x9i_eval_camera.c

示例10: BSP_CAMERA_HwReset

/**
  * @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 */
}
开发者ID:QuantumDeveloper,项目名称:AvalonStudio,代码行数:29,代码来源:stm32446e_eval_camera.c

示例11: BSP_CAMERA_Stop

/**
  * @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;
}
开发者ID:PaulingZhou,项目名称:RM2016_0X3_SystemBoard,代码行数:28,代码来源:stm324x9i_eval_camera.c

示例12: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  FRESULT res;                                          /* FatFs function common result code */
  uint32_t byteswritten, bytesread;                     /* File write/read counts */
  uint8_t wtext[] = "This is STM32 working with FatFs"; /* File write buffer */
  uint8_t rtext[100];                                   /* File read 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();
  
  /* Initialize IO expander */
  BSP_IO_Init();

  /* Configure LED1 and LED3 */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED3);
  
  /* ###########################################################################
     When the uSD Card is used; the Camera module must be unplugged, this is due
     to the shared pins between the two devices. 
  
     Otherwise, you have to set camera sensor in Power Down mode, by calling the
     BSP_CAMERA_PwrDown() available under stm32446e_eval_camera.c BSP driver */
  
      BSP_IO_Init();
      
     /* Assert the camera RSTI pin */ 
     /* Camera power down sequence */
     BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
     /* Assert the camera RSTI pin (active low) */
     BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);
  
  /*##-1- Link the SD disk I/O driver ########################################*/
  if(FATFS_LinkDriver(&SD_Driver, SDPath) == 0) 
  {
    /*##-2- Register the file system object to the FatFs module ##############*/
    if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) != FR_OK)
    {
      /* FatFs Initialization Error */
      Error_Handler();
    }
    else
    {
      /*##-3- Create a FAT file system (format) on the logical drive #########*/
      if(f_mkfs((TCHAR const*)SDPath, 0, 0) != FR_OK)
      {     
        Error_Handler();
      }
      else
      {
        /*##-4- Create and Open a new text file object with write access #####*/
        if(f_open(&MyFile, "STM32.TXT", FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) 
        {
          /* 'STM32.TXT' file Open for write Error */
          Error_Handler();
        }
        else
        {
          /*##-5- Write data to the text file ################################*/
          res = f_write(&MyFile, wtext, sizeof(wtext), (void *)&byteswritten);
          
          if((byteswritten == 0) || (res != FR_OK))
          {
            /* 'STM32.TXT' file Write or EOF Error */
            Error_Handler();
          }
          else
          {
            /*##-6- Close the open text file #################################*/
            f_close(&MyFile);
            
            /*##-7- Open the text file object with read access ###############*/
            if(f_open(&MyFile, "STM32.TXT", FA_READ) != FR_OK)
            {
              /* 'STM32.TXT' file Open for read Error */
              Error_Handler();
            }
            else
            {
              /*##-8- Read data from the text file ###########################*/
              res = f_read(&MyFile, rtext, sizeof(rtext), (UINT*)&bytesread);
              
              if((bytesread == 0) || (res != FR_OK))
              {
                /* 'STM32.TXT' file Read or EOF Error */
                Error_Handler();
              }
//.........这里部分代码省略.........
开发者ID:451506709,项目名称:automated_machine,代码行数:101,代码来源:main.c

示例13: IOE_GPIO_demo

/**
  * @brief  SDRAM Demo
  * @param  None
  * @retval None
  */
void IOE_GPIO_demo (void)
{ 
  uint32_t ioe_irq_pending_status, ioe_gpio_status; 
  uint32_t lcd_line = 85;
  uint8_t test_result = IOE_GPIO_TEST_PASSED;
  uint8_t all_test_fail = 1;
  GPIO_PinState mcu_pin_state;

  IOE_GPIO_SetHint();

  /* Enable the Leds */
  BSP_IO_Init();
  BSP_LED_Init(LED1); 
  BSP_LED_Init(LED2); 
  
  BSP_LED_On(LED1); 
  BSP_LED_On(LED2); 
 
  BSP_IO_ConfigPin(MFX_CONNECTET_PIN, IO_MODE_OFF);

  /* TEST IO_MODE_OUPUT mode */
  /* ---------------------------------- */

  /* SetUp a GPIO to be connected to one of the MFX GPIOS via a wire */
  SetMcuGpioToBeConnectedToMfxGPO();
  test_result = IOE_GPIO_TEST_PASSED;
  BSP_IO_ConfigPin(MFX_CONNECTET_PIN, IO_MODE_OUTPUT);

  BSP_IO_WritePin(MFX_CONNECTET_PIN, BSP_IO_PIN_RESET);
  HAL_Delay(1);
  mcu_pin_state = HAL_GPIO_ReadPin (MCU_GPIO_PORT, MCU_GPIO_PIN);
  if (mcu_pin_state) 
  {
    test_result |= IOE_GPIO_TEST_FAILED;
  }
  else
  {
    test_result |= IOE_GPIO_TEST_PASSED;
  }

  BSP_IO_WritePin(MFX_CONNECTET_PIN, BSP_IO_PIN_SET);
  HAL_Delay(1);
  mcu_pin_state = HAL_GPIO_ReadPin (MCU_GPIO_PORT, MCU_GPIO_PIN);
  if (mcu_pin_state) 
  {
    test_result |= IOE_GPIO_TEST_PASSED;
  }
  else
  {
    test_result |= IOE_GPIO_TEST_FAILED;
  }

  BSP_IO_WritePin(MFX_CONNECTET_PIN, BSP_IO_PIN_RESET);
  HAL_Delay(1);
  mcu_pin_state = HAL_GPIO_ReadPin (MCU_GPIO_PORT, MCU_GPIO_PIN);
  if (mcu_pin_state) 
  {
    test_result |= IOE_GPIO_TEST_FAILED;
  }
  else
  {
    test_result |= IOE_GPIO_TEST_PASSED;
  }

  lcd_line += 15;
  if (test_result) 
  {
    BSP_LCD_DisplayStringAt(20, lcd_line, (uint8_t *)"IOE IO_MODE_OUTPUT: FAILED", LEFT_MODE);
  }
  else
  {
    BSP_LCD_DisplayStringAt(20, lcd_line, (uint8_t *)"IOE IO_MODE_OUTPUT: PASSED", LEFT_MODE);
    all_test_fail = 0;
  }


  /* TEST IO_MODE_INPUT mode */
  /* ---------------------------------- */

  /* SetUp a GPIO to be connected to one of the MFX GPIOS via a wire */
  SetMcuGpioToBeConnectedToMfxGPI();
  test_result = IOE_GPIO_TEST_PASSED;
  BSP_IO_ConfigPin(MFX_CONNECTET_PIN, IO_MODE_INPUT);

  HAL_GPIO_WritePin(MCU_GPIO_PORT, MCU_GPIO_PIN, GPIO_PIN_RESET);
  HAL_Delay(1);
  ioe_gpio_status = BSP_IO_ReadPin (MFX_CONNECTET_PIN);
  if (ioe_gpio_status) 
  {
    test_result |= IOE_GPIO_TEST_FAILED;
  }
  else
  {
    test_result |= IOE_GPIO_TEST_PASSED;
  }
//.........这里部分代码省略.........
开发者ID:eemei,项目名称:library-stm32f4,代码行数:101,代码来源:ioe_gpio.c

示例14: BSP_SD_MspInit

/**
  * @brief  Initializes the SD MSP.
  * @param  hsd: SD handle
  * @param  Params : pointer on additional configuration parameters, can be NULL.
  */
__weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
{
  static DMA_HandleTypeDef dma_rx_handle;
  static DMA_HandleTypeDef dma_tx_handle;
  GPIO_InitTypeDef gpio_init_structure;

  /* SD pins are in conflict with Camera pins therefore Camera is power down */
  /* __weak function can be modified by the application */
  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);
  HAL_Delay(100);
  
  /* Enable SDIO clock */
  __HAL_RCC_SDIO_CLK_ENABLE();

  /* Enable DMA2 clocks */
  __DMAx_TxRx_CLK_ENABLE();

  /* Enable GPIOs clock */
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOD_CLK_ENABLE();

  /* Common GPIO configuration */
  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
  gpio_init_structure.Pull      = GPIO_PULLUP;
  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
  gpio_init_structure.Alternate = GPIO_AF12_SDIO;
  
  /* GPIOC configuration */
  gpio_init_structure.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
   
  HAL_GPIO_Init(GPIOC, &gpio_init_structure);

  /* GPIOD configuration */
  gpio_init_structure.Pin = GPIO_PIN_2;
  HAL_GPIO_Init(GPIOD, &gpio_init_structure);

  /* NVIC configuration for SDIO interrupts */
  HAL_NVIC_SetPriority(SDIO_IRQn, 5, 0);
  HAL_NVIC_EnableIRQ(SDIO_IRQn);

  /* Configure DMA Rx parameters */
  dma_rx_handle.Init.Channel             = SD_DMAx_Rx_CHANNEL;
  dma_rx_handle.Init.Direction           = DMA_PERIPH_TO_MEMORY;
  dma_rx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
  dma_rx_handle.Init.MemInc              = DMA_MINC_ENABLE;
  dma_rx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
  dma_rx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
  dma_rx_handle.Init.Mode                = DMA_PFCTRL;
  dma_rx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
  dma_rx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
  dma_rx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
  dma_rx_handle.Init.MemBurst            = DMA_MBURST_INC4;
  dma_rx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
  
  dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
  
  /* Associate the DMA handle */
  __HAL_LINKDMA(hsd, hdmarx, dma_rx_handle);
  
  /* Deinitialize the stream for new transfer */
  HAL_DMA_DeInit(&dma_rx_handle);
  
  /* Configure the DMA stream */
  HAL_DMA_Init(&dma_rx_handle);
  
  /* Configure DMA Tx parameters */
  dma_tx_handle.Init.Channel             = SD_DMAx_Tx_CHANNEL;
  dma_tx_handle.Init.Direction           = DMA_MEMORY_TO_PERIPH;
  dma_tx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
  dma_tx_handle.Init.MemInc              = DMA_MINC_ENABLE;
  dma_tx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
  dma_tx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
  dma_tx_handle.Init.Mode                = DMA_PFCTRL;
  dma_tx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
  dma_tx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
  dma_tx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
  dma_tx_handle.Init.MemBurst            = DMA_MBURST_INC4;
  dma_tx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
  
  dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
  
  /* Associate the DMA handle */
  __HAL_LINKDMA(hsd, hdmatx, dma_tx_handle);
  
  /* Deinitialize the stream for new transfer */
  HAL_DMA_DeInit(&dma_tx_handle);
  
  /* Configure the DMA stream */
  HAL_DMA_Init(&dma_tx_handle); 
  
//.........这里部分代码省略.........
开发者ID:robbie-cao,项目名称:stm32f4-discovery,代码行数:101,代码来源:stm32469i_eval_sd.c

示例15: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{ 
  /* Configure the MPU attributes as Write Through */
  MPU_Config();

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

  /* STM32F7xx HAL library initialization:
       - Configure the Flash ART accelerator on ITCM interface
       - 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 200 MHz */
  SystemClock_Config();

  BSP_LED_Init(LED_GREEN);
  BSP_LED_Init(LED_ORANGE); 
  BSP_LED_Init(LED_RED);
  BSP_LED_Init(LED_BLUE); 
  
  
  /* 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);

  /* Configure the Tamper push-button in GPIO Mode */
  BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO);

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

  BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS);

  Display_DemoDescription();

  /* Wait For User inputs */
  while (1)
  {
    if ( mfx_toggle_led == 1)   /* Toggle LED */
    {
      BSP_LED_Toggle(LED_GREEN);
      mfx_toggle_led = 0;
    }

    if(BSP_PB_GetState(BUTTON_TAMPER) == GPIO_PIN_SET)
    {
      while (BSP_PB_GetState(BUTTON_TAMPER) == GPIO_PIN_SET);
      
      BSP_examples[DemoIndex++].DemoFunc();
      
      if(DemoIndex >= COUNT_OF_EXAMPLE(BSP_examples))
      {
        NbLoop++;
        DemoIndex = 0;
      }
      Display_DemoDescription();
    }
  }
}
开发者ID:RadMie,项目名称:STM32F7DiscoveryBase,代码行数:77,代码来源:main.c


注:本文中的BSP_IO_WritePin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。