-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c1a4ab
commit 6b38d8d
Showing
24 changed files
with
176 additions
and
5,684 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* USER CODE BEGIN Header */ | ||
/** | ||
****************************************************************************** | ||
* @file usb.h | ||
* @brief This file contains all the function prototypes for | ||
* the usb.c file | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* Copyright (c) 2024 STMicroelectronics. | ||
* All rights reserved. | ||
* | ||
* This software is licensed under terms that can be found in the LICENSE file | ||
* in the root directory of this software component. | ||
* If no LICENSE file comes with this software, it is provided AS-IS. | ||
* | ||
****************************************************************************** | ||
*/ | ||
/* USER CODE END Header */ | ||
/* Define to prevent recursive inclusion -------------------------------------*/ | ||
#ifndef __USB_H__ | ||
#define __USB_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
#include "main.h" | ||
|
||
/* USER CODE BEGIN Includes */ | ||
|
||
/* USER CODE END Includes */ | ||
|
||
extern PCD_HandleTypeDef hpcd_USB_FS; | ||
|
||
/* USER CODE BEGIN Private defines */ | ||
|
||
/* USER CODE END Private defines */ | ||
|
||
void MX_USB_PCD_Init(void); | ||
|
||
/* USER CODE BEGIN Prototypes */ | ||
|
||
/* USER CODE END Prototypes */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __USB_H__ */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* USER CODE BEGIN Header */ | ||
/** | ||
****************************************************************************** | ||
* @file usb.c | ||
* @brief This file provides code for the configuration | ||
* of the USB instances. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* Copyright (c) 2024 STMicroelectronics. | ||
* All rights reserved. | ||
* | ||
* This software is licensed under terms that can be found in the LICENSE file | ||
* in the root directory of this software component. | ||
* If no LICENSE file comes with this software, it is provided AS-IS. | ||
* | ||
****************************************************************************** | ||
*/ | ||
/* USER CODE END Header */ | ||
/* Includes ------------------------------------------------------------------*/ | ||
#include "usb.h" | ||
|
||
/* USER CODE BEGIN 0 */ | ||
|
||
/* USER CODE END 0 */ | ||
|
||
PCD_HandleTypeDef hpcd_USB_FS; | ||
|
||
/* USB init function */ | ||
|
||
void MX_USB_PCD_Init(void) | ||
{ | ||
|
||
/* USER CODE BEGIN USB_Init 0 */ | ||
|
||
/* USER CODE END USB_Init 0 */ | ||
|
||
/* USER CODE BEGIN USB_Init 1 */ | ||
|
||
/* USER CODE END USB_Init 1 */ | ||
hpcd_USB_FS.Instance = USB; | ||
hpcd_USB_FS.Init.dev_endpoints = 8; | ||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL; | ||
hpcd_USB_FS.Init.low_power_enable = DISABLE; | ||
hpcd_USB_FS.Init.lpm_enable = DISABLE; | ||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE; | ||
if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK) | ||
{ | ||
Error_Handler(); | ||
} | ||
/* USER CODE BEGIN USB_Init 2 */ | ||
|
||
/* USER CODE END USB_Init 2 */ | ||
|
||
} | ||
|
||
void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle) | ||
{ | ||
|
||
if(pcdHandle->Instance==USB) | ||
{ | ||
/* USER CODE BEGIN USB_MspInit 0 */ | ||
|
||
/* USER CODE END USB_MspInit 0 */ | ||
/* USB clock enable */ | ||
__HAL_RCC_USB_CLK_ENABLE(); | ||
|
||
/* USB interrupt Init */ | ||
HAL_NVIC_SetPriority(USB_HP_CAN1_TX_IRQn, 0, 0); | ||
HAL_NVIC_EnableIRQ(USB_HP_CAN1_TX_IRQn); | ||
HAL_NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 0, 0); | ||
HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn); | ||
/* USER CODE BEGIN USB_MspInit 1 */ | ||
|
||
/* USER CODE END USB_MspInit 1 */ | ||
} | ||
} | ||
|
||
void HAL_PCD_MspDeInit(PCD_HandleTypeDef* pcdHandle) | ||
{ | ||
|
||
if(pcdHandle->Instance==USB) | ||
{ | ||
/* USER CODE BEGIN USB_MspDeInit 0 */ | ||
|
||
/* USER CODE END USB_MspDeInit 0 */ | ||
/* Peripheral clock disable */ | ||
__HAL_RCC_USB_CLK_DISABLE(); | ||
|
||
/* USB interrupt Deinit */ | ||
HAL_NVIC_DisableIRQ(USB_HP_CAN1_TX_IRQn); | ||
HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn); | ||
/* USER CODE BEGIN USB_MspDeInit 1 */ | ||
|
||
/* USER CODE END USB_MspDeInit 1 */ | ||
} | ||
} | ||
|
||
/* USER CODE BEGIN 1 */ | ||
|
||
/* USER CODE END 1 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.