management functions
More...
|
| HAL_StatusTypeDef | HAL_PCD_DevConnect (PCD_HandleTypeDef *hpcd) |
| | Connect the USB device. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_DevDisconnect (PCD_HandleTypeDef *hpcd) |
| | Disconnect the USB device. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_SetAddress (PCD_HandleTypeDef *hpcd, uint8_t address) |
| | Set the USB Device address. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_EP_Open (PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type) |
| | Open and configure an endpoint. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_EP_Close (PCD_HandleTypeDef *hpcd, uint8_t ep_addr) |
| | Deactivate an endpoint. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_EP_Receive (PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len) |
| | Receive an amount of data. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_EP_Transmit (PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len) |
| | Send an amount of data. More...
|
| |
| uint32_t | HAL_PCD_EP_GetRxCount (PCD_HandleTypeDef *hpcd, uint8_t ep_addr) |
| | Get Received Data Size. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_EP_SetStall (PCD_HandleTypeDef *hpcd, uint8_t ep_addr) |
| | Set a STALL condition over an endpoint. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_EP_ClrStall (PCD_HandleTypeDef *hpcd, uint8_t ep_addr) |
| | Clear a STALL condition over in an endpoint. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_EP_Flush (PCD_HandleTypeDef *hpcd, uint8_t ep_addr) |
| | Flush an endpoint. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_ActivateRemoteWakeup (PCD_HandleTypeDef *hpcd) |
| | Activate remote wakeup signalling. More...
|
| |
| HAL_StatusTypeDef | HAL_PCD_DeActivateRemoteWakeup (PCD_HandleTypeDef *hpcd) |
| | De-activate remote wakeup signalling. More...
|
| |
management functions
===============================================================================
##### Peripheral Control functions #####
===============================================================================
[..]
This subsection provides a set of functions allowing to control the PCD data
transfers.
◆ HAL_PCD_ActivateRemoteWakeup()
Activate remote wakeup signalling.
- Parameters
-
- Return values
-
Definition at line 2042 of file stm32l4xx_hal_pcd.c.
HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx)
USB_ActivateRemoteWakeup active remote wakeup signalling.
◆ HAL_PCD_DeActivateRemoteWakeup()
De-activate remote wakeup signalling.
- Parameters
-
- Return values
-
Definition at line 2052 of file stm32l4xx_hal_pcd.c.
HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx)
USB_DeActivateRemoteWakeup de-active remote wakeup signalling.
◆ HAL_PCD_DevConnect()
Connect the USB device.
- Parameters
-
- Return values
-
Definition at line 1728 of file stm32l4xx_hal_pcd.c.
1730 #if defined (USB_OTG_FS) 1731 USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
1735 #if defined (USB_OTG_FS) 1736 if (hpcd->Init.battery_charging_enable == 1U)
1739 USBx->GCCFG |= USB_OTG_GCCFG_PWRDWN;
HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx)
USB_DevConnect : Connect the USB device by enabling the pull-up/pull-down.
◆ HAL_PCD_DevDisconnect()
Disconnect the USB device.
- Parameters
-
- Return values
-
Definition at line 1752 of file stm32l4xx_hal_pcd.c.
1754 #if defined (USB_OTG_FS) 1755 USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
1760 #if defined (USB_OTG_FS) 1761 if (hpcd->Init.battery_charging_enable == 1U)
1764 USBx->GCCFG &= ~(USB_OTG_GCCFG_PWRDWN);
HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx)
USB_DevDisconnect : Disconnect the USB device by disabling the pull-up/pull-down. ...
◆ HAL_PCD_EP_Close()
Deactivate an endpoint.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
- Return values
-
Definition at line 1837 of file stm32l4xx_hal_pcd.c.
1841 if ((ep_addr & 0x80U) == 0x80U)
1843 ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
1848 ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK];
1851 ep->
num = ep_addr & EP_ADDR_MSK;
HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
De-activate and de-initialize an endpoint.
◆ HAL_PCD_EP_ClrStall()
Clear a STALL condition over in an endpoint.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
- Return values
-
Definition at line 1983 of file stm32l4xx_hal_pcd.c.
1987 if (((uint32_t)ep_addr & 0x0FU) > hpcd->Init.dev_endpoints)
1992 if ((0x80U & ep_addr) == 0x80U)
1994 ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
1999 ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK];
2004 ep->
num = ep_addr & EP_ADDR_MSK;
HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EPClearStall : Clear a stall condition over an EP.
◆ HAL_PCD_EP_Flush()
Flush an endpoint.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
- Return values
-
Definition at line 2019 of file stm32l4xx_hal_pcd.c.
2023 if ((ep_addr & 0x80U) == 0x80U)
2025 (void)
USB_FlushTxFifo(hpcd->Instance, (uint32_t)ep_addr & EP_ADDR_MSK);
HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx)
USB_FlushRxFifo : Flush Rx FIFO.
HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num)
USB_OTG_FlushTxFifo : Flush a Tx FIFO.
◆ HAL_PCD_EP_GetRxCount()
Get Received Data Size.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
- Return values
-
Definition at line 1899 of file stm32l4xx_hal_pcd.c.
1901 return hpcd->OUT_ep[ep_addr & EP_ADDR_MSK].xfer_count;
◆ HAL_PCD_EP_Open()
| HAL_StatusTypeDef HAL_PCD_EP_Open |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
ep_addr, |
|
|
uint16_t |
ep_mps, |
|
|
uint8_t |
ep_type |
|
) |
| |
Open and configure an endpoint.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
| ep_mps | endpoint max packet size |
| ep_type | endpoint type |
- Return values
-
Definition at line 1793 of file stm32l4xx_hal_pcd.c.
1795 HAL_StatusTypeDef ret =
HAL_OK;
1798 if ((ep_addr & 0x80U) == 0x80U)
1800 ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
1805 ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK];
1809 ep->
num = ep_addr & EP_ADDR_MSK;
1813 if (ep->
is_in != 0U)
1819 if (ep_type == EP_TYPE_BULK)
HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
Activate and configure an endpoint.
◆ HAL_PCD_EP_Receive()
| HAL_StatusTypeDef HAL_PCD_EP_Receive |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
ep_addr, |
|
|
uint8_t * |
pBuf, |
|
|
uint32_t |
len |
|
) |
| |
Receive an amount of data.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
| pBuf | pointer to the reception buffer |
| len | amount of data to be received |
- Return values
-
Definition at line 1868 of file stm32l4xx_hal_pcd.c.
1872 ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK];
1879 ep->
num = ep_addr & EP_ADDR_MSK;
1881 if ((ep_addr & EP_ADDR_MSK) == 0U)
HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EPStartXfer : setup and starts a transfer over an EP.
HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EP0StartXfer : setup and starts a transfer over the EP 0.
◆ HAL_PCD_EP_SetStall()
Set a STALL condition over an endpoint.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
- Return values
-
Definition at line 1942 of file stm32l4xx_hal_pcd.c.
1946 if (((uint32_t)ep_addr & EP_ADDR_MSK) > hpcd->Init.dev_endpoints)
1951 if ((0x80U & ep_addr) == 0x80U)
1953 ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
1958 ep = &hpcd->OUT_ep[ep_addr];
1963 ep->
num = ep_addr & EP_ADDR_MSK;
1968 if ((ep_addr & EP_ADDR_MSK) == 0U)
HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t *psetup)
Prepare the EP0 to start the first control setup.
HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EPSetStall : set a stall condition over an EP.
◆ HAL_PCD_EP_Transmit()
| HAL_StatusTypeDef HAL_PCD_EP_Transmit |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
ep_addr, |
|
|
uint8_t * |
pBuf, |
|
|
uint32_t |
len |
|
) |
| |
Send an amount of data.
- Parameters
-
| hpcd | PCD handle |
| ep_addr | endpoint address |
| pBuf | pointer to the transmission buffer |
| len | amount of data to be sent |
- Return values
-
Definition at line 1911 of file stm32l4xx_hal_pcd.c.
1915 ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
1922 ep->
num = ep_addr & EP_ADDR_MSK;
1924 if ((ep_addr & EP_ADDR_MSK) == 0U)
HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EPStartXfer : setup and starts a transfer over an EP.
HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EP0StartXfer : setup and starts a transfer over the EP 0.
◆ HAL_PCD_SetAddress()
Set the USB Device address.
- Parameters
-
| hpcd | PCD handle |
| address | new device address |
- Return values
-
Definition at line 1777 of file stm32l4xx_hal_pcd.c.
1780 hpcd->USB_Address = address;
HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address)
USB_SetDevAddress : Stop the usb device mode.