Skip to content

Commit

Permalink
remove: stm usb library
Browse files Browse the repository at this point in the history
  • Loading branch information
luftaquila committed Aug 5, 2024
1 parent 7c1a4ab commit 6b38d8d
Show file tree
Hide file tree
Showing 24 changed files with 176 additions and 5,684 deletions.
40 changes: 15 additions & 25 deletions device/firmware/.mxproject

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions device/firmware/Core/Inc/usb.h
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__ */

4 changes: 2 additions & 2 deletions device/firmware/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "spi.h"
#include "tim.h"
#include "usart.h"
#include "usb_device.h"
#include "usb.h"
#include "gpio.h"

/* Private includes ----------------------------------------------------------*/
Expand Down Expand Up @@ -105,7 +105,7 @@ int main(void)
MX_TIM1_Init();
MX_USART1_UART_Init();
MX_FATFS_Init();
MX_USB_DEVICE_Init();
MX_USB_PCD_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */

Expand Down
2 changes: 1 addition & 1 deletion device/firmware/Core/Src/stm32f1xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
/* USER CODE END 0 */

/* External variables --------------------------------------------------------*/
extern PCD_HandleTypeDef hpcd_USB_FS;
extern DMA_HandleTypeDef hdma_adc1;
extern ADC_HandleTypeDef hadc1;
extern SPI_HandleTypeDef hspi1;
extern SPI_HandleTypeDef hspi2;
extern TIM_HandleTypeDef htim1;
extern PCD_HandleTypeDef hpcd_USB_FS;
/* USER CODE BEGIN EV */

/* USER CODE END EV */
Expand Down
101 changes: 101 additions & 0 deletions device/firmware/Core/Src/usb.c
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 */
17 changes: 3 additions & 14 deletions device/firmware/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Sat Aug 03 03:04:48 KST 2024]
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Mon Aug 05 11:48:56 KST 2024]
##########################################################################################################################

# ------------------------------------------------
Expand Down Expand Up @@ -59,10 +59,6 @@ Core/Src/stm32f1xx_hal_msp.c \
FATFS/Target/user_diskio.c \
FATFS/Target/user_diskio_spi.c \
FATFS/App/fatfs.c \
USB_DEVICE/App/usb_device.c \
USB_DEVICE/App/usbd_desc.c \
USB_DEVICE/App/usbd_cdc_if.c \
USB_DEVICE/Target/usbd_conf.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
Expand Down Expand Up @@ -92,12 +88,9 @@ Middlewares/Third_Party/FatFs/src/ff.c \
Middlewares/Third_Party/FatFs/src/ff_gen_drv.c \
Middlewares/Third_Party/FatFs/src/option/syscall.c \
Middlewares/Third_Party/FatFs/src/option/ccsbcs.c \
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
Core/Src/sysmem.c \
Core/Src/syscalls.c
Core/Src/syscalls.c \
Core/Src/usb.c

# ASM sources
ASM_SOURCES = \
Expand Down Expand Up @@ -160,13 +153,9 @@ C_INCLUDES = \
-ICore/Inc \
-IFATFS/Target \
-IFATFS/App \
-IUSB_DEVICE/App \
-IUSB_DEVICE/Target \
-IDrivers/STM32F1xx_HAL_Driver/Inc \
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
-IMiddlewares/Third_Party/FatFs/src \
-IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \
-IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
-IDrivers/CMSIS/Include

Expand Down
Loading

0 comments on commit 6b38d8d

Please sign in to comment.