From 82b4626ae3003f5d18cc7b36c8e0e0b3d53ccaa0 Mon Sep 17 00:00:00 2001 From: Sam Kirkham Date: Wed, 29 Jul 2020 12:39:49 +0100 Subject: [PATCH] stm32g4: Add support for USB Co-authored-by: Ben Brewer --- include/libopencm3/stm32/g4/st_usbfs.h | 27 ++++++++++++++++++++++++++ include/libopencm3/stm32/st_usbfs.h | 2 ++ lib/stm32/g4/Makefile | 4 ++++ 3 files changed, 33 insertions(+) create mode 100644 include/libopencm3/stm32/g4/st_usbfs.h diff --git a/include/libopencm3/stm32/g4/st_usbfs.h b/include/libopencm3/stm32/g4/st_usbfs.h new file mode 100644 index 00000000..7b65d2b8 --- /dev/null +++ b/include/libopencm3/stm32/g4/st_usbfs.h @@ -0,0 +1,27 @@ +/* + * This file is part of the libopencm3 project. + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ +/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY ! + * Use top-level + */ + +#ifndef LIBOPENCM3_ST_USBFS_H +# error Do not include directly ! +#else + +#include + +#endif diff --git a/include/libopencm3/stm32/st_usbfs.h b/include/libopencm3/stm32/st_usbfs.h index 08f5d247..9f0cb5e0 100644 --- a/include/libopencm3/stm32/st_usbfs.h +++ b/include/libopencm3/stm32/st_usbfs.h @@ -35,6 +35,8 @@ # include #elif defined(STM32L4) # include +#elif defined(STM32G4) +# include #else # error "STM32 family not defined or not supported." #endif diff --git a/lib/stm32/g4/Makefile b/lib/stm32/g4/Makefile index 5c1bfdca..9b59fbaf 100644 --- a/lib/stm32/g4/Makefile +++ b/lib/stm32/g4/Makefile @@ -44,6 +44,10 @@ OBJS += pwr.o OBJS += rcc.o rcc_common_all.o OBJS += timer_common_all.o timer_common_f0234.o +OBJS += usb.o usb_control.o usb_standard.o usb_msc.o +OBJS += usb_hid.o +OBJS += st_usbfs_core.o st_usbfs_v2.o + VPATH += ../../usb:../:../../cm3:../common VPATH += ../../ethernet