[docs] Add auto-generated module support page

This commit is contained in:
Kuba Szczodrzyński
2022-06-18 21:07:55 +02:00
parent a6ad84a3b8
commit bc056eaca2
16 changed files with 1184 additions and 174 deletions

View File

@@ -34,63 +34,7 @@ LibreTuya also provides a common interface for all family implementations. The i
## Board List
A (mostly) complete* list of Tuya wireless module boards.
  | Module Name | MCU | Flash | RAM | Pins** | Wi-Fi | BLE | Family name
------------------------------|------------------------------------------------------------------------------------------------|-------------------------|-------|----------|-------------|-------|-----|---------------
❌ | [WB1S](https://developer.tuya.com/en/docs/iot/wb1s?id=K9duevbj3ol4x) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 18 (11 I/O) | ✔️ | ✔️ | -
❌ | [WB2L](https://developer.tuya.com/en/docs/iot/wb2l-datasheet?id=K9duegc9bualu) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ✔️ | -
❌ | [WB2S](https://developer.tuya.com/en/docs/iot/wb2s-module-datasheet?id=K9ghecl7kc479) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ✔️ | -
❌ | [WB3L](https://developer.tuya.com/en/docs/iot/wb3l-module-datasheet?id=K9duiggw2v8sp) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ✔️ | -
❌ | [WB3S](https://developer.tuya.com/en/docs/iot/wb3s-module-datasheet?id=K9dx20n6hz5n4) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 16 (11 I/O) | ✔️ | ✔️ | -
❌ | [WB3S-IPEX](https://developer.tuya.com/en/docs/iot/wb3sipex-module-datasheet?id=K9irq0laun21z) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 16 (11 I/O) | ✔️ | ✔️ | -
❌ | [WB8P](https://developer.tuya.com/en/docs/iot/wb8p-module-datasheet?id=K9fwx4f89tvzd) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 10 (8 I/O) | ✔️ | ✔️ | -
❌ | [WBLC5](https://developer.tuya.com/en/docs/iot/wblc5-module-datasheet?id=K9duilns1f3gi) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 6 (3 I/O) | ✔️ | ✔️ | -
❌ | [WBLC9](https://developer.tuya.com/en/docs/iot/wblc9-module-datasheet?id=K9hgglry2jp5h) | BK7231T @ 120 MHz | 2 MiB | 256 KiB | 8 (6 I/O) | ✔️ | ✔️ | -
❌ | [CB1S](https://developer.tuya.com/en/docs/iot/cb1s-module-datasheet?id=Kaij1abmwyjq2) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 18 (11 I/O) | ✔️ | ✔️ | -
❌ | [CB2L](https://developer.tuya.com/en/docs/iot/cb2l-module-datasheet?id=Kai2eku1m3pyl) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ✔️ | -
❌ | [CB2S](https://developer.tuya.com/en/docs/iot/cb2s-module-datasheet?id=Kafgfsa2aaypq) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ✔️ | -
❌ | [CB3L](https://developer.tuya.com/en/docs/iot/cb3l-module-datasheet?id=Kai51ngmrh3qm) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 16 (11 I/O) | ✔️ | ✔️ | -
❌ | [CB3S](https://developer.tuya.com/en/docs/iot/cb3s?id=Kai94mec0s076) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 22 (14 I/O) | ✔️ | ✔️ | -
❌ | [CB3S-NL](https://developer.tuya.com/en/docs/iot/CB3S-NL-module-datasheet?id=Kbaesan0vyoms) | BK7231NL (?) @ 120 MHz | 2 MiB | 256 KiB | 22 (14 I/O) | ✔️ | ✔️ | -
❌ | [CB3SE](https://developer.tuya.com/en/docs/iot/CB3SE-Module-Datasheet?id=Kanoiluul7nl2) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 22 (17 I/O) | ✔️ | ✔️ | -
❌ | [CB8P](https://developer.tuya.com/en/docs/iot/cb8p-module-datasheet?id=Kahvig14r1yk9) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 10 (8 I/O) | ✔️ | ✔️ | -
❌ | [CBLC5](https://developer.tuya.com/en/docs/iot/cblc5-module-datasheet?id=Ka07iqyusq1wm) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 6 (3 I/O) | ✔️ | ✔️ | -
❌ | [CBLC9](https://developer.tuya.com/en/docs/iot/cblc9-module-datasheet?id=Ka42cqnj9r0i5) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 8 (6 I/O) | ✔️ | ✔️ | -
❌ | [CBU](https://developer.tuya.com/en/docs/iot/cbu-module-datasheet?id=Ka07pykl5dk4u) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 21 (18 I/O) | ✔️ | ✔️ | -
❌ | [CBU-IPEX](https://developer.tuya.com/en/docs/iot/cbuipex-module-datasheet?id=Kaedsyurckrhu) | BK7231N @ 120 MHz | 2 MiB | 256 KiB | 21 (18 I/O) | ✔️ | ✔️ | -
❌ | [CBU-NL](https://developer.tuya.com/en/docs/iot/CBU-NL-module-datasheet?id=Kbaeq6j53y0yg) | BK7231N (?) @ 120 MHz | 2 MiB | 256 KiB | 21 (18 I/O) | ✔️ | ✔️ | -
❌ | [WR1](https://developer.tuya.com/en/docs/iot/wifiwr1module?id=K9605tc0k90t3) | RTL8710BN @ 125 MHz | 1 MiB | 256 KiB | 18 (11 I/O) | ✔️ | ❌ | -
❌ | [WR1-IPEX](https://developer.tuya.com/en/docs/iot/wifiwr1ipexmodule?id=K9605t977tx5u) | RTL8710BN @ 125 MHz | 1 MiB | 256 KiB | 18 (11 I/O) | ✔️ | ❌ | -
❌ | [WR1E](https://developer.tuya.com/en/docs/iot/wr1e?id=K96smbbeycxtf) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 18 (11 I/O) | ✔️ | ❌ | -
❌ | [WR2](https://developer.tuya.com/en/docs/iot/wifiwr2module?id=K9605tko0juc3) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ❌ | -
❌ | [WR2E](https://developer.tuya.com/en/docs/iot/wr2e?id=K97scnsjhue4h) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ❌ | -
❌ | [WR2L](https://developer.tuya.com/en/docs/iot/wifiwr2lmodule?id=K9605tnbj7gva) | RTL8710BX @ 62.5 MHz | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ❌ | -
❌ | [WR2LE](https://developer.tuya.com/en/docs/iot/wr2le?id=K9eio9y9e8i8c) | RTL8710BX @ 62.5 MHz | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ❌ | -
[`wr3`](boards/wr3/README.md) | [WR3](https://developer.tuya.com/en/docs/iot/wr3-module-datasheet?id=K9g3ainzbj9z1) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | `realtek-ambz`
❌ | [WR3E](https://developer.tuya.com/en/docs/iot/wr3e-module-datasheet?id=K9elwlqbfosbc) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | -
❌ | [WR3L](https://developer.tuya.com/en/docs/iot/wifiwr3lmodule?id=K9605tt0kveqm) | RTL8710BX @ 125 MHz (?) | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | -
❌ | [WR3LE](https://developer.tuya.com/en/docs/iot/wr3le?id=K986l7a1ha8tm) | RTL8710BX @ 62.5 MHz | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | -
❌ | [WR3N](https://developer.tuya.com/en/docs/iot/wr3n-datasheet?id=K98zdx31ztdge) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 16 (10 I/O) | ✔️ | ❌ | -
❌ | [WR4](https://developer.tuya.com/en/docs/iot/wifiwr4module?id=K9605tvu78p3e) | RTL8710BN @ 125 MHz | 1 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | -
❌ | [WR5E](https://developer.tuya.com/en/docs/iot/wr5e?id=K986r9pxqxa8i) | RTL8710BX @ 62.5 MHz | 2 MiB | 256 KiB | 15 (12 I/O) | ✔️ | ❌ | -
❌ | [WR6-H](https://developer.tuya.com/en/docs/iot/wr6h-module-datasheet?id=K9pork8eeowgl) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 18 (12 I/O) | ✔️ | ❌ | -
❌ | [WR6](https://developer.tuya.com/en/docs/iot/wr6-datasheet?id=K97rp45u6gff9) | RTL8710BN @ 125 MHz | 2 MiB | 256 KiB | 18 (12 I/O) | ✔️ | ❌ | -
❌ | [WRG1](https://developer.tuya.com/en/docs/iot/wr6-datasheet?id=K97rp45u6gff9) | RTL8711AM @ 166 MHz | 4 MiB | 2048 KiB | 25 (20 I/O) | ✔️ | ❌ | -
❌ | [XR1](https://developer.tuya.com/en/docs/iot/xr1?id=K9lq3y9xo0zkx) | XR809 @ 160 MHz | 2 MiB | 384 KiB | 18 (11 I/O) | ✔️ | ❌ | -
❌ | [XR1-IPEX](https://developer.tuya.com/en/docs/iot/xr1ipex-module-datasheet?id=K9razqu9gqele) | XR809 @ 160 MHz | 2 MiB | 384 KiB | 18 (11 I/O) | ✔️ | ❌ | -
❌ | [XR3](https://developer.tuya.com/en/docs/iot/xr3-datasheet?id=K98s9168qi49g) | XR809 @ 160 MHz | 2 MiB | 384 KiB | 22 (17 I/O) | ✔️ | ❌ | -
❌ | [WE1S](https://developer.tuya.com/en/docs/iot/wifie1smodule?id=K9605thnvg3e7) | ESP8266EX @ 80/160 MHz | 2 MiB | 36 KiB | 18 (11 I/O) | ✔️ | ❌ | -
❌ | [WE2L](https://developer.tuya.com/en/docs/iot/wifie2lmodule?id=K9605ud0gkjmh) | ESP8285 @ 80/160 MHz | 1 MiB | 50 KiB | 7 (5 I/O) | ✔️ | ❌ | -
❌ | [WE2S](https://developer.tuya.com/en/docs/iot/wifie2smodule?id=K9605u79tgxug) | ESP8285 @ 80/160 MHz | 1 MiB | 50 KiB | 11 (8 I/O) | ✔️ | ❌ | -
❌ | [WE3L](https://developer.tuya.com/en/docs/iot/wifie3lpinmodule?id=K9605uj1ar87n) | ESP8266 @ 80/160 MHz | 2 MiB | 50 KiB | 16 (12 I/O) | ✔️ | ❌ | -
❌ | [WE3S](https://developer.tuya.com/en/docs/iot/wifie3smodule?id=K9605ua1cx9tv) | ESP8266 @ 80/160 MHz | 2 MiB | 50 KiB | 16 (12 I/O) | ✔️ | ❌ | -
❌ | [WE3SE](https://developer.tuya.com/en/docs/iot/we3se?id=K97qv6ab7oh8d) | ESP32 @ 240 MHz | 4 MiB | 520 KiB | 22 (17 I/O) | ✔️ | ✔️ | -
❌ | [WE5P](https://developer.tuya.com/en/docs/iot/wifie5pmodule?id=K9605um3dtjbx) | ESP8266 @ 80/160 MHz | 1 MiB | 50 KiB | 15 (11 I/O) | ✔️ | ❌ | -
\* Only modules featuring at least Wi-Fi. WBR, JWBR, CR, (TY)JW and (TY)LC Series are not included here
** I/O count includes GPIOs, ADCs, PWM outputs and UART, but doesn't count CEN/RST and power pins.
See [Boards & CPU list](https://kuba2k2.github.io/libretuya/docs/supported/).
## Arduino Core support status

View File

@@ -1,5 +1,5 @@
* [Home](README.md)
* [💻 Family list](docs/families.md)
* [💻 Boards & CPU list](docs/supported.md)
* [✔️ Implementation status](docs/implementation-status.md)
* [🔧 Configuration](docs/config.md)
* [📁 Project structure](docs/project-structure.md)
@@ -47,11 +47,10 @@
* [Realtek - notes](docs/platform/realtek/README.md)
* [Beken 72xx - notes](docs/platform/beken-72xx/README.md)
* Realtek AmebaZ Series
* Boards
* [WR3](boards/wr3/README.md)
* C library
* [Built-in functions](docs/platform/realtek-ambz/stdlib.md)
* [Memory management](docs/platform/realtek-ambz/memory-management.md)
* [Debugging](docs/platform/realtek/debugging.md)
* [Exception decoder](docs/platform/realtek/exception-decoder.md)
* [All supported boards](boards/)
* [🔗 Resources](docs/resources.md)

4
boards/SUMMARY.md Normal file
View File

@@ -0,0 +1,4 @@
<!-- This file is auto-generated -->
- [WB2L Wi-Fi Module](../boards/wb2l/README.md)
- [WR3 Wi-Fi Module](../boards/wr3/README.md)

634
docs/boards_tuya_all.json Normal file
View File

@@ -0,0 +1,634 @@
{
"wb": {
"wb1s": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wb1s",
"datasheet_id": "K9duevbj3ol4x"
},
"wb2l": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 7,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wb2l-datasheet",
"datasheet_id": "K9duegc9bualu"
},
"wb2s": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 11,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wb2s-module-datasheet",
"datasheet_id": "K9ghecl7kc479"
},
"wb3l": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wb3l-module-datasheet",
"datasheet_id": "K9duiggw2v8sp"
},
"wb3s": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 22,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wb3s-module-datasheet",
"datasheet_id": "K9dx20n6hz5n4"
},
"wb8p": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 10,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wb8p-module-datasheet",
"datasheet_id": "K9fwx4f89tvzd"
},
"wblc5": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 15,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wblc5-module-datasheet",
"datasheet_id": "K9duilns1f3gi"
},
"wblc9": {
"mcu": "bk7231t",
"flash": 2097152,
"ram": 262144,
"pins_total": 8,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wblc9-module-datasheet",
"datasheet_id": "K9hgglry2jp5h"
}
},
"wbr": {
"wbr1": {
"mcu": "rtl8720cf",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr1d-module-datasheet",
"datasheet_id": "K9duko5tg2vjw"
},
"wbr1d": {
"mcu": "rtl8720dn",
"flash": 4194304,
"ram": 524288,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr1d-module-datasheet",
"datasheet_id": "K9duko5tg2vjw"
},
"wbr2": {
"mcu": "rtl8720cf",
"flash": 2097152,
"ram": 262144,
"pins_total": 11,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr2l-module-datasheet",
"datasheet_id": "K9rw73glq0mkp"
},
"wbr2d": {
"mcu": "rtl8720dn",
"flash": 4194304,
"ram": 524288,
"pins_total": 11,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr2d-module-datasheet",
"datasheet_id": "K9dujwcg2yr8i"
},
"wbr2l": {
"mcu": "rtl8720cf",
"flash": 2097152,
"ram": 262144,
"pins_total": 7,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr2l-module-datasheet",
"datasheet_id": "K9rw73glq0mkp"
},
"wbr3": {
"mcu": "rtl8720cf",
"flash": 2097152,
"ram": 262144,
"pins_total": 16,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr3n-datasheet",
"datasheet_id": "K9qskxwpcqyaq"
},
"wbr3d": {
"mcu": "rtl8720dn",
"flash": 4194304,
"ram": 524288,
"pins_total": 16,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr3d-module-datasheet",
"datasheet_id": "K9dukbbnmuw4h"
},
"wbr3l": {
"mcu": "rtl8720cf",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr3l-module-datasheet",
"datasheet_id": "K9fte9kq2vq6t"
},
"wbr3n": {
"mcu": "rtl8720cs",
"flash": 4194304,
"ram": 524288,
"pins_total": 16,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr3n-datasheet",
"datasheet_id": "K9qskxwpcqyaq"
},
"wbr3s": {
"mcu": "rtl8720cf",
"flash": 2097152,
"ram": 262144,
"pins_total": 22,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr3s-module-datasheet",
"datasheet_id": "K9qrt2je8wqxo"
},
"wbr3t": {
"mcu": "rtl8720dn",
"flash": 4194304,
"ram": 524288,
"pins_total": 16,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbr3t-module-datasheet",
"datasheet_id": "K9qs708w94ox8"
},
"wbrg1": {
"mcu": "rtl8720csm",
"flash": 8388608,
"ram": 4194304,
"pins_total": 25,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbrg1-module-datasheet",
"datasheet_id": "Ka015vo8tfztz"
},
"wbru": {
"mcu": "rtl8720cf",
"flash": 2097152,
"ram": 262144,
"pins_total": 21,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "wbru-module-datasheet",
"datasheet_id": "Kai1h5xb3dp98"
}
},
"cb": {
"cb1s": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cb1s-module-datasheet",
"datasheet_id": "Kaij1abmwyjq2"
},
"cb2l": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 7,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cb2l-module-datasheet",
"datasheet_id": "Kai2eku1m3pyl"
},
"cb2s": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 11,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cb2s-module-datasheet",
"datasheet_id": "Kafgfsa2aaypq"
},
"cb3l": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cb3l-module-datasheet",
"datasheet_id": "Kai51ngmrh3qm"
},
"cb3s": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 22,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cb3s",
"datasheet_id": "Kai94mec0s076"
},
"cb3s-nl": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 22,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "CB3S-NL-module-datasheet",
"datasheet_id": "Kbaesan0vyoms"
},
"cb3se": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 22,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "CB3SE-Module-Datasheet",
"datasheet_id": "Kanoiluul7nl2"
},
"cb8p": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 10,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cb8p-module-datasheet",
"datasheet_id": "Kahvig14r1yk9"
},
"cblc5": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 15,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cblc5-module-datasheet",
"datasheet_id": "Ka07iqyusq1wm"
},
"cblc9": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 8,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cblc9-module-datasheet",
"datasheet_id": "Ka42cqnj9r0i5"
},
"cbu": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 21,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cbu-module-datasheet",
"datasheet_id": "Ka07pykl5dk4u"
},
"cbu-nl": {
"mcu": "bk7231n",
"flash": 2097152,
"ram": 262144,
"pins_total": 21,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "CBU-NL-module-datasheet",
"datasheet_id": "Kbaeq6j53y0yg"
}
},
"cr": {
"cr2s": {
"mcu": "rtl8720cm",
"flash": 4194304,
"ram": 4194304,
"pins_total": 11,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cr2s-module-datasheet",
"datasheet_id": "Kaawygkszksio"
},
"cr3l": {
"mcu": "rtl8720cm",
"flash": 4194304,
"ram": 4194304,
"pins_total": 18,
"connectivity": [
"wifi",
"ble"
],
"datasheet_name": "cr3l-module-datasheet",
"datasheet_id": "Ka3gl6ria8f1t"
}
},
"wr": {
"wr1": {
"mcu": "rtl8710bn",
"flash": 1048576,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi"
],
"datasheet_name": "wifiwr1module",
"datasheet_id": "K9605tc0k90t3"
},
"wr1e": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi"
],
"datasheet_name": "wr1e",
"datasheet_id": "K96smbbeycxtf"
},
"wr2": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 11,
"connectivity": [
"wifi"
],
"datasheet_name": "wifiwr2lmodule",
"datasheet_id": "K9605tnbj7gva"
},
"wr2e": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 11,
"connectivity": [
"wifi"
],
"datasheet_name": "wr2e",
"datasheet_id": "K97scnsjhue4h"
},
"wr2l": {
"mcu": "rtl8710bx",
"flash": 2097152,
"ram": 262144,
"pins_total": 7,
"connectivity": [
"wifi"
],
"datasheet_name": "wifiwr2lmodule",
"datasheet_id": "K9605tnbj7gva"
},
"wr2le": {
"mcu": "rtl8710bx",
"flash": 2097152,
"ram": 262144,
"pins_total": 7,
"connectivity": [
"wifi"
],
"datasheet_name": "wr2le",
"datasheet_id": "K9eio9y9e8i8c"
},
"wr3": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 16,
"connectivity": [
"wifi"
],
"datasheet_name": "wr3le",
"datasheet_id": "K986l7a1ha8tm"
},
"wr3e": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 16,
"connectivity": [
"wifi"
],
"datasheet_name": "wr3e-module-datasheet",
"datasheet_id": "K9elwlqbfosbc"
},
"wr3l": {
"mcu": "rtl8710bx",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi"
],
"datasheet_name": "wr3le",
"datasheet_id": "K986l7a1ha8tm"
},
"wr3le": {
"mcu": "rtl8710bx",
"flash": 2097152,
"ram": 262144,
"pins_total": 18,
"connectivity": [
"wifi"
],
"datasheet_name": "wr3le",
"datasheet_id": "K986l7a1ha8tm"
},
"wr3n": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 16,
"connectivity": [
"wifi"
],
"datasheet_name": "wr3n-datasheet",
"datasheet_id": "K98zdx31ztdge"
},
"wr4": {
"mcu": "rtl8710bn",
"flash": 1048576,
"ram": 262144,
"pins_total": 16,
"connectivity": [
"wifi"
],
"datasheet_name": "wifiwr4module",
"datasheet_id": "K9605tvu78p3e"
},
"wr5e": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 15,
"connectivity": [
"wifi"
],
"datasheet_name": "wr5e",
"datasheet_id": "K986r9pxqxa8i"
},
"wr6": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 14,
"connectivity": [
"wifi"
],
"datasheet_name": "wr6h-module-datasheet",
"datasheet_id": "K9pork8eeowgl"
},
"wr6-h": {
"mcu": "rtl8710bn",
"flash": 2097152,
"ram": 262144,
"pins_total": 14,
"connectivity": [
"wifi"
],
"datasheet_name": "wr6h-module-datasheet",
"datasheet_id": "K9pork8eeowgl"
},
"wrg1": {
"mcu": "rtl8711am",
"flash": 4194304,
"ram": 2097152,
"pins_total": 25,
"connectivity": [
"wifi"
],
"datasheet_name": "wrg1-datasheet",
"datasheet_id": "K97rig6mscj8e"
}
},
"xr": {
"xr1": {
"mcu": "xr809",
"flash": 2097152,
"ram": 393216,
"pins_total": 18,
"connectivity": [
"wifi",
"rfid"
],
"datasheet_name": "xr1ipex-module-datasheet",
"datasheet_id": "K9razqu9gqele"
},
"xr3": {
"mcu": "xr809",
"flash": 2097152,
"ram": 393216,
"pins_total": 16,
"connectivity": [
"wifi",
"rfid"
],
"datasheet_name": "xr3-module",
"datasheet_id": "Kae2nqhs3ap1z"
}
}
}

View File

@@ -1,18 +0,0 @@
# Families
A list of families currently available in this project.
**Note:** the term *family* was chosen over *platform*, in order to reduce possible confusion between LibreTuya supported "platforms" and PlatformIO's "platform", as an entire package. *Family* is also more compatible with the UF2 term.
The following list corresponds to UF2 OTA format family names, and is also [available as JSON](../families.json). The IDs are also present in [ChipType.h](../arduino/libretuya/core/ChipType.h).
Title | Name (parent) | Code | Short name & ID | Supported MCU(s) | Arduino Core | Source SDK
-------------------------------------------------------------------|------------------------------|----------------------|-------------------------|---------------------------|--------------|----------------------------------------------------------------------------------
Realtek Ameba1 | `-` | `-` | `RTL8710A` (0x9FFFD543) | - | ❌ | -
[Realtek AmebaZ](https://www.amebaiot.com/en/amebaz/) | `realtek-ambz` | `ambz` | `RTL8710B` (0x22E0D6FC) | RTL8710BN | ✔️ | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk))
Realtek AmebaZ2 | `-` | `-` | `RTL8720C` (0xE08F7564) | - | ❌ | -
Realtek AmebaD | `-` | `-` | `RTL8720D` (0x3379CFE2) | - | ❌ | -
[Beken 7231T](http://www.bekencorp.com/en/goods/detail/cid/7.html) | `beken-7231t` (`beken-72xx`) | `bk7231t` (`bk72xx`) | `BK7231T` (0x675A40B0) | BK7231T, BK7231S, BK7231U | ❌ | `framework-beken-bdk` ([bdk_freertos](https://github.com/bekencorp/bdk_freertos))
Beken 7231N | `-` | `-` | `BK7231N` (0x7B3EF230) | - | ❌ | -
Boufallo 602 | `-` | `-` | `BL602` (0xDE1270B7) | - | ❌ | -
Xradiotech 809 | `-` | `-` | `XR809` (0x51E903A8) | - | ❌ | -

View File

@@ -1,94 +0,0 @@
# Copyright (c) Kuba Szczodrzyński 2022-05-31.
import sys
from os.path import dirname, join
sys.path.append(join(dirname(__file__), ".."))
from tools.util.platform import get_families
HEADER = """\
# Families
A list of families currently available in this project.
**Note:** the term *family* was chosen over *platform*, in order to reduce possible confusion between LibreTuya supported "platforms" and PlatformIO's "platform", as an entire package. *Family* is also more compatible with the UF2 term.
The following list corresponds to UF2 OTA format family names, and is also [available as JSON](../families.json). The IDs are also present in [ChipType.h](../arduino/libretuya/core/ChipType.h).
"""
def format_row(row: list, lengths: list) -> str:
row = [col + " " * (lengths[i] - len(col)) for i, col in enumerate(row)]
return " | ".join(row).rstrip()
if __name__ == "__main__":
out = join(dirname(__file__), "families.md")
md = [HEADER]
lengths = [0, 0, 0, 0, 0, 0, 0]
header = [
"Title",
"Name (parent)",
"Code",
"Short name & ID",
"Supported MCU(s)",
"Arduino Core",
"Source SDK",
]
rows = []
for family in get_families():
row = [
# Title
"[{}]({})".format(
family.description,
family.url,
family.name,
)
if family.name
else family.description,
# Name (parent)
f"`{family.name or '-'}`"
if not family.parent
else f"`{family.name}` (`{family.parent}`)",
# Code
f"`{family.code or '-'}`"
if not family.parent
else f"`{family.code}` (`{family.parent_code}`)",
# Short name & ID
"`{}` (0x{:X})".format(
family.short_name,
family.id,
),
# f"`{family.short_name}` (0x{family.id:X})",
# Supported MCU(s)
", ".join(family.mcus) or "-",
# Arduino Core
"✔️" if family.has_arduino_core else "",
# Source SDK
"`{}` ([{}]({}))".format(
family.framework,
family.sdk_name,
family.sdk,
)
if family.name
else "-",
]
rows.append(row)
for row in [header] + rows:
for i, col in enumerate(row):
lengths[i] = max(lengths[i], len(col))
md.append(format_row(header, lengths))
md.append("-|-".join(length * "-" for length in lengths))
for row in rows:
md.append(format_row(row, lengths))
md.append("")
with open(out, "w", encoding="utf-8") as f:
f.write("\n".join(md))

44
docs/supported.md Normal file
View File

@@ -0,0 +1,44 @@
# Supported boards, modules and CPUs
## CPU list
Chips currently supported by the project:
{%
include-markdown "supported_chips.md"
%}
This list is not exhaustive, i.e. a similar chip (but different package) might work just fine, but there's no board definition for it yet.
If you have an unsupported chip, feel free to reach out using Issues or on the Discord server.
## Board list
{%
include-markdown "supported_boards.md"
%}
\* I/O count includes GPIOs, ADCs, PWM outputs and UART, but doesn't count CEN/RST and power pins.
## Families
A list of chip families currently supported by this project.
!!! note
The term *family* was chosen over *platform*, in order to reduce possible confusion between LibreTuya supported "platforms" and PlatformIO's "platform", as an entire package. *Family* is also more compatible with the UF2 term.
The following list corresponds to UF2 OTA format family names, and is also [available as JSON](../families.json). The IDs are also present in [ChipType.h](../ltapi/_chip_type_8h_source.md).
{%
include-markdown "supported_families.md"
%}
## Unsupported boards
### Tuya Inc.
!!! note
Only modules featuring at least Wi-Fi are included in the table. (TY)JW, (TY)WE and (TY)LC Series are omitted, as they contain Espressif chips.
{%
include-markdown "unsupported_boards_tuya_all.md"
%}

7
docs/supported_boards.md Normal file
View File

@@ -0,0 +1,7 @@
<!-- This file is auto-generated -->
Name | MCU | Flash | RAM | Pins* | Wi-Fi | BLE | ZigBee | Family name
---------------------------------|-----------|-------|---------|-------------|-------|-----|--------|---------------
**Tuya Inc.** | | | | | | | |
[WB2L](../boards/wb2l/README.md) | BK7231T | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t`
[WR3](../boards/wr3/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz`

6
docs/supported_chips.md Normal file
View File

@@ -0,0 +1,6 @@
<!-- This file is auto-generated -->
- BK7231S
- BK7231T
- BK7231U
- RTL8710BN

View File

@@ -0,0 +1,12 @@
<!-- This file is auto-generated -->
Title | Name (parent) | Code | Short name & ID | Arduino Core | Source SDK
-------------------------------------------------------------------|------------------------------|----------------------|-------------------------|--------------|----------------------------------------------------------------------------------
Realtek Ameba1 | `-` | `-` | `RTL8710A` (0x9FFFD543) | ❌ | -
[Realtek AmebaZ](https://www.amebaiot.com/en/amebaz/) | `realtek-ambz` | `ambz` | `RTL8710B` (0x22E0D6FC) | ✔️ | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk))
Realtek AmebaZ2 | `-` | `-` | `RTL8720C` (0xE08F7564) | ❌ | -
Realtek AmebaD | `-` | `-` | `RTL8720D` (0x3379CFE2) | ❌ | -
[Beken 7231T](http://www.bekencorp.com/en/goods/detail/cid/7.html) | `beken-7231t` (`beken-72xx`) | `bk7231t` (`bk72xx`) | `BK7231T` (0x675A40B0) | ❌ | `framework-beken-bdk` ([bdk_freertos](https://github.com/bekencorp/bdk_freertos))
Beken 7231N | `-` | `-` | `BK7231N` (0x7B3EF230) | ❌ | -
Boufallo 602 | `-` | `-` | `BL602` (0xDE1270B7) | ❌ | -
Xradiotech 809 | `-` | `-` | `XR809` (0x51E903A8) | ❌ | -

View File

@@ -0,0 +1,61 @@
<!-- This file is auto-generated -->
Name | MCU | Flash | RAM | Pins | Wi-Fi | BLE | ZigBee
---------------|------------|-------|---------|------|-------|-----|-------
**CB Series** | | | | | | |
CB1S | BK7231N | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
CB2L | BK7231N | 2 MiB | 256 KiB | 7 | ✔️ | ✔️ | ❌
CB2S | BK7231N | 2 MiB | 256 KiB | 11 | ✔️ | ✔️ | ❌
CB3L | BK7231N | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
CB3S | BK7231N | 2 MiB | 256 KiB | 22 | ✔️ | ✔️ | ❌
CB3S-NL | BK7231N | 2 MiB | 256 KiB | 22 | ✔️ | ✔️ | ❌
CB3SE | BK7231N | 2 MiB | 256 KiB | 22 | ✔️ | ✔️ | ❌
CB8P | BK7231N | 2 MiB | 256 KiB | 10 | ✔️ | ✔️ | ❌
CBLC5 | BK7231N | 2 MiB | 256 KiB | 15 | ✔️ | ✔️ | ❌
CBLC9 | BK7231N | 2 MiB | 256 KiB | 8 | ✔️ | ✔️ | ❌
CBU | BK7231N | 2 MiB | 256 KiB | 21 | ✔️ | ✔️ | ❌
CBU-NL | BK7231N | 2 MiB | 256 KiB | 21 | ✔️ | ✔️ | ❌
**CR Series** | | | | | | |
CR2S | RTL8720CM | 4 MiB | 4 MiB | 11 | ✔️ | ✔️ | ❌
CR3L | RTL8720CM | 4 MiB | 4 MiB | 18 | ✔️ | ✔️ | ❌
**WB Series** | | | | | | |
WB1S | BK7231T | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
WB2S | BK7231T | 2 MiB | 256 KiB | 11 | ✔️ | ✔️ | ❌
WB3L | BK7231T | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
WB3S | BK7231T | 2 MiB | 256 KiB | 22 | ✔️ | ✔️ | ❌
WB8P | BK7231T | 2 MiB | 256 KiB | 10 | ✔️ | ✔️ | ❌
WBLC5 | BK7231T | 2 MiB | 256 KiB | 15 | ✔️ | ✔️ | ❌
WBLC9 | BK7231T | 2 MiB | 256 KiB | 8 | ✔️ | ✔️ | ❌
**WBR Series** | | | | | | |
WBR1 | RTL8720CF | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
WBR2 | RTL8720CF | 2 MiB | 256 KiB | 11 | ✔️ | ✔️ | ❌
WBR2L | RTL8720CF | 2 MiB | 256 KiB | 7 | ✔️ | ✔️ | ❌
WBR3 | RTL8720CF | 2 MiB | 256 KiB | 16 | ✔️ | ✔️ | ❌
WBR3L | RTL8720CF | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
WBR3S | RTL8720CF | 2 MiB | 256 KiB | 22 | ✔️ | ✔️ | ❌
WBRU | RTL8720CF | 2 MiB | 256 KiB | 21 | ✔️ | ✔️ | ❌
WBR3N | RTL8720CS | 4 MiB | 512 KiB | 16 | ✔️ | ✔️ | ❌
WBRG1 | RTL8720CSM | 8 MiB | 4 MiB | 25 | ✔️ | ✔️ | ❌
WBR1D | RTL8720DN | 4 MiB | 512 KiB | 18 | ✔️ | ✔️ | ❌
WBR2D | RTL8720DN | 4 MiB | 512 KiB | 11 | ✔️ | ✔️ | ❌
WBR3D | RTL8720DN | 4 MiB | 512 KiB | 16 | ✔️ | ✔️ | ❌
WBR3T | RTL8720DN | 4 MiB | 512 KiB | 16 | ✔️ | ✔️ | ❌
**WR Series** | | | | | | |
WR1 | RTL8710BN | 1 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌
WR1E | RTL8710BN | 2 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌
WR2 | RTL8710BN | 2 MiB | 256 KiB | 11 | ✔️ | ❌ | ❌
WR2E | RTL8710BN | 2 MiB | 256 KiB | 11 | ✔️ | ❌ | ❌
WR3E | RTL8710BN | 2 MiB | 256 KiB | 16 | ✔️ | ❌ | ❌
WR3N | RTL8710BN | 2 MiB | 256 KiB | 16 | ✔️ | ❌ | ❌
WR4 | RTL8710BN | 1 MiB | 256 KiB | 16 | ✔️ | ❌ | ❌
WR5E | RTL8710BN | 2 MiB | 256 KiB | 15 | ✔️ | ❌ | ❌
WR6 | RTL8710BN | 2 MiB | 256 KiB | 14 | ✔️ | ❌ | ❌
WR6-H | RTL8710BN | 2 MiB | 256 KiB | 14 | ✔️ | ❌ | ❌
WR2L | RTL8710BX | 2 MiB | 256 KiB | 7 | ✔️ | ❌ | ❌
WR2LE | RTL8710BX | 2 MiB | 256 KiB | 7 | ✔️ | ❌ | ❌
WR3L | RTL8710BX | 2 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌
WR3LE | RTL8710BX | 2 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌
WRG1 | RTL8711AM | 4 MiB | 2 MiB | 25 | ✔️ | ❌ | ❌
**XR Series** | | | | | | |
XR1 | XR809 | 2 MiB | 384 KiB | 18 | ✔️ | ❌ | ❌
XR3 | XR809 | 2 MiB | 384 KiB | 16 | ✔️ | ❌ | ❌

307
docs/update_docs.py Normal file
View File

@@ -0,0 +1,307 @@
# Copyright (c) Kuba Szczodrzyński 2022-05-31.
import re
import sys
from os.path import dirname, join
from typing import Dict, List, Set, Tuple
sys.path.append(join(dirname(__file__), ".."))
from tools.util.fileio import readjson, readtext
from tools.util.markdown import Markdown
from tools.util.obj import get, sizeof
from tools.util.platform import (
get_board_list,
get_board_manifest,
get_families,
get_family,
)
def load_boards() -> Dict[str, dict]:
return {board: get_board_manifest(board) for board in get_board_list()}
def load_chip_type_h() -> str:
code = readtext(
join(
dirname(__file__),
"..",
"arduino",
"libretuya",
"core",
"ChipType.h",
)
)
code = re.sub(r"//.+", "", code)
code = re.sub(r"/\*.+\*/", "", code)
return code
def check_mcus(boards: List[Tuple[str, dict]]) -> bool:
for board_name, board in boards:
# check if all boards' MCUs are defined in families.json
family_name: str = get(board, "build.family")
mcu_name: str = get(board, "build.mcu")
family = get_family(short_name=family_name)
if not family:
print(f"Family '{family_name}' of board '{board_name}' does not exist")
return False
mcus = [mcu.lower() for mcu in family.mcus]
if mcu_name not in mcus:
print(
f"MCU '{mcu_name}' of board '{board_name}' is not defined for family '{family_name}'"
)
return False
return True
def get_family_mcus() -> Set[str]:
out = []
for family in get_families():
out += family.mcus
return set(out)
def get_family_names() -> Set[str]:
return set(family.short_name for family in get_families())
def get_board_mcus(boards: List[Tuple[str, dict]]) -> Set[str]:
out = set()
for _, board in boards:
mcu_name: str = get(board, "build.mcu")
out.add(mcu_name.upper())
return out
def get_enum_keys(code: str, name: str) -> Set[str]:
code = code.partition(f"enum {name}")[2]
code = code.partition(";")[0]
code = code.strip().strip("{}").strip()
code = [line.strip().strip(",").strip() for line in code.split("\n")]
code = filter(None, code)
return set(line.partition(" ")[0].strip() for line in code)
def get_enum_mcus(code: str) -> Set[str]:
return get_enum_keys(code, "ChipType")
def get_enum_families(code: str) -> Set[str]:
return set(family[2:] for family in get_enum_keys(code, "ChipFamily"))
def board_sort(tpl):
return (
get(tpl[1], "vendor"),
get(tpl[1], "build.mcu"),
get(tpl[1], "mcu"),
tpl[0],
)
def write_chips(mcus: List[str]):
md = Markdown(dirname(__file__), "supported_chips")
md.add_list(*mcus)
md.write()
def write_boards(boards: List[Tuple[str, dict]]):
md = Markdown(dirname(__file__), "supported_boards")
header = [
"Name",
"MCU",
"Flash",
"RAM",
"Pins*",
"Wi-Fi",
"BLE",
"ZigBee",
"Family name",
]
rows = []
vendor_prev = ""
for board_name, board in boards:
family = get_family(short_name=get(board, "build.family"))
# add board vendor as a row
vendor = get(board, "vendor")
if vendor_prev != vendor:
rows.append([f"**{vendor}**"])
vendor_prev = vendor
# count total pin count & IO count
pins = "-"
pinout: Dict[str, dict] = get(board, "pcb.pinout")
if pinout:
pinout = [pin for name, pin in pinout.items() if name.isnumeric()]
pins_total = len(pinout)
pins_io = sum(1 for pin in pinout if "ARD" in pin)
pins = f"{pins_total} ({pins_io} I/O)"
# format row values
board_url = f"[{board_name.upper()}](../boards/{board_name}/README.md)"
row = [
board_url,
get(board, "build.mcu").upper(),
sizeof(get(board, "upload.flash_size")),
sizeof(get(board, "upload.maximum_ram_size")),
pins,
"✔️" if "wifi" in get(board, "connectivity") else "",
"✔️" if "ble" in get(board, "connectivity") else "",
"✔️" if "zigbee" in get(board, "connectivity") else "",
f"`{family.name}`",
]
rows.append(row)
md.add_table(header, *rows)
md.write()
def write_unsupported_boards(
series: Dict[str, Dict[str, dict]],
name: str,
supported: List[str],
):
md = Markdown(dirname(__file__), name)
header = [
"Name",
"MCU",
"Flash",
"RAM",
"Pins",
"Wi-Fi",
"BLE",
"ZigBee",
]
rows = []
for series_name in sorted(series):
series_rows = []
series_rows.append([f"**{series_name.upper()} Series**"])
boards = series[series_name]
for board_name, board in sorted(boards.items(), key=board_sort):
if board_name in supported:
continue
row = [
board_name.upper(),
board["mcu"].upper(),
sizeof(board["flash"]),
sizeof(board["ram"]),
str(board["pins_total"]),
"✔️" if "wifi" in board["connectivity"] else "",
"✔️" if "ble" in board["connectivity"] else "",
"✔️" if "zigbee" in board["connectivity"] else "",
]
series_rows.append(row)
if series_rows:
rows += series_rows
md.add_table(header, *rows)
md.write()
def write_families():
md = Markdown(dirname(__file__), "supported_families")
header = [
"Title",
"Name (parent)",
"Code",
"Short name & ID",
"Arduino Core",
"Source SDK",
]
rows = []
for family in get_families():
row = [
# Title
"[{}]({})".format(
family.description,
family.url,
family.name,
)
if family.name
else family.description,
# Name (parent)
f"`{family.name or '-'}`"
if not family.parent
else f"`{family.name}` (`{family.parent}`)",
# Code
f"`{family.code or '-'}`"
if not family.parent
else f"`{family.code}` (`{family.parent_code}`)",
# Short name & ID
"`{}` (0x{:X})".format(
family.short_name,
family.id,
),
# Arduino Core
"✔️" if family.has_arduino_core else "",
# Source SDK
"`{}` ([{}]({}))".format(
family.framework,
family.sdk_name,
family.sdk,
)
if family.name
else "-",
]
rows.append(row)
md.add_table(header, *rows)
md.write()
def write_boards_list(boards: List[Tuple[str, dict]]):
md = Markdown(dirname(__file__), join("..", "boards", "SUMMARY"))
items = []
for board_name, board in boards:
title = get(board, "name")
items.append(f"[{title}](../boards/{board_name}/README.md)")
md.add_list(*items)
md.write()
if __name__ == "__main__":
boards = load_boards()
boards = sorted(boards.items(), key=board_sort)
code = load_chip_type_h()
errors = False
families_json = get_family_names()
families_enum = get_enum_families(code)
if families_json != families_enum:
print(f"Inconsistent JSON families vs ChipType.h families:")
print("- Missing in JSON: " + ", ".join(families_enum - families_json))
print("- Missing in enum: " + ", ".join(families_json - families_enum))
errors = True
mcus_json = get_family_mcus()
mcus_enum = get_enum_mcus(code)
mcus_boards = get_board_mcus(boards)
if mcus_json != mcus_enum:
print(f"Inconsistent JSON family MCUs vs ChipType.h MCUs:")
print("- Missing in JSON: " + ", ".join(mcus_enum - mcus_json))
print("- Missing in enum: " + ", ".join(mcus_json - mcus_enum))
# this is not considered an error (for now)
# errors = True
if not check_mcus(boards):
errors = True
if errors:
exit(1)
write_chips(sorted(mcus_boards.union(mcus_json)))
write_boards(boards)
write_boards_list(boards)
write_families()
boards_all = [
"boards_tuya_all",
]
for name in boards_all:
file = join(dirname(__file__), f"{name}.json")
data = readjson(file)
write_unsupported_boards(
series=data,
name=f"unsupported_{name}",
supported=[tpl[0] for tpl in boards],
)

View File

@@ -3,7 +3,7 @@
import json
from io import BytesIO
from os.path import dirname, getmtime, isfile, join
from typing import Union
from typing import List, Union
def chname(path: str, name: str) -> str:
@@ -57,3 +57,22 @@ def writejson(file: str, data: Union[dict, list]):
"""Write a dict or list to a JSON file."""
with open(file, "w", encoding="utf-8") as f:
json.dump(data, f)
def readtext(file: str) -> str:
"""Read a text file into a string."""
with open(file, "r", encoding="utf-8") as f:
data = f.read()
return data
def writetext(file: str, data: Union[str, bytes, List[str]]):
"""Write data into a text file."""
with open(file, "w", encoding="utf-8") as f:
if isinstance(data, bytes):
f.write(data.decode())
elif isinstance(data, list):
f.write("\n".join(data))
f.write("\n")
else:
f.write(data)

70
tools/util/markdown.py Normal file
View File

@@ -0,0 +1,70 @@
# Copyright (c) Kuba Szczodrzyński 2022-06-18.
from os.path import join
from tools.util.fileio import writetext
class Markdown:
items: list[str]
output: str
def __init__(self, dir: str, name: str) -> None:
self.items = ["<!-- This file is auto-generated -->", ""]
self.output = join(dir, f"{name}.md")
def write(self):
writetext(self.output, self.items)
def pad(self, s: str, i: int) -> str:
return s + " " * (i - len(s))
def add_heading(self, text: str, level: int = 1) -> "Markdown":
self.items.append(level * "#" + " " + text)
return self
def get_link(self, text: str, href: str) -> str:
return f"[{text}]({href})"
def get_img(self, alt: str, src: str) -> str:
return f"![{alt}]({src})"
def add_link(self, text: str, href: str) -> "Markdown":
self.items.append(self.get_link(text, href))
return self
def add_img(self, alt: str, src: str) -> "Markdown":
self.items.append(self.get_img(alt, src))
return self
def add_text(self, *text: str) -> "Markdown":
self.items.append(" ".join(text))
return self
def add_styled(self, style: str, *text: str) -> "Markdown":
self.items.append(style + " ".join(text) + style)
return self
def add_list(self, *items: str) -> "Markdown":
self.items.append("- " + "\n- ".join(items))
return self
def add_table(self, header: list[str], *rows: list[str]) -> "Markdown":
maxlen = [len(h) for h in header]
for row in rows:
for i, col in enumerate(row):
maxlen[i] = max(maxlen[i], len(col))
lines = []
header = [self.pad(h, maxlen[i]) for i, h in enumerate(header)]
line = " | ".join(header)
lines.append(line.rstrip())
underline = ["-" * i for i in maxlen]
line = "-|-".join(underline)
lines.append(line.rstrip())
for row in rows:
row += [""] * (len(header) - len(row))
row = [self.pad(h, maxlen[i]) for i, h in enumerate(row)]
line = " | ".join(row)
lines.append(line.rstrip())
self.items.append("\n".join(lines))
return self

View File

@@ -50,3 +50,12 @@ def slice2int(val: SliceLike) -> Tuple[int, int]:
elif val.isnumeric():
return (int(val), int(val))
raise ValueError(f"invalid slice format: {val}")
# https://stackoverflow.com/a/1094933/9438331
def sizeof(num: int, suffix="iB", base=1024.0) -> str:
for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]:
if abs(num) < base:
return f"{num:.1f} {unit}{suffix}".replace(".0 ", " ")
num /= base
return f"{num:.1f} Y{suffix}".replace(".0 ", " ")

View File

@@ -1,6 +1,7 @@
# Copyright (c) Kuba Szczodrzyński 2022-06-02.
from os.path import dirname, isfile, join
from glob import glob
from os.path import basename, dirname, isfile, join
from typing import Dict, List, Union
from tools.util.models import Family
@@ -10,6 +11,11 @@ boards_base: Dict[str, dict] = {}
families: List[Family] = []
def get_board_list() -> List[str]:
boards_glob = join(dirname(__file__), "..", "..", "boards", "*.json")
return [basename(file)[:-5] for file in glob(boards_glob)]
def get_board_manifest(board: Union[str, dict]) -> dict:
boards_dir = join(dirname(__file__), "..", "..", "boards")
if not isinstance(board, dict):