diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 50bf218..8794182 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -18,25 +18,28 @@ jobs:
with:
python-version: '3.10'
- - name: Install ltchiptool
- run: pip install ltchiptool
+ - name: Install docs dependencies
+ run: pip install -U ltchiptool boardgen
- - name: Generate static JSON files
+ - name: Generate docs and static JSON files
run: |
mkdir -p site/
- python docs/build_json.py
+ boardgen ltci
+ python docs/scripts/update_docs.py
+ python docs/scripts/prepare_doxygen.py
+ python docs/scripts/build_json.py
cp *.json site/
- name: Set custom domain
run: |
mkdir -p site/
- echo docs.libretuya.ml > site/CNAME
+ echo docs.libretiny.eu > site/CNAME
- name: Deploy docs
- uses: libretuya/mkdocs-deploy-gh-pages@master
+ uses: libretiny-eu/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: mkdocs.yml
EXTRA_PACKAGES: build-base doxygen
REQUIREMENTS: docs/requirements.txt
- CUSTOM_DOMAIN: docs.libretuya.ml
+ CUSTOM_DOMAIN: docs.libretiny.eu
diff --git a/.gitignore b/.gitignore
index e0759e9..d4c122c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -258,3 +258,9 @@ xml/
ltapi/
hashChanges.yaml
.piopm
+
+# board files
+docs/status/supported_*.md
+docs/status/unsupported_boards_*.md
+boards/**/*.svg
+boards/**/*.md
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 4265a1e..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,2 +0,0 @@
-[submodule "tools/boardgen"]
- url = https://github.com/kuba2k2/boardgen
diff --git a/README.md b/README.md
index 0130107..6a8420b 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,45 @@
-# LibreTuya
+# LibreTiny
-[](https://kuba2k2.github.io/libretuya/)
-
+[](https://kuba2k2.github.io/libretiny/)
+
[](.clang-format)
[](https://github.com/psf/black)
[](https://discord.gg/SyGCB9Xwtf)
-[](https://registry.platformio.org/platforms/kuba2k2/libretuya)
+[](https://registry.platformio.org/platforms/kuba2k2/libretiny)


+## LibreTuya is now LibreTiny! đ
+
+We have [renamed the project](https://github.com/kuba2k2/libretiny/issues/92) to LibreTiny, also marking the very first v1.0.0 release, along with a huge structure refactor. While some care has been taken to ensure that things don't break, you may still need to update some references in your code to use the new name.
+
+---
+
PlatformIO development platform for IoT modules manufactured by Tuya Inc.
The main goal of this project is to provide a usable build environment for IoT developers. While also providing vendor SDKs as PlatformIO cores,
the project focuses on developing working Arduino-compatible cores for supported families. The cores are inspired by Espressif's official core for ESP32,
-which should make it easier to port/run existing ESP apps on Tuya IoT (and 3-rd party) modules.
+which should make it easier to port/run existing ESP apps on less-common, unsupported IoT modules.
-**There's an [ESPHome port](https://docs.libretuya.ml/docs/projects/esphome/) based on LibreTuya, which supports BK7231 and RTL8710B chips.**
+**There's an [ESPHome port](https://docs.libretiny.eu/docs/projects/esphome/) based on LibreTiny, which supports BK7231 and RTL8710B chips.**
**Note:** this project is work-in-progress.
## Usage
1. [Install PlatformIO](https://platformio.org/platformio-ide)
-2. `platformio platform install https://github.com/kuba2k2/libretuya`
+2. `platformio platform install -f https://github.com/kuba2k2/libretiny`
3. Create a project, build it and upload!
-4. See the [docs](https://docs.libretuya.ml/) for any questions/problems.
+4. See the [docs](https://docs.libretiny.eu/) for any questions/problems.
+
## License
diff --git a/SUMMARY.md b/SUMMARY.md
index 7badd4c..fbe2623 100644
--- a/SUMMARY.md
+++ b/SUMMARY.md
@@ -1,58 +1,56 @@
* [Home](README.md)
+* [](SUMMARY.md)
* [đ Getting started](docs/getting-started/README.md)
- * [ESPHome](docs/projects/esphome.md)
-* [đČ Flashing/dumping](docs/flashing/)
-* [đ» Supported boards & chips](docs/status/supported.md)
-* đ Reference
- * Chip families
- * [Beken BK72xx](docs/platform/beken-72xx/README.md)
- * [Realtek Ameba - info](docs/platform/realtek-amb/README.md)
- * [Realtek AmebaZ](docs/platform/realtek-ambz/README.md)
- * [Debugging](docs/platform/realtek-ambz/debugging.md)
- * [Exception decoder](docs/platform/realtek-ambz/exception-decoder.md)
- * C library
- * [Built-in functions](docs/platform/realtek-ambz/stdlib.md)
- * [Memory management](docs/platform/realtek-ambz/memory-management.md)
- * [đ§ LT configuration](docs/reference/config.md)
- * [âïž Implementation status](docs/status/arduino.md)
- * [đ Boards documentation](boards/)
- * [đ Examples](examples/)
- * [đ LibreTuya API](docs/reference/lt-api.md)
- * [LT class reference](ltapi/class_libre_tuya.md)
- * [Common methods](ltapi/_libre_tuya_a_p_i_8h.md)
- * [Wiring custom methods](ltapi/_libre_tuya_custom_8h.md)
- * [Logger](ltapi/lt__logger_8h.md)
- * [Chip & family IDs](ltapi/_chip_type_8h_source.md)
- * [POSIX utilities](ltapi/lt__posix__api_8h.md)
- * đ Common API
- * [FS](ltapi/classfs_1_1_f_s.md)
- * [Preferences](ltapi/class_i_preferences.md)
+ * [âĄïž Info on accessing GPIOs](docs/getting-started/gpio.md)
+* [đĄ ESPHome setup guide](docs/projects/esphome.md)
+* [đČ Flashing/dumping guide](docs/flashing/)
+* [đ How to connect the chip in download mode?](docs/flashing/chip-connection/)
+* [đ» Supported chips](docs/status/supported.md)
+ * [All boards](boards/)
+* [](SUMMARY.md)
+* đȘ Chip family docs & info
+ * [Beken BK72xx](docs/platform/beken-72xx/README.md)
+ * [Realtek Ameba - info](docs/platform/realtek-amb/README.md)
+ * [Realtek AmebaZ](docs/platform/realtek-ambz/README.md)
+ * [Debugging](docs/platform/realtek-ambz/debugging.md)
+ * [Exception decoder](docs/platform/realtek-ambz/exception-decoder.md)
+* [đ§ LT Configuration](docs/dev/config.md)
+* đ§ Programmer's manual
+ * [â ïž Migration guide](docs/dev/migration_v1.0.0.md)
+ * [đ PlatformIO Examples](examples/)
+ * [đ LibreTiny API](docs/dev/lt-api.md)
+ * [C API](ltapi/dir_c7e317b16142bccc961a83c0babf0065.md)
+ * [C++ API](ltapi/dir_930634efd5dc4a957bbb6e685a3ccda1.md)
+ * đ Arduino Libraries
* [SoftwareSerial](ltapi/class_software_serial.md)
- * [WiFi API](ltapi/class_wi_fi_class.md)
- * [TCP Client](ltapi/class_i_wi_fi_client.md)
- * [SSL Client](ltapi/class_i_wi_fi_client_secure.md)
- * [TCP Server](ltapi/class_i_wi_fi_server.md)
- * [đ LibreTuya libraries](docs/libs-built-in.md)
- * [base64](ltapi/classbase64.md)
+ * [WiFi](ltapi/class_wi_fi_class.md)
+ * [](SUMMARY.md)
* [Flash](ltapi/class_flash_class.md)
- * [HTTPClient](ltapi/class_h_t_t_p_client.md)
+ * [IPv6Address](ltapi/classarduino_1_1_i_pv6_address.md)
+ * [MD5](ltapi/libraries_2common_2_m_d5_2_m_d5_8h.md)
* [mDNS](ltapi/classm_d_n_s.md)
- * NetUtils
- * [ssl/MbedTLSClient](ltapi/class_mbed_t_l_s_client.md)
- * [IPv6Address](ltapi/classarduino_1_1_i_pv6_address.md)
- * [LwIPRxBuffer](ltapi/class_lw_i_p_rx_buffer.md)
* [Update](ltapi/class_update_class.md)
+ * [WiFiClient](ltapi/class_i_wi_fi_client.md)
+ * [WiFiClientSecure](ltapi/class_i_wi_fi_client_secure.md)
+ * [WiFiServer](ltapi/class_i_wi_fi_server.md)
+ * [WiFiUDP](ltapi/class_i_wi_fi_u_d_p.md)
+ * [](SUMMARY.md)
+ * [HTTPClient](ltapi/class_h_t_t_p_client.md)
+ * [StreamString](ltapi/class_stream_string.md)
* [WebServer](ltapi/class_web_server.md)
* [WiFiMulti](ltapi/class_wi_fi_multi.md)
- * [Third party libraries](docs/libs-3rd-party.md)
+ * [](SUMMARY.md)
+ * [External compatible libraries](docs/dev/libs-3rd-party.md)
* Full documentation
* [Classes](ltapi/classes.md)
* [Functions](ltapi/functions.md)
* [Macros](ltapi/macros.md)
* [File list](ltapi/files.md)
- * [đ Project structure](docs/reference/project-structure.md)
- * [âïž OTA format](docs/ota/README.md)
- * [uf2ota.py tool](docs/ota/uf2ota.md)
- * [uf2ota.h library](docs/ota/library.md)
- * [đ TODO](TODO.md)
+* đ· Contributor's manual (WIP)
+ * [đ Project structure](docs/dev/project-structure.md)
+ * [âïž OTA format](docs/dev/ota/README.md)
+ * [uf2ota.py tool](docs/dev/ota/uf2ota.md)
+ * [uf2ota.h library](docs/dev/ota/library.md)
+ * [đ TODO](docs/TODO.md)
+* [](SUMMARY.md)
* [đ Resources](docs/resources/)
diff --git a/arduino/beken-72xx/cores/arduino/Arduino.h b/arduino/beken-72xx/cores/arduino/Arduino.h
deleted file mode 100644
index c2df300..0000000
--- a/arduino/beken-72xx/cores/arduino/Arduino.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-14. */
-
-#pragma once
-
-#ifdef __cplusplus
-#include "WCharacterFixup.h"
-#endif
-
-#define delay delayMilliseconds // change delay()'s signature - it's defined as static inline in WVariant.h
-#include
-#include
-#undef delay
-
-// Include family-specific code
-#include "WVariant.h"
-// Include board variant
-#include "variant.h"
-
-// Choose the main UART output port
-#ifndef LT_UART_DEFAULT_PORT
-#if defined(PIN_SERIAL2_TX)
-#define LT_UART_DEFAULT_PORT 2
-#else
-#define LT_UART_DEFAULT_PORT 1
-#endif
-#endif
-
-// Define available serial ports
-#ifdef __cplusplus
-#include "SerialClass.h"
-#include
-#endif
diff --git a/arduino/beken-72xx/cores/arduino/LibreTuyaAPI.cpp b/arduino/beken-72xx/cores/arduino/LibreTuyaAPI.cpp
deleted file mode 100644
index 0c36da2..0000000
--- a/arduino/beken-72xx/cores/arduino/LibreTuyaAPI.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-19. */
-
-#include
-#include
-
-// can't include as it collides with on Windows -_-
-#define REG_FLASH_BASE 0x00803000
-#define REG_FLASH_OPERATE_SW (REG_FLASH_BASE + 0 * 4)
-#define REG_FLASH_RDID (REG_FLASH_BASE + 4 * 4)
-#define FLASH_BUSY_SW (0x01UL << 31)
-#define FLASH_WP_VALUE (0x01UL << 30)
-#define FLASH_OP_SW (0x01UL << 29)
-#define FLASH_OP_TYPE_POS 24
-#define FLASH_OP_RDID 20
-
-extern "C" {
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-extern uint8_t system_mac[];
-extern uint32_t wdt_ctrl(uint32_t cmd, void *param);
-
-} // extern "C"
-
-void LibreTuya::restart() {
- bk_reboot();
-}
-
-void LibreTuya::restartDownloadMode() {
- bk_reboot();
-}
-
-ResetReason LibreTuya::getResetReason() {
- switch (bk_misc_get_start_type()) {
- case RESET_SOURCE_POWERON:
- return RESET_REASON_POWER;
-
- case RESET_SOURCE_REBOOT:
- return RESET_REASON_SOFTWARE;
-
- case RESET_SOURCE_WATCHDOG:
- return RESET_REASON_WATCHDOG;
-
- case RESET_SOURCE_CRASH_XAT0:
- case RESET_SOURCE_CRASH_UNDEFINED:
- case RESET_SOURCE_CRASH_PREFETCH_ABORT:
- case RESET_SOURCE_CRASH_DATA_ABORT:
- case RESET_SOURCE_CRASH_UNUSED:
- case RESET_SOURCE_CRASH_PER_XAT0:
- return RESET_REASON_CRASH;
-
- case RESET_SOURCE_DEEPPS_GPIO:
- case RESET_SOURCE_DEEPPS_RTC:
- return RESET_REASON_SLEEP;
- }
- return RESET_REASON_UNKNOWN;
-}
-
-/* CPU-related */
-
-ChipType LibreTuya::getChipType() {
- uint8_t chipId = *(uint8_t *)(SCTRL_CHIP_ID);
- return CHIP_TYPE_ENUM(FAMILY, chipId);
-}
-
-const char *LibreTuya::getChipModel() {
- return STRINGIFY_MACRO(MCU);
-}
-
-uint32_t LibreTuya::getChipId() {
- uint8_t mac[6];
- cfg_load_mac(mac); // force loading MAC from TLV (ignore user-set WiFi MAC)
- return (mac[3]) | (mac[4] << 8) | (mac[5] << 16);
-}
-
-uint8_t LibreTuya::getChipCores() {
- return 1;
-}
-
-const char *LibreTuya::getChipCoreType() {
- return "ARM968E-S";
-}
-
-uint32_t LibreTuya::getCpuFreq() {
- return configCPU_CLOCK_HZ;
-}
-
-uint32_t LibreTuya::getCycleCount() {
- // TODO
- return 0;
-}
-
-/* Flash memory utilities */
-
-FlashId LibreTuya::getFlashChipId() {
- uint32_t data = (FLASH_OP_RDID << FLASH_OP_TYPE_POS) | FLASH_OP_SW | FLASH_WP_VALUE;
- REG_WRITE(REG_FLASH_OPERATE_SW, data);
- while (REG_READ(REG_FLASH_OPERATE_SW) & FLASH_BUSY_SW) {}
- FlashId id = {
- .manufacturerId = REG_RD8(REG_FLASH_RDID, 2),
- .chipId = REG_RD8(REG_FLASH_RDID, 1),
- .chipSizeId = REG_RD8(REG_FLASH_RDID, 0),
- };
- return id;
-}
-
-/* Memory management */
-
-uint32_t LibreTuya::getRamSize() {
- return 256 * 1024;
-}
-
-uint32_t LibreTuya::getHeapSize() {
-#if configDYNAMIC_HEAP_SIZE
- extern unsigned char _empty_ram;
-#if CFG_SOC_NAME == SOC_BK7231N
- return (0x00400000 + 192 * 1024) - (uint32_t)(&_empty_ram);
-#else
- return (0x00400000 + 256 * 1024) - (uint32_t)(&_empty_ram);
-#endif
-#else
- return configTOTAL_HEAP_SIZE;
-#endif
-}
-
-uint32_t LibreTuya::getFreeHeap() {
- return xPortGetFreeHeapSize();
-}
-
-uint32_t LibreTuya::getMinFreeHeap() {
- return xPortGetMinimumEverFreeHeapSize();
-}
-
-uint32_t LibreTuya::getMaxAllocHeap() {
- return 0;
-}
-
-/* OTA-related */
-
-static int8_t otaImage2Valid = -1;
-
-uint8_t LibreTuya::otaGetRunning() {
- // Beken has bootloader-based OTA, running app is always index 1
- return 1;
-}
-
-uint8_t LibreTuya::otaGetStoredIndex() {
- return otaHasImage2() ? 2 : 1;
-}
-
-bool LibreTuya::otaSupportsDual() {
- return true;
-}
-
-bool LibreTuya::otaHasImage1() {
- return true;
-}
-
-bool LibreTuya::otaHasImage2() {
- if (otaImage2Valid != -1)
- return otaImage2Valid;
- // check download RBL
- // TODO: maybe check header CRC or even binary hashes
- uint32_t magic;
- Flash.readBlock(FLASH_DOWNLOAD_OFFSET, (uint8_t *)&magic, 4);
- otaImage2Valid = magic == 0x004C4252; // "RBL\0", little-endian
- return otaImage2Valid;
-}
-
-bool LibreTuya::otaSwitch(bool force) {
- // no need to check otaGetStoredIndex() as it does the same as otaHasImage2()
-
- // force checking validity again
- otaImage2Valid = -1;
-
- if (otaHasImage2() && force) {
- // "rollback" - abort bootloader upgrade operation by wiping first sector
- return Flash.eraseSector(FLASH_DOWNLOAD_OFFSET);
- }
-
- return otaHasImage2(); // false if second image is not valid
-}
-
-/* Watchdog */
-
-bool LibreTuya::wdtEnable(uint32_t timeout) {
- wdt_ctrl(WCMD_SET_PERIOD, &timeout);
- wdt_ctrl(WCMD_POWER_UP, NULL);
-}
-
-void LibreTuya::wdtDisable() {
- wdt_ctrl(WCMD_POWER_DOWN, NULL);
-}
-
-void LibreTuya::wdtFeed() {
- wdt_ctrl(WCMD_RELOAD_PERIOD, NULL);
-}
-
-/* Global instance */
-
-LibreTuya LT;
-LibreTuya ESP = LT;
diff --git a/arduino/beken-72xx/cores/arduino/WVariant.h b/arduino/beken-72xx/cores/arduino/WVariant.h
deleted file mode 100644
index cbe3777..0000000
--- a/arduino/beken-72xx/cores/arduino/WVariant.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-18. */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "sdk_extern.h"
-#include "sdk_mem.h"
-
-// define an inline delay() which overrides BDK's delay()
-static inline __attribute__((always_inline)) void delay(unsigned long ms) {
- delayMilliseconds(ms);
-}
-
-// from fixups/arch_main.c
-extern unsigned char __bk_rf_is_init;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/arduino/beken-72xx/cores/arduino/sdk_extern.h b/arduino/beken-72xx/cores/arduino/sdk_extern.h
deleted file mode 100644
index 535c87e..0000000
--- a/arduino/beken-72xx/cores/arduino/sdk_extern.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-18. */
-
-#pragma once
-
-// for printf() etc (they are wrapped anyway)
-#include
-
-// most stuff is here
-#include
-// for os_printf
-#include
-// for GPIO names
-#include
-
-// conflict with stl_algobase.h
-#undef min
-#undef max
-
-// include printf() wrapper disable methods
-#include
-
-// make non-SDK code call the proper printf()
-#undef bk_printf
-#undef os_printf
-#undef warning_prf
-#undef fatal_prf
-#define bk_printf printf
-#define os_printf printf
-#define warning_prf printf
-#define fatal_prf printf
diff --git a/arduino/beken-72xx/cores/arduino/sdk_mem.h b/arduino/beken-72xx/cores/arduino/sdk_mem.h
deleted file mode 100644
index e61ab14..0000000
--- a/arduino/beken-72xx/cores/arduino/sdk_mem.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-18. */
-
-#pragma once
-
-#include
-
-// Beken SDK is actually pretty good, in terms of declaring
-// stdlib functions properly! So no need for any #define hell.
-#include
-
-// All the MemMang functions are in stdlib, just wrapped
-// during linking.
-#include
-// for memcpy etc.
-#include
-
-// ...except zalloc, which is apparently not in the stdlib
-#define zalloc os_zalloc
-
-#define LT_HEAP_FUNC xPortGetFreeHeapSize
diff --git a/arduino/beken-72xx/libraries/MD5/MD5Impl.h b/arduino/beken-72xx/libraries/MD5/MD5Impl.h
deleted file mode 100644
index 11d2134..0000000
--- a/arduino/beken-72xx/libraries/MD5/MD5Impl.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-07-11. */
-
-#pragma once
-
-#define LT_MD5_USE_HOSTAPD 1
diff --git a/arduino/beken-72xx/libraries/WiFi/WiFi.h b/arduino/beken-72xx/libraries/WiFi/WiFi.h
deleted file mode 100644
index 8d5fcad..0000000
--- a/arduino/beken-72xx/libraries/WiFi/WiFi.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-26. */
-
-#pragma once
-
-#include
-#include
-
-#include "WiFiClient.h"
-#include "WiFiClientSecure.h"
-#include "WiFiServer.h"
diff --git a/arduino/beken-72xx/libraries/WiFi/WiFiClient.h b/arduino/beken-72xx/libraries/WiFi/WiFiClient.h
deleted file mode 100644
index eb27361..0000000
--- a/arduino/beken-72xx/libraries/WiFi/WiFiClient.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-27. */
-
-#pragma once
-
-#include
-#include
-
-typedef LwIPClient WiFiClient;
diff --git a/arduino/beken-72xx/libraries/WiFi/WiFiClientSecure.h b/arduino/beken-72xx/libraries/WiFi/WiFiClientSecure.h
deleted file mode 100644
index 3addedf..0000000
--- a/arduino/beken-72xx/libraries/WiFi/WiFiClientSecure.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-05-04. */
-
-#pragma once
-
-#include
-#include
-
-typedef MbedTLSClient WiFiClientSecure;
diff --git a/arduino/beken-72xx/libraries/WiFi/WiFiData.h b/arduino/beken-72xx/libraries/WiFi/WiFiData.h
deleted file mode 100644
index b572acb..0000000
--- a/arduino/beken-72xx/libraries/WiFi/WiFiData.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-26. */
-
-#pragma once
-
-#include
-
-extern "C" {
-
-#include
-#include
-#include
-
-} // extern "C"
-
-typedef struct {
- void *configSta;
- void *configAp;
- unsigned long scannedAt;
- SemaphoreHandle_t scanSem;
- void *statusIp;
- void *statusLink;
- rw_evt_type lastStaEvent;
- rw_evt_type lastApEvent;
- bool apEnabled;
-} WiFiData;
diff --git a/arduino/beken-72xx/libraries/WiFi/WiFiServer.h b/arduino/beken-72xx/libraries/WiFi/WiFiServer.h
deleted file mode 100644
index db8df0b..0000000
--- a/arduino/beken-72xx/libraries/WiFi/WiFiServer.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-27. */
-
-#pragma once
-
-#include
-#include
-
-typedef LwIPServer WiFiServer;
diff --git a/arduino/beken-72xx/libraries/WiFi/WiFiUdp.h b/arduino/beken-72xx/libraries/WiFi/WiFiUdp.h
deleted file mode 100644
index 8b60be1..0000000
--- a/arduino/beken-72xx/libraries/WiFi/WiFiUdp.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-09-10. */
-
-#pragma once
-
-#include
-#include
-
-typedef LwIPUDP WiFiUDP;
diff --git a/arduino/libretuya/core/ChipType.h b/arduino/libretuya/core/ChipType.h
deleted file mode 100644
index 7faca88..0000000
--- a/arduino/libretuya/core/ChipType.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-05-28. */
-
-#pragma once
-
-#define CHIP_TYPE(family, chip_id) (((family >> 24) << 8) | chip_id)
-#define CHIP_TYPE_ENUM(family, chip_id) (ChipType) CHIP_TYPE(family, chip_id)
-
-enum ChipFamily {
- // used in UF2 Family ID
- F_RTL8710A = 0x9FFFD543, // Realtek Ameba1
- F_RTL8710B = 0x22E0D6FC, // Realtek AmebaZ (realtek-ambz)
- F_RTL8720C = 0xE08F7564, // Realtek AmebaZ2
- F_RTL8720D = 0x3379CFE2, // Realtek AmebaD
- F_BK7231U = 0x675A40B0, // Beken 7231U/7231T
- F_BK7231N = 0x7B3EF230, // Beken 7231N
- F_BK7251 = 0x6A82CC42, // Beken 7251/7252
- F_BL602 = 0xDE1270B7, // Boufallo 602
- F_XR809 = 0x51E903A8, // Xradiotech 809
- F_NATIVE = 0xDEADBEEF, // Host-native
-};
-
-enum ChipType {
- // Realtek AmebaZ
- // IDs copied from rtl8710b_efuse.h
- RTL8710BL = CHIP_TYPE(F_RTL8710B, 0xE0), // ???
- RTL8710BN = CHIP_TYPE(F_RTL8710B, 0xFF), // CHIPID_8710BN / QFN32
- RTL8710BU = CHIP_TYPE(F_RTL8710B, 0xFE), // CHIPID_8710BU / QFN48
- RTL8710BX = CHIP_TYPE(F_RTL8710B, 0xF6), // found on an actual RTL8710BX
- RTL8710L0 = CHIP_TYPE(F_RTL8710B, 0xFB), // CHIPID_8710BN_L0 / QFN32
- RTL8711BN = CHIP_TYPE(F_RTL8710B, 0xFD), // CHIPID_8711BN / QFN48
- RTL8711BU = CHIP_TYPE(F_RTL8710B, 0xFC), // CHIPID_8711BG / QFN68
- // Beken 72XX
- BK7231T = CHIP_TYPE(F_BK7231U, 0x1A), // *SCTRL_CHIP_ID = 0x7231a
- BK7231N = CHIP_TYPE(F_BK7231N, 0x1C), // *SCTRL_CHIP_ID = 0x7231c
- BL2028N = CHIP_TYPE(F_BK7231N, 0x1C), // *SCTRL_CHIP_ID = 0x7231c
- BK7252 = CHIP_TYPE(F_BK7251, 0x00), // TODO
-};
diff --git a/arduino/libretuya/core/LibreTuyaAPI.cpp b/arduino/libretuya/core/LibreTuyaAPI.cpp
deleted file mode 100644
index 3304f27..0000000
--- a/arduino/libretuya/core/LibreTuyaAPI.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-29. */
-
-#include "LibreTuyaAPI.h"
-
-String ipToString(const IPAddress &ip) {
- char szRet[16];
- sprintf(szRet, "%hhu.%hhu.%hhu.%hhu", ip[0], ip[1], ip[2], ip[3]);
- return String(szRet);
-}
-
-/**
- * @brief Generate random bytes using rand().
- *
- * @param buf destination pointer
- * @param len how many bytes to generate
- */
-extern "C" {
-void lt_rand_bytes(uint8_t *buf, size_t len) {
- int *data = (int *)buf;
- size_t i;
- for (i = 0; len >= sizeof(int); len -= sizeof(int)) {
- data[i++] = rand();
- }
- if (len) {
- int rem = rand();
- unsigned char *pRem = (unsigned char *)&rem;
- memcpy(buf + i * sizeof(int), pRem, len);
- }
-}
-
-#undef putchar
-
-/**
- * @brief Print data pointed to by buf in hexdump-like format (hex+ASCII).
- *
- * @param buf source pointer
- * @param len how many bytes to print
- * @param offset increment printed offset by this value
- * @param width how many bytes on a line
- */
-void hexdump(const uint8_t *buf, size_t len, uint32_t offset, uint8_t width) {
- uint16_t pos = 0;
- while (pos < len) {
- // print hex offset
- printf("%06x ", offset + pos);
- // calculate current line width
- uint8_t lineWidth = min(width, len - pos);
- // print hexadecimal representation
- for (uint8_t i = 0; i < lineWidth; i++) {
- if (i % 8 == 0) {
- printf(" ");
- }
- printf("%02x ", buf[pos + i]);
- }
- // print ascii representation
- printf(" |");
- for (uint8_t i = 0; i < lineWidth; i++) {
- char c = buf[pos + i];
- putchar((c >= 0x20 && c <= 0x7f) ? c : '.');
- }
- puts("|\r");
- pos += lineWidth;
- }
-}
-}
diff --git a/arduino/libretuya/core/LibreTuyaAPI.h b/arduino/libretuya/core/LibreTuyaAPI.h
deleted file mode 100644
index d649368..0000000
--- a/arduino/libretuya/core/LibreTuyaAPI.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-28. */
-
-#pragma once
-
-// C standard libraries
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// C++ standard libraries
-#ifdef __cplusplus
-#include
-#include
-using ::round;
-using std::abs;
-using std::isinf;
-using std::isnan;
-using std::max;
-using std::min;
-#endif
-
-// LibreTuya version macros
-#ifndef LT_VERSION
-#define LT_VERSION 1.0.0
-#endif
-#ifndef LT_BOARD
-#define LT_BOARD unknown
-#endif
-#define STRINGIFY(x) #x
-#define STRINGIFY_MACRO(x) STRINGIFY(x)
-#define LT_VERSION_STR STRINGIFY_MACRO(LT_VERSION)
-#define LT_BOARD_STR STRINGIFY_MACRO(LT_BOARD)
-
-// Includes
-#include "LibreTuyaClass.h" // global LT class
-#include "LibreTuyaCompat.h" // compatibility methods
-#include "LibreTuyaConfig.h" // configuration macros
-#include "LibreTuyaCustom.h" // family-defined methods (Wiring custom)
-#include
-
-// C includes
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-#include "lt_logger.h"
-#include "lt_posix_api.h"
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// Functional macros
-#define LT_BANNER() \
- LT_LOG( \
- LT_LEVEL_INFO, \
- __FUNCTION__, \
- __LINE__, \
- "LibreTuya v" LT_VERSION_STR " on " LT_BOARD_STR ", compiled at " __DATE__ " " __TIME__ \
- )
-
-#ifdef __cplusplus
-String ipToString(const IPAddress &ip);
-
-extern "C" {
-void lt_rand_bytes(uint8_t *buf, size_t len);
-void hexdump(const uint8_t *buf, size_t len, uint32_t offset = 0, uint8_t width = 16);
-}
-
-#else
-
-void lt_rand_bytes(uint8_t *buf, size_t len);
-void hexdump(const uint8_t *buf, size_t len, uint32_t offset, uint8_t width);
-
-#endif
diff --git a/arduino/libretuya/core/LibreTuyaClass.cpp b/arduino/libretuya/core/LibreTuyaClass.cpp
deleted file mode 100644
index 4cf53dd..0000000
--- a/arduino/libretuya/core/LibreTuyaClass.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-06. */
-
-#include "LibreTuyaClass.h"
-
-/**
- * @brief Get LibreTuya version string.
- */
-const char *LibreTuya::getVersion() {
- return LT_VERSION_STR;
-}
-
-/**
- * @brief Get board name.
- */
-const char *LibreTuya::getBoard() {
- return LT_BOARD_STR;
-}
-
-/**
- * @brief Get CPU family ID.
- */
-ChipFamily LibreTuya::getChipFamily() {
- return FAMILY;
-}
-
-/**
- * @brief Get CPU family name as string.
- */
-const char *LibreTuya::getChipFamilyName() {
- return STRINGIFY_MACRO(FAMILY) + 2;
-}
-
-static char *deviceName = NULL;
-
-/**
- * @brief Get device friendly name in format "LT--".
- * Can be used as hostname.
- */
-const char *LibreTuya::getDeviceName() {
- if (deviceName)
- return deviceName;
- uint32_t chipId = getChipId();
- uint8_t *id = (uint8_t *)&chipId;
-
- const char *board = getBoard();
- uint8_t boardLen = strlen(board);
- deviceName = (char *)malloc(3 + boardLen + 1 + 6 + 1);
-
- sprintf(deviceName, "LT-%s-%02x%02x%02x", board, id[0], id[1], id[2]);
- return deviceName;
-}
-
-/**
- * @brief Get a textual representation of a reset reason.
- *
- * @param reason value to convert to text, uses getResetReason() by default
- */
-const char *LibreTuya::getResetReasonName(ResetReason reason) {
- if (reason >= RESET_REASON_MAX)
- reason = getResetReason();
- switch (reason) {
- case RESET_REASON_POWER:
- return "Power-On";
- case RESET_REASON_BROWNOUT:
- return "Brownout";
- case RESET_REASON_HARDWARE:
- return "HW Reboot";
- case RESET_REASON_SOFTWARE:
- return "SW Reboot";
- case RESET_REASON_WATCHDOG:
- return "WDT Reset";
- case RESET_REASON_CRASH:
- return "Crash";
- case RESET_REASON_SLEEP:
- return "Sleep Wakeup";
- }
- return "Unknown";
-}
-
-/**
- * @brief Get CPU frequency in MHz.
- */
-uint32_t LibreTuya::getCpuFreqMHz() {
- return getCpuFreq() / 1000000;
-}
-
-/**
- * @brief Get flash chip total size.
- * The default implementation uses the least significant
- * byte of the chip ID to determine the size.
- */
-__attribute__((weak)) uint32_t LibreTuya::getFlashChipSize() {
- FlashId id = getFlashChipId();
- if (id.chipSizeId >= 0x14 && id.chipSizeId <= 0x19) {
- return (1 << id.chipSizeId);
- }
-#ifdef FLASH_LENGTH
- return FLASH_LENGTH;
-#else
- return 0;
-#endif
-}
-
-/**
- * @brief Get the OTA index for updated firmware.
- *
- * Note: returns 1 for chips without dual-OTA.
- */
-uint8_t LibreTuya::otaGetTarget() {
- if (!otaSupportsDual())
- return 1;
- return otaGetRunning() ^ 0b11;
-}
-
-/**
- * @brief Perform OTA rollback: switch to the previous image, or abort current
- * switched OTA update, if not rebooted yet.
- *
- * @return false if no second image to run, writing failed or dual-OTA not supported
- */
-bool LibreTuya::otaRollback() {
- if (!otaCanRollback())
- return false;
- if (otaGetRunning() != otaGetStoredIndex())
- // force switching back to current image
- return otaSwitch(true);
- return true;
-}
-
-/**
- * @brief Check if OTA rollback is supported and available (there is another image to run).
- * @return false if no second image to run or dual-OTA not supported
- */
-bool LibreTuya::otaCanRollback() {
- if (!otaSupportsDual())
- return false;
- if (otaGetRunning() == otaGetStoredIndex())
- return true;
- if (otaGetRunning() == 1 && otaHasImage1())
- return true;
- if (otaGetRunning() == 2 && otaHasImage2())
- return true;
- return false;
-}
-
-__attribute__((weak)) void LibreTuya::gpioRecover() {
- // nop by default
-}
diff --git a/arduino/libretuya/core/LibreTuyaClass.h b/arduino/libretuya/core/LibreTuyaClass.h
deleted file mode 100644
index be2a42a..0000000
--- a/arduino/libretuya/core/LibreTuyaClass.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-06. */
-
-#pragma once
-
-#ifdef __cplusplus
-
-#include "LibreTuyaAPI.h"
-#include
-
-typedef enum {
- RESET_REASON_UNKNOWN = 0,
- RESET_REASON_POWER = 1,
- RESET_REASON_BROWNOUT = 2,
- RESET_REASON_HARDWARE = 3,
- RESET_REASON_SOFTWARE = 4,
- RESET_REASON_WATCHDOG = 5,
- RESET_REASON_CRASH = 6,
- RESET_REASON_SLEEP = 7,
- RESET_REASON_MAX = 8,
-} ResetReason;
-
-/**
- * @brief Flash chip ID structure.
- */
-typedef struct {
- uint8_t manufacturerId;
- uint8_t chipId;
- uint8_t chipSizeId;
-} FlashId;
-
-/**
- * @brief Main LibreTuya API class.
- *
- * This class contains all functions common amongst all families.
- * Implementations of these methods may vary between families.
- *
- * The class is accessible using the `LT` global object (defined by the family).
- */
-class LibreTuya {
- public: /* Common methods - note: these are documented in LibreTuyaAPI.cpp */
- const char *getVersion();
- const char *getBoard();
- ChipFamily getChipFamily();
- const char *getChipFamilyName();
- const char *getDeviceName();
- const char *getResetReasonName(ResetReason reason = RESET_REASON_MAX);
- uint32_t getCpuFreqMHz();
- uint32_t getFlashChipSize();
- uint8_t otaGetTarget();
- bool otaRollback();
- bool otaCanRollback();
-
- public: /* Compatibility methods */
- /**
- * @brief Alias of getMaxAllocHeap().
- */
- inline uint32_t getMaxFreeBlockSize() {
- return getMaxAllocHeap();
- }
-
- public: /* Family-defined methods */
- /**
- * @brief Reboot the CPU.
- */
- void restart();
- /**
- * @brief Reboot the CPU and stay in download mode (if possible).
- */
- void restartDownloadMode();
- /**
- * @brief Get the reason of last chip reset.
- */
- ResetReason getResetReason();
- /**
- * @brief Reconfigure GPIO pins used for debugging
- * (SWD/JTAG), so that they can be used as normal I/O.
- */
- void gpioRecover();
-
- public: /* CPU-related */
- /**
- * @brief Get CPU model ID.
- */
- ChipType getChipType();
- /**
- * @brief Get CPU model name as string.
- */
- const char *getChipModel();
- /**
- * @brief Get CPU unique ID. This may be based on MAC, eFuse, etc.
- * Note: the number should be 24-bit (with most significant byte being zero).
- */
- uint32_t getChipId();
- /**
- * @brief Get CPU core count.
- */
- uint8_t getChipCores();
- /**
- * @brief Get CPU core type name as string.
- */
- const char *getChipCoreType();
- /**
- * @brief Get CPU frequency in Hz.
- */
- uint32_t getCpuFreq();
- /**
- * @brief Get CPU cycle count.
- */
- uint32_t getCycleCount();
-
- public: /* Flash memory utilities */
- /**
- * @brief Read flash chip ID and return a FlashId struct.
- */
- FlashId getFlashChipId();
-
- public: /* Memory management */
- /**
- * @brief Get total RAM size.
- */
- uint32_t getRamSize();
- /**
- * @brief Get total heap size.
- */
- uint32_t getHeapSize();
- /**
- * @brief Get free heap size.
- */
- uint32_t getFreeHeap();
- /**
- * @brief Get lowest level of free heap memory.
- */
- uint32_t getMinFreeHeap();
- /**
- * @brief Get largest block of heap that can be allocated at once.
- */
- uint32_t getMaxAllocHeap();
-
- public: /* OTA-related */
- /**
- * @brief Get the currently running firmware OTA index.
- */
- uint8_t otaGetRunning();
- /**
- * @brief Read the currently active OTA index, i.e. the one that will boot upon restart.
- */
- uint8_t otaGetStoredIndex();
- /**
- * @brief Check if the chip supports dual-OTA (i.e. OTA is flashed to a different partition).
- *
- * TODO: make this work for actual dual-OTA chips; remove checking this in otaGetTarget() etc.
- */
- bool otaSupportsDual();
- /**
- * @brief Check if OTA1 image is valid.
- */
- bool otaHasImage1();
- /**
- * @brief Check if OTA2 image is valid.
- */
- bool otaHasImage2();
- /**
- * @brief Try to switch OTA index to the other image.
- *
- * Note: should return true for chips without dual-OTA. Should return false if one of two images is not valid.
- *
- * @param force switch even if other image already marked as active
- * @return false if writing failed; true otherwise
- */
- bool otaSwitch(bool force = false);
-
- public: /* Watchdog */
- /**
- * @brief Enable the hardware watchdog.
- *
- * @param timeout watchdog timeout, milliseconds (defaults to 10s)
- * @return whether the chip has a hardware watchdog
- */
- bool wdtEnable(uint32_t timeout = 10000);
- /**
- * @brief Disable the hardware watchdog.
- */
- void wdtDisable();
- /**
- * @brief Feed/reset the hardware watchdog timer.
- */
- void wdtFeed();
-};
-
-extern LibreTuya LT;
-extern LibreTuya ESP;
-
-#endif
diff --git a/arduino/libretuya/core/LibreTuyaCompat.cpp b/arduino/libretuya/core/LibreTuyaCompat.cpp
deleted file mode 100644
index 203f390..0000000
--- a/arduino/libretuya/core/LibreTuyaCompat.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-04. */
-
-#include "LibreTuyaCompat.h"
-
-#if LT_HAS_FREERTOS
-BaseType_t xTaskCreateUniversal(
- TaskFunction_t pxTaskCode,
- const char *const pcName,
- const uint32_t usStackDepth,
- void *const pvParameters,
- UBaseType_t uxPriority,
- TaskHandle_t *const pxCreatedTask,
- const BaseType_t xCoreID
-) {
- // #ifndef CONFIG_FREERTOS_UNICORE
- // if (xCoreID >= 0 && xCoreID < 2) {
- // return xTaskCreatePinnedToCore(
- // pxTaskCode,
- // pcName,
- // usStackDepth,
- // pvParameters,
- // uxPriority,
- // pxCreatedTask,
- // xCoreID
- // );
- // } else {
- // #endif
- return xTaskCreate(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask);
- // #ifndef CONFIG_FREERTOS_UNICORE
- // }
- // #endif
-}
-#endif
diff --git a/arduino/libretuya/core/SerialExtern.h b/arduino/libretuya/core/SerialExtern.h
deleted file mode 100644
index e404333..0000000
--- a/arduino/libretuya/core/SerialExtern.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-07-04. */
-
-#pragma once
-
-#include
-
-#ifdef HAS_SERIAL_CLASS // failsafe for circular inclusion
-
-#ifdef PIN_SERIAL0_TX
-extern SerialClass Serial0;
-#endif
-
-#ifdef PIN_SERIAL1_TX
-extern SerialClass Serial1;
-#endif
-
-#ifdef PIN_SERIAL2_TX
-extern SerialClass Serial2;
-#endif
-
-#define SerialN(x) Serial##x
-#define SerialM(x) SerialN(x)
-#define Serial SerialM(LT_UART_DEFAULT_SERIAL)
-
-#endif
diff --git a/arduino/libretuya/core/main.cpp b/arduino/libretuya/core/main.cpp
deleted file mode 100644
index bbad290..0000000
--- a/arduino/libretuya/core/main.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-19. */
-
-#include
-#include
-
-using namespace arduino;
-
-extern "C" {
-#include
-fal_partition_t fal_root_part = NULL;
-}
-
-// Arduino framework initialization.
-// May be redefined by family files.
-void initArduino() __attribute__((weak));
-
-// Weak empty variant initialization function.
-// May be redefined by variant files.
-void initVariant() __attribute__((weak));
-
-// Initialize C library
-extern "C" void __libc_init_array(void);
-
-void mainTask(const void *arg) {
- setup();
-
- for (;;) {
- loop();
- if (serialEventRun)
- serialEventRun();
- yield();
- }
-}
-
-static unsigned long periodicTasks[] = {0, 0};
-
-void runPeriodicTasks() {
-#if LT_LOG_HEAP
- if (millis() - periodicTasks[0] > 1000) {
- LT_HEAP_I();
- periodicTasks[0] = millis();
- }
-#endif
-#if LT_USE_TIME
- if (millis() - periodicTasks[1] > 10000) {
- gettimeofday(NULL, NULL);
- periodicTasks[1] = millis();
- }
-#endif
-}
-
-int main(void) {
- // print a startup banner
- LT_BANNER();
- // initialize C library
- __libc_init_array();
- // inform about the reset reason
- LT_I("Reset reason: %u", LT.getResetReason());
- // initialize Arduino framework
- initArduino();
- // optionally initialize per-variant code
- initVariant();
- // initialize FAL
- fal_init();
- // provide root partition
- fal_root_part = (fal_partition_t)fal_partition_find("root");
- // start the main task and OS kernel
- if (!startMainTask()) {
- LT_F("Couldn't start the main task");
- }
-
- while (1) {}
- return 0;
-}
diff --git a/arduino/libretuya/libraries/Flash/Flash.cpp b/arduino/libretuya/libraries/Flash/Flash.cpp
deleted file mode 100644
index f3dc2f9..0000000
--- a/arduino/libretuya/libraries/Flash/Flash.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-24. */
-
-#include "Flash.h"
-
-extern "C" {
-#include
-}
-
-// Global Flash object.
-FlashClass Flash;
-
-FlashId FlashClass::getChipId() {
- return LT.getFlashChipId();
-}
-
-uint32_t FlashClass::getSize() {
- return LT.getFlashChipSize();
-}
-
-bool FlashClass::eraseSector(uint32_t offset) {
- return fal_partition_erase(fal_root_part, offset, 1) >= 0;
-}
-
-bool FlashClass::readBlock(uint32_t offset, uint8_t *data, size_t size) {
- return fal_partition_read(fal_root_part, offset, data, size) >= 0;
-}
-
-bool FlashClass::writeBlock(uint32_t offset, uint8_t *data, size_t size) {
- return fal_partition_write(fal_root_part, offset, data, size) >= 0;
-}
diff --git a/arduino/libretuya/libraries/Flash/Flash.h b/arduino/libretuya/libraries/Flash/Flash.h
deleted file mode 100644
index 7e23a02..0000000
--- a/arduino/libretuya/libraries/Flash/Flash.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-24. */
-
-#pragma once
-
-#include
-
-class FlashClass {
- public:
- FlashId getChipId();
- uint32_t getSize();
-
- bool eraseSector(uint32_t offset);
- bool readBlock(uint32_t offset, uint8_t *data, size_t size);
- bool writeBlock(uint32_t offset, uint8_t *data, size_t size);
-};
-
-extern FlashClass Flash;
diff --git a/arduino/libretuya/libraries/HTTPClient/strptime.h b/arduino/libretuya/libraries/HTTPClient/strptime.h
deleted file mode 100644
index 62b9b56..0000000
--- a/arduino/libretuya/libraries/HTTPClient/strptime.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-29. */
-
-#pragma once
-
-#include
-
-extern char *strptime(const char *buf, const char *fmt, struct tm *tm);
diff --git a/arduino/libretuya/libraries/MD5/MD5MbedTLSImpl.cpp b/arduino/libretuya/libraries/MD5/MD5MbedTLSImpl.cpp
deleted file mode 100644
index 2db16c0..0000000
--- a/arduino/libretuya/libraries/MD5/MD5MbedTLSImpl.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-07-11. */
-
-#if LT_ARD_HAS_MD5
-
-#include "MD5.h"
-
-#if LT_MD5_USE_MBEDTLS
-
-extern "C" {
-
-void MD5Init(LT_MD5_CTX_T *context) {
- mbedtls_md5_init(context);
- mbedtls_md5_starts(context);
-}
-
-void MD5Update(LT_MD5_CTX_T *context, const unsigned char *buf, unsigned len) {
- mbedtls_md5_update(context, buf, len);
-}
-
-void MD5Final(unsigned char digest[16], LT_MD5_CTX_T *context) {
- mbedtls_md5_finish(context, digest);
-}
-
-} // extern "C"
-
-#endif // LT_MD5_USE_MBEDTLS
-
-#endif // LT_ARD_HAS_MD5
diff --git a/arduino/libretuya/libraries/MD5/MD5MbedTLSImpl.h b/arduino/libretuya/libraries/MD5/MD5MbedTLSImpl.h
deleted file mode 100644
index 68fcd48..0000000
--- a/arduino/libretuya/libraries/MD5/MD5MbedTLSImpl.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-07-11. */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#define LT_MD5_CTX_T mbedtls_md5_context
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/arduino/libretuya/libraries/MD5/MD5PolarSSLImpl.cpp b/arduino/libretuya/libraries/MD5/MD5PolarSSLImpl.cpp
deleted file mode 100644
index b7265d5..0000000
--- a/arduino/libretuya/libraries/MD5/MD5PolarSSLImpl.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-03. */
-
-#if LT_ARD_HAS_MD5
-
-#include "MD5.h"
-
-#if LT_MD5_USE_POLARSSL
-
-extern "C" {
-
-void MD5Init(LT_MD5_CTX_T *context) {
- md5_init(context);
- md5_starts(context);
-}
-
-void MD5Update(LT_MD5_CTX_T *context, const unsigned char *buf, unsigned len) {
- md5_update(context, buf, len);
-}
-
-void MD5Final(unsigned char digest[16], LT_MD5_CTX_T *context) {
- md5_finish(context, digest);
-}
-
-} // extern "C"
-
-#endif // LT_MD5_USE_POLARSSL
-
-#endif // LT_ARD_HAS_MD5
diff --git a/arduino/libretuya/libraries/MD5/MD5PolarSSLImpl.h b/arduino/libretuya/libraries/MD5/MD5PolarSSLImpl.h
deleted file mode 100644
index 778d526..0000000
--- a/arduino/libretuya/libraries/MD5/MD5PolarSSLImpl.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-03. */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#define LT_MD5_CTX_T md5_context
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/arduino/realtek-ambz/cores/arduino/Arduino.h b/arduino/realtek-ambz/cores/arduino/Arduino.h
deleted file mode 100644
index 093f7f9..0000000
--- a/arduino/realtek-ambz/cores/arduino/Arduino.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-23. */
-
-#pragma once
-
-#ifdef __cplusplus
-#include "WCharacterFixup.h"
-#endif
-
-#define PinMode PinModeArduino // this conflicts with SDK enum
-#include
-#include
-#undef PinMode
-
-// Include family-specific code
-#include "WVariant.h"
-// Include board variant
-#include "variant.h"
-
-// Choose the main UART output port
-#ifndef LT_UART_DEFAULT_PORT
-#if defined(PIN_SERIAL2_TX)
-#define LT_UART_DEFAULT_PORT 2
-#elif defined(PIN_SERIAL0_TX)
-#define LT_UART_DEFAULT_PORT 0
-#else
-#define LT_UART_DEFAULT_PORT 1
-#endif
-#endif
-
-// Define available serial ports
-#ifdef __cplusplus
-#include "SerialClass.h"
-#include
-#endif
diff --git a/arduino/realtek-ambz/cores/arduino/LibreTuyaAPI.cpp b/arduino/realtek-ambz/cores/arduino/LibreTuyaAPI.cpp
deleted file mode 100644
index c3703d2..0000000
--- a/arduino/realtek-ambz/cores/arduino/LibreTuyaAPI.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-05-28. */
-
-#include
-
-#include
-
-extern "C" {
-#include
-#include
-#include
-#include
-}
-
-void LibreTuya::restart() {
- // The Watchdog Way
- wdtEnable(1L);
- while (1) {}
-}
-
-void LibreTuya::restartDownloadMode() {
- // mww 0x40000138 0x8
- HAL_WRITE32(SYSTEM_CTRL_BASE, REG_SYS_NORESET_FF, 0x08);
- // reboot it the ugly way
- sys_reset();
- while (1) {}
-}
-
-ResetReason LibreTuya::getResetReason() {
- return RESET_REASON_UNKNOWN;
-}
-
-void LibreTuya::gpioRecover() {
- // PA14 and PA15 are apparently unusable with SWD enabled
- sys_jtag_off();
- Pinmux_Config(PA_14, PINMUX_FUNCTION_GPIO);
- Pinmux_Config(PA_15, PINMUX_FUNCTION_GPIO);
-}
-
-/* CPU-related */
-
-ChipType LibreTuya::getChipType() {
- uint8_t chipId;
- EFUSE_OneByteReadROM(9902, 0xF8, &chipId, L25EOUTVOLTAGE);
- return CHIP_TYPE_ENUM(FAMILY, chipId);
-}
-
-const char *LibreTuya::getChipModel() {
- return STRINGIFY_MACRO(MCU);
-}
-
-uint32_t LibreTuya::getChipId() {
- uint32_t chipId = 0;
- uint8_t *id = (uint8_t *)&chipId;
- // 9902 was extracted from ROM disassembly, probably not needed
- /* EFUSE_OneByteReadROM(9902, 0x3B, id + 0, L25EOUTVOLTAGE);
- EFUSE_OneByteReadROM(9902, 0x3C, id + 1, L25EOUTVOLTAGE);
- EFUSE_OneByteReadROM(9902, 0x3D, id + 2, L25EOUTVOLTAGE); */
- // new method, based on EFUSE logical map
- uint8_t *efuse = (uint8_t *)malloc(512);
- // TODO do what EFUSE_LogicalMapRead() does, and read only the used data
- EFUSE_LogicalMap_Read(efuse);
- memcpy(id, efuse + 0x11A + 3, 3);
- free(efuse);
- return chipId;
-}
-
-uint8_t LibreTuya::getChipCores() {
- return 1;
-}
-
-const char *LibreTuya::getChipCoreType() {
- return "ARM Cortex-M4F";
-}
-
-uint32_t LibreTuya::getCpuFreq() {
- return CPU_ClkGet(false);
-}
-
-uint32_t LibreTuya::getCycleCount() {
- return microsecondsToClockCycles(micros());
-}
-
-/* Flash memory utilities */
-
-FlashId LibreTuya::getFlashChipId() {
- FlashId id;
- uint8_t idBytes[3];
- flash_read_id(NULL, idBytes, 3);
- id.manufacturerId = idBytes[0];
- id.chipId = idBytes[1];
- id.chipSizeId = idBytes[2];
- return id;
-}
-
-/* Memory management */
-
-uint32_t LibreTuya::getRamSize() {
- return 256 * 1024;
-}
-
-uint32_t LibreTuya::getHeapSize() {
- return configTOTAL_HEAP_SIZE;
-}
-
-uint32_t LibreTuya::getFreeHeap() {
- return xPortGetFreeHeapSize();
-}
-
-uint32_t LibreTuya::getMinFreeHeap() {
- return xPortGetMinimumEverFreeHeapSize();
-}
-
-uint32_t LibreTuya::getMaxAllocHeap() {
- return 0;
-}
-
-/* OTA-related */
-
-uint8_t LibreTuya::otaGetRunning() {
- // RTL8710B is XIP, so check the code offset in flash
- uint32_t addr = (uint32_t)lt_log;
- uint32_t offs = addr - SPI_FLASH_BASE;
- return offs > FLASH_OTA2_OFFSET ? 2 : 1;
-}
-
-uint8_t LibreTuya::otaGetStoredIndex() {
- uint32_t *otaAddress = (uint32_t *)0x8009000;
- if (*otaAddress == 0xFFFFFFFF)
- return 1;
- uint32_t otaCounter = *((uint32_t *)0x8009004);
- // even count of zero-bits means OTA1, odd count means OTA2
- // this allows to switch OTA images by simply clearing next bits,
- // without needing to erase the flash
- uint8_t count = 0;
- for (uint8_t i = 0; i < 32; i++) {
- if ((otaCounter & (1 << i)) == 0)
- count++;
- }
- return 1 + (count % 2);
-}
-
-bool LibreTuya::otaSupportsDual() {
- return true;
-}
-
-bool LibreTuya::otaHasImage1() {
- uint8_t *ota1Addr = (uint8_t *)(SPI_FLASH_BASE + FLASH_OTA1_OFFSET);
- return memcmp(ota1Addr, "81958711", 8) == 0;
-}
-
-bool LibreTuya::otaHasImage2() {
- uint8_t *ota2Addr = (uint8_t *)(SPI_FLASH_BASE + FLASH_OTA2_OFFSET);
- return memcmp(ota2Addr, "81958711", 8) == 0;
-}
-
-bool LibreTuya::otaSwitch(bool force) {
- if (!force && otaGetRunning() != otaGetStoredIndex())
- // OTA has already been switched
- return true;
- // - read current OTA switch value from 0x9004
- // - reset OTA switch to 0xFFFFFFFE if it's 0x0
- // - else check first non-zero bit of OTA switch
- // - write OTA switch with first non-zero bit cleared
-
- if (!otaHasImage1() || !otaHasImage2())
- return false;
-
- uint32_t value = HAL_READ32(SPI_FLASH_BASE, FLASH_SYSTEM_OFFSET + 4);
- if (value == 0) {
- uint8_t *system = (uint8_t *)malloc(64);
- Flash.readBlock(FLASH_SYSTEM_OFFSET, system, 64);
- // reset OTA switch
- ((uint32_t *)system)[1] = -2;
- Flash.eraseSector(FLASH_SYSTEM_OFFSET);
- return Flash.writeBlock(FLASH_SYSTEM_OFFSET, system, 64);
- }
-
- uint8_t i;
- // find first non-zero bit
- for (i = 0; i < 32; i++) {
- if (value & (1 << i))
- break;
- }
- // clear the bit
- value &= ~(1 << i);
- // write OTA switch to flash
- flash_write_word(NULL, FLASH_SYSTEM_OFFSET + 4, value);
- return true;
-}
-
-/* Watchdog */
-
-bool LibreTuya::wdtEnable(uint32_t timeout) {
- watchdog_init(timeout);
- watchdog_start();
-}
-
-void LibreTuya::wdtDisable() {
- watchdog_stop();
-}
-
-void LibreTuya::wdtFeed() {
- watchdog_refresh();
-}
-
-/* Global instance */
-
-LibreTuya LT;
-LibreTuya ESP = LT;
diff --git a/arduino/realtek-ambz/cores/arduino/WVariant.h b/arduino/realtek-ambz/cores/arduino/WVariant.h
deleted file mode 100644
index 71902f3..0000000
--- a/arduino/realtek-ambz/cores/arduino/WVariant.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "sdk_extern.h"
-#include "sdk_mem.h"
-#include "sdk_os.h"
-
-#define DEFAULT 1
-#define EXTERNAL 0
-
-#define round(x) ((x) >= 0 ? (long)((x) + 0.5) : (long)((x)-0.5))
-
-// Additional Wiring functions
-extern uint32_t digitalPinToPort(uint32_t pinNumber);
-extern uint32_t digitalPinToBitMask(uint32_t pinNumber);
-extern void analogOutputInit(void);
-extern void wait_for_debug();
-
-#ifdef __cplusplus
-extern "C" uint32_t SystemCoreClock;
-#else
-extern uint32_t SystemCoreClock;
-#endif
-#define clockCyclesPerMicrosecond() (SystemCoreClock / 1000000L)
-#define clockCyclesToMicroseconds(a) (a * 1000L / (SystemCoreClock / 1000L))
-#define microsecondsToClockCycles(a) (a * (SystemCoreClock / 1000000L))
-
-#define interrupts() vPortClearInterruptMask(0)
-#define noInterrupts() ulPortSetInterruptMask()
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/arduino/realtek-ambz/cores/arduino/sdk_mem.c b/arduino/realtek-ambz/cores/arduino/sdk_mem.c
deleted file mode 100644
index a91b8c4..0000000
--- a/arduino/realtek-ambz/cores/arduino/sdk_mem.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-05-06. */
-
-#include "sdk_mem.h"
-
-#include // for memset
-
-void *pvPortZalloc(size_t size) {
- void *pvReturn = pvPortMalloc(size);
- if (pvReturn)
- memset(pvReturn, 0, size);
- return pvReturn;
-}
-
-void *pvPortCalloc(size_t nmemb, size_t size) {
- return pvPortZalloc(nmemb * size);
-}
diff --git a/arduino/realtek-ambz/cores/arduino/sdk_mem.h b/arduino/realtek-ambz/cores/arduino/sdk_mem.h
deleted file mode 100644
index a242d4a..0000000
--- a/arduino/realtek-ambz/cores/arduino/sdk_mem.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-05-06. */
-
-#pragma once
-
-#include
-
-// provide extern functions directly, as callers
-// generally don't expect needing to include malloc()
-extern void *pvPortMalloc(size_t xWantedSize);
-extern void *pvPortZalloc(size_t size);
-extern void *pvPortCalloc(size_t nmemb, size_t size);
-extern void *pvPortReAlloc(void *pv, size_t xWantedSize);
-extern void vPortFree(void *pv);
-
-#define malloc pvPortMalloc
-#define zalloc pvPortZalloc
-#define calloc pvPortCalloc
-#define realloc pvPortReAlloc
-#define free vPortFree
-
-#define LT_HEAP_FUNC xPortGetFreeHeapSize
diff --git a/arduino/realtek-ambz/cores/arduino/sdk_os.c b/arduino/realtek-ambz/cores/arduino/sdk_os.c
deleted file mode 100644
index 801ecdf..0000000
--- a/arduino/realtek-ambz/cores/arduino/sdk_os.c
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "sdk_os.h"
-
-#include
-#include
-
-uint32_t os_thread_create(void (*task)(const void *argument), void *argument, int priority, uint32_t stack_size) {
-
- osThreadDef_t thread_def;
-
- thread_def.pthread = task;
- thread_def.tpriority = (osPriority)priority;
- // the underlying freertos implementation on cmsis os divide stack size by 4
- thread_def.stacksize = stack_size * 4;
- thread_def.name = "ARDUINO";
-
- return (uint32_t)osThreadCreate(&thread_def, argument);
-}
-
-uint32_t os_thread_get_id(void) {
- return osThreadGetId();
-}
-
-uint32_t os_thread_terminate(uint32_t thread_id) {
- return (uint32_t)osThreadTerminate(thread_id);
-}
-
-uint32_t os_thread_yield(void) {
- return (uint32_t)osThreadYield();
-}
-
-uint32_t os_thread_set_priority(uint32_t thread_id, int priority) {
- return (uint32_t)osThreadSetPriority(thread_id, (osPriority)priority);
-}
-
-int os_thread_get_priority(uint32_t thread_id) {
- return (int)osThreadGetPriority(thread_id);
-}
-
-int32_t os_signal_set(uint32_t thread_id, int32_t signals) {
- return osSignalSet(thread_id, signals);
-}
-
-int32_t os_signal_clear(uint32_t thread_id, int32_t signals) {
- return osSignalClear(thread_id, signals);
-}
-
-os_event_t os_signal_wait(int32_t signals, uint32_t millisec) {
-
- osEvent evt;
- os_event_t ret;
-
- evt = osSignalWait(signals, millisec);
- ret.status = (uint32_t)evt.status;
- ret.value.signals = evt.value.signals;
- ret.def.message_id = evt.def.message_id;
-
- return ret;
-}
-
-typedef void (*os_ptimer)(const void *argument);
-
-uint32_t os_timer_create(void (*callback)(const void *argument), uint8_t isPeriodic, void *argument) {
-
- osTimerDef_t *pTimerDef;
-
- pTimerDef = (osTimerDef_t *)malloc(sizeof(osTimerDef_t));
- pTimerDef->ptimer = callback;
- pTimerDef->custom = (struct os_timer_custom *)malloc(sizeof(struct os_timer_custom));
-
- return osTimerCreate(pTimerDef, (isPeriodic ? osTimerPeriodic : osTimerOnce), argument);
-}
-
-uint32_t os_timer_start(uint32_t timer_id, uint32_t millisec) {
- return osTimerStart(timer_id, millisec);
-}
-
-uint32_t os_timer_stop(uint32_t timer_id) {
- return osTimerStop(timer_id);
-}
-
-uint32_t os_timer_delete(uint32_t timer_id) {
-
- osTimerDef_t *pTimerDef;
-
- pTimerDef = (osTimerDef_t *)pvTimerGetTimerID(timer_id);
- free(pTimerDef->custom);
- free(pTimerDef);
-
- return osTimerDelete(timer_id);
-}
-
-uint32_t os_semaphore_create(int32_t count) {
- return (uint32_t)osSemaphoreCreate(NULL, count);
-}
-
-int32_t os_semaphore_wait(uint32_t semaphore_id, uint32_t millisec) {
- if (osSemaphoreWait((osSemaphoreId)semaphore_id, millisec) == 0) {
- return 1;
- } else {
- return 0;
- }
-}
-
-uint32_t os_semaphore_release(uint32_t semaphore_id) {
- return (uint32_t)osSemaphoreRelease((osSemaphoreId)semaphore_id);
-}
-
-uint32_t os_semaphore_delete(uint32_t semaphore_id) {
- return (uint32_t)osSemaphoreDelete((osSemaphoreId)semaphore_id);
-}
diff --git a/arduino/realtek-ambz/cores/arduino/sdk_os.h b/arduino/realtek-ambz/cores/arduino/sdk_os.h
deleted file mode 100644
index c3483d9..0000000
--- a/arduino/realtek-ambz/cores/arduino/sdk_os.h
+++ /dev/null
@@ -1,302 +0,0 @@
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-
-/**
- * @defgroup os_status os_status
- * Redefinition from enum osStatus
- * @{
- */
-/** function completed; no error or event occurred. */
-#define OS_OK 0x00
-/** function completed; signal event occurred. */
-#define OS_EVENT_SIGNAL 0x08
-/** function completed; message event occurred. */
-#define OS_EVENT_MESSAGE 0x10
-/** function completed; mail event occurred. */
-#define OS_EVENT_MAIL 0x20
-/** function completed; timeout occurred. */
-#define OS_EVENT_TIMEOUT 0x40
-/** parameter error: a mandatory parameter was missing or specified an incorrect object. */
-#define OS_ERROR_PARAMETER 0x80
-/** resource not available: a specified resource was not available. */
-#define OS_ERROR_RESOURCE 0x81
-/** resource not available within given time: a specified resource was not available within the timeout period. */
-#define OS_ERROR_TIMEOUT_RESOURCE 0xC1
-/** not allowed in ISR context: the function cannot be called from interrupt service routines. */
-#define OS_ERROR_ISR 0x82
-/** function called multiple times from ISR with same object. */
-#define OS_ERROR_ISR_RECURSIVE 0x83
-/** system cannot determine priority or thread has illegal priority. */
-#define OS_ERROR_PRIORITY 0x84
-/** system is out of memory: it was impossible to allocate or reserve memory for the operation. */
-#define OS_ERROR_NO_MEMORY 0x85
-/** value of a parameter is out of range. */
-#define OS_ERROR_VALUE 0x86
-/** unspecified RTOS error: run-time error but no other error message fits. */
-#define OS_ERROR_OS 0xFF
-/** @} */ // end of group os_status
-
-/**
- * @defgroup os_priority os_priority
- * Redefinition from enum osPriority
- * @{
- */
-/** priority: idle (lowest) */
-#define OS_PRIORITY_IDLE (-3)
-/** priority: low */
-#define OS_PRIORITY_LOW (-2)
-/** priority: below normal */
-#define OS_PRIORITY_BELOW_NORMAL (-1)
-/** priority: normal (default) */
-#define OS_PRIORITY_NORMAL (0)
-/** priority: above normal */
-#define OS_PRIORITY_ABOVENORMAL (+1)
-/** priority: high */
-#define OS_PRIORITY_HIGH (+2)
-/** priority: realtime (highest) */
-#define OS_PRIORITY_REALTIME (+3)
-/** @} */ // end of group os_priority
-
-#ifndef DEFAULT_STACK_SIZE
-/**
- * @ingroup wiring_os
- * @brief default stack size
- *
- * It is suggest that thread is assigned stack size more than DEFAULT_STACK_SIZE
- */
-#define DEFAULT_STACK_SIZE 512
-#endif
-
-/**
- * @ingroup wiring_os
- * @struct os_event_t
- * Redefine osEvent in cmsis_os.h
- */
-typedef struct {
- uint32_t status; ///< status code: event or error information
-
- union {
- uint32_t v; ///< message as 32-bit value
- void *p; ///< message or mail as void pointer
- int32_t signals; ///< signal flags
- } value; ///< event value
-
- union {
- void *mail_id; ///< mail id obtained by osMailCreate
- void *message_id; ///< message id obtained by osMessageCreate
- } def; ///< event definition
-} os_event_t;
-
-/**
- * @defgroup thread_management thread_management
- * Thread management include create, get thread id, terminate, yield, and set/get priority
- **/
-
-/**
- * @ingroup thread_management
- * @brief Create a thread and add it to Active Threads and set it to state READY.
- *
- * @param[in] task Function pointer which is the thread body. It should not run into the end of function unless
- * os_thread_terminate is invoked
- * @param[in] argument the data pointer which brings to task
- * @param[in] priority The underlying os is FreeRTOS. It executes tasks with highest priority which are not in idle
- * state.\n If there are more than 2 tasks to be executed, then they share the time slice.
- * @param[in] stack_size The stack_size is used as memory heap only for this task. \n
- * The local variables and call stacks would occupy this heap. Please make sure the the stack_size is big enough to
- * avoid curroption
- * @return The thread id which is used in thread operation and signaling.
- */
-extern uint32_t os_thread_create(void (*task)(const void *argument), void *argument, int priority, uint32_t stack_size);
-
-/**
- * @ingroup thread_management
- * @brief Return the thread ID of the current running thread.
- *
- * @return Current thread id which calls os_thread_get_id
- */
-extern uint32_t os_thread_get_id(void);
-
-/**
- * @ingroup thread_management
- * @brief Terminate execution of a thread and remove it from Active Threads.
- *
- * Thread should not ended without terminate first
- *
- * @param[in] thread_id Terminate the thread with specific thread_id
- * @return os_status code
- */
-extern uint32_t os_thread_terminate(uint32_t thread_id);
-
-/**
- * @ingroup thread_management
- * @brief Pass control to next thread that is in state \b READY.
- *
- * By default the minimal execution unit is 1 millisecond. In a scenario that if a thread with smaller want to handout
- * execution right to a thread with higher priority immediately without waiting for the ending of current 1 millisecond,
- * then invoke os_thread_yield can transfer exection right to OS's idle task and check which is the next execution
- * thread.
- *
- * @return os_status code
- */
-extern uint32_t os_thread_yield(void);
-
-/**
- * @ingroup thread_management
- * @brief Change priority of an active thread.
- *
- * @param[in] thread_id The target thread with the thread id to be changed
- * @param[in] priority The updated priority
- * @return os_status code
- */
-extern uint32_t os_thread_set_priority(uint32_t thread_id, int priority);
-
-/**
- * @ingroup thread_management
- * @brief Get current priority of an active thread.
- *
- * @param[in] thread_id The target thread with the thread id to be searched
- * @return os_priority
- */
-extern int os_thread_get_priority(uint32_t thread_id);
-
-/**
- * @defgroup signal_management signal_management
- * Signaling between threads include set, clear, and wait
- */
-
-/**
- * @ingroup signal_management
- * @brief Set the specified Signal Flags of an active thread.
- *
- * @param[in] thread_id Send signal to a thread with the thread id
- * @param[in] signals the signals to be send
- * @return os_status code
- */
-extern int32_t os_signal_set(uint32_t thread_id, int32_t signals);
-
-/**
- * @ingroup signal_management
- * @brief Clear the specified Signal Flags of an active thread.
- *
- * @param[in] thread_id Clear signal to a thread with the thread id
- * @param[in] signals The signals to be clear
- * @return os_status code
- */
-extern int32_t os_signal_clear(uint32_t thread_id, int32_t signals);
-
-/**
- * @ingroup signal_management
- * @brief Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread.
- *
- * @param[in] signals the signals to be wait
- * @param[in] millisec the timeout value if no signal comes in. Fill in 0xFFFFFFFF for infinite wait.
- * @return os_status code
- */
-extern os_event_t os_signal_wait(int32_t signals, uint32_t millisec);
-
-/**
- * @defgroup timer_management timer_management
- * Software timer management include create, start, stop, delete.
- */
-
-/**
- * @ingroup timer_management
- * @brief specify timer type that invoke only once
- */
-#define OS_TIMER_ONCE (0)
-
-/**
- * @ingroup timer_management
- * @brief specify timer type that invoke periodically
- */
-#define OS_TIMER_PERIODIC (1)
-
-/**
- * @ingroup timer_management
- * @brief Create a timer.
- *
- * @param[in] callback The function to be invoke when timer timeout
- * @param[in] isPeriodic \b OS_TIMER_ONCE or \b OS_TIMER_PERIODIC
- * @param[in] argument The argument that is bring into callback function
- * @return timer id
- */
-extern uint32_t os_timer_create(void (*callback)(const void *argument), uint8_t isPeriodic, void *argument);
-
-/**
- * @ingroup timer_management
- * @brief Start or restart a timer.
- *
- * @param[in] timer_id The timer id obtained from by os_timer_create
- * @param[in] millisec The delays after timer starts
- * @return os_status code
- */
-extern uint32_t os_timer_start(uint32_t timer_id, uint32_t millisec);
-
-/**
- * @ingroup timer_management
- * @brief Stop the timer.
- *
- * @param[in] timer_id The timer id obtained from by os_timer_create
- * @return os_status code
- */
-extern uint32_t os_timer_stop(uint32_t timer_id);
-
-/**
- * @ingroup timer_management
- * @brief Delete a timer that was created by os_timer_create
- *
- * @param[in] timer_id The timer id obtained from by os_timer_create
- * @return os_status code
- */
-extern uint32_t os_timer_delete(uint32_t timer_id);
-
-/**
- * @defgroup semaphore_management semaphore_management
- * Semaphore API between threads include create, wait, release, delete.
- */
-
-/**
- * @ingroup semaphore_management
- * @brief Create and Initialize a Semaphore object used for managing resources
- *
- * @param[in] count The number of available resources
- * @return semaphore ID
- */
-extern uint32_t os_semaphore_create(int32_t count);
-
-/**
- * @ingroup semaphore_management
- * @brief Wait until a Semaphore token becomes available
- *
- * @param[in] semaphore_id semaphore id obtained from os_semaphore_create
- * @param[in] millisec timeout value
- * @return os_status code
- */
-extern int32_t os_semaphore_wait(uint32_t semaphore_id, uint32_t millisec);
-
-/**
- * @ingroup semaphore_management
- * @brief Release a Semaphore token
- *
- * @param[in] semaphore_id semaphore id obtained from os_semaphore_create
- * @return os_status code
- */
-extern uint32_t os_semaphore_release(uint32_t semaphore_id);
-
-/**
- * @ingroup semaphore_management
- * @brief Delete a Semaphore that was created by os_semaphore_create.
- *
- * @param[in] semaphore_id semaphore id obtained from os_semaphore_create
- * @return os_status code
- */
-extern uint32_t os_semaphore_delete(uint32_t semaphore_id);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/arduino/realtek-ambz/libraries/MD5/MD5Impl.h b/arduino/realtek-ambz/libraries/MD5/MD5Impl.h
deleted file mode 100644
index e9bb3d8..0000000
--- a/arduino/realtek-ambz/libraries/MD5/MD5Impl.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-03. */
-
-#pragma once
-
-#define LT_MD5_USE_POLARSSL 1
diff --git a/arduino/realtek-ambz/libraries/PowerManagement/PowerManagement.cpp b/arduino/realtek-ambz/libraries/PowerManagement/PowerManagement.cpp
deleted file mode 100644
index 978d4d6..0000000
--- a/arduino/realtek-ambz/libraries/PowerManagement/PowerManagement.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "PowerManagement.h"
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#include
-#include
-#include
-}
-#endif
-
-#if defined(BOARD_RTL8195A)
-#define SAVE_LOCK_PIN 18
-#elif defined(BOARD_RTL8710)
-#define SAVE_LOCK_PIN 7 // PB_1
-#else
-#define SAVE_LOCK_PIN 18
-#endif
-
-bool PowerManagementClass::reservePLL = true;
-
-void PowerManagementClass::sleep(uint32_t bitflg) {
- if (!safeLock()) {
- pmu_release_wakelock(bitflg);
- }
-}
-
-void PowerManagementClass::sleep(void) {
- if (!safeLock()) {
- pmu_release_wakelock(BIT(PMU_OS));
- }
-}
-
-void PowerManagementClass::active(uint32_t bitflg) {
- pmu_acquire_wakelock(bitflg);
-}
-
-void PowerManagementClass::active(void) {
- pmu_acquire_wakelock(BIT(PMU_OS));
-}
-
-void PowerManagementClass::deepsleep(uint32_t duration_ms) {
- if (!safeLock()) {
- deepsleep_ex(DSLEEP_WAKEUP_BY_TIMER, duration_ms);
- }
-}
-
-bool PowerManagementClass::safeLock() {
- pinMode(SAVE_LOCK_PIN, INPUT_PULLUP);
- return (digitalRead(SAVE_LOCK_PIN) == 1) ? false : true;
-}
-
-void PowerManagementClass::softReset() {
- sys_reset();
-}
-
-PowerManagementClass PowerManagement;
diff --git a/arduino/realtek-ambz/libraries/PowerManagement/PowerManagement.h b/arduino/realtek-ambz/libraries/PowerManagement/PowerManagement.h
deleted file mode 100644
index c2551d7..0000000
--- a/arduino/realtek-ambz/libraries/PowerManagement/PowerManagement.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#pragma once
-
-#include
-
-/**
- * @class PowerManagementClass PowerManagement.h
- * @brief Power management in Ameba
- */
-class PowerManagementClass {
- public:
- /**
- * @brief Allow OS automatically save power while idle
- *
- * As OS consider it would idle for more than 2s, it will invoke system suspend.
- * If wlan is associated with AP, than it will under asslociated idle state.
- */
- static void sleep(void);
- static void sleep(uint32_t bitflg);
-
- /**
- * @brief Disallow OS automatically save power while idle
- */
- static void active(void);
- static void active(uint32_t bitflg);
-
- /**
- * @brief Reserved PLL while sleep
- *
- * Reserve PLL would keep FIFO of peripherals (Ex. UART) but cost more power (around 5mA).
- * If we don't reserve PLL, it saves more power but we might missing data because FIFO is turned of this way.
- *
- * @param[in] reserve true for reserved, false for non-reserved
- */
- static void setPllReserved(bool reserve);
-
- /**
- * @brief Enter deepsleep immediately
- *
- * Invoke deepsleep would make system enter deepsleep state immediately.
- * It's the state that saves most power.
- * As it wakeup from deepsleep, the system would behave just like reboot.
- *
- * @param[in] duration_ms wakeup after specific time in unit of millisecond
- */
- static void deepsleep(uint32_t duration_ms);
-
- /**
- * @brief Check if system is allowed enter any power save state
- *
- * The pin 18 (GPIOE_5) is designed as safe lock.
- * If pin 18 is HIGH, then we prevent Ameba enter any power save state.\n\n
- * Under any power save state, we are not able to flash image to Ameba.
- * Thus if user misuse deepsleep and make Ameba enter deepsleep immediately after boot up,
- * then he would find it's hard to flash image.
- * In this case, he can pull up pin 18.
- *
- * @return true if system not allowed enter any power save state, and false vise versa
- */
- static bool safeLock();
-
- /**
- * @brief Reboot system
- *
- * Reboot system in soft way. Some registers is not powered off in this case, but mostly we could regard this as
- * reboot.
- */
- static void softReset();
-
- private:
- static bool reservePLL;
-};
-
-extern PowerManagementClass PowerManagement;
diff --git a/arduino/realtek-ambz/libraries/SoftwareSerial/SoftwareSerial.h b/arduino/realtek-ambz/libraries/SoftwareSerial/SoftwareSerial.h
deleted file mode 100644
index e711c8a..0000000
--- a/arduino/realtek-ambz/libraries/SoftwareSerial/SoftwareSerial.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-07-03. */
-
-#pragma once
-
-#include
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFi.h b/arduino/realtek-ambz/libraries/WiFi/WiFi.h
deleted file mode 100644
index c386b1b..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFi.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-25. */
-
-#pragma once
-
-#include
-#include
-
-#include "WiFiClient.h"
-#include "WiFiClientSecure.h"
-#include "WiFiServer.h"
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFiClient.h b/arduino/realtek-ambz/libraries/WiFi/WiFiClient.h
deleted file mode 100644
index eb27361..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFiClient.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-27. */
-
-#pragma once
-
-#include
-#include
-
-typedef LwIPClient WiFiClient;
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFiClientSecure.h b/arduino/realtek-ambz/libraries/WiFi/WiFiClientSecure.h
deleted file mode 100644
index 3addedf..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFiClientSecure.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-05-04. */
-
-#pragma once
-
-#include
-#include
-
-typedef MbedTLSClient WiFiClientSecure;
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFiData.h b/arduino/realtek-ambz/libraries/WiFi/WiFiData.h
deleted file mode 100644
index 2488579..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFiData.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-23. */
-
-#pragma once
-
-#include
-
-extern "C" {
-
-#include
-#include
-
-} // extern "C"
-
-typedef struct {
- bool initialized;
- bool sleep;
- SemaphoreHandle_t scanSem;
-} WiFiData;
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFiGeneric.cpp b/arduino/realtek-ambz/libraries/WiFi/WiFiGeneric.cpp
deleted file mode 100644
index 2b5e1c5..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFiGeneric.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-25. */
-
-#include "WiFiPriv.h"
-
-int32_t WiFiClass::channel() {
- int channel = 0;
- wifi_get_channel(&channel);
- return channel;
-}
-
-bool WiFiClass::modePriv(WiFiMode mode, WiFiModeAction sta, WiFiModeAction ap) {
- __wrap_rtl_printf_disable();
- __wrap_DiagPrintf_disable();
- startWifiTask();
-
- if (!data.initialized) {
- // initialize wifi first
- LT_IM(WIFI, "Initializing LwIP");
- LwIP_Init();
- reset_wifi_struct();
- data.initialized = true;
- }
- LT_HEAP_I();
- if (getMode()) {
- // stop wifi to change mode
- LT_DM(WIFI, "Stopping WiFi to change mode");
- if (wifi_off() != RTW_SUCCESS)
- goto error;
- vTaskDelay(20);
- if (mode == WIFI_MODE_NULL)
- goto error;
- }
-
- if (wifi_on((rtw_mode_t)mode) != RTW_SUCCESS) {
- LT_EM(WIFI, "Error while changing mode(%u)", mode);
- goto error;
- }
-
- // send STA start/stop events and AP stop event (start is handled in softAP())
- if (sta == WLMODE_ENABLE) {
- wifi_indication(WIFI_EVENT_CONNECT, NULL, ARDUINO_EVENT_WIFI_STA_START, -2);
- } else if (sta == WLMODE_DISABLE) {
- wifi_indication(WIFI_EVENT_CONNECT, NULL, ARDUINO_EVENT_WIFI_STA_STOP, -2);
- }
- if (ap == WLMODE_DISABLE) {
- wifi_indication(WIFI_EVENT_CONNECT, NULL, ARDUINO_EVENT_WIFI_AP_STOP, -2);
- }
-
- LT_HEAP_I();
- __wrap_rtl_printf_enable();
- __wrap_DiagPrintf_enable();
- return true;
-
-error:
- __wrap_rtl_printf_enable();
- __wrap_DiagPrintf_enable();
- return false;
-}
-
-WiFiMode WiFiClass::getMode() {
- if (!data.initialized)
- return WIFI_MODE_NULL;
- return (WiFiMode)wifi_mode;
-}
-
-WiFiStatus WiFiClass::status() {
- if (wifi_is_connected_to_ap() == 0) {
- return WL_CONNECTED;
- } else {
- return WL_DISCONNECTED;
- }
-}
-
-bool WiFiClass::setSleep(bool enable) {
- LT_DM(WIFI, "WiFi sleep mode %u", enable);
- if (enable) {
- if (wifi_enable_powersave() != RTW_SUCCESS)
- return false;
- } else {
- if (wifi_disable_powersave() != RTW_SUCCESS)
- return false;
- }
- data.sleep = enable;
- return true;
-}
-
-bool WiFiClass::getSleep() {
- return data.sleep;
-}
-
-bool WiFiClass::setTxPower(int power) {
- return false; // wifi_set_txpower(power) == RTW_SUCCESS;
-}
-
-int WiFiClass::getTxPower() {
- return 0;
- int power = 0;
- wifi_get_txpower(&power);
- return power;
-}
-
-IPAddress WiFiClass::hostByName(const char *hostname) {
- ip_addr_t ip;
- int ret = netconn_gethostbyname(hostname, &ip);
- if (ret == ERR_OK) {
- return ip.addr;
- }
- return IPAddress();
-}
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFiPriv.h b/arduino/realtek-ambz/libraries/WiFi/WiFiPriv.h
deleted file mode 100644
index 37439d6..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFiPriv.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-04-25. */
-
-#pragma once
-
-#include
-
-extern "C" {
-
-// copy defines from PIO builder (for IDE to understand)
-#define LWIP_TIMEVAL_PRIVATE 0
-#define LWIP_NETIF_HOSTNAME 1
-#define LWIP_SO_RCVBUF 1
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-extern struct netif xnetif[NET_IF_NUM];
-
-} // extern "C"
-
-// WiFi.cpp
-extern rtw_network_info_t wifi;
-extern rtw_ap_info_t ap;
-extern rtw_wifi_setting_t wifi_setting;
-extern unsigned char sta_password[65];
-extern unsigned char ap_password[65];
-extern void reset_wifi_struct(void);
-extern rtw_mode_t wifi_mode;
-extern WiFiAuthMode securityTypeToAuthMode(uint8_t type);
-// WiFiEvents.cpp
-extern void startWifiTask();
-extern void handleRtwEvent(uint16_t event, char *data, int len, int flags);
-
-#define NETIF_RTW_STA &xnetif[RTW_STA_INTERFACE]
-#define NETIF_RTW_AP (wifi_mode == WIFI_MODE_APSTA ? &xnetif[RTW_AP_INTERFACE] : NETIF_RTW_STA)
-
-#define NETNAME_STA WLAN0_NAME
-#define NETNAME_AP (wifi_mode == WIFI_MODE_APSTA ? WLAN1_NAME : WLAN0_NAME)
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFiServer.h b/arduino/realtek-ambz/libraries/WiFi/WiFiServer.h
deleted file mode 100644
index db8df0b..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFiServer.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-06-27. */
-
-#pragma once
-
-#include
-#include
-
-typedef LwIPServer WiFiServer;
diff --git a/arduino/realtek-ambz/libraries/WiFi/WiFiUdp.h b/arduino/realtek-ambz/libraries/WiFi/WiFiUdp.h
deleted file mode 100644
index 8b60be1..0000000
--- a/arduino/realtek-ambz/libraries/WiFi/WiFiUdp.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) Kuba SzczodrzyĆski 2022-09-10. */
-
-#pragma once
-
-#include
-#include
-
-typedef LwIPUDP WiFiUDP;
diff --git a/boards/SUMMARY.md b/boards/SUMMARY.md
deleted file mode 100644
index 2df5314..0000000
--- a/boards/SUMMARY.md
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-- [Generic - BK7231N (Tuya QFN32)](../boards/generic-bk7231n-qfn32-tuya/README.md)
-- [Generic - BK7231T (Tuya QFN32)](../boards/generic-bk7231t-qfn32-tuya/README.md)
-- [Generic - BK7252](../boards/generic-bk7252/README.md)
-- [Generic - RTL8710BN (2M/468k)](../boards/generic-rtl8710bn-2mb-468k/README.md)
-- [Generic - RTL8710BN (2M/788k)](../boards/generic-rtl8710bn-2mb-788k/README.md)
-- [Generic - RTL8710BX (4M/980k)](../boards/generic-rtl8710bx-4mb-980k/README.md)
-- [Generic - RTL8720CF (2M/992k)](../boards/generic-rtl8720cf-2mb-992k/README.md)
-- [BW12](../boards/bw12/README.md)
-- [BW15](../boards/bw15/README.md)
-- [CB2L](../boards/cb2l/README.md)
-- [CB2S](../boards/cb2s/README.md)
-- [CB3L](../boards/cb3l/README.md)
-- [CB3S](../boards/cb3s/README.md)
-- [CB3SE](../boards/cb3se/README.md)
-- [WB2L](../boards/wb2l/README.md)
-- [WB2S](../boards/wb2s/README.md)
-- [WB3L](../boards/wb3l/README.md)
-- [WB3S](../boards/wb3s/README.md)
-- [WR2](../boards/wr2/README.md)
-- [WR2E](../boards/wr2e/README.md)
-- [WR3](../boards/wr3/README.md)
-- [WR3E](../boards/wr3e/README.md)
-- [WR3N](../boards/wr3n/README.md)
-- [WR2L](../boards/wr2l/README.md)
-- [WR2LE](../boards/wr2le/README.md)
-- [WR3L](../boards/wr3l/README.md)
-- [WR3LE](../boards/wr3le/README.md)
-- [LSC LMA35](../boards/lsc-lma35/README.md)
-- [LSC LMA35 T](../boards/lsc-lma35-t/README.md)
-- [Generic - Host-native](../boards/generic-native/README.md)
diff --git a/boards/_base/beken-7231n.json b/boards/_base/beken-7231n.json
index 4a1421b..308a3ba 100644
--- a/boards/_base/beken-7231n.json
+++ b/boards/_base/beken-7231n.json
@@ -1,9 +1,9 @@
{
"build": {
"family": "BK7231N",
- "ldscript_sdk": "bk7231n_bsp.ld",
- "ldscript_arduino": "bk7231n_bsp.ld",
+ "ldscript": "bk7231n_bsp.ld",
"bkboot_version": "1.0.1-bk7231n",
+ "bkoffset_app": "0x10000",
"bkrbl_size_app": "0x108700"
},
"flash": {
diff --git a/boards/_base/beken-7231u.json b/boards/_base/beken-7231u.json
index 7199113..7516035 100644
--- a/boards/_base/beken-7231u.json
+++ b/boards/_base/beken-7231u.json
@@ -1,9 +1,9 @@
{
"build": {
"family": "BK7231U",
- "ldscript_sdk": "bk7231_bsp.ld",
- "ldscript_arduino": "bk7231_bsp.ld",
+ "ldscript": "bk7231_bsp.ld",
"bkboot_version": "1.0.8-bk7231u",
+ "bkoffset_app": "0x10000",
"bkrbl_size_app": "0x108700"
},
"flash": {
diff --git a/boards/_base/beken-7252.json b/boards/_base/beken-7252.json
index e9efae5..cc86e67 100644
--- a/boards/_base/beken-7252.json
+++ b/boards/_base/beken-7252.json
@@ -2,9 +2,9 @@
"build": {
"family": "BK7251",
"f_cpu": "180000000L",
- "ldscript_sdk": "bk7231_bsp.ld",
- "ldscript_arduino": "bk7231_bsp.ld",
+ "ldscript": "bk7231_bsp.ld",
"bkboot_version": "0.1.3-bk7252",
+ "bkoffset_app": "0x10000",
"bkrbl_size_app": "0x1A0000"
},
"flash": {
diff --git a/boards/_base/beken-72xx.json b/boards/_base/beken-72xx.json
index bbbaef8..f466879 100644
--- a/boards/_base/beken-72xx.json
+++ b/boards/_base/beken-72xx.json
@@ -22,10 +22,6 @@
"mem 0x000000 0x200000 ro"
]
},
- "frameworks": [
- "beken-72xx-sdk",
- "beken-72xx-arduino"
- ],
"upload": {
"maximum_ram_size": 262144,
"flash_size": 2097152,
diff --git a/boards/_base/ic/rtl8710bn.json b/boards/_base/ic/rtl8710bn.json
index 7a376d4..0a3d6e7 100644
--- a/boards/_base/ic/rtl8710bn.json
+++ b/boards/_base/ic/rtl8710bn.json
@@ -92,6 +92,7 @@
},
"27": {
"C_NAME": "AD_2",
+ "GPIONUM": 41,
"IO": "I",
"ADC": 2
},
diff --git a/boards/_base/realtek-ambz-2mb-468k.json b/boards/_base/realtek-ambz-2mb-468k.json
index 539f23e..6b8346c 100644
--- a/boards/_base/realtek-ambz-2mb-468k.json
+++ b/boards/_base/realtek-ambz-2mb-468k.json
@@ -1,7 +1,5 @@
{
"build": {
- "ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_2M_468k_cpp.ld",
- "ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_2M_468k_cpp.ld",
"amb_boot_all": "boot_all_77F7.bin"
},
"flash": {
diff --git a/boards/_base/realtek-ambz-2mb-788k.json b/boards/_base/realtek-ambz-2mb-788k.json
index 0af4b40..7df3e6e 100644
--- a/boards/_base/realtek-ambz-2mb-788k.json
+++ b/boards/_base/realtek-ambz-2mb-788k.json
@@ -1,7 +1,5 @@
{
"build": {
- "ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_2M_cpp.ld",
- "ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_2M_cpp.ld",
"amb_boot_all": "boot_all_77F7.bin"
},
"flash": {
diff --git a/boards/_base/realtek-ambz-4mb-980k.json b/boards/_base/realtek-ambz-4mb-980k.json
index ce08d8b..5f5fd0e 100644
--- a/boards/_base/realtek-ambz-4mb-980k.json
+++ b/boards/_base/realtek-ambz-4mb-980k.json
@@ -1,7 +1,5 @@
{
"build": {
- "ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_4M_980k_cpp.ld",
- "ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_4M_980k_cpp.ld",
"amb_boot_all": "boot_all_C556.bin"
},
"flash": {
diff --git a/boards/_base/realtek-ambz.json b/boards/_base/realtek-ambz.json
index 9585c44..8fbbdae 100644
--- a/boards/_base/realtek-ambz.json
+++ b/boards/_base/realtek-ambz.json
@@ -1,6 +1,7 @@
{
"build": {
"family": "RTL8710B",
+ "ldscript": "rlx8711B-symbol-v02-img2_xip1.ld",
"f_cpu": "125000000L",
"prefix": "arm-none-eabi-",
"amb_flash_addr": "0x08000000"
@@ -24,10 +25,6 @@
"mem 0x8000000 0x8200000 ro"
]
},
- "frameworks": [
- "realtek-ambz-sdk",
- "realtek-ambz-arduino"
- ],
"upload": {
"maximum_ram_size": 262144,
"require_upload_port": true,
diff --git a/boards/_base/realtek-ambz2.json b/boards/_base/realtek-ambz2.json
index c7f451a..be1f316 100644
--- a/boards/_base/realtek-ambz2.json
+++ b/boards/_base/realtek-ambz2.json
@@ -3,8 +3,7 @@
"family": "RTL8720C",
"f_cpu": "100000000L",
"prefix": "arm-none-eabi-",
- "ldscript_sdk": "rtl8710c_ram.ld",
- "ldscript_arduino": "rtl8710c_ram.ld"
+ "ldscript": "rtl8710c_ram.ld"
},
"flash": {
"part_table": "0x000000+0x1000",
@@ -16,9 +15,6 @@
"protocol": "openocd",
"protocols": []
},
- "frameworks": [
- "realtek-ambz2-sdk"
- ],
"upload": {
"maximum_ram_size": 262144
},
diff --git a/boards/bw12/README.md b/boards/bw12/README.md
deleted file mode 100644
index db2e50c..0000000
--- a/boards/bw12/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# BW12
-
-*by Ai-Thinker Co., Ltd.*
-
-[Product page](http://www.ai-thinker.com/pro_view-13.html)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-- [Vendor datasheet](https://docs.ai-thinker.com/_media/rtl8710/hardware/bw12_datasheet_en.pdf)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `bw12`
-MCU | RTL8710BX
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 62.5 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 11x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ARI3-BW1X](https://fccid.io/2ARI3-BW1X)
-
-## Usage
-
-**Board code:** `bw12`
-
-In `platformio.ini`:
-
-```ini
-[env:bw12]
-platform = libretuya
-board = bw12
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: bw12
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA05 | | | | PWM4 |
-D1 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D2 | PA00 | | | | PWM2 |
-D3 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D4 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D5 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-D6 | PA14 | | | | PWM0 | SWCLK
-D7 | PA12 | | | | PWM3 |
-D8 | PA15 | | | | PWM1 | SWDIO
-D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-A0 | PA19, ADC1 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 468 KiB / 0x75000 | 0x080000
-OTA2 Image | 0x080000 | 468 KiB / 0x75000 | 0x0F5000
-Key-Value Store | 0x0F5000 | 24 KiB / 0x6000 | 0x0FB000
-User Data | 0x0FB000 | 1 MiB / 0x104000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/bw12/pinout_bw12.svg b/boards/bw12/pinout_bw12.svg
deleted file mode 100644
index 97456f5..0000000
--- a/boards/bw12/pinout_bw12.svg
+++ /dev/null
@@ -1,315 +0,0 @@
-
-
diff --git a/boards/bw12/pins_arduino.h b/boards/bw12/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/bw12/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/bw12/variant.h b/boards/bw12/variant.h
deleted file mode 100644
index a895a4d..0000000
--- a/boards/bw12/variant.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* This file was auto-generated from bw12.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 11
-#define NUM_DIGITAL_PINS 11
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 3u // PA_19
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 3u // PA_19
-#define PIN_SPI0_MISO 4u // PA_22
-#define PIN_SPI0_MOSI 10u // PA_23
-#define PIN_SPI0_SCK 9u // PA_18
-#define PIN_SPI1_CS 3u // PA_19
-#define PIN_SPI1_MISO 4u // PA_22
-#define PIN_SPI1_MOSI 10u // PA_23
-#define PIN_SPI1_SCK 9u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 1u // PA_29
-#define PIN_WIRE0_SCL_1 4u // PA_22
-#define PIN_WIRE0_SDA_0 3u // PA_19
-#define PIN_WIRE0_SDA_1 5u // PA_30
-#define PIN_WIRE1_SCL 9u // PA_18
-#define PIN_WIRE1_SDA 10u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 3u // PA_19
-#define PIN_SERIAL0_RTS 4u // PA_22
-#define PIN_SERIAL0_RX 9u // PA_18
-#define PIN_SERIAL0_TX 10u // PA_23
-#define PIN_SERIAL2_RX 1u // PA_29
-#define PIN_SERIAL2_TX 5u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 3u // PA_19
-#define PIN_FUNCTION_CS0 3u // PA_19
-#define PIN_FUNCTION_CS1 3u // PA_19
-#define PIN_FUNCTION_CTS0 3u // PA_19
-#define PIN_FUNCTION_MISO0 4u // PA_22
-#define PIN_FUNCTION_MISO1 4u // PA_22
-#define PIN_FUNCTION_MOSI0 10u // PA_23
-#define PIN_FUNCTION_MOSI1 10u // PA_23
-#define PIN_FUNCTION_PA00 2u // PA_0
-#define PIN_FUNCTION_PA05 0u // PA_5
-#define PIN_FUNCTION_PA12 7u // PA_12
-#define PIN_FUNCTION_PA14 6u // PA_14
-#define PIN_FUNCTION_PA15 8u // PA_15
-#define PIN_FUNCTION_PA18 9u // PA_18
-#define PIN_FUNCTION_PA19 3u // PA_19
-#define PIN_FUNCTION_PA22 4u // PA_22
-#define PIN_FUNCTION_PA23 10u // PA_23
-#define PIN_FUNCTION_PA29 1u // PA_29
-#define PIN_FUNCTION_PA30 5u // PA_30
-#define PIN_FUNCTION_RTS0 4u // PA_22
-#define PIN_FUNCTION_RX0 9u // PA_18
-#define PIN_FUNCTION_RX2 1u // PA_29
-#define PIN_FUNCTION_SCK0 9u // PA_18
-#define PIN_FUNCTION_SCK1 9u // PA_18
-#define PIN_FUNCTION_TX0 10u // PA_23
-#define PIN_FUNCTION_TX2 5u // PA_30
diff --git a/boards/bw15/README.md b/boards/bw15/README.md
deleted file mode 100644
index 9c5c778..0000000
--- a/boards/bw15/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# BW15
-
-*by Ai-Thinker Co., Ltd.*
-
-[Product page](https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Vendor datasheet](https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `bw15`
-MCU | RTL8720CF
-Manufacturer | Realtek
-Series | AmebaZ2
-Frequency | 100 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 13x GPIO, 8x PWM, 3x UART
-Wi-Fi | 802.11 b/g/n
-BLE | v4.2
-FCC ID | [2AXVG-BW15](https://fccid.io/2AXVG-BW15)
-
-## Usage
-
-**Board code:** `bw15`
-
-In `platformio.ini`:
-
-```ini
-[env:bw15]
-platform = libretuya
-board = bw15
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: bw15
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Partition Table | 0x000000 | 4 KiB / 0x1000 | 0x001000
-System Data | 0x001000 | 4 KiB / 0x1000 | 0x002000
-Calibration | 0x002000 | 4 KiB / 0x1000 | 0x003000
-(reserved) | 0x003000 | 4 KiB / 0x1000 | 0x004000
-Boot Image | 0x004000 | 32 KiB / 0x8000 | 0x00C000
-OTA1 Image | 0x00C000 | 992 KiB / 0xF8000 | 0x104000
-OTA2 Image | 0x104000 | 992 KiB / 0xF8000 | 0x1FC000
-Key-Value Store | 0x1FC000 | 8 KiB / 0x2000 | 0x1FE000
-User Data | 0x1FE000 | 8 KiB / 0x2000 | 0x200000
diff --git a/boards/bw15/pinout_bw15.svg b/boards/bw15/pinout_bw15.svg
deleted file mode 100644
index fc777d0..0000000
--- a/boards/bw15/pinout_bw15.svg
+++ /dev/null
@@ -1,355 +0,0 @@
-
-
diff --git a/boards/bw15/pins_arduino.h b/boards/bw15/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/bw15/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/bw15/variant.h b/boards/bw15/variant.h
deleted file mode 100644
index 32b21b3..0000000
--- a/boards/bw15/variant.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* This file was auto-generated from bw15.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
diff --git a/boards/cb2l/README.md b/boards/cb2l/README.md
deleted file mode 100644
index 103c865..0000000
--- a/boards/cb2l/README.md
+++ /dev/null
@@ -1,82 +0,0 @@
-# CB2L Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/cb2l-module-datasheet?id=Kai2eku1m3pyl)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `cb2l`
-MCU | BK7231N
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 9x GPIO, 5x PWM, 2x UART
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.1
-FCC ID | [2ANDL-CB2L](https://fccid.io/2ANDL-CB2L)
-
-## Usage
-
-**Board code:** `cb2l`
-
-In `platformio.ini`:
-
-```ini
-[env:cb2l]
-platform = libretuya
-board = cb2l
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: cb2l
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----|----------|----------|-----|------|------
-D0 | P8 | | | | PWM2 |
-D1 | P7 | | | | PWM1 |
-D2 | P6 | | | | PWM0 |
-D3 | P26 | | | | PWM5 |
-D4 | P24 | | | | PWM4 |
-D5 | P10 | UART1_RX | | | |
-D6 | P0 | UART2_TX | I2C2_SCL | | |
-D7 | P11 | UART1_TX | | | |
-D8 | P21 | | I2C1_SDA | | | TMS
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000
-OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000
-Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000
-Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000
-TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000
-Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000
-User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/cb2l/pinout_cb2l.svg b/boards/cb2l/pinout_cb2l.svg
deleted file mode 100644
index f41a95e..0000000
--- a/boards/cb2l/pinout_cb2l.svg
+++ /dev/null
@@ -1,258 +0,0 @@
-
-
diff --git a/boards/cb2l/pins_arduino.h b/boards/cb2l/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/cb2l/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/cb2l/variant.h b/boards/cb2l/variant.h
deleted file mode 100644
index a09b1e7..0000000
--- a/boards/cb2l/variant.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This file was auto-generated from cb2l.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 9
-#define NUM_DIGITAL_PINS 9
-#define NUM_ANALOG_OUTPUTS 0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 0
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 1
-#define PIN_SERIAL1_RX 5u // GPIO10
-#define PIN_SERIAL1_TX 7u // GPIO11
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_P0 6u // GPIO0
-#define PIN_FUNCTION_P6 2u // GPIO6
-#define PIN_FUNCTION_P7 1u // GPIO7
-#define PIN_FUNCTION_P8 0u // GPIO8
-#define PIN_FUNCTION_P10 5u // GPIO10
-#define PIN_FUNCTION_P11 7u // GPIO11
-#define PIN_FUNCTION_P21 8u // GPIO21
-#define PIN_FUNCTION_P24 4u // GPIO24
-#define PIN_FUNCTION_P26 3u // GPIO26
-#define PIN_FUNCTION_PWM0 2u // GPIO6
-#define PIN_FUNCTION_PWM1 1u // GPIO7
-#define PIN_FUNCTION_PWM2 0u // GPIO8
-#define PIN_FUNCTION_PWM4 4u // GPIO24
-#define PIN_FUNCTION_PWM5 3u // GPIO26
-#define PIN_FUNCTION_RX1 5u // GPIO10
-#define PIN_FUNCTION_SCL2 6u // GPIO0
-#define PIN_FUNCTION_SDA1 8u // GPIO21
-#define PIN_FUNCTION_TX1 7u // GPIO11
-#define PIN_FUNCTION_TX2 6u // GPIO0
diff --git a/boards/cb2s/README.md b/boards/cb2s/README.md
deleted file mode 100644
index bdaf6f8..0000000
--- a/boards/cb2s/README.md
+++ /dev/null
@@ -1,85 +0,0 @@
-# CB2S Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/cb2s-module-datasheet?id=Kafgfsa2aaypq)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `cb2s`
-MCU | BK7231N
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 11x GPIO, 5x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.1
-FCC ID | [2ANDL-CB2S](https://fccid.io/2ANDL-CB2S)
-
-## Usage
-
-**Board code:** `cb2s`
-
-In `platformio.ini`:
-
-```ini
-[env:cb2s]
-platform = libretuya
-board = cb2s
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: cb2s
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|-----|------|------
-D0 | P6 | | | | PWM0 |
-D1 | P7 | | | | PWM1 |
-D2 | P8 | | | | PWM2 |
-D3 | P23 | | | | | TDO
-D4 | P10 | UART1_RX | | | |
-D5 | P11 | UART1_TX | | | |
-D6 | P24 | | | | PWM4 |
-D7 | P26 | | | | PWM5 |
-D8 | P0 | UART2_TX | I2C2_SCL | | |
-D9 | P1 | UART2_RX | I2C2_SDA | | |
-D10 | P21 | | I2C1_SDA | | | TMS
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000
-OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000
-Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000
-Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000
-TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000
-Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000
-User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/cb2s/pinout_cb2s.svg b/boards/cb2s/pinout_cb2s.svg
deleted file mode 100644
index bb69c2f..0000000
--- a/boards/cb2s/pinout_cb2s.svg
+++ /dev/null
@@ -1,276 +0,0 @@
-
-
diff --git a/boards/cb2s/pins_arduino.h b/boards/cb2s/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/cb2s/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/cb2s/variant.h b/boards/cb2s/variant.h
deleted file mode 100644
index f47ff6d..0000000
--- a/boards/cb2s/variant.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This file was auto-generated from cb2s.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 11
-#define NUM_DIGITAL_PINS 11
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 3u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 1
-#define PIN_WIRE2_SCL 8u // GPIO0
-#define PIN_WIRE2_SDA 9u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 4u // GPIO10
-#define PIN_SERIAL1_TX 5u // GPIO11
-#define PIN_SERIAL2_RX 9u // GPIO1
-#define PIN_SERIAL2_TX 8u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 3u // GPIO23
-#define PIN_FUNCTION_P0 8u // GPIO0
-#define PIN_FUNCTION_P1 9u // GPIO1
-#define PIN_FUNCTION_P6 0u // GPIO6
-#define PIN_FUNCTION_P7 1u // GPIO7
-#define PIN_FUNCTION_P8 2u // GPIO8
-#define PIN_FUNCTION_P10 4u // GPIO10
-#define PIN_FUNCTION_P11 5u // GPIO11
-#define PIN_FUNCTION_P21 10u // GPIO21
-#define PIN_FUNCTION_P23 3u // GPIO23
-#define PIN_FUNCTION_P24 6u // GPIO24
-#define PIN_FUNCTION_P26 7u // GPIO26
-#define PIN_FUNCTION_PWM0 0u // GPIO6
-#define PIN_FUNCTION_PWM1 1u // GPIO7
-#define PIN_FUNCTION_PWM2 2u // GPIO8
-#define PIN_FUNCTION_PWM4 6u // GPIO24
-#define PIN_FUNCTION_PWM5 7u // GPIO26
-#define PIN_FUNCTION_RX1 4u // GPIO10
-#define PIN_FUNCTION_RX2 9u // GPIO1
-#define PIN_FUNCTION_SCL2 8u // GPIO0
-#define PIN_FUNCTION_SDA1 10u // GPIO21
-#define PIN_FUNCTION_SDA2 9u // GPIO1
-#define PIN_FUNCTION_TX1 5u // GPIO11
-#define PIN_FUNCTION_TX2 8u // GPIO0
diff --git a/boards/cb3l/README.md b/boards/cb3l/README.md
deleted file mode 100644
index 3d0a043..0000000
--- a/boards/cb3l/README.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# CB3L Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/cb3l-module-datasheet?id=Kai51ngmrh3qm)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `cb3l`
-MCU | BK7231N
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 12x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.1
-FCC ID | [2ANDL-CB3L](https://fccid.io/2ANDL-CB3L)
-
-## Usage
-
-**Board code:** `cb3l`
-
-In `platformio.ini`:
-
-```ini
-[env:cb3l]
-platform = libretuya
-board = cb3l
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: cb3l
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|-----|------|------
-D0 | P23 | | | | | TDO
-D1 | P14 | | | SCK | |
-D2 | P26 | | | | PWM5 |
-D3 | P24 | | | | PWM4 |
-D4 | P6 | | | | PWM0 |
-D5 | P9 | | | | PWM3 |
-D6 | P0 | UART2_TX | I2C2_SCL | | |
-D7 | P21 | | I2C1_SDA | | | TMS
-D8 | P8 | | | | PWM2 |
-D9 | P7 | | | | PWM1 |
-D10 | P10 | UART1_RX | | | |
-D11 | P11 | UART1_TX | | | |
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000
-OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000
-Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000
-Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000
-TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000
-Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000
-User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/cb3l/pinout_cb3l.svg b/boards/cb3l/pinout_cb3l.svg
deleted file mode 100644
index 35eb017..0000000
--- a/boards/cb3l/pinout_cb3l.svg
+++ /dev/null
@@ -1,253 +0,0 @@
-
-
diff --git a/boards/cb3l/pins_arduino.h b/boards/cb3l/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/cb3l/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/cb3l/variant.h b/boards/cb3l/variant.h
deleted file mode 100644
index b787cde..0000000
--- a/boards/cb3l/variant.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* This file was auto-generated from cb3l.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 12
-#define NUM_DIGITAL_PINS 12
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 0u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 0
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 1
-#define PIN_SERIAL1_RX 10u // GPIO10
-#define PIN_SERIAL1_TX 11u // GPIO11
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 0u // GPIO23
-#define PIN_FUNCTION_P0 6u // GPIO0
-#define PIN_FUNCTION_P6 4u // GPIO6
-#define PIN_FUNCTION_P7 9u // GPIO7
-#define PIN_FUNCTION_P8 8u // GPIO8
-#define PIN_FUNCTION_P9 5u // GPIO9
-#define PIN_FUNCTION_P10 10u // GPIO10
-#define PIN_FUNCTION_P11 11u // GPIO11
-#define PIN_FUNCTION_P14 1u // GPIO14
-#define PIN_FUNCTION_P21 7u // GPIO21
-#define PIN_FUNCTION_P23 0u // GPIO23
-#define PIN_FUNCTION_P24 3u // GPIO24
-#define PIN_FUNCTION_P26 2u // GPIO26
-#define PIN_FUNCTION_PWM0 4u // GPIO6
-#define PIN_FUNCTION_PWM1 9u // GPIO7
-#define PIN_FUNCTION_PWM2 8u // GPIO8
-#define PIN_FUNCTION_PWM3 5u // GPIO9
-#define PIN_FUNCTION_PWM4 3u // GPIO24
-#define PIN_FUNCTION_PWM5 2u // GPIO26
-#define PIN_FUNCTION_RX1 10u // GPIO10
-#define PIN_FUNCTION_SCK 1u // GPIO14
-#define PIN_FUNCTION_SCL2 6u // GPIO0
-#define PIN_FUNCTION_SDA1 7u // GPIO21
-#define PIN_FUNCTION_TX1 11u // GPIO11
-#define PIN_FUNCTION_TX2 6u // GPIO0
diff --git a/boards/cb3s/README.md b/boards/cb3s/README.md
deleted file mode 100644
index 825ed95..0000000
--- a/boards/cb3s/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-# CB3S Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/cb3s?id=Kai94mec0s076)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `cb3s`
-MCU | BK7231N
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 14x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.1
-FCC ID | [2ANDL-CB3S](https://fccid.io/2ANDL-CB3S)
-
-## Usage
-
-**Board code:** `cb3s`
-
-In `platformio.ini`:
-
-```ini
-[env:cb3s]
-platform = libretuya
-board = cb3s
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: cb3s
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|-----|------|------
-D0 | P23 | | | | | TDO
-D1 | P14 | | | SCK | |
-D2 | P26 | | | | PWM5 |
-D3 | P24 | | | | PWM4 |
-D4 | P6 | | | | PWM0 |
-D5 | P9 | | | | PWM3 |
-D6 | P0 | UART2_TX | I2C2_SCL | | |
-D7 | P21 | | I2C1_SDA | | | TMS
-D8 | P8 | | | | PWM2 |
-D9 | P7 | | | | PWM1 |
-D10 | P10 | UART1_RX | | | |
-D11 | P11 | UART1_TX | | | |
-D12 | P22 | | | | | TDI
-D13 | P20 | | I2C1_SCL | | | TCK
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000
-OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000
-Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000
-Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000
-TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000
-Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000
-User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/cb3s/pinout_cb3s.svg b/boards/cb3s/pinout_cb3s.svg
deleted file mode 100644
index a35a0eb..0000000
--- a/boards/cb3s/pinout_cb3s.svg
+++ /dev/null
@@ -1,375 +0,0 @@
-
-
diff --git a/boards/cb3s/pins_arduino.h b/boards/cb3s/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/cb3s/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/cb3s/variant.h b/boards/cb3s/variant.h
deleted file mode 100644
index 991948c..0000000
--- a/boards/cb3s/variant.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* This file was auto-generated from cb3s.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 14
-#define NUM_DIGITAL_PINS 14
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 0u // GPIO23
-#define PIN_A0 0u // GPIO23
-#define A0 PIN_A0
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 1
-#define PIN_WIRE1_SCL 13u // GPIO20
-#define PIN_WIRE1_SDA_0 7u // GPIO21
-#define PIN_WIRE1_SDA_1 7u // GPIO21
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 1
-#define PIN_SERIAL1_RX 10u // GPIO10
-#define PIN_SERIAL1_TX 11u // GPIO11
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 0u // GPIO23
-#define PIN_FUNCTION_P0 6u // GPIO0
-#define PIN_FUNCTION_P6 4u // GPIO6
-#define PIN_FUNCTION_P7 9u // GPIO7
-#define PIN_FUNCTION_P8 8u // GPIO8
-#define PIN_FUNCTION_P9 5u // GPIO9
-#define PIN_FUNCTION_P10 10u // GPIO10
-#define PIN_FUNCTION_P11 11u // GPIO11
-#define PIN_FUNCTION_P14 1u // GPIO14
-#define PIN_FUNCTION_P20 13u // GPIO20
-#define PIN_FUNCTION_P21 7u // GPIO21
-#define PIN_FUNCTION_P22 12u // GPIO22
-#define PIN_FUNCTION_P23 0u // GPIO23
-#define PIN_FUNCTION_P24 3u // GPIO24
-#define PIN_FUNCTION_P26 2u // GPIO26
-#define PIN_FUNCTION_PWM0 4u // GPIO6
-#define PIN_FUNCTION_PWM1 9u // GPIO7
-#define PIN_FUNCTION_PWM2 8u // GPIO8
-#define PIN_FUNCTION_PWM3 5u // GPIO9
-#define PIN_FUNCTION_PWM4 3u // GPIO24
-#define PIN_FUNCTION_PWM5 2u // GPIO26
-#define PIN_FUNCTION_RX1 10u // GPIO10
-#define PIN_FUNCTION_SCK 1u // GPIO14
-#define PIN_FUNCTION_SCL1 13u // GPIO20
-#define PIN_FUNCTION_SCL2 6u // GPIO0
-#define PIN_FUNCTION_SDA1 7u // GPIO21
-#define PIN_FUNCTION_TX1 11u // GPIO11
-#define PIN_FUNCTION_TX2 6u // GPIO0
diff --git a/boards/cb3se/README.md b/boards/cb3se/README.md
deleted file mode 100644
index 584b8be..0000000
--- a/boards/cb3se/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# CB3SE Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/CB3SE-Module-Datasheet?id=Kanoiluul7nl2)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|--------------------------------------------
-Board code | `cb3se`
-MCU | BK7231N
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 17x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.1
-FCC ID | [2ANDL-CB3SE](https://fccid.io/2ANDL-CB3SE)
-
-## Usage
-
-**Board code:** `cb3se`
-
-In `platformio.ini`:
-
-```ini
-[env:cb3se]
-platform = libretuya
-board = cb3se
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: cb3se
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|------|------|------
-D0 | P23 | | | | | TDO
-D1 | P14 | | | SCK | |
-D2 | P26 | | | | PWM5 |
-D3 | P24 | | | | PWM4 |
-D4 | P6 | | | | PWM0 |
-D5 | P9 | | | | PWM3 |
-D6 | P0 | UART2_TX | I2C2_SCL | | |
-D7 | P1 | UART2_RX | I2C2_SDA | | |
-D8 | P8 | | | | PWM2 |
-D9 | P7 | | | | PWM1 |
-D10 | P10 | UART1_RX | | | |
-D11 | P11 | UART1_TX | | | |
-D12 | P15 | | | CS | |
-D13 | P22 | | | | | TDI
-D14 | P20 | | I2C1_SCL | | | TCK
-D15 | P17 | | | MISO | |
-D16 | P16 | | | MOSI | |
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000
-OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000
-Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000
-Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000
-TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000
-Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000
-User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/cb3se/pinout_cb3se.svg b/boards/cb3se/pinout_cb3se.svg
deleted file mode 100644
index 4b9e01a..0000000
--- a/boards/cb3se/pinout_cb3se.svg
+++ /dev/null
@@ -1,345 +0,0 @@
-
-
diff --git a/boards/cb3se/pins_arduino.h b/boards/cb3se/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/cb3se/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/cb3se/variant.h b/boards/cb3se/variant.h
deleted file mode 100644
index ad56ccd..0000000
--- a/boards/cb3se/variant.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* This file was auto-generated from cb3se.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 17
-#define NUM_DIGITAL_PINS 17
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 0u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 1
-#define PIN_WIRE2_SCL 6u // GPIO0
-#define PIN_WIRE2_SDA 7u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 10u // GPIO10
-#define PIN_SERIAL1_TX 11u // GPIO11
-#define PIN_SERIAL2_RX 7u // GPIO1
-#define PIN_SERIAL2_TX 6u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 0u // GPIO23
-#define PIN_FUNCTION_CS 12u // GPIO15
-#define PIN_FUNCTION_MISO 15u // GPIO17
-#define PIN_FUNCTION_MOSI 16u // GPIO16
-#define PIN_FUNCTION_P0 6u // GPIO0
-#define PIN_FUNCTION_P1 7u // GPIO1
-#define PIN_FUNCTION_P6 4u // GPIO6
-#define PIN_FUNCTION_P7 9u // GPIO7
-#define PIN_FUNCTION_P8 8u // GPIO8
-#define PIN_FUNCTION_P9 5u // GPIO9
-#define PIN_FUNCTION_P10 10u // GPIO10
-#define PIN_FUNCTION_P11 11u // GPIO11
-#define PIN_FUNCTION_P14 1u // GPIO14
-#define PIN_FUNCTION_P15 12u // GPIO15
-#define PIN_FUNCTION_P16 16u // GPIO16
-#define PIN_FUNCTION_P17 15u // GPIO17
-#define PIN_FUNCTION_P20 14u // GPIO20
-#define PIN_FUNCTION_P22 13u // GPIO22
-#define PIN_FUNCTION_P23 0u // GPIO23
-#define PIN_FUNCTION_P24 3u // GPIO24
-#define PIN_FUNCTION_P26 2u // GPIO26
-#define PIN_FUNCTION_PWM0 4u // GPIO6
-#define PIN_FUNCTION_PWM1 9u // GPIO7
-#define PIN_FUNCTION_PWM2 8u // GPIO8
-#define PIN_FUNCTION_PWM3 5u // GPIO9
-#define PIN_FUNCTION_PWM4 3u // GPIO24
-#define PIN_FUNCTION_PWM5 2u // GPIO26
-#define PIN_FUNCTION_RX1 10u // GPIO10
-#define PIN_FUNCTION_RX2 7u // GPIO1
-#define PIN_FUNCTION_SCK 1u // GPIO14
-#define PIN_FUNCTION_SCL1 14u // GPIO20
-#define PIN_FUNCTION_SCL2 6u // GPIO0
-#define PIN_FUNCTION_SDA2 7u // GPIO1
-#define PIN_FUNCTION_TX1 11u // GPIO11
-#define PIN_FUNCTION_TX2 6u // GPIO0
diff --git a/boards/generic-bk7231n-qfn32-tuya.json b/boards/generic-bk7231n-qfn32-tuya.json
index 127451a..03f346c 100644
--- a/boards/generic-bk7231n-qfn32-tuya.json
+++ b/boards/generic-bk7231n-qfn32-tuya.json
@@ -12,7 +12,7 @@
},
"name": "Generic - BK7231N (Tuya QFN32)",
"symbol": "BK7231N (Tuya QFN32)",
- "url": "https://kuba2k2.github.io/libretuya/boards/generic-bk7231n-qfn32-tuya/",
+ "url": "https://docs.libretiny.eu/boards/generic-bk7231n-qfn32-tuya/",
"vendor": "Generic",
"pcb": {
"pinout": {
diff --git a/boards/generic-bk7231n-qfn32-tuya/README.md b/boards/generic-bk7231n-qfn32-tuya/README.md
deleted file mode 100644
index a6a34c7..0000000
--- a/boards/generic-bk7231n-qfn32-tuya/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-# Generic - BK7231N (Tuya QFN32)
-
-*by Generic*
-
-[Product page](https://kuba2k2.github.io/libretuya/boards/generic-bk7231n-qfn32-tuya/)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `generic-bk7231n-qfn32-tuya`
-MCU | BK7231N
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 19x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.1
-
-## Usage
-
-**Board code:** `generic-bk7231n-qfn32-tuya`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-bk7231n-qfn32-tuya]
-platform = libretuya
-board = generic-bk7231n-qfn32-tuya
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-bk7231n-qfn32-tuya
- framework:
- version: dev
-```
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|------|------|------
-D0 | P0 | UART2_TX | I2C2_SCL | | |
-D1 | P1 | UART2_RX | I2C2_SDA | | |
-D2 | P6 | | | | PWM0 |
-D3 | P7 | | | | PWM1 |
-D4 | P8 | | | | PWM2 |
-D5 | P9 | | | | PWM3 |
-D6 | P10 | UART1_RX | | | |
-D7 | P11 | UART1_TX | | | |
-D8 | P14 | | | SCK | |
-D9 | P15 | | | CS | |
-D10 | P16 | | | MOSI | |
-D11 | P17 | | | MISO | |
-D12 | P20 | | I2C1_SCL | | | TCK
-D13 | P21 | | I2C1_SDA | | | TMS
-D14 | P22 | | | | | TDI
-D15 | P23 | | | | | TDO
-D16 | P24 | | | | PWM4 |
-D17 | P26 | | | | PWM5 |
-D18 | P28 | | | | |
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000
-OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000
-Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000
-Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000
-TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000
-Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000
-User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/generic-bk7231n-qfn32-tuya/pins_arduino.h b/boards/generic-bk7231n-qfn32-tuya/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-bk7231n-qfn32-tuya/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-bk7231n-qfn32-tuya/variant.h b/boards/generic-bk7231n-qfn32-tuya/variant.h
deleted file mode 100644
index 11cd0e6..0000000
--- a/boards/generic-bk7231n-qfn32-tuya/variant.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* This file was auto-generated from generic-bk7231n-qfn32-tuya.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 19
-#define NUM_DIGITAL_PINS 19
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 15u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE1_SCL 12u // GPIO20
-#define PIN_WIRE1_SDA 13u // GPIO21
-#define PIN_WIRE2_SCL 0u // GPIO0
-#define PIN_WIRE2_SDA 1u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 6u // GPIO10
-#define PIN_SERIAL1_TX 7u // GPIO11
-#define PIN_SERIAL2_RX 1u // GPIO1
-#define PIN_SERIAL2_TX 0u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 15u // GPIO23
-#define PIN_FUNCTION_CS 9u // GPIO15
-#define PIN_FUNCTION_MISO 11u // GPIO17
-#define PIN_FUNCTION_MOSI 10u // GPIO16
-#define PIN_FUNCTION_P0 0u // GPIO0
-#define PIN_FUNCTION_P1 1u // GPIO1
-#define PIN_FUNCTION_P6 2u // GPIO6
-#define PIN_FUNCTION_P7 3u // GPIO7
-#define PIN_FUNCTION_P8 4u // GPIO8
-#define PIN_FUNCTION_P9 5u // GPIO9
-#define PIN_FUNCTION_P10 6u // GPIO10
-#define PIN_FUNCTION_P11 7u // GPIO11
-#define PIN_FUNCTION_P14 8u // GPIO14
-#define PIN_FUNCTION_P15 9u // GPIO15
-#define PIN_FUNCTION_P16 10u // GPIO16
-#define PIN_FUNCTION_P17 11u // GPIO17
-#define PIN_FUNCTION_P20 12u // GPIO20
-#define PIN_FUNCTION_P21 13u // GPIO21
-#define PIN_FUNCTION_P22 14u // GPIO22
-#define PIN_FUNCTION_P23 15u // GPIO23
-#define PIN_FUNCTION_P24 16u // GPIO24
-#define PIN_FUNCTION_P26 17u // GPIO26
-#define PIN_FUNCTION_P28 18u // GPIO28
-#define PIN_FUNCTION_PWM0 2u // GPIO6
-#define PIN_FUNCTION_PWM1 3u // GPIO7
-#define PIN_FUNCTION_PWM2 4u // GPIO8
-#define PIN_FUNCTION_PWM3 5u // GPIO9
-#define PIN_FUNCTION_PWM4 16u // GPIO24
-#define PIN_FUNCTION_PWM5 17u // GPIO26
-#define PIN_FUNCTION_RX1 6u // GPIO10
-#define PIN_FUNCTION_RX2 1u // GPIO1
-#define PIN_FUNCTION_SCK 8u // GPIO14
-#define PIN_FUNCTION_SCL1 12u // GPIO20
-#define PIN_FUNCTION_SCL2 0u // GPIO0
-#define PIN_FUNCTION_SDA1 13u // GPIO21
-#define PIN_FUNCTION_SDA2 1u // GPIO1
-#define PIN_FUNCTION_TX1 7u // GPIO11
-#define PIN_FUNCTION_TX2 0u // GPIO0
diff --git a/boards/generic-bk7231t-qfn32-tuya.json b/boards/generic-bk7231t-qfn32-tuya.json
index 473efe5..d748612 100644
--- a/boards/generic-bk7231t-qfn32-tuya.json
+++ b/boards/generic-bk7231t-qfn32-tuya.json
@@ -12,7 +12,7 @@
},
"name": "Generic - BK7231T (Tuya QFN32)",
"symbol": "BK7231T (Tuya QFN32)",
- "url": "https://kuba2k2.github.io/libretuya/boards/generic-bk7231t-qfn32-tuya/",
+ "url": "https://docs.libretiny.eu/boards/generic-bk7231t-qfn32-tuya/",
"vendor": "Generic",
"pcb": {
"pinout": {
diff --git a/boards/generic-bk7231t-qfn32-tuya/README.md b/boards/generic-bk7231t-qfn32-tuya/README.md
deleted file mode 100644
index 8554058..0000000
--- a/boards/generic-bk7231t-qfn32-tuya/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-# Generic - BK7231T (Tuya QFN32)
-
-*by Generic*
-
-[Product page](https://kuba2k2.github.io/libretuya/boards/generic-bk7231t-qfn32-tuya/)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `generic-bk7231t-qfn32-tuya`
-MCU | BK7231T
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 19x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v4.2
-
-## Usage
-
-**Board code:** `generic-bk7231t-qfn32-tuya`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-bk7231t-qfn32-tuya]
-platform = libretuya
-board = generic-bk7231t-qfn32-tuya
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-bk7231t-qfn32-tuya
- framework:
- version: dev
-```
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|------|------|------
-D0 | P0 | UART2_TX | I2C2_SCL | | |
-D1 | P1 | UART2_RX | I2C2_SDA | | |
-D2 | P6 | | | | PWM0 |
-D3 | P7 | | | | PWM1 |
-D4 | P8 | | | | PWM2 |
-D5 | P9 | | | | PWM3 |
-D6 | P10 | UART1_RX | | | |
-D7 | P11 | UART1_TX | | | |
-D8 | P14 | | | SCK | |
-D9 | P15 | | | CS | |
-D10 | P16 | | | MOSI | |
-D11 | P17 | | | MISO | |
-D12 | P20 | | I2C1_SCL | | | TCK
-D13 | P21 | | I2C1_SDA | | | TMS
-D14 | P22 | | | | | TDI
-D15 | P23 | | | | | TDO
-D16 | P24 | | | | PWM4 |
-D17 | P26 | | | | PWM5 |
-D18 | P28 | | | | |
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000
-OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000
-Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000
-Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000
-TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000
-Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000
-User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/generic-bk7231t-qfn32-tuya/pins_arduino.h b/boards/generic-bk7231t-qfn32-tuya/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-bk7231t-qfn32-tuya/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-bk7231t-qfn32-tuya/variant.h b/boards/generic-bk7231t-qfn32-tuya/variant.h
deleted file mode 100644
index bf4e5ae..0000000
--- a/boards/generic-bk7231t-qfn32-tuya/variant.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* This file was auto-generated from generic-bk7231t-qfn32-tuya.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 19
-#define NUM_DIGITAL_PINS 19
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 15u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE1_SCL 12u // GPIO20
-#define PIN_WIRE1_SDA 13u // GPIO21
-#define PIN_WIRE2_SCL 0u // GPIO0
-#define PIN_WIRE2_SDA 1u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 6u // GPIO10
-#define PIN_SERIAL1_TX 7u // GPIO11
-#define PIN_SERIAL2_RX 1u // GPIO1
-#define PIN_SERIAL2_TX 0u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 15u // GPIO23
-#define PIN_FUNCTION_CS 9u // GPIO15
-#define PIN_FUNCTION_MISO 11u // GPIO17
-#define PIN_FUNCTION_MOSI 10u // GPIO16
-#define PIN_FUNCTION_P0 0u // GPIO0
-#define PIN_FUNCTION_P1 1u // GPIO1
-#define PIN_FUNCTION_P6 2u // GPIO6
-#define PIN_FUNCTION_P7 3u // GPIO7
-#define PIN_FUNCTION_P8 4u // GPIO8
-#define PIN_FUNCTION_P9 5u // GPIO9
-#define PIN_FUNCTION_P10 6u // GPIO10
-#define PIN_FUNCTION_P11 7u // GPIO11
-#define PIN_FUNCTION_P14 8u // GPIO14
-#define PIN_FUNCTION_P15 9u // GPIO15
-#define PIN_FUNCTION_P16 10u // GPIO16
-#define PIN_FUNCTION_P17 11u // GPIO17
-#define PIN_FUNCTION_P20 12u // GPIO20
-#define PIN_FUNCTION_P21 13u // GPIO21
-#define PIN_FUNCTION_P22 14u // GPIO22
-#define PIN_FUNCTION_P23 15u // GPIO23
-#define PIN_FUNCTION_P24 16u // GPIO24
-#define PIN_FUNCTION_P26 17u // GPIO26
-#define PIN_FUNCTION_P28 18u // GPIO28
-#define PIN_FUNCTION_PWM0 2u // GPIO6
-#define PIN_FUNCTION_PWM1 3u // GPIO7
-#define PIN_FUNCTION_PWM2 4u // GPIO8
-#define PIN_FUNCTION_PWM3 5u // GPIO9
-#define PIN_FUNCTION_PWM4 16u // GPIO24
-#define PIN_FUNCTION_PWM5 17u // GPIO26
-#define PIN_FUNCTION_RX1 6u // GPIO10
-#define PIN_FUNCTION_RX2 1u // GPIO1
-#define PIN_FUNCTION_SCK 8u // GPIO14
-#define PIN_FUNCTION_SCL1 12u // GPIO20
-#define PIN_FUNCTION_SCL2 0u // GPIO0
-#define PIN_FUNCTION_SDA1 13u // GPIO21
-#define PIN_FUNCTION_SDA2 1u // GPIO1
-#define PIN_FUNCTION_TX1 7u // GPIO11
-#define PIN_FUNCTION_TX2 0u // GPIO0
diff --git a/boards/generic-bk7252.json b/boards/generic-bk7252.json
index 2cc46fc..4705351 100644
--- a/boards/generic-bk7252.json
+++ b/boards/generic-bk7252.json
@@ -11,7 +11,7 @@
},
"name": "Generic - BK7252",
"symbol": "BK7252",
- "url": "https://kuba2k2.github.io/libretuya/boards/generic-bk7252/",
+ "url": "https://docs.libretiny.eu/boards/generic-bk7252/",
"vendor": "Generic",
"pcb": {
"pinout": {
diff --git a/boards/generic-bk7252/README.md b/boards/generic-bk7252/README.md
deleted file mode 100644
index 6517fed..0000000
--- a/boards/generic-bk7252/README.md
+++ /dev/null
@@ -1,112 +0,0 @@
-# Generic - BK7252
-
-*by Generic*
-
-[Product page](https://kuba2k2.github.io/libretuya/boards/generic-bk7252/)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `generic-bk7252`
-MCU | BK7252
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 180 MHz
-Flash size | 4 MiB
-RAM size | 512 KiB
-Voltage | 3.0V - 3.6V
-I/O | 38x GPIO, 4x PWM, 2x UART, 7x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.0
-
-## Usage
-
-**Board code:** `generic-bk7252`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-bk7252]
-platform = libretuya
-board = generic-bk7252
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-bk7252
- framework:
- version: dev
-```
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|-----------|----------|------|------|----------
-D0 | P0 | UART2_TX | I2C2_SCL | | |
-D1 | P1 | UART2_RX | I2C2_SDA | | |
-D2 | P2 | | | | |
-D3 | P3 | | | | |
-D4 | P4 | | | | |
-D5 | P5 | | | | |
-D6 | P6 | | | | PWM0 |
-D7 | P7 | | | | PWM1 |
-D8 | P10 | UART1_RX | | | |
-D9 | P11 | UART1_TX | | | |
-D10 | P12 | UART1_CTS | | | |
-D11 | P13 | UART1_RTS | | | |
-D12 | P14 | | | SCK | |
-D13 | P15 | | | CS | |
-D14 | P16 | | | MOSI | |
-D15 | P17 | | | MISO | |
-D16 | P18 | | | | |
-D17 | P19 | | | | |
-D18 | P20 | | I2C1_SCL | | | TCK
-D19 | P21 | | I2C1_SDA | | | TMS
-D20 | P22 | | | | | TDI
-D21 | P23 | | | | | TDO
-D22 | P24 | | | | PWM4 |
-D23 | P25 | | | | |
-D24 | P26 | | | | PWM5 |
-D25 | P27 | | | | | DVP_MCLK
-D26 | P28 | | | | |
-D27 | P29 | | | | | DVP_PCLK
-D28 | P30 | | | | | DVP_HSYNC
-D29 | P31 | | | | | DVP_VSYNC
-D30 | P32 | | | | | DVP_PD0
-D31 | P33 | | | | | DVP_PD1
-D32 | P34 | | | | | DVP_PD2
-D33 | P35 | | | | | DVP_PD3
-D34 | P36 | | | | | DVP_PD4
-D35 | P37 | | | | | DVP_PD5
-D36 | P38 | | | | | DVP_PD6
-D37 | P39 | | | | | DVP_PD7
-A1 | P4, ADC1 | | | | |
-A2 | P5, ADC2 | | | | |
-A3 | P23, ADC3 | | | | |
-A4 | P3, ADC5 | | | | |
-A5 | P2, ADC4 | | | | |
-A6 | P12, ADC6 | | | | |
-A7 | P13, ADC7 | | | | |
-
-## Flash memory map
-
-Flash size: 4 MiB / 4,194,304 B / 0x400000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.7 MiB / 0x1BA000 | 0x1CB000
-File System | 0x1CB000 | 1.1 MiB / 0x119000 | 0x2E4000
-Key-Value Store | 0x2E4000 | 32 KiB / 0x8000 | 0x2EC000
-OTA Image | 0x2EC000 | 1.1 MiB / 0x112000 | 0x3FE000
-Calibration | 0x3FE000 | 4 KiB / 0x1000 | 0x3FF000
-TLV Store | 0x3FF000 | 4 KiB / 0x1000 | 0x400000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/generic-bk7252/pins_arduino.h b/boards/generic-bk7252/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-bk7252/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-bk7252/variant.h b/boards/generic-bk7252/variant.h
deleted file mode 100644
index 47c4a52..0000000
--- a/boards/generic-bk7252/variant.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* This file was auto-generated from generic-bk7252.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 38
-#define NUM_DIGITAL_PINS 38
-#define NUM_ANALOG_INPUTS 7
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A5 2u // GPIO2
-#define PIN_A4 3u // GPIO3
-#define PIN_A1 4u // GPIO4
-#define PIN_A2 5u // GPIO5
-#define PIN_A6 10u // GPIO12
-#define PIN_A7 11u // GPIO13
-#define PIN_A3 21u // GPIO23
-#define A5 PIN_A5
-#define A4 PIN_A4
-#define A1 PIN_A1
-#define A2 PIN_A2
-#define A6 PIN_A6
-#define A7 PIN_A7
-#define A3 PIN_A3
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE1_SCL 18u // GPIO20
-#define PIN_WIRE1_SDA 19u // GPIO21
-#define PIN_WIRE2_SCL 0u // GPIO0
-#define PIN_WIRE2_SDA 1u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_CTS 10u // GPIO12
-#define PIN_SERIAL1_RTS 11u // GPIO13
-#define PIN_SERIAL1_RX 8u // GPIO10
-#define PIN_SERIAL1_TX 9u // GPIO11
-#define PIN_SERIAL2_RX 1u // GPIO1
-#define PIN_SERIAL2_TX 0u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 4u // GPIO4
-#define PIN_FUNCTION_ADC2 5u // GPIO5
-#define PIN_FUNCTION_ADC3 21u // GPIO23
-#define PIN_FUNCTION_ADC4 2u // GPIO2
-#define PIN_FUNCTION_ADC5 3u // GPIO3
-#define PIN_FUNCTION_ADC6 10u // GPIO12
-#define PIN_FUNCTION_ADC7 11u // GPIO13
-#define PIN_FUNCTION_CS 13u // GPIO15
-#define PIN_FUNCTION_CTS1 10u // GPIO12
-#define PIN_FUNCTION_MISO 15u // GPIO17
-#define PIN_FUNCTION_MOSI 14u // GPIO16
-#define PIN_FUNCTION_P0 0u // GPIO0
-#define PIN_FUNCTION_P1 1u // GPIO1
-#define PIN_FUNCTION_P2 2u // GPIO2
-#define PIN_FUNCTION_P3 3u // GPIO3
-#define PIN_FUNCTION_P4 4u // GPIO4
-#define PIN_FUNCTION_P5 5u // GPIO5
-#define PIN_FUNCTION_P6 6u // GPIO6
-#define PIN_FUNCTION_P7 7u // GPIO7
-#define PIN_FUNCTION_P10 8u // GPIO10
-#define PIN_FUNCTION_P11 9u // GPIO11
-#define PIN_FUNCTION_P12 10u // GPIO12
-#define PIN_FUNCTION_P13 11u // GPIO13
-#define PIN_FUNCTION_P14 12u // GPIO14
-#define PIN_FUNCTION_P15 13u // GPIO15
-#define PIN_FUNCTION_P16 14u // GPIO16
-#define PIN_FUNCTION_P17 15u // GPIO17
-#define PIN_FUNCTION_P18 16u // GPIO18
-#define PIN_FUNCTION_P19 17u // GPIO19
-#define PIN_FUNCTION_P20 18u // GPIO20
-#define PIN_FUNCTION_P21 19u // GPIO21
-#define PIN_FUNCTION_P22 20u // GPIO22
-#define PIN_FUNCTION_P23 21u // GPIO23
-#define PIN_FUNCTION_P24 22u // GPIO24
-#define PIN_FUNCTION_P25 23u // GPIO25
-#define PIN_FUNCTION_P26 24u // GPIO26
-#define PIN_FUNCTION_P27 25u // GPIO27
-#define PIN_FUNCTION_P28 26u // GPIO28
-#define PIN_FUNCTION_P29 27u // GPIO29
-#define PIN_FUNCTION_P30 28u // GPIO30
-#define PIN_FUNCTION_P31 29u // GPIO31
-#define PIN_FUNCTION_P32 30u // GPIO32
-#define PIN_FUNCTION_P33 31u // GPIO33
-#define PIN_FUNCTION_P34 32u // GPIO34
-#define PIN_FUNCTION_P35 33u // GPIO35
-#define PIN_FUNCTION_P36 34u // GPIO36
-#define PIN_FUNCTION_P37 35u // GPIO37
-#define PIN_FUNCTION_P38 36u // GPIO38
-#define PIN_FUNCTION_P39 37u // GPIO39
-#define PIN_FUNCTION_PWM0 6u // GPIO6
-#define PIN_FUNCTION_PWM1 7u // GPIO7
-#define PIN_FUNCTION_PWM4 22u // GPIO24
-#define PIN_FUNCTION_PWM5 24u // GPIO26
-#define PIN_FUNCTION_RTS1 11u // GPIO13
-#define PIN_FUNCTION_RX1 8u // GPIO10
-#define PIN_FUNCTION_RX2 1u // GPIO1
-#define PIN_FUNCTION_SCK 12u // GPIO14
-#define PIN_FUNCTION_SCL1 18u // GPIO20
-#define PIN_FUNCTION_SCL2 0u // GPIO0
-#define PIN_FUNCTION_SDA1 19u // GPIO21
-#define PIN_FUNCTION_SDA2 1u // GPIO1
-#define PIN_FUNCTION_TX1 9u // GPIO11
-#define PIN_FUNCTION_TX2 0u // GPIO0
diff --git a/boards/generic-native.json b/boards/generic-native.json
deleted file mode 100644
index 00dfd6e..0000000
--- a/boards/generic-native.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "build": {
- "family": "NATIVE",
- "mcu": "native",
- "f_cpu": "1000000000L",
- "variant": "generic-native"
- },
- "flash": {
- "bootloader": "0x000000+0x10000",
- "system": "0x010000+0x10000",
- "ota1": "0x020000+0x100000",
- "ota2": "0x120000+0x100000",
- "download": "0x220000+0x100000",
- "kvs": "0x320000+0x40000",
- "userdata": "0x360000+0xA0000"
- },
- "connectivity": [
- "wifi"
- ],
- "frameworks": [
- "host-native-sdk",
- "host-native-arduino"
- ],
- "upload": {
- "maximum_ram_size": 4194304,
- "flash_size": 4194304,
- "maximum_size": 1048576
- },
- "doc": {
- "params": {
- "manufacturer": "N/A",
- "series": "N/A",
- "voltage": "5V"
- },
- "extra": [
- "## Description",
- "`generic-native` is a dummy board using the `host-native` family, which also serves as a template for building new families, as well as for testing flash-related modules (i.e. Fat FS, OTA, etc)."
- ]
- },
- "name": "Generic - Host-native",
- "vendor": "N/A",
- "url": "https://kuba2k2.github.io/libretuya/",
- "symbol": "Native"
-}
diff --git a/boards/generic-native/README.md b/boards/generic-native/README.md
deleted file mode 100644
index 48a61a4..0000000
--- a/boards/generic-native/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# Generic - Host-native
-
-*by N/A*
-
-[Product page](https://kuba2k2.github.io/libretuya/)
-
-Parameter | Value
--------------|-----------------
-Board code | `generic-native`
-MCU | NATIVE
-Manufacturer | N/A
-Series | N/A
-Frequency | 1 GHz
-Flash size | 4 MiB
-RAM size | 4 MiB
-Voltage | 5V
-
-## Usage
-
-**Board code:** `generic-native`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-native]
-platform = libretuya
-board = generic-native
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-native
- framework:
- version: dev
-```
-
-## Flash memory map
-
-Flash size: 4 MiB / 4,194,304 B / 0x400000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Bootloader | 0x000000 | 64 KiB / 0x10000 | 0x010000
-System Data | 0x010000 | 64 KiB / 0x10000 | 0x020000
-OTA1 Image | 0x020000 | 1 MiB / 0x100000 | 0x120000
-OTA2 Image | 0x120000 | 1 MiB / 0x100000 | 0x220000
-OTA Image | 0x220000 | 1 MiB / 0x100000 | 0x320000
-Key-Value Store | 0x320000 | 256 KiB / 0x40000 | 0x360000
-User Data | 0x360000 | 640 KiB / 0xA0000 | 0x400000
-
-## Description
-
-`generic-native` is a dummy board using the `host-native` family, which also serves as a template for building new families, as well as for testing flash-related modules (i.e. Fat FS, OTA, etc).
diff --git a/boards/generic-native/pins_arduino.h b/boards/generic-native/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-native/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-native/variant.h b/boards/generic-native/variant.h
deleted file mode 100644
index 4c3b6cd..0000000
--- a/boards/generic-native/variant.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* This file was auto-generated from generic-native.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
diff --git a/boards/generic-rtl8710bn-2mb-468k.json b/boards/generic-rtl8710bn-2mb-468k.json
index 06148fe..c3206b8 100644
--- a/boards/generic-rtl8710bn-2mb-468k.json
+++ b/boards/generic-rtl8710bn-2mb-468k.json
@@ -11,7 +11,7 @@
},
"name": "Generic - RTL8710BN (2M/468k)",
"symbol": "RTL8710BN (2M/468k)",
- "url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-468k/",
+ "url": "https://docs.libretiny.eu/boards/generic-rtl8710bn-2mb-468k/",
"vendor": "Generic",
"pcb": {
"pinout": {
diff --git a/boards/generic-rtl8710bn-2mb-468k/README.md b/boards/generic-rtl8710bn-2mb-468k/README.md
deleted file mode 100644
index 8d692ca..0000000
--- a/boards/generic-rtl8710bn-2mb-468k/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# Generic - RTL8710BN (2M/468k)
-
-*by Generic*
-
-[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-468k/)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `generic-rtl8710bn-2mb-468k`
-MCU | RTL8710BN
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 125 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 17x GPIO, 6x PWM, 2x UART, 2x ADC
-Wi-Fi | 802.11 b/g/n
-
-## Usage
-
-**Board code:** `generic-rtl8710bn-2mb-468k`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-rtl8710bn-2mb-468k]
-platform = libretuya
-board = generic-rtl8710bn-2mb-468k
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-rtl8710bn-2mb-468k
- framework:
- version: dev
-```
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA00 | | | | PWM2 |
-D1 | PA05 | | | | PWM4 |
-D2 | PA06 | | | FCS | |
-D3 | PA07 | | | FD1 | |
-D4 | PA08 | | | FD2 | |
-D5 | PA09 | | | FD0 | |
-D6 | PA10 | | | FSCK | |
-D7 | PA11 | | | FD3 | |
-D8 | PA12 | | | | PWM3 |
-D9 | PA14 | | | | PWM0 | SWCLK
-D10 | PA15 | | | | PWM1 | SWDIO
-D11 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D12 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D13 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D14 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-D15 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D16 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-A0 | PA19, ADC1 | | | | |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 468 KiB / 0x75000 | 0x080000
-OTA2 Image | 0x080000 | 468 KiB / 0x75000 | 0x0F5000
-Key-Value Store | 0x0F5000 | 24 KiB / 0x6000 | 0x0FB000
-User Data | 0x0FB000 | 1 MiB / 0x104000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/generic-rtl8710bn-2mb-468k/pins_arduino.h b/boards/generic-rtl8710bn-2mb-468k/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-rtl8710bn-2mb-468k/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-rtl8710bn-2mb-468k/variant.h b/boards/generic-rtl8710bn-2mb-468k/variant.h
deleted file mode 100644
index 8906bd4..0000000
--- a/boards/generic-rtl8710bn-2mb-468k/variant.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* This file was auto-generated from generic-rtl8710bn-2mb-468k.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 18
-#define NUM_DIGITAL_PINS 17
-#define NUM_ANALOG_INPUTS 2
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 12u // PA_19
-#define PIN_A1 17u // AD_2
-#define A0 PIN_A0
-#define A1 PIN_A1
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 12u // PA_19
-#define PIN_SPI0_MISO 13u // PA_22
-#define PIN_SPI0_MOSI 14u // PA_23
-#define PIN_SPI0_SCK 11u // PA_18
-#define PIN_SPI1_CS 12u // PA_19
-#define PIN_SPI1_MISO 13u // PA_22
-#define PIN_SPI1_MOSI 14u // PA_23
-#define PIN_SPI1_SCK 11u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 13u // PA_22
-#define PIN_WIRE0_SCL_1 15u // PA_29
-#define PIN_WIRE0_SDA_0 12u // PA_19
-#define PIN_WIRE0_SDA_1 16u // PA_30
-#define PIN_WIRE1_SCL 11u // PA_18
-#define PIN_WIRE1_SDA 14u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 12u // PA_19
-#define PIN_SERIAL0_RTS 13u // PA_22
-#define PIN_SERIAL0_RX 11u // PA_18
-#define PIN_SERIAL0_TX 14u // PA_23
-#define PIN_SERIAL2_RX 15u // PA_29
-#define PIN_SERIAL2_TX 16u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 12u // PA_19
-#define PIN_FUNCTION_ADC2 17u // AD_2
-#define PIN_FUNCTION_CS0 12u // PA_19
-#define PIN_FUNCTION_CS1 12u // PA_19
-#define PIN_FUNCTION_CTS0 12u // PA_19
-#define PIN_FUNCTION_FCS 2u // PA_6
-#define PIN_FUNCTION_FD0 5u // PA_9
-#define PIN_FUNCTION_FD1 3u // PA_7
-#define PIN_FUNCTION_FD2 4u // PA_8
-#define PIN_FUNCTION_FD3 7u // PA_11
-#define PIN_FUNCTION_FSCK 6u // PA_10
-#define PIN_FUNCTION_MISO0 13u // PA_22
-#define PIN_FUNCTION_MISO1 13u // PA_22
-#define PIN_FUNCTION_MOSI0 14u // PA_23
-#define PIN_FUNCTION_MOSI1 14u // PA_23
-#define PIN_FUNCTION_PA00 0u // PA_0
-#define PIN_FUNCTION_PA05 1u // PA_5
-#define PIN_FUNCTION_PA06 2u // PA_6
-#define PIN_FUNCTION_PA07 3u // PA_7
-#define PIN_FUNCTION_PA08 4u // PA_8
-#define PIN_FUNCTION_PA09 5u // PA_9
-#define PIN_FUNCTION_PA10 6u // PA_10
-#define PIN_FUNCTION_PA11 7u // PA_11
-#define PIN_FUNCTION_PA12 8u // PA_12
-#define PIN_FUNCTION_PA14 9u // PA_14
-#define PIN_FUNCTION_PA15 10u // PA_15
-#define PIN_FUNCTION_PA18 11u // PA_18
-#define PIN_FUNCTION_PA19 12u // PA_19
-#define PIN_FUNCTION_PA22 13u // PA_22
-#define PIN_FUNCTION_PA23 14u // PA_23
-#define PIN_FUNCTION_PA29 15u // PA_29
-#define PIN_FUNCTION_PA30 16u // PA_30
-#define PIN_FUNCTION_RTS0 13u // PA_22
-#define PIN_FUNCTION_RX0 11u // PA_18
-#define PIN_FUNCTION_RX2 15u // PA_29
-#define PIN_FUNCTION_SCK0 11u // PA_18
-#define PIN_FUNCTION_SCK1 11u // PA_18
-#define PIN_FUNCTION_TX0 14u // PA_23
-#define PIN_FUNCTION_TX2 16u // PA_30
diff --git a/boards/generic-rtl8710bn-2mb-788k.json b/boards/generic-rtl8710bn-2mb-788k.json
index d9d9305..a4b8dcc 100644
--- a/boards/generic-rtl8710bn-2mb-788k.json
+++ b/boards/generic-rtl8710bn-2mb-788k.json
@@ -11,7 +11,7 @@
},
"name": "Generic - RTL8710BN (2M/788k)",
"symbol": "RTL8710BN (2M/788k)",
- "url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-788k/",
+ "url": "https://docs.libretiny.eu/boards/generic-rtl8710bn-2mb-788k/",
"vendor": "Generic",
"pcb": {
"pinout": {
diff --git a/boards/generic-rtl8710bn-2mb-788k/README.md b/boards/generic-rtl8710bn-2mb-788k/README.md
deleted file mode 100644
index d2d7c83..0000000
--- a/boards/generic-rtl8710bn-2mb-788k/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# Generic - RTL8710BN (2M/788k)
-
-*by Generic*
-
-[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-788k/)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `generic-rtl8710bn-2mb-788k`
-MCU | RTL8710BN
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 125 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 17x GPIO, 6x PWM, 2x UART, 2x ADC
-Wi-Fi | 802.11 b/g/n
-
-## Usage
-
-**Board code:** `generic-rtl8710bn-2mb-788k`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-rtl8710bn-2mb-788k]
-platform = libretuya
-board = generic-rtl8710bn-2mb-788k
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-rtl8710bn-2mb-788k
- framework:
- version: dev
-```
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA00 | | | | PWM2 |
-D1 | PA05 | | | | PWM4 |
-D2 | PA06 | | | FCS | |
-D3 | PA07 | | | FD1 | |
-D4 | PA08 | | | FD2 | |
-D5 | PA09 | | | FD0 | |
-D6 | PA10 | | | FSCK | |
-D7 | PA11 | | | FD3 | |
-D8 | PA12 | | | | PWM3 |
-D9 | PA14 | | | | PWM0 | SWCLK
-D10 | PA15 | | | | PWM1 | SWDIO
-D11 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D12 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D13 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D14 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-D15 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D16 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-A0 | PA19, ADC1 | | | | |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/generic-rtl8710bn-2mb-788k/pins_arduino.h b/boards/generic-rtl8710bn-2mb-788k/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-rtl8710bn-2mb-788k/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-rtl8710bn-2mb-788k/variant.h b/boards/generic-rtl8710bn-2mb-788k/variant.h
deleted file mode 100644
index cf285a0..0000000
--- a/boards/generic-rtl8710bn-2mb-788k/variant.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* This file was auto-generated from generic-rtl8710bn-2mb-788k.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 18
-#define NUM_DIGITAL_PINS 17
-#define NUM_ANALOG_INPUTS 2
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 12u // PA_19
-#define PIN_A1 17u // AD_2
-#define A0 PIN_A0
-#define A1 PIN_A1
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 12u // PA_19
-#define PIN_SPI0_MISO 13u // PA_22
-#define PIN_SPI0_MOSI 14u // PA_23
-#define PIN_SPI0_SCK 11u // PA_18
-#define PIN_SPI1_CS 12u // PA_19
-#define PIN_SPI1_MISO 13u // PA_22
-#define PIN_SPI1_MOSI 14u // PA_23
-#define PIN_SPI1_SCK 11u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 13u // PA_22
-#define PIN_WIRE0_SCL_1 15u // PA_29
-#define PIN_WIRE0_SDA_0 12u // PA_19
-#define PIN_WIRE0_SDA_1 16u // PA_30
-#define PIN_WIRE1_SCL 11u // PA_18
-#define PIN_WIRE1_SDA 14u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 12u // PA_19
-#define PIN_SERIAL0_RTS 13u // PA_22
-#define PIN_SERIAL0_RX 11u // PA_18
-#define PIN_SERIAL0_TX 14u // PA_23
-#define PIN_SERIAL2_RX 15u // PA_29
-#define PIN_SERIAL2_TX 16u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 12u // PA_19
-#define PIN_FUNCTION_ADC2 17u // AD_2
-#define PIN_FUNCTION_CS0 12u // PA_19
-#define PIN_FUNCTION_CS1 12u // PA_19
-#define PIN_FUNCTION_CTS0 12u // PA_19
-#define PIN_FUNCTION_FCS 2u // PA_6
-#define PIN_FUNCTION_FD0 5u // PA_9
-#define PIN_FUNCTION_FD1 3u // PA_7
-#define PIN_FUNCTION_FD2 4u // PA_8
-#define PIN_FUNCTION_FD3 7u // PA_11
-#define PIN_FUNCTION_FSCK 6u // PA_10
-#define PIN_FUNCTION_MISO0 13u // PA_22
-#define PIN_FUNCTION_MISO1 13u // PA_22
-#define PIN_FUNCTION_MOSI0 14u // PA_23
-#define PIN_FUNCTION_MOSI1 14u // PA_23
-#define PIN_FUNCTION_PA00 0u // PA_0
-#define PIN_FUNCTION_PA05 1u // PA_5
-#define PIN_FUNCTION_PA06 2u // PA_6
-#define PIN_FUNCTION_PA07 3u // PA_7
-#define PIN_FUNCTION_PA08 4u // PA_8
-#define PIN_FUNCTION_PA09 5u // PA_9
-#define PIN_FUNCTION_PA10 6u // PA_10
-#define PIN_FUNCTION_PA11 7u // PA_11
-#define PIN_FUNCTION_PA12 8u // PA_12
-#define PIN_FUNCTION_PA14 9u // PA_14
-#define PIN_FUNCTION_PA15 10u // PA_15
-#define PIN_FUNCTION_PA18 11u // PA_18
-#define PIN_FUNCTION_PA19 12u // PA_19
-#define PIN_FUNCTION_PA22 13u // PA_22
-#define PIN_FUNCTION_PA23 14u // PA_23
-#define PIN_FUNCTION_PA29 15u // PA_29
-#define PIN_FUNCTION_PA30 16u // PA_30
-#define PIN_FUNCTION_RTS0 13u // PA_22
-#define PIN_FUNCTION_RX0 11u // PA_18
-#define PIN_FUNCTION_RX2 15u // PA_29
-#define PIN_FUNCTION_SCK0 11u // PA_18
-#define PIN_FUNCTION_SCK1 11u // PA_18
-#define PIN_FUNCTION_TX0 14u // PA_23
-#define PIN_FUNCTION_TX2 16u // PA_30
diff --git a/boards/generic-rtl8710bx-4mb-980k.json b/boards/generic-rtl8710bx-4mb-980k.json
index 5f40241..4168c7e 100644
--- a/boards/generic-rtl8710bx-4mb-980k.json
+++ b/boards/generic-rtl8710bx-4mb-980k.json
@@ -12,13 +12,13 @@
},
"name": "Generic - RTL8710BX (4M/980k)",
"symbol": "RTL8710BX (4M/980k)",
- "url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bx-4mb-980k/",
+ "url": "https://docs.libretiny.eu/boards/generic-rtl8710bx-4mb-980k/",
"vendor": "Generic",
"doc": {
"extra": [
"## Information",
"This is a generic board definition for RTL8710BX with 4 MiB of flash. It has a bigger application partition size (980 KiB). The used bootloader is also different from the standard Tuya one.",
- "It can be found in [Ezviz T31 smart plug](https://www.ezviz.com/product/T31/2021) - bare chip soldered onto the manufacturer-made PCB. The plug is not Tuya/SmartLife-compatible and has a 25Q32CSIG flash chip. Refer to [libretuya#23](https://github.com/kuba2k2/libretuya/issues/23) for photos and more information.",
+ "It can be found in [Ezviz T31 smart plug](https://www.ezviz.com/product/T31/2021) - bare chip soldered onto the manufacturer-made PCB. The plug is not Tuya/SmartLife-compatible and has a 25Q32CSIG flash chip. Refer to [libretiny#23](https://github.com/kuba2k2/libretiny/issues/23) for photos and more information.",
"Note that stock firmware seems to use smaller app images (0x80000 / 512 KiB). After 0x180000 some product-test data and device logs can be found. Because the OTA2 offset is 0x100000, the board definition was configured to use all available space."
]
},
diff --git a/boards/generic-rtl8710bx-4mb-980k/README.md b/boards/generic-rtl8710bx-4mb-980k/README.md
deleted file mode 100644
index 403467d..0000000
--- a/boards/generic-rtl8710bx-4mb-980k/README.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# Generic - RTL8710BX (4M/980k)
-
-*by Generic*
-
-[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bx-4mb-980k/)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `generic-rtl8710bx-4mb-980k`
-MCU | RTL8710BX
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 62.5 MHz
-Flash size | 4 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 17x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-
-## Usage
-
-**Board code:** `generic-rtl8710bx-4mb-980k`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-rtl8710bx-4mb-980k]
-platform = libretuya
-board = generic-rtl8710bx-4mb-980k
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-rtl8710bx-4mb-980k
- framework:
- version: dev
-```
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA00 | | | | PWM2 |
-D1 | PA05 | | | | PWM4 |
-D2 | PA06 | | | FCS | |
-D3 | PA07 | | | FD1 | |
-D4 | PA08 | | | FD2 | |
-D5 | PA09 | | | FD0 | |
-D6 | PA10 | | | FSCK | |
-D7 | PA11 | | | FD3 | |
-D8 | PA12 | | | | PWM3 |
-D9 | PA14 | | | | PWM0 | SWCLK
-D10 | PA15 | | | | PWM1 | SWDIO
-D11 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D12 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D13 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D14 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-D15 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D16 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-A0 | PA19, ADC1 | | | | |
-
-## Flash memory map
-
-Flash size: 4 MiB / 4,194,304 B / 0x400000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 980 KiB / 0xF5000 | 0x100000
-OTA2 Image | 0x100000 | 980 KiB / 0xF5000 | 0x1F5000
-Key-Value Store | 0x1F5000 | 32 KiB / 0x8000 | 0x1FD000
-User Data | 0x1FD000 | 2 MiB / 0x202000 | 0x3FF000
-RDP | 0x3FF000 | 4 KiB / 0x1000 | 0x400000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
-
-## Information
-
-This is a generic board definition for RTL8710BX with 4 MiB of flash. It has a bigger application partition size (980 KiB). The used bootloader is also different from the standard Tuya one.
-
-It can be found in [Ezviz T31 smart plug](https://www.ezviz.com/product/T31/2021) - bare chip soldered onto the manufacturer-made PCB. The plug is not Tuya/SmartLife-compatible and has a 25Q32CSIG flash chip. Refer to [libretuya#23](https://github.com/kuba2k2/libretuya/issues/23) for photos and more information.
-
-Note that stock firmware seems to use smaller app images (0x80000 / 512 KiB). After 0x180000 some product-test data and device logs can be found. Because the OTA2 offset is 0x100000, the board definition was configured to use all available space.
diff --git a/boards/generic-rtl8710bx-4mb-980k/pins_arduino.h b/boards/generic-rtl8710bx-4mb-980k/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-rtl8710bx-4mb-980k/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-rtl8710bx-4mb-980k/variant.h b/boards/generic-rtl8710bx-4mb-980k/variant.h
deleted file mode 100644
index dab27a9..0000000
--- a/boards/generic-rtl8710bx-4mb-980k/variant.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* This file was auto-generated from generic-rtl8710bx-4mb-980k.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 17
-#define NUM_DIGITAL_PINS 17
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 12u // PA_19
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 12u // PA_19
-#define PIN_SPI0_MISO 13u // PA_22
-#define PIN_SPI0_MOSI 14u // PA_23
-#define PIN_SPI0_SCK 11u // PA_18
-#define PIN_SPI1_CS 12u // PA_19
-#define PIN_SPI1_MISO 13u // PA_22
-#define PIN_SPI1_MOSI 14u // PA_23
-#define PIN_SPI1_SCK 11u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 13u // PA_22
-#define PIN_WIRE0_SCL_1 15u // PA_29
-#define PIN_WIRE0_SDA_0 12u // PA_19
-#define PIN_WIRE0_SDA_1 16u // PA_30
-#define PIN_WIRE1_SCL 11u // PA_18
-#define PIN_WIRE1_SDA 14u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 12u // PA_19
-#define PIN_SERIAL0_RTS 13u // PA_22
-#define PIN_SERIAL0_RX 11u // PA_18
-#define PIN_SERIAL0_TX 14u // PA_23
-#define PIN_SERIAL2_RX 15u // PA_29
-#define PIN_SERIAL2_TX 16u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 12u // PA_19
-#define PIN_FUNCTION_CS0 12u // PA_19
-#define PIN_FUNCTION_CS1 12u // PA_19
-#define PIN_FUNCTION_CTS0 12u // PA_19
-#define PIN_FUNCTION_FCS 2u // PA_6
-#define PIN_FUNCTION_FD0 5u // PA_9
-#define PIN_FUNCTION_FD1 3u // PA_7
-#define PIN_FUNCTION_FD2 4u // PA_8
-#define PIN_FUNCTION_FD3 7u // PA_11
-#define PIN_FUNCTION_FSCK 6u // PA_10
-#define PIN_FUNCTION_MISO0 13u // PA_22
-#define PIN_FUNCTION_MISO1 13u // PA_22
-#define PIN_FUNCTION_MOSI0 14u // PA_23
-#define PIN_FUNCTION_MOSI1 14u // PA_23
-#define PIN_FUNCTION_PA00 0u // PA_0
-#define PIN_FUNCTION_PA05 1u // PA_5
-#define PIN_FUNCTION_PA06 2u // PA_6
-#define PIN_FUNCTION_PA07 3u // PA_7
-#define PIN_FUNCTION_PA08 4u // PA_8
-#define PIN_FUNCTION_PA09 5u // PA_9
-#define PIN_FUNCTION_PA10 6u // PA_10
-#define PIN_FUNCTION_PA11 7u // PA_11
-#define PIN_FUNCTION_PA12 8u // PA_12
-#define PIN_FUNCTION_PA14 9u // PA_14
-#define PIN_FUNCTION_PA15 10u // PA_15
-#define PIN_FUNCTION_PA18 11u // PA_18
-#define PIN_FUNCTION_PA19 12u // PA_19
-#define PIN_FUNCTION_PA22 13u // PA_22
-#define PIN_FUNCTION_PA23 14u // PA_23
-#define PIN_FUNCTION_PA29 15u // PA_29
-#define PIN_FUNCTION_PA30 16u // PA_30
-#define PIN_FUNCTION_RTS0 13u // PA_22
-#define PIN_FUNCTION_RX0 11u // PA_18
-#define PIN_FUNCTION_RX2 15u // PA_29
-#define PIN_FUNCTION_SCK0 11u // PA_18
-#define PIN_FUNCTION_SCK1 11u // PA_18
-#define PIN_FUNCTION_TX0 14u // PA_23
-#define PIN_FUNCTION_TX2 16u // PA_30
diff --git a/boards/generic-rtl8720cf-2mb-992k.json b/boards/generic-rtl8720cf-2mb-992k.json
index c1f79ef..c187d41 100644
--- a/boards/generic-rtl8720cf-2mb-992k.json
+++ b/boards/generic-rtl8720cf-2mb-992k.json
@@ -12,7 +12,7 @@
},
"name": "Generic - RTL8720CF (2M/992k)",
"symbol": "RTL8720CF (2M/992k)",
- "url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8720cf-2mb-992k/",
+ "url": "https://docs.libretiny.eu/boards/generic-rtl8720cf-2mb-992k/",
"vendor": "Generic",
"pcb": {
"pinout": {
diff --git a/boards/generic-rtl8720cf-2mb-992k/README.md b/boards/generic-rtl8720cf-2mb-992k/README.md
deleted file mode 100644
index bab705c..0000000
--- a/boards/generic-rtl8720cf-2mb-992k/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# Generic - RTL8720CF (2M/992k)
-
-*by Generic*
-
-[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8720cf-2mb-992k/)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-
-Parameter | Value
--------------|-----------------------------
-Board code | `generic-rtl8720cf-2mb-992k`
-MCU | RTL8720CF
-Manufacturer | Realtek
-Series | AmebaZ2
-Frequency | 100 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 20x GPIO, 8x PWM, 3x UART
-Wi-Fi | 802.11 b/g/n
-BLE | v4.2
-
-## Usage
-
-**Board code:** `generic-rtl8720cf-2mb-992k`
-
-In `platformio.ini`:
-
-```ini
-[env:generic-rtl8720cf-2mb-992k]
-platform = libretuya
-board = generic-rtl8720cf-2mb-992k
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: generic-rtl8720cf-2mb-992k
- framework:
- version: dev
-```
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Partition Table | 0x000000 | 4 KiB / 0x1000 | 0x001000
-System Data | 0x001000 | 4 KiB / 0x1000 | 0x002000
-Calibration | 0x002000 | 4 KiB / 0x1000 | 0x003000
-(reserved) | 0x003000 | 4 KiB / 0x1000 | 0x004000
-Boot Image | 0x004000 | 32 KiB / 0x8000 | 0x00C000
-OTA1 Image | 0x00C000 | 992 KiB / 0xF8000 | 0x104000
-OTA2 Image | 0x104000 | 992 KiB / 0xF8000 | 0x1FC000
-Key-Value Store | 0x1FC000 | 8 KiB / 0x2000 | 0x1FE000
-User Data | 0x1FE000 | 8 KiB / 0x2000 | 0x200000
diff --git a/boards/generic-rtl8720cf-2mb-992k/pins_arduino.h b/boards/generic-rtl8720cf-2mb-992k/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/generic-rtl8720cf-2mb-992k/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/generic-rtl8720cf-2mb-992k/variant.h b/boards/generic-rtl8720cf-2mb-992k/variant.h
deleted file mode 100644
index 9cd90ec..0000000
--- a/boards/generic-rtl8720cf-2mb-992k/variant.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* This file was auto-generated from generic-rtl8720cf-2mb-992k.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
diff --git a/boards/lsc-lma35-t/README.md b/boards/lsc-lma35-t/README.md
deleted file mode 100644
index df042fc..0000000
--- a/boards/lsc-lma35-t/README.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# LSC LMA35 BK7231T
-
-*by Unknown*
-
-[Product page](https://www.action.com/de-at/p/lsc-smart-connect-outdoor-led-streifen/)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `lsc-lma35-t`
-MCU | BK7231T
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 15x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v4.2
-
-## Usage
-
-**Board code:** `lsc-lma35-t`
-
-In `platformio.ini`:
-
-```ini
-[env:lsc-lma35-t]
-platform = libretuya
-board = lsc-lma35-t
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: lsc-lma35-t
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|------|------|------
-D0 | P26 | | | | PWM5 |
-D1 | P14 | | | SCK | |
-D2 | P16 | | | MOSI | |
-D3 | P24 | | | | PWM4 |
-D4 | P22 | | | | | TDI
-D5 | P0 | UART2_TX | I2C2_SCL | | |
-D6 | P23 | | | | | TDO
-D7 | P8 | | | | PWM2 |
-D8 | P9 | | | | PWM3 |
-D9 | P21 | | I2C1_SDA | | | TMS
-D10 | P6 | | | | PWM0 |
-D11 | P7 | | | | PWM1 |
-D12 | P10 | UART1_RX | | | |
-D13 | P11 | UART1_TX | | | |
-D14 | P1 | UART2_RX | I2C2_SDA | | |
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000
-OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000
-Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000
-Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000
-TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000
-Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000
-User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
-
-## Information
-
-This board has no marking on the front side, only something that looks like PCB manufacturing info on the back; thus it was named based on these symbols.
-
-It can be found in 'LSC Smart Connect Outdoor LED Strip', and is likely custom-made for this product.
-
-The pinout was established by writing to and probing consecutive GPIOs, using the generic board definition.
-
-Pins marked with '?' are currently unknown, with a possibility of being CEN. Pin 22 (P1/D14) is also not confirmed.
diff --git a/boards/lsc-lma35-t/pinout_lsc-lma35-t.svg b/boards/lsc-lma35-t/pinout_lsc-lma35-t.svg
deleted file mode 100644
index 3d02d8c..0000000
--- a/boards/lsc-lma35-t/pinout_lsc-lma35-t.svg
+++ /dev/null
@@ -1,325 +0,0 @@
-
-
diff --git a/boards/lsc-lma35-t/pins_arduino.h b/boards/lsc-lma35-t/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/lsc-lma35-t/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/lsc-lma35-t/variant.h b/boards/lsc-lma35-t/variant.h
deleted file mode 100644
index 7fff860..0000000
--- a/boards/lsc-lma35-t/variant.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* This file was auto-generated from lsc-lma35-t.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 15
-#define NUM_DIGITAL_PINS 15
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 6u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 1
-#define PIN_WIRE2_SCL 5u // GPIO0
-#define PIN_WIRE2_SDA 14u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 12u // GPIO10
-#define PIN_SERIAL1_TX 13u // GPIO11
-#define PIN_SERIAL2_RX 14u // GPIO1
-#define PIN_SERIAL2_TX 5u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 6u // GPIO23
-#define PIN_FUNCTION_MOSI 2u // GPIO16
-#define PIN_FUNCTION_P0 5u // GPIO0
-#define PIN_FUNCTION_P1 14u // GPIO1
-#define PIN_FUNCTION_P6 10u // GPIO6
-#define PIN_FUNCTION_P7 11u // GPIO7
-#define PIN_FUNCTION_P8 7u // GPIO8
-#define PIN_FUNCTION_P9 8u // GPIO9
-#define PIN_FUNCTION_P10 12u // GPIO10
-#define PIN_FUNCTION_P11 13u // GPIO11
-#define PIN_FUNCTION_P14 1u // GPIO14
-#define PIN_FUNCTION_P16 2u // GPIO16
-#define PIN_FUNCTION_P21 9u // GPIO21
-#define PIN_FUNCTION_P22 4u // GPIO22
-#define PIN_FUNCTION_P23 6u // GPIO23
-#define PIN_FUNCTION_P24 3u // GPIO24
-#define PIN_FUNCTION_P26 0u // GPIO26
-#define PIN_FUNCTION_PWM0 10u // GPIO6
-#define PIN_FUNCTION_PWM1 11u // GPIO7
-#define PIN_FUNCTION_PWM2 7u // GPIO8
-#define PIN_FUNCTION_PWM3 8u // GPIO9
-#define PIN_FUNCTION_PWM4 3u // GPIO24
-#define PIN_FUNCTION_PWM5 0u // GPIO26
-#define PIN_FUNCTION_RX1 12u // GPIO10
-#define PIN_FUNCTION_RX2 14u // GPIO1
-#define PIN_FUNCTION_SCK 1u // GPIO14
-#define PIN_FUNCTION_SCL2 5u // GPIO0
-#define PIN_FUNCTION_SDA1 9u // GPIO21
-#define PIN_FUNCTION_SDA2 14u // GPIO1
-#define PIN_FUNCTION_TX1 13u // GPIO11
-#define PIN_FUNCTION_TX2 5u // GPIO0
diff --git a/boards/lsc-lma35/README.md b/boards/lsc-lma35/README.md
deleted file mode 100644
index 9065734..0000000
--- a/boards/lsc-lma35/README.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# LSC LMA35
-
-*by Unknown*
-
-[Product page](https://www.action.com/de-at/p/lsc-smart-connect-outdoor-led-streifen/)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|----------------------------------
-Board code | `lsc-lma35`
-MCU | BK7231N
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 15x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v5.1
-
-## Usage
-
-**Board code:** `lsc-lma35`
-
-In `platformio.ini`:
-
-```ini
-[env:lsc-lma35]
-platform = libretuya
-board = lsc-lma35
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: lsc-lma35
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|------|------|------
-D0 | P26 | | | | PWM5 |
-D1 | P14 | | | SCK | |
-D2 | P16 | | | MOSI | |
-D3 | P24 | | | | PWM4 |
-D4 | P22 | | | | | TDI
-D5 | P0 | UART2_TX | I2C2_SCL | | |
-D6 | P23 | | | | | TDO
-D7 | P8 | | | | PWM2 |
-D8 | P9 | | | | PWM3 |
-D9 | P21 | | I2C1_SDA | | | TMS
-D10 | P6 | | | | PWM0 |
-D11 | P7 | | | | PWM1 |
-D12 | P10 | UART1_RX | | | |
-D13 | P11 | UART1_TX | | | |
-D14 | P1 | UART2_RX | I2C2_SDA | | |
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000
-OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000
-Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000
-Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000
-TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000
-Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000
-User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
-
-## Information
-
-This board has no marking on the front side, only something that looks like PCB manufacturing info on the back; thus it was named based on these symbols.
-
-It can be found in 'LSC Smart Connect Outdoor LED Strip', and is likely custom-made for this product.
-
-The pinout was established by writing to and probing consecutive GPIOs, using the generic board definition.
-
-Pins marked with '?' are currently unknown, with a possibility of being CEN. Pin 22 (P1/D14) is also not confirmed.
diff --git a/boards/lsc-lma35/pinout_lsc-lma35.svg b/boards/lsc-lma35/pinout_lsc-lma35.svg
deleted file mode 100644
index 3d02d8c..0000000
--- a/boards/lsc-lma35/pinout_lsc-lma35.svg
+++ /dev/null
@@ -1,325 +0,0 @@
-
-
diff --git a/boards/lsc-lma35/pins_arduino.h b/boards/lsc-lma35/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/lsc-lma35/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/lsc-lma35/variant.h b/boards/lsc-lma35/variant.h
deleted file mode 100644
index 0fb2fa1..0000000
--- a/boards/lsc-lma35/variant.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* This file was auto-generated from lsc-lma35.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 15
-#define NUM_DIGITAL_PINS 15
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 6u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 1
-#define PIN_WIRE2_SCL 5u // GPIO0
-#define PIN_WIRE2_SDA 14u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 12u // GPIO10
-#define PIN_SERIAL1_TX 13u // GPIO11
-#define PIN_SERIAL2_RX 14u // GPIO1
-#define PIN_SERIAL2_TX 5u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 6u // GPIO23
-#define PIN_FUNCTION_MOSI 2u // GPIO16
-#define PIN_FUNCTION_P0 5u // GPIO0
-#define PIN_FUNCTION_P1 14u // GPIO1
-#define PIN_FUNCTION_P6 10u // GPIO6
-#define PIN_FUNCTION_P7 11u // GPIO7
-#define PIN_FUNCTION_P8 7u // GPIO8
-#define PIN_FUNCTION_P9 8u // GPIO9
-#define PIN_FUNCTION_P10 12u // GPIO10
-#define PIN_FUNCTION_P11 13u // GPIO11
-#define PIN_FUNCTION_P14 1u // GPIO14
-#define PIN_FUNCTION_P16 2u // GPIO16
-#define PIN_FUNCTION_P21 9u // GPIO21
-#define PIN_FUNCTION_P22 4u // GPIO22
-#define PIN_FUNCTION_P23 6u // GPIO23
-#define PIN_FUNCTION_P24 3u // GPIO24
-#define PIN_FUNCTION_P26 0u // GPIO26
-#define PIN_FUNCTION_PWM0 10u // GPIO6
-#define PIN_FUNCTION_PWM1 11u // GPIO7
-#define PIN_FUNCTION_PWM2 7u // GPIO8
-#define PIN_FUNCTION_PWM3 8u // GPIO9
-#define PIN_FUNCTION_PWM4 3u // GPIO24
-#define PIN_FUNCTION_PWM5 0u // GPIO26
-#define PIN_FUNCTION_RX1 12u // GPIO10
-#define PIN_FUNCTION_RX2 14u // GPIO1
-#define PIN_FUNCTION_SCK 1u // GPIO14
-#define PIN_FUNCTION_SCL2 5u // GPIO0
-#define PIN_FUNCTION_SDA1 9u // GPIO21
-#define PIN_FUNCTION_SDA2 14u // GPIO1
-#define PIN_FUNCTION_TX1 13u // GPIO11
-#define PIN_FUNCTION_TX2 5u // GPIO0
diff --git a/boards/bw12/variant.cpp b/boards/variants/bw12.c
similarity index 69%
rename from boards/bw12/variant.cpp
rename to boards/variants/bw12.c
index 035bb33..8b631e6 100644
--- a/boards/bw12/variant.cpp
+++ b/boards/variants/bw12.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA05, PWM4, WAKE1
{PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: PA29, UART2_RX, I2C0_SCL, PWM4
@@ -29,6 +31,18 @@ PinInfo pinTable[PINS_COUNT] = {
// D10: PA23, UART0_TX, SPI0_MOSI, SPI1_MOSI, I2C1_SDA, SD_D1, PWM0, WAKE3
{PA_23, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[2]), // PA_0 (D2)
+ [5] = &(lt_arduino_pin_info_list[0]), // PA_5 (D0)
+ [12] = &(lt_arduino_pin_info_list[7]), // PA_12 (D7)
+ [14] = &(lt_arduino_pin_info_list[6]), // PA_14 (D6)
+ [15] = &(lt_arduino_pin_info_list[8]), // PA_15 (D8)
+ [18] = &(lt_arduino_pin_info_list[9]), // PA_18 (D9)
+ [19] = &(lt_arduino_pin_info_list[3]), // PA_19 (D3)
+ [22] = &(lt_arduino_pin_info_list[4]), // PA_22 (D4)
+ [23] = &(lt_arduino_pin_info_list[10]), // PA_23 (D10)
+ [29] = &(lt_arduino_pin_info_list[1]), // PA_29 (D1)
+ [30] = &(lt_arduino_pin_info_list[5]), // PA_30 (D5)
+};
+// clang-format on
diff --git a/boards/variants/bw12.h b/boards/variants/bw12.h
new file mode 100644
index 0000000..130f383
--- /dev/null
+++ b/boards/variants/bw12.h
@@ -0,0 +1,123 @@
+/* This file was auto-generated from bw12.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 11 // Total GPIO count
+#define NUM_DIGITAL_PINS 11 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 30 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 29u // PA_29
+#define PIN_WIRE0_SCL_1 22u // PA_22
+#define PIN_WIRE0_SDA_0 19u // PA_19
+#define PIN_WIRE0_SDA_1 30u // PA_30
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 30u // PA_30
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 22u // PA_22
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 30u // PA_30
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 5u // PA_5
+#define PIN_D1 29u // PA_29
+#define PIN_D2 0u // PA_0
+#define PIN_D3 19u // PA_19
+#define PIN_D4 22u // PA_22
+#define PIN_D5 30u // PA_30
+#define PIN_D6 14u // PA_14
+#define PIN_D7 12u // PA_12
+#define PIN_D8 15u // PA_15
+#define PIN_D9 18u // PA_18
+#define PIN_D10 23u // PA_23
+#define PIN_A0 19u // PA_19
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
diff --git a/boards/variants/bw15.c b/boards/variants/bw15.c
new file mode 100644
index 0000000..a769d26
--- /dev/null
+++ b/boards/variants/bw15.c
@@ -0,0 +1,54 @@
+/* This file was auto-generated from bw15.json using boardgen */
+
+#include
+
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
+
+// clang-format off
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
+ // D0: PA17, SD_CMD, PWM5
+ {PIN_A17, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D1: PA18, SD_CLK, PWM6
+ {PIN_A18, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D2: PA02, TDO, UART1_RX, SPI0_CS, I2C0_SCL, PWM2
+ {PIN_A2, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D3: PA15, SD_D2, SPI0_CS, UART2_RX, I2C0_SCL, PWM3
+ {PIN_A15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D4: PA04, tRST, UART1_CTS, SPI0_MOSI, PWM4
+ {PIN_A4, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D5: PA19, SD_D0, SPI0_MOSI, UART2_CTS, I2C0_SCL, PWM7
+ {PIN_A19, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D6: PA20, SD_D1, SPI0_MISO, UART2_RTS, I2C0_SDA, PWM0
+ {PIN_A20, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D7: PA16, SD_D3, SPI0_SCK, UART2_TX, I2C0_SDA, PWM4
+ {PIN_A16, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D8: PA00, TCK, UART1_RX, PWM0, SWCLK
+ {PIN_A0, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SWD | PIN_UART, PIN_NONE, 0},
+ // D9: PA03, TDI, UART1_TX, SPI0_SCK, I2C0_SDA, PWM3
+ {PIN_A3, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D10: PA01, TMS, UART1_TX, PWM1, SWDIO
+ {PIN_A1, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SWD | PIN_UART, PIN_NONE, 0},
+ // D11: PA13, UART0_RX, PWM7
+ {PIN_A13, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_UART, PIN_NONE, 0},
+ // D12: PA14, SD_INT, UART0_TX, PWM2
+ {PIN_A14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_UART, PIN_NONE, 0},
+};
+
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[8]), // PIN_A0 (D8)
+ [1] = &(lt_arduino_pin_info_list[10]), // PIN_A1 (D10)
+ [2] = &(lt_arduino_pin_info_list[2]), // PIN_A2 (D2)
+ [3] = &(lt_arduino_pin_info_list[9]), // PIN_A3 (D9)
+ [4] = &(lt_arduino_pin_info_list[4]), // PIN_A4 (D4)
+ [13] = &(lt_arduino_pin_info_list[11]), // PIN_A13 (D11)
+ [14] = &(lt_arduino_pin_info_list[12]), // PIN_A14 (D12)
+ [15] = &(lt_arduino_pin_info_list[3]), // PIN_A15 (D3)
+ [16] = &(lt_arduino_pin_info_list[7]), // PIN_A16 (D7)
+ [17] = &(lt_arduino_pin_info_list[0]), // PIN_A17 (D0)
+ [18] = &(lt_arduino_pin_info_list[1]), // PIN_A18 (D1)
+ [19] = &(lt_arduino_pin_info_list[5]), // PIN_A19 (D5)
+ [20] = &(lt_arduino_pin_info_list[6]), // PIN_A20 (D6)
+};
+// clang-format on
diff --git a/boards/variants/bw15.h b/boards/variants/bw15.h
new file mode 100644
index 0000000..eb1f647
--- /dev/null
+++ b/boards/variants/bw15.h
@@ -0,0 +1,128 @@
+/* This file was auto-generated from bw15.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 13 // Total GPIO count
+#define NUM_DIGITAL_PINS 13 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 0 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 13 // PWM & DAC outputs
+#define PINS_GPIO_MAX 20 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS_0 2u // PIN_A2
+#define PIN_SPI0_CS_1 15u // PIN_A15
+#define PIN_SPI0_MISO 20u // PIN_A20
+#define PIN_SPI0_MOSI_0 4u // PIN_A4
+#define PIN_SPI0_MOSI_1 19u // PIN_A19
+#define PIN_SPI0_SCK_0 16u // PIN_A16
+#define PIN_SPI0_SCK_1 3u // PIN_A3
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 2u // PIN_A2
+#define PIN_WIRE0_SCL_1 15u // PIN_A15
+#define PIN_WIRE0_SCL_2 19u // PIN_A19
+#define PIN_WIRE0_SDA_0 20u // PIN_A20
+#define PIN_WIRE0_SDA_1 16u // PIN_A16
+#define PIN_WIRE0_SDA_2 3u // PIN_A3
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_RX 13u // PIN_A13
+#define PIN_SERIAL0_TX 14u // PIN_A14
+#define PIN_SERIAL1_CTS 4u // PIN_A4
+#define PIN_SERIAL1_RX_0 2u // PIN_A2
+#define PIN_SERIAL1_RX_1 0u // PIN_A0
+#define PIN_SERIAL1_TX_0 3u // PIN_A3
+#define PIN_SERIAL1_TX_1 1u // PIN_A1
+#define PIN_SERIAL2_CTS 19u // PIN_A19
+#define PIN_SERIAL2_RTS 20u // PIN_A20
+#define PIN_SERIAL2_RX 15u // PIN_A15
+#define PIN_SERIAL2_TX 16u // PIN_A16
+
+// Pin function macros
+// -------------------
+#define PIN_CS0 15u // PIN_A15
+#define PIN_CTS1 4u // PIN_A4
+#define PIN_CTS2 19u // PIN_A19
+#define PIN_MISO0 20u // PIN_A20
+#define PIN_MOSI0 19u // PIN_A19
+#define PIN_PA00 0u // PIN_A0
+#define PIN_PA01 1u // PIN_A1
+#define PIN_PA02 2u // PIN_A2
+#define PIN_PA03 3u // PIN_A3
+#define PIN_PA04 4u // PIN_A4
+#define PIN_PA13 13u // PIN_A13
+#define PIN_PA14 14u // PIN_A14
+#define PIN_PA15 15u // PIN_A15
+#define PIN_PA16 16u // PIN_A16
+#define PIN_PA17 17u // PIN_A17
+#define PIN_PA18 18u // PIN_A18
+#define PIN_PA19 19u // PIN_A19
+#define PIN_PA20 20u // PIN_A20
+#define PIN_PWM0 0u // PIN_A0
+#define PIN_PWM1 1u // PIN_A1
+#define PIN_PWM2 14u // PIN_A14
+#define PIN_PWM3 3u // PIN_A3
+#define PIN_PWM4 16u // PIN_A16
+#define PIN_PWM5 17u // PIN_A17
+#define PIN_PWM6 18u // PIN_A18
+#define PIN_PWM7 13u // PIN_A13
+#define PIN_RTS2 20u // PIN_A20
+#define PIN_RX0 13u // PIN_A13
+#define PIN_RX1 0u // PIN_A0
+#define PIN_RX2 15u // PIN_A15
+#define PIN_SCK0 3u // PIN_A3
+#define PIN_SCL0 19u // PIN_A19
+#define PIN_SDA0 3u // PIN_A3
+#define PIN_TX0 14u // PIN_A14
+#define PIN_TX1 1u // PIN_A1
+#define PIN_TX2 16u // PIN_A16
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_WIRE0 1
+#define SERIAL_INTERFACES_COUNT 3
+#define SPI_INTERFACES_COUNT 1
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 17u // PIN_A17
+#define PIN_D1 18u // PIN_A18
+#define PIN_D2 2u // PIN_A2
+#define PIN_D3 15u // PIN_A15
+#define PIN_D4 4u // PIN_A4
+#define PIN_D5 19u // PIN_A19
+#define PIN_D6 20u // PIN_A20
+#define PIN_D7 16u // PIN_A16
+#define PIN_D8 0u // PIN_A0
+#define PIN_D9 3u // PIN_A3
+#define PIN_D10 1u // PIN_A1
+#define PIN_D11 13u // PIN_A13
+#define PIN_D12 14u // PIN_A14
+
+// Static pin names
+// ----------------
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
diff --git a/boards/cb2l/variant.cpp b/boards/variants/cb2l.c
similarity index 61%
rename from boards/cb2l/variant.cpp
rename to boards/variants/cb2l.c
index d67162b..a613471 100644
--- a/boards/cb2l/variant.cpp
+++ b/boards/variants/cb2l.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P8, PWM2
{GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P7, PWM1
@@ -25,6 +27,16 @@ PinInfo pinTable[PINS_COUNT] = {
// D8: P21, I2C1_SDA, TMS, MCLK, ^FCS
{GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[6]), // GPIO0 (D6)
+ [6] = &(lt_arduino_pin_info_list[2]), // GPIO6 (D2)
+ [7] = &(lt_arduino_pin_info_list[1]), // GPIO7 (D1)
+ [8] = &(lt_arduino_pin_info_list[0]), // GPIO8 (D0)
+ [10] = &(lt_arduino_pin_info_list[5]), // GPIO10 (D5)
+ [11] = &(lt_arduino_pin_info_list[7]), // GPIO11 (D7)
+ [21] = &(lt_arduino_pin_info_list[8]), // GPIO21 (D8)
+ [24] = &(lt_arduino_pin_info_list[4]), // GPIO24 (D4)
+ [26] = &(lt_arduino_pin_info_list[3]), // GPIO26 (D3)
+};
+// clang-format on
diff --git a/boards/variants/cb2l.h b/boards/variants/cb2l.h
new file mode 100644
index 0000000..ccbc8d1
--- /dev/null
+++ b/boards/variants/cb2l.h
@@ -0,0 +1,71 @@
+/* This file was auto-generated from cb2l.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 9 // Total GPIO count
+#define NUM_DIGITAL_PINS 9 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 0 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 5 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_P0 0u // GPIO0
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P21 21u // GPIO21
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define SERIAL_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 8u // GPIO8
+#define PIN_D1 7u // GPIO7
+#define PIN_D2 6u // GPIO6
+#define PIN_D3 26u // GPIO26
+#define PIN_D4 24u // GPIO24
+#define PIN_D5 10u // GPIO10
+#define PIN_D6 0u // GPIO0
+#define PIN_D7 11u // GPIO11
+#define PIN_D8 21u // GPIO21
+
+// Static pin names
+// ----------------
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
diff --git a/boards/cb2s/variant.cpp b/boards/variants/cb2s.c
similarity index 61%
rename from boards/cb2s/variant.cpp
rename to boards/variants/cb2s.c
index 505e4e1..8ab2a42 100644
--- a/boards/cb2s/variant.cpp
+++ b/boards/variants/cb2s.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P6, PWM0
{GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P7, PWM1
@@ -29,6 +31,18 @@ PinInfo pinTable[PINS_COUNT] = {
// D10: P21, I2C1_SDA, TMS, MCLK, ^FCS
{GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[8]), // GPIO0 (D8)
+ [1] = &(lt_arduino_pin_info_list[9]), // GPIO1 (D9)
+ [6] = &(lt_arduino_pin_info_list[0]), // GPIO6 (D0)
+ [7] = &(lt_arduino_pin_info_list[1]), // GPIO7 (D1)
+ [8] = &(lt_arduino_pin_info_list[2]), // GPIO8 (D2)
+ [10] = &(lt_arduino_pin_info_list[4]), // GPIO10 (D4)
+ [11] = &(lt_arduino_pin_info_list[5]), // GPIO11 (D5)
+ [21] = &(lt_arduino_pin_info_list[10]), // GPIO21 (D10)
+ [23] = &(lt_arduino_pin_info_list[3]), // GPIO23 (D3)
+ [24] = &(lt_arduino_pin_info_list[6]), // GPIO24 (D6)
+ [26] = &(lt_arduino_pin_info_list[7]), // GPIO26 (D7)
+};
+// clang-format on
diff --git a/boards/variants/cb2s.h b/boards/variants/cb2s.h
new file mode 100644
index 0000000..a90ec1c
--- /dev/null
+++ b/boards/variants/cb2s.h
@@ -0,0 +1,90 @@
+/* This file was auto-generated from cb2s.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 11 // Total GPIO count
+#define NUM_DIGITAL_PINS 11 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 5 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P21 21u // GPIO21
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 6u // GPIO6
+#define PIN_D1 7u // GPIO7
+#define PIN_D2 8u // GPIO8
+#define PIN_D3 23u // GPIO23
+#define PIN_D4 10u // GPIO10
+#define PIN_D5 11u // GPIO11
+#define PIN_D6 24u // GPIO24
+#define PIN_D7 26u // GPIO26
+#define PIN_D8 0u // GPIO0
+#define PIN_D9 1u // GPIO1
+#define PIN_D10 21u // GPIO21
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
diff --git a/boards/cb3l/variant.cpp b/boards/variants/cb3l.c
similarity index 61%
rename from boards/cb3l/variant.cpp
rename to boards/variants/cb3l.c
index df4de7d..6d592ce 100644
--- a/boards/cb3l/variant.cpp
+++ b/boards/variants/cb3l.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
@@ -31,6 +33,19 @@ PinInfo pinTable[PINS_COUNT] = {
// D11: P11, UART1_TX
{GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[6]), // GPIO0 (D6)
+ [6] = &(lt_arduino_pin_info_list[4]), // GPIO6 (D4)
+ [7] = &(lt_arduino_pin_info_list[9]), // GPIO7 (D9)
+ [8] = &(lt_arduino_pin_info_list[8]), // GPIO8 (D8)
+ [9] = &(lt_arduino_pin_info_list[5]), // GPIO9 (D5)
+ [10] = &(lt_arduino_pin_info_list[10]), // GPIO10 (D10)
+ [11] = &(lt_arduino_pin_info_list[11]), // GPIO11 (D11)
+ [14] = &(lt_arduino_pin_info_list[1]), // GPIO14 (D1)
+ [21] = &(lt_arduino_pin_info_list[7]), // GPIO21 (D7)
+ [23] = &(lt_arduino_pin_info_list[0]), // GPIO23 (D0)
+ [24] = &(lt_arduino_pin_info_list[3]), // GPIO24 (D3)
+ [26] = &(lt_arduino_pin_info_list[2]), // GPIO26 (D2)
+};
+// clang-format on
diff --git a/boards/variants/cb3l.h b/boards/variants/cb3l.h
new file mode 100644
index 0000000..cd31a53
--- /dev/null
+++ b/boards/variants/cb3l.h
@@ -0,0 +1,85 @@
+/* This file was auto-generated from cb3l.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 12 // Total GPIO count
+#define NUM_DIGITAL_PINS 12 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_P0 0u // GPIO0
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P21 21u // GPIO21
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define SERIAL_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 23u // GPIO23
+#define PIN_D1 14u // GPIO14
+#define PIN_D2 26u // GPIO26
+#define PIN_D3 24u // GPIO24
+#define PIN_D4 6u // GPIO6
+#define PIN_D5 9u // GPIO9
+#define PIN_D6 0u // GPIO0
+#define PIN_D7 21u // GPIO21
+#define PIN_D8 8u // GPIO8
+#define PIN_D9 7u // GPIO7
+#define PIN_D10 10u // GPIO10
+#define PIN_D11 11u // GPIO11
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
diff --git a/boards/cb3s/variant.cpp b/boards/variants/cb3s.c
similarity index 61%
rename from boards/cb3s/variant.cpp
rename to boards/variants/cb3s.c
index eb8b2d7..049d819 100644
--- a/boards/cb3s/variant.cpp
+++ b/boards/variants/cb3s.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
@@ -35,6 +37,21 @@ PinInfo pinTable[PINS_COUNT] = {
// D13: P20, I2C1_SCL, TCK, FSCK
{GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[6]), // GPIO0 (D6)
+ [6] = &(lt_arduino_pin_info_list[4]), // GPIO6 (D4)
+ [7] = &(lt_arduino_pin_info_list[9]), // GPIO7 (D9)
+ [8] = &(lt_arduino_pin_info_list[8]), // GPIO8 (D8)
+ [9] = &(lt_arduino_pin_info_list[5]), // GPIO9 (D5)
+ [10] = &(lt_arduino_pin_info_list[10]), // GPIO10 (D10)
+ [11] = &(lt_arduino_pin_info_list[11]), // GPIO11 (D11)
+ [14] = &(lt_arduino_pin_info_list[1]), // GPIO14 (D1)
+ [20] = &(lt_arduino_pin_info_list[13]), // GPIO20 (D13)
+ [21] = &(lt_arduino_pin_info_list[7]), // GPIO21 (D7)
+ [22] = &(lt_arduino_pin_info_list[12]), // GPIO22 (D12)
+ [23] = &(lt_arduino_pin_info_list[0]), // GPIO23 (D0)
+ [24] = &(lt_arduino_pin_info_list[3]), // GPIO24 (D3)
+ [26] = &(lt_arduino_pin_info_list[2]), // GPIO26 (D2)
+};
+// clang-format on
diff --git a/boards/variants/cb3s.h b/boards/variants/cb3s.h
new file mode 100644
index 0000000..711d8b1
--- /dev/null
+++ b/boards/variants/cb3s.h
@@ -0,0 +1,100 @@
+/* This file was auto-generated from cb3s.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 14 // Total GPIO count
+#define NUM_DIGITAL_PINS 14 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA_0 21u // GPIO21
+#define PIN_WIRE1_SDA_1 21u // GPIO21
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_P0 0u // GPIO0
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 23u // GPIO23
+#define PIN_D1 14u // GPIO14
+#define PIN_D2 26u // GPIO26
+#define PIN_D3 24u // GPIO24
+#define PIN_D4 6u // GPIO6
+#define PIN_D5 9u // GPIO9
+#define PIN_D6 0u // GPIO0
+#define PIN_D7 21u // GPIO21
+#define PIN_D8 8u // GPIO8
+#define PIN_D9 7u // GPIO7
+#define PIN_D10 10u // GPIO10
+#define PIN_D11 11u // GPIO11
+#define PIN_D12 22u // GPIO22
+#define PIN_D13 20u // GPIO20
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
diff --git a/boards/cb3se/variant.cpp b/boards/variants/cb3se.c
similarity index 59%
rename from boards/cb3se/variant.cpp
rename to boards/variants/cb3se.c
index 55d77a9..7cd476d 100644
--- a/boards/cb3se/variant.cpp
+++ b/boards/variants/cb3se.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
@@ -41,6 +43,24 @@ PinInfo pinTable[PINS_COUNT] = {
// D16: P16, SD_D0, MOSI
{GPIO16, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[6]), // GPIO0 (D6)
+ [1] = &(lt_arduino_pin_info_list[7]), // GPIO1 (D7)
+ [6] = &(lt_arduino_pin_info_list[4]), // GPIO6 (D4)
+ [7] = &(lt_arduino_pin_info_list[9]), // GPIO7 (D9)
+ [8] = &(lt_arduino_pin_info_list[8]), // GPIO8 (D8)
+ [9] = &(lt_arduino_pin_info_list[5]), // GPIO9 (D5)
+ [10] = &(lt_arduino_pin_info_list[10]), // GPIO10 (D10)
+ [11] = &(lt_arduino_pin_info_list[11]), // GPIO11 (D11)
+ [14] = &(lt_arduino_pin_info_list[1]), // GPIO14 (D1)
+ [15] = &(lt_arduino_pin_info_list[12]), // GPIO15 (D12)
+ [16] = &(lt_arduino_pin_info_list[16]), // GPIO16 (D16)
+ [17] = &(lt_arduino_pin_info_list[15]), // GPIO17 (D15)
+ [20] = &(lt_arduino_pin_info_list[14]), // GPIO20 (D14)
+ [22] = &(lt_arduino_pin_info_list[13]), // GPIO22 (D13)
+ [23] = &(lt_arduino_pin_info_list[0]), // GPIO23 (D0)
+ [24] = &(lt_arduino_pin_info_list[3]), // GPIO24 (D3)
+ [26] = &(lt_arduino_pin_info_list[2]), // GPIO26 (D2)
+};
+// clang-format on
diff --git a/boards/variants/cb3se.h b/boards/variants/cb3se.h
new file mode 100644
index 0000000..95d3f98
--- /dev/null
+++ b/boards/variants/cb3se.h
@@ -0,0 +1,113 @@
+/* This file was auto-generated from cb3se.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 17 // Total GPIO count
+#define NUM_DIGITAL_PINS 17 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_CS 15u // GPIO15
+#define PIN_MISO 17u // GPIO17
+#define PIN_MOSI 16u // GPIO16
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P15 15u // GPIO15
+#define PIN_P16 16u // GPIO16
+#define PIN_P17 17u // GPIO17
+#define PIN_P20 20u // GPIO20
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 23u // GPIO23
+#define PIN_D1 14u // GPIO14
+#define PIN_D2 26u // GPIO26
+#define PIN_D3 24u // GPIO24
+#define PIN_D4 6u // GPIO6
+#define PIN_D5 9u // GPIO9
+#define PIN_D6 0u // GPIO0
+#define PIN_D7 1u // GPIO1
+#define PIN_D8 8u // GPIO8
+#define PIN_D9 7u // GPIO7
+#define PIN_D10 10u // GPIO10
+#define PIN_D11 11u // GPIO11
+#define PIN_D12 15u // GPIO15
+#define PIN_D13 22u // GPIO22
+#define PIN_D14 20u // GPIO20
+#define PIN_D15 17u // GPIO17
+#define PIN_D16 16u // GPIO16
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
diff --git a/boards/generic-bk7231n-qfn32-tuya/variant.cpp b/boards/variants/generic-bk7231n-qfn32-tuya.c
similarity index 62%
rename from boards/generic-bk7231n-qfn32-tuya/variant.cpp
rename to boards/variants/generic-bk7231n-qfn32-tuya.c
index fb33d95..64a732a 100644
--- a/boards/generic-bk7231n-qfn32-tuya/variant.cpp
+++ b/boards/variants/generic-bk7231n-qfn32-tuya.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P0, UART2_TX, I2C2_SCL
{GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D1: P1, UART2_RX, I2C2_SDA
@@ -45,6 +47,26 @@ PinInfo pinTable[PINS_COUNT] = {
// D18: P28, DN
{GPIO28, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[0]), // GPIO0 (D0)
+ [1] = &(lt_arduino_pin_info_list[1]), // GPIO1 (D1)
+ [6] = &(lt_arduino_pin_info_list[2]), // GPIO6 (D2)
+ [7] = &(lt_arduino_pin_info_list[3]), // GPIO7 (D3)
+ [8] = &(lt_arduino_pin_info_list[4]), // GPIO8 (D4)
+ [9] = &(lt_arduino_pin_info_list[5]), // GPIO9 (D5)
+ [10] = &(lt_arduino_pin_info_list[6]), // GPIO10 (D6)
+ [11] = &(lt_arduino_pin_info_list[7]), // GPIO11 (D7)
+ [14] = &(lt_arduino_pin_info_list[8]), // GPIO14 (D8)
+ [15] = &(lt_arduino_pin_info_list[9]), // GPIO15 (D9)
+ [16] = &(lt_arduino_pin_info_list[10]), // GPIO16 (D10)
+ [17] = &(lt_arduino_pin_info_list[11]), // GPIO17 (D11)
+ [20] = &(lt_arduino_pin_info_list[12]), // GPIO20 (D12)
+ [21] = &(lt_arduino_pin_info_list[13]), // GPIO21 (D13)
+ [22] = &(lt_arduino_pin_info_list[14]), // GPIO22 (D14)
+ [23] = &(lt_arduino_pin_info_list[15]), // GPIO23 (D15)
+ [24] = &(lt_arduino_pin_info_list[16]), // GPIO24 (D16)
+ [26] = &(lt_arduino_pin_info_list[17]), // GPIO26 (D17)
+ [28] = &(lt_arduino_pin_info_list[18]), // GPIO28 (D18)
+};
+// clang-format on
diff --git a/boards/variants/generic-bk7231n-qfn32-tuya.h b/boards/variants/generic-bk7231n-qfn32-tuya.h
new file mode 100644
index 0000000..73d8a9c
--- /dev/null
+++ b/boards/variants/generic-bk7231n-qfn32-tuya.h
@@ -0,0 +1,123 @@
+/* This file was auto-generated from generic-bk7231n-qfn32-tuya.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 19 // Total GPIO count
+#define NUM_DIGITAL_PINS 19 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 28 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA 21u // GPIO21
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_CS 15u // GPIO15
+#define PIN_MISO 17u // GPIO17
+#define PIN_MOSI 16u // GPIO16
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P15 15u // GPIO15
+#define PIN_P16 16u // GPIO16
+#define PIN_P17 17u // GPIO17
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_P28 28u // GPIO28
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 0u // GPIO0
+#define PIN_D1 1u // GPIO1
+#define PIN_D2 6u // GPIO6
+#define PIN_D3 7u // GPIO7
+#define PIN_D4 8u // GPIO8
+#define PIN_D5 9u // GPIO9
+#define PIN_D6 10u // GPIO10
+#define PIN_D7 11u // GPIO11
+#define PIN_D8 14u // GPIO14
+#define PIN_D9 15u // GPIO15
+#define PIN_D10 16u // GPIO16
+#define PIN_D11 17u // GPIO17
+#define PIN_D12 20u // GPIO20
+#define PIN_D13 21u // GPIO21
+#define PIN_D14 22u // GPIO22
+#define PIN_D15 23u // GPIO23
+#define PIN_D16 24u // GPIO24
+#define PIN_D17 26u // GPIO26
+#define PIN_D18 28u // GPIO28
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
+static const unsigned char D17 = PIN_D17;
+static const unsigned char D18 = PIN_D18;
diff --git a/boards/generic-bk7231t-qfn32-tuya/variant.cpp b/boards/variants/generic-bk7231t-qfn32-tuya.c
similarity index 62%
rename from boards/generic-bk7231t-qfn32-tuya/variant.cpp
rename to boards/variants/generic-bk7231t-qfn32-tuya.c
index c358dee..539e8ba 100644
--- a/boards/generic-bk7231t-qfn32-tuya/variant.cpp
+++ b/boards/variants/generic-bk7231t-qfn32-tuya.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P0, UART2_TX, I2C2_SCL
{GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D1: P1, UART2_RX, I2C2_SDA
@@ -45,6 +47,26 @@ PinInfo pinTable[PINS_COUNT] = {
// D18: P28, DN
{GPIO28, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[0]), // GPIO0 (D0)
+ [1] = &(lt_arduino_pin_info_list[1]), // GPIO1 (D1)
+ [6] = &(lt_arduino_pin_info_list[2]), // GPIO6 (D2)
+ [7] = &(lt_arduino_pin_info_list[3]), // GPIO7 (D3)
+ [8] = &(lt_arduino_pin_info_list[4]), // GPIO8 (D4)
+ [9] = &(lt_arduino_pin_info_list[5]), // GPIO9 (D5)
+ [10] = &(lt_arduino_pin_info_list[6]), // GPIO10 (D6)
+ [11] = &(lt_arduino_pin_info_list[7]), // GPIO11 (D7)
+ [14] = &(lt_arduino_pin_info_list[8]), // GPIO14 (D8)
+ [15] = &(lt_arduino_pin_info_list[9]), // GPIO15 (D9)
+ [16] = &(lt_arduino_pin_info_list[10]), // GPIO16 (D10)
+ [17] = &(lt_arduino_pin_info_list[11]), // GPIO17 (D11)
+ [20] = &(lt_arduino_pin_info_list[12]), // GPIO20 (D12)
+ [21] = &(lt_arduino_pin_info_list[13]), // GPIO21 (D13)
+ [22] = &(lt_arduino_pin_info_list[14]), // GPIO22 (D14)
+ [23] = &(lt_arduino_pin_info_list[15]), // GPIO23 (D15)
+ [24] = &(lt_arduino_pin_info_list[16]), // GPIO24 (D16)
+ [26] = &(lt_arduino_pin_info_list[17]), // GPIO26 (D17)
+ [28] = &(lt_arduino_pin_info_list[18]), // GPIO28 (D18)
+};
+// clang-format on
diff --git a/boards/variants/generic-bk7231t-qfn32-tuya.h b/boards/variants/generic-bk7231t-qfn32-tuya.h
new file mode 100644
index 0000000..dd9b587
--- /dev/null
+++ b/boards/variants/generic-bk7231t-qfn32-tuya.h
@@ -0,0 +1,123 @@
+/* This file was auto-generated from generic-bk7231t-qfn32-tuya.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 19 // Total GPIO count
+#define NUM_DIGITAL_PINS 19 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 28 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA 21u // GPIO21
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_CS 15u // GPIO15
+#define PIN_MISO 17u // GPIO17
+#define PIN_MOSI 16u // GPIO16
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P15 15u // GPIO15
+#define PIN_P16 16u // GPIO16
+#define PIN_P17 17u // GPIO17
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_P28 28u // GPIO28
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 0u // GPIO0
+#define PIN_D1 1u // GPIO1
+#define PIN_D2 6u // GPIO6
+#define PIN_D3 7u // GPIO7
+#define PIN_D4 8u // GPIO8
+#define PIN_D5 9u // GPIO9
+#define PIN_D6 10u // GPIO10
+#define PIN_D7 11u // GPIO11
+#define PIN_D8 14u // GPIO14
+#define PIN_D9 15u // GPIO15
+#define PIN_D10 16u // GPIO16
+#define PIN_D11 17u // GPIO17
+#define PIN_D12 20u // GPIO20
+#define PIN_D13 21u // GPIO21
+#define PIN_D14 22u // GPIO22
+#define PIN_D15 23u // GPIO23
+#define PIN_D16 24u // GPIO24
+#define PIN_D17 26u // GPIO26
+#define PIN_D18 28u // GPIO28
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
+static const unsigned char D17 = PIN_D17;
+static const unsigned char D18 = PIN_D18;
diff --git a/boards/generic-bk7252/variant.cpp b/boards/variants/generic-bk7252.c
similarity index 62%
rename from boards/generic-bk7252/variant.cpp
rename to boards/variants/generic-bk7252.c
index 74c7841..b7287a6 100644
--- a/boards/generic-bk7252/variant.cpp
+++ b/boards/variants/generic-bk7252.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P0, UART2_TX, I2C2_SCL
{GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D1: P1, UART2_RX, I2C2_SDA
@@ -83,6 +85,45 @@ PinInfo pinTable[PINS_COUNT] = {
// D37: P39, DVP_PD7
{GPIO39, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[0]), // GPIO0 (D0)
+ [1] = &(lt_arduino_pin_info_list[1]), // GPIO1 (D1)
+ [2] = &(lt_arduino_pin_info_list[2]), // GPIO2 (D2)
+ [3] = &(lt_arduino_pin_info_list[3]), // GPIO3 (D3)
+ [4] = &(lt_arduino_pin_info_list[4]), // GPIO4 (D4)
+ [5] = &(lt_arduino_pin_info_list[5]), // GPIO5 (D5)
+ [6] = &(lt_arduino_pin_info_list[6]), // GPIO6 (D6)
+ [7] = &(lt_arduino_pin_info_list[7]), // GPIO7 (D7)
+ [10] = &(lt_arduino_pin_info_list[8]), // GPIO10 (D8)
+ [11] = &(lt_arduino_pin_info_list[9]), // GPIO11 (D9)
+ [12] = &(lt_arduino_pin_info_list[10]), // GPIO12 (D10)
+ [13] = &(lt_arduino_pin_info_list[11]), // GPIO13 (D11)
+ [14] = &(lt_arduino_pin_info_list[12]), // GPIO14 (D12)
+ [15] = &(lt_arduino_pin_info_list[13]), // GPIO15 (D13)
+ [16] = &(lt_arduino_pin_info_list[14]), // GPIO16 (D14)
+ [17] = &(lt_arduino_pin_info_list[15]), // GPIO17 (D15)
+ [18] = &(lt_arduino_pin_info_list[16]), // GPIO18 (D16)
+ [19] = &(lt_arduino_pin_info_list[17]), // GPIO19 (D17)
+ [20] = &(lt_arduino_pin_info_list[18]), // GPIO20 (D18)
+ [21] = &(lt_arduino_pin_info_list[19]), // GPIO21 (D19)
+ [22] = &(lt_arduino_pin_info_list[20]), // GPIO22 (D20)
+ [23] = &(lt_arduino_pin_info_list[21]), // GPIO23 (D21)
+ [24] = &(lt_arduino_pin_info_list[22]), // GPIO24 (D22)
+ [25] = &(lt_arduino_pin_info_list[23]), // GPIO25 (D23)
+ [26] = &(lt_arduino_pin_info_list[24]), // GPIO26 (D24)
+ [27] = &(lt_arduino_pin_info_list[25]), // GPIO27 (D25)
+ [28] = &(lt_arduino_pin_info_list[26]), // GPIO28 (D26)
+ [29] = &(lt_arduino_pin_info_list[27]), // GPIO29 (D27)
+ [30] = &(lt_arduino_pin_info_list[28]), // GPIO30 (D28)
+ [31] = &(lt_arduino_pin_info_list[29]), // GPIO31 (D29)
+ [32] = &(lt_arduino_pin_info_list[30]), // GPIO32 (D30)
+ [33] = &(lt_arduino_pin_info_list[31]), // GPIO33 (D31)
+ [34] = &(lt_arduino_pin_info_list[32]), // GPIO34 (D32)
+ [35] = &(lt_arduino_pin_info_list[33]), // GPIO35 (D33)
+ [36] = &(lt_arduino_pin_info_list[34]), // GPIO36 (D34)
+ [37] = &(lt_arduino_pin_info_list[35]), // GPIO37 (D35)
+ [38] = &(lt_arduino_pin_info_list[36]), // GPIO38 (D36)
+ [39] = &(lt_arduino_pin_info_list[37]), // GPIO39 (D37)
+};
+// clang-format on
diff --git a/boards/variants/generic-bk7252.h b/boards/variants/generic-bk7252.h
new file mode 100644
index 0000000..98a7ac7
--- /dev/null
+++ b/boards/variants/generic-bk7252.h
@@ -0,0 +1,200 @@
+/* This file was auto-generated from generic-bk7252.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 38 // Total GPIO count
+#define NUM_DIGITAL_PINS 38 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 7 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 4 // PWM & DAC outputs
+#define PINS_GPIO_MAX 39 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA 21u // GPIO21
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_CTS 12u // GPIO12
+#define PIN_SERIAL1_RTS 13u // GPIO13
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 4u // GPIO4
+#define PIN_ADC2 5u // GPIO5
+#define PIN_ADC3 23u // GPIO23
+#define PIN_ADC4 2u // GPIO2
+#define PIN_ADC5 3u // GPIO3
+#define PIN_ADC6 12u // GPIO12
+#define PIN_ADC7 13u // GPIO13
+#define PIN_CS 15u // GPIO15
+#define PIN_CTS1 12u // GPIO12
+#define PIN_MISO 17u // GPIO17
+#define PIN_MOSI 16u // GPIO16
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P2 2u // GPIO2
+#define PIN_P3 3u // GPIO3
+#define PIN_P4 4u // GPIO4
+#define PIN_P5 5u // GPIO5
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P12 12u // GPIO12
+#define PIN_P13 13u // GPIO13
+#define PIN_P14 14u // GPIO14
+#define PIN_P15 15u // GPIO15
+#define PIN_P16 16u // GPIO16
+#define PIN_P17 17u // GPIO17
+#define PIN_P18 18u // GPIO18
+#define PIN_P19 19u // GPIO19
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P25 25u // GPIO25
+#define PIN_P26 26u // GPIO26
+#define PIN_P27 27u // GPIO27
+#define PIN_P28 28u // GPIO28
+#define PIN_P29 29u // GPIO29
+#define PIN_P30 30u // GPIO30
+#define PIN_P31 31u // GPIO31
+#define PIN_P32 32u // GPIO32
+#define PIN_P33 33u // GPIO33
+#define PIN_P34 34u // GPIO34
+#define PIN_P35 35u // GPIO35
+#define PIN_P36 36u // GPIO36
+#define PIN_P37 37u // GPIO37
+#define PIN_P38 38u // GPIO38
+#define PIN_P39 39u // GPIO39
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RTS1 13u // GPIO13
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 0u // GPIO0
+#define PIN_D1 1u // GPIO1
+#define PIN_D2 2u // GPIO2
+#define PIN_D3 3u // GPIO3
+#define PIN_D4 4u // GPIO4
+#define PIN_D5 5u // GPIO5
+#define PIN_D6 6u // GPIO6
+#define PIN_D7 7u // GPIO7
+#define PIN_D8 10u // GPIO10
+#define PIN_D9 11u // GPIO11
+#define PIN_D10 12u // GPIO12
+#define PIN_D11 13u // GPIO13
+#define PIN_D12 14u // GPIO14
+#define PIN_D13 15u // GPIO15
+#define PIN_D14 16u // GPIO16
+#define PIN_D15 17u // GPIO17
+#define PIN_D16 18u // GPIO18
+#define PIN_D17 19u // GPIO19
+#define PIN_D18 20u // GPIO20
+#define PIN_D19 21u // GPIO21
+#define PIN_D20 22u // GPIO22
+#define PIN_D21 23u // GPIO23
+#define PIN_D22 24u // GPIO24
+#define PIN_D23 25u // GPIO25
+#define PIN_D24 26u // GPIO26
+#define PIN_D25 27u // GPIO27
+#define PIN_D26 28u // GPIO28
+#define PIN_D27 29u // GPIO29
+#define PIN_D28 30u // GPIO30
+#define PIN_D29 31u // GPIO31
+#define PIN_D30 32u // GPIO32
+#define PIN_D31 33u // GPIO33
+#define PIN_D32 34u // GPIO34
+#define PIN_D33 35u // GPIO35
+#define PIN_D34 36u // GPIO36
+#define PIN_D35 37u // GPIO37
+#define PIN_D36 38u // GPIO38
+#define PIN_D37 39u // GPIO39
+#define PIN_A1 4u // GPIO4
+#define PIN_A2 5u // GPIO5
+#define PIN_A3 23u // GPIO23
+#define PIN_A4 3u // GPIO3
+#define PIN_A5 2u // GPIO2
+#define PIN_A6 12u // GPIO12
+#define PIN_A7 13u // GPIO13
+
+// Static pin names
+// ----------------
+static const unsigned char A1 = PIN_A1;
+static const unsigned char A2 = PIN_A2;
+static const unsigned char A3 = PIN_A3;
+static const unsigned char A4 = PIN_A4;
+static const unsigned char A5 = PIN_A5;
+static const unsigned char A6 = PIN_A6;
+static const unsigned char A7 = PIN_A7;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
+static const unsigned char D17 = PIN_D17;
+static const unsigned char D18 = PIN_D18;
+static const unsigned char D19 = PIN_D19;
+static const unsigned char D20 = PIN_D20;
+static const unsigned char D21 = PIN_D21;
+static const unsigned char D22 = PIN_D22;
+static const unsigned char D23 = PIN_D23;
+static const unsigned char D24 = PIN_D24;
+static const unsigned char D25 = PIN_D25;
+static const unsigned char D26 = PIN_D26;
+static const unsigned char D27 = PIN_D27;
+static const unsigned char D28 = PIN_D28;
+static const unsigned char D29 = PIN_D29;
+static const unsigned char D30 = PIN_D30;
+static const unsigned char D31 = PIN_D31;
+static const unsigned char D32 = PIN_D32;
+static const unsigned char D33 = PIN_D33;
+static const unsigned char D34 = PIN_D34;
+static const unsigned char D35 = PIN_D35;
+static const unsigned char D36 = PIN_D36;
+static const unsigned char D37 = PIN_D37;
diff --git a/boards/generic-rtl8710bn-2mb-468k/variant.cpp b/boards/variants/generic-rtl8710bn-2mb-468k.c
similarity index 69%
rename from boards/generic-rtl8710bn-2mb-468k/variant.cpp
rename to boards/variants/generic-rtl8710bn-2mb-468k.c
index 227abbe..10a9b98 100644
--- a/boards/generic-rtl8710bn-2mb-468k/variant.cpp
+++ b/boards/variants/generic-rtl8710bn-2mb-468k.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA00, PWM2
{PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: PA05, PWM4, WAKE1
@@ -43,6 +45,25 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[0]), // PA_0 (D0)
+ [5] = &(lt_arduino_pin_info_list[1]), // PA_5 (D1)
+ [6] = &(lt_arduino_pin_info_list[2]), // PA_6 (D2)
+ [7] = &(lt_arduino_pin_info_list[3]), // PA_7 (D3)
+ [8] = &(lt_arduino_pin_info_list[4]), // PA_8 (D4)
+ [9] = &(lt_arduino_pin_info_list[5]), // PA_9 (D5)
+ [10] = &(lt_arduino_pin_info_list[6]), // PA_10 (D6)
+ [11] = &(lt_arduino_pin_info_list[7]), // PA_11 (D7)
+ [12] = &(lt_arduino_pin_info_list[8]), // PA_12 (D8)
+ [14] = &(lt_arduino_pin_info_list[9]), // PA_14 (D9)
+ [15] = &(lt_arduino_pin_info_list[10]), // PA_15 (D10)
+ [18] = &(lt_arduino_pin_info_list[11]), // PA_18 (D11)
+ [19] = &(lt_arduino_pin_info_list[12]), // PA_19 (D12)
+ [22] = &(lt_arduino_pin_info_list[13]), // PA_22 (D13)
+ [23] = &(lt_arduino_pin_info_list[14]), // PA_23 (D14)
+ [29] = &(lt_arduino_pin_info_list[15]), // PA_29 (D15)
+ [30] = &(lt_arduino_pin_info_list[16]), // PA_30 (D16)
+ [41] = &(lt_arduino_pin_info_list[17]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/generic-rtl8710bn-2mb-468k.h b/boards/variants/generic-rtl8710bn-2mb-468k.h
new file mode 100644
index 0000000..e61f834
--- /dev/null
+++ b/boards/variants/generic-rtl8710bn-2mb-468k.h
@@ -0,0 +1,150 @@
+/* This file was auto-generated from generic-rtl8710bn-2mb-468k.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 18 // Total GPIO count
+#define NUM_DIGITAL_PINS 17 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 2 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 22u // PA_22
+#define PIN_WIRE0_SCL_1 29u // PA_29
+#define PIN_WIRE0_SDA_0 19u // PA_19
+#define PIN_WIRE0_SDA_1 30u // PA_30
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_ADC2 41u // AD_2
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_FCS 6u // PA_6
+#define PIN_FD0 9u // PA_9
+#define PIN_FD1 7u // PA_7
+#define PIN_FD2 8u // PA_8
+#define PIN_FD3 11u // PA_11
+#define PIN_FSCK 10u // PA_10
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA06 6u // PA_6
+#define PIN_PA07 7u // PA_7
+#define PIN_PA08 8u // PA_8
+#define PIN_PA09 9u // PA_9
+#define PIN_PA10 10u // PA_10
+#define PIN_PA11 11u // PA_11
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 30u // PA_30
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 29u // PA_29
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 30u // PA_30
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 0u // PA_0
+#define PIN_D1 5u // PA_5
+#define PIN_D2 6u // PA_6
+#define PIN_D3 7u // PA_7
+#define PIN_D4 8u // PA_8
+#define PIN_D5 9u // PA_9
+#define PIN_D6 10u // PA_10
+#define PIN_D7 11u // PA_11
+#define PIN_D8 12u // PA_12
+#define PIN_D9 14u // PA_14
+#define PIN_D10 15u // PA_15
+#define PIN_D11 18u // PA_18
+#define PIN_D12 19u // PA_19
+#define PIN_D13 22u // PA_22
+#define PIN_D14 23u // PA_23
+#define PIN_D15 29u // PA_29
+#define PIN_D16 30u // PA_30
+#define PIN_A0 19u // PA_19
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
diff --git a/boards/generic-rtl8710bn-2mb-788k/variant.cpp b/boards/variants/generic-rtl8710bn-2mb-788k.c
similarity index 69%
rename from boards/generic-rtl8710bn-2mb-788k/variant.cpp
rename to boards/variants/generic-rtl8710bn-2mb-788k.c
index 41602e5..a19fd6c 100644
--- a/boards/generic-rtl8710bn-2mb-788k/variant.cpp
+++ b/boards/variants/generic-rtl8710bn-2mb-788k.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA00, PWM2
{PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: PA05, PWM4, WAKE1
@@ -43,6 +45,25 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[0]), // PA_0 (D0)
+ [5] = &(lt_arduino_pin_info_list[1]), // PA_5 (D1)
+ [6] = &(lt_arduino_pin_info_list[2]), // PA_6 (D2)
+ [7] = &(lt_arduino_pin_info_list[3]), // PA_7 (D3)
+ [8] = &(lt_arduino_pin_info_list[4]), // PA_8 (D4)
+ [9] = &(lt_arduino_pin_info_list[5]), // PA_9 (D5)
+ [10] = &(lt_arduino_pin_info_list[6]), // PA_10 (D6)
+ [11] = &(lt_arduino_pin_info_list[7]), // PA_11 (D7)
+ [12] = &(lt_arduino_pin_info_list[8]), // PA_12 (D8)
+ [14] = &(lt_arduino_pin_info_list[9]), // PA_14 (D9)
+ [15] = &(lt_arduino_pin_info_list[10]), // PA_15 (D10)
+ [18] = &(lt_arduino_pin_info_list[11]), // PA_18 (D11)
+ [19] = &(lt_arduino_pin_info_list[12]), // PA_19 (D12)
+ [22] = &(lt_arduino_pin_info_list[13]), // PA_22 (D13)
+ [23] = &(lt_arduino_pin_info_list[14]), // PA_23 (D14)
+ [29] = &(lt_arduino_pin_info_list[15]), // PA_29 (D15)
+ [30] = &(lt_arduino_pin_info_list[16]), // PA_30 (D16)
+ [41] = &(lt_arduino_pin_info_list[17]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/generic-rtl8710bn-2mb-788k.h b/boards/variants/generic-rtl8710bn-2mb-788k.h
new file mode 100644
index 0000000..3174473
--- /dev/null
+++ b/boards/variants/generic-rtl8710bn-2mb-788k.h
@@ -0,0 +1,150 @@
+/* This file was auto-generated from generic-rtl8710bn-2mb-788k.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 18 // Total GPIO count
+#define NUM_DIGITAL_PINS 17 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 2 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 22u // PA_22
+#define PIN_WIRE0_SCL_1 29u // PA_29
+#define PIN_WIRE0_SDA_0 19u // PA_19
+#define PIN_WIRE0_SDA_1 30u // PA_30
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_ADC2 41u // AD_2
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_FCS 6u // PA_6
+#define PIN_FD0 9u // PA_9
+#define PIN_FD1 7u // PA_7
+#define PIN_FD2 8u // PA_8
+#define PIN_FD3 11u // PA_11
+#define PIN_FSCK 10u // PA_10
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA06 6u // PA_6
+#define PIN_PA07 7u // PA_7
+#define PIN_PA08 8u // PA_8
+#define PIN_PA09 9u // PA_9
+#define PIN_PA10 10u // PA_10
+#define PIN_PA11 11u // PA_11
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 30u // PA_30
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 29u // PA_29
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 30u // PA_30
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 0u // PA_0
+#define PIN_D1 5u // PA_5
+#define PIN_D2 6u // PA_6
+#define PIN_D3 7u // PA_7
+#define PIN_D4 8u // PA_8
+#define PIN_D5 9u // PA_9
+#define PIN_D6 10u // PA_10
+#define PIN_D7 11u // PA_11
+#define PIN_D8 12u // PA_12
+#define PIN_D9 14u // PA_14
+#define PIN_D10 15u // PA_15
+#define PIN_D11 18u // PA_18
+#define PIN_D12 19u // PA_19
+#define PIN_D13 22u // PA_22
+#define PIN_D14 23u // PA_23
+#define PIN_D15 29u // PA_29
+#define PIN_D16 30u // PA_30
+#define PIN_A0 19u // PA_19
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
diff --git a/boards/generic-rtl8710bx-4mb-980k/variant.cpp b/boards/variants/generic-rtl8710bx-4mb-980k.c
similarity index 69%
rename from boards/generic-rtl8710bx-4mb-980k/variant.cpp
rename to boards/variants/generic-rtl8710bx-4mb-980k.c
index dc55d0a..b2f0fce 100644
--- a/boards/generic-rtl8710bx-4mb-980k/variant.cpp
+++ b/boards/variants/generic-rtl8710bx-4mb-980k.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA00, PWM2
{PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: PA05, PWM4, WAKE1
@@ -41,6 +43,24 @@ PinInfo pinTable[PINS_COUNT] = {
// D16: PA30, UART2_TX, I2C0_SDA, PWM4
{PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[0]), // PA_0 (D0)
+ [5] = &(lt_arduino_pin_info_list[1]), // PA_5 (D1)
+ [6] = &(lt_arduino_pin_info_list[2]), // PA_6 (D2)
+ [7] = &(lt_arduino_pin_info_list[3]), // PA_7 (D3)
+ [8] = &(lt_arduino_pin_info_list[4]), // PA_8 (D4)
+ [9] = &(lt_arduino_pin_info_list[5]), // PA_9 (D5)
+ [10] = &(lt_arduino_pin_info_list[6]), // PA_10 (D6)
+ [11] = &(lt_arduino_pin_info_list[7]), // PA_11 (D7)
+ [12] = &(lt_arduino_pin_info_list[8]), // PA_12 (D8)
+ [14] = &(lt_arduino_pin_info_list[9]), // PA_14 (D9)
+ [15] = &(lt_arduino_pin_info_list[10]), // PA_15 (D10)
+ [18] = &(lt_arduino_pin_info_list[11]), // PA_18 (D11)
+ [19] = &(lt_arduino_pin_info_list[12]), // PA_19 (D12)
+ [22] = &(lt_arduino_pin_info_list[13]), // PA_22 (D13)
+ [23] = &(lt_arduino_pin_info_list[14]), // PA_23 (D14)
+ [29] = &(lt_arduino_pin_info_list[15]), // PA_29 (D15)
+ [30] = &(lt_arduino_pin_info_list[16]), // PA_30 (D16)
+};
+// clang-format on
diff --git a/boards/variants/generic-rtl8710bx-4mb-980k.h b/boards/variants/generic-rtl8710bx-4mb-980k.h
new file mode 100644
index 0000000..272ffca
--- /dev/null
+++ b/boards/variants/generic-rtl8710bx-4mb-980k.h
@@ -0,0 +1,147 @@
+/* This file was auto-generated from generic-rtl8710bx-4mb-980k.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 17 // Total GPIO count
+#define NUM_DIGITAL_PINS 17 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 30 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 22u // PA_22
+#define PIN_WIRE0_SCL_1 29u // PA_29
+#define PIN_WIRE0_SDA_0 19u // PA_19
+#define PIN_WIRE0_SDA_1 30u // PA_30
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_FCS 6u // PA_6
+#define PIN_FD0 9u // PA_9
+#define PIN_FD1 7u // PA_7
+#define PIN_FD2 8u // PA_8
+#define PIN_FD3 11u // PA_11
+#define PIN_FSCK 10u // PA_10
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA06 6u // PA_6
+#define PIN_PA07 7u // PA_7
+#define PIN_PA08 8u // PA_8
+#define PIN_PA09 9u // PA_9
+#define PIN_PA10 10u // PA_10
+#define PIN_PA11 11u // PA_11
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 30u // PA_30
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 29u // PA_29
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 30u // PA_30
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 0u // PA_0
+#define PIN_D1 5u // PA_5
+#define PIN_D2 6u // PA_6
+#define PIN_D3 7u // PA_7
+#define PIN_D4 8u // PA_8
+#define PIN_D5 9u // PA_9
+#define PIN_D6 10u // PA_10
+#define PIN_D7 11u // PA_11
+#define PIN_D8 12u // PA_12
+#define PIN_D9 14u // PA_14
+#define PIN_D10 15u // PA_15
+#define PIN_D11 18u // PA_18
+#define PIN_D12 19u // PA_19
+#define PIN_D13 22u // PA_22
+#define PIN_D14 23u // PA_23
+#define PIN_D15 29u // PA_29
+#define PIN_D16 30u // PA_30
+#define PIN_A0 19u // PA_19
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
diff --git a/boards/variants/generic-rtl8720cf-2mb-992k.c b/boards/variants/generic-rtl8720cf-2mb-992k.c
new file mode 100644
index 0000000..26deb19
--- /dev/null
+++ b/boards/variants/generic-rtl8720cf-2mb-992k.c
@@ -0,0 +1,75 @@
+/* This file was auto-generated from generic-rtl8720cf-2mb-992k.json using boardgen */
+
+#include
+
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
+
+// clang-format off
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
+ // D0: PA00, TCK, UART1_RX, PWM0, SWCLK
+ {PIN_A0, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SWD | PIN_UART, PIN_NONE, 0},
+ // D1: PA01, TMS, UART1_TX, PWM1, SWDIO
+ {PIN_A1, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SWD | PIN_UART, PIN_NONE, 0},
+ // D2: PA02, TDO, UART1_RX, SPI0_CS, I2C0_SCL, PWM2
+ {PIN_A2, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D3: PA03, TDI, UART1_TX, SPI0_SCK, I2C0_SDA, PWM3
+ {PIN_A3, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D4: PA04, tRST, UART1_CTS, SPI0_MOSI, PWM4
+ {PIN_A4, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D5: PA07, ^FCS, SPI0_CS
+ {PIN_A7, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
+ // D6: PA08, FSCK, SPI0_SCK
+ {PIN_A8, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
+ // D7: PA09, FD2, SPI0_MOSI, UART0_RTS
+ {PIN_A9, PIN_GPIO | PIN_IRQ | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D8: PA10, FD1, SPI0_MISO, UART0_CTS
+ {PIN_A10, PIN_GPIO | PIN_IRQ | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D9: PA11, FD0, UART0_TX, I2C0_SCL, PWM0
+ {PIN_A11, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
+ // D10: PA12, FD3, UART0_RX, I2C0_SDA, PWM1
+ {PIN_A12, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
+ // D11: PA13, UART0_RX, PWM7
+ {PIN_A13, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_UART, PIN_NONE, 0},
+ // D12: PA14, SD_INT, UART0_TX, PWM2
+ {PIN_A14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_UART, PIN_NONE, 0},
+ // D13: PA15, SD_D2, SPI0_CS, UART2_RX, I2C0_SCL, PWM3
+ {PIN_A15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D14: PA16, SD_D3, SPI0_SCK, UART2_TX, I2C0_SDA, PWM4
+ {PIN_A16, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D15: PA17, SD_CMD, PWM5
+ {PIN_A17, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D16: PA18, SD_CLK, PWM6
+ {PIN_A18, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D17: PA19, SD_D0, SPI0_MOSI, UART2_CTS, I2C0_SCL, PWM7
+ {PIN_A19, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D18: PA20, SD_D1, SPI0_MISO, UART2_RTS, I2C0_SDA, PWM0
+ {PIN_A20, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
+ // D19: PA23, PWM7
+ {PIN_A23, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+};
+
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[0]), // PIN_A0 (D0)
+ [1] = &(lt_arduino_pin_info_list[1]), // PIN_A1 (D1)
+ [2] = &(lt_arduino_pin_info_list[2]), // PIN_A2 (D2)
+ [3] = &(lt_arduino_pin_info_list[3]), // PIN_A3 (D3)
+ [4] = &(lt_arduino_pin_info_list[4]), // PIN_A4 (D4)
+ [7] = &(lt_arduino_pin_info_list[5]), // PIN_A7 (D5)
+ [8] = &(lt_arduino_pin_info_list[6]), // PIN_A8 (D6)
+ [9] = &(lt_arduino_pin_info_list[7]), // PIN_A9 (D7)
+ [10] = &(lt_arduino_pin_info_list[8]), // PIN_A10 (D8)
+ [11] = &(lt_arduino_pin_info_list[9]), // PIN_A11 (D9)
+ [12] = &(lt_arduino_pin_info_list[10]), // PIN_A12 (D10)
+ [13] = &(lt_arduino_pin_info_list[11]), // PIN_A13 (D11)
+ [14] = &(lt_arduino_pin_info_list[12]), // PIN_A14 (D12)
+ [15] = &(lt_arduino_pin_info_list[13]), // PIN_A15 (D13)
+ [16] = &(lt_arduino_pin_info_list[14]), // PIN_A16 (D14)
+ [17] = &(lt_arduino_pin_info_list[15]), // PIN_A17 (D15)
+ [18] = &(lt_arduino_pin_info_list[16]), // PIN_A18 (D16)
+ [19] = &(lt_arduino_pin_info_list[17]), // PIN_A19 (D17)
+ [20] = &(lt_arduino_pin_info_list[18]), // PIN_A20 (D18)
+ [23] = &(lt_arduino_pin_info_list[19]), // PIN_A23 (D19)
+};
+// clang-format on
diff --git a/boards/variants/generic-rtl8720cf-2mb-992k.h b/boards/variants/generic-rtl8720cf-2mb-992k.h
new file mode 100644
index 0000000..fddd627
--- /dev/null
+++ b/boards/variants/generic-rtl8720cf-2mb-992k.h
@@ -0,0 +1,161 @@
+/* This file was auto-generated from generic-rtl8720cf-2mb-992k.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 20 // Total GPIO count
+#define NUM_DIGITAL_PINS 20 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 0 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 16 // PWM & DAC outputs
+#define PINS_GPIO_MAX 23 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS_0 2u // PIN_A2
+#define PIN_SPI0_CS_1 7u // PIN_A7
+#define PIN_SPI0_CS_2 15u // PIN_A15
+#define PIN_SPI0_MISO_0 10u // PIN_A10
+#define PIN_SPI0_MISO_1 20u // PIN_A20
+#define PIN_SPI0_MOSI_0 4u // PIN_A4
+#define PIN_SPI0_MOSI_1 9u // PIN_A9
+#define PIN_SPI0_MOSI_2 19u // PIN_A19
+#define PIN_SPI0_SCK_0 3u // PIN_A3
+#define PIN_SPI0_SCK_1 8u // PIN_A8
+#define PIN_SPI0_SCK_2 16u // PIN_A16
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 2u // PIN_A2
+#define PIN_WIRE0_SCL_1 11u // PIN_A11
+#define PIN_WIRE0_SCL_2 15u // PIN_A15
+#define PIN_WIRE0_SCL_3 19u // PIN_A19
+#define PIN_WIRE0_SDA_0 3u // PIN_A3
+#define PIN_WIRE0_SDA_1 12u // PIN_A12
+#define PIN_WIRE0_SDA_2 16u // PIN_A16
+#define PIN_WIRE0_SDA_3 20u // PIN_A20
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 10u // PIN_A10
+#define PIN_SERIAL0_RTS 9u // PIN_A9
+#define PIN_SERIAL0_RX_0 12u // PIN_A12
+#define PIN_SERIAL0_RX_1 13u // PIN_A13
+#define PIN_SERIAL0_TX_0 11u // PIN_A11
+#define PIN_SERIAL0_TX_1 14u // PIN_A14
+#define PIN_SERIAL1_CTS 4u // PIN_A4
+#define PIN_SERIAL1_RX_0 0u // PIN_A0
+#define PIN_SERIAL1_RX_1 2u // PIN_A2
+#define PIN_SERIAL1_TX_0 1u // PIN_A1
+#define PIN_SERIAL1_TX_1 3u // PIN_A3
+#define PIN_SERIAL2_CTS 19u // PIN_A19
+#define PIN_SERIAL2_RTS 20u // PIN_A20
+#define PIN_SERIAL2_RX 15u // PIN_A15
+#define PIN_SERIAL2_TX 16u // PIN_A16
+
+// Pin function macros
+// -------------------
+#define PIN_CS0 15u // PIN_A15
+#define PIN_CTS0 10u // PIN_A10
+#define PIN_CTS1 4u // PIN_A4
+#define PIN_CTS2 19u // PIN_A19
+#define PIN_MISO0 20u // PIN_A20
+#define PIN_MOSI0 19u // PIN_A19
+#define PIN_PA00 0u // PIN_A0
+#define PIN_PA01 1u // PIN_A1
+#define PIN_PA02 2u // PIN_A2
+#define PIN_PA03 3u // PIN_A3
+#define PIN_PA04 4u // PIN_A4
+#define PIN_PA07 7u // PIN_A7
+#define PIN_PA08 8u // PIN_A8
+#define PIN_PA09 9u // PIN_A9
+#define PIN_PA10 10u // PIN_A10
+#define PIN_PA11 11u // PIN_A11
+#define PIN_PA12 12u // PIN_A12
+#define PIN_PA13 13u // PIN_A13
+#define PIN_PA14 14u // PIN_A14
+#define PIN_PA15 15u // PIN_A15
+#define PIN_PA16 16u // PIN_A16
+#define PIN_PA17 17u // PIN_A17
+#define PIN_PA18 18u // PIN_A18
+#define PIN_PA19 19u // PIN_A19
+#define PIN_PA20 20u // PIN_A20
+#define PIN_PA23 23u // PIN_A23
+#define PIN_PWM0 20u // PIN_A20
+#define PIN_PWM1 12u // PIN_A12
+#define PIN_PWM2 14u // PIN_A14
+#define PIN_PWM3 15u // PIN_A15
+#define PIN_PWM4 16u // PIN_A16
+#define PIN_PWM5 17u // PIN_A17
+#define PIN_PWM6 18u // PIN_A18
+#define PIN_PWM7 23u // PIN_A23
+#define PIN_RTS0 9u // PIN_A9
+#define PIN_RTS2 20u // PIN_A20
+#define PIN_RX0 13u // PIN_A13
+#define PIN_RX1 2u // PIN_A2
+#define PIN_RX2 15u // PIN_A15
+#define PIN_SCK0 16u // PIN_A16
+#define PIN_SCL0 19u // PIN_A19
+#define PIN_SDA0 20u // PIN_A20
+#define PIN_TX0 14u // PIN_A14
+#define PIN_TX1 3u // PIN_A3
+#define PIN_TX2 16u // PIN_A16
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_WIRE0 1
+#define SERIAL_INTERFACES_COUNT 3
+#define SPI_INTERFACES_COUNT 1
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 0u // PIN_A0
+#define PIN_D1 1u // PIN_A1
+#define PIN_D2 2u // PIN_A2
+#define PIN_D3 3u // PIN_A3
+#define PIN_D4 4u // PIN_A4
+#define PIN_D5 7u // PIN_A7
+#define PIN_D6 8u // PIN_A8
+#define PIN_D7 9u // PIN_A9
+#define PIN_D8 10u // PIN_A10
+#define PIN_D9 11u // PIN_A11
+#define PIN_D10 12u // PIN_A12
+#define PIN_D11 13u // PIN_A13
+#define PIN_D12 14u // PIN_A14
+#define PIN_D13 15u // PIN_A15
+#define PIN_D14 16u // PIN_A16
+#define PIN_D15 17u // PIN_A17
+#define PIN_D16 18u // PIN_A18
+#define PIN_D17 19u // PIN_A19
+#define PIN_D18 20u // PIN_A20
+#define PIN_D19 23u // PIN_A23
+
+// Static pin names
+// ----------------
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
+static const unsigned char D16 = PIN_D16;
+static const unsigned char D17 = PIN_D17;
+static const unsigned char D18 = PIN_D18;
+static const unsigned char D19 = PIN_D19;
diff --git a/boards/lsc-lma35-t/variant.cpp b/boards/variants/lsc-lma35-t.c
similarity index 62%
rename from boards/lsc-lma35-t/variant.cpp
rename to boards/variants/lsc-lma35-t.c
index 19882ab..2ac070c 100644
--- a/boards/lsc-lma35-t/variant.cpp
+++ b/boards/variants/lsc-lma35-t.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P26, PWM5, IRDA
{GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
@@ -37,6 +39,22 @@ PinInfo pinTable[PINS_COUNT] = {
// D14: P1, UART2_RX, I2C2_SDA
{GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[5]), // GPIO0 (D5)
+ [1] = &(lt_arduino_pin_info_list[14]), // GPIO1 (D14)
+ [6] = &(lt_arduino_pin_info_list[10]), // GPIO6 (D10)
+ [7] = &(lt_arduino_pin_info_list[11]), // GPIO7 (D11)
+ [8] = &(lt_arduino_pin_info_list[7]), // GPIO8 (D7)
+ [9] = &(lt_arduino_pin_info_list[8]), // GPIO9 (D8)
+ [10] = &(lt_arduino_pin_info_list[12]), // GPIO10 (D12)
+ [11] = &(lt_arduino_pin_info_list[13]), // GPIO11 (D13)
+ [14] = &(lt_arduino_pin_info_list[1]), // GPIO14 (D1)
+ [16] = &(lt_arduino_pin_info_list[2]), // GPIO16 (D2)
+ [21] = &(lt_arduino_pin_info_list[9]), // GPIO21 (D9)
+ [22] = &(lt_arduino_pin_info_list[4]), // GPIO22 (D4)
+ [23] = &(lt_arduino_pin_info_list[6]), // GPIO23 (D6)
+ [24] = &(lt_arduino_pin_info_list[3]), // GPIO24 (D3)
+ [26] = &(lt_arduino_pin_info_list[0]), // GPIO26 (D0)
+};
+// clang-format on
diff --git a/boards/variants/lsc-lma35-t.h b/boards/variants/lsc-lma35-t.h
new file mode 100644
index 0000000..695df45
--- /dev/null
+++ b/boards/variants/lsc-lma35-t.h
@@ -0,0 +1,105 @@
+/* This file was auto-generated from lsc-lma35-t.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 15 // Total GPIO count
+#define NUM_DIGITAL_PINS 15 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_MOSI 16u // GPIO16
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P16 16u // GPIO16
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 26u // GPIO26
+#define PIN_D1 14u // GPIO14
+#define PIN_D2 16u // GPIO16
+#define PIN_D3 24u // GPIO24
+#define PIN_D4 22u // GPIO22
+#define PIN_D5 0u // GPIO0
+#define PIN_D6 23u // GPIO23
+#define PIN_D7 8u // GPIO8
+#define PIN_D8 9u // GPIO9
+#define PIN_D9 21u // GPIO21
+#define PIN_D10 6u // GPIO6
+#define PIN_D11 7u // GPIO7
+#define PIN_D12 10u // GPIO10
+#define PIN_D13 11u // GPIO11
+#define PIN_D14 1u // GPIO1
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
diff --git a/boards/lsc-lma35/variant.cpp b/boards/variants/lsc-lma35.c
similarity index 62%
rename from boards/lsc-lma35/variant.cpp
rename to boards/variants/lsc-lma35.c
index e07b81f..c04545b 100644
--- a/boards/lsc-lma35/variant.cpp
+++ b/boards/variants/lsc-lma35.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P26, PWM5, IRDA
{GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
@@ -37,6 +39,22 @@ PinInfo pinTable[PINS_COUNT] = {
// D14: P1, UART2_RX, I2C2_SDA
{GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[5]), // GPIO0 (D5)
+ [1] = &(lt_arduino_pin_info_list[14]), // GPIO1 (D14)
+ [6] = &(lt_arduino_pin_info_list[10]), // GPIO6 (D10)
+ [7] = &(lt_arduino_pin_info_list[11]), // GPIO7 (D11)
+ [8] = &(lt_arduino_pin_info_list[7]), // GPIO8 (D7)
+ [9] = &(lt_arduino_pin_info_list[8]), // GPIO9 (D8)
+ [10] = &(lt_arduino_pin_info_list[12]), // GPIO10 (D12)
+ [11] = &(lt_arduino_pin_info_list[13]), // GPIO11 (D13)
+ [14] = &(lt_arduino_pin_info_list[1]), // GPIO14 (D1)
+ [16] = &(lt_arduino_pin_info_list[2]), // GPIO16 (D2)
+ [21] = &(lt_arduino_pin_info_list[9]), // GPIO21 (D9)
+ [22] = &(lt_arduino_pin_info_list[4]), // GPIO22 (D4)
+ [23] = &(lt_arduino_pin_info_list[6]), // GPIO23 (D6)
+ [24] = &(lt_arduino_pin_info_list[3]), // GPIO24 (D3)
+ [26] = &(lt_arduino_pin_info_list[0]), // GPIO26 (D0)
+};
+// clang-format on
diff --git a/boards/variants/lsc-lma35.h b/boards/variants/lsc-lma35.h
new file mode 100644
index 0000000..4a0d153
--- /dev/null
+++ b/boards/variants/lsc-lma35.h
@@ -0,0 +1,105 @@
+/* This file was auto-generated from lsc-lma35.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 15 // Total GPIO count
+#define NUM_DIGITAL_PINS 15 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_MOSI 16u // GPIO16
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P16 16u // GPIO16
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 26u // GPIO26
+#define PIN_D1 14u // GPIO14
+#define PIN_D2 16u // GPIO16
+#define PIN_D3 24u // GPIO24
+#define PIN_D4 22u // GPIO22
+#define PIN_D5 0u // GPIO0
+#define PIN_D6 23u // GPIO23
+#define PIN_D7 8u // GPIO8
+#define PIN_D8 9u // GPIO9
+#define PIN_D9 21u // GPIO21
+#define PIN_D10 6u // GPIO6
+#define PIN_D11 7u // GPIO7
+#define PIN_D12 10u // GPIO10
+#define PIN_D13 11u // GPIO11
+#define PIN_D14 1u // GPIO1
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
diff --git a/boards/wb2l/variant.cpp b/boards/variants/wb2l.c
similarity index 61%
rename from boards/wb2l/variant.cpp
rename to boards/variants/wb2l.c
index 534343b..6501454 100644
--- a/boards/wb2l/variant.cpp
+++ b/boards/variants/wb2l.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P8, PWM2
{GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P7, PWM1
@@ -33,6 +35,20 @@ PinInfo pinTable[PINS_COUNT] = {
// D12: P22, TDI, FSI
{GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[8]), // GPIO0 (D8)
+ [1] = &(lt_arduino_pin_info_list[7]), // GPIO1 (D7)
+ [6] = &(lt_arduino_pin_info_list[2]), // GPIO6 (D2)
+ [7] = &(lt_arduino_pin_info_list[1]), // GPIO7 (D1)
+ [8] = &(lt_arduino_pin_info_list[0]), // GPIO8 (D0)
+ [10] = &(lt_arduino_pin_info_list[5]), // GPIO10 (D5)
+ [11] = &(lt_arduino_pin_info_list[6]), // GPIO11 (D6)
+ [20] = &(lt_arduino_pin_info_list[9]), // GPIO20 (D9)
+ [21] = &(lt_arduino_pin_info_list[10]), // GPIO21 (D10)
+ [22] = &(lt_arduino_pin_info_list[12]), // GPIO22 (D12)
+ [23] = &(lt_arduino_pin_info_list[11]), // GPIO23 (D11)
+ [24] = &(lt_arduino_pin_info_list[4]), // GPIO24 (D4)
+ [26] = &(lt_arduino_pin_info_list[3]), // GPIO26 (D3)
+};
+// clang-format on
diff --git a/boards/variants/wb2l.h b/boards/variants/wb2l.h
new file mode 100644
index 0000000..55a5d1b
--- /dev/null
+++ b/boards/variants/wb2l.h
@@ -0,0 +1,100 @@
+/* This file was auto-generated from wb2l.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 13 // Total GPIO count
+#define NUM_DIGITAL_PINS 13 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 5 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA 21u // GPIO21
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 8u // GPIO8
+#define PIN_D1 7u // GPIO7
+#define PIN_D2 6u // GPIO6
+#define PIN_D3 26u // GPIO26
+#define PIN_D4 24u // GPIO24
+#define PIN_D5 10u // GPIO10
+#define PIN_D6 11u // GPIO11
+#define PIN_D7 1u // GPIO1
+#define PIN_D8 0u // GPIO0
+#define PIN_D9 20u // GPIO20
+#define PIN_D10 21u // GPIO21
+#define PIN_D11 23u // GPIO23
+#define PIN_D12 22u // GPIO22
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
diff --git a/boards/wb2s/variant.cpp b/boards/variants/wb2s.c
similarity index 62%
rename from boards/wb2s/variant.cpp
rename to boards/variants/wb2s.c
index d0d6bc3..b08506c 100644
--- a/boards/wb2s/variant.cpp
+++ b/boards/variants/wb2s.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P8, PWM2
{GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P7, PWM1
@@ -35,6 +37,21 @@ PinInfo pinTable[PINS_COUNT] = {
// D13: P22, TDI, FSI
{GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[11]), // GPIO0 (D11)
+ [1] = &(lt_arduino_pin_info_list[10]), // GPIO1 (D10)
+ [6] = &(lt_arduino_pin_info_list[2]), // GPIO6 (D2)
+ [7] = &(lt_arduino_pin_info_list[1]), // GPIO7 (D1)
+ [8] = &(lt_arduino_pin_info_list[0]), // GPIO8 (D0)
+ [9] = &(lt_arduino_pin_info_list[9]), // GPIO9 (D9)
+ [10] = &(lt_arduino_pin_info_list[4]), // GPIO10 (D4)
+ [11] = &(lt_arduino_pin_info_list[5]), // GPIO11 (D5)
+ [20] = &(lt_arduino_pin_info_list[8]), // GPIO20 (D8)
+ [21] = &(lt_arduino_pin_info_list[12]), // GPIO21 (D12)
+ [22] = &(lt_arduino_pin_info_list[13]), // GPIO22 (D13)
+ [23] = &(lt_arduino_pin_info_list[3]), // GPIO23 (D3)
+ [24] = &(lt_arduino_pin_info_list[6]), // GPIO24 (D6)
+ [26] = &(lt_arduino_pin_info_list[7]), // GPIO26 (D7)
+};
+// clang-format on
diff --git a/boards/variants/wb2s.h b/boards/variants/wb2s.h
new file mode 100644
index 0000000..b7b5102
--- /dev/null
+++ b/boards/variants/wb2s.h
@@ -0,0 +1,104 @@
+/* This file was auto-generated from wb2s.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 14 // Total GPIO count
+#define NUM_DIGITAL_PINS 14 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA 21u // GPIO21
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 8u // GPIO8
+#define PIN_D1 7u // GPIO7
+#define PIN_D2 6u // GPIO6
+#define PIN_D3 23u // GPIO23
+#define PIN_D4 10u // GPIO10
+#define PIN_D5 11u // GPIO11
+#define PIN_D6 24u // GPIO24
+#define PIN_D7 26u // GPIO26
+#define PIN_D8 20u // GPIO20
+#define PIN_D9 9u // GPIO9
+#define PIN_D10 1u // GPIO1
+#define PIN_D11 0u // GPIO0
+#define PIN_D12 21u // GPIO21
+#define PIN_D13 22u // GPIO22
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
diff --git a/boards/wb3l/variant.cpp b/boards/variants/wb3l.c
similarity index 62%
rename from boards/wb3l/variant.cpp
rename to boards/variants/wb3l.c
index 41ddfce..aad420e 100644
--- a/boards/wb3l/variant.cpp
+++ b/boards/variants/wb3l.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
@@ -39,6 +41,23 @@ PinInfo pinTable[PINS_COUNT] = {
// D15: P1, UART2_RX, I2C2_SDA
{GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[6]), // GPIO0 (D6)
+ [1] = &(lt_arduino_pin_info_list[15]), // GPIO1 (D15)
+ [6] = &(lt_arduino_pin_info_list[4]), // GPIO6 (D4)
+ [7] = &(lt_arduino_pin_info_list[9]), // GPIO7 (D9)
+ [8] = &(lt_arduino_pin_info_list[8]), // GPIO8 (D8)
+ [9] = &(lt_arduino_pin_info_list[5]), // GPIO9 (D5)
+ [10] = &(lt_arduino_pin_info_list[10]), // GPIO10 (D10)
+ [11] = &(lt_arduino_pin_info_list[11]), // GPIO11 (D11)
+ [14] = &(lt_arduino_pin_info_list[1]), // GPIO14 (D1)
+ [16] = &(lt_arduino_pin_info_list[7]), // GPIO16 (D7)
+ [20] = &(lt_arduino_pin_info_list[14]), // GPIO20 (D14)
+ [21] = &(lt_arduino_pin_info_list[13]), // GPIO21 (D13)
+ [22] = &(lt_arduino_pin_info_list[12]), // GPIO22 (D12)
+ [23] = &(lt_arduino_pin_info_list[0]), // GPIO23 (D0)
+ [24] = &(lt_arduino_pin_info_list[3]), // GPIO24 (D3)
+ [26] = &(lt_arduino_pin_info_list[2]), // GPIO26 (D2)
+};
+// clang-format on
diff --git a/boards/variants/wb3l.h b/boards/variants/wb3l.h
new file mode 100644
index 0000000..77e07bc
--- /dev/null
+++ b/boards/variants/wb3l.h
@@ -0,0 +1,112 @@
+/* This file was auto-generated from wb3l.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 16 // Total GPIO count
+#define NUM_DIGITAL_PINS 16 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA 21u // GPIO21
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_MOSI 16u // GPIO16
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P16 16u // GPIO16
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 23u // GPIO23
+#define PIN_D1 14u // GPIO14
+#define PIN_D2 26u // GPIO26
+#define PIN_D3 24u // GPIO24
+#define PIN_D4 6u // GPIO6
+#define PIN_D5 9u // GPIO9
+#define PIN_D6 0u // GPIO0
+#define PIN_D7 16u // GPIO16
+#define PIN_D8 8u // GPIO8
+#define PIN_D9 7u // GPIO7
+#define PIN_D10 10u // GPIO10
+#define PIN_D11 11u // GPIO11
+#define PIN_D12 22u // GPIO22
+#define PIN_D13 21u // GPIO21
+#define PIN_D14 20u // GPIO20
+#define PIN_D15 1u // GPIO1
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
+static const unsigned char D15 = PIN_D15;
diff --git a/boards/wb3s/variant.cpp b/boards/variants/wb3s.c
similarity index 62%
rename from boards/wb3s/variant.cpp
rename to boards/variants/wb3s.c
index 3b4e22b..9866697 100644
--- a/boards/wb3s/variant.cpp
+++ b/boards/variants/wb3s.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
@@ -37,6 +39,22 @@ PinInfo pinTable[PINS_COUNT] = {
// D14: P20, I2C1_SCL, TCK, FSCK
{GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[6]), // GPIO0 (D6)
+ [1] = &(lt_arduino_pin_info_list[7]), // GPIO1 (D7)
+ [6] = &(lt_arduino_pin_info_list[4]), // GPIO6 (D4)
+ [7] = &(lt_arduino_pin_info_list[5]), // GPIO7 (D5)
+ [8] = &(lt_arduino_pin_info_list[9]), // GPIO8 (D9)
+ [9] = &(lt_arduino_pin_info_list[8]), // GPIO9 (D8)
+ [10] = &(lt_arduino_pin_info_list[10]), // GPIO10 (D10)
+ [11] = &(lt_arduino_pin_info_list[11]), // GPIO11 (D11)
+ [14] = &(lt_arduino_pin_info_list[1]), // GPIO14 (D1)
+ [20] = &(lt_arduino_pin_info_list[14]), // GPIO20 (D14)
+ [21] = &(lt_arduino_pin_info_list[13]), // GPIO21 (D13)
+ [22] = &(lt_arduino_pin_info_list[12]), // GPIO22 (D12)
+ [23] = &(lt_arduino_pin_info_list[0]), // GPIO23 (D0)
+ [24] = &(lt_arduino_pin_info_list[3]), // GPIO24 (D3)
+ [26] = &(lt_arduino_pin_info_list[2]), // GPIO26 (D2)
+};
+// clang-format on
diff --git a/boards/variants/wb3s.h b/boards/variants/wb3s.h
new file mode 100644
index 0000000..f875fe8
--- /dev/null
+++ b/boards/variants/wb3s.h
@@ -0,0 +1,108 @@
+/* This file was auto-generated from wb3s.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 15 // Total GPIO count
+#define NUM_DIGITAL_PINS 15 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 26 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 20u // GPIO20
+#define PIN_WIRE1_SDA 21u // GPIO21
+#define PIN_WIRE2_SCL 0u // GPIO0
+#define PIN_WIRE2_SDA 1u // GPIO1
+
+// Serial ports
+// ------------
+#define PIN_SERIAL1_RX 10u // GPIO10
+#define PIN_SERIAL1_TX 11u // GPIO11
+#define PIN_SERIAL2_RX 1u // GPIO1
+#define PIN_SERIAL2_TX 0u // GPIO0
+
+// Pin function macros
+// -------------------
+#define PIN_ADC3 23u // GPIO23
+#define PIN_P0 0u // GPIO0
+#define PIN_P1 1u // GPIO1
+#define PIN_P6 6u // GPIO6
+#define PIN_P7 7u // GPIO7
+#define PIN_P8 8u // GPIO8
+#define PIN_P9 9u // GPIO9
+#define PIN_P10 10u // GPIO10
+#define PIN_P11 11u // GPIO11
+#define PIN_P14 14u // GPIO14
+#define PIN_P20 20u // GPIO20
+#define PIN_P21 21u // GPIO21
+#define PIN_P22 22u // GPIO22
+#define PIN_P23 23u // GPIO23
+#define PIN_P24 24u // GPIO24
+#define PIN_P26 26u // GPIO26
+#define PIN_PWM0 6u // GPIO6
+#define PIN_PWM1 7u // GPIO7
+#define PIN_PWM2 8u // GPIO8
+#define PIN_PWM3 9u // GPIO9
+#define PIN_PWM4 24u // GPIO24
+#define PIN_PWM5 26u // GPIO26
+#define PIN_RX1 10u // GPIO10
+#define PIN_RX2 1u // GPIO1
+#define PIN_SCK 14u // GPIO14
+#define PIN_SCL1 20u // GPIO20
+#define PIN_SCL2 0u // GPIO0
+#define PIN_SDA1 21u // GPIO21
+#define PIN_SDA2 1u // GPIO1
+#define PIN_TX1 11u // GPIO11
+#define PIN_TX2 0u // GPIO0
+
+// Port availability
+// -----------------
+#define HAS_SERIAL1 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE1 1
+#define HAS_WIRE2 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 23u // GPIO23
+#define PIN_D1 14u // GPIO14
+#define PIN_D2 26u // GPIO26
+#define PIN_D3 24u // GPIO24
+#define PIN_D4 6u // GPIO6
+#define PIN_D5 7u // GPIO7
+#define PIN_D6 0u // GPIO0
+#define PIN_D7 1u // GPIO1
+#define PIN_D8 9u // GPIO9
+#define PIN_D9 8u // GPIO8
+#define PIN_D10 10u // GPIO10
+#define PIN_D11 11u // GPIO11
+#define PIN_D12 22u // GPIO22
+#define PIN_D13 21u // GPIO21
+#define PIN_D14 20u // GPIO20
+#define PIN_A0 23u // GPIO23
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
+static const unsigned char D11 = PIN_D11;
+static const unsigned char D12 = PIN_D12;
+static const unsigned char D13 = PIN_D13;
+static const unsigned char D14 = PIN_D14;
diff --git a/boards/wr2/variant.cpp b/boards/variants/wr2.c
similarity index 65%
rename from boards/wr2/variant.cpp
rename to boards/variants/wr2.c
index 7c5f0fa..7dcdcdc 100644
--- a/boards/wr2/variant.cpp
+++ b/boards/variants/wr2.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA12, PWM3
{PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: PA00, PWM2
@@ -23,6 +25,15 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[1]), // PA_0 (D1)
+ [5] = &(lt_arduino_pin_info_list[2]), // PA_5 (D2)
+ [12] = &(lt_arduino_pin_info_list[0]), // PA_12 (D0)
+ [14] = &(lt_arduino_pin_info_list[5]), // PA_14 (D6)
+ [15] = &(lt_arduino_pin_info_list[6]), // PA_15 (D7)
+ [18] = &(lt_arduino_pin_info_list[3]), // PA_18 (D4)
+ [23] = &(lt_arduino_pin_info_list[4]), // PA_23 (D5)
+ [41] = &(lt_arduino_pin_info_list[7]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/wr2.h b/boards/variants/wr2.h
new file mode 100644
index 0000000..0c9909d
--- /dev/null
+++ b/boards/variants/wr2.h
@@ -0,0 +1,76 @@
+/* This file was auto-generated from wr2.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 8 // Total GPIO count
+#define NUM_DIGITAL_PINS 7 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 6 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+
+// Pin function macros
+// -------------------
+#define PIN_ADC2 41u // AD_2
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA23 23u // PA_23
+#define PIN_PWM0 14u // PA_14
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_RX0 18u // PA_18
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 1
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 12u // PA_12
+#define PIN_D1 0u // PA_0
+#define PIN_D2 5u // PA_5
+#define PIN_D4 18u // PA_18
+#define PIN_D5 23u // PA_23
+#define PIN_D6 14u // PA_14
+#define PIN_D7 15u // PA_15
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
diff --git a/boards/wr2e/variant.cpp b/boards/variants/wr2e.c
similarity index 68%
rename from boards/wr2e/variant.cpp
rename to boards/variants/wr2e.c
index 3175921..ab08bfb 100644
--- a/boards/wr2e/variant.cpp
+++ b/boards/variants/wr2e.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA12, PWM3
{PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: PA19, ADC1, UART0_CTS, SPI0_CS, SPI1_CS, I2C0_SDA, SD_D3, TMR5_TRIG, I2S0_TX
@@ -23,6 +25,15 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [5] = &(lt_arduino_pin_info_list[2]), // PA_5 (D2)
+ [12] = &(lt_arduino_pin_info_list[0]), // PA_12 (D0)
+ [14] = &(lt_arduino_pin_info_list[5]), // PA_14 (D5)
+ [15] = &(lt_arduino_pin_info_list[6]), // PA_15 (D6)
+ [18] = &(lt_arduino_pin_info_list[3]), // PA_18 (D3)
+ [19] = &(lt_arduino_pin_info_list[1]), // PA_19 (D1)
+ [23] = &(lt_arduino_pin_info_list[4]), // PA_23 (D4)
+ [41] = &(lt_arduino_pin_info_list[7]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/wr2e.h b/boards/variants/wr2e.h
new file mode 100644
index 0000000..279dbaf
--- /dev/null
+++ b/boards/variants/wr2e.h
@@ -0,0 +1,83 @@
+/* This file was auto-generated from wr2e.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 8 // Total GPIO count
+#define NUM_DIGITAL_PINS 7 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 2 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 5 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_ADC2 41u // AD_2
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA23 23u // PA_23
+#define PIN_PWM0 14u // PA_14
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_RX0 18u // PA_18
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 19u // PA_19
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 1
+#define WIRE_INTERFACES_COUNT 1
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 12u // PA_12
+#define PIN_D1 19u // PA_19
+#define PIN_D2 5u // PA_5
+#define PIN_D3 18u // PA_18
+#define PIN_D4 23u // PA_23
+#define PIN_D5 14u // PA_14
+#define PIN_D6 15u // PA_15
+#define PIN_A0 19u // PA_19
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
diff --git a/boards/wr2l/variant.cpp b/boards/variants/wr2l.c
similarity index 65%
rename from boards/wr2l/variant.cpp
rename to boards/variants/wr2l.c
index 525dcf2..250ab34 100644
--- a/boards/wr2l/variant.cpp
+++ b/boards/variants/wr2l.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA15, PWM1, SWDIO
{PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0},
// D1: PA14, PWM0, SWCLK
@@ -17,6 +19,12 @@ PinInfo pinTable[PINS_COUNT] = {
// D4: PA12, PWM3
{PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [5] = &(lt_arduino_pin_info_list[2]), // PA_5 (D2)
+ [12] = &(lt_arduino_pin_info_list[4]), // PA_12 (D4)
+ [14] = &(lt_arduino_pin_info_list[1]), // PA_14 (D1)
+ [15] = &(lt_arduino_pin_info_list[0]), // PA_15 (D0)
+ [19] = &(lt_arduino_pin_info_list[3]), // PA_19 (D3)
+};
+// clang-format on
diff --git a/boards/variants/wr2l.h b/boards/variants/wr2l.h
new file mode 100644
index 0000000..70feccd
--- /dev/null
+++ b/boards/variants/wr2l.h
@@ -0,0 +1,48 @@
+/* This file was auto-generated from wr2l.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 5 // Total GPIO count
+#define NUM_DIGITAL_PINS 5 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 4 // PWM & DAC outputs
+#define PINS_GPIO_MAX 19 // Last usable GPIO number
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA19 19u // PA_19
+#define PIN_PWM0 14u // PA_14
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_SDA0 19u // PA_19
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 15u // PA_15
+#define PIN_D1 14u // PA_14
+#define PIN_D2 5u // PA_5
+#define PIN_D3 19u // PA_19
+#define PIN_D4 12u // PA_12
+#define PIN_A0 19u // PA_19
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
diff --git a/boards/wr2le/variant.cpp b/boards/variants/wr2le.c
similarity index 65%
rename from boards/wr2le/variant.cpp
rename to boards/variants/wr2le.c
index 677ebf2..00570cf 100644
--- a/boards/wr2le/variant.cpp
+++ b/boards/variants/wr2le.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA15, PWM1, SWDIO
{PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0},
// D1: PA14, PWM0, SWCLK
@@ -17,6 +19,12 @@ PinInfo pinTable[PINS_COUNT] = {
// D4: PA12, PWM3
{PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [5] = &(lt_arduino_pin_info_list[2]), // PA_5 (D2)
+ [12] = &(lt_arduino_pin_info_list[4]), // PA_12 (D4)
+ [14] = &(lt_arduino_pin_info_list[1]), // PA_14 (D1)
+ [15] = &(lt_arduino_pin_info_list[0]), // PA_15 (D0)
+ [22] = &(lt_arduino_pin_info_list[3]), // PA_22 (D3)
+};
+// clang-format on
diff --git a/boards/variants/wr2le.h b/boards/variants/wr2le.h
new file mode 100644
index 0000000..5ac549c
--- /dev/null
+++ b/boards/variants/wr2le.h
@@ -0,0 +1,46 @@
+/* This file was auto-generated from wr2le.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 5 // Total GPIO count
+#define NUM_DIGITAL_PINS 5 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 0 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 5 // PWM & DAC outputs
+#define PINS_GPIO_MAX 22 // Last usable GPIO number
+
+// Pin function macros
+// -------------------
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA22 22u // PA_22
+#define PIN_PWM0 14u // PA_14
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_SCL0 22u // PA_22
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 15u // PA_15
+#define PIN_D1 14u // PA_14
+#define PIN_D2 5u // PA_5
+#define PIN_D3 22u // PA_22
+#define PIN_D4 12u // PA_12
+
+// Static pin names
+// ----------------
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
diff --git a/boards/wr3/variant.cpp b/boards/variants/wr3.c
similarity index 68%
rename from boards/wr3/variant.cpp
rename to boards/variants/wr3.c
index 43aaa4b..abdd128 100644
--- a/boards/wr3/variant.cpp
+++ b/boards/variants/wr3.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA22, UART0_RTS, SPI0_MISO, SPI1_MISO, I2C0_SCL, SD_D0, PWM5, I2S0_WS, WAKE2
{PA_22, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
// D1: PA19, ADC1, UART0_CTS, SPI0_CS, SPI1_CS, I2C0_SDA, SD_D3, TMR5_TRIG, I2S0_TX
@@ -31,6 +33,19 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[4]), // PA_0 (D4)
+ [5] = &(lt_arduino_pin_info_list[7]), // PA_5 (D7)
+ [12] = &(lt_arduino_pin_info_list[8]), // PA_12 (D8)
+ [14] = &(lt_arduino_pin_info_list[2]), // PA_14 (D2)
+ [15] = &(lt_arduino_pin_info_list[3]), // PA_15 (D3)
+ [18] = &(lt_arduino_pin_info_list[9]), // PA_18 (D9)
+ [19] = &(lt_arduino_pin_info_list[1]), // PA_19 (D1)
+ [22] = &(lt_arduino_pin_info_list[0]), // PA_22 (D0)
+ [23] = &(lt_arduino_pin_info_list[10]), // PA_23 (D10)
+ [29] = &(lt_arduino_pin_info_list[5]), // PA_29 (D5)
+ [30] = &(lt_arduino_pin_info_list[6]), // PA_30 (D6)
+ [41] = &(lt_arduino_pin_info_list[11]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/wr3.h b/boards/variants/wr3.h
new file mode 100644
index 0000000..e479168
--- /dev/null
+++ b/boards/variants/wr3.h
@@ -0,0 +1,126 @@
+/* This file was auto-generated from wr3.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 12 // Total GPIO count
+#define NUM_DIGITAL_PINS 11 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 2 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 22u // PA_22
+#define PIN_WIRE0_SCL_1 29u // PA_29
+#define PIN_WIRE0_SDA_0 19u // PA_19
+#define PIN_WIRE0_SDA_1 30u // PA_30
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_ADC2 41u // AD_2
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 29u // PA_29
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 30u // PA_30
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 22u // PA_22
+#define PIN_D1 19u // PA_19
+#define PIN_D2 14u // PA_14
+#define PIN_D3 15u // PA_15
+#define PIN_D4 0u // PA_0
+#define PIN_D5 29u // PA_29
+#define PIN_D6 30u // PA_30
+#define PIN_D7 5u // PA_5
+#define PIN_D8 12u // PA_12
+#define PIN_D9 18u // PA_18
+#define PIN_D10 23u // PA_23
+#define PIN_A0 19u // PA_19
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
diff --git a/boards/wr3e/variant.cpp b/boards/variants/wr3e.c
similarity index 68%
rename from boards/wr3e/variant.cpp
rename to boards/variants/wr3e.c
index 0739909..e47c10c 100644
--- a/boards/wr3e/variant.cpp
+++ b/boards/variants/wr3e.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA29, UART2_RX, I2C0_SCL, PWM4
{PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D1: PA14, PWM0, SWCLK
@@ -31,6 +33,19 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[4]), // PA_0 (D4)
+ [5] = &(lt_arduino_pin_info_list[7]), // PA_5 (D7)
+ [12] = &(lt_arduino_pin_info_list[8]), // PA_12 (D8)
+ [14] = &(lt_arduino_pin_info_list[1]), // PA_14 (D1)
+ [15] = &(lt_arduino_pin_info_list[2]), // PA_15 (D2)
+ [18] = &(lt_arduino_pin_info_list[9]), // PA_18 (D9)
+ [19] = &(lt_arduino_pin_info_list[6]), // PA_19 (D6)
+ [22] = &(lt_arduino_pin_info_list[3]), // PA_22 (D3)
+ [23] = &(lt_arduino_pin_info_list[10]), // PA_23 (D10)
+ [29] = &(lt_arduino_pin_info_list[0]), // PA_29 (D0)
+ [30] = &(lt_arduino_pin_info_list[5]), // PA_30 (D5)
+ [41] = &(lt_arduino_pin_info_list[11]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/wr3e.h b/boards/variants/wr3e.h
new file mode 100644
index 0000000..4a4c942
--- /dev/null
+++ b/boards/variants/wr3e.h
@@ -0,0 +1,126 @@
+/* This file was auto-generated from wr3e.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 12 // Total GPIO count
+#define NUM_DIGITAL_PINS 11 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 2 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 29u // PA_29
+#define PIN_WIRE0_SCL_1 22u // PA_22
+#define PIN_WIRE0_SDA_0 30u // PA_30
+#define PIN_WIRE0_SDA_1 19u // PA_19
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_ADC2 41u // AD_2
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 22u // PA_22
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 19u // PA_19
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 29u // PA_29
+#define PIN_D1 14u // PA_14
+#define PIN_D2 15u // PA_15
+#define PIN_D3 22u // PA_22
+#define PIN_D4 0u // PA_0
+#define PIN_D5 30u // PA_30
+#define PIN_D6 19u // PA_19
+#define PIN_D7 5u // PA_5
+#define PIN_D8 12u // PA_12
+#define PIN_D9 18u // PA_18
+#define PIN_D10 23u // PA_23
+#define PIN_A0 19u // PA_19
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
diff --git a/boards/wr3l/variant.cpp b/boards/variants/wr3l.c
similarity index 68%
rename from boards/wr3l/variant.cpp
rename to boards/variants/wr3l.c
index 977b8ef..8261af7 100644
--- a/boards/wr3l/variant.cpp
+++ b/boards/variants/wr3l.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA22, UART0_RTS, SPI0_MISO, SPI1_MISO, I2C0_SCL, SD_D0, PWM5, I2S0_WS, WAKE2
{PA_22, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
// D1: PA19, ADC1, UART0_CTS, SPI0_CS, SPI1_CS, I2C0_SDA, SD_D3, TMR5_TRIG, I2S0_TX
@@ -31,6 +33,19 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[4]), // PA_0 (D4)
+ [5] = &(lt_arduino_pin_info_list[7]), // PA_5 (D7)
+ [12] = &(lt_arduino_pin_info_list[8]), // PA_12 (D8)
+ [14] = &(lt_arduino_pin_info_list[2]), // PA_14 (D2)
+ [15] = &(lt_arduino_pin_info_list[3]), // PA_15 (D3)
+ [18] = &(lt_arduino_pin_info_list[9]), // PA_18 (D9)
+ [19] = &(lt_arduino_pin_info_list[1]), // PA_19 (D1)
+ [22] = &(lt_arduino_pin_info_list[0]), // PA_22 (D0)
+ [23] = &(lt_arduino_pin_info_list[10]), // PA_23 (D10)
+ [29] = &(lt_arduino_pin_info_list[5]), // PA_29 (D5)
+ [30] = &(lt_arduino_pin_info_list[6]), // PA_30 (D6)
+ [41] = &(lt_arduino_pin_info_list[11]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/wr3l.h b/boards/variants/wr3l.h
new file mode 100644
index 0000000..5a692a6
--- /dev/null
+++ b/boards/variants/wr3l.h
@@ -0,0 +1,126 @@
+/* This file was auto-generated from wr3l.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 12 // Total GPIO count
+#define NUM_DIGITAL_PINS 11 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 2 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 22u // PA_22
+#define PIN_WIRE0_SCL_1 29u // PA_29
+#define PIN_WIRE0_SDA_0 19u // PA_19
+#define PIN_WIRE0_SDA_1 30u // PA_30
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_ADC2 41u // AD_2
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 29u // PA_29
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 30u // PA_30
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 22u // PA_22
+#define PIN_D1 19u // PA_19
+#define PIN_D2 14u // PA_14
+#define PIN_D3 15u // PA_15
+#define PIN_D4 0u // PA_0
+#define PIN_D5 29u // PA_29
+#define PIN_D6 30u // PA_30
+#define PIN_D7 5u // PA_5
+#define PIN_D8 12u // PA_12
+#define PIN_D9 18u // PA_18
+#define PIN_D10 23u // PA_23
+#define PIN_A0 19u // PA_19
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
diff --git a/boards/wr3le/variant.cpp b/boards/variants/wr3le.c
similarity index 68%
rename from boards/wr3le/variant.cpp
rename to boards/variants/wr3le.c
index 4fac504..b96370f 100644
--- a/boards/wr3le/variant.cpp
+++ b/boards/variants/wr3le.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA29, UART2_RX, I2C0_SCL, PWM4
{PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D1: PA14, PWM0, SWCLK
@@ -31,6 +33,19 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[4]), // PA_0 (D4)
+ [5] = &(lt_arduino_pin_info_list[7]), // PA_5 (D7)
+ [12] = &(lt_arduino_pin_info_list[8]), // PA_12 (D8)
+ [14] = &(lt_arduino_pin_info_list[1]), // PA_14 (D1)
+ [15] = &(lt_arduino_pin_info_list[2]), // PA_15 (D2)
+ [18] = &(lt_arduino_pin_info_list[9]), // PA_18 (D9)
+ [19] = &(lt_arduino_pin_info_list[6]), // PA_19 (D6)
+ [22] = &(lt_arduino_pin_info_list[3]), // PA_22 (D3)
+ [23] = &(lt_arduino_pin_info_list[10]), // PA_23 (D10)
+ [29] = &(lt_arduino_pin_info_list[0]), // PA_29 (D0)
+ [30] = &(lt_arduino_pin_info_list[5]), // PA_30 (D5)
+ [41] = &(lt_arduino_pin_info_list[11]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/wr3le.h b/boards/variants/wr3le.h
new file mode 100644
index 0000000..8063f1b
--- /dev/null
+++ b/boards/variants/wr3le.h
@@ -0,0 +1,126 @@
+/* This file was auto-generated from wr3le.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 12 // Total GPIO count
+#define NUM_DIGITAL_PINS 11 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 2 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// SPI Interfaces
+// --------------
+#define PIN_SPI0_CS 19u // PA_19
+#define PIN_SPI0_MISO 22u // PA_22
+#define PIN_SPI0_MOSI 23u // PA_23
+#define PIN_SPI0_SCK 18u // PA_18
+#define PIN_SPI1_CS 19u // PA_19
+#define PIN_SPI1_MISO 22u // PA_22
+#define PIN_SPI1_MOSI 23u // PA_23
+#define PIN_SPI1_SCK 18u // PA_18
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL_0 29u // PA_29
+#define PIN_WIRE0_SCL_1 22u // PA_22
+#define PIN_WIRE0_SDA_0 30u // PA_30
+#define PIN_WIRE0_SDA_1 19u // PA_19
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_CTS 19u // PA_19
+#define PIN_SERIAL0_RTS 22u // PA_22
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC1 19u // PA_19
+#define PIN_ADC2 41u // AD_2
+#define PIN_CS0 19u // PA_19
+#define PIN_CS1 19u // PA_19
+#define PIN_CTS0 19u // PA_19
+#define PIN_MISO0 22u // PA_22
+#define PIN_MISO1 22u // PA_22
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA19 19u // PA_19
+#define PIN_PA22 22u // PA_22
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_PWM5 22u // PA_22
+#define PIN_RTS0 22u // PA_22
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 22u // PA_22
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 19u // PA_19
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_SPI0 1
+#define HAS_SPI1 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define SPI_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 29u // PA_29
+#define PIN_D1 14u // PA_14
+#define PIN_D2 15u // PA_15
+#define PIN_D3 22u // PA_22
+#define PIN_D4 0u // PA_0
+#define PIN_D5 30u // PA_30
+#define PIN_D6 19u // PA_19
+#define PIN_D7 5u // PA_5
+#define PIN_D8 12u // PA_12
+#define PIN_D9 18u // PA_18
+#define PIN_D10 23u // PA_23
+#define PIN_A0 19u // PA_19
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A0 = PIN_A0;
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
+static const unsigned char D9 = PIN_D9;
+static const unsigned char D10 = PIN_D10;
diff --git a/boards/wr3n/variant.cpp b/boards/variants/wr3n.c
similarity index 66%
rename from boards/wr3n/variant.cpp
rename to boards/variants/wr3n.c
index 955c0a4..5af75b6 100644
--- a/boards/wr3n/variant.cpp
+++ b/boards/variants/wr3n.c
@@ -2,10 +2,12 @@
#include
-extern "C" {
+#ifdef LT_VARIANT_INCLUDE
+#include LT_VARIANT_INCLUDE
+#endif
// clang-format off
-PinInfo pinTable[PINS_COUNT] = {
+PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA29, UART2_RX, I2C0_SCL, PWM4
{PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D1: PA14, PWM0, SWCLK
@@ -27,6 +29,17 @@ PinInfo pinTable[PINS_COUNT] = {
// A1: ADC2
{AD_2, PIN_ADC, PIN_NONE, 0},
};
-// clang-format on
-} // extern "C"
+PinInfo *lt_arduino_pin_gpio_map[] = {
+ [0] = &(lt_arduino_pin_info_list[3]), // PA_0 (D3)
+ [5] = &(lt_arduino_pin_info_list[5]), // PA_5 (D5)
+ [12] = &(lt_arduino_pin_info_list[6]), // PA_12 (D6)
+ [14] = &(lt_arduino_pin_info_list[1]), // PA_14 (D1)
+ [15] = &(lt_arduino_pin_info_list[2]), // PA_15 (D2)
+ [18] = &(lt_arduino_pin_info_list[7]), // PA_18 (D7)
+ [23] = &(lt_arduino_pin_info_list[8]), // PA_23 (D8)
+ [29] = &(lt_arduino_pin_info_list[0]), // PA_29 (D0)
+ [30] = &(lt_arduino_pin_info_list[4]), // PA_30 (D4)
+ [41] = &(lt_arduino_pin_info_list[9]), // AD_2 (A1)
+};
+// clang-format on
diff --git a/boards/variants/wr3n.h b/boards/variants/wr3n.h
new file mode 100644
index 0000000..0c44afa
--- /dev/null
+++ b/boards/variants/wr3n.h
@@ -0,0 +1,92 @@
+/* This file was auto-generated from wr3n.json using boardgen */
+
+#pragma once
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 10 // Total GPIO count
+#define NUM_DIGITAL_PINS 9 // Digital inputs/outputs
+#define NUM_ANALOG_INPUTS 1 // ADC inputs
+#define NUM_ANALOG_OUTPUTS 8 // PWM & DAC outputs
+#define PINS_GPIO_MAX 41 // Last usable GPIO number
+
+// Wire Interfaces
+// ---------------
+#define PIN_WIRE0_SCL 29u // PA_29
+#define PIN_WIRE0_SDA 30u // PA_30
+#define PIN_WIRE1_SCL 18u // PA_18
+#define PIN_WIRE1_SDA 23u // PA_23
+
+// Serial ports
+// ------------
+#define PIN_SERIAL0_RX 18u // PA_18
+#define PIN_SERIAL0_TX 23u // PA_23
+#define PIN_SERIAL2_RX 29u // PA_29
+#define PIN_SERIAL2_TX 30u // PA_30
+
+// Pin function macros
+// -------------------
+#define PIN_ADC2 41u // AD_2
+#define PIN_MOSI0 23u // PA_23
+#define PIN_MOSI1 23u // PA_23
+#define PIN_PA00 0u // PA_0
+#define PIN_PA05 5u // PA_5
+#define PIN_PA12 12u // PA_12
+#define PIN_PA14 14u // PA_14
+#define PIN_PA15 15u // PA_15
+#define PIN_PA18 18u // PA_18
+#define PIN_PA23 23u // PA_23
+#define PIN_PA29 29u // PA_29
+#define PIN_PA30 30u // PA_30
+#define PIN_PWM0 23u // PA_23
+#define PIN_PWM1 15u // PA_15
+#define PIN_PWM2 0u // PA_0
+#define PIN_PWM3 12u // PA_12
+#define PIN_PWM4 5u // PA_5
+#define PIN_RX0 18u // PA_18
+#define PIN_RX2 29u // PA_29
+#define PIN_SCK0 18u // PA_18
+#define PIN_SCK1 18u // PA_18
+#define PIN_SCL0 29u // PA_29
+#define PIN_SCL1 18u // PA_18
+#define PIN_SDA0 30u // PA_30
+#define PIN_SDA1 23u // PA_23
+#define PIN_TX0 23u // PA_23
+#define PIN_TX2 30u // PA_30
+
+// Port availability
+// -----------------
+#define HAS_SERIAL0 1
+#define HAS_SERIAL2 1
+#define HAS_WIRE0 1
+#define HAS_WIRE1 1
+#define SERIAL_INTERFACES_COUNT 2
+#define WIRE_INTERFACES_COUNT 2
+
+// Arduino pin names
+// -----------------
+#define PIN_D0 29u // PA_29
+#define PIN_D1 14u // PA_14
+#define PIN_D2 15u // PA_15
+#define PIN_D3 0u // PA_0
+#define PIN_D4 30u // PA_30
+#define PIN_D5 5u // PA_5
+#define PIN_D6 12u // PA_12
+#define PIN_D7 18u // PA_18
+#define PIN_D8 23u // PA_23
+#define PIN_A1 41u // AD_2
+
+// Static pin names
+// ----------------
+static const unsigned char A1 = PIN_A1;
+static const unsigned char D0 = PIN_D0;
+static const unsigned char D1 = PIN_D1;
+static const unsigned char D2 = PIN_D2;
+static const unsigned char D3 = PIN_D3;
+static const unsigned char D4 = PIN_D4;
+static const unsigned char D5 = PIN_D5;
+static const unsigned char D6 = PIN_D6;
+static const unsigned char D7 = PIN_D7;
+static const unsigned char D8 = PIN_D8;
diff --git a/boards/wb2l/README.md b/boards/wb2l/README.md
deleted file mode 100644
index 698083f..0000000
--- a/boards/wb2l/README.md
+++ /dev/null
@@ -1,87 +0,0 @@
-# WB2L Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wb2l-datasheet?id=K9duegc9bualu)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wb2l`
-MCU | BK7231T
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 13x GPIO, 5x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v4.2
-FCC ID | [2ANDL-WB2L](https://fccid.io/2ANDL-WB2L)
-
-## Usage
-
-**Board code:** `wb2l`
-
-In `platformio.ini`:
-
-```ini
-[env:wb2l]
-platform = libretuya
-board = wb2l
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wb2l
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|-----|------|------
-D0 | P8 | | | | PWM2 |
-D1 | P7 | | | | PWM1 |
-D2 | P6 | | | | PWM0 |
-D3 | P26 | | | | PWM5 |
-D4 | P24 | | | | PWM4 |
-D5 | P10 | UART1_RX | | | |
-D6 | P11 | UART1_TX | | | |
-D7 | P1 | UART2_RX | I2C2_SDA | | |
-D8 | P0 | UART2_TX | I2C2_SCL | | |
-D9 | P20 | | I2C1_SCL | | | TCK
-D10 | P21 | | I2C1_SDA | | | TMS
-D11 | P23 | | | | | TDO
-D12 | P22 | | | | | TDI
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000
-OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000
-Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000
-Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000
-TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000
-Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000
-User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/wb2l/pinout_wb2l.svg b/boards/wb2l/pinout_wb2l.svg
deleted file mode 100644
index c47c44e..0000000
--- a/boards/wb2l/pinout_wb2l.svg
+++ /dev/null
@@ -1,372 +0,0 @@
-
-
diff --git a/boards/wb2l/pins_arduino.h b/boards/wb2l/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wb2l/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wb2l/variant.h b/boards/wb2l/variant.h
deleted file mode 100644
index 3c26b7b..0000000
--- a/boards/wb2l/variant.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* This file was auto-generated from wb2l.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 13
-#define NUM_DIGITAL_PINS 13
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 11u // GPIO23
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE1_SCL 9u // GPIO20
-#define PIN_WIRE1_SDA 10u // GPIO21
-#define PIN_WIRE2_SCL 8u // GPIO0
-#define PIN_WIRE2_SDA 7u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 5u // GPIO10
-#define PIN_SERIAL1_TX 6u // GPIO11
-#define PIN_SERIAL2_RX 7u // GPIO1
-#define PIN_SERIAL2_TX 8u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 11u // GPIO23
-#define PIN_FUNCTION_P0 8u // GPIO0
-#define PIN_FUNCTION_P1 7u // GPIO1
-#define PIN_FUNCTION_P6 2u // GPIO6
-#define PIN_FUNCTION_P7 1u // GPIO7
-#define PIN_FUNCTION_P8 0u // GPIO8
-#define PIN_FUNCTION_P10 5u // GPIO10
-#define PIN_FUNCTION_P11 6u // GPIO11
-#define PIN_FUNCTION_P20 9u // GPIO20
-#define PIN_FUNCTION_P21 10u // GPIO21
-#define PIN_FUNCTION_P22 12u // GPIO22
-#define PIN_FUNCTION_P23 11u // GPIO23
-#define PIN_FUNCTION_P24 4u // GPIO24
-#define PIN_FUNCTION_P26 3u // GPIO26
-#define PIN_FUNCTION_PWM0 2u // GPIO6
-#define PIN_FUNCTION_PWM1 1u // GPIO7
-#define PIN_FUNCTION_PWM2 0u // GPIO8
-#define PIN_FUNCTION_PWM4 4u // GPIO24
-#define PIN_FUNCTION_PWM5 3u // GPIO26
-#define PIN_FUNCTION_RX1 5u // GPIO10
-#define PIN_FUNCTION_RX2 7u // GPIO1
-#define PIN_FUNCTION_SCL1 9u // GPIO20
-#define PIN_FUNCTION_SCL2 8u // GPIO0
-#define PIN_FUNCTION_SDA1 10u // GPIO21
-#define PIN_FUNCTION_SDA2 7u // GPIO1
-#define PIN_FUNCTION_TX1 6u // GPIO11
-#define PIN_FUNCTION_TX2 8u // GPIO0
diff --git a/boards/wb2s/README.md b/boards/wb2s/README.md
deleted file mode 100644
index cf44ee6..0000000
--- a/boards/wb2s/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-# WB2S Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wb2s-module-datasheet?id=K9ghecl7kc479)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wb2s`
-MCU | BK7231T
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 14x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v4.2
-FCC ID | [2ANDL-WB2S](https://fccid.io/2ANDL-WB2S)
-
-## Usage
-
-**Board code:** `wb2s`
-
-In `platformio.ini`:
-
-```ini
-[env:wb2s]
-platform = libretuya
-board = wb2s
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wb2s
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|-----|------|------
-D0 | P8 | | | | PWM2 |
-D1 | P7 | | | | PWM1 |
-D2 | P6 | | | | PWM0 |
-D3 | P23 | | | | | TDO
-D4 | P10 | UART1_RX | | | |
-D5 | P11 | UART1_TX | | | |
-D6 | P24 | | | | PWM4 |
-D7 | P26 | | | | PWM5 |
-D8 | P20 | | I2C1_SCL | | | TCK
-D9 | P9 | | | | PWM3 |
-D10 | P1 | UART2_RX | I2C2_SDA | | |
-D11 | P0 | UART2_TX | I2C2_SCL | | |
-D12 | P21 | | I2C1_SDA | | | TMS
-D13 | P22 | | | | | TDI
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000
-OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000
-Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000
-Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000
-TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000
-Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000
-User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/wb2s/pinout_wb2s.svg b/boards/wb2s/pinout_wb2s.svg
deleted file mode 100644
index 5ecf3d1..0000000
--- a/boards/wb2s/pinout_wb2s.svg
+++ /dev/null
@@ -1,391 +0,0 @@
-
-
diff --git a/boards/wb2s/pins_arduino.h b/boards/wb2s/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wb2s/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wb2s/variant.h b/boards/wb2s/variant.h
deleted file mode 100644
index a2b9c4b..0000000
--- a/boards/wb2s/variant.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This file was auto-generated from wb2s.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 14
-#define NUM_DIGITAL_PINS 14
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 3u // GPIO23
-#define PIN_A0 3u // GPIO23
-#define A0 PIN_A0
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE1_SCL 8u // GPIO20
-#define PIN_WIRE1_SDA 12u // GPIO21
-#define PIN_WIRE2_SCL 11u // GPIO0
-#define PIN_WIRE2_SDA 10u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 4u // GPIO10
-#define PIN_SERIAL1_TX 5u // GPIO11
-#define PIN_SERIAL2_RX 10u // GPIO1
-#define PIN_SERIAL2_TX 11u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 3u // GPIO23
-#define PIN_FUNCTION_P0 11u // GPIO0
-#define PIN_FUNCTION_P1 10u // GPIO1
-#define PIN_FUNCTION_P6 2u // GPIO6
-#define PIN_FUNCTION_P7 1u // GPIO7
-#define PIN_FUNCTION_P8 0u // GPIO8
-#define PIN_FUNCTION_P9 9u // GPIO9
-#define PIN_FUNCTION_P10 4u // GPIO10
-#define PIN_FUNCTION_P11 5u // GPIO11
-#define PIN_FUNCTION_P20 8u // GPIO20
-#define PIN_FUNCTION_P21 12u // GPIO21
-#define PIN_FUNCTION_P22 13u // GPIO22
-#define PIN_FUNCTION_P23 3u // GPIO23
-#define PIN_FUNCTION_P24 6u // GPIO24
-#define PIN_FUNCTION_P26 7u // GPIO26
-#define PIN_FUNCTION_PWM0 2u // GPIO6
-#define PIN_FUNCTION_PWM1 1u // GPIO7
-#define PIN_FUNCTION_PWM2 0u // GPIO8
-#define PIN_FUNCTION_PWM3 9u // GPIO9
-#define PIN_FUNCTION_PWM4 6u // GPIO24
-#define PIN_FUNCTION_PWM5 7u // GPIO26
-#define PIN_FUNCTION_RX1 4u // GPIO10
-#define PIN_FUNCTION_RX2 10u // GPIO1
-#define PIN_FUNCTION_SCL1 8u // GPIO20
-#define PIN_FUNCTION_SCL2 11u // GPIO0
-#define PIN_FUNCTION_SDA1 12u // GPIO21
-#define PIN_FUNCTION_SDA2 10u // GPIO1
-#define PIN_FUNCTION_TX1 5u // GPIO11
-#define PIN_FUNCTION_TX2 11u // GPIO0
diff --git a/boards/wb3l/README.md b/boards/wb3l/README.md
deleted file mode 100644
index 4baf8e4..0000000
--- a/boards/wb3l/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# WB3L Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wb3l-module-datasheet?id=K9duiggw2v8sp)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wb3l`
-MCU | BK7231T
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 16x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v4.2
-FCC ID | [2ANDL-WB3L](https://fccid.io/2ANDL-WB3L)
-
-## Usage
-
-**Board code:** `wb3l`
-
-In `platformio.ini`:
-
-```ini
-[env:wb3l]
-platform = libretuya
-board = wb3l
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wb3l
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|------|------|------
-D0 | P23 | | | | | TDO
-D1 | P14 | | | SCK | |
-D2 | P26 | | | | PWM5 |
-D3 | P24 | | | | PWM4 |
-D4 | P6 | | | | PWM0 |
-D5 | P9 | | | | PWM3 |
-D6 | P0 | UART2_TX | I2C2_SCL | | |
-D7 | P16 | | | MOSI | |
-D8 | P8 | | | | PWM2 |
-D9 | P7 | | | | PWM1 |
-D10 | P10 | UART1_RX | | | |
-D11 | P11 | UART1_TX | | | |
-D12 | P22 | | | | | TDI
-D13 | P21 | | I2C1_SDA | | | TMS
-D14 | P20 | | I2C1_SCL | | | TCK
-D15 | P1 | UART2_RX | I2C2_SDA | | |
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000
-OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000
-Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000
-Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000
-TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000
-Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000
-User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/wb3l/pinout_wb3l.svg b/boards/wb3l/pinout_wb3l.svg
deleted file mode 100644
index 26cd9a6..0000000
--- a/boards/wb3l/pinout_wb3l.svg
+++ /dev/null
@@ -1,372 +0,0 @@
-
-
diff --git a/boards/wb3l/pins_arduino.h b/boards/wb3l/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wb3l/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wb3l/variant.h b/boards/wb3l/variant.h
deleted file mode 100644
index da5196a..0000000
--- a/boards/wb3l/variant.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* This file was auto-generated from wb3l.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 16
-#define NUM_DIGITAL_PINS 16
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 0u // GPIO23
-#define PIN_A0 0u // GPIO23
-#define A0 PIN_A0
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE1_SCL 14u // GPIO20
-#define PIN_WIRE1_SDA 13u // GPIO21
-#define PIN_WIRE2_SCL 6u // GPIO0
-#define PIN_WIRE2_SDA 15u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 10u // GPIO10
-#define PIN_SERIAL1_TX 11u // GPIO11
-#define PIN_SERIAL2_RX 15u // GPIO1
-#define PIN_SERIAL2_TX 6u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 0u // GPIO23
-#define PIN_FUNCTION_MOSI 7u // GPIO16
-#define PIN_FUNCTION_P0 6u // GPIO0
-#define PIN_FUNCTION_P1 15u // GPIO1
-#define PIN_FUNCTION_P6 4u // GPIO6
-#define PIN_FUNCTION_P7 9u // GPIO7
-#define PIN_FUNCTION_P8 8u // GPIO8
-#define PIN_FUNCTION_P9 5u // GPIO9
-#define PIN_FUNCTION_P10 10u // GPIO10
-#define PIN_FUNCTION_P11 11u // GPIO11
-#define PIN_FUNCTION_P14 1u // GPIO14
-#define PIN_FUNCTION_P16 7u // GPIO16
-#define PIN_FUNCTION_P20 14u // GPIO20
-#define PIN_FUNCTION_P21 13u // GPIO21
-#define PIN_FUNCTION_P22 12u // GPIO22
-#define PIN_FUNCTION_P23 0u // GPIO23
-#define PIN_FUNCTION_P24 3u // GPIO24
-#define PIN_FUNCTION_P26 2u // GPIO26
-#define PIN_FUNCTION_PWM0 4u // GPIO6
-#define PIN_FUNCTION_PWM1 9u // GPIO7
-#define PIN_FUNCTION_PWM2 8u // GPIO8
-#define PIN_FUNCTION_PWM3 5u // GPIO9
-#define PIN_FUNCTION_PWM4 3u // GPIO24
-#define PIN_FUNCTION_PWM5 2u // GPIO26
-#define PIN_FUNCTION_RX1 10u // GPIO10
-#define PIN_FUNCTION_RX2 15u // GPIO1
-#define PIN_FUNCTION_SCK 1u // GPIO14
-#define PIN_FUNCTION_SCL1 14u // GPIO20
-#define PIN_FUNCTION_SCL2 6u // GPIO0
-#define PIN_FUNCTION_SDA1 13u // GPIO21
-#define PIN_FUNCTION_SDA2 15u // GPIO1
-#define PIN_FUNCTION_TX1 11u // GPIO11
-#define PIN_FUNCTION_TX2 6u // GPIO0
diff --git a/boards/wb3s/README.md b/boards/wb3s/README.md
deleted file mode 100644
index de30353..0000000
--- a/boards/wb3s/README.md
+++ /dev/null
@@ -1,89 +0,0 @@
-# WB3S Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wb3s-module-datasheet?id=K9dx20n6hz5n4)
-
-- [General info](../../docs/platform/beken-72xx/README.md)
-- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wb3s`
-MCU | BK7231T
-Manufacturer | Beken
-Series | BK72XX
-Frequency | 120 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 15x GPIO, 6x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-Bluetooth | BLE v4.2
-FCC ID | [2ANDL-WB3S](https://fccid.io/2ANDL-WB3S)
-
-## Usage
-
-**Board code:** `wb3s`
-
-In `platformio.ini`:
-
-```ini
-[env:wb3s]
-platform = libretuya
-board = wb3s
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wb3s
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|-----------|----------|----------|-----|------|------
-D0 | P23 | | | | | TDO
-D1 | P14 | | | SCK | |
-D2 | P26 | | | | PWM5 |
-D3 | P24 | | | | PWM4 |
-D4 | P6 | | | | PWM0 |
-D5 | P7 | | | | PWM1 |
-D6 | P0 | UART2_TX | I2C2_SCL | | |
-D7 | P1 | UART2_RX | I2C2_SDA | | |
-D8 | P9 | | | | PWM3 |
-D9 | P8 | | | | PWM2 |
-D10 | P10 | UART1_RX | | | |
-D11 | P11 | UART1_TX | | | |
-D12 | P22 | | | | | TDI
-D13 | P21 | | I2C1_SDA | | | TMS
-D14 | P20 | | I2C1_SCL | | | TCK
-A0 | P23, ADC3 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|--------------------|---------
-Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
-App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000
-OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000
-Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000
-Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000
-TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000
-Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000
-User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000
-
-Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
diff --git a/boards/wb3s/pinout_wb3s.svg b/boards/wb3s/pinout_wb3s.svg
deleted file mode 100644
index 9533b88..0000000
--- a/boards/wb3s/pinout_wb3s.svg
+++ /dev/null
@@ -1,370 +0,0 @@
-
-
diff --git a/boards/wb3s/pins_arduino.h b/boards/wb3s/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wb3s/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wb3s/variant.h b/boards/wb3s/variant.h
deleted file mode 100644
index 2c1fb78..0000000
--- a/boards/wb3s/variant.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* This file was auto-generated from wb3s.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 15
-#define NUM_DIGITAL_PINS 15
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 0u // GPIO23
-#define PIN_A0 0u // GPIO23
-#define A0 PIN_A0
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE1_SCL 14u // GPIO20
-#define PIN_WIRE1_SDA 13u // GPIO21
-#define PIN_WIRE2_SCL 6u // GPIO0
-#define PIN_WIRE2_SDA 7u // GPIO1
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL1_RX 10u // GPIO10
-#define PIN_SERIAL1_TX 11u // GPIO11
-#define PIN_SERIAL2_RX 7u // GPIO1
-#define PIN_SERIAL2_TX 6u // GPIO0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC3 0u // GPIO23
-#define PIN_FUNCTION_P0 6u // GPIO0
-#define PIN_FUNCTION_P1 7u // GPIO1
-#define PIN_FUNCTION_P6 4u // GPIO6
-#define PIN_FUNCTION_P7 5u // GPIO7
-#define PIN_FUNCTION_P8 9u // GPIO8
-#define PIN_FUNCTION_P9 8u // GPIO9
-#define PIN_FUNCTION_P10 10u // GPIO10
-#define PIN_FUNCTION_P11 11u // GPIO11
-#define PIN_FUNCTION_P14 1u // GPIO14
-#define PIN_FUNCTION_P20 14u // GPIO20
-#define PIN_FUNCTION_P21 13u // GPIO21
-#define PIN_FUNCTION_P22 12u // GPIO22
-#define PIN_FUNCTION_P23 0u // GPIO23
-#define PIN_FUNCTION_P24 3u // GPIO24
-#define PIN_FUNCTION_P26 2u // GPIO26
-#define PIN_FUNCTION_PWM0 4u // GPIO6
-#define PIN_FUNCTION_PWM1 5u // GPIO7
-#define PIN_FUNCTION_PWM2 9u // GPIO8
-#define PIN_FUNCTION_PWM3 8u // GPIO9
-#define PIN_FUNCTION_PWM4 3u // GPIO24
-#define PIN_FUNCTION_PWM5 2u // GPIO26
-#define PIN_FUNCTION_RX1 10u // GPIO10
-#define PIN_FUNCTION_RX2 7u // GPIO1
-#define PIN_FUNCTION_SCK 1u // GPIO14
-#define PIN_FUNCTION_SCL1 14u // GPIO20
-#define PIN_FUNCTION_SCL2 6u // GPIO0
-#define PIN_FUNCTION_SDA1 13u // GPIO21
-#define PIN_FUNCTION_SDA2 7u // GPIO1
-#define PIN_FUNCTION_TX1 11u // GPIO11
-#define PIN_FUNCTION_TX2 6u // GPIO0
diff --git a/boards/wr2/README.md b/boards/wr2/README.md
deleted file mode 100644
index 3fdfc80..0000000
--- a/boards/wr2/README.md
+++ /dev/null
@@ -1,85 +0,0 @@
-# WR2 Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wifiwr2module?id=K9605tko0juc3)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|----------------------------------------
-Board code | `wr2`
-MCU | RTL8710BN
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 125 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 7x GPIO, 5x PWM, 1x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR2](https://fccid.io/2ANDL-WR2)
-
-## Usage
-
-**Board code:** `wr2`
-
-In `platformio.ini`:
-
-```ini
-[env:wr2]
-platform = libretuya
-board = wr2
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr2
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------|----------|----------|----------------------|------|------
-D0 | PA12 | | | | PWM3 |
-D1 | PA00 | | | | PWM2 |
-D2 | PA05 | | | | PWM4 |
-D4 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D5 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-D6 | PA14 | | | | PWM0 | SWCLK
-D7 | PA15 | | | | PWM1 | SWDIO
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr2/pinout_wr2.svg b/boards/wr2/pinout_wr2.svg
deleted file mode 100644
index e240c2d..0000000
--- a/boards/wr2/pinout_wr2.svg
+++ /dev/null
@@ -1,224 +0,0 @@
-
-
diff --git a/boards/wr2/pins_arduino.h b/boards/wr2/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr2/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr2/variant.h b/boards/wr2/variant.h
deleted file mode 100644
index 3fb6663..0000000
--- a/boards/wr2/variant.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This file was auto-generated from wr2.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 8
-#define NUM_DIGITAL_PINS 7
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A1 7u // AD_2
-#define A1 PIN_A1
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 1
-#define PIN_WIRE1_SCL 3u // PA_18
-#define PIN_WIRE1_SDA 4u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 1
-#define PIN_SERIAL0_RX 3u // PA_18
-#define PIN_SERIAL0_TX 4u // PA_23
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC2 7u // AD_2
-#define PIN_FUNCTION_MOSI0 4u // PA_23
-#define PIN_FUNCTION_MOSI1 4u // PA_23
-#define PIN_FUNCTION_PA00 1u // PA_0
-#define PIN_FUNCTION_PA05 2u // PA_5
-#define PIN_FUNCTION_PA12 0u // PA_12
-#define PIN_FUNCTION_PA14 5u // PA_14
-#define PIN_FUNCTION_PA15 6u // PA_15
-#define PIN_FUNCTION_PA18 3u // PA_18
-#define PIN_FUNCTION_PA23 4u // PA_23
-#define PIN_FUNCTION_RX0 3u // PA_18
-#define PIN_FUNCTION_SCK0 3u // PA_18
-#define PIN_FUNCTION_SCK1 3u // PA_18
-#define PIN_FUNCTION_SCL1 3u // PA_18
-#define PIN_FUNCTION_SDA1 4u // PA_23
-#define PIN_FUNCTION_TX0 4u // PA_23
diff --git a/boards/wr2e/README.md b/boards/wr2e/README.md
deleted file mode 100644
index 2a513f0..0000000
--- a/boards/wr2e/README.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# WR2E Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wr2e?id=K97scnsjhue4h)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wr2e`
-MCU | RTL8710BN
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 125 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 7x GPIO, 4x PWM, 1x UART, 2x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR2E](https://fccid.io/2ANDL-WR2E)
-
-## Usage
-
-**Board code:** `wr2e`
-
-In `platformio.ini`:
-
-```ini
-[env:wr2e]
-platform = libretuya
-board = wr2e
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr2e
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA12 | | | | PWM3 |
-D1 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D2 | PA05 | | | | PWM4 |
-D3 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D4 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-D5 | PA14 | | | | PWM0 | SWCLK
-D6 | PA15 | | | | PWM1 | SWDIO
-A0 | PA19, ADC1 | | | | |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr2e/pinout_wr2e.svg b/boards/wr2e/pinout_wr2e.svg
deleted file mode 100644
index a0549c7..0000000
--- a/boards/wr2e/pinout_wr2e.svg
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
diff --git a/boards/wr2e/pins_arduino.h b/boards/wr2e/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr2e/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr2e/variant.h b/boards/wr2e/variant.h
deleted file mode 100644
index 290e3be..0000000
--- a/boards/wr2e/variant.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This file was auto-generated from wr2e.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 8
-#define NUM_DIGITAL_PINS 7
-#define NUM_ANALOG_INPUTS 2
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 1u // PA_19
-#define PIN_A1 7u // AD_2
-#define A0 PIN_A0
-#define A1 PIN_A1
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 1
-#define PIN_WIRE1_SCL 3u // PA_18
-#define PIN_WIRE1_SDA 4u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 1
-#define PIN_SERIAL0_CTS 1u // PA_19
-#define PIN_SERIAL0_RX 3u // PA_18
-#define PIN_SERIAL0_TX 4u // PA_23
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 1u // PA_19
-#define PIN_FUNCTION_ADC2 7u // AD_2
-#define PIN_FUNCTION_CS0 1u // PA_19
-#define PIN_FUNCTION_CS1 1u // PA_19
-#define PIN_FUNCTION_CTS0 1u // PA_19
-#define PIN_FUNCTION_MOSI0 4u // PA_23
-#define PIN_FUNCTION_MOSI1 4u // PA_23
-#define PIN_FUNCTION_PA05 2u // PA_5
-#define PIN_FUNCTION_PA12 0u // PA_12
-#define PIN_FUNCTION_PA14 5u // PA_14
-#define PIN_FUNCTION_PA15 6u // PA_15
-#define PIN_FUNCTION_PA18 3u // PA_18
-#define PIN_FUNCTION_PA19 1u // PA_19
-#define PIN_FUNCTION_PA23 4u // PA_23
-#define PIN_FUNCTION_RX0 3u // PA_18
-#define PIN_FUNCTION_SCK0 3u // PA_18
-#define PIN_FUNCTION_SCK1 3u // PA_18
-#define PIN_FUNCTION_SCL1 3u // PA_18
-#define PIN_FUNCTION_SDA0 1u // PA_19
-#define PIN_FUNCTION_SDA1 4u // PA_23
-#define PIN_FUNCTION_TX0 4u // PA_23
diff --git a/boards/wr2l/README.md b/boards/wr2l/README.md
deleted file mode 100644
index 65e4299..0000000
--- a/boards/wr2l/README.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# WR2L Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wifiwr2lmodule?id=K9605tnbj7gva)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wr2l`
-MCU | RTL8710BX
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 62.5 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 5x GPIO, 4x PWM, 1x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR2L](https://fccid.io/2ANDL-WR2L)
-
-## Usage
-
-**Board code:** `wr2l`
-
-In `platformio.ini`:
-
-```ini
-[env:wr2l]
-platform = libretuya
-board = wr2l
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr2l
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|------------------|------|------
-D0 | PA15 | | | | PWM1 | SWDIO
-D1 | PA14 | | | | PWM0 | SWCLK
-D2 | PA05 | | | | PWM4 |
-D3 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D4 | PA12 | | | | PWM3 |
-A0 | PA19, ADC1 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr2l/pinout_wr2l.svg b/boards/wr2l/pinout_wr2l.svg
deleted file mode 100644
index 34f6e6e..0000000
--- a/boards/wr2l/pinout_wr2l.svg
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
diff --git a/boards/wr2l/pins_arduino.h b/boards/wr2l/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr2l/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr2l/variant.h b/boards/wr2l/variant.h
deleted file mode 100644
index 3e44957..0000000
--- a/boards/wr2l/variant.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* This file was auto-generated from wr2l.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 5
-#define NUM_DIGITAL_PINS 5
-#define NUM_ANALOG_INPUTS 1
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 3u // PA_19
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 0
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 3u // PA_19
-#define PIN_FUNCTION_CS0 3u // PA_19
-#define PIN_FUNCTION_CS1 3u // PA_19
-#define PIN_FUNCTION_CTS0 3u // PA_19
-#define PIN_FUNCTION_PA05 2u // PA_5
-#define PIN_FUNCTION_PA12 4u // PA_12
-#define PIN_FUNCTION_PA14 1u // PA_14
-#define PIN_FUNCTION_PA15 0u // PA_15
-#define PIN_FUNCTION_PA19 3u // PA_19
-#define PIN_FUNCTION_PWM0 1u // PA_14
-#define PIN_FUNCTION_PWM1 0u // PA_15
-#define PIN_FUNCTION_PWM3 4u // PA_12
-#define PIN_FUNCTION_PWM4 2u // PA_5
-#define PIN_FUNCTION_SDA0 3u // PA_19
diff --git a/boards/wr2le/README.md b/boards/wr2le/README.md
deleted file mode 100644
index fb05274..0000000
--- a/boards/wr2le/README.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# WR2LE Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wr2le?id=K9eio9y9e8i8c)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|-------------------------
-Board code | `wr2le`
-MCU | RTL8710BX
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 62.5 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 5x GPIO, 5x PWM, 1x UART
-Wi-Fi | 802.11 b/g/n
-
-## Usage
-
-**Board code:** `wr2le`
-
-In `platformio.ini`:
-
-```ini
-[env:wr2le]
-platform = libretuya
-board = wr2le
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr2le
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------|-----------|----------|----------------------|------|------
-D0 | PA15 | | | | PWM1 | SWDIO
-D1 | PA14 | | | | PWM0 | SWCLK
-D2 | PA05 | | | | PWM4 |
-D3 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D4 | PA12 | | | | PWM3 |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr2le/pinout_wr2le.svg b/boards/wr2le/pinout_wr2le.svg
deleted file mode 100644
index aa10a33..0000000
--- a/boards/wr2le/pinout_wr2le.svg
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
diff --git a/boards/wr2le/pins_arduino.h b/boards/wr2le/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr2le/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr2le/variant.h b/boards/wr2le/variant.h
deleted file mode 100644
index 2d4b8a0..0000000
--- a/boards/wr2le/variant.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* This file was auto-generated from wr2le.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 5
-#define NUM_DIGITAL_PINS 5
-#define NUM_ANALOG_OUTPUTS 0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 0
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 0
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_MISO0 3u // PA_22
-#define PIN_FUNCTION_MISO1 3u // PA_22
-#define PIN_FUNCTION_PA05 2u // PA_5
-#define PIN_FUNCTION_PA12 4u // PA_12
-#define PIN_FUNCTION_PA14 1u // PA_14
-#define PIN_FUNCTION_PA15 0u // PA_15
-#define PIN_FUNCTION_PA22 3u // PA_22
-#define PIN_FUNCTION_PWM0 1u // PA_14
-#define PIN_FUNCTION_PWM1 0u // PA_15
-#define PIN_FUNCTION_PWM3 4u // PA_12
-#define PIN_FUNCTION_PWM4 2u // PA_5
-#define PIN_FUNCTION_PWM5 3u // PA_22
-#define PIN_FUNCTION_RTS0 3u // PA_22
-#define PIN_FUNCTION_SCL0 3u // PA_22
diff --git a/boards/wr3/README.md b/boards/wr3/README.md
deleted file mode 100644
index cae18a1..0000000
--- a/boards/wr3/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# WR3 Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wr3-module-datasheet?id=K9g3ainzbj9z1)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|----------------------------------------
-Board code | `wr3`
-MCU | RTL8710BN
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 125 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 11x GPIO, 6x PWM, 2x UART, 2x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR3](https://fccid.io/2ANDL-WR3)
-
-## Usage
-
-**Board code:** `wr3`
-
-In `platformio.ini`:
-
-```ini
-[env:wr3]
-platform = libretuya
-board = wr3
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr3
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D1 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D2 | PA14 | | | | PWM0 | SWCLK
-D3 | PA15 | | | | PWM1 | SWDIO
-D4 | PA00 | | | | PWM2 |
-D5 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D6 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-D7 | PA05 | | | | PWM4 |
-D8 | PA12 | | | | PWM3 |
-D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-A0 | PA19, ADC1 | | | | |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr3/pinout_wr3.svg b/boards/wr3/pinout_wr3.svg
deleted file mode 100644
index fc5c656..0000000
--- a/boards/wr3/pinout_wr3.svg
+++ /dev/null
@@ -1,309 +0,0 @@
-
-
diff --git a/boards/wr3/pins_arduino.h b/boards/wr3/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr3/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr3/variant.h b/boards/wr3/variant.h
deleted file mode 100644
index 89aa47c..0000000
--- a/boards/wr3/variant.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* This file was auto-generated from wr3.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 12
-#define NUM_DIGITAL_PINS 11
-#define NUM_ANALOG_INPUTS 2
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 1u // PA_19
-#define PIN_A1 11u // AD_2
-#define A0 PIN_A0
-#define A1 PIN_A1
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 1u // PA_19
-#define PIN_SPI0_MISO 0u // PA_22
-#define PIN_SPI0_MOSI 10u // PA_23
-#define PIN_SPI0_SCK 9u // PA_18
-#define PIN_SPI1_CS 1u // PA_19
-#define PIN_SPI1_MISO 0u // PA_22
-#define PIN_SPI1_MOSI 10u // PA_23
-#define PIN_SPI1_SCK 9u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 0u // PA_22
-#define PIN_WIRE0_SCL_1 5u // PA_29
-#define PIN_WIRE0_SDA_0 1u // PA_19
-#define PIN_WIRE0_SDA_1 6u // PA_30
-#define PIN_WIRE1_SCL 9u // PA_18
-#define PIN_WIRE1_SDA 10u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 1u // PA_19
-#define PIN_SERIAL0_RTS 0u // PA_22
-#define PIN_SERIAL0_RX 9u // PA_18
-#define PIN_SERIAL0_TX 10u // PA_23
-#define PIN_SERIAL2_RX 5u // PA_29
-#define PIN_SERIAL2_TX 6u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 1u // PA_19
-#define PIN_FUNCTION_ADC2 11u // AD_2
-#define PIN_FUNCTION_CS0 1u // PA_19
-#define PIN_FUNCTION_CS1 1u // PA_19
-#define PIN_FUNCTION_CTS0 1u // PA_19
-#define PIN_FUNCTION_MISO0 0u // PA_22
-#define PIN_FUNCTION_MISO1 0u // PA_22
-#define PIN_FUNCTION_MOSI0 10u // PA_23
-#define PIN_FUNCTION_MOSI1 10u // PA_23
-#define PIN_FUNCTION_PA00 4u // PA_0
-#define PIN_FUNCTION_PA05 7u // PA_5
-#define PIN_FUNCTION_PA12 8u // PA_12
-#define PIN_FUNCTION_PA14 2u // PA_14
-#define PIN_FUNCTION_PA15 3u // PA_15
-#define PIN_FUNCTION_PA18 9u // PA_18
-#define PIN_FUNCTION_PA19 1u // PA_19
-#define PIN_FUNCTION_PA22 0u // PA_22
-#define PIN_FUNCTION_PA23 10u // PA_23
-#define PIN_FUNCTION_PA29 5u // PA_29
-#define PIN_FUNCTION_PA30 6u // PA_30
-#define PIN_FUNCTION_RTS0 0u // PA_22
-#define PIN_FUNCTION_RX0 9u // PA_18
-#define PIN_FUNCTION_RX2 5u // PA_29
-#define PIN_FUNCTION_SCK0 9u // PA_18
-#define PIN_FUNCTION_SCK1 9u // PA_18
-#define PIN_FUNCTION_TX0 10u // PA_23
-#define PIN_FUNCTION_TX2 6u // PA_30
diff --git a/boards/wr3e/README.md b/boards/wr3e/README.md
deleted file mode 100644
index d564d2d..0000000
--- a/boards/wr3e/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# WR3E Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wr3e-module-datasheet?id=K9elwlqbfosbc)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wr3e`
-MCU | RTL8710BN
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 125 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 11x GPIO, 6x PWM, 2x UART, 2x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR3E](https://fccid.io/2ANDL-WR3E)
-
-## Usage
-
-**Board code:** `wr3e`
-
-In `platformio.ini`:
-
-```ini
-[env:wr3e]
-platform = libretuya
-board = wr3e
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr3e
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D1 | PA14 | | | | PWM0 | SWCLK
-D2 | PA15 | | | | PWM1 | SWDIO
-D3 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D4 | PA00 | | | | PWM2 |
-D5 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-D6 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D7 | PA05 | | | | PWM4 |
-D8 | PA12 | | | | PWM3 |
-D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-A0 | PA19, ADC1 | | | | |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr3e/pinout_wr3e.svg b/boards/wr3e/pinout_wr3e.svg
deleted file mode 100644
index f1fc4fd..0000000
--- a/boards/wr3e/pinout_wr3e.svg
+++ /dev/null
@@ -1,309 +0,0 @@
-
-
diff --git a/boards/wr3e/pins_arduino.h b/boards/wr3e/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr3e/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr3e/variant.h b/boards/wr3e/variant.h
deleted file mode 100644
index 6ddccc9..0000000
--- a/boards/wr3e/variant.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* This file was auto-generated from wr3e.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 12
-#define NUM_ANALOG_INPUTS 2
-#define NUM_DIGITAL_PINS 11
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A1 11u // AD_2
-#define PIN_A0 6u // PA_19
-#define A1 PIN_A1
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 6u // PA_19
-#define PIN_SPI0_MISO 3u // PA_22
-#define PIN_SPI0_MOSI 10u // PA_23
-#define PIN_SPI0_SCK 9u // PA_18
-#define PIN_SPI1_CS 6u // PA_19
-#define PIN_SPI1_MISO 3u // PA_22
-#define PIN_SPI1_MOSI 10u // PA_23
-#define PIN_SPI1_SCK 9u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 0u // PA_29
-#define PIN_WIRE0_SCL_1 3u // PA_22
-#define PIN_WIRE0_SDA_0 5u // PA_30
-#define PIN_WIRE0_SDA_1 6u // PA_19
-#define PIN_WIRE1_SCL 9u // PA_18
-#define PIN_WIRE1_SDA 10u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 6u // PA_19
-#define PIN_SERIAL0_RTS 3u // PA_22
-#define PIN_SERIAL0_RX 9u // PA_18
-#define PIN_SERIAL0_TX 10u // PA_23
-#define PIN_SERIAL2_RX 0u // PA_29
-#define PIN_SERIAL2_TX 5u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 6u // PA_19
-#define PIN_FUNCTION_ADC2 11u // AD_2
-#define PIN_FUNCTION_CS0 6u // PA_19
-#define PIN_FUNCTION_CS1 6u // PA_19
-#define PIN_FUNCTION_CTS0 6u // PA_19
-#define PIN_FUNCTION_MISO0 3u // PA_22
-#define PIN_FUNCTION_MISO1 3u // PA_22
-#define PIN_FUNCTION_MOSI0 10u // PA_23
-#define PIN_FUNCTION_MOSI1 10u // PA_23
-#define PIN_FUNCTION_PA00 4u // PA_0
-#define PIN_FUNCTION_PA05 7u // PA_5
-#define PIN_FUNCTION_PA12 8u // PA_12
-#define PIN_FUNCTION_PA14 1u // PA_14
-#define PIN_FUNCTION_PA15 2u // PA_15
-#define PIN_FUNCTION_PA18 9u // PA_18
-#define PIN_FUNCTION_PA19 6u // PA_19
-#define PIN_FUNCTION_PA22 3u // PA_22
-#define PIN_FUNCTION_PA23 10u // PA_23
-#define PIN_FUNCTION_PA29 0u // PA_29
-#define PIN_FUNCTION_PA30 5u // PA_30
-#define PIN_FUNCTION_RTS0 3u // PA_22
-#define PIN_FUNCTION_RX0 9u // PA_18
-#define PIN_FUNCTION_RX2 0u // PA_29
-#define PIN_FUNCTION_SCK0 9u // PA_18
-#define PIN_FUNCTION_SCK1 9u // PA_18
-#define PIN_FUNCTION_TX0 10u // PA_23
-#define PIN_FUNCTION_TX2 5u // PA_30
diff --git a/boards/wr3l/README.md b/boards/wr3l/README.md
deleted file mode 100644
index e10a350..0000000
--- a/boards/wr3l/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# WR3L Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wifiwr3lmodule?id=K9605tt0kveqm)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wr3l`
-MCU | RTL8710BX
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 62.5 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 11x GPIO, 6x PWM, 2x UART, 2x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR3L](https://fccid.io/2ANDL-WR3L)
-
-## Usage
-
-**Board code:** `wr3l`
-
-In `platformio.ini`:
-
-```ini
-[env:wr3l]
-platform = libretuya
-board = wr3l
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr3l
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D1 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D2 | PA14 | | | | PWM0 | SWCLK
-D3 | PA15 | | | | PWM1 | SWDIO
-D4 | PA00 | | | | PWM2 |
-D5 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D6 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-D7 | PA05 | | | | PWM4 |
-D8 | PA12 | | | | PWM3 |
-D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-A0 | PA19, ADC1 | | | | |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr3l/pinout_wr3l.svg b/boards/wr3l/pinout_wr3l.svg
deleted file mode 100644
index 50a4006..0000000
--- a/boards/wr3l/pinout_wr3l.svg
+++ /dev/null
@@ -1,325 +0,0 @@
-
-
diff --git a/boards/wr3l/pins_arduino.h b/boards/wr3l/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr3l/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr3l/variant.h b/boards/wr3l/variant.h
deleted file mode 100644
index ab59b7f..0000000
--- a/boards/wr3l/variant.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* This file was auto-generated from wr3l.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 12
-#define NUM_DIGITAL_PINS 11
-#define NUM_ANALOG_INPUTS 2
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A0 1u // PA_19
-#define PIN_A1 11u // AD_2
-#define A0 PIN_A0
-#define A1 PIN_A1
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 1u // PA_19
-#define PIN_SPI0_MISO 0u // PA_22
-#define PIN_SPI0_MOSI 10u // PA_23
-#define PIN_SPI0_SCK 9u // PA_18
-#define PIN_SPI1_CS 1u // PA_19
-#define PIN_SPI1_MISO 0u // PA_22
-#define PIN_SPI1_MOSI 10u // PA_23
-#define PIN_SPI1_SCK 9u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 0u // PA_22
-#define PIN_WIRE0_SCL_1 5u // PA_29
-#define PIN_WIRE0_SDA_0 1u // PA_19
-#define PIN_WIRE0_SDA_1 6u // PA_30
-#define PIN_WIRE1_SCL 9u // PA_18
-#define PIN_WIRE1_SDA 10u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 1u // PA_19
-#define PIN_SERIAL0_RTS 0u // PA_22
-#define PIN_SERIAL0_RX 9u // PA_18
-#define PIN_SERIAL0_TX 10u // PA_23
-#define PIN_SERIAL2_RX 5u // PA_29
-#define PIN_SERIAL2_TX 6u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 1u // PA_19
-#define PIN_FUNCTION_ADC2 11u // AD_2
-#define PIN_FUNCTION_CS0 1u // PA_19
-#define PIN_FUNCTION_CS1 1u // PA_19
-#define PIN_FUNCTION_CTS0 1u // PA_19
-#define PIN_FUNCTION_MISO0 0u // PA_22
-#define PIN_FUNCTION_MISO1 0u // PA_22
-#define PIN_FUNCTION_MOSI0 10u // PA_23
-#define PIN_FUNCTION_MOSI1 10u // PA_23
-#define PIN_FUNCTION_PA00 4u // PA_0
-#define PIN_FUNCTION_PA05 7u // PA_5
-#define PIN_FUNCTION_PA12 8u // PA_12
-#define PIN_FUNCTION_PA14 2u // PA_14
-#define PIN_FUNCTION_PA15 3u // PA_15
-#define PIN_FUNCTION_PA18 9u // PA_18
-#define PIN_FUNCTION_PA19 1u // PA_19
-#define PIN_FUNCTION_PA22 0u // PA_22
-#define PIN_FUNCTION_PA23 10u // PA_23
-#define PIN_FUNCTION_PA29 5u // PA_29
-#define PIN_FUNCTION_PA30 6u // PA_30
-#define PIN_FUNCTION_RTS0 0u // PA_22
-#define PIN_FUNCTION_RX0 9u // PA_18
-#define PIN_FUNCTION_RX2 5u // PA_29
-#define PIN_FUNCTION_SCK0 9u // PA_18
-#define PIN_FUNCTION_SCK1 9u // PA_18
-#define PIN_FUNCTION_TX0 10u // PA_23
-#define PIN_FUNCTION_TX2 6u // PA_30
diff --git a/boards/wr3le/README.md b/boards/wr3le/README.md
deleted file mode 100644
index 6e28e43..0000000
--- a/boards/wr3le/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# WR3LE Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wr3le?id=K986l7a1ha8tm)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|--------------------------------------------
-Board code | `wr3le`
-MCU | RTL8710BX
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 62.5 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 11x GPIO, 6x PWM, 2x UART, 2x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR3LE](https://fccid.io/2ANDL-WR3LE)
-
-## Usage
-
-**Board code:** `wr3le`
-
-In `platformio.ini`:
-
-```ini
-[env:wr3le]
-platform = libretuya
-board = wr3le
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr3le
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------------|-----------|----------|----------------------|------|------
-D0 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D1 | PA14 | | | | PWM0 | SWCLK
-D2 | PA15 | | | | PWM1 | SWDIO
-D3 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
-D4 | PA00 | | | | PWM2 |
-D5 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-D6 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
-D7 | PA05 | | | | PWM4 |
-D8 | PA12 | | | | PWM3 |
-D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-A0 | PA19, ADC1 | | | | |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr3le/pinout_wr3le.svg b/boards/wr3le/pinout_wr3le.svg
deleted file mode 100644
index 2ba22d2..0000000
--- a/boards/wr3le/pinout_wr3le.svg
+++ /dev/null
@@ -1,325 +0,0 @@
-
-
diff --git a/boards/wr3le/pins_arduino.h b/boards/wr3le/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr3le/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr3le/variant.h b/boards/wr3le/variant.h
deleted file mode 100644
index 7e9d8c0..0000000
--- a/boards/wr3le/variant.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* This file was auto-generated from wr3le.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 12
-#define NUM_ANALOG_INPUTS 2
-#define NUM_DIGITAL_PINS 11
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A1 11u // AD_2
-#define PIN_A0 6u // PA_19
-#define A1 PIN_A1
-#define A0 PIN_A0
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 2
-#define PIN_SPI0_CS 6u // PA_19
-#define PIN_SPI0_MISO 3u // PA_22
-#define PIN_SPI0_MOSI 10u // PA_23
-#define PIN_SPI0_SCK 9u // PA_18
-#define PIN_SPI1_CS 6u // PA_19
-#define PIN_SPI1_MISO 3u // PA_22
-#define PIN_SPI1_MOSI 10u // PA_23
-#define PIN_SPI1_SCK 9u // PA_18
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL_0 0u // PA_29
-#define PIN_WIRE0_SCL_1 3u // PA_22
-#define PIN_WIRE0_SDA_0 5u // PA_30
-#define PIN_WIRE0_SDA_1 6u // PA_19
-#define PIN_WIRE1_SCL 9u // PA_18
-#define PIN_WIRE1_SDA 10u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_CTS 6u // PA_19
-#define PIN_SERIAL0_RTS 3u // PA_22
-#define PIN_SERIAL0_RX 9u // PA_18
-#define PIN_SERIAL0_TX 10u // PA_23
-#define PIN_SERIAL2_RX 0u // PA_29
-#define PIN_SERIAL2_TX 5u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC1 6u // PA_19
-#define PIN_FUNCTION_ADC2 11u // AD_2
-#define PIN_FUNCTION_CS0 6u // PA_19
-#define PIN_FUNCTION_CS1 6u // PA_19
-#define PIN_FUNCTION_CTS0 6u // PA_19
-#define PIN_FUNCTION_MISO0 3u // PA_22
-#define PIN_FUNCTION_MISO1 3u // PA_22
-#define PIN_FUNCTION_MOSI0 10u // PA_23
-#define PIN_FUNCTION_MOSI1 10u // PA_23
-#define PIN_FUNCTION_PA00 4u // PA_0
-#define PIN_FUNCTION_PA05 7u // PA_5
-#define PIN_FUNCTION_PA12 8u // PA_12
-#define PIN_FUNCTION_PA14 1u // PA_14
-#define PIN_FUNCTION_PA15 2u // PA_15
-#define PIN_FUNCTION_PA18 9u // PA_18
-#define PIN_FUNCTION_PA19 6u // PA_19
-#define PIN_FUNCTION_PA22 3u // PA_22
-#define PIN_FUNCTION_PA23 10u // PA_23
-#define PIN_FUNCTION_PA29 0u // PA_29
-#define PIN_FUNCTION_PA30 5u // PA_30
-#define PIN_FUNCTION_RTS0 3u // PA_22
-#define PIN_FUNCTION_RX0 9u // PA_18
-#define PIN_FUNCTION_RX2 0u // PA_29
-#define PIN_FUNCTION_SCK0 9u // PA_18
-#define PIN_FUNCTION_SCK1 9u // PA_18
-#define PIN_FUNCTION_TX0 10u // PA_23
-#define PIN_FUNCTION_TX2 5u // PA_30
diff --git a/boards/wr3n/README.md b/boards/wr3n/README.md
deleted file mode 100644
index 4bfa78e..0000000
--- a/boards/wr3n/README.md
+++ /dev/null
@@ -1,87 +0,0 @@
-# WR3N Wi-Fi Module
-
-*by Tuya Inc.*
-
-[Product page](https://developer.tuya.com/en/docs/iot/wr3n-datasheet?id=K98zdx31ztdge)
-
-- [General info](../../docs/platform/realtek-amb/README.md)
-- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
-- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
-
-Parameter | Value
--------------|------------------------------------------
-Board code | `wr3n`
-MCU | RTL8710BN
-Manufacturer | Realtek
-Series | AmebaZ
-Frequency | 125 MHz
-Flash size | 2 MiB
-RAM size | 256 KiB
-Voltage | 3.0V - 3.6V
-I/O | 9x GPIO, 5x PWM, 2x UART, 1x ADC
-Wi-Fi | 802.11 b/g/n
-FCC ID | [2ANDL-WR3N](https://fccid.io/2ANDL-WR3N)
-
-## Usage
-
-**Board code:** `wr3n`
-
-In `platformio.ini`:
-
-```ini
-[env:wr3n]
-platform = libretuya
-board = wr3n
-framework = arduino
-```
-
-In ESPHome YAML:
-
-```yaml
-libretuya:
- board: wr3n
- framework:
- version: dev
-```
-
-## Pinout
-
-
-
-## Arduino Core pin mapping
-
-No. | Pin | UART | IÂČC | SPI | PWM | Other
-----|------|----------|----------|----------------------|------|------
-D0 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
-D1 | PA14 | | | | PWM0 | SWCLK
-D2 | PA15 | | | | PWM1 | SWDIO
-D3 | PA00 | | | | PWM2 |
-D4 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
-D5 | PA05 | | | | PWM4 |
-D6 | PA12 | | | | PWM3 |
-D7 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
-D8 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
-A1 | ADC2 | | | | |
-
-## Flash memory map
-
-Flash size: 2 MiB / 2,097,152 B / 0x200000
-
-Hex values are in bytes.
-
-Name | Start | Length | End
-----------------|----------|-------------------|---------
-Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
-Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
-(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
-System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
-Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
-OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000
-OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000
-Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000
-User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000
-RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000
-
-RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
-
-Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
diff --git a/boards/wr3n/pinout_wr3n.svg b/boards/wr3n/pinout_wr3n.svg
deleted file mode 100644
index 428d398..0000000
--- a/boards/wr3n/pinout_wr3n.svg
+++ /dev/null
@@ -1,241 +0,0 @@
-
-
diff --git a/boards/wr3n/pins_arduino.h b/boards/wr3n/pins_arduino.h
deleted file mode 100644
index 1de3ade..0000000
--- a/boards/wr3n/pins_arduino.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "variant.h"
diff --git a/boards/wr3n/variant.h b/boards/wr3n/variant.h
deleted file mode 100644
index 38645fb..0000000
--- a/boards/wr3n/variant.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This file was auto-generated from wr3n.json using boardgen */
-
-#pragma once
-
-#include
-
-// clang-format off
-
-// Pins
-// ----
-#define PINS_COUNT 10
-#define NUM_ANALOG_INPUTS 1
-#define NUM_DIGITAL_PINS 9
-#define NUM_ANALOG_OUTPUTS 0
-
-// Analog pins
-// -----------
-#define PIN_A1 9u // AD_2
-#define A1 PIN_A1
-
-// SPI Interfaces
-// --------------
-#define SPI_INTERFACES_COUNT 0
-
-// Wire Interfaces
-// ---------------
-#define WIRE_INTERFACES_COUNT 2
-#define PIN_WIRE0_SCL 0u // PA_29
-#define PIN_WIRE0_SDA 4u // PA_30
-#define PIN_WIRE1_SCL 7u // PA_18
-#define PIN_WIRE1_SDA 8u // PA_23
-
-// Serial ports
-// ------------
-#define SERIAL_INTERFACES_COUNT 2
-#define PIN_SERIAL0_RX 7u // PA_18
-#define PIN_SERIAL0_TX 8u // PA_23
-#define PIN_SERIAL2_RX 0u // PA_29
-#define PIN_SERIAL2_TX 4u // PA_30
-
-// Pin function macros
-// -------------------
-#define PIN_FUNCTION_ADC2 9u // AD_2
-#define PIN_FUNCTION_MOSI0 8u // PA_23
-#define PIN_FUNCTION_MOSI1 8u // PA_23
-#define PIN_FUNCTION_PA00 3u // PA_0
-#define PIN_FUNCTION_PA05 5u // PA_5
-#define PIN_FUNCTION_PA12 6u // PA_12
-#define PIN_FUNCTION_PA14 1u // PA_14
-#define PIN_FUNCTION_PA15 2u // PA_15
-#define PIN_FUNCTION_PA18 7u // PA_18
-#define PIN_FUNCTION_PA23 8u // PA_23
-#define PIN_FUNCTION_PA29 0u // PA_29
-#define PIN_FUNCTION_PA30 4u // PA_30
-#define PIN_FUNCTION_RX0 7u // PA_18
-#define PIN_FUNCTION_RX2 0u // PA_29
-#define PIN_FUNCTION_SCK0 7u // PA_18
-#define PIN_FUNCTION_SCK1 7u // PA_18
-#define PIN_FUNCTION_SCL0 0u // PA_29
-#define PIN_FUNCTION_SCL1 7u // PA_18
-#define PIN_FUNCTION_SDA0 4u // PA_30
-#define PIN_FUNCTION_SDA1 8u // PA_23
-#define PIN_FUNCTION_TX0 8u // PA_23
-#define PIN_FUNCTION_TX2 4u // PA_30
diff --git a/builder/arduino-common.py b/builder/arduino-common.py
deleted file mode 100644
index 3cb2879..0000000
--- a/builder/arduino-common.py
+++ /dev/null
@@ -1,167 +0,0 @@
-# Copyright (c) Kuba SzczodrzyĆski 2022-04-23.
-
-from os.path import isdir, join
-
-from SCons.Script import DefaultEnvironment
-
-env = DefaultEnvironment()
-platform = env.PioPlatform()
-
-API_DIR = platform.get_package_dir("framework-arduino-api")
-LT_ARDUINO_DIR = join(platform.get_dir(), "arduino", "libretuya")
-assert isdir(API_DIR)
-assert isdir(LT_ARDUINO_DIR)
-
-# Flags
-env.Append(
- CPPDEFINES=[
- ("LIBRETUYA_ARDUINO", "1"),
- ("ARDUINO", 10812),
- "ARDUINO_SDK",
- ],
- LINKFLAGS=[
- "--specs=nosys.specs",
- "-Wl,--as-needed",
- "-Wl,--build-id=none",
- "-Wl,--cref",
- "-Wl,--no-enum-size-warning",
- "-Wl,--no-undefined",
- "-Wl,--warn-common",
- # wrappers from port/printf/
- "-Wl,-wrap,putchar",
- "-Wl,-wrap,puts",
- # wrappers from posix/time.c
- "-Wl,-wrap,gettimeofday",
- "-Wl,-wrap,settimeofday",
- ],
-)
-# Arduino core uses __libc_init_array
-if "-nostartfiles" in env["LINKFLAGS"]:
- env["LINKFLAGS"].remove("-nostartfiles")
-
-# Sources - ArduinoCore-API
-env.AddLibrary(
- name="arduino_api",
- base_dir=API_DIR,
- srcs=[
- "+",
- "+",
- "+",
- "+",
- "+",
- "+",
- ],
- includes=[
- "!<.>",
- "!",
- ],
-)
-
-# Sources - LibreTuya API
-env.AddLibrary(
- name="libretuya_api",
- base_dir=LT_ARDUINO_DIR,
- srcs=[
- "+",
- "+",
- "+",
- "+",
- "+",
- "+",
- ],
- includes=[
- "!<.>",
- "!",
- "!",
- "!",
- "!",
- "!",
- ],
-)
-
-# Sources - uf2ota library
-ltchiptool_dir = platform.get_package_dir(f"tool-ltchiptool")
-env.AddLibrary(
- name="uf2ota",
- base_dir=ltchiptool_dir,
- srcs=[
- "+",
- ],
- includes=[
- "+<.>",
- ],
-)
-
-# Sources - board variant
-env.AddLibrary(
- name="board_${VARIANT}",
- base_dir="$BOARD_DIR",
- srcs=[
- "+",
- ],
-)
-
-for code, base_dir in env["ARDUINO_DIRS"].items():
- code = env.subst(code)
- base_dir = env.subst(base_dir)
- if not code or not isdir(base_dir):
- # Skip unused paths
- continue
-
- # Sources - Arduino Core
- env.AddLibrary(
- name=f"{code}_arduino_core",
- base_dir=base_dir,
- srcs=[
- # Wiring core
- "+",
- "+",
- ],
- includes=[
- # prepend these as the Arduino core may be incorrectly picking some includes from SDKs
- "!",
- ],
- )
-
- # Sources - Arduino libraries
- env.AddLibrary(
- name=f"{code}_arduino_libs",
- base_dir=base_dir,
- srcs=[
- "+",
- ],
- includes=[
- "+",
- ],
- )
-
- # Sources - external library ports
- env.AddLibrary(
- name=f"{code}_arduino_port",
- base_dir=base_dir,
- srcs=[
- "+",
- ],
- includes=[
- "+",
- ],
- )
-
-# Sources - external library ports
-env.AddLibraryFlashDB(version="03500fa")
-env.AddLibraryPrintf(version="6.0.0")
-
-# Libs & linker config
-env.Append(
- LIBS=[
- "stdc++",
- "supc++",
- ],
-)
-env.Replace(
- # Change to Arduino linker script
- LDSCRIPT_PATH=["${LDSCRIPT_ARDUINO}"],
-)
-
-# Build all libraries
-env.BuildLibraries(safe=False)
diff --git a/builder/frameworks/beken-72xx-sdk.py b/builder/family/beken-72xx.py
similarity index 75%
rename from builder/frameworks/beken-72xx-sdk.py
rename to builder/family/beken-72xx.py
index 26f0220..167b438 100644
--- a/builder/frameworks/beken-72xx-sdk.py
+++ b/builder/family/beken-72xx.py
@@ -2,11 +2,13 @@
from os.path import join
-from ltchiptool.soc.bk72xx.binary import to_offset
-from SCons.Script import Builder, DefaultEnvironment
+from platformio.platform.board import PlatformBoardConfig
+from SCons.Script import DefaultEnvironment, Environment
-env = DefaultEnvironment()
-board = env.BoardConfig()
+env: Environment = DefaultEnvironment()
+board: PlatformBoardConfig = env.BoardConfig()
+queue = env.AddLibraryQueue("beken-72xx")
+env.ConfigureFamily()
ROOT_DIR = join("$SDK_DIR", "beken378")
APP_DIR = join(ROOT_DIR, "app")
@@ -14,7 +16,7 @@ DRIVER_DIR = join(ROOT_DIR, "driver")
FUNC_DIR = join(ROOT_DIR, "func")
# Load sys_config.h into env
-env.LoadConfig(join("$FAMILY_DIR", "config", "sys_config.h"))
+env.LoadConfig(join("$FAMILY_DIR", "base", "config", "sys_config.h"))
# Define vars used during build
SOC_BK7231 = 1
@@ -36,47 +38,20 @@ SOC = env.Cfg("CFG_SOC_NAME")
WPA_VERSION = "wpa_supplicant_2_9" if env.Cfg("CFG_USE_WPA_29") else "hostapd-2.5"
# Flags
-env.Append(
+queue.AppendPublic(
CCFLAGS=[
"-mcpu=arm968e-s",
"-march=armv5te",
"-mthumb",
"-mthumb-interwork",
- "-g",
+ "-Wno-write-strings",
+ "-Wno-attributes",
# anything higher, like -O2 or -Os, causes random issues
# like bootlooping, missing (blank) strings, random lockups during boot
- "-O1",
- "-fdata-sections",
- "-ffunction-sections",
- "-fno-inline-functions",
- "-fno-strict-aliasing",
- "-fsigned-char",
- "-fno-delete-null-pointer-checks",
- "-Wno-comment",
- ],
- CFLAGS=[
- "-std=gnu99",
- "-nostdlib",
- "-Wall",
- "-Wno-format",
- "-Wno-unknown-pragmas",
- "-Werror=implicit-function-declaration",
- ],
- CXXFLAGS=[
- "-std=gnu++11",
- "-MMD",
- "-fno-exceptions",
- "-fno-rtti",
- "-Wno-literal-suffix",
- "-Wno-psabi",
- "-Wno-return-type",
+ "+<-O1>",
+ "-<-Os>",
],
CPPDEFINES=[
- # LibreTuya configuration
- ("LT_HAS_LWIP", "1"),
- ("LT_HAS_LWIP2", "1"),
- ("LT_HAS_FREERTOS", "1"),
- ("LT_HAS_MBEDTLS", "1"),
# SDK options
("CFG_OS_FREERTOS", "1"),
("MBEDTLS_CONFIG_FILE", r"\"tls_config.h\""),
@@ -98,42 +73,44 @@ env.Append(
"-mcpu=arm968e-s",
"-marm",
"-mthumb-interwork",
- "-g",
- "-nostartfiles",
"--specs=nano.specs",
- "-Wl,--gc-sections",
- "-Wl,-wrap,_free_r",
- "-Wl,-wrap,_malloc_r",
- "-Wl,-wrap,calloc",
- "-Wl,-wrap,free",
- "-Wl,-wrap,malloc",
- "-Wl,-wrap,realloc",
- "-Wl,-wrap,zalloc",
- "-Wl,-wrap,_realloc_r",
- "-Wl,-wrap,printf",
- "-Wl,-wrap,puts",
- "-Wl,-wrap,snprintf",
- "-Wl,-wrap,sprintf",
- "-Wl,-wrap,vsnprintf",
"-Wl,-wrap,bk_flash_get_info",
"-Wl,-wrap,bk_flash_erase",
"-Wl,-wrap,bk_flash_write",
"-Wl,-wrap,bk_flash_read",
+ # stdio wrappers (base/port/printf.c)
+ "-Wl,-wrap,bk_printf",
+ ],
+)
+queue.AppendPrivate(
+ CCFLAGS=[
+ "-Wno-comment",
+ "-Wno-char-subscripts",
+ "-Wno-missing-braces",
+ "-Wno-return-type",
+ ],
+ CFLAGS=[
+ "-Wno-format",
+ "-Wno-unknown-pragmas",
],
)
srcs_core = []
-srcs_fixups = []
# Fix for BK7231T's bootloader compatibility
if board.get("build.bkboot_version") == "1.0.5-bk7231s":
- env.Append(CPPDEFINES=[("CFG_SUPPORT_BOOTLOADER", "1")])
- srcs_fixups.append("+")
+ # this has to be public, so that fixups/intc.c sees it
+ queue.AppendPublic(CPPDEFINES=[("CFG_SUPPORT_BOOTLOADER", "1")])
+ queue.AddLibrary(
+ name="bdk_boot",
+ base_dir="$FAMILY_DIR/base/fixups",
+ srcs=["+"],
+ )
else:
srcs_core.append("+")
# Sources - from framework-beken-bdk/beken378/beken_src.mk
-env.AddLibrary(
+queue.AddLibrary(
name="bdk_core",
base_dir=ROOT_DIR,
srcs=[
@@ -154,32 +131,8 @@ env.AddLibrary(
],
)
-# Sources - parent family fixups
-env.AddLibrary(
- name="${FAMILY_PARENT_CODE}_fixups",
- base_dir="$PARENT_DIR/fixups",
- srcs=[
- "+",
- "+",
- "+",
- "+",
- "+",
- "+",
- *srcs_fixups,
- ],
-)
-
-# Sources - family fixups
-env.AddLibrary(
- name="${FAMILY_CODE}_fixups",
- base_dir="$FAMILY_DIR/fixups",
- srcs=[
- "+",
- ],
-)
-
# Sources - app module
-env.AddLibrary(
+queue.AddLibrary(
name="bdk_app",
base_dir=APP_DIR,
srcs=[
@@ -199,7 +152,7 @@ env.AddLibrary(
)
# Sources - drivers
-env.AddLibrary(
+queue.AddLibrary(
name="bdk_driver",
base_dir=DRIVER_DIR,
srcs=[
@@ -227,7 +180,7 @@ env.AddLibrary(
"+",
"+",
"+",
- "+",
+ "+",
"+",
],
includes=[
@@ -256,7 +209,7 @@ env.AddLibrary(
)
# Sources - functional components
-env.AddLibrary(
+queue.AddLibrary(
name="bdk_func",
base_dir=FUNC_DIR,
srcs=[
@@ -320,66 +273,55 @@ env.AddLibrary(
)
# Sources - FreeRTOS
-env.AddLibrary(
+freertos_opts = dict(
+ CCFLAGS=[
+ # build FreeRTOS port in ARM mode
+ "+<-marm>",
+ "-<-mthumb>",
+ ],
+)
+env.Replace(FREERTOS_PORT="beken-bdk", FREERTOS_PORT_DEFINE="BEKEN_BDK")
+queue.AddExternalLibrary("freertos", options=freertos_opts)
+queue.AddExternalLibrary("freertos-port", options=freertos_opts)
+queue.AddLibrary(
name="bdk_freertos_thumb",
base_dir=ROOT_DIR,
srcs=[
"+",
+ "-",
],
includes=[
"+",
],
)
-env.AddLibrary(
- name="bdk_freertos_arm",
- base_dir="$SDK_DIR",
- srcs=[
- "+",
- ],
- includes=[
- "+",
- "+",
- ],
- options=dict(
- CCFLAGS=[
- # build FreeRTOS port in ARM mode
- "+<-marm>",
- "-<-mthumb>",
- ],
- ),
-)
-# Sources - lwIP 2.1.3
-env.AddLibraryLwIP(version="2.1.3", port="bdk")
+# Sources - lwIP
+queue.AddExternalLibrary("lwip", port="bdk")
# Sources - mbedTLS 2.6.0
-env.AddLibrary(
+queue.AddLibrary(
name="bdk_mbedtls",
base_dir=join(FUNC_DIR, "mbedtls"),
srcs=[
"+",
- "+",
"+",
],
includes=[
"+",
- "+",
"+",
],
options=dict(
CCFLAGS=[
"-Wno-unused-variable",
"-Wno-implicit-function-declaration",
- "-Wno-incompatible-pointer-types",
- "-Wno-int-conversion",
+ "-w",
],
- CFLAGS=["-<-Wall>"],
),
)
# Sources - chip-specific drivers
if SOC in [SOC_BK7231U, SOC_BK7251]:
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_driver_spi",
base_dir=join(DRIVER_DIR, "spi"),
srcs=[
@@ -389,7 +331,7 @@ if SOC in [SOC_BK7231U, SOC_BK7251]:
],
)
if SOC in [SOC_BK7231N]:
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_driver_spi",
base_dir=join(DRIVER_DIR, "spi"),
srcs=[
@@ -399,7 +341,7 @@ if SOC in [SOC_BK7231N]:
],
)
if SOC in [SOC_BK7251]:
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_bk7251",
base_dir=ROOT_DIR,
srcs=[
@@ -416,7 +358,7 @@ if SOC in [SOC_BK7251]:
# Sources - enabled through config
if env.Cfg("CFG_SDIO"):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_driver_sdio",
base_dir=ROOT_DIR,
srcs=[
@@ -425,7 +367,7 @@ if env.Cfg("CFG_SDIO"):
],
)
if env.Cfg("CFG_BK_AWARE"):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_driver_sdio",
base_dir="$SDK_DIR",
srcs=[
@@ -437,7 +379,7 @@ if env.Cfg("CFG_BK_AWARE"):
],
)
if env.Cfg("CFG_USE_SDCARD_HOST"):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_func_fatfs",
base_dir=join(FUNC_DIR, "fatfs"),
srcs=[
@@ -449,7 +391,7 @@ if env.Cfg("CFG_USE_SDCARD_HOST"):
],
)
if env.Cfg("CFG_WPA3"):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_wolfssl",
base_dir=join(FUNC_DIR, "wolfssl"),
srcs=[
@@ -467,7 +409,7 @@ if env.Cfg("CFG_WPA3"):
if env.Cfg("CFG_SUPPORT_BLE") and env.Cfg("CFG_BLE_VERSION") == env.Cfg(
"BLE_VERSION_4_2"
):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_ble_4_2",
base_dir=join(DRIVER_DIR, "ble"),
srcs=[
@@ -487,7 +429,7 @@ if env.Cfg("CFG_SUPPORT_BLE") and env.Cfg("CFG_BLE_VERSION") == env.Cfg(
if env.Cfg("CFG_SUPPORT_BLE") and env.Cfg("CFG_BLE_VERSION") == env.Cfg(
"BLE_VERSION_5_x"
):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_ble_5_x",
base_dir=join(DRIVER_DIR, "ble_5_x_rw"),
srcs=[
@@ -509,7 +451,7 @@ if env.Cfg("CFG_SUPPORT_BLE") and env.Cfg("CFG_BLE_VERSION") == env.Cfg(
],
)
if env.Cfg("ATSVR_CFG"):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_atsvr",
base_dir=join(FUNC_DIR, "at_server"),
srcs=[
@@ -521,7 +463,7 @@ if env.Cfg("ATSVR_CFG"):
],
)
if env.Cfg("CFG_USB") or env.Cfg("CFG_USE_SDCARD_HOST"):
- env.AddLibrary(
+ queue.AddLibrary(
name="bdk_driver_usb",
base_dir=ROOT_DIR,
srcs=[
@@ -534,7 +476,7 @@ if env.Cfg("CFG_USB") or env.Cfg("CFG_USE_SDCARD_HOST"):
)
# Libs & linker config
-env.Append(
+queue.AppendPublic(
LIBPATH=[
join("$SDK_DIR", "beken378", "lib"),
join("$SDK_DIR", "beken378", "func", "airkiss"),
@@ -566,6 +508,13 @@ env.Replace(
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES",
)
+# Generate linker scripts with correct flash offsets
+env.GenerateLinkerScript(board, board.get("build.ldscript"))
+
+
+def to_offset(addr: int) -> int:
+ return int(addr + (addr // 32) * 2)
+
# Calculate RBL header offset
app_offs = int(env["FLASH_APP_OFFSET"], 16)
@@ -574,34 +523,29 @@ rbl_offs = to_offset(app_size) - 102
env.Replace(FLASH_RBL_OFFSET=f"0x{app_offs + rbl_offs:06X}")
# Build all libraries
-env.BuildLibraries()
+queue.BuildLibraries()
-# Main firmware outputs and actions
-env.Replace(
- # linker command (encryption + packaging)
- LINK="${LTCHIPTOOL} link2bin ${VARIANT} '' ''",
- # UF2OTA input list
- UF2OTA=[
- # app binary image (enc+crc), OTA1 (uploader) only
- (
- "app",
- "${BUILD_DIR}/${MCULC}_app_${FLASH_APP_OFFSET}.crc",
- "",
- "",
- ),
- # app RBL header (crc), OTA1 (uploader) only
- (
- f"app+{rbl_offs}",
- "${BUILD_DIR}/${MCULC}_app_${FLASH_RBL_OFFSET}.rblh",
- "", # not used for OTA2
- "",
- ),
- # OTA RBL package, OTA2 (uf2ota lib) only
- (
- "", # not used for OTA1
- "",
- "download",
- "${BUILD_DIR}/${MCULC}_app.ota.rbl",
- ),
+# Rename Arduino's delay() to delayMilliseconds()
+env.Append(
+ CPPDEFINES=[
+ ("delay", "delayMilliseconds"),
+ ],
+)
+
+# Main firmware outputs and actions
+image_app_crc = "${BUILD_DIR}/image_${MCULC}_app.${FLASH_APP_OFFSET}.crc"
+image_app_rblh = "${BUILD_DIR}/image_${MCULC}_app.${FLASH_RBL_OFFSET}.rblh"
+image_ota_rbl = "${BUILD_DIR}/image_${MCULC}_app.ota.rbl"
+env.Replace(
+ # linker command (encryption + packaging)
+ LINK="${LTCHIPTOOL} link2bin ${BOARD_JSON} '' ''",
+ # UF2OTA input list
+ UF2OTA=[
+ # app binary image (enc+crc) for flasher
+ f"{image_app_crc}=flasher:app",
+ # app RBL header (with crc) for flasher
+ f"{image_app_rblh}+{rbl_offs}=flasher:app",
+ # OTA RBL package for device only
+ f"{image_ota_rbl}=device:download",
],
)
diff --git a/builder/frameworks/realtek-ambz-sdk.py b/builder/family/realtek-ambz.py
similarity index 74%
rename from builder/frameworks/realtek-ambz-sdk.py
rename to builder/family/realtek-ambz.py
index dd18cf5..38b3c67 100644
--- a/builder/frameworks/realtek-ambz-sdk.py
+++ b/builder/family/realtek-ambz.py
@@ -2,50 +2,24 @@
from os.path import join
-from SCons.Script import Builder, DefaultEnvironment
+from platformio.platform.board import PlatformBoardConfig
+from SCons.Script import Builder, DefaultEnvironment, Environment
-env = DefaultEnvironment()
-board = env.BoardConfig()
+env: Environment = DefaultEnvironment()
+board: PlatformBoardConfig = env.BoardConfig()
+queue = env.AddLibraryQueue("realtek-ambz")
+env.ConfigureFamily()
# Flags
-env.Append(
+queue.AppendPublic(
CCFLAGS=[
"-mcpu=cortex-m4",
"-mthumb",
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
- "-g2",
- "-w",
- "-Os",
- "-fdata-sections",
- "-ffunction-sections",
- "-fno-inline-functions",
- "-fmessage-length=0",
- "-fno-common",
"-fno-short-enums",
- "-fomit-frame-pointer",
- "-fsigned-char",
- "-fno-delete-null-pointer-checks",
- ],
- CFLAGS=[
- "-std=gnu99",
- "-Wno-pointer-sign",
- ],
- CXXFLAGS=[
- # borrowed from RtlDuino/development/rtl87xx/platform.txt
- "-std=gnu++11",
- "-MMD",
- "-fno-exceptions",
- "-fno-rtti",
- "-Wno-psabi",
],
CPPDEFINES=[
- # LibreTuya configuration
- ("LT_HAS_LWIP", "1"),
- ("LT_HAS_LWIP2", "1"),
- ("LT_HAS_FREERTOS", "1"),
- ("LT_HAS_MBEDTLS", "1"),
- ("LT_PRINTF_BROKEN", "1"), # printf does not handle %.3f properly
# other options
"M3",
"CONFIG_PLATFORM_8711B",
@@ -59,18 +33,11 @@ env.Append(
"-mthumb",
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
- "-g",
"--specs=nano.specs",
- "-nostartfiles",
- "-Os",
- "-Wl,--gc-sections",
- "-Wl,--cref",
+ # the entrypoint in ROM (?)
"-Wl,--entry=Reset_Handler",
- "-Wl,--no-enum-size-warning",
- "-Wl,--no-wchar-size-warning",
- "-Wl,-wrap,malloc",
- "-Wl,-wrap,free",
- "-Wl,-wrap,realloc",
+ # start function table in startup.c
+ "-Wl,--undefined=gImage2EntryFun0",
"-Wl,-wrap,rom_psk_CalcGTK",
"-Wl,-wrap,rom_psk_CalcPTK",
"-Wl,-wrap,CalcMIC",
@@ -78,13 +45,61 @@ env.Append(
"-Wl,-wrap,aes_80211_encrypt",
"-Wl,-wrap,aes_80211_decrypt",
"-Wl,-wrap,DecGTK",
+ # ROM stdlib (wraps/stdlib.c)
+ # stock SDK defines these as macros
+ "-Wl,-wrap,atoi",
+ "-Wl,-wrap,atol",
+ "-Wl,-wrap,strtol",
+ "-Wl,-wrap,strtoul",
+ "-Wl,-wrap,rand",
+ "-Wl,-wrap,strcat",
+ "-Wl,-wrap,strcpy",
+ "-Wl,-wrap,strncat",
+ "-Wl,-wrap,strncpy",
+ "-Wl,-wrap,strchr",
+ "-Wl,-wrap,strcmp",
+ "-Wl,-wrap,strlen",
+ "-Wl,-wrap,strncmp",
+ "-Wl,-wrap,strpbrk",
+ "-Wl,-wrap,strstr",
+ "-Wl,-wrap,strtok",
+ "-Wl,-wrap,memchr",
+ "-Wl,-wrap,memcmp",
+ "-Wl,-wrap,memcpy",
+ "-Wl,-wrap,memmove",
+ "-Wl,-wrap,memset",
+ "-Wl,-wrap,strsep",
+ # stdio wrappers (base/port/printf.c)
+ "-Wl,-wrap,rtl_printf",
+ "-Wl,-wrap,rtl_sprintf",
+ "-Wl,-wrap,rtl_snprintf",
+ "-Wl,-wrap,rtl_vsnprintf",
+ "-Wl,-wrap,rtl_vsnprintf_r",
+ "-Wl,-wrap,rtl_vprintf",
+ "-Wl,-wrap,rtl_vfprintf",
+ "-Wl,-wrap,DiagPrintf",
+ "-Wl,-wrap,DiagSPrintf",
+ "-Wl,-wrap,DiagSnPrintf",
+ "-Wl,-wrap,prvDiagPrintf",
+ "-Wl,-wrap,prvDiagSPrintf",
+ "-Wl,-wrap,VSprintf",
+ "-Wl,-wrap,LOG_PRINTF",
+ "-Wl,-wrap,__rtl_vfprintf_r_v1_00",
+ ],
+)
+queue.AppendPrivate(
+ CFLAGS=[
+ "-Wno-implicit-function-declaration",
+ "-Wno-incompatible-pointer-types",
+ "-Wno-int-conversion",
+ "-Wno-pointer-sign",
],
)
# Sources - from SDK project/realtek_amebaz_va0_example/GCC-RELEASE/application.mk
# - "console" is disabled as it introduces build error, and is generally useless
# - "utilities example" are also not really needed
-env.AddLibrary(
+queue.AddLibrary(
name="ambz_sdk",
base_dir="$SDK_DIR",
srcs=[
@@ -97,7 +112,7 @@ env.AddLibrary(
"+",
"+",
"+",
- "+",
+ "ARDUINO" not in "ENV" and "+",
"+",
"+",
"+",
@@ -105,17 +120,8 @@ env.AddLibrary(
"+",
"+",
"+",
- "+",
- "+",
- # "+",
"+",
- "+",
- "+",
"+",
- "+",
- "+",
- "+",
- "+",
"+",
"+",
"+",
@@ -153,8 +159,6 @@ env.AddLibrary(
includes=[
"+",
"+",
- "+",
- "+",
"+",
"+",
"+",
@@ -195,43 +199,36 @@ env.AddLibrary(
"+",
"+",
],
+ options=dict(
+ CFLAGS=["-w"],
+ ),
)
-# Sources - lwIP 2.1.3
-env.AddLibraryLwIP(version="2.1.3", port="amb1")
+# Sources - FreeRTOS
+env.Replace(FREERTOS_PORT=env["FAMILY_NAME"], FREERTOS_PORT_DEFINE="REALTEK_AMB1")
+queue.AddExternalLibrary("freertos")
+queue.AddExternalLibrary("freertos-port")
+
+# Sources - lwIP
+queue.AddExternalLibrary("lwip", port="amb1")
# Sources - mbedTLS
-env.AddLibrary(
+queue.AddLibrary(
name="ambz_mbedtls",
base_dir="$SDK_DIR",
srcs=[
# mbedTLS from SDK
"+