Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/flipperdevices/libusb_stm32.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Filimonchuk <dmitrystu@gmail.com>2022-08-30 23:28:20 +0300
committerGitHub <noreply@github.com>2022-08-30 23:28:20 +0300
commit396c2c50ad330b522104d0565525a7350e486fb9 (patch)
tree3e5f990e61066ad30a7e7b12c3e014c5139425cf
parent90e12ea03f5e47a4c040ba14f29e4575e2272bef (diff)
parent33bbf99efc0ed43e1cafe80e11e6d6fa268c7d1f (diff)
Merge pull request #115 from mamins1376/pio
Add PlatformIO support
-rw-r--r--demo/cdc_loop.c2
-rw-r--r--demo/cdc_startup.c2
-rw-r--r--inc/stm32_compat.h59
-rw-r--r--library.json17
-rw-r--r--src/usbd_stm32f103_devfs.c2
-rw-r--r--src/usbd_stm32f105_otgfs.c2
-rw-r--r--src/usbd_stm32f429_otgfs.c2
-rw-r--r--src/usbd_stm32f429_otghs.c2
-rw-r--r--src/usbd_stm32f446_otgfs.c2
-rw-r--r--src/usbd_stm32f446_otghs.c2
-rw-r--r--src/usbd_stm32h743_otgfs.c2
-rw-r--r--src/usbd_stm32l052_devfs.c2
-rw-r--r--src/usbd_stm32l100_devfs.c2
-rw-r--r--src/usbd_stm32l433_devfs.c2
-rw-r--r--src/usbd_stm32l476_otgfs.c2
-rw-r--r--src/usbd_stm32wb55_devfs.c2
16 files changed, 90 insertions, 14 deletions
diff --git a/demo/cdc_loop.c b/demo/cdc_loop.c
index cea9171..986a7ba 100644
--- a/demo/cdc_loop.c
+++ b/demo/cdc_loop.c
@@ -16,7 +16,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#include "usb_cdc.h"
#include "usb_hid.h"
diff --git a/demo/cdc_startup.c b/demo/cdc_startup.c
index 68ce0ae..612b64f 100644
--- a/demo/cdc_startup.c
+++ b/demo/cdc_startup.c
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include "stm32.h"
+#include "stm32_compat.h"
static void cdc_init_rcc (void) {
#if defined(STM32L0)
diff --git a/inc/stm32_compat.h b/inc/stm32_compat.h
new file mode 100644
index 0000000..1564567
--- /dev/null
+++ b/inc/stm32_compat.h
@@ -0,0 +1,59 @@
+#ifndef _STM32_COMPAT_H_
+#define _STM32_COMPAT_H_
+
+#ifndef PLATFORMIO
+
+#include <stm32.h>
+
+#else // PLATFORMIO
+/* modify bitfield */
+#define _BMD(reg, msk, val) (reg) = (((reg) & ~(msk)) | (val))
+/* set bitfield */
+#define _BST(reg, bits) (reg) = ((reg) | (bits))
+/* clear bitfield */
+#define _BCL(reg, bits) (reg) = ((reg) & ~(bits))
+/* wait until bitfield set */
+#define _WBS(reg, bits) while(((reg) & (bits)) == 0)
+/* wait until bitfield clear */
+#define _WBC(reg, bits) while(((reg) & (bits)) != 0)
+/* wait for bitfield value */
+#define _WVL(reg, msk, val) while(((reg) & (msk)) != (val))
+/* bit value */
+#define _BV(bit) (0x01 << (bit))
+
+#if defined(STM32F0xx)
+ #include <stm32f0xx.h>
+#elif defined(STM32F1xx)
+ #include <stm32f1xx.h>
+#elif defined(STM32F2xx)
+ #include <stm32f2xx.h>
+#elif defined(STM32F3xx)
+ #include <stm32f3xx.h>
+#elif defined(STM32F4xx)
+ #include <stm32f4xx.h>
+#elif defined(STM32F7xx)
+ #include <stm32f7xx.h>
+#elif defined(STM32H7xx)
+ #include <stm32h7xx.h>
+#elif defined(STM32L0xx)
+ #include <stm32l0xx.h>
+#elif defined(STM32L1xx)
+ #include <stm32l1xx.h>
+#elif defined(STM32L4xx)
+ #include <stm32l4xx.h>
+#elif defined(STM32L5xx)
+ #include <stm32l5xx.h>
+#elif defined(STM32G0xx)
+ #include <stm32g0xx.h>
+#elif defined(STM32G4xx)
+ #include <stm32g4xx.h>
+#elif defined(STM32WBxx)
+ #include <stm32wbxx.h>
+#else
+ #error "STM32 family not defined"
+#endif
+
+#endif // PLATFORMIO
+
+
+#endif // _STM32_COMPAT_H_ \ No newline at end of file
diff --git a/library.json b/library.json
new file mode 100644
index 0000000..210c991
--- /dev/null
+++ b/library.json
@@ -0,0 +1,17 @@
+{
+ "name": "libusb_stm32",
+ "description": "Lightweight USB Device Stack",
+ "version": "0.1.0",
+ "keywords": "stm32, usb",
+ "authors": {
+ "name": "Dmitry Filimonchuk",
+ "email": "dmitrystu@gmail.com"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dmitrystu/libusb_stm32.git"
+ },
+ "platforms": [ "ststm32" ],
+ "headers": ["stm32_compat.h", "usb.h"],
+ "build": { "includeDir": "inc" }
+}
diff --git a/src/usbd_stm32f103_devfs.c b/src/usbd_stm32f103_devfs.c
index 8601994..2e81435 100644
--- a/src/usbd_stm32f103_devfs.c
+++ b/src/usbd_stm32f103_devfs.c
@@ -16,7 +16,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32F103)
diff --git a/src/usbd_stm32f105_otgfs.c b/src/usbd_stm32f105_otgfs.c
index 90ddf09..e3c0f4b 100644
--- a/src/usbd_stm32f105_otgfs.c
+++ b/src/usbd_stm32f105_otgfs.c
@@ -16,7 +16,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32F105)
diff --git a/src/usbd_stm32f429_otgfs.c b/src/usbd_stm32f429_otgfs.c
index ea1b3b4..059a541 100644
--- a/src/usbd_stm32f429_otgfs.c
+++ b/src/usbd_stm32f429_otgfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32F429FS)
diff --git a/src/usbd_stm32f429_otghs.c b/src/usbd_stm32f429_otghs.c
index fa0b1d6..996c701 100644
--- a/src/usbd_stm32f429_otghs.c
+++ b/src/usbd_stm32f429_otghs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32F429HS)
diff --git a/src/usbd_stm32f446_otgfs.c b/src/usbd_stm32f446_otgfs.c
index 32a78e4..ea1d586 100644
--- a/src/usbd_stm32f446_otgfs.c
+++ b/src/usbd_stm32f446_otgfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32F446FS)
diff --git a/src/usbd_stm32f446_otghs.c b/src/usbd_stm32f446_otghs.c
index 2473286..4e4a8b3 100644
--- a/src/usbd_stm32f446_otghs.c
+++ b/src/usbd_stm32f446_otghs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32F446HS)
diff --git a/src/usbd_stm32h743_otgfs.c b/src/usbd_stm32h743_otgfs.c
index b5de2c8..7ea6236 100644
--- a/src/usbd_stm32h743_otgfs.c
+++ b/src/usbd_stm32h743_otgfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32H743FS)
diff --git a/src/usbd_stm32l052_devfs.c b/src/usbd_stm32l052_devfs.c
index b6b3689..e2ba11e 100644
--- a/src/usbd_stm32l052_devfs.c
+++ b/src/usbd_stm32l052_devfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32L052)
diff --git a/src/usbd_stm32l100_devfs.c b/src/usbd_stm32l100_devfs.c
index 6764bfb..77488ed 100644
--- a/src/usbd_stm32l100_devfs.c
+++ b/src/usbd_stm32l100_devfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32L100)
diff --git a/src/usbd_stm32l433_devfs.c b/src/usbd_stm32l433_devfs.c
index 171ee24..133624c 100644
--- a/src/usbd_stm32l433_devfs.c
+++ b/src/usbd_stm32l433_devfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32L433)
diff --git a/src/usbd_stm32l476_otgfs.c b/src/usbd_stm32l476_otgfs.c
index 7aa54dc..66294bc 100644
--- a/src/usbd_stm32l476_otgfs.c
+++ b/src/usbd_stm32l476_otgfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32L476)
diff --git a/src/usbd_stm32wb55_devfs.c b/src/usbd_stm32wb55_devfs.c
index fd1142b..07a50b0 100644
--- a/src/usbd_stm32wb55_devfs.c
+++ b/src/usbd_stm32wb55_devfs.c
@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "stm32.h"
+#include "stm32_compat.h"
#include "usb.h"
#if defined(USBD_STM32WB55)