Merge branch 'structure-refactor'

This commit is contained in:
Kuba Szczodrzyński
2023-04-27 23:36:51 +02:00
595 changed files with 10302 additions and 27007 deletions

View File

@@ -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

6
.gitignore vendored
View File

@@ -258,3 +258,9 @@ xml/
ltapi/
hashChanges.yaml
.piopm
# board files
docs/status/supported_*.md
docs/status/unsupported_boards_*.md
boards/**/*.svg
boards/**/*.md

2
.gitmodules vendored
View File

@@ -1,2 +0,0 @@
[submodule "tools/boardgen"]
url = https://github.com/kuba2k2/boardgen

View File

@@ -1,38 +1,45 @@
# LibreTuya
# LibreTiny
<div align="center" markdown>
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kuba2k2/libretuya/Deploy%20docs%20on%20GitHub%20Pages?label=docs&logo=markdown)](https://kuba2k2.github.io/libretuya/)
![GitHub last commit](https://img.shields.io/github/last-commit/kuba2k2/libretuya?logo=github)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kuba2k2/libretiny/Deploy%20docs%20on%20GitHub%20Pages?label=docs&logo=markdown)](https://kuba2k2.github.io/libretiny/)
![GitHub last commit](https://img.shields.io/github/last-commit/kuba2k2/libretiny?logo=github)
[![Code style: clang-format](https://img.shields.io/badge/code%20style-clang--format-purple.svg)](.clang-format)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Discord](https://img.shields.io/discord/967863521511608370?color=%235865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/SyGCB9Xwtf)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/kuba2k2/platform/libretuya.svg)](https://registry.platformio.org/platforms/kuba2k2/libretuya)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/kuba2k2/platform/libretiny.svg)](https://registry.platformio.org/platforms/kuba2k2/libretiny)
![RTL8710BN](https://img.shields.io/badge/-rtl8710bn-blue)
![BK7231](https://img.shields.io/badge/-bk7231-blue)
</div>
## 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.
<!--
## Arduino Core support status
Note: this list will probably change with each functionality update.
@@ -57,10 +64,10 @@ TCP Server | ✔️ | ✔️
IPv6 | ❌ | ❌
HTTP Client (SSL) | ✔️ (✔️) | ❓
HTTP Server | ✔️ | ✔️
NVS / Preferences | |
NVS / Preferences | ✔️ | ✔️
SPIFFS | ❌ | ❌
BLE | - | ❌
NTP | |
NTP | ✔️ | ✔️
OTA | ✔️ | ✔️
MDNS | ✔️ | ✔️
MQTT | ✅ | ❌
@@ -80,6 +87,7 @@ Names:
- Core functions - stuff like delay(), millis(), yield(), etc.
- **CORE LIBRARIES** - included normally in all Arduino cores
- **OTHER LIBRARIES** - included in ESP32 core or downloadable
-->
## License

View File

@@ -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/)

View File

@@ -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 <api/ArduinoAPI.h>
#include <core/LibreTuyaAPI.h>
#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 <core/SerialExtern.h>
#endif

View File

@@ -1,208 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-19. */
#include <LibreTuyaAPI.h>
#include <libraries/Flash/Flash.h>
// can't include <flash.h> as it collides with <Flash.h> 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 <flash_pub.h>
#include <param_config.h>
#include <start_type_pub.h>
#include <sys_ctrl.h>
#include <sys_rtos.h>
#include <wdt_pub.h>
#include <wlan_ui_pub.h>
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;

View File

@@ -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

View File

@@ -1,30 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-18. */
#pragma once
// for printf() etc (they are wrapped anyway)
#include <stdio.h>
// most stuff is here
#include <include.h>
// for os_printf
#include <uart_pub.h>
// for GPIO names
#include <gpio_pub.h>
// conflict with stl_algobase.h
#undef min
#undef max
// include printf() wrapper disable methods
#include <printf_port.h>
// 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

View File

@@ -1,20 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-18. */
#pragma once
#include <stddef.h>
// Beken SDK is actually pretty good, in terms of declaring
// stdlib functions properly! So no need for any #define hell.
#include <mem_pub.h>
// All the MemMang functions are in stdlib, just wrapped
// during linking.
#include <stdlib.h>
// for memcpy etc.
#include <string.h>
// ...except zalloc, which is apparently not in the stdlib
#define zalloc os_zalloc
#define LT_HEAP_FUNC xPortGetFreeHeapSize

View File

@@ -1,5 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-07-11. */
#pragma once
#define LT_MD5_USE_HOSTAPD 1

View File

@@ -1,10 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-26. */
#pragma once
#include <Arduino.h>
#include <api/WiFi/WiFi.h>
#include "WiFiClient.h"
#include "WiFiClientSecure.h"
#include "WiFiServer.h"

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-27. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <lwip/LwIPClient.h>
typedef LwIPClient WiFiClient;

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-04. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <ssl/MbedTLSClient.h>
typedef MbedTLSClient WiFiClientSecure;

View File

@@ -1,25 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-26. */
#pragma once
#include <Arduino.h>
extern "C" {
#include <FreeRTOS.h>
#include <rw_msg_pub.h>
#include <semphr.h>
} // 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;

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-27. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <lwip/LwIPServer.h>
typedef LwIPServer WiFiServer;

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-09-10. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <lwip/LwIPUdp.h>
typedef LwIPUDP WiFiUDP;

View File

@@ -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
};

View File

@@ -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;
}
}
}

View File

@@ -1,80 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-04-28. */
#pragma once
// C standard libraries
#include <inttypes.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// C++ standard libraries
#ifdef __cplusplus
#include <algorithm>
#include <cmath>
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 <Arduino.h>
// 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

View File

@@ -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-<board>-<chip id>".
* 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
}

View File

@@ -1,193 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-06. */
#pragma once
#ifdef __cplusplus
#include "LibreTuyaAPI.h"
#include <core/ChipType.h>
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

View File

@@ -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

View File

@@ -1,25 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-07-04. */
#pragma once
#include <Arduino.h>
#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

View File

@@ -1,74 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-19. */
#include <Arduino.h>
#include <api/HardwareSerial.h>
using namespace arduino;
extern "C" {
#include <fal.h>
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;
}

View File

@@ -1,30 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-04-24. */
#include "Flash.h"
extern "C" {
#include <fal.h>
}
// 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;
}

View File

@@ -1,17 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-04-24. */
#pragma once
#include <Arduino.h>
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;

View File

@@ -1,7 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-04-29. */
#pragma once
#include <time.h>
extern char *strptime(const char *buf, const char *fmt, struct tm *tm);

View File

@@ -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

View File

@@ -1,14 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-07-11. */
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <mbedtls/md5.h>
#define LT_MD5_CTX_T mbedtls_md5_context
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -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

View File

@@ -1,14 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-03. */
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <polarssl/md5.h>
#define LT_MD5_CTX_T md5_context
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -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 <api/ArduinoAPI.h>
#include <core/LibreTuyaAPI.h>
#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 <core/SerialExtern.h>
#endif

View File

@@ -1,209 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-28. */
#include <LibreTuyaAPI.h>
#include <Flash.h>
extern "C" {
#include <flash_api.h>
#include <rtl8710b.h>
#include <sys_api.h>
#include <wdt_api.h>
}
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;

View File

@@ -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

View File

@@ -1,16 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-06. */
#include "sdk_mem.h"
#include <Arduino.h> // 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);
}

View File

@@ -1,21 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-06. */
#pragma once
#include <stddef.h>
// 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

View File

@@ -1,110 +0,0 @@
#include "sdk_os.h"
#include <Arduino.h>
#include <cmsis_os.h>
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);
}

View File

@@ -1,302 +0,0 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/**
* @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

View File

@@ -1,5 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-03. */
#pragma once
#define LT_MD5_USE_POLARSSL 1

View File

@@ -1,58 +0,0 @@
#include "PowerManagement.h"
#include <Arduino.h>
#ifdef __cplusplus
extern "C" {
#include <freertos_pmu.h>
#include <sleep_ex_api.h>
#include <sys_api.h>
}
#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;

View File

@@ -1,73 +0,0 @@
#pragma once
#include <inttypes.h>
/**
* @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;

View File

@@ -1,5 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-07-03. */
#pragma once
#include <api/SoftwareSerial.h>

View File

@@ -1,10 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-04-25. */
#pragma once
#include <Arduino.h>
#include <api/WiFi/WiFi.h>
#include "WiFiClient.h"
#include "WiFiClientSecure.h"
#include "WiFiServer.h"

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-27. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <lwip/LwIPClient.h>
typedef LwIPClient WiFiClient;

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-04. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <ssl/MbedTLSClient.h>
typedef MbedTLSClient WiFiClientSecure;

View File

@@ -1,18 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-23. */
#pragma once
#include <Arduino.h>
extern "C" {
#include <FreeRTOS.h>
#include <semphr.h>
} // extern "C"
typedef struct {
bool initialized;
bool sleep;
SemaphoreHandle_t scanSem;
} WiFiData;

View File

@@ -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();
}

View File

@@ -1,47 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-04-25. */
#pragma once
#include <api/WiFi/WiFi.h>
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 <FreeRTOS.h>
#include <autoconf.h>
#include <dhcp/dhcps.h>
#include <lwip/api.h>
#include <lwip/dns.h>
#include <lwip/err.h>
#include <lwip_netconf.h>
#include <semphr.h>
#include <wifi_conf.h>
#include <wifi_constants.h>
#include <wifi_structures.h>
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)

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-27. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <lwip/LwIPServer.h>
typedef LwIPServer WiFiServer;

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2022-09-10. */
#pragma once
#include <api/WiFi/WiFi.h>
#include <lwip/LwIPUdp.h>
typedef LwIPUDP WiFiUDP;

View File

@@ -1,32 +0,0 @@
<!-- This file is auto-generated -->
- [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)

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -22,10 +22,6 @@
"mem 0x000000 0x200000 ro"
]
},
"frameworks": [
"beken-72xx-sdk",
"beken-72xx-arduino"
],
"upload": {
"maximum_ram_size": 262144,
"flash_size": 2097152,

View File

@@ -92,6 +92,7 @@
},
"27": {
"C_NAME": "AD_2",
"GPIONUM": 41,
"IO": "I",
"ADC": 2
},

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -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,

View File

@@ -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
},

View File

@@ -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
![Pinout](pinout_bw12.svg)
## 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.

View File

