diff --git a/EX-IOExpander.ino b/EX-IOExpander.ino
index 84736a6..ecd2169 100644
--- a/EX-IOExpander.ino
+++ b/EX-IOExpander.ino
@@ -1,4 +1,5 @@
/*
+ * © 2024, Paul M. Antoine
* © 2022, Peter Cole. All rights reserved.
* © 2023, Peter Cole. All rights reserved.
*
@@ -62,6 +63,8 @@
#include "arduino_arch_samd.h"
#elif defined(ARDUINO_BLUEPILL_F103C8)
#include "arduino_bluepill_f103c8.h"
+#elif defined(ARDUINO_BLACKPILL_F401CC)
+#include "arduino_blackpill_f401cc.h"
#endif
/*
diff --git a/arduino_blackpill_f401cc.h b/arduino_blackpill_f401cc.h
new file mode 100644
index 0000000..a9efd16
--- /dev/null
+++ b/arduino_blackpill_f401cc.h
@@ -0,0 +1,52 @@
+/*
+ * © 2024, Paul M. Antoine
+ * © 2023, Peter Cole. All rights reserved.
+ *
+ * This file is part of EX-IOExpander.
+ *
+ * This is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * It 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CommandStation. If not, see .
+ */
+
+#ifndef ARDUINO_BLACKPILL_F401CC_H
+#define ARDUINO_BLACKPILL_F401CC_H
+
+#include
+#include "globals.h"
+
+pinDefinition pinMap[TOTAL_PINS] = {
+ {PB12,DIO},{PB13,DIOP},{PB14,DIOP},{PB15,DIOP},{PA8,DIOP},{PA9,DIOP},{PA10,DIOP},{PA15,DIOP}, // P1 (left row)
+ {PB3,DIOP},{PB4,DIOP},{PB5,DIOP},{PB6,DIOP},{PB7,DIOP}, // P1 (left row)
+ {PB10,DIOP},{PB2,DIO},{PB1,AIDIOP},{PB0,AIDIOP},{PA7,AIDIOP},{PA6,AIDIOP},{PA5,DIOP}, // P2 (right row)
+ {PA4,AIDIOP},{PA3,AIDIO},{PA2,DIO},{PA1,AIDIOP},{PA0,AIDIOP},{PC15,DIO},{PC14,DIO},{PC13,DIO}, // P2 (right row)
+};
+
+#define I2C_SDA PB9
+#define I2C_SCL PB8
+
+pinName pinNameMap[TOTAL_PINS] = {
+ {PB12,"PB12"},{PB13,"PB13"},{PB14,"PB14"},{PB15,"PB15"},{PA8,"PA8"},{PA9,"PA9"},{PA10,"PA10"},{PA15,"PA15"}, // P1 (left row)
+ {PB3,"PB3"},{PB4,"PB4"},{PB5,"PB5"},{PB6,"PB6"},{PB7,"PB7"}, // P1 (left row)
+ {PB10,"PB10"},{PB2,"PB2"},{PB1,"PB1"},{PB0,"PB0"},{PA7,"PA7"},{PA6,"PA6"},{PA5,"PA5"}, // P2 (right row)
+ {PA4,"PA4"},{PA3,"PA3"},{PA2,"PA2"},{PA1,"PA1"},{PA0,"PA0"},{PC15,"PC15"},{PC14,"PC14"},{PC13,"PC13"}, // P2 (right row)
+};
+
+/*
+Pins not available for use:
+Digital - PA13|14 (debugger),PH0|1 (clock), PC14|15 (used by 32KHz oscillator)
+Digital - PB8|9 (I2C)
+Digital - PA11/12 (USB D-/D+)
+Note that PC13 has a green LED - 0 to this pin to turn it on
+*/
+
+#endif
\ No newline at end of file
diff --git a/defines.h b/defines.h
index 3fbc1d3..cf5688c 100644
--- a/defines.h
+++ b/defines.h
@@ -1,4 +1,5 @@
/*
+ * © 2024, Paul M. Antoine
* © 2023, Peter Cole. All rights reserved.
*
* This file is part of EX-IOExpander.
@@ -71,6 +72,11 @@
#define TOTAL_PINS 28
#define NUM_PWM_PINS 19
#define MAX_SUPERPINS 28
+#elif defined(ARDUINO_BLACKPILL_F401CC)
+#define BOARD_TYPE F("BLACKPILL-STM32F401CC")
+#define TOTAL_PINS 28
+#define NUM_PWM_PINS 19
+#define MAX_SUPERPINS 28
#else
#define CPU_TYPE_ERROR
#endif
@@ -81,7 +87,8 @@
#undef USB_SERIAL // Teensy has this defined by default (in case we ever support Teensy)
#define USB_SERIAL Serial // Standard serial port most of the time!
-#if defined(ARDUINO_ARCH_SAMD)
+#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_BLACKPILL_F401CC)
+#warning found usb serial
#undef USB_SERIAL
#define USB_SERIAL SerialUSB // Most SAMD21 clones use native USB on the SAMD21G18 variants
#endif
diff --git a/globals.h b/globals.h
index d731d28..42dd652 100644
--- a/globals.h
+++ b/globals.h
@@ -1,4 +1,5 @@
/*
+ * © 2024, Paul M. Antoine
* © 2023, Peter Cole. All rights reserved.
*
* This file is part of EX-IOExpander.
diff --git a/platformio.ini b/platformio.ini
index 02c45aa..2b0549c 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -130,3 +130,21 @@ build_flags =
-DUSB_PRODUCT="\"BLUEPILL_F103C8\""
monitor_speed = 115200
monitor_echo = yes
+
+[env:blackpill_f401cc]
+platform = ststm32
+board = blackpill_f401cc
+framework = arduino
+upload_protocol = dfu
+build_flags =
+ ${env.build_flags}
+ -std=c++17 -Os -g2
+ -DPIO_FRAMEWORK_ARDUINO_ENABLE_CDC
+ -DUSBCON
+ -DHAL_PCD_MODULE_ENABLED
+ -DUSBD_VID=0x0483
+ -DUSBD_PID=0x5740
+ -DUSB_MANUFACTURER="Unknown"
+ -DUSB_PRODUCT="\"BLACKPILL_F401CC\""
+monitor_speed = 115200
+monitor_echo = yes
diff --git a/version.h b/version.h
index 3df9346..2a50aa1 100644
--- a/version.h
+++ b/version.h
@@ -2,8 +2,10 @@
#define VERSION_H
// Version must only ever be numeric in order to be able to send it to the CommandStation
-#define VERSION "0.0.23"
+#define VERSION "0.0.23a"
+// 0.0.23a includes:
+// - Add experimental definition for BlackPill F401CC devices
// 0.0.23 includes:
// - Add use of Servo library for controlling servos for supported platforms
// - Add SuperPin class for neat dimming of LEDs without needing hardware PWM pins