STM32L486xx HAL User Manual
stm32l4xx_hal_pcd_ex.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_hal_pcd_ex.c
00004   * @author  MCD Application Team
00005   * @brief   PCD Extended HAL module driver.
00006   *          This file provides firmware functions to manage the following
00007   *          functionalities of the USB Peripheral Controller:
00008   *           + Extended features functions
00009   *
00010   ******************************************************************************
00011   * @attention
00012   *
00013   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00014   *
00015   * Redistribution and use in source and binary forms, with or without modification,
00016   * are permitted provided that the following conditions are met:
00017   *   1. Redistributions of source code must retain the above copyright notice,
00018   *      this list of conditions and the following disclaimer.
00019   *   2. Redistributions in binary form must reproduce the above copyright notice,
00020   *      this list of conditions and the following disclaimer in the documentation
00021   *      and/or other materials provided with the distribution.
00022   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00023   *      may be used to endorse or promote products derived from this software
00024   *      without specific prior written permission.
00025   *
00026   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00027   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00029   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00030   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00031   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00032   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00033   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00034   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00035   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036   *
00037   ******************************************************************************
00038   */
00039 
00040 /* Includes ------------------------------------------------------------------*/
00041 #include "stm32l4xx_hal.h"
00042 
00043 /** @addtogroup STM32L4xx_HAL_Driver
00044   * @{
00045   */
00046 
00047 /** @defgroup PCDEx PCDEx
00048   * @brief PCD Extended HAL module driver
00049   * @{
00050   */
00051 
00052 #ifdef HAL_PCD_MODULE_ENABLED
00053 
00054 #if defined (USB) || defined (USB_OTG_FS) || defined (USB_OTG_HS)
00055 
00056 /* Private types -------------------------------------------------------------*/
00057 /* Private variables ---------------------------------------------------------*/
00058 /* Private constants ---------------------------------------------------------*/
00059 /* Private macros ------------------------------------------------------------*/
00060 /* Private functions ---------------------------------------------------------*/
00061 /* Exported functions --------------------------------------------------------*/
00062 
00063 /** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions
00064   * @{
00065   */
00066 
00067 /** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
00068   * @brief    PCDEx control functions
00069  *
00070 @verbatim
00071  ===============================================================================
00072                  ##### Extended features functions #####
00073  ===============================================================================
00074     [..]  This section provides functions allowing to:
00075       (+) Update FIFO configuration
00076 
00077 @endverbatim
00078   * @{
00079   */
00080 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
00081 /**
00082   * @brief  Set Tx FIFO
00083   * @param  hpcd PCD handle
00084   * @param  fifo The number of Tx fifo
00085   * @param  size Fifo size
00086   * @retval HAL status
00087   */
00088 HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size)
00089 {
00090   uint8_t i;
00091   uint32_t Tx_Offset;
00092 
00093   /*  TXn min size = 16 words. (n  : Transmit FIFO index)
00094       When a TxFIFO is not used, the Configuration should be as follows:
00095           case 1 :  n > m    and Txn is not used    (n,m  : Transmit FIFO indexes)
00096          --> Txm can use the space allocated for Txn.
00097          case2  :  n < m    and Txn is not used    (n,m  : Transmit FIFO indexes)
00098          --> Txn should be configured with the minimum space of 16 words
00099      The FIFO is used optimally when used TxFIFOs are allocated in the top
00100          of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.
00101      When DMA is used 3n * FIFO locations should be reserved for internal DMA registers */
00102 
00103   Tx_Offset = hpcd->Instance->GRXFSIZ;
00104 
00105   if (fifo == 0U)
00106   {
00107     hpcd->Instance->DIEPTXF0_HNPTXFSIZ = ((uint32_t)size << 16) | Tx_Offset;
00108   }
00109   else
00110   {
00111     Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16;
00112     for (i = 0U; i < (fifo - 1U); i++)
00113     {
00114       Tx_Offset += (hpcd->Instance->DIEPTXF[i] >> 16);
00115     }
00116 
00117     /* Multiply Tx_Size by 2 to get higher performance */
00118     hpcd->Instance->DIEPTXF[fifo - 1U] = ((uint32_t)size << 16) | Tx_Offset;
00119   }
00120 
00121   return HAL_OK;
00122 }
00123 
00124 /**
00125   * @brief  Set Rx FIFO
00126   * @param  hpcd PCD handle
00127   * @param  size Size of Rx fifo
00128   * @retval HAL status
00129   */
00130 HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size)
00131 {
00132   hpcd->Instance->GRXFSIZ = size;
00133 
00134   return HAL_OK;
00135 }
00136 
00137 /**
00138   * @brief  Activate LPM feature.
00139   * @param  hpcd PCD handle
00140   * @retval HAL status
00141   */
00142 HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)
00143 {
00144   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
00145 
00146   hpcd->lpm_active = 1U;
00147   hpcd->LPM_State = LPM_L0;
00148   USBx->GINTMSK |= USB_OTG_GINTMSK_LPMINTM;
00149   USBx->GLPMCFG |= (USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);
00150 
00151   return HAL_OK;
00152 }
00153 
00154 /**
00155   * @brief  Deactivate LPM feature.
00156   * @param  hpcd PCD handle
00157   * @retval HAL status
00158   */
00159 HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)
00160 {
00161   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
00162 
00163   hpcd->lpm_active = 0U;
00164   USBx->GINTMSK &= ~USB_OTG_GINTMSK_LPMINTM;
00165   USBx->GLPMCFG &= ~(USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);
00166 
00167   return HAL_OK;
00168 }
00169 
00170 /**
00171   * @brief  Handle BatteryCharging Process.
00172   * @param  hpcd PCD handle
00173   * @retval HAL status
00174   */
00175 void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)
00176 {
00177   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
00178   uint32_t USBx_BASE = (uint32_t)USBx;
00179   uint32_t tickstart = HAL_GetTick();
00180 
00181   /* Start BCD When device is connected */
00182   if ((USBx_DEVICE->DCTL & USB_OTG_DCTL_SDIS) == USB_OTG_DCTL_SDIS)
00183   {
00184     /* Enable DCD : Data Contact Detect */
00185     USBx->GCCFG |= USB_OTG_GCCFG_DCDEN;
00186 
00187     /* Wait Detect flag or a timeout is happen*/
00188     while ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == 0U)
00189     {
00190       /* Check for the Timeout */
00191       if ((HAL_GetTick() - tickstart) > 1000U)
00192       {
00193 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00194         hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);
00195 #else
00196         HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);
00197 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00198 
00199         return;
00200       }
00201     }
00202 
00203     /* Right response got */
00204     HAL_Delay(100);
00205 
00206     /* Check Detect flag*/
00207     if ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == USB_OTG_GCCFG_DCDET)
00208     {
00209 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00210       hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);
00211 #else
00212       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);
00213 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00214     }
00215 
00216     /*Primary detection: checks if connected to Standard Downstream Port
00217     (without charging capability) */
00218     USBx->GCCFG &= ~ USB_OTG_GCCFG_DCDEN;
00219     USBx->GCCFG |=  USB_OTG_GCCFG_PDEN;
00220     HAL_Delay(100);
00221 
00222     if ((USBx->GCCFG & USB_OTG_GCCFG_PDET) == 0U)
00223     {
00224       /* Case of Standard Downstream Port */
00225 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00226       hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
00227 #else
00228       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
00229 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00230     }
00231     else
00232     {
00233       /* start secondary detection to check connection to Charging Downstream
00234       Port or Dedicated Charging Port */
00235       USBx->GCCFG &= ~ USB_OTG_GCCFG_PDEN;
00236       USBx->GCCFG |=  USB_OTG_GCCFG_SDEN;
00237       HAL_Delay(100);
00238 
00239       if ((USBx->GCCFG & USB_OTG_GCCFG_SDET) == USB_OTG_GCCFG_SDET)
00240       {
00241         /* case Dedicated Charging Port  */
00242 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00243         hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
00244 #else
00245         HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
00246 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00247       }
00248       else
00249       {
00250         /* case Charging Downstream Port  */
00251 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00252         hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
00253 #else
00254         HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
00255 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00256       }
00257     }
00258 
00259     /* Battery Charging capability discovery finished */
00260     (void)HAL_PCDEx_DeActivateBCD(hpcd);
00261 
00262 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00263     hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
00264 #else
00265     HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
00266 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00267   }
00268 }
00269 
00270 /**
00271   * @brief  Activate BatteryCharging feature.
00272   * @param  hpcd PCD handle
00273   * @retval HAL status
00274   */
00275 HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)
00276 {
00277   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
00278 
00279   hpcd->battery_charging_active = 1U;
00280   USBx->GCCFG |= (USB_OTG_GCCFG_BCDEN);
00281 
00282   return HAL_OK;
00283 }
00284 
00285 /**
00286   * @brief  Deactivate BatteryCharging feature.
00287   * @param  hpcd PCD handle
00288   * @retval HAL status
00289   */
00290 HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)
00291 {
00292   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
00293   hpcd->battery_charging_active = 0U;
00294   USBx->GCCFG &= ~(USB_OTG_GCCFG_BCDEN);
00295   return HAL_OK;
00296 }
00297 #endif /* USB_OTG_FS || USB_OTG_HS */
00298 
00299 #if defined (USB)
00300 /**
00301   * @brief  Configure PMA for EP
00302   * @param  hpcd  Device instance
00303   * @param  ep_addr endpoint address
00304   * @param  ep_kind endpoint Kind
00305   *                  USB_SNG_BUF: Single Buffer used
00306   *                  USB_DBL_BUF: Double Buffer used
00307   * @param  pmaadress: EP address in The PMA: In case of single buffer endpoint
00308   *                   this parameter is 16-bit value providing the address
00309   *                   in PMA allocated to endpoint.
00310   *                   In case of double buffer endpoint this parameter
00311   *                   is a 32-bit value providing the endpoint buffer 0 address
00312   *                   in the LSB part of 32-bit value and endpoint buffer 1 address
00313   *                   in the MSB part of 32-bit value.
00314   * @retval HAL status
00315   */
00316 
00317 HAL_StatusTypeDef  HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
00318                                        uint16_t ep_addr,
00319                                        uint16_t ep_kind,
00320                                        uint32_t pmaadress)
00321 {
00322   PCD_EPTypeDef *ep;
00323 
00324   /* initialize ep structure*/
00325   if ((0x80U & ep_addr) == 0x80U)
00326   {
00327     ep = &hpcd->IN_ep[ep_addr & 0xFU];
00328   }
00329   else
00330   {
00331     ep = &hpcd->OUT_ep[ep_addr];
00332   }
00333 
00334   /* Here we check if the endpoint is single or double Buffer*/
00335   if (ep_kind == PCD_SNG_BUF)
00336   {
00337     /* Single Buffer */
00338     ep->doublebuffer = 0U;
00339     /* Configure the PMA */
00340     ep->pmaadress = (uint16_t)pmaadress;
00341   }
00342   else /* USB_DBL_BUF */
00343   {
00344     /* Double Buffer Endpoint */
00345     ep->doublebuffer = 1U;
00346     /* Configure the PMA */
00347     ep->pmaaddr0 = (uint16_t)(pmaadress & 0xFFFFU);
00348     ep->pmaaddr1 = (uint16_t)((pmaadress & 0xFFFF0000U) >> 16);
00349   }
00350 
00351   return HAL_OK;
00352 }
00353 
00354 /**
00355   * @brief  Activate BatteryCharging feature.
00356   * @param  hpcd PCD handle
00357   * @retval HAL status
00358   */
00359 HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)
00360 {
00361   USB_TypeDef *USBx = hpcd->Instance;
00362   hpcd->battery_charging_active = 1U;
00363 
00364   USBx->BCDR |= (USB_BCDR_BCDEN);
00365   /* Enable DCD : Data Contact Detect */
00366   USBx->BCDR |= (USB_BCDR_DCDEN);
00367 
00368   return HAL_OK;
00369 }
00370 
00371 /**
00372   * @brief  Deactivate BatteryCharging feature.
00373   * @param  hpcd PCD handle
00374   * @retval HAL status
00375   */
00376 HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)
00377 {
00378   USB_TypeDef *USBx = hpcd->Instance;
00379   hpcd->battery_charging_active = 0U;
00380 
00381   USBx->BCDR &= ~(USB_BCDR_BCDEN);
00382 
00383   return HAL_OK;
00384 }
00385 
00386 /**
00387   * @brief  Handle BatteryCharging Process.
00388   * @param  hpcd PCD handle
00389   * @retval HAL status
00390   */
00391 void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)
00392 {
00393   USB_TypeDef *USBx = hpcd->Instance;
00394   uint32_t tickstart = HAL_GetTick();
00395 
00396   /* Wait Detect flag or a timeout is happen*/
00397   while ((USBx->BCDR & USB_BCDR_DCDET) == 0U)
00398   {
00399     /* Check for the Timeout */
00400     if ((HAL_GetTick() - tickstart) > 1000U)
00401     {
00402 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00403       hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);
00404 #else
00405       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);
00406 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00407 
00408       return;
00409     }
00410   }
00411 
00412   HAL_Delay(300U);
00413 
00414   /* Data Pin Contact ? Check Detect flag */
00415   if ((USBx->BCDR & USB_BCDR_DCDET) == USB_BCDR_DCDET)
00416   {
00417 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00418     hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);
00419 #else
00420     HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);
00421 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00422   }
00423   /* Primary detection: checks if connected to Standard Downstream Port
00424   (without charging capability) */
00425   USBx->BCDR &= ~(USB_BCDR_DCDEN);
00426   USBx->BCDR |= (USB_BCDR_PDEN);
00427   HAL_Delay(300U);
00428 
00429   /* If Charger detect ? */
00430   if ((USBx->BCDR & USB_BCDR_PDET) == USB_BCDR_PDET)
00431   {
00432     /* Start secondary detection to check connection to Charging Downstream
00433     Port or Dedicated Charging Port */
00434     USBx->BCDR &= ~(USB_BCDR_PDEN);
00435     USBx->BCDR |= (USB_BCDR_SDEN);
00436     HAL_Delay(300U);
00437 
00438     /* If CDP ? */
00439     if ((USBx->BCDR & USB_BCDR_SDET) == USB_BCDR_SDET)
00440     {
00441       /* Dedicated Downstream Port DCP */
00442 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00443       hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
00444 #else
00445       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
00446 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00447     }
00448     else
00449     {
00450       /* Charging Downstream Port CDP */
00451 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00452       hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
00453 #else
00454       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
00455 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00456     }
00457   }
00458   else /* NO */
00459   {
00460     /* Standard Downstream Port */
00461 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00462     hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
00463 #else
00464     HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
00465 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00466   }
00467 
00468   /* Battery Charging capability discovery finished Start Enumeration */
00469   (void)HAL_PCDEx_DeActivateBCD(hpcd);
00470 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
00471   hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
00472 #else
00473   HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
00474 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
00475 }
00476 
00477 /**
00478   * @brief  Activate LPM feature.
00479   * @param  hpcd PCD handle
00480   * @retval HAL status
00481   */
00482 HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)
00483 {
00484 
00485   USB_TypeDef *USBx = hpcd->Instance;
00486   hpcd->lpm_active = 1U;
00487   hpcd->LPM_State = LPM_L0;
00488 
00489   USBx->LPMCSR |= USB_LPMCSR_LMPEN;
00490   USBx->LPMCSR |= USB_LPMCSR_LPMACK;
00491 
00492   return HAL_OK;
00493 }
00494 
00495 /**
00496   * @brief  Deactivate LPM feature.
00497   * @param  hpcd PCD handle
00498   * @retval HAL status
00499   */
00500 HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)
00501 {
00502   USB_TypeDef *USBx = hpcd->Instance;
00503 
00504   hpcd->lpm_active = 0U;
00505 
00506   USBx->LPMCSR &= ~(USB_LPMCSR_LMPEN);
00507   USBx->LPMCSR &= ~(USB_LPMCSR_LPMACK);
00508 
00509   return HAL_OK;
00510 }
00511 #endif /* USB */
00512 
00513 /**
00514   * @brief  Send LPM message to user layer callback.
00515   * @param  hpcd PCD handle
00516   * @param  msg LPM message
00517   * @retval HAL status
00518   */
00519 __weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)
00520 {
00521   /* Prevent unused argument(s) compilation warning */
00522   UNUSED(hpcd);
00523   UNUSED(msg);
00524 
00525   /* NOTE : This function should not be modified, when the callback is needed,
00526             the HAL_PCDEx_LPM_Callback could be implemented in the user file
00527    */
00528 }
00529 
00530 /**
00531   * @brief  Send BatteryCharging message to user layer callback.
00532   * @param  hpcd PCD handle
00533   * @param  msg LPM message
00534   * @retval HAL status
00535   */
00536 __weak void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg)
00537 {
00538   /* Prevent unused argument(s) compilation warning */
00539   UNUSED(hpcd);
00540   UNUSED(msg);
00541 
00542   /* NOTE : This function should not be modified, when the callback is needed,
00543             the HAL_PCDEx_BCD_Callback could be implemented in the user file
00544    */
00545 }
00546 
00547 /**
00548   * @}
00549   */
00550 
00551 /**
00552   * @}
00553   */
00554 
00555 #endif /* defined (USB) || defined (USB_OTG_FS) || defined (USB_OTG_HS) */
00556 
00557 #endif /* HAL_PCD_MODULE_ENABLED */
00558 
00559 /**
00560   * @}
00561   */
00562 
00563 /**
00564   * @}
00565   */
00566 
00567 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/