@@ -1,315 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,85.33333333333333,41.666666666666664" width="1024">
<defs/>
<rect fill="white" height="41.666666666666664" stroke="black" stroke-width="0.1" width="85.33333333333333" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#4d4d4d"/>
<stop offset="100%" stop-color="#0f0f0f"/>
</linearGradient>
<rect fill="url(#id1) none" height="23.9" stroke="#b5a739" stroke-width="0.1" width="15.9" x="34.36666666666666" y="8.883333333333333"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin1.trace" width="0.7" x="34.31666666666666" y="16.583333333333332"/>
<circle cx="34.31666666666666" cy="17.18333333333333" fill="#fff" id="esp12s.front.left.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin2.trace" width="0.7" x="34.31666666666666" y="18.583333333333332"/>
<circle cx="34.31666666666666" cy="19.18333333333333" fill="#fff" id="esp12s.front.left.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin3.trace" width="0.7" x="34.31666666666666" y="20.583333333333332"/>
<circle cx="34.31666666666666" cy="21.18333333333333" fill="#fff" id="esp12s.front.left.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin4.trace" width="0.7" x="34.31666666666666" y="22.583333333333332"/>
<circle cx="34.31666666666666" cy="23.18333333333333" fill="#fff" id="esp12s.front.left.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin5.trace" width="0.7" x="34.31666666666666" y="24.583333333333332"/>
<circle cx="34.31666666666666" cy="25.183333333333334" fill="#fff" id="esp12s.front.left.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin6.trace" width="0.7" x="34.31666666666666" y="26.583333333333332"/>
<circle cx="34.31666666666666" cy="27.183333333333334" fill="#fff" id="esp12s.front.left.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin7.trace" width="0.7" x="34.31666666666666" y="28.583333333333332"/>
<circle cx="34.31666666666666" cy="29.183333333333334" fill="#fff" id="esp12s.front.left.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin8.trace" width="0.7" x="34.31666666666666" y="30.583333333333332"/>
<circle cx="34.31666666666666" cy="31.183333333333334" fill="#fff" id="esp12s.front.left.pin8.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin1.trace" width="0.7" x="49.61666666666666" y="16.583333333333332"/>
<circle cx="50.31666666666666" cy="17.18333333333333" fill="#fff" id="esp12s.front.right.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin2.trace" width="0.7" x="49.61666666666666" y="18.583333333333332"/>
<circle cx="50.31666666666666" cy="19.18333333333333" fill="#fff" id="esp12s.front.right.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin3.trace" width="0.7" x="49.61666666666666" y="20.583333333333332"/>
<circle cx="50.31666666666666" cy="21.18333333333333" fill="#fff" id="esp12s.front.right.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin4.trace" width="0.7" x="49.61666666666666" y="22.583333333333332"/>
<circle cx="50.31666666666666" cy="23.18333333333333" fill="#fff" id="esp12s.front.right.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin5.trace" width="0.7" x="49.61666666666666" y="24.583333333333332"/>
<circle cx="50.31666666666666" cy="25.183333333333334" fill="#fff" id="esp12s.front.right.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin6.trace" width="0.7" x="49.61666666666666" y="26.583333333333332"/>
<circle cx="50.31666666666666" cy="27.183333333333334" fill="#fff" id="esp12s.front.right.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin7.trace" width="0.7" x="49.61666666666666" y="28.583333333333332"/>
<circle cx="50.31666666666666" cy="29.183333333333334" fill="#fff" id="esp12s.front.right.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin8.trace" width="0.7" x="49.61666666666666" y="30.583333333333332"/>
<circle cx="50.31666666666666" cy="31.183333333333334" fill="#fff" id="esp12s.front.right.pin8.cast" r="0.35"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="16.8" rx="0.5" ry="0.5" width="13.6" x="35.516666666666666" y="15.783333333333331"/>
<rect fill="#fafd9d" height="5.2" width="0.5" x="35.416666666666664" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="4.6" x="35.416666666666664" y="9.633333333333333"/>
<rect fill="#fafd9d" height="5.2" width="0.5" x="37.61666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="39.516666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="3.0" x="39.516666666666666" y="12.133333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="42.016666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="2.7" x="42.016666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="44.21666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="3.0" x="44.21666666666666" y="12.133333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="46.71666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="2.5" x="46.71666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="4.4" width="0.5" x="48.71666666666666" y="9.633333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="17.08333333333333"/>
<g transform="translate(27.431026020611558,16.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="28.91666666666666" y="17.18333333333333">PA15</text>
<g transform="translate(24.43102602061156,16.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.616666666666664" y="17.18333333333333">D8</text>
<g transform="translate(20.83102602061156,16.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.316666666666663" y="17.18333333333333">PWM1</text>
<g transform="translate(17.231026020611562,16.38333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="18.716666666666665" y="17.18333333333333">SWDIO</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="19.08333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="21.08333333333333"/>
<g transform="translate(27.431026020611558,20.38333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="28.91666666666666" y="21.18333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="23.08333333333333"/>
<g transform="translate(27.431026020611558,22.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="28.91666666666666" y="23.18333333333333">PA05</text>
<g transform="translate(24.43102602061156,22.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.616666666666664" y="23.18333333333333">D0</text>
<g transform="translate(20.83102602061156,22.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.316666666666663" y="23.18333333333333">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="25.083333333333332"/>
<g transform="translate(27.431026020611558,24.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="28.91666666666666" y="25.183333333333334">PA29</text>
<g transform="translate(24.43102602061156,24.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.616666666666664" y="25.183333333333334">D1</text>
<g transform="translate(20.83102602061156,24.383333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.316666666666663" y="25.183333333333334">RX2</text>
<g transform="translate(17.231026020611562,24.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="18.716666666666665" y="25.183333333333334">SCL0</text>
<g transform="translate(13.631026020611563,24.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="15.116666666666664" y="25.183333333333334">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="27.083333333333332"/>
<g transform="translate(27.431026020611558,26.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="28.91666666666666" y="27.183333333333334">PA00</text>
<g transform="translate(24.43102602061156,26.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.616666666666664" y="27.183333333333334">D2</text>
<g transform="translate(20.83102602061156,26.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.316666666666663" y="27.183333333333334">PWM2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="29.083333333333332"/>
<g transform="translate(27.431026020611558,28.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="28.91666666666666" y="29.183333333333334">PA19</text>
<g transform="translate(23.83102602061156,28.383333333333333)">
<rect fill="#8ad039" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.316666666666663" y="29.183333333333334">ADC1</text>
<g transform="translate(20.83102602061156,28.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.016666666666662" y="29.183333333333334">D3</text>
<g transform="translate(17.83102602061156,28.383333333333333)">
<rect fill="#16a352" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="19.016666666666662" y="29.183333333333334">A0</text>
<g transform="translate(14.23102602061156,28.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="15.716666666666661" y="29.183333333333334">SDA0</text>
<g transform="translate(10.631026020611559,28.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="12.11666666666666" y="29.183333333333334">CS0</text>
<g transform="translate(7.031026020611558,28.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="8.516666666666659" y="29.183333333333334">CS1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.21666666666666" y="31.083333333333332"/>
<g transform="translate(27.431026020611558,30.383333333333333)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="28.91666666666666" y="31.183333333333334">3V3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="31.083333333333332"/>
<g transform="translate(54.231026020611566,30.383333333333333)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="31.183333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="29.083333333333332"/>
<g transform="translate(54.231026020611566,28.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="29.183333333333334">PA22</text>
<g transform="translate(57.83102602061157,28.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.016666666666666" y="29.183333333333334">D4</text>
<g transform="translate(60.83102602061157,28.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.31666666666667" y="29.183333333333334">SCL0</text>
<g transform="translate(64.43102602061157,28.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="65.91666666666667" y="29.183333333333334">MISO0</text>
<g transform="translate(68.03102602061156,28.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.51666666666667" y="29.183333333333334">MISO1</text>
<g transform="translate(71.63102602061156,28.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="73.11666666666666" y="29.183333333333334">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="27.083333333333332"/>
<g transform="translate(54.231026020611566,26.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="27.183333333333334">PA30</text>
<g transform="translate(57.83102602061157,26.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.016666666666666" y="27.183333333333334">D5</text>
<g transform="translate(60.83102602061157,26.383333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.31666666666667" y="27.183333333333334">TX2</text>
<g transform="translate(64.43102602061157,26.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="65.91666666666667" y="27.183333333333334">SDA0</text>
<g transform="translate(68.03102602061156,26.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.51666666666667" y="27.183333333333334">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="25.083333333333332"/>
<g transform="translate(54.231026020611566,24.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="25.183333333333334">PA14</text>
<g transform="translate(57.83102602061157,24.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.016666666666666" y="25.183333333333334">D6</text>
<g transform="translate(60.83102602061157,24.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.31666666666667" y="25.183333333333334">PWM0</text>
<g transform="translate(64.43102602061157,24.383333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="65.91666666666667" y="25.183333333333334">SWCLK</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="23.08333333333333"/>
<g transform="translate(54.231026020611566,22.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="23.18333333333333">PA12</text>
<g transform="translate(57.83102602061157,22.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.016666666666666" y="23.18333333333333">D7</text>
<g transform="translate(60.83102602061157,22.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.31666666666667" y="23.18333333333333">PWM3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="21.08333333333333"/>
<g transform="translate(54.231026020611566,20.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="21.18333333333333">PA15</text>
<g transform="translate(57.83102602061157,20.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.016666666666666" y="21.18333333333333">D8</text>
<g transform="translate(60.83102602061157,20.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.31666666666667" y="21.18333333333333">PWM1</text>
<g transform="translate(64.43102602061157,20.38333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="65.91666666666667" y="21.18333333333333">SWDIO</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="19.08333333333333"/>
<g transform="translate(54.231026020611566,18.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="19.18333333333333">PA18</text>
<g transform="translate(57.83102602061157,18.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.016666666666666" y="19.18333333333333">D9</text>
<g transform="translate(60.83102602061157,18.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.31666666666667" y="19.18333333333333">RX0</text>
<g transform="translate(64.43102602061157,18.38333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="65.91666666666667" y="19.18333333333333">SCL1</text>
<g transform="translate(68.03102602061156,18.38333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.51666666666667" y="19.18333333333333">SCK0</text>
<g transform="translate(71.63102602061156,18.38333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="73.11666666666666" y="19.18333333333333">SCK1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="50.81666666666666" y="17.08333333333333"/>
<g transform="translate(54.231026020611566,16.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.71666666666667" y="17.18333333333333">PA23</text>
<g transform="translate(57.83102602061157,16.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.016666666666666" y="17.18333333333333">D10</text>
<g transform="translate(60.83102602061157,16.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.31666666666667" y="17.18333333333333">TX0</text>
<g transform="translate(64.43102602061157,16.38333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="65.91666666666667" y="17.18333333333333">SDA1</text>
<g transform="translate(68.03102602061156,16.38333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.51666666666667" y="17.18333333333333">MOSI0</text>
<g transform="translate(71.63102602061156,16.38333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="73.11666666666666" y="17.18333333333333">MOSI1</text>
<g transform="translate(75.23102602061157,16.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="76.71666666666667" y="17.18333333333333">PWM0</text>
</svg>

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,80 +0,0 @@
/* This file was auto-generated from bw12.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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
![Pinout](pinout_bw15.svg)
## 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

View File

@@ -1,355 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,85.33333333333333,41.666666666666664" width="1024">
<defs/>
<rect fill="white" height="41.666666666666664" stroke="black" stroke-width="0.1" width="85.33333333333333" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#4d4d4d"/>
<stop offset="100%" stop-color="#0f0f0f"/>
</linearGradient>
<rect fill="url(#id1) none" height="23.9" stroke="#b5a739" stroke-width="0.1" width="15.9" x="34.66666666666666" y="8.883333333333333"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin1.trace" width="0.7" x="34.61666666666666" y="16.583333333333332"/>
<circle cx="34.61666666666666" cy="17.18333333333333" fill="#fff" id="esp12s.front.left.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin2.trace" width="0.7" x="34.61666666666666" y="18.583333333333332"/>
<circle cx="34.61666666666666" cy="19.18333333333333" fill="#fff" id="esp12s.front.left.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin3.trace" width="0.7" x="34.61666666666666" y="20.583333333333332"/>
<circle cx="34.61666666666666" cy="21.18333333333333" fill="#fff" id="esp12s.front.left.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin4.trace" width="0.7" x="34.61666666666666" y="22.583333333333332"/>
<circle cx="34.61666666666666" cy="23.18333333333333" fill="#fff" id="esp12s.front.left.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin5.trace" width="0.7" x="34.61666666666666" y="24.583333333333332"/>
<circle cx="34.61666666666666" cy="25.183333333333334" fill="#fff" id="esp12s.front.left.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin6.trace" width="0.7" x="34.61666666666666" y="26.583333333333332"/>
<circle cx="34.61666666666666" cy="27.183333333333334" fill="#fff" id="esp12s.front.left.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin7.trace" width="0.7" x="34.61666666666666" y="28.583333333333332"/>
<circle cx="34.61666666666666" cy="29.183333333333334" fill="#fff" id="esp12s.front.left.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin8.trace" width="0.7" x="34.61666666666666" y="30.583333333333332"/>
<circle cx="34.61666666666666" cy="31.183333333333334" fill="#fff" id="esp12s.front.left.pin8.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin1.trace" width="0.7" x="49.91666666666666" y="16.583333333333332"/>
<circle cx="50.61666666666666" cy="17.18333333333333" fill="#fff" id="esp12s.front.right.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin2.trace" width="0.7" x="49.91666666666666" y="18.583333333333332"/>
<circle cx="50.61666666666666" cy="19.18333333333333" fill="#fff" id="esp12s.front.right.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin3.trace" width="0.7" x="49.91666666666666" y="20.583333333333332"/>
<circle cx="50.61666666666666" cy="21.18333333333333" fill="#fff" id="esp12s.front.right.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin4.trace" width="0.7" x="49.91666666666666" y="22.583333333333332"/>
<circle cx="50.61666666666666" cy="23.18333333333333" fill="#fff" id="esp12s.front.right.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin5.trace" width="0.7" x="49.91666666666666" y="24.583333333333332"/>
<circle cx="50.61666666666666" cy="25.183333333333334" fill="#fff" id="esp12s.front.right.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin6.trace" width="0.7" x="49.91666666666666" y="26.583333333333332"/>
<circle cx="50.61666666666666" cy="27.183333333333334" fill="#fff" id="esp12s.front.right.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin7.trace" width="0.7" x="49.91666666666666" y="28.583333333333332"/>
<circle cx="50.61666666666666" cy="29.183333333333334" fill="#fff" id="esp12s.front.right.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin8.trace" width="0.7" x="49.91666666666666" y="30.583333333333332"/>
<circle cx="50.61666666666666" cy="31.183333333333334" fill="#fff" id="esp12s.front.right.pin8.cast" r="0.35"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="16.8" rx="0.5" ry="0.5" width="13.6" x="35.81666666666666" y="15.783333333333331"/>
<rect fill="#fafd9d" height="5.2" width="0.5" x="35.71666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="4.6" x="35.71666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="5.2" width="0.5" x="37.91666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="39.81666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="3.0" x="39.81666666666666" y="12.133333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="42.31666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="2.7" x="42.31666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="44.51666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="3.0" x="44.51666666666666" y="12.133333333333333"/>
<rect fill="#fafd9d" height="3.0" width="0.5" x="47.01666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="0.5" width="2.5" x="47.01666666666666" y="9.633333333333333"/>
<rect fill="#fafd9d" height="4.4" width="0.5" x="49.01666666666666" y="9.633333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="17.08333333333333"/>
<g transform="translate(27.731026020611555,16.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="17.18333333333333">PA17</text>
<g transform="translate(24.73102602061156,16.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="17.18333333333333">D0</text>
<g transform="translate(21.131026020611557,16.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="17.18333333333333">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="19.08333333333333"/>
<g transform="translate(27.731026020611555,18.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="19.18333333333333">PA18</text>
<g transform="translate(24.73102602061156,18.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="19.18333333333333">D1</text>
<g transform="translate(21.131026020611557,18.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="19.18333333333333">PWM6</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="21.08333333333333"/>
<g transform="translate(27.731026020611555,20.38333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="21.18333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="23.08333333333333"/>
<g transform="translate(27.731026020611555,22.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="23.18333333333333">PA02</text>
<g transform="translate(24.73102602061156,22.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="23.18333333333333">D2</text>
<g transform="translate(21.131026020611557,22.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="23.18333333333333">RX1</text>
<g transform="translate(17.53102602061156,22.38333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="19.016666666666662" y="23.18333333333333">SCL0</text>
<g transform="translate(13.93102602061156,22.38333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="15.41666666666666" y="23.18333333333333">CS0</text>
<g transform="translate(10.331026020611558,22.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="11.81666666666666" y="23.18333333333333">PWM2</text>
<g transform="translate(6.731026020611557,22.38333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="8.216666666666658" y="23.18333333333333">TDO</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="25.083333333333332"/>
<g transform="translate(27.731026020611555,24.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="25.183333333333334">PA15</text>
<g transform="translate(24.73102602061156,24.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="25.183333333333334">D3</text>
<g transform="translate(21.131026020611557,24.383333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="25.183333333333334">RX2</text>
<g transform="translate(17.53102602061156,24.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="19.016666666666662" y="25.183333333333334">SCL0</text>
<g transform="translate(13.93102602061156,24.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="15.41666666666666" y="25.183333333333334">CS0</text>
<g transform="translate(10.331026020611558,24.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="11.81666666666666" y="25.183333333333334">PWM3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="27.083333333333332"/>
<g transform="translate(27.731026020611555,26.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="27.183333333333334">PA04</text>
<g transform="translate(24.73102602061156,26.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="27.183333333333334">D4</text>
<g transform="translate(21.131026020611557,26.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="27.183333333333334">MOSI0</text>
<g transform="translate(17.53102602061156,26.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="19.016666666666662" y="27.183333333333334">PWM4</text>
<g transform="translate(13.93102602061156,26.383333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="15.41666666666666" y="27.183333333333334">tRST</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="29.083333333333332"/>
<g transform="translate(27.731026020611555,28.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="29.183333333333334">PA19</text>
<g transform="translate(24.73102602061156,28.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="29.183333333333334">D5</text>
<g transform="translate(21.131026020611557,28.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="29.183333333333334">SCL0</text>
<g transform="translate(17.53102602061156,28.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="19.016666666666662" y="29.183333333333334">MOSI0</text>
<g transform="translate(13.93102602061156,28.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="15.41666666666666" y="29.183333333333334">PWM7</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="31.083333333333332"/>
<g transform="translate(27.731026020611555,30.383333333333333)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="31.183333333333334">3V3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="31.083333333333332"/>
<g transform="translate(54.53102602061156,30.383333333333333)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="31.183333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="29.083333333333332"/>
<g transform="translate(54.53102602061156,28.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="29.183333333333334">PA20</text>
<g transform="translate(58.131026020611564,28.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="29.183333333333334">D6</text>
<g transform="translate(61.131026020611564,28.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="29.183333333333334">SDA0</text>
<g transform="translate(64.73102602061155,28.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="29.183333333333334">MISO0</text>
<g transform="translate(68.33102602061156,28.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.81666666666666" y="29.183333333333334">PWM0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="27.083333333333332"/>
<g transform="translate(54.53102602061156,26.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="27.183333333333334">PA16</text>
<g transform="translate(58.131026020611564,26.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="27.183333333333334">D7</text>
<g transform="translate(61.131026020611564,26.383333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="27.183333333333334">TX2</text>
<g transform="translate(64.73102602061155,26.383333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="27.183333333333334">SDA0</text>
<g transform="translate(68.33102602061156,26.383333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.81666666666666" y="27.183333333333334">SCK0</text>
<g transform="translate(71.93102602061157,26.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="73.41666666666667" y="27.183333333333334">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="25.083333333333332"/>
<g transform="translate(54.53102602061156,24.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="25.183333333333334">PA00</text>
<g transform="translate(58.131026020611564,24.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="25.183333333333334">D8</text>
<g transform="translate(61.131026020611564,24.383333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="25.183333333333334">RX1</text>
<g transform="translate(64.73102602061155,24.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="25.183333333333334">PWM0</text>
<g transform="translate(68.33102602061156,24.383333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.81666666666666" y="25.183333333333334">TCK</text>
<g transform="translate(71.93102602061157,24.383333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="73.41666666666667" y="25.183333333333334">SWCLK</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="23.08333333333333"/>
<g transform="translate(54.53102602061156,22.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="23.18333333333333">PA03</text>
<g transform="translate(58.131026020611564,22.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="23.18333333333333">D9</text>
<g transform="translate(61.131026020611564,22.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="23.18333333333333">TX1</text>
<g transform="translate(64.73102602061155,22.38333333333333)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="23.18333333333333">SDA0</text>
<g transform="translate(68.33102602061156,22.38333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.81666666666666" y="23.18333333333333">SCK0</text>
<g transform="translate(71.93102602061157,22.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="73.41666666666667" y="23.18333333333333">PWM3</text>
<g transform="translate(75.53102602061156,22.38333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="77.01666666666667" y="23.18333333333333">TDI</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="21.08333333333333"/>
<g transform="translate(54.53102602061156,20.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="21.18333333333333">PA01</text>
<g transform="translate(58.131026020611564,20.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="21.18333333333333">D10</text>
<g transform="translate(61.131026020611564,20.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="21.18333333333333">TX1</text>
<g transform="translate(64.73102602061155,20.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="21.18333333333333">PWM1</text>
<g transform="translate(68.33102602061156,20.38333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="69.81666666666666" y="21.18333333333333">TMS</text>
<g transform="translate(71.93102602061157,20.38333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="73.41666666666667" y="21.18333333333333">SWDIO</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="19.08333333333333"/>
<g transform="translate(54.53102602061156,18.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="19.18333333333333">PA13</text>
<g transform="translate(58.131026020611564,18.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="19.18333333333333">D11</text>
<g transform="translate(61.131026020611564,18.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="19.18333333333333">RX0</text>
<g transform="translate(64.73102602061155,18.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="19.18333333333333">PWM7</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="17.08333333333333"/>
<g transform="translate(54.53102602061156,16.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="17.18333333333333">PA14</text>
<g transform="translate(58.131026020611564,16.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="17.18333333333333">D12</text>
<g transform="translate(61.131026020611564,16.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="17.18333333333333">TX0</text>
<g transform="translate(64.73102602061155,16.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="17.18333333333333">PWM2</text>
</svg>

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,7 +0,0 @@
/* This file was auto-generated from bw15.json using boardgen */
#pragma once
#include <WVariant.h>
// clang-format off

