kopia lustrzana https://github.com/mobilinkd/tnc3-firmware
Mock up support for suspend. Fix charge enable on address assignment after HAL update.
rodzic
ca6fb5aa5f
commit
992ae6dfe9
|
@ -2,7 +2,7 @@
|
|||
******************************************************************************
|
||||
* @file : usbd_desc.h
|
||||
* @version : v2.0_Cube
|
||||
* @brief : Header for usbd_desc.c file.
|
||||
* @brief : Header for usbd_conf.c file.
|
||||
******************************************************************************
|
||||
* This notice applies to any and all portions of this file
|
||||
* that are not between comment pairs USER CODE BEGIN and
|
||||
|
@ -46,7 +46,6 @@
|
|||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_cdc_if.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
#include "Log.h"
|
||||
#include "UsbPort.h"
|
||||
#include "main.h"
|
||||
#include "cmsis_os.h"
|
||||
|
@ -318,7 +319,7 @@ static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
|
|||
{
|
||||
/* USER CODE BEGIN 6 */
|
||||
cdc_receive(Buf, *Len);
|
||||
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
|
||||
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
|
||||
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
|
||||
return (USBD_OK);
|
||||
/* USER CODE END 6 */
|
||||
|
|
|
@ -239,8 +239,7 @@ void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
|
|||
/* USER CODE BEGIN 2 */
|
||||
if (hpcd->Init.low_power_enable)
|
||||
{
|
||||
/* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register. */
|
||||
SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
|
||||
osMessagePut(ioEventQueueHandle, CMD_USB_SUSPEND, 0);
|
||||
}
|
||||
/* USER CODE END 2 */
|
||||
}
|
||||
|
@ -257,9 +256,7 @@ void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
|
|||
/* USER CODE BEGIN 3 */
|
||||
if (hpcd->Init.low_power_enable)
|
||||
{
|
||||
/* Reset SLEEPDEEP bit of Cortex System Control Register. */
|
||||
SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
|
||||
SystemClockConfig_Resume();
|
||||
osMessagePut(ioEventQueueHandle, CMD_USB_RESUME, 0);
|
||||
}
|
||||
/* USER CODE END 3 */
|
||||
USBD_LL_Resume((USBD_HandleTypeDef*)hpcd->pData);
|
||||
|
@ -645,6 +642,7 @@ USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_a
|
|||
|
||||
switch (hal_status) {
|
||||
case HAL_OK :
|
||||
osMessagePut(ioEventQueueHandle, CMD_USB_CHARGE_ENABLE, 0);
|
||||
usb_status = USBD_OK;
|
||||
break;
|
||||
case HAL_ERROR :
|
||||
|
@ -660,13 +658,6 @@ USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_a
|
|||
usb_status = USBD_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN USBD_LL_SetUSBAddress 1 */
|
||||
// We can now draw 500mA from the port.
|
||||
DEBUG("USB address assigned");
|
||||
osMessagePut(ioEventQueueHandle, CMD_USB_CHARGE_ENABLE, 0);
|
||||
/* USER CODE END USBD_LL_SetUSBAddress 1 */
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
|
@ -842,12 +833,11 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
|
|||
if (state == 1)
|
||||
{
|
||||
/* Configure Low connection state. */
|
||||
|
||||
UNUSED(hpcd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Configure High connection state. */
|
||||
|
||||
}
|
||||
/* USER CODE END 6 */
|
||||
}
|
||||
|
|
|
@ -329,11 +329,11 @@ uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
{
|
||||
if(speed == USBD_SPEED_HIGH)
|
||||
{
|
||||
USBD_GetString((uint8_t *)serial_number, USBD_StrDesc, length);
|
||||
USBD_GetString((uint8_t *)USBD_SERIALNUMBER_STRING_FS, USBD_StrDesc, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
USBD_GetString((uint8_t *)serial_number, USBD_StrDesc, length);
|
||||
USBD_GetString((uint8_t *)USBD_SERIALNUMBER_STRING_FS, USBD_StrDesc, length);
|
||||
}
|
||||
return USBD_StrDesc;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue