diff --git a/.gitignore b/.gitignore
index bec8ade2e..48c875d1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@ doxygen.log
TAGS
tags
.DS_Store
+.vscode/
+.clang-format
diff --git a/Documentation/img/configuration-stm32duino-stm32f1c8t6.png b/Documentation/img/configuration-stm32duino-stm32f1c8t6.png
new file mode 100644
index 000000000..3e0df3a8e
Binary files /dev/null and b/Documentation/img/configuration-stm32duino-stm32f1c8t6.png differ
diff --git a/MySensors.h b/MySensors.h
index ec01be347..33667bcbd 100644
--- a/MySensors.h
+++ b/MySensors.h
@@ -73,6 +73,9 @@
#elif defined(ARDUINO_ARCH_STM32F1)
#include "hal/architecture/STM32F1/MyHwSTM32F1.cpp"
#include "hal/crypto/generic/MyCryptoGeneric.cpp"
+#elif defined(ARDUINO_ARCH_STM32)
+#include "hal/architecture/STM32/MyHwSTM32.cpp"
+#include "hal/crypto/generic/MyCryptoGeneric.cpp"
#elif defined(ARDUINO_ARCH_NRF5) || defined(ARDUINO_ARCH_NRF52)
#include "hal/architecture/NRF5/MyHwNRF5.cpp"
#include "hal/crypto/generic/MyCryptoGeneric.cpp"
@@ -336,7 +339,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
#define MY_RAM_ROUTING_TABLE_ENABLED
#elif defined(MY_RAM_ROUTING_TABLE_FEATURE) && defined(MY_REPEATER_FEATURE)
// activate feature based on architecture
-#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_NRF5) || defined(ARDUINO_ARCH_STM32F1) || defined(TEENSYDUINO) || defined(__linux__) || defined(__ASR6501__) || defined (__ASR6502__)
+#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_NRF5) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32) || defined(TEENSYDUINO) || defined(__linux__) || defined(__ASR6501__) || defined (__ASR6502__)
#define MY_RAM_ROUTING_TABLE_ENABLED
#elif defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
#if defined(__avr_atmega1280__) || defined(__avr_atmega1284__) || defined(__avr_atmega2560__) || defined(__avr_attiny3224__) || defined(__avr_attiny3227__)
@@ -474,6 +477,8 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
#include "hal/architecture/Linux/MyMainLinuxGeneric.cpp"
#elif defined(ARDUINO_ARCH_STM32F1)
#include "hal/architecture/STM32F1/MyMainSTM32F1.cpp"
+#elif defined(ARDUINO_ARCH_STM32)
+#include "hal/architecture/STM32/MyMainSTM32.cpp"
#elif defined(__ASR6501__) || defined(__ASR6502__)
#include "hal/architecture/ASR650x/MyMainASR650x.cpp"
#elif defined(__arm__) && defined(TEENSYDUINO)
diff --git a/README.stm32duino.md b/README.stm32duino.md
new file mode 100644
index 000000000..6316c9996
--- /dev/null
+++ b/README.stm32duino.md
@@ -0,0 +1,25 @@
+# MySensors Library readme for [stm32duino](https://github.com/stm32duino/Arduino_Core_STM32)
+
+## Why start this since there is STM32 support of [rogerclarkmelbourne/Arduino_STM32](https://github.com/rogerclarkmelbourne/Arduino_STM32)
+- It lacks low power support, which is important for battery powered nodes.
+- Rich features of STM32 are limited, such as STM32 has more interrupt than AVR.
+
+## Task status
+- [x] STM32F1 basic support
+- [ ] Low Power support
+- [ ] Extra Interrupt support
+
+## Development Memo
+Tested on:
+- Hardware: STM32F103C8T6 Bluepill 128KB
+ - configuration
+
+
+
+- STM32 Cores by STMicroelectronics Version 1.9.0
+
+# Thanks
+- [#Arduino_Core_STM32](https://github.com/stm32duino/Arduino_Core_STM32) for the rich support of STM32 series.
+- [Arduino_STM32](https://github.com/rogerclarkmelbourne/Arduino_STM32) for the first STM32 support on STM32.
+- [NodeManager](https://github.com/mysensors/NodeManager) for the fast development on mysensors gateways/nodes.
+- [MySensors](https://github.com/mysensors/MySensors) for building the base.
diff --git a/core/MyCapabilities.h b/core/MyCapabilities.h
index 44d769008..4e46fe196 100644
--- a/core/MyCapabilities.h
+++ b/core/MyCapabilities.h
@@ -166,7 +166,9 @@
#elif defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
#define MY_CAP_ARCH "A"
#elif defined(ARDUINO_ARCH_STM32F1)
-#define MY_CAP_ARCH "M"
+#define MY_CAP_ARCH "F"
+#elif defined(ARDUINO_ARCH_STM32)
+#define MY_CAP_ARCH "f"
#elif defined(__arm__) && defined(TEENSYDUINO)
#define MY_CAP_ARCH "T"
#elif defined(__linux__)
diff --git a/examples/SecurityPersonalizer/SecurityPersonalizer.ino b/examples/SecurityPersonalizer/SecurityPersonalizer.ino
index 2a07d0e0c..05b7d4457 100644
--- a/examples/SecurityPersonalizer/SecurityPersonalizer.ino
+++ b/examples/SecurityPersonalizer/SecurityPersonalizer.ino
@@ -1351,6 +1351,8 @@ static void probe_and_print_peripherals(void)
Serial.print(F("| SAMD | DETECTED | N/A | "));
#elif defined(ARDUINO_ARCH_STM32F1)
Serial.print(F("| STM32F1 | DETECTED | N/A | "));
+#elif defined(ARDUINO_ARCH_STM32)
+ Serial.print(F("| STM32 | DETECTED | N/A | "));
#elif defined(__linux__)
Serial.print(F("| Linux | DETECTED | N/A | "));
#else
diff --git a/hal/architecture/STM32/MyHwSTM32.cpp b/hal/architecture/STM32/MyHwSTM32.cpp
new file mode 100644
index 000000000..e4c834e4c
--- /dev/null
+++ b/hal/architecture/STM32/MyHwSTM32.cpp
@@ -0,0 +1,184 @@
+/*
+ * The MySensors Arduino library handles the wireless radio link and protocol
+ * between your home built sensors/actuators and HA controller of choice.
+ * The sensors forms a self healing radio network with optional repeaters. Each
+ * repeater and gateway builds a routing tables in EEPROM which keeps track of
+ * the network topology allowing messages to be routed to nodes.
+ *
+ * Created by Henrik Ekblad
+ * Copyright (C) 2013-2019 Sensnology AB
+ * Full contributor list:
+ * https://github.com/mysensors/MySensors/graphs/contributors
+ *
+ * Documentation: http://www.mysensors.org
+ * Support Forum: http://forum.mysensors.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include "MyHwSTM32.h"
+#include "drivers/hal_conf_custom.h"
+#include "drivers/stm32_ADC_internal_channels.h"
+
+/*
+ * Pinout STM32F103C8 dev board:
+ * http://wiki.stm32duino.com/images/a/ae/Bluepillpinout.gif
+ *
+ * Wiring RFM69 radio / SPI1
+ * --------------------------------------------------
+ * CLK PA5
+ * MISO PA6
+ * MOSI PA7
+ * CSN PA4
+ * CE NA
+ * IRQ PA3 (default)
+ *
+ * Wiring RF24 radio / SPI1
+ * --------------------------------------------------
+ * CLK PA5
+ * MISO PA6
+ * MOSI PA7
+ * CSN PA4
+ * CE PB0 (default)
+ * IRQ NA
+ *
+ */
+bool hwInit(void) {
+#if !defined(MY_DISABLED_SERIAL)
+ MY_SERIALDEVICE.begin(MY_BAUD_RATE);
+#if defined(MY_GATEWAY_SERIAL)
+ while (!MY_SERIALDEVICE) {
+ }
+#endif
+#endif
+ return true;
+ // return EEPROM.begin();
+
+ // if (EEPROM.init() == EEPROM_OK) {
+ // uint16 cnt;
+ // EEPROM.count(&cnt);
+ // if(cnt>=EEPROM.maxcount()) {
+ // // tmp, WIP: format eeprom if full
+ // EEPROM.format();
+ // }
+ // return true;
+ // }
+ // return false;
+}
+
+void hwReadConfigBlock(void *buf, void *addr, size_t length) {
+ uint8_t *dst = static_cast(buf);
+ int pos = reinterpret_cast(addr);
+ eeprom_buffer_fill();
+ // return eeprom_buffered_read_byte(pos);
+
+ // while (length-- > 0) {
+ // *dst++ = EEPROM.read(pos++);
+ // }
+ while (length-- > 0) {
+ *dst++ = eeprom_buffered_read_byte(pos++);
+ }
+}
+
+void hwWriteConfigBlock(void *buf, void *addr, size_t length) {
+ uint8_t *src = static_cast(buf);
+ int pos = reinterpret_cast(addr);
+ // while (length-- > 0) {
+ // EEPROM.write(pos++, *src++);
+ // }
+ while (length-- > 0) {
+ // EEPROM.write(pos++, *src++);
+ eeprom_buffered_write_byte(pos++, *src++);
+ }
+ eeprom_buffer_flush();
+}
+
+// void hwReadConfigBlock(void *buf, void *addr, size_t length) {
+// uint8_t *dst = static_cast(buf);
+// int pos = reinterpret_cast(addr);
+// while (length-- > 0) {
+// *dst++ = EEPROM.read(pos++);
+// }
+// }
+
+// void hwWriteConfigBlock(void *buf, void *addr, size_t length) {
+// uint8_t *src = static_cast(buf);
+// int pos = reinterpret_cast(addr);
+// while (length-- > 0) {
+// EEPROM.write(pos++, *src++);
+// }
+// }
+
+// uint8_t hwReadConfig(const int addr) {
+// uint8_t value;
+// hwReadConfigBlock(&value, reinterpret_cast(addr), 1);
+// return value;
+// }
+
+// void hwWriteConfig(const int addr, uint8_t value) {
+// hwWriteConfigBlock(&value, reinterpret_cast(addr), 1);
+// }
+
+int8_t hwSleep(uint32_t ms) {
+ // TODO: Not supported!
+ (void)ms;
+ return MY_SLEEP_NOT_POSSIBLE;
+}
+
+int8_t hwSleep(const uint8_t interrupt, const uint8_t mode, uint32_t ms) {
+ // TODO: Not supported!
+ (void)interrupt;
+ (void)mode;
+ (void)ms;
+ return MY_SLEEP_NOT_POSSIBLE;
+}
+
+int8_t hwSleep(const uint8_t interrupt1, const uint8_t mode1,
+ const uint8_t interrupt2, const uint8_t mode2, uint32_t ms) {
+ // TODO: Not supported!
+ (void)interrupt1;
+ (void)mode1;
+ (void)interrupt2;
+ (void)mode2;
+ (void)ms;
+ return MY_SLEEP_NOT_POSSIBLE;
+}
+
+void hwRandomNumberInit(void) {
+ // use internal temperature sensor as noise source
+ uint32_t seed = 0;
+ uint16_t currentValue = 0;
+ uint16_t newValue = 0;
+
+ for (uint8_t i = 0; i < 32; i++) {
+ const uint32_t timeout = hwMillis() + 20;
+ while (timeout >= hwMillis()) {
+ newValue = analogRead(ATEMP);
+ if (newValue != currentValue) {
+ currentValue = newValue;
+ break;
+ }
+ }
+ seed ^= ((newValue + hwMillis()) & 7) << i;
+ }
+ randomSeed(seed);
+}
+
+bool hwUniqueID(unique_id_t *uniqueID) {
+ (void)memcpy((uint8_t *)uniqueID, (uint32_t *)0x1FFFF7E0,
+ 16); // FlashID + ChipID
+ return true;
+}
+
+uint16_t hwCPUVoltage(void) { return (uint16_t)readVref(); }
+
+uint16_t hwCPUFrequency(void) { return F_CPU / 100000UL; }
+
+int8_t hwCPUTemperature(void) { return (int8_t)readTempSensor(readVref()); }
+
+uint16_t hwFreeMem(void) {
+ // Not yet implemented
+ return FUNCTION_NOT_SUPPORTED;
+}
diff --git a/hal/architecture/STM32/MyHwSTM32.h b/hal/architecture/STM32/MyHwSTM32.h
new file mode 100644
index 000000000..98c7c1c21
--- /dev/null
+++ b/hal/architecture/STM32/MyHwSTM32.h
@@ -0,0 +1,98 @@
+/*
+ * The MySensors Arduino library handles the wireless radio link and protocol
+ * between your home built sensors/actuators and HA controller of choice.
+ * The sensors forms a self healing radio network with optional repeaters. Each
+ * repeater and gateway builds a routing tables in EEPROM which keeps track of the
+ * network topology allowing messages to be routed to nodes.
+ *
+ * Created by Henrik Ekblad
+ * Copyright (C) 2013-2019 Sensnology AB
+ * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
+ *
+ * Documentation: http://www.mysensors.org
+ * Support Forum: http://forum.mysensors.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#ifndef MyHwSTM32_h
+#define MyHwSTM32_h
+
+// #include
+#include
+// #include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+#include
+#endif
+
+#define CRYPTO_LITTLE_ENDIAN
+
+#ifndef MY_SERIALDEVICE
+#define MY_SERIALDEVICE Serial
+#endif
+
+#ifndef MY_DEBUGDEVICE
+#define MY_DEBUGDEVICE MY_SERIALDEVICE
+#endif
+
+#ifndef MY_STM32F1_TEMPERATURE_OFFSET
+#define MY_STM32F1_TEMPERATURE_OFFSET (0.0f)
+#endif
+
+#ifndef MY_STM32F1_TEMPERATURE_GAIN
+#define MY_STM32F1_TEMPERATURE_GAIN (1.0f)
+#endif
+
+// SS default
+#ifndef SS
+#define SS PA4
+#endif
+
+// mapping
+#define snprintf_P snprintf
+#define vsnprintf_P vsnprintf
+#define strncpy_P strncpy
+#define printf_P printf
+#define yield() // not defined
+
+#ifndef digitalPinToInterrupt
+#define digitalPinToInterrupt(__pin) (__pin)
+#endif
+
+#define hwDigitalWrite(__pin, __value) digitalWrite(__pin, __value)
+#define hwDigitalRead(__pin) digitalRead(__pin)
+#define hwPinMode(__pin, __value) pinMode(__pin, __value)
+#define hwWatchdogReset() IWatchdog.reload() // iwdg_feed()
+// #define hwReboot() nvic_sys_reset()
+#define hwReboot() HAL_NVIC_SystemReset()
+#define hwMillis() millis()
+#define hwGetSleepRemaining() (0ul)
+
+extern void serialEventRun(void) __attribute__((weak));
+bool hwInit(void);
+void hwRandomNumberInit(void);
+void hwReadConfigBlock(void *buf, void *addr, size_t length);
+void hwWriteConfigBlock(void *buf, void *addr, size_t length);
+// void hwWriteConfig(const int addr, uint8_t value);
+// uint8_t hwReadConfig(const int addr);
+#define hwReadConfig(__pos) eeprom_read_byte((const uint32_t)__pos)
+#define hwWriteConfig(__pos, __val) eeprom_write_byte((const uint32_t)__pos, (uint8_t)__val)
+
+// SOFTSPI
+#ifdef MY_SOFTSPI
+#error Soft SPI is not available on this architecture!
+#endif
+#define hwSPI SPI //!< hwSPI
+
+
+#ifndef DOXYGEN
+#define MY_CRITICAL_SECTION
+#endif /* DOXYGEN */
+
+#endif
diff --git a/hal/architecture/STM32/MyMainSTM32.cpp b/hal/architecture/STM32/MyMainSTM32.cpp
new file mode 100644
index 000000000..01283dde7
--- /dev/null
+++ b/hal/architecture/STM32/MyMainSTM32.cpp
@@ -0,0 +1,64 @@
+/*
+ * The MySensors Arduino library handles the wireless radio link and protocol
+ * between your home built sensors/actuators and HA controller of choice.
+ * The sensors forms a self healing radio network with optional repeaters. Each
+ * repeater and gateway builds a routing tables in EEPROM which keeps track of
+ * the network topology allowing messages to be routed to nodes.
+ *
+ * Created by Henrik Ekblad
+ * Copyright (C) 2013-2019 Sensnology AB
+ * Full contributor list:
+ * https://github.com/mysensors/MySensors/graphs/contributors
+ *
+ * Documentation: http://www.mysensors.org
+ * Support Forum: http://forum.mysensors.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#define ARDUINO_MAIN
+#include "Arduino.h"
+
+// Force init to be called *first*, i.e. before static object allocation.
+// Otherwise, statically allocated objects that need HAL may fail.
+__attribute__((constructor(101))) void premain() {
+
+ // Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html
+#ifdef NVIC_PRIORITYGROUP_4
+ HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
+#endif
+#if (__CORTEX_M == 0x07U)
+ // Defined in CMSIS core_cm7.h
+#ifndef I_CACHE_DISABLED
+ SCB_EnableICache();
+#endif
+#ifndef D_CACHE_DISABLED
+ SCB_EnableDCache();
+#endif
+#endif
+
+ init();
+}
+
+/*
+ * \brief Main entry point of Arduino application
+ */
+int main(void) {
+ initVariant();
+
+ // setup();
+ _begin(); // Startup MySensors library
+ for (;;) {
+ _process(); // Process incoming data
+ if (loop) { // Call sketch loop
+ loop();
+ }
+ if (serialEventRun) {
+ serialEventRun();
+ }
+ }
+
+ return 0;
+}
diff --git a/hal/architecture/STM32/drivers/hal_conf_custom.h b/hal/architecture/STM32/drivers/hal_conf_custom.h
new file mode 100644
index 000000000..ab1535b07
--- /dev/null
+++ b/hal/architecture/STM32/drivers/hal_conf_custom.h
@@ -0,0 +1,66 @@
+/**
+ ******************************************************************************
+ * @file stm32f1xx_hal_conf_default.h
+ * @brief HAL default configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef _HAL_CONF_CUSTOM_H
+#define _HAL_CONF_CUSTOM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// #define HAL_MODULE_ENABLED
+// #define HAL_ADC_MODULE_ENABLED
+// #define HAL_CAN_MODULE_ENABLED
+/*#define HAL_CAN_LEGACY_MODULE_ENABLED*/
+// #define HAL_CEC_MODULE_ENABLED
+// #define HAL_CORTEX_MODULE_ENABLED
+// #define HAL_CRC_MODULE_ENABLED
+// #define HAL_DAC_MODULE_ENABLED
+// #define HAL_DMA_MODULE_ENABLED
+// #define HAL_ETH_MODULE_ENABLED
+// #define HAL_EXTI_MODULE_ENABLED
+// #define HAL_FLASH_MODULE_ENABLED
+// #define HAL_GPIO_MODULE_ENABLED
+// #define HAL_HCD_MODULE_ENABLED
+// #define HAL_I2C_MODULE_ENABLED
+// #define HAL_I2S_MODULE_ENABLED
+// #define HAL_IRDA_MODULE_ENABLED
+// #define HAL_IWDG_MODULE_ENABLED
+// #define HAL_NAND_MODULE_ENABLED
+// #define HAL_NOR_MODULE_ENABLED
+// #define HAL_PCCARD_MODULE_ENABLED
+// #define HAL_PCD_MODULE_ENABLED
+// #define HAL_PWR_MODULE_ENABLED
+// #define HAL_RCC_MODULE_ENABLED
+// #define HAL_RTC_MODULE_ENABLED
+// #define HAL_SD_MODULE_ENABLED
+// #define HAL_SMARTCARD_MODULE_ENABLED
+// #define HAL_SPI_MODULE_ENABLED
+// #define HAL_SRAM_MODULE_ENABLED
+// #define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+// #define HAL_USART_MODULE_ENABLED
+// #define HAL_WWDG_MODULE_ENABLED
+// #define HAL_MMC_MODULE_ENABLED
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _HAL_CONF_CUSTOM_H */
diff --git a/hal/architecture/STM32/drivers/stm32_ADC_internal_channels.h b/hal/architecture/STM32/drivers/stm32_ADC_internal_channels.h
new file mode 100644
index 000000000..fd32c860b
--- /dev/null
+++ b/hal/architecture/STM32/drivers/stm32_ADC_internal_channels.h
@@ -0,0 +1,95 @@
+/*
+Examples:
+
+// the setup routine runs once when you press reset:
+void setup() {
+ // initialize serial communication at 9600 bits per second:
+ Serial.begin(9600);
+ analogReadResolution(ADC_RESOLUTION);
+}
+
+// the loop routine runs over and over again forever:
+void loop() {
+ // print out the value you read:
+ Serial.print("VRef(mv)= ");
+ int32_t VRef = readVref();
+ Serial.print(VRef);
+
+#ifdef ATEMP
+ Serial.print("\tTemp(°C)= ");
+ Serial.print(readTempSensor(VRef));
+#endif
+#ifdef AVBAT
+ Serial.print("\tVbat(mv)= ");
+ Serial.print(readVoltage(VRef, AVBAT));
+#endif
+
+ Serial.print("\tA0(mv)= ");
+ Serial.println(readVoltage(VRef, A0));
+ delay(200);
+}
+*/
+
+#ifndef _STM32_ADC_INTERNAL_CHANNELS_H_
+#define _STM32_ADC_INTERNAL_CHANNELS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "stm32yyxx_ll_adc.h"
+
+/* Values available in datasheet */
+#define CALX_TEMP 25
+#if defined(STM32F1xx)
+#define V25 1430
+#define AVG_SLOPE 4300
+#define VREFINT 1200
+#elif defined(STM32F2xx)
+#define V25 760
+#define AVG_SLOPE 2500
+#define VREFINT 1210
+#endif
+
+/* Analog read resolution */
+#if ADC_RESOLUTION == 10
+#define LL_ADC_RESOLUTION LL_ADC_RESOLUTION_10B
+#define ADC_RANGE 1024
+#else
+#define LL_ADC_RESOLUTION LL_ADC_RESOLUTION_12B
+#define ADC_RANGE 4096
+#endif
+
+static int32_t readVref() {
+#ifdef __LL_ADC_CALC_VREFANALOG_VOLTAGE
+ return (
+ __LL_ADC_CALC_VREFANALOG_VOLTAGE(analogRead(AVREF), LL_ADC_RESOLUTION));
+#else
+ return (VREFINT * ADC_RANGE / analogRead(AVREF)); // ADC sample to mV
+#endif
+}
+
+#ifdef ATEMP
+static int32_t readTempSensor(int32_t VRef) {
+#ifdef __LL_ADC_CALC_TEMPERATURE
+ return (
+ __LL_ADC_CALC_TEMPERATURE(VRef, analogRead(ATEMP), LL_ADC_RESOLUTION));
+#elif defined(__LL_ADC_CALC_TEMPERATURE_TYP_PARAMS)
+ return (__LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(
+ AVG_SLOPE, V25, CALX_TEMP, VRef, analogRead(ATEMP), LL_ADC_RESOLUTION));
+#else
+ return 0;
+#endif
+}
+#endif
+
+static int32_t readVoltage(int32_t VRef, uint32_t pin) {
+ return (
+ __LL_ADC_CALC_DATA_TO_VOLTAGE(VRef, analogRead(pin), LL_ADC_RESOLUTION));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/hal/transport/RF24/driver/RF24.h b/hal/transport/RF24/driver/RF24.h
index b2ed76d9d..b35def6d8 100644
--- a/hal/transport/RF24/driver/RF24.h
+++ b/hal/transport/RF24/driver/RF24.h
@@ -78,6 +78,8 @@
//#define DEFAULT_RF24_CS_PIN (24) //!< DEFAULT_RF24_CS_PIN
#elif defined(ARDUINO_ARCH_STM32F1)
#define DEFAULT_RF24_CE_PIN (PB0) //!< DEFAULT_RF24_CE_PIN
+#elif defined(ARDUINO_ARCH_STM32)
+#define DEFAULT_RF24_CE_PIN (PB0) //!< DEFAULT_RF24_CE_PIN
#elif defined(TEENSYDUINO)
#define DEFAULT_RF24_CE_PIN (9) //!< DEFAULT_RF24_CE_PIN
#else
diff --git a/hal/transport/RFM69/driver/new/RFM69_new.h b/hal/transport/RFM69/driver/new/RFM69_new.h
index 86e11b540..3b10441a2 100644
--- a/hal/transport/RFM69/driver/new/RFM69_new.h
+++ b/hal/transport/RFM69/driver/new/RFM69_new.h
@@ -97,6 +97,8 @@
#define DEFAULT_RFM69_IRQ_PIN (22) //!< DEFAULT_RFM69_IRQ_PIN
#elif defined(ARDUINO_ARCH_STM32F1)
#define DEFAULT_RFM69_IRQ_PIN (PA3) //!< DEFAULT_RFM69_IRQ_PIN
+#elif defined(ARDUINO_ARCH_STM32)
+#define DEFAULT_RFM69_IRQ_PIN (PA3) //!< DEFAULT_RFM69_IRQ_PIN
#elif defined(TEENSYDUINO)
#define DEFAULT_RFM69_IRQ_PIN (8) //!< DEFAULT_RFM69_IRQ_PIN
#else
diff --git a/hal/transport/RFM69/driver/old/RFM69_old.h b/hal/transport/RFM69/driver/old/RFM69_old.h
index 4b3f95245..ef37e88ba 100644
--- a/hal/transport/RFM69/driver/old/RFM69_old.h
+++ b/hal/transport/RFM69/driver/old/RFM69_old.h
@@ -59,6 +59,9 @@
#elif defined(ARDUINO_ARCH_STM32F1)
#define DEFAULT_RFM69_IRQ_PIN (PA3) //!< DEFAULT_RFM69_IRQ_PIN
#define DEFAULT_RFM69_IRQ_NUM DEFAULT_RFM69_IRQ_PIN //!< DEFAULT_RFM69_IRQ_NUM
+#elif defined(ARDUINO_ARCH_STM32)
+#define DEFAULT_RFM69_IRQ_PIN (PA3) //!< DEFAULT_RFM69_IRQ_PIN
+#define DEFAULT_RFM69_IRQ_NUM DEFAULT_RFM69_IRQ_PIN //!< DEFAULT_RFM69_IRQ_NUM
#elif defined(TEENSYDUINO)
#define DEFAULT_RFM69_IRQ_PIN (8) //!< DEFAULT_RFM69_IRQ_PIN
#define DEFAULT_RFM69_IRQ_NUM digitalPinToInterrupt(MY_RFM69_IRQ_PIN) //!< DEFAULT_RFM69_IRQ_NUM
diff --git a/hal/transport/RFM95/driver/RFM95.h b/hal/transport/RFM95/driver/RFM95.h
index f33cf0aec..9961a4adf 100644
--- a/hal/transport/RFM95/driver/RFM95.h
+++ b/hal/transport/RFM95/driver/RFM95.h
@@ -103,6 +103,8 @@
#define DEFAULT_RFM95_IRQ_PIN (22) //!< DEFAULT_RFM95_IRQ_PIN
#elif defined(ARDUINO_ARCH_STM32F1)
#define DEFAULT_RFM95_IRQ_PIN (PA3) //!< DEFAULT_RFM95_IRQ_PIN
+#elif defined(ARDUINO_ARCH_STM32)
+#define DEFAULT_RFM95_IRQ_PIN (PA3) //!< DEFAULT_RFM95_IRQ_PIN
#elif defined(TEENSYDUINO)
#define DEFAULT_RFM95_IRQ_PIN (8) //!< DEFAULT_RFM95_IRQ_PIN
#else