View File

@@ -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
![Pinout](pinout_cb2l.svg)
## 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.

View File

@@ -1,258 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,93.0909090909091,45.45454545454545" width="1024">
<defs/>
<rect fill="white" height="45.45454545454545" stroke="black" stroke-width="0.1" width="93.0909090909091" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#f9f9f9"/>
<stop offset="100%" stop-color="#ededed"/>
</linearGradient>
<rect fill="url(#id1) none" height="17.2" stroke="#b5a739" stroke-width="0.1" width="14.9" x="17.622727272727275" y="9.677272727272728"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin1.trace" width="1.2" x="18.472727272727273" y="25.227272727272727"/>
<circle cx="19.072727272727274" cy="26.92727272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin1.cast" r="0.35"/>
<circle cx="19.072727272727274" cy="25.877272727272725" fill="#fff" id="pins_horz7_2mm_0.7mm.pin1.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin2.trace" width="1.2" x="20.472727272727273" y="25.227272727272727"/>
<circle cx="21.072727272727274" cy="26.92727272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin2.cast" r="0.35"/>
<circle cx="21.072727272727274" cy="25.877272727272725" fill="#fff" id="pins_horz7_2mm_0.7mm.pin2.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin3.trace" width="1.2" x="22.472727272727273" y="25.227272727272727"/>
<circle cx="23.072727272727274" cy="26.92727272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin3.cast" r="0.35"/>
<circle cx="23.072727272727274" cy="25.877272727272725" fill="#fff" id="pins_horz7_2mm_0.7mm.pin3.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin4.trace" width="1.2" x="24.472727272727276" y="25.227272727272727"/>
<circle cx="25.072727272727274" cy="26.92727272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin4.cast" r="0.35"/>
<circle cx="25.072727272727274" cy="25.877272727272725" fill="#fff" id="pins_horz7_2mm_0.7mm.pin4.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin5.trace" width="1.2" x="26.472727272727276" y="25.227272727272727"/>
<circle cx="27.072727272727274" cy="26.92727272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin5.cast" r="0.35"/>
<circle cx="27.072727272727274" cy="25.877272727272725" fill="#fff" id="pins_horz7_2mm_0.7mm.pin5.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin6.trace" width="1.2" x="28.472727272727276" y="25.227272727272727"/>
<circle cx="29.072727272727274" cy="26.92727272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin6.cast" r="0.35"/>
<circle cx="29.072727272727274" cy="25.877272727272725" fill="#fff" id="pins_horz7_2mm_0.7mm.pin6.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin7.trace" width="1.2" x="30.472727272727276" y="25.227272727272727"/>
<circle cx="31.072727272727274" cy="26.92727272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin7.cast" r="0.35"/>
<circle cx="31.072727272727274" cy="25.877272727272725" fill="#fff" id="pins_horz7_2mm_0.7mm.pin7.hole" r="0.35"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="18.972727272727273" y="27.127272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="18.772727272727273" y="28.92727272727273"/>
<rect height="0.0" id="tuya2l.front.pins.label1.anchor" width="0.0" x="19.272727272727273" y="29.02727272727273"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="20.972727272727273" y="27.127272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="18.772727272727273" y="30.92727272727273"/>
<rect height="0.0" id="tuya2l.front.pins.label2.anchor" width="0.0" x="19.272727272727273" y="31.027272727272724"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="22.972727272727276" y="27.127272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="18.772727272727273" y="32.92727272727273"/>
<rect height="0.0" id="tuya2l.front.pins.label3.anchor" width="0.0" x="19.272727272727273" y="33.027272727272724"/>
<rect fill="#4e4c4c" height="8.0" width="0.2" x="24.972727272727276" y="27.127272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="6.2" x="18.772727272727273" y="34.92727272727273"/>
<rect height="0.0" id="tuya2l.front.pins.label4.anchor" width="0.0" x="19.272727272727273" y="35.027272727272724"/>
<rect fill="#4e4c4c" height="8.0" width="0.2" x="26.972727272727276" y="27.127272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="27.072727272727274" y="34.92727272727273"/>
<rect height="0.0" id="tuya2l.front.pins.label5.anchor" width="0.0" x="30.772727272727273" y="35.027272727272724"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="28.972727272727276" y="27.127272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="29.072727272727274" y="32.92727272727273"/>
<rect height="0.0" id="tuya2l.front.pins.label6.anchor" width="0.0" x="30.772727272727273" y="33.027272727272724"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="30.972727272727276" y="27.127272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="31.072727272727274" y="30.92727272727273"/>
<rect height="0.0" id="tuya2l.front.pins.label7.anchor" width="0.0" x="30.772727272727273" y="31.027272727272724"/>
<text fill="#000" font-family="Consolas" font-size="1.0" x="21.572727272727274" y="15.127272727272727">CB2L</text>
<rect fill="#e0e0e0" height="5.2" width="0.5" x="18.372727272727275" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="0.5" width="4.6" x="18.372727272727275" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="5.2" width="0.5" x="20.572727272727274" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="3.0" width="0.5" x="22.472727272727276" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="0.5" width="3.0" x="22.472727272727276" y="12.627272727272727"/>
<rect fill="#e0e0e0" height="3.0" width="0.5" x="24.972727272727276" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="0.5" width="2.7" x="24.972727272727276" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="3.0" width="0.5" x="27.172727272727272" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="0.5" width="3.0" x="27.172727272727272" y="12.627272727272727"/>
<rect fill="#e0e0e0" height="3.0" width="0.5" x="29.672727272727272" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="0.5" width="2.5" x="29.672727272727272" y="10.127272727272727"/>
<rect fill="#e0e0e0" height="4.4" width="0.5" x="31.672727272727272" y="10.127272727272727"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="9.0" rx="0.5" ry="0.5" width="13.6" x="18.272727272727273" y="15.627272727272727"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="16.172727272727272" y="28.92727272727273"/>
<g transform="translate(12.387086626672172,28.22727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="13.872727272727273" y="29.02727272727273">P8</text>
<g transform="translate(9.387086626672172,28.22727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="10.572727272727274" y="29.02727272727273">D0</text>
<g transform="translate(5.787086626672172,28.22727272727273)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="7.272727272727274" y="29.02727272727273">PWM2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="16.172727272727272" y="30.927272727272722"/>
<g transform="translate(12.387086626672172,30.227272727272723)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="13.872727272727273" y="31.027272727272724">P7</text>
<g transform="translate(9.387086626672172,30.227272727272723)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="10.572727272727274" y="31.027272727272724">D1</text>
<g transform="translate(5.787086626672172,30.227272727272723)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="7.272727272727274" y="31.027272727272724">PWM1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="16.172727272727272" y="32.92727272727272"/>
<g transform="translate(12.387086626672172,32.22727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="13.872727272727273" y="33.027272727272724">P6</text>
<g transform="translate(9.387086626672172,32.22727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="10.572727272727274" y="33.027272727272724">D2</text>
<g transform="translate(5.787086626672172,32.22727272727273)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="7.272727272727274" y="33.027272727272724">PWM0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="16.172727272727272" y="34.92727272727272"/>
<g transform="translate(12.387086626672172,34.22727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="13.872727272727273" y="35.027272727272724">P26</text>
<g transform="translate(9.387086626672172,34.22727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="10.572727272727274" y="35.027272727272724">D3</text>
<g transform="translate(5.787086626672172,34.22727272727273)">
<rect fill="#aeafc1" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="7.272727272727274" y="35.027272727272724">IRDA</text>
<g transform="translate(2.1870866266721727,34.22727272727273)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="3.6727272727272746" y="35.027272727272724">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.272727272727273" y="34.92727272727272"/>
<g transform="translate(34.687086626672176,34.22727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="36.17272727272728" y="35.027272727272724">P24</text>
<g transform="translate(38.28708662667218,34.22727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="39.472727272727276" y="35.027272727272724">D4</text>
<g transform="translate(41.28708662667218,34.22727272727273)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="42.77272727272728" y="35.027272727272724">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.272727272727273" y="32.92727272727272"/>
<g transform="translate(34.687086626672176,32.22727272727273)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="36.17272727272728" y="33.027272727272724">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.272727272727273" y="30.927272727272722"/>
<g transform="translate(34.687086626672176,30.227272727272723)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="36.17272727272728" y="31.027272727272724">3V3</text>
<linearGradient gradientUnits="objectBoundingBox" id="id3" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#f9f9f9"/>
<stop offset="100%" stop-color="#ededed"/>
</linearGradient>
<rect fill="url(#id3) none" height="17.2" stroke="#b5a739" stroke-width="0.1" width="14.9" x="68.71818181818182" y="14.852272727272727"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin1.trace" width="1.2" x="69.56818181818183" y="30.402272727272727"/>
<circle cx="70.16818181818182" cy="32.10227272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin1.cast" r="0.35"/>
<circle cx="70.16818181818182" cy="31.052272727272726" fill="#fff" id="pins_horz7_2mm_0.7mm.pin1.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin2.trace" width="1.2" x="71.56818181818183" y="30.402272727272727"/>
<circle cx="72.16818181818182" cy="32.10227272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin2.cast" r="0.35"/>
<circle cx="72.16818181818182" cy="31.052272727272726" fill="#fff" id="pins_horz7_2mm_0.7mm.pin2.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin3.trace" width="1.2" x="73.56818181818183" y="30.402272727272727"/>
<circle cx="74.16818181818182" cy="32.10227272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin3.cast" r="0.35"/>
<circle cx="74.16818181818182" cy="31.052272727272726" fill="#fff" id="pins_horz7_2mm_0.7mm.pin3.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin4.trace" width="1.2" x="75.56818181818183" y="30.402272727272727"/>
<circle cx="76.16818181818182" cy="32.10227272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin4.cast" r="0.35"/>
<circle cx="76.16818181818182" cy="31.052272727272726" fill="#fff" id="pins_horz7_2mm_0.7mm.pin4.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin5.trace" width="1.2" x="77.56818181818183" y="30.402272727272727"/>
<circle cx="78.16818181818182" cy="32.10227272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin5.cast" r="0.35"/>
<circle cx="78.16818181818182" cy="31.052272727272726" fill="#fff" id="pins_horz7_2mm_0.7mm.pin5.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin6.trace" width="1.2" x="79.56818181818183" y="30.402272727272727"/>
<circle cx="80.16818181818182" cy="32.10227272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin6.cast" r="0.35"/>
<circle cx="80.16818181818182" cy="31.052272727272726" fill="#fff" id="pins_horz7_2mm_0.7mm.pin6.hole" r="0.35"/>
<rect fill="#e5b472" height="1.7" id="pins_horz7_2mm_0.7mm.pin7.trace" width="1.2" x="81.56818181818183" y="30.402272727272727"/>
<circle cx="82.16818181818182" cy="32.10227272727273" fill="#fff" id="pins_horz7_2mm_0.7mm.pin7.cast" r="0.35"/>
<circle cx="82.16818181818182" cy="31.052272727272726" fill="#fff" id="pins_horz7_2mm_0.7mm.pin7.hole" r="0.35"/>
<circle cx="70.16818181818182" cy="22.302272727272726" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="2.7" width="0.2" x="68.96818181818182" y="19.702272727272728"/>
<rect fill="#4e4c4c" height="0.2" width="0.4" x="69.06818181818183" y="22.202272727272728"/>
<rect height="0.0" id="label_line_2mm_down.anchor" width="0.0" x="68.96818181818182" y="22.302272727272726"/>
<rect height="0.0" id="cb2l.back.u1_rxd.anchor" width="0.0" x="69.56818181818183" y="19.802272727272726"/>
<circle cx="70.86818181818182" cy="20.702272727272728" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="70.76818181818182" y="17.702272727272724"/>
<rect fill="#4e4c4c" height="0.2" width="1.7" x="69.06818181818183" y="17.702272727272724"/>
<rect height="0.0" id="cb2l.back.u2_txd.anchor" width="0.0" x="69.56818181818183" y="17.802272727272726"/>
<circle cx="72.66818181818182" cy="20.702272727272728" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="72.56818181818183" y="15.702272727272724"/>
<rect fill="#4e4c4c" height="0.2" width="3.5" x="69.06818181818183" y="15.702272727272724"/>
<rect height="0.0" id="cb2l.back.u1_txd.anchor" width="0.0" x="69.56818181818183" y="15.802272727272726"/>
<circle cx="77.86818181818182" cy="20.702272727272728" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="77.76818181818182" y="13.702272727272724"/>
<rect fill="#4e4c4c" height="0.2" width="8.7" x="69.06818181818181" y="13.702272727272724"/>
<rect height="0.0" id="cb2l.back.gnd.anchor" width="0.0" x="69.56818181818181" y="13.802272727272726"/>
<circle cx="70.86818181818182" cy="25.502272727272725" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="1.0" width="0.2" x="70.76818181818182" y="23.502272727272725"/>
<rect fill="#4e4c4c" height="0.2" width="1.7" x="69.06818181818183" y="23.502272727272725"/>
<rect height="0.0" id="cb2l.back.rst.anchor" width="0.0" x="69.56818181818183" y="23.602272727272727"/>
<circle cx="70.86818181818182" cy="26.802272727272726" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="1.0" width="0.2" x="70.76818181818182" y="27.802272727272726"/>
<rect fill="#4e4c4c" height="0.2" width="1.7" x="69.06818181818183" y="28.602272727272727"/>
<rect height="0.0" id="cb2l.back.f_csn.anchor" width="0.0" x="69.56818181818183" y="28.702272727272728"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="66.46818181818182" y="13.702272727272726"/>
<g transform="translate(62.68254117212672,13.002272727272725)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.16818181818182" y="13.802272727272726">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="66.46818181818183" y="23.502272727272725"/>
<g transform="translate(62.68254117212672,22.802272727272726)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.16818181818182" y="23.602272727272727">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="66.46818181818183" y="19.702272727272724"/>
<g transform="translate(62.68254117212672,19.002272727272725)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.16818181818182" y="19.802272727272726">P10</text>
<g transform="translate(59.682541172126726,19.002272727272725)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.868181818181824" y="19.802272727272726">D5</text>
<g transform="translate(56.082541172126724,19.002272727272725)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.56818181818183" y="19.802272727272726">RX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="66.46818181818183" y="17.702272727272724"/>
<g transform="translate(62.68254117212672,17.002272727272725)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.16818181818182" y="17.802272727272726">P0</text>
<g transform="translate(59.682541172126726,17.002272727272725)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.868181818181824" y="17.802272727272726">D6</text>
<g transform="translate(56.082541172126724,17.002272727272725)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.56818181818183" y="17.802272727272726">TX2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="66.46818181818183" y="15.702272727272726"/>
<g transform="translate(62.68254117212672,15.002272727272725)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.16818181818182" y="15.802272727272726">P11</text>
<g transform="translate(59.682541172126726,15.002272727272725)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.868181818181824" y="15.802272727272726">D7</text>
<g transform="translate(56.082541172126724,15.002272727272725)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.56818181818183" y="15.802272727272726">TX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="66.46818181818183" y="28.602272727272727"/>
<g transform="translate(62.68254117212672,27.902272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.16818181818182" y="28.702272727272728">P21</text>
<g transform="translate(59.682541172126726,27.902272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.868181818181824" y="28.702272727272728">D8</text>
</svg>

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,49 +0,0 @@
/* This file was auto-generated from cb2l.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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
![Pinout](pinout_cb2s.svg)
## 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.

View File

@@ -1,276 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,93.0909090909091,45.45454545454545" width="1024">
<defs/>
<rect fill="white" height="45.45454545454545" stroke="black" stroke-width="0.1" width="93.0909090909091" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#47a8cd"/>
<stop offset="100%" stop-color="#008fb5"/>
</linearGradient>
<rect fill="url(#id1) none" height="17.799999999999997" stroke="#b5a739" stroke-width="0.1" width="14.9" x="16.32272727272727" y="10.377272727272727"/>
<rect fill="#b5a739" height="0.1" width="1.6" x="16.27272727272727" y="24.677272727272726"/>
<rect fill="#b5a739" height="3.45" width="0.1" x="17.87272727272727" y="24.677272727272726"/>
<rect fill="#fff" height="3.55" width="1.7" x="16.17272727272727" y="24.777272727272724"/>
<rect fill="#b5a739" height="0.1" width="1.6" x="29.57272727272727" y="24.677272727272726"/>
<rect fill="#b5a739" height="3.45" width="0.1" x="29.57272727272727" y="24.677272727272726"/>
<rect fill="#fff" height="3.55" width="1.7" x="29.672727272727272" y="24.777272727272724"/>
<rect fill="#e5b472" height="2.5" id="pads_horz5_2mm.pin1.pad" rx="0.2" ry="0.2" width="1.0" x="19.27272727272727" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz5_2mm.pin2.pad" rx="0.2" ry="0.2" width="1.0" x="21.27272727272727" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz5_2mm.pin3.pad" rx="0.2" ry="0.2" width="1.0" x="23.27272727272727" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz5_2mm.pin4.pad" rx="0.2" ry="0.2" width="1.0" x="25.27272727272727" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz5_2mm.pin5.pad" rx="0.2" ry="0.2" width="1.0" x="27.27272727272727" y="25.377272727272725"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="19.67272727272727" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="19.47272727272727" y="30.227272727272727"/>
<rect height="0.0" id="tuya2.front.pins.label1.anchor" width="0.0" x="19.97272727272727" y="30.327272727272728"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="21.672727272727272" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="19.47272727272727" y="32.22727272727273"/>
<rect height="0.0" id="tuya2.front.pins.label2.anchor" width="0.0" x="19.97272727272727" y="32.32727272727273"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="23.672727272727272" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="19.47272727272727" y="34.22727272727273"/>
<rect height="0.0" id="tuya2.front.pins.label3.anchor" width="0.0" x="19.97272727272727" y="34.32727272727273"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="25.672727272727272" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="25.77272727272727" y="34.22727272727273"/>
<rect height="0.0" id="tuya2.front.pins.label4.anchor" width="0.0" x="29.47272727272727" y="34.32727272727273"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="27.672727272727272" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="27.77272727272727" y="32.22727272727273"/>
<rect height="0.0" id="tuya2.front.pins.label5.anchor" width="0.0" x="29.47272727272727" y="32.32727272727273"/>
<text fill="#fff" font-family="Consolas" font-size="1.0" x="23.27272727272727" y="15.327272727272726">CB2S</text>
<rect fill="#58839b" height="5.2" width="0.5" x="17.07272727272727" y="10.827272727272726"/>
<rect fill="#58839b" height="0.5" width="4.6" x="17.07272727272727" y="10.827272727272726"/>
<rect fill="#58839b" height="5.2" width="0.5" x="19.27272727272727" y="10.827272727272726"/>
<rect fill="#58839b" height="3.0" width="0.5" x="21.172727272727272" y="10.827272727272726"/>
<rect fill="#58839b" height="0.5" width="3.0" x="21.172727272727272" y="13.327272727272726"/>
<rect fill="#58839b" height="3.0" width="0.5" x="23.672727272727272" y="10.827272727272726"/>
<rect fill="#58839b" height="0.5" width="2.7" x="23.672727272727272" y="10.827272727272726"/>
<rect fill="#58839b" height="3.0" width="0.5" x="25.872727272727268" y="10.827272727272726"/>
<rect fill="#58839b" height="0.5" width="3.0" x="25.872727272727268" y="13.327272727272726"/>
<rect fill="#58839b" height="3.0" width="0.5" x="28.372727272727268" y="10.827272727272726"/>
<rect fill="#58839b" height="0.5" width="2.5" x="28.372727272727268" y="10.827272727272726"/>
<rect fill="#58839b" height="4.4" width="0.5" x="30.372727272727268" y="10.827272727272726"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="8.0" rx="0.5" ry="0.5" width="14.4" x="16.57272727272727" y="16.327272727272728"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.97272727272727" y="32.22727272727273"/>
<g transform="translate(33.38708662667217,31.527272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="34.872727272727275" y="32.32727272727273">P6</text>
<g transform="translate(36.98708662667217,31.527272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="38.17272727272727" y="32.32727272727273">D0</text>
<g transform="translate(39.98708662667217,31.527272727272727)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="41.472727272727276" y="32.32727272727273">PWM0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.97272727272727" y="34.22727272727273"/>
<g transform="translate(33.38708662667217,33.52727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="34.872727272727275" y="34.32727272727273">P7</text>
<g transform="translate(36.98708662667217,33.52727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="38.17272727272727" y="34.32727272727273">D1</text>
<g transform="translate(39.98708662667217,33.52727272727273)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="41.472727272727276" y="34.32727272727273">PWM1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="16.872727272727268" y="34.22727272727273"/>
<g transform="translate(13.087086626672166,33.52727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="14.572727272727267" y="34.32727272727273">P8</text>
<g transform="translate(10.087086626672168,33.52727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="11.27272727272727" y="34.32727272727273">D2</text>
<g transform="translate(6.487086626672168,33.52727272727273)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="7.97272727272727" y="34.32727272727273">PWM2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="16.872727272727268" y="32.22727272727273"/>
<g transform="translate(13.08708662667217,31.527272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="14.57272727272727" y="32.32727272727273">P23</text>
<g transform="translate(9.487086626672168,31.527272727272727)">
<rect fill="#8ad039" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="10.972727272727269" y="32.32727272727273">ADC3</text>
<g transform="translate(6.487086626672168,31.527272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="7.67272727272727" y="32.32727272727273">D3</text>
<g transform="translate(3.4870866266721685,31.527272727272727)">
<rect fill="#16a352" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="4.67272727272727" y="32.32727272727273">A0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="16.872727272727268" y="30.227272727272727"/>
<g transform="translate(13.08708662667217,29.527272727272727)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="14.57272727272727" y="30.327272727272728">CEN</text>
<linearGradient gradientUnits="objectBoundingBox" id="id3" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#47a8cd"/>
<stop offset="100%" stop-color="#008fb5"/>
</linearGradient>
<rect fill="url(#id3) none" height="17.799999999999997" stroke="#b5a739" stroke-width="0.1" width="14.9" x="61.543181818181814" y="10.377272727272727"/>
<rect fill="#b5a739" height="0.1" width="1.6" x="61.49318181818182" y="24.677272727272726"/>
<rect fill="#b5a739" height="3.45" width="0.1" x="63.09318181818182" y="24.677272727272726"/>
<rect fill="#fff" height="3.55" width="1.7" x="61.393181818181816" y="24.777272727272724"/>
<rect fill="#b5a739" height="0.1" width="1.6" x="74.79318181818182" y="24.677272727272726"/>
<rect fill="#b5a739" height="3.45" width="0.1" x="74.79318181818182" y="24.677272727272726"/>
<rect fill="#fff" height="3.55" width="1.7" x="74.89318181818182" y="24.777272727272724"/>
<rect fill="#e5b472" height="2.5" id="pads_horz6_2mm.pin1.pad" rx="0.2" ry="0.2" width="1.0" x="63.44318181818182" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz6_2mm.pin2.pad" rx="0.2" ry="0.2" width="1.0" x="65.44318181818181" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz6_2mm.pin3.pad" rx="0.2" ry="0.2" width="1.0" x="67.44318181818181" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz6_2mm.pin4.pad" rx="0.2" ry="0.2" width="1.0" x="69.44318181818181" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz6_2mm.pin5.pad" rx="0.2" ry="0.2" width="1.0" x="71.44318181818181" y="25.377272727272725"/>
<rect fill="#e5b472" height="2.5" id="pads_horz6_2mm.pin6.pad" rx="0.2" ry="0.2" width="1.0" x="73.44318181818181" y="25.377272727272725"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="63.84318181818182" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="63.643181818181816" y="30.227272727272727"/>
<rect height="0.0" id="tuya2.back.pins.label1.anchor" width="0.0" x="64.14318181818182" y="30.327272727272728"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="65.84318181818182" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="63.643181818181816" y="32.22727272727273"/>
<rect height="0.0" id="tuya2.back.pins.label2.anchor" width="0.0" x="64.14318181818182" y="32.32727272727273"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="67.84318181818182" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="63.643181818181816" y="34.22727272727273"/>
<rect height="0.0" id="tuya2.back.pins.label3.anchor" width="0.0" x="64.14318181818182" y="34.32727272727273"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="69.84318181818182" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="69.94318181818181" y="34.22727272727273"/>
<rect height="0.0" id="tuya2.back.pins.label4.anchor" width="0.0" x="73.64318181818182" y="34.32727272727273"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="71.84318181818182" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="71.94318181818181" y="32.22727272727273"/>
<rect height="0.0" id="tuya2.back.pins.label5.anchor" width="0.0" x="73.64318181818182" y="32.32727272727273"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="73.84318181818182" y="28.427272727272722"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="73.94318181818181" y="30.227272727272727"/>
<rect height="0.0" id="tuya2.back.pins.label6.anchor" width="0.0" x="73.64318181818182" y="30.327272727272728"/>
<rect fill="#e5b472" height="2.9" width="2.9" x="67.49318181818182" y="19.227272727272727"/>
<rect fill="#4e4c4c" height="0.0" width="0.2" x="68.09318181818182" y="16.227272727272727"/>
<rect fill="#4e4c4c" height="0.2" width="2.7" x="65.39318181818182" y="16.227272727272727"/>
<rect height="0.0" id="cb2s.back.u2_txd.anchor" width="0.0" x="65.89318181818182" y="16.327272727272728"/>
<circle cx="68.99318181818182" cy="16.327272727272728" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="0.0" width="0.2" x="67.59318181818182" y="18.227272727272727"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="65.39318181818182" y="18.227272727272727"/>
<rect height="0.0" id="cb2s.back.u2_rxd.anchor" width="0.0" x="65.89318181818182" y="18.327272727272728"/>
<circle cx="68.49318181818182" cy="18.327272727272728" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="0.0" width="0.2" x="65.59318181818182" y="21.227272727272727"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="65.39318181818182" y="21.227272727272727"/>
<rect height="0.0" id="cb2s.back.csn.anchor" width="0.0" x="65.89318181818182" y="21.327272727272728"/>
<circle cx="66.49318181818182" cy="21.327272727272728" fill="#e5b472" r="0.5"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="61.043181818181814" y="30.227272727272727"/>
<g transform="translate(57.257541172126714,29.527272727272727)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.74318181818182" y="30.327272727272728">3V3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="61.043181818181814" y="32.22727272727273"/>
<g transform="translate(57.257541172126714,31.527272727272727)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.74318181818182" y="32.32727272727273">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="61.043181818181814" y="34.22727272727273"/>
<g transform="translate(57.257541172126714,33.52727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.74318181818182" y="34.32727272727273">P10</text>
<g transform="translate(54.257541172126714,33.52727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="55.44318181818181" y="34.32727272727273">D4</text>
<g transform="translate(50.65754117212671,33.52727272727273)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="52.143181818181816" y="34.32727272727273">RX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="74.14318181818182" y="34.22727272727273"/>
<g transform="translate(77.55754117212672,33.52727272727273)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="79.04318181818182" y="34.32727272727273">P11</text>
<g transform="translate(81.15754117212671,33.52727272727273)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="82.34318181818182" y="34.32727272727273">D5</text>
<g transform="translate(84.15754117212671,33.52727272727273)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="85.64318181818182" y="34.32727272727273">TX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="74.14318181818182" y="32.22727272727273"/>
<g transform="translate(77.5575411721267,31.527272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="79.04318181818181" y="32.32727272727273">P24</text>
<g transform="translate(81.15754117212671,31.527272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="82.34318181818182" y="32.32727272727273">D6</text>
<g transform="translate(84.15754117212671,31.527272727272727)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="85.64318181818182" y="32.32727272727273">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="74.14318181818182" y="30.227272727272727"/>
<g transform="translate(77.5575411721267,29.527272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="79.04318181818181" y="30.327272727272728">P26</text>
<g transform="translate(81.15754117212671,29.527272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="82.34318181818182" y="30.327272727272728">D7</text>
<g transform="translate(84.15754117212671,29.527272727272727)">
<rect fill="#aeafc1" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="85.64318181818182" y="30.327272727272728">IRDA</text>
<g transform="translate(87.75754117212671,29.527272727272727)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="89.24318181818181" y="30.327272727272728">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="62.793181818181814" y="18.227272727272727"/>
<g transform="translate(59.007541172126714,17.527272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.49318181818182" y="18.327272727272728">P1</text>
<g transform="translate(56.00754117212672,17.527272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.19318181818182" y="18.327272727272728">D9</text>
<g transform="translate(52.40754117212672,17.527272727272727)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="53.89318181818182" y="18.327272727272728">RX2</text>
<g transform="translate(48.80754117212672,17.527272727272727)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="50.29318181818182" y="18.327272727272728">SDA2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="62.793181818181814" y="16.227272727272727"/>
<g transform="translate(59.007541172126714,15.527272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.49318181818182" y="16.327272727272728">P0</text>
<g transform="translate(56.00754117212672,15.527272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.19318181818182" y="16.327272727272728">D8</text>
<g transform="translate(52.40754117212672,15.527272727272727)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="53.89318181818182" y="16.327272727272728">TX2</text>
<g transform="translate(48.80754117212672,15.527272727272727)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="50.29318181818182" y="16.327272727272728">SCL2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="62.793181818181814" y="21.227272727272727"/>
<g transform="translate(59.007541172126714,20.527272727272727)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.49318181818182" y="21.327272727272728">P21</text>
<g transform="translate(56.00754117212672,20.527272727272727)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.19318181818182" y="21.327272727272728">D10</text>
<g transform="translate(52.40754117212672,20.527272727272727)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="53.89318181818182" y="21.327272727272728">SDA1</text>
</svg>

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,64 +0,0 @@
/* This file was auto-generated from cb2s.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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
![Pinout](pinout_cb3l.svg)
## 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.

View File

@@ -1,253 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,85.33333333333333,41.666666666666664" width="1024">
<defs/>
<rect fill="white" height="41.666666666666664" stroke="black" stroke-width="0.1" width="85.33333333333333" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#47a8cd"/>
<stop offset="100%" stop-color="#008fb5"/>
</linearGradient>
<rect fill="url(#id1) none" height="23.9" stroke="#b5a739" stroke-width="0.1" width="15.9" x="36.46666666666666" y="8.883333333333333"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin1.trace" width="1.7" x="36.416666666666664" y="16.583333333333332"/>
<circle cx="36.416666666666664" cy="17.18333333333333" fill="#fff" id="esp12s.front.left.pin1.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="17.18333333333333" fill="#fff" id="esp12s.front.left.pin1.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin2.trace" width="1.7" x="36.416666666666664" y="18.583333333333332"/>
<circle cx="36.416666666666664" cy="19.18333333333333" fill="#fff" id="esp12s.front.left.pin2.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="19.18333333333333" fill="#fff" id="esp12s.front.left.pin2.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin3.trace" width="1.7" x="36.416666666666664" y="20.583333333333332"/>
<circle cx="36.416666666666664" cy="21.18333333333333" fill="#fff" id="esp12s.front.left.pin3.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="21.18333333333333" fill="#fff" id="esp12s.front.left.pin3.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin4.trace" width="1.7" x="36.416666666666664" y="22.583333333333332"/>
<circle cx="36.416666666666664" cy="23.18333333333333" fill="#fff" id="esp12s.front.left.pin4.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="23.18333333333333" fill="#fff" id="esp12s.front.left.pin4.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin5.trace" width="1.7" x="36.416666666666664" y="24.583333333333332"/>
<circle cx="36.416666666666664" cy="25.183333333333334" fill="#fff" id="esp12s.front.left.pin5.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="25.183333333333334" fill="#fff" id="esp12s.front.left.pin5.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin6.trace" width="1.7" x="36.416666666666664" y="26.583333333333332"/>
<circle cx="36.416666666666664" cy="27.183333333333334" fill="#fff" id="esp12s.front.left.pin6.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="27.183333333333334" fill="#fff" id="esp12s.front.left.pin6.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin7.trace" width="1.7" x="36.416666666666664" y="28.583333333333332"/>
<circle cx="36.416666666666664" cy="29.183333333333334" fill="#fff" id="esp12s.front.left.pin7.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="29.183333333333334" fill="#fff" id="esp12s.front.left.pin7.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.left.pin8.trace" width="1.7" x="36.416666666666664" y="30.583333333333332"/>
<circle cx="36.416666666666664" cy="31.183333333333334" fill="#fff" id="esp12s.front.left.pin8.cast" r="0.35"/>
<circle cx="37.46666666666666" cy="31.183333333333334" fill="#fff" id="esp12s.front.left.pin8.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin1.trace" width="1.7" x="50.71666666666667" y="16.583333333333332"/>
<circle cx="52.416666666666664" cy="17.18333333333333" fill="#fff" id="esp12s.front.right.pin1.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="17.18333333333333" fill="#fff" id="esp12s.front.right.pin1.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin2.trace" width="1.7" x="50.71666666666667" y="18.583333333333332"/>
<circle cx="52.416666666666664" cy="19.18333333333333" fill="#fff" id="esp12s.front.right.pin2.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="19.18333333333333" fill="#fff" id="esp12s.front.right.pin2.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin3.trace" width="1.7" x="50.71666666666667" y="20.583333333333332"/>
<circle cx="52.416666666666664" cy="21.18333333333333" fill="#fff" id="esp12s.front.right.pin3.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="21.18333333333333" fill="#fff" id="esp12s.front.right.pin3.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin4.trace" width="1.7" x="50.71666666666667" y="22.583333333333332"/>
<circle cx="52.416666666666664" cy="23.18333333333333" fill="#fff" id="esp12s.front.right.pin4.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="23.18333333333333" fill="#fff" id="esp12s.front.right.pin4.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin5.trace" width="1.7" x="50.71666666666667" y="24.583333333333332"/>
<circle cx="52.416666666666664" cy="25.183333333333334" fill="#fff" id="esp12s.front.right.pin5.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="25.183333333333334" fill="#fff" id="esp12s.front.right.pin5.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin6.trace" width="1.7" x="50.71666666666667" y="26.583333333333332"/>
<circle cx="52.416666666666664" cy="27.183333333333334" fill="#fff" id="esp12s.front.right.pin6.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="27.183333333333334" fill="#fff" id="esp12s.front.right.pin6.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin7.trace" width="1.7" x="50.71666666666667" y="28.583333333333332"/>
<circle cx="52.416666666666664" cy="29.183333333333334" fill="#fff" id="esp12s.front.right.pin7.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="29.183333333333334" fill="#fff" id="esp12s.front.right.pin7.hole" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12s.front.right.pin8.trace" width="1.7" x="50.71666666666667" y="30.583333333333332"/>
<circle cx="52.416666666666664" cy="31.183333333333334" fill="#fff" id="esp12s.front.right.pin8.cast" r="0.35"/>
<circle cx="51.36666666666666" cy="31.183333333333334" fill="#fff" id="esp12s.front.right.pin8.hole" r="0.35"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="15.8" rx="0.5" ry="0.5" width="12.0" x="38.416666666666664" y="15.783333333333331"/>
<rect fill="#fff" height="0.15" width="15.0" x="36.916666666666664" y="15.033333333333331"/>
<text fill="#fff" font-family="Consolas" font-size="1.0" x="43.416666666666664" y="14.333333333333332">CB3L</text>
<rect fill="#58839b" height="5.2" width="0.5" x="37.516666666666666" y="9.633333333333333"/>
<rect fill="#58839b" height="0.5" width="4.6" x="37.516666666666666" y="9.633333333333333"/>
<rect fill="#58839b" height="5.2" width="0.5" x="39.71666666666666" y="9.633333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="41.61666666666667" y="9.633333333333333"/>
<rect fill="#58839b" height="0.5" width="3.0" x="41.61666666666667" y="12.133333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="44.11666666666667" y="9.633333333333333"/>
<rect fill="#58839b" height="0.5" width="2.7" x="44.11666666666667" y="9.633333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="46.31666666666666" y="9.633333333333333"/>
<rect fill="#58839b" height="0.5" width="3.0" x="46.31666666666666" y="12.133333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="48.81666666666666" y="9.633333333333333"/>
<rect fill="#58839b" height="0.5" width="2.5" x="48.81666666666666" y="9.633333333333333"/>
<rect fill="#58839b" height="4.4" width="0.5" x="50.81666666666666" y="9.633333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="17.08333333333333"/>
<g transform="translate(29.53102602061156,16.38333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="17.18333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="19.08333333333333"/>
<g transform="translate(29.53102602061156,18.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="19.18333333333333">P23</text>
<g transform="translate(25.93102602061156,18.38333333333333)">
<rect fill="#8ad039" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.416666666666664" y="19.18333333333333">ADC3</text>
<g transform="translate(22.93102602061156,18.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.116666666666664" y="19.18333333333333">D0</text>
<g transform="translate(19.93102602061156,18.38333333333333)">
<rect fill="#16a352" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="21.116666666666664" y="19.18333333333333">A0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="21.08333333333333"/>
<g transform="translate(29.53102602061156,20.38333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="21.18333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="23.08333333333333"/>
<g transform="translate(29.53102602061156,22.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="23.18333333333333">P14</text>
<g transform="translate(26.531026020611563,22.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.716666666666665" y="23.18333333333333">D1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="25.083333333333332"/>
<g transform="translate(29.53102602061156,24.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="25.183333333333334">P26</text>
<g transform="translate(26.531026020611563,24.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.716666666666665" y="25.183333333333334">D2</text>
<g transform="translate(22.93102602061156,24.383333333333333)">
<rect fill="#aeafc1" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.416666666666664" y="25.183333333333334">IRDA</text>
<g transform="translate(19.331026020611564,24.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.816666666666666" y="25.183333333333334">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="27.083333333333332"/>
<g transform="translate(29.53102602061156,26.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="27.183333333333334">P24</text>
<g transform="translate(26.531026020611563,26.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.716666666666665" y="27.183333333333334">D3</text>
<g transform="translate(22.93102602061156,26.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.416666666666664" y="27.183333333333334">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="29.083333333333332"/>
<g transform="translate(29.53102602061156,28.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="29.183333333333334">P6</text>
<g transform="translate(26.531026020611563,28.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.716666666666665" y="29.183333333333334">D4</text>
<g transform="translate(22.93102602061156,28.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.416666666666664" y="29.183333333333334">PWM0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.31666666666666" y="31.083333333333332"/>
<g transform="translate(29.53102602061156,30.383333333333333)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="31.016666666666662" y="31.183333333333334">3V3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="31.083333333333332"/>
<g transform="translate(56.33102602061157,30.383333333333333)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="31.183333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="29.083333333333332"/>
<g transform="translate(56.33102602061157,28.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="29.183333333333334">P9</text>
<g transform="translate(59.93102602061157,28.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.11666666666667" y="29.183333333333334">D5</text>
<g transform="translate(62.93102602061157,28.383333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.41666666666667" y="29.183333333333334">PWM3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="27.083333333333332"/>
<g transform="translate(56.33102602061157,26.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="27.183333333333334">P0</text>
<g transform="translate(59.93102602061157,26.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.11666666666667" y="27.183333333333334">D6</text>
<g transform="translate(62.93102602061157,26.383333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.41666666666667" y="27.183333333333334">TX2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="25.083333333333332"/>
<g transform="translate(56.33102602061157,24.383333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="25.183333333333334">P21</text>
<g transform="translate(59.93102602061157,24.383333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.11666666666667" y="25.183333333333334">D7</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="23.08333333333333"/>
<g transform="translate(56.33102602061157,22.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="23.18333333333333">P8</text>
<g transform="translate(59.93102602061157,22.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.11666666666667" y="23.18333333333333">D8</text>
<g transform="translate(62.93102602061157,22.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.41666666666667" y="23.18333333333333">PWM2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="21.08333333333333"/>
<g transform="translate(56.33102602061157,20.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="21.18333333333333">P7</text>
<g transform="translate(59.93102602061157,20.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.11666666666667" y="21.18333333333333">D9</text>
<g transform="translate(62.93102602061157,20.38333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.41666666666667" y="21.18333333333333">PWM1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="19.08333333333333"/>
<g transform="translate(56.33102602061157,18.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="19.18333333333333">P10</text>
<g transform="translate(59.93102602061157,18.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.11666666666667" y="19.18333333333333">D10</text>
<g transform="translate(62.93102602061157,18.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.41666666666667" y="19.18333333333333">RX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.916666666666664" y="17.08333333333333"/>
<g transform="translate(56.33102602061157,16.38333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.81666666666667" y="17.18333333333333">P11</text>
<g transform="translate(59.93102602061157,16.38333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.11666666666667" y="17.18333333333333">D11</text>
<g transform="translate(62.93102602061157,16.38333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.41666666666667" y="17.18333333333333">TX1</text>
</svg>

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,61 +0,0 @@
/* This file was auto-generated from cb3l.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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
![Pinout](pinout_cb3s.svg)
## 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.

View File

@@ -1,375 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,85.33333333333333,41.666666666666664" width="1024">
<defs/>
<rect fill="white" height="41.666666666666664" stroke="black" stroke-width="0.1" width="85.33333333333333" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#47a8cd"/>
<stop offset="100%" stop-color="#008fb5"/>
</linearGradient>
<rect fill="url(#id1) none" height="23.9" stroke="#b5a739" stroke-width="0.1" width="15.9" x="36.16666666666666" y="5.433333333333331"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin1.trace" width="0.7" x="36.11666666666666" y="13.133333333333331"/>
<circle cx="36.11666666666666" cy="13.73333333333333" fill="#fff" id="esp12e-22.front.left.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin2.trace" width="0.7" x="36.11666666666666" y="15.133333333333331"/>
<circle cx="36.11666666666666" cy="15.73333333333333" fill="#fff" id="esp12e-22.front.left.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin3.trace" width="0.7" x="36.11666666666666" y="17.133333333333333"/>
<circle cx="36.11666666666666" cy="17.73333333333333" fill="#fff" id="esp12e-22.front.left.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin4.trace" width="0.7" x="36.11666666666666" y="19.133333333333333"/>
<circle cx="36.11666666666666" cy="19.73333333333333" fill="#fff" id="esp12e-22.front.left.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin5.trace" width="0.7" x="36.11666666666666" y="21.133333333333333"/>
<circle cx="36.11666666666666" cy="21.733333333333334" fill="#fff" id="esp12e-22.front.left.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin6.trace" width="0.7" x="36.11666666666666" y="23.133333333333333"/>
<circle cx="36.11666666666666" cy="23.733333333333334" fill="#fff" id="esp12e-22.front.left.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin7.trace" width="0.7" x="36.11666666666666" y="25.133333333333333"/>
<circle cx="36.11666666666666" cy="25.733333333333334" fill="#fff" id="esp12e-22.front.left.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin8.trace" width="0.7" x="36.11666666666666" y="27.133333333333333"/>
<circle cx="36.11666666666666" cy="27.733333333333334" fill="#fff" id="esp12e-22.front.left.pin8.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin1.trace" width="0.7" x="51.41666666666666" y="13.133333333333331"/>
<circle cx="52.11666666666666" cy="13.73333333333333" fill="#fff" id="esp12e-22.front.right.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin2.trace" width="0.7" x="51.41666666666666" y="15.133333333333331"/>
<circle cx="52.11666666666666" cy="15.73333333333333" fill="#fff" id="esp12e-22.front.right.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin3.trace" width="0.7" x="51.41666666666666" y="17.133333333333333"/>
<circle cx="52.11666666666666" cy="17.73333333333333" fill="#fff" id="esp12e-22.front.right.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin4.trace" width="0.7" x="51.41666666666666" y="19.133333333333333"/>
<circle cx="52.11666666666666" cy="19.73333333333333" fill="#fff" id="esp12e-22.front.right.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin5.trace" width="0.7" x="51.41666666666666" y="21.133333333333333"/>
<circle cx="52.11666666666666" cy="21.733333333333334" fill="#fff" id="esp12e-22.front.right.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin6.trace" width="0.7" x="51.41666666666666" y="23.133333333333333"/>
<circle cx="52.11666666666666" cy="23.733333333333334" fill="#fff" id="esp12e-22.front.right.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin7.trace" width="0.7" x="51.41666666666666" y="25.133333333333333"/>
<circle cx="52.11666666666666" cy="25.733333333333334" fill="#fff" id="esp12e-22.front.right.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin8.trace" width="0.7" x="51.41666666666666" y="27.133333333333333"/>
<circle cx="52.11666666666666" cy="27.733333333333334" fill="#fff" id="esp12e-22.front.right.pin8.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin1.trace" width="1.2" x="38.56666666666666" y="28.68333333333333"/>
<circle cx="39.16666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin2.trace" width="1.2" x="40.56666666666666" y="28.68333333333333"/>
<circle cx="41.16666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin3.trace" width="1.2" x="42.56666666666666" y="28.68333333333333"/>
<circle cx="43.16666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin4.trace" width="1.2" x="44.56666666666666" y="28.68333333333333"/>
<circle cx="45.16666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin5.trace" width="1.2" x="46.56666666666666" y="28.68333333333333"/>
<circle cx="47.16666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin6.trace" width="1.2" x="48.56666666666666" y="28.68333333333333"/>
<circle cx="49.16666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin6.cast" r="0.35"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="39.06666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="38.86666666666666" y="31.383333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label1.anchor" width="0.0" x="39.36666666666666" y="31.483333333333334"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="41.06666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="38.86666666666666" y="33.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label2.anchor" width="0.0" x="39.36666666666666" y="33.483333333333334"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="43.06666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="38.86666666666666" y="35.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label3.anchor" width="0.0" x="39.36666666666666" y="35.483333333333334"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="45.06666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="45.16666666666666" y="35.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label4.anchor" width="0.0" x="48.86666666666666" y="35.483333333333334"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="47.06666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="47.16666666666666" y="33.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label5.anchor" width="0.0" x="48.86666666666666" y="33.483333333333334"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="49.06666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="49.16666666666666" y="31.383333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label6.anchor" width="0.0" x="48.86666666666666" y="31.483333333333334"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="15.8" rx="0.5" ry="0.5" width="13.6" x="37.31666666666666" y="12.333333333333332"/>
<rect fill="#fff" height="0.15" width="15.0" x="36.61666666666666" y="11.583333333333332"/>
<text fill="#fff" font-family="Consolas" font-size="1.0" x="43.11666666666666" y="10.883333333333331">CB3S</text>
<rect fill="#58839b" height="5.2" width="0.5" x="37.21666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="4.6" x="37.21666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="5.2" width="0.5" x="39.41666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="3.0" width="0.5" x="41.31666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="3.0" x="41.31666666666666" y="8.68333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="43.81666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="2.7" x="43.81666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="3.0" width="0.5" x="46.01666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="3.0" x="46.01666666666666" y="8.68333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="48.51666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="2.5" x="48.51666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="4.4" width="0.5" x="50.51666666666666" y="6.183333333333331"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="13.633333333333331"/>
<g transform="translate(29.231026020611555,12.93333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="13.73333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="15.633333333333331"/>
<g transform="translate(29.231026020611555,14.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="15.73333333333333">P23</text>
<g transform="translate(25.631026020611557,14.93333333333333)">
<rect fill="#8ad039" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.11666666666666" y="15.73333333333333">ADC3</text>
<g transform="translate(22.631026020611557,14.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.81666666666666" y="15.73333333333333">D0</text>
<g transform="translate(19.631026020611557,14.93333333333333)">
<rect fill="#16a352" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.81666666666666" y="15.73333333333333">A0</text>
<g transform="translate(16.031026020611556,14.93333333333333)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="17.51666666666666" y="15.73333333333333">TDO</text>
<g transform="translate(12.431026020611556,14.93333333333333)">
<rect fill="#f68a1e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="13.916666666666657" y="15.73333333333333">FSO</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="17.63333333333333"/>
<g transform="translate(29.231026020611555,16.93333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="17.73333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="19.63333333333333"/>
<g transform="translate(29.231026020611555,18.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="19.73333333333333">P14</text>
<g transform="translate(26.23102602061156,18.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.41666666666666" y="19.73333333333333">D1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="21.633333333333333"/>
<g transform="translate(29.231026020611555,20.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="21.733333333333334">P26</text>
<g transform="translate(26.23102602061156,20.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.41666666666666" y="21.733333333333334">D2</text>
<g transform="translate(22.631026020611557,20.933333333333334)">
<rect fill="#aeafc1" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.11666666666666" y="21.733333333333334">IRDA</text>
<g transform="translate(19.03102602061156,20.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.516666666666662" y="21.733333333333334">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="23.633333333333333"/>
<g transform="translate(29.231026020611555,22.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="23.733333333333334">P24</text>
<g transform="translate(26.23102602061156,22.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.41666666666666" y="23.733333333333334">D3</text>
<g transform="translate(22.631026020611557,22.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.11666666666666" y="23.733333333333334">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="25.633333333333333"/>
<g transform="translate(29.231026020611555,24.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="25.733333333333334">P6</text>
<g transform="translate(26.23102602061156,24.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.41666666666666" y="25.733333333333334">D4</text>
<g transform="translate(22.631026020611557,24.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.11666666666666" y="25.733333333333334">PWM0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="33.01666666666666" y="27.633333333333333"/>
<g transform="translate(29.231026020611555,26.933333333333334)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.716666666666658" y="27.733333333333334">3V3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="27.633333333333333"/>
<g transform="translate(56.03102602061156,26.933333333333334)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="27.733333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="25.633333333333333"/>
<g transform="translate(56.03102602061156,24.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="25.733333333333334">P9</text>
<g transform="translate(59.631026020611564,24.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.81666666666666" y="25.733333333333334">D5</text>
<g transform="translate(62.631026020611564,24.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.11666666666666" y="25.733333333333334">PWM3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="23.633333333333333"/>
<g transform="translate(56.03102602061156,22.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="23.733333333333334">P0</text>
<g transform="translate(59.631026020611564,22.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.81666666666666" y="23.733333333333334">D6</text>
<g transform="translate(62.631026020611564,22.933333333333334)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.11666666666666" y="23.733333333333334">TX2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="21.633333333333333"/>
<g transform="translate(56.03102602061156,20.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="21.733333333333334">P21</text>
<g transform="translate(59.631026020611564,20.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.81666666666666" y="21.733333333333334">D7</text>
<g transform="translate(62.631026020611564,20.933333333333334)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.11666666666666" y="21.733333333333334">SDA1</text>
<g transform="translate(66.23102602061155,20.933333333333334)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="67.71666666666665" y="21.733333333333334">TMS</text>
<g transform="translate(69.83102602061156,20.933333333333334)">
<rect fill="#f68a1e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="middle" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="71.31666666666666" y="20.720833333333335">___</text>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="71.31666666666666" y="21.839583333333334">FCS</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="19.63333333333333"/>
<g transform="translate(56.03102602061156,18.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="19.73333333333333">P8</text>
<g transform="translate(59.631026020611564,18.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.81666666666666" y="19.73333333333333">D8</text>
<g transform="translate(62.631026020611564,18.93333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.11666666666666" y="19.73333333333333">PWM2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="17.63333333333333"/>
<g transform="translate(56.03102602061156,16.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="17.73333333333333">P7</text>
<g transform="translate(59.631026020611564,16.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.81666666666666" y="17.73333333333333">D9</text>
<g transform="translate(62.631026020611564,16.93333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.11666666666666" y="17.73333333333333">PWM1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="15.633333333333331"/>
<g transform="translate(56.03102602061156,14.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="15.73333333333333">P10</text>
<g transform="translate(59.631026020611564,14.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.81666666666666" y="15.73333333333333">D10</text>
<g transform="translate(62.631026020611564,14.93333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.11666666666666" y="15.73333333333333">RX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="52.61666666666666" y="13.633333333333331"/>
<g transform="translate(56.03102602061156,12.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.516666666666666" y="13.73333333333333">P11</text>
<g transform="translate(59.631026020611564,12.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.81666666666666" y="13.73333333333333">D11</text>
<g transform="translate(62.631026020611564,12.93333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.11666666666666" y="13.73333333333333">TX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="36.26666666666666" y="31.383333333333333"/>
<g transform="translate(32.48102602061156,30.683333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="33.96666666666666" y="31.483333333333334">P23</text>
<g transform="translate(28.881026020611554,30.683333333333334)">
<rect fill="#8ad039" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.366666666666656" y="31.483333333333334">ADC3</text>
<g transform="translate(25.881026020611557,30.683333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.06666666666666" y="31.483333333333334">D0</text>
<g transform="translate(22.881026020611557,30.683333333333334)">
<rect fill="#16a352" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="24.06666666666666" y="31.483333333333334">A0</text>
<g transform="translate(19.281026020611556,30.683333333333334)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.76666666666666" y="31.483333333333334">TDO</text>
<g transform="translate(15.681026020611556,30.683333333333334)">
<rect fill="#f68a1e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="17.166666666666657" y="31.483333333333334">FSO</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="36.26666666666666" y="33.38333333333333"/>
<g transform="translate(32.48102602061156,32.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="33.96666666666666" y="33.483333333333334">P22</text>
<g transform="translate(29.481026020611555,32.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.666666666666657" y="33.483333333333334">D12</text>
<g transform="translate(25.881026020611557,32.68333333333334)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.36666666666666" y="33.483333333333334">TDI</text>
<g transform="translate(22.281026020611556,32.68333333333334)">
<rect fill="#f68a1e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.76666666666666" y="33.483333333333334">FSI</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="36.26666666666666" y="35.38333333333333"/>
<g transform="translate(32.48102602061156,34.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="33.96666666666666" y="35.483333333333334">P21</text>
<g transform="translate(29.481026020611555,34.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.666666666666657" y="35.483333333333334">D7</text>
<g transform="translate(25.881026020611557,34.68333333333334)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.36666666666666" y="35.483333333333334">SDA1</text>
<g transform="translate(22.281026020611556,34.68333333333334)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.76666666666666" y="35.483333333333334">TMS</text>
<g transform="translate(18.681026020611558,34.68333333333334)">
<rect fill="#f68a1e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="middle" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.16666666666666" y="34.47083333333334">___</text>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.16666666666666" y="35.58958333333334">FCS</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="49.36666666666666" y="35.38333333333333"/>
<g transform="translate(52.78102602061156,34.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="54.266666666666666" y="35.483333333333334">P20</text>
<g transform="translate(56.381026020611564,34.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="57.56666666666666" y="35.483333333333334">D13</text>
<g transform="translate(59.381026020611564,34.68333333333334)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="60.86666666666667" y="35.483333333333334">SCL1</text>
<g transform="translate(62.981026020611566,34.68333333333334)">
<rect fill="#ffe680" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.46666666666667" y="35.483333333333334">TCK</text>
<g transform="translate(66.58102602061156,34.68333333333334)">
<rect fill="#f68a1e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="68.06666666666666" y="35.483333333333334">FSCK</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="49.36666666666666" y="33.38333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="49.36666666666666" y="31.383333333333333"/>
</svg>

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,69 +0,0 @@
/* This file was auto-generated from cb3s.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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
![Pinout](pinout_cb3se.svg)
## 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.

View File

@@ -1,345 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,85.33333333333333,41.666666666666664" width="1024">
<defs/>
<rect fill="white" height="41.666666666666664" stroke="black" stroke-width="0.1" width="85.33333333333333" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#47a8cd"/>
<stop offset="100%" stop-color="#008fb5"/>
</linearGradient>
<rect fill="url(#id1) none" height="23.9" stroke="#b5a739" stroke-width="0.1" width="15.9" x="34.66666666666666" y="5.433333333333331"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin1.trace" width="0.7" x="34.61666666666666" y="13.133333333333331"/>
<circle cx="34.61666666666666" cy="13.73333333333333" fill="#fff" id="esp12e-22.front.left.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin2.trace" width="0.7" x="34.61666666666666" y="15.133333333333331"/>
<circle cx="34.61666666666666" cy="15.73333333333333" fill="#fff" id="esp12e-22.front.left.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin3.trace" width="0.7" x="34.61666666666666" y="17.133333333333333"/>
<circle cx="34.61666666666666" cy="17.73333333333333" fill="#fff" id="esp12e-22.front.left.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin4.trace" width="0.7" x="34.61666666666666" y="19.133333333333333"/>
<circle cx="34.61666666666666" cy="19.73333333333333" fill="#fff" id="esp12e-22.front.left.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin5.trace" width="0.7" x="34.61666666666666" y="21.133333333333333"/>
<circle cx="34.61666666666666" cy="21.733333333333334" fill="#fff" id="esp12e-22.front.left.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin6.trace" width="0.7" x="34.61666666666666" y="23.133333333333333"/>
<circle cx="34.61666666666666" cy="23.733333333333334" fill="#fff" id="esp12e-22.front.left.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin7.trace" width="0.7" x="34.61666666666666" y="25.133333333333333"/>
<circle cx="34.61666666666666" cy="25.733333333333334" fill="#fff" id="esp12e-22.front.left.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.left.pin8.trace" width="0.7" x="34.61666666666666" y="27.133333333333333"/>
<circle cx="34.61666666666666" cy="27.733333333333334" fill="#fff" id="esp12e-22.front.left.pin8.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin1.trace" width="0.7" x="49.91666666666666" y="13.133333333333331"/>
<circle cx="50.61666666666666" cy="13.73333333333333" fill="#fff" id="esp12e-22.front.right.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin2.trace" width="0.7" x="49.91666666666666" y="15.133333333333331"/>
<circle cx="50.61666666666666" cy="15.73333333333333" fill="#fff" id="esp12e-22.front.right.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin3.trace" width="0.7" x="49.91666666666666" y="17.133333333333333"/>
<circle cx="50.61666666666666" cy="17.73333333333333" fill="#fff" id="esp12e-22.front.right.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin4.trace" width="0.7" x="49.91666666666666" y="19.133333333333333"/>
<circle cx="50.61666666666666" cy="19.73333333333333" fill="#fff" id="esp12e-22.front.right.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin5.trace" width="0.7" x="49.91666666666666" y="21.133333333333333"/>
<circle cx="50.61666666666666" cy="21.733333333333334" fill="#fff" id="esp12e-22.front.right.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin6.trace" width="0.7" x="49.91666666666666" y="23.133333333333333"/>
<circle cx="50.61666666666666" cy="23.733333333333334" fill="#fff" id="esp12e-22.front.right.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin7.trace" width="0.7" x="49.91666666666666" y="25.133333333333333"/>
<circle cx="50.61666666666666" cy="25.733333333333334" fill="#fff" id="esp12e-22.front.right.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="esp12e-22.front.right.pin8.trace" width="0.7" x="49.91666666666666" y="27.133333333333333"/>
<circle cx="50.61666666666666" cy="27.733333333333334" fill="#fff" id="esp12e-22.front.right.pin8.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin1.trace" width="1.2" x="37.06666666666666" y="28.68333333333333"/>
<circle cx="37.66666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin2.trace" width="1.2" x="39.06666666666666" y="28.68333333333333"/>
<circle cx="39.66666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin3.trace" width="1.2" x="41.06666666666666" y="28.68333333333333"/>
<circle cx="41.66666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin4.trace" width="1.2" x="43.06666666666666" y="28.68333333333333"/>
<circle cx="43.66666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin5.trace" width="1.2" x="45.06666666666666" y="28.68333333333333"/>
<circle cx="45.66666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz6_2mm_0.7mm.pin6.trace" width="1.2" x="47.06666666666666" y="28.68333333333333"/>
<circle cx="47.66666666666666" cy="29.383333333333333" fill="#fff" id="pins_horz6_2mm_0.7mm.pin6.cast" r="0.35"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="37.56666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="37.36666666666666" y="31.383333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label1.anchor" width="0.0" x="37.86666666666666" y="31.483333333333334"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="39.56666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="37.36666666666666" y="33.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label2.anchor" width="0.0" x="37.86666666666666" y="33.483333333333334"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="41.56666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="37.36666666666666" y="35.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label3.anchor" width="0.0" x="37.86666666666666" y="35.483333333333334"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="43.56666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="43.66666666666666" y="35.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label4.anchor" width="0.0" x="47.36666666666666" y="35.483333333333334"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="45.56666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="45.66666666666666" y="33.38333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label5.anchor" width="0.0" x="47.36666666666666" y="33.483333333333334"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="47.56666666666666" y="29.58333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="47.66666666666666" y="31.383333333333333"/>
<rect height="0.0" id="esp12e-22.front.down.label6.anchor" width="0.0" x="47.36666666666666" y="31.483333333333334"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="15.8" rx="0.5" ry="0.5" width="13.6" x="35.81666666666666" y="12.333333333333332"/>
<rect fill="#fff" height="0.15" width="15.0" x="35.11666666666666" y="11.583333333333332"/>
<text fill="#fff" font-family="Consolas" font-size="1.0" x="41.61666666666666" y="10.883333333333331">CB3SE</text>
<rect fill="#58839b" height="5.2" width="0.5" x="35.71666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="4.6" x="35.71666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="5.2" width="0.5" x="37.91666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="3.0" width="0.5" x="39.81666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="3.0" x="39.81666666666666" y="8.68333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="42.31666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="2.7" x="42.31666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="3.0" width="0.5" x="44.51666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="3.0" x="44.51666666666666" y="8.68333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="47.01666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="0.5" width="2.5" x="47.01666666666666" y="6.183333333333331"/>
<rect fill="#58839b" height="4.4" width="0.5" x="49.01666666666666" y="6.183333333333331"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="13.633333333333331"/>
<g transform="translate(27.731026020611555,12.93333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="13.73333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="15.633333333333331"/>
<g transform="translate(27.731026020611555,14.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="15.73333333333333">P23</text>
<g transform="translate(24.131026020611557,14.93333333333333)">
<rect fill="#8ad039" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.61666666666666" y="15.73333333333333">ADC3</text>
<g transform="translate(21.131026020611557,14.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.31666666666666" y="15.73333333333333">D0</text>
<g transform="translate(18.131026020611557,14.93333333333333)">
<rect fill="#16a352" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="19.31666666666666" y="15.73333333333333">A0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="17.63333333333333"/>
<g transform="translate(27.731026020611555,16.93333333333333)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="17.73333333333333">CEN</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="19.63333333333333"/>
<g transform="translate(27.731026020611555,18.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="19.73333333333333">P14</text>
<g transform="translate(24.73102602061156,18.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="19.73333333333333">D1</text>
<g transform="translate(21.131026020611557,18.93333333333333)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="19.73333333333333">SCK</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="21.633333333333333"/>
<g transform="translate(27.731026020611555,20.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="21.733333333333334">P26</text>
<g transform="translate(24.73102602061156,20.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="21.733333333333334">D2</text>
<g transform="translate(21.131026020611557,20.933333333333334)">
<rect fill="#aeafc1" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="21.733333333333334">IRDA</text>
<g transform="translate(17.53102602061156,20.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="19.016666666666662" y="21.733333333333334">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="23.633333333333333"/>
<g transform="translate(27.731026020611555,22.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="23.733333333333334">P24</text>
<g transform="translate(24.73102602061156,22.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="23.733333333333334">D3</text>
<g transform="translate(21.131026020611557,22.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="23.733333333333334">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="25.633333333333333"/>
<g transform="translate(27.731026020611555,24.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="25.733333333333334">P6</text>
<g transform="translate(24.73102602061156,24.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.91666666666666" y="25.733333333333334">D4</text>
<g transform="translate(21.131026020611557,24.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="22.61666666666666" y="25.733333333333334">PWM0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="31.51666666666666" y="27.633333333333333"/>
<g transform="translate(27.731026020611555,26.933333333333334)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.216666666666658" y="27.733333333333334">3V3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="27.633333333333333"/>
<g transform="translate(54.53102602061156,26.933333333333334)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="27.733333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="25.633333333333333"/>
<g transform="translate(54.53102602061156,24.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="25.733333333333334">P9</text>
<g transform="translate(58.131026020611564,24.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="25.733333333333334">D5</text>
<g transform="translate(61.131026020611564,24.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="25.733333333333334">PWM3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="23.633333333333333"/>
<g transform="translate(54.53102602061156,22.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="23.733333333333334">P0</text>
<g transform="translate(58.131026020611564,22.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="23.733333333333334">D6</text>
<g transform="translate(61.131026020611564,22.933333333333334)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="23.733333333333334">TX2</text>
<g transform="translate(64.73102602061155,22.933333333333334)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="23.733333333333334">SCL2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="21.633333333333333"/>
<g transform="translate(54.53102602061156,20.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="21.733333333333334">P1</text>
<g transform="translate(58.131026020611564,20.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="21.733333333333334">D7</text>
<g transform="translate(61.131026020611564,20.933333333333334)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="21.733333333333334">RX2</text>
<g transform="translate(64.73102602061155,20.933333333333334)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="66.21666666666665" y="21.733333333333334">SDA2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="19.63333333333333"/>
<g transform="translate(54.53102602061156,18.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="19.73333333333333">P8</text>
<g transform="translate(58.131026020611564,18.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="19.73333333333333">D8</text>
<g transform="translate(61.131026020611564,18.93333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="19.73333333333333">PWM2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="17.63333333333333"/>
<g transform="translate(54.53102602061156,16.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="17.73333333333333">P7</text>
<g transform="translate(58.131026020611564,16.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="17.73333333333333">D9</text>
<g transform="translate(61.131026020611564,16.93333333333333)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="17.73333333333333">PWM1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="15.633333333333331"/>
<g transform="translate(54.53102602061156,14.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="15.73333333333333">P10</text>
<g transform="translate(58.131026020611564,14.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="15.73333333333333">D10</text>
<g transform="translate(61.131026020611564,14.93333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="15.73333333333333">RX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="51.11666666666666" y="13.633333333333331"/>
<g transform="translate(54.53102602061156,12.93333333333333)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.016666666666666" y="13.73333333333333">P11</text>
<g transform="translate(58.131026020611564,12.93333333333333)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.31666666666666" y="13.73333333333333">D11</text>
<g transform="translate(61.131026020611564,12.93333333333333)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="62.61666666666667" y="13.73333333333333">TX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="34.76666666666666" y="31.383333333333333"/>
<g transform="translate(30.981026020611555,30.683333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="32.46666666666666" y="31.483333333333334">P15</text>
<g transform="translate(27.98102602061156,30.683333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.16666666666666" y="31.483333333333334">D12</text>
<g transform="translate(24.381026020611557,30.683333333333334)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="25.86666666666666" y="31.483333333333334">CS</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="34.76666666666666" y="33.38333333333333"/>
<g transform="translate(30.981026020611555,32.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="32.46666666666666" y="33.483333333333334">P22</text>
<g transform="translate(27.98102602061156,32.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="29.16666666666666" y="33.483333333333334">D13</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="34.76666666666666" y="35.38333333333333"/>
<g transform="translate(30.981026020611555,34.68333333333334)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="32.46666666666666" y="35.483333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="47.86666666666666" y="35.38333333333333"/>
<g transform="translate(51.28102602061156,34.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="52.766666666666666" y="35.483333333333334">P20</text>
<g transform="translate(54.881026020611564,34.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.06666666666666" y="35.483333333333334">D14</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="47.86666666666666" y="33.38333333333333"/>
<g transform="translate(51.28102602061156,32.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="52.766666666666666" y="33.483333333333334">P17</text>
<g transform="translate(54.881026020611564,32.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.06666666666666" y="33.483333333333334">D15</text>
<g transform="translate(57.881026020611564,32.68333333333334)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.36666666666667" y="33.483333333333334">MISO</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="47.86666666666666" y="31.383333333333333"/>
<g transform="translate(51.28102602061156,30.683333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="52.766666666666666" y="31.483333333333334">P16</text>
<g transform="translate(54.881026020611564,30.683333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="56.06666666666666" y="31.483333333333334">D16</text>
<g transform="translate(57.881026020611564,30.683333333333334)">
<rect fill="#e9ba33" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="59.36666666666667" y="31.483333333333334">MOSI</text>
</svg>

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,75 +0,0 @@
/* This file was auto-generated from cb3se.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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": {

View File

@@ -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.

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,80 +0,0 @@
/* This file was auto-generated from generic-bk7231n-qfn32-tuya.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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": {

View File

@@ -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.

View File

@@ -1 +0,0 @@
#include "variant.h"

View File

@@ -1,80 +0,0 @@
/* This file was auto-generated from generic-bk7231t-qfn32-tuya.json using boardgen */
#pragma once
#include <WVariant.h>
// 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

View File

@@ -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": {

View File

@@ -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.

Some files were not shown because too many files have changed in this diff Show More