Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b748d99437 | ||
|
|
9a33fc0a69 | ||
|
|
4cddc01f22 | ||
|
|
1d80b5fff7 | ||
|
|
140cf07173 | ||
|
|
1e3a82f439 | ||
|
|
c90794e9f5 | ||
|
|
03c723c73d | ||
|
|
bad2ffdd07 | ||
|
|
eed39c9cfb | ||
|
|
7bd6d1d815 | ||
|
|
bb7fcd5c4d | ||
|
|
9b8e00c7fa | ||
|
|
b97825d552 | ||
|
|
085b5aed16 | ||
|
|
7f43624824 | ||
|
|
1ed0000819 | ||
|
|
3b79636d00 | ||
|
|
5a4b932a37 | ||
|
|
dd2ae149ad | ||
|
|
0f5d0a8889 | ||
|
|
3750ae6953 | ||
|
|
5be993f9eb | ||
|
|
57c43ce515 |
2
.github/workflows/push-master.yml
vendored
2
.github/workflows/push-master.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install docs dependencies
|
||||
run: pip install -U ltchiptool boardgen
|
||||
run: pip install -U ltchiptool "boardgen>=0.11.0"
|
||||
|
||||
- name: Generate docs and static JSON files
|
||||
run: |
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
<div align="center" markdown>
|
||||
|
||||
[](https://docs.libretiny.eu/)
|
||||

|
||||
[](https://docs.libretiny.eu/)
|
||||

|
||||
|
||||
[](.clang-format)
|
||||
[](https://github.com/psf/black)
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
PlatformIO development platform for IoT modules manufactured by Tuya Inc.
|
||||
PlatformIO development platform for BK7231 and RTL8710 IoT chips.
|
||||
|
||||
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,
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* [](SUMMARY.md)
|
||||
* 🍪 Chip family docs & info
|
||||
* [Beken BK72xx](docs/platform/beken-72xx/README.md)
|
||||
* [Finding encryption keys](docs/platform/beken-72xx/keys.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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 10,
|
||||
"scale": 14,
|
||||
"test_pads": {
|
||||
"TSCK": "cb1s.back.sck.anchor",
|
||||
"TCSN": "cb1s.back.csn.anchor",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 11,
|
||||
"test_pads": {
|
||||
"TRST": "cb2l.back.rst.anchor",
|
||||
"TRX1": "cb2l.back.u1_rxd.anchor",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 11,
|
||||
"test_pads": {
|
||||
"TTX2": "cb2s.back.u2_txd.anchor",
|
||||
"TRX2": "cb2s.back.u2_rxd.anchor",
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"rf-type1"
|
||||
],
|
||||
"scale": 10.5,
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI",
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD",
|
||||
"drawing_hidden": "SPI",
|
||||
"pinout": {
|
||||
"1": {
|
||||
"PWR": 3.3
|
||||
|
||||
70
boards/_base/pcb/t112.json
Normal file
70
boards/_base/pcb/t112.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"pcb": {
|
||||
"templates": [
|
||||
"esp01m-14",
|
||||
"pcb-blue-light",
|
||||
"rf-type1"
|
||||
],
|
||||
"scale": 10.5,
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD",
|
||||
"drawing_hidden": "I2C,SPI",
|
||||
"pinout": {
|
||||
"1": {
|
||||
"PWR": 3.3
|
||||
},
|
||||
"2": {
|
||||
"IC": 2,
|
||||
"ARD": "D0"
|
||||
},
|
||||
"3": {
|
||||
"IC": 30,
|
||||
"ARD": [
|
||||
"D1",
|
||||
"A0"
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"IC": 14,
|
||||
"ARD": "D2"
|
||||
},
|
||||
"5": {
|
||||
"IC": 13,
|
||||
"ARD": "D3"
|
||||
},
|
||||
"6": {
|
||||
"IC": 16,
|
||||
"ARD": "D4"
|
||||
},
|
||||
"7": {
|
||||
"NC": null
|
||||
},
|
||||
"8": {
|
||||
"IC": 28,
|
||||
"ARD": "D5"
|
||||
},
|
||||
"9": {
|
||||
"IC": 29,
|
||||
"ARD": "D6"
|
||||
},
|
||||
"10": {
|
||||
"IC": 17,
|
||||
"ARD": "D7"
|
||||
},
|
||||
"11": {
|
||||
"IC": 32,
|
||||
"ARD": "D8"
|
||||
},
|
||||
"12": {
|
||||
"IC": 31,
|
||||
"ARD": "D9"
|
||||
},
|
||||
"13": {
|
||||
"IC": 1,
|
||||
"ARD": "D10"
|
||||
},
|
||||
"14": {
|
||||
"GND": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 10.5,
|
||||
"scale": 11,
|
||||
"templates": [
|
||||
"tuya2",
|
||||
"pcb-blue-light",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 11,
|
||||
"test_pads": {
|
||||
"TRST": "wb2l.back.rst.anchor",
|
||||
"TRX1": "wb2l.back.u1_rxd.anchor",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 10.5,
|
||||
"templates": [
|
||||
"tuya2",
|
||||
"pcb-blue-light",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"vars": {
|
||||
"PINHOLE": 0
|
||||
},
|
||||
"pinout_hidden": "I2S,SD,SPI",
|
||||
"pinout_hidden": "I2S,SD",
|
||||
"pinout": {
|
||||
"1": {
|
||||
"NC": null
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 10.5,
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI",
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD",
|
||||
"drawing_hidden": "SPI",
|
||||
"pinout": {
|
||||
"1": {
|
||||
"PWR": 3.3
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"pcb": {
|
||||
"scale": 10.5,
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI,SDA0",
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SDA0",
|
||||
"drawing_hidden": "SPI",
|
||||
"pinout": {
|
||||
"1": {
|
||||
"PWR": 3.3
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"templates": [
|
||||
"pcb-black"
|
||||
],
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI",
|
||||
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD",
|
||||
"pinout": {
|
||||
"1": {
|
||||
"NC": null
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"extra": [
|
||||
"## Information",
|
||||
"This is a generic board definition for RTL8710BX with 4 MiB of flash. It has a bigger application partition size (980 KiB). The used bootloader is also different from the standard Tuya one.",
|
||||
"It can be found in [Ezviz T31 smart plug](https://www.ezviz.com/product/T31/2021) - bare chip soldered onto the manufacturer-made PCB. The plug is not Tuya/SmartLife-compatible and has a 25Q32CSIG flash chip. Refer to [libretiny#23](https://github.com/kuba2k2/libretiny/issues/23) for photos and more information.",
|
||||
"It can be found in [Ezviz T31 smart plug](https://www.ezviz.com/product/T31/2021) - bare chip soldered onto the manufacturer-made PCB. The plug is not Tuya/SmartLife-compatible and has a 25Q32CSIG flash chip. Refer to [libretiny#23](https://github.com/libretiny-eu/libretiny/issues/23) for photos and more information.",
|
||||
"Note that stock firmware seems to use smaller app images (0x80000 / 512 KiB). After 0x180000 some product-test data and device logs can be found. Because the OTA2 offset is 0x100000, the board definition was configured to use all available space."
|
||||
]
|
||||
},
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
"url": "https://docs.libretiny.eu/boards/t102-v1.1/",
|
||||
"vendor": "Unknown",
|
||||
"doc": {
|
||||
"fccid": "2AU7O-T102V11"
|
||||
"fccid": "2AU7O-T102V11",
|
||||
"mcu": "w302"
|
||||
},
|
||||
"pcb": {
|
||||
"symbol": "T102_V1.1"
|
||||
|
||||
22
boards/t112-v1.1.json
Normal file
22
boards/t112-v1.1.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"_base": [
|
||||
"realtek-ambz",
|
||||
"realtek-ambz-2mb-788k",
|
||||
"ic/rtl8710bn",
|
||||
"pcb/t112"
|
||||
],
|
||||
"build": {
|
||||
"mcu": "rtl8710bn",
|
||||
"variant": "t112-v1.1"
|
||||
},
|
||||
"name": "T112_V1.1",
|
||||
"url": "https://docs.libretiny.eu/boards/t112-v1.1/",
|
||||
"vendor": "Unknown",
|
||||
"doc": {
|
||||
"fccid": "2AU7O-T102V11",
|
||||
"mcu": "w302"
|
||||
},
|
||||
"pcb": {
|
||||
"symbol": "T112_V1.1"
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"pos": "7.0,5.0",
|
||||
"pos": "6.0,5.5",
|
||||
"text": "${SYMBOL}",
|
||||
"font_size": 1.0,
|
||||
"fill": {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"pos": "4.0,5.5",
|
||||
"pos": "6.0,5.5",
|
||||
"text": "${SYMBOL}",
|
||||
"font_size": 1.0,
|
||||
"fill": {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"pos": "4.0,5.5",
|
||||
"pos": "6.5,5.0",
|
||||
"text": "${SYMBOL}",
|
||||
"font_size": 1.0,
|
||||
"fill": {
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u, 22u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -62,7 +80,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -73,9 +90,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 22u // PA_22
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#define PIN_SPI0_MOSI_1 19u // PIN_A19
|
||||
#define PIN_SPI0_SCK_0 16u // PIN_A16
|
||||
#define PIN_SPI0_SCK_1 3u // PIN_A3
|
||||
#define PINS_SPI0_CS (pin_size_t[]){2u, 15u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){20u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){4u, 19u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){16u, 3u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -30,6 +34,8 @@
|
||||
#define PIN_WIRE0_SDA_0 20u // PIN_A20
|
||||
#define PIN_WIRE0_SDA_1 16u // PIN_A16
|
||||
#define PIN_WIRE0_SDA_2 3u // PIN_A3
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){2u, 15u, 19u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){20u, 16u, 3u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
@@ -44,14 +50,21 @@
|
||||
#define PIN_SERIAL2_RTS 20u // PIN_A20
|
||||
#define PIN_SERIAL2_RX 15u // PIN_A15
|
||||
#define PIN_SERIAL2_TX 16u // PIN_A16
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){13u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){14u}
|
||||
#define PINS_SERIAL1_CTS (pin_size_t[]){4u}
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){2u, 0u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){3u, 1u}
|
||||
#define PINS_SERIAL2_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL2_RTS (pin_size_t[]){20u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){15u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){16u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
#define PIN_CS0 15u // PIN_A15
|
||||
#define PIN_CTS1 4u // PIN_A4
|
||||
#define PIN_CTS2 19u // PIN_A19
|
||||
#define PIN_MISO0 20u // PIN_A20
|
||||
#define PIN_MOSI0 19u // PIN_A19
|
||||
#define PIN_PA00 0u // PIN_A0
|
||||
#define PIN_PA01 1u // PIN_A1
|
||||
#define PIN_PA02 2u // PIN_A2
|
||||
@@ -65,23 +78,15 @@
|
||||
#define PIN_PA18 18u // PIN_A18
|
||||
#define PIN_PA19 19u // PIN_A19
|
||||
#define PIN_PA20 20u // PIN_A20
|
||||
#define PIN_PWM0 0u // PIN_A0
|
||||
#define PIN_PWM1 1u // PIN_A1
|
||||
#define PIN_PWM2 14u // PIN_A14
|
||||
#define PIN_PWM3 3u // PIN_A3
|
||||
#define PIN_PWM4 16u // PIN_A16
|
||||
#define PIN_PWM5 17u // PIN_A17
|
||||
#define PIN_PWM6 18u // PIN_A18
|
||||
#define PIN_PWM7 13u // PIN_A13
|
||||
#define PIN_RTS2 20u // PIN_A20
|
||||
#define PIN_RX0 13u // PIN_A13
|
||||
#define PIN_RX1 0u // PIN_A0
|
||||
#define PIN_RX2 15u // PIN_A15
|
||||
#define PIN_SCK0 3u // PIN_A3
|
||||
#define PIN_SCL0 19u // PIN_A19
|
||||
#define PIN_SDA0 3u // PIN_A3
|
||||
#define PIN_TX0 14u // PIN_A14
|
||||
#define PIN_TX1 1u // PIN_A1
|
||||
#define PIN_TX2 16u // PIN_A16
|
||||
|
||||
// Port availability
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,9 +14,12 @@
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,15 +14,21 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,9 +14,12 @@
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -17,12 +17,17 @@
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA_0 21u // GPIO21
|
||||
#define PIN_WIRE1_SDA_1 21u // GPIO21
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u, 21u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,15 +14,21 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,15 +14,21 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,19 +14,29 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_CTS 12u // GPIO12
|
||||
#define PIN_SERIAL1_RTS 13u // GPIO13
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_CTS 12u // GPIO12
|
||||
#define PIN_SERIAL1_RTS 13u // GPIO13
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_CTS (pin_size_t[]){12u}
|
||||
#define PINS_SERIAL1_RTS (pin_size_t[]){13u}
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){22u, 29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -75,7 +93,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -86,9 +103,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 29u // PA_29
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){22u, 29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -75,7 +93,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -86,9 +103,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 29u // PA_29
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){22u, 29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -74,7 +92,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -85,9 +102,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 29u // PA_29
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#define PIN_SPI0_SCK_0 3u // PIN_A3
|
||||
#define PIN_SPI0_SCK_1 8u // PIN_A8
|
||||
#define PIN_SPI0_SCK_2 16u // PIN_A16
|
||||
#define PINS_SPI0_CS (pin_size_t[]){2u, 7u, 15u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){10u, 20u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){4u, 9u, 19u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){3u, 8u, 16u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -36,6 +40,8 @@
|
||||
#define PIN_WIRE0_SDA_1 12u // PIN_A12
|
||||
#define PIN_WIRE0_SDA_2 16u // PIN_A16
|
||||
#define PIN_WIRE0_SDA_3 20u // PIN_A20
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){2u, 11u, 15u, 19u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){3u, 12u, 16u, 20u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
@@ -54,6 +60,17 @@
|
||||
#define PIN_SERIAL2_RTS 20u // PIN_A20
|
||||
#define PIN_SERIAL2_RX 15u // PIN_A15
|
||||
#define PIN_SERIAL2_TX 16u // PIN_A16
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){9u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){12u, 13u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){11u, 14u}
|
||||
#define PINS_SERIAL1_CTS (pin_size_t[]){4u}
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){0u, 2u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){1u, 3u}
|
||||
#define PINS_SERIAL2_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL2_RTS (pin_size_t[]){20u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){15u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){16u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -61,7 +78,6 @@
|
||||
#define PIN_CTS0 10u // PIN_A10
|
||||
#define PIN_CTS1 4u // PIN_A4
|
||||
#define PIN_CTS2 19u // PIN_A19
|
||||
#define PIN_MISO0 20u // PIN_A20
|
||||
#define PIN_MOSI0 19u // PIN_A19
|
||||
#define PIN_PA00 0u // PIN_A0
|
||||
#define PIN_PA01 1u // PIN_A1
|
||||
@@ -84,23 +100,13 @@
|
||||
#define PIN_PA20 20u // PIN_A20
|
||||
#define PIN_PA23 23u // PIN_A23
|
||||
#define PIN_PWM0 20u // PIN_A20
|
||||
#define PIN_PWM1 12u // PIN_A12
|
||||
#define PIN_PWM2 14u // PIN_A14
|
||||
#define PIN_PWM3 15u // PIN_A15
|
||||
#define PIN_PWM4 16u // PIN_A16
|
||||
#define PIN_PWM5 17u // PIN_A17
|
||||
#define PIN_PWM6 18u // PIN_A18
|
||||
#define PIN_PWM7 23u // PIN_A23
|
||||
#define PIN_RTS0 9u // PIN_A9
|
||||
#define PIN_RTS2 20u // PIN_A20
|
||||
#define PIN_RX0 13u // PIN_A13
|
||||
#define PIN_RX1 2u // PIN_A2
|
||||
#define PIN_RX2 15u // PIN_A15
|
||||
#define PIN_SCK0 16u // PIN_A16
|
||||
#define PIN_SCL0 19u // PIN_A19
|
||||
#define PIN_SDA0 20u // PIN_A20
|
||||
#define PIN_TX0 14u // PIN_A14
|
||||
#define PIN_TX1 3u // PIN_A3
|
||||
#define PIN_TX2 16u // PIN_A16
|
||||
|
||||
// Port availability
|
||||
|
||||
@@ -14,15 +14,21 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,15 +14,21 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE0_SCL 29u // PA_29
|
||||
#define PIN_WIRE0_SDA 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PIN_WIRE0_SCL 29u // PA_29
|
||||
#define PIN_WIRE0_SDA 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -39,7 +47,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 14u // PA_14
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){22u, 29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -63,7 +81,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -74,9 +91,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 29u // PA_29
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
48
boards/variants/t112-v1.1.c
Normal file
48
boards/variants/t112-v1.1.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* This file was auto-generated from t112-v1.1.json using boardgen */
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#ifdef LT_VARIANT_INCLUDE
|
||||
#include LT_VARIANT_INCLUDE
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
|
||||
// D0: PA29, UART2_RX, I2C0_SCL, PWM4
|
||||
{PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
|
||||
// D1: PA19, ADC1, UART0_CTS, SPI0_CS, SPI1_CS, I2C0_SDA, SD_D3, TMR5_TRIG, I2S0_TX
|
||||
{PA_19, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
|
||||
// D2: PA15, PWM1, SWDIO
|
||||
{PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0},
|
||||
// D3: PA14, PWM0, SWCLK
|
||||
{PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0},
|
||||
// D4: PA00, PWM2
|
||||
{PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
|
||||
// D5: PA05, PWM4, WAKE1
|
||||
{PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
|
||||
// D6: PA18, UART0_RX, SPI0_SCK, SPI1_SCK, I2C1_SCL, SD_D2, TMR4_TRIG, I2S0_MCK, WAKE0
|
||||
{PA_18, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
|
||||
// D7: PA12, PWM3
|
||||
{PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
|
||||
// D8: PA23, UART0_TX, SPI0_MOSI, SPI1_MOSI, I2C1_SDA, SD_D1, PWM0, WAKE3
|
||||
{PA_23, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
|
||||
// D9: PA22, UART0_RTS, SPI0_MISO, SPI1_MISO, I2C0_SCL, SD_D0, PWM5, I2S0_WS, WAKE2
|
||||
{PA_22, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
|
||||
// D10: PA30, UART2_TX, I2C0_SDA, PWM4
|
||||
{PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
|
||||
};
|
||||
|
||||
PinInfo *lt_arduino_pin_gpio_map[] = {
|
||||
[0] = &(lt_arduino_pin_info_list[4]), // PA_0 (D4)
|
||||
[5] = &(lt_arduino_pin_info_list[5]), // PA_5 (D5)
|
||||
[12] = &(lt_arduino_pin_info_list[7]), // PA_12 (D7)
|
||||
[14] = &(lt_arduino_pin_info_list[3]), // PA_14 (D3)
|
||||
[15] = &(lt_arduino_pin_info_list[2]), // PA_15 (D2)
|
||||
[18] = &(lt_arduino_pin_info_list[6]), // PA_18 (D6)
|
||||
[19] = &(lt_arduino_pin_info_list[1]), // PA_19 (D1)
|
||||
[22] = &(lt_arduino_pin_info_list[9]), // PA_22 (D9)
|
||||
[23] = &(lt_arduino_pin_info_list[8]), // PA_23 (D8)
|
||||
[29] = &(lt_arduino_pin_info_list[0]), // PA_29 (D0)
|
||||
[30] = &(lt_arduino_pin_info_list[10]), // PA_30 (D10)
|
||||
};
|
||||
// clang-format on
|
||||
138
boards/variants/t112-v1.1.h
Normal file
138
boards/variants/t112-v1.1.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/* This file was auto-generated from t112-v1.1.json using boardgen */
|
||||
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
|
||||
// Pins
|
||||
// ----
|
||||
#define PINS_COUNT 11 // Total GPIO count
|
||||
#define NUM_DIGITAL_PINS 11 // Digital inputs/outputs
|
||||
#define NUM_ANALOG_INPUTS 1 // ADC inputs
|
||||
#define NUM_ANALOG_OUTPUTS 9 // PWM & DAC outputs
|
||||
#define PINS_GPIO_MAX 30 // Last usable GPIO number
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE0_SCL_0 29u // PA_29
|
||||
#define PIN_WIRE0_SCL_1 22u // PA_22
|
||||
#define PIN_WIRE0_SDA_0 19u // PA_19
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u, 22u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
#define PIN_ADC1 19u // PA_19
|
||||
#define PIN_CS0 19u // PA_19
|
||||
#define PIN_CS1 19u // PA_19
|
||||
#define PIN_CTS0 19u // PA_19
|
||||
#define PIN_MISO0 22u // PA_22
|
||||
#define PIN_MISO1 22u // PA_22
|
||||
#define PIN_MOSI0 23u // PA_23
|
||||
#define PIN_MOSI1 23u // PA_23
|
||||
#define PIN_PA00 0u // PA_0
|
||||
#define PIN_PA05 5u // PA_5
|
||||
#define PIN_PA12 12u // PA_12
|
||||
#define PIN_PA14 14u // PA_14
|
||||
#define PIN_PA15 15u // PA_15
|
||||
#define PIN_PA18 18u // PA_18
|
||||
#define PIN_PA19 19u // PA_19
|
||||
#define PIN_PA22 22u // PA_22
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
#define PIN_PWM4 30u // PA_30
|
||||
#define PIN_PWM5 22u // PA_22
|
||||
#define PIN_RTS0 22u // PA_22
|
||||
#define PIN_RX0 18u // PA_18
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
// Port availability
|
||||
// -----------------
|
||||
#define HAS_SERIAL0 1
|
||||
#define HAS_SERIAL2 1
|
||||
#define HAS_SPI0 1
|
||||
#define HAS_SPI1 1
|
||||
#define HAS_WIRE0 1
|
||||
#define HAS_WIRE1 1
|
||||
#define SERIAL_INTERFACES_COUNT 2
|
||||
#define SPI_INTERFACES_COUNT 2
|
||||
#define WIRE_INTERFACES_COUNT 2
|
||||
|
||||
// Arduino pin names
|
||||
// -----------------
|
||||
#define PIN_D0 29u // PA_29
|
||||
#define PIN_D1 19u // PA_19
|
||||
#define PIN_D2 15u // PA_15
|
||||
#define PIN_D3 14u // PA_14
|
||||
#define PIN_D4 0u // PA_0
|
||||
#define PIN_D5 5u // PA_5
|
||||
#define PIN_D6 18u // PA_18
|
||||
#define PIN_D7 12u // PA_12
|
||||
#define PIN_D8 23u // PA_23
|
||||
#define PIN_D9 22u // PA_22
|
||||
#define PIN_D10 30u // PA_30
|
||||
#define PIN_A0 19u // PA_19
|
||||
|
||||
// Static pin names
|
||||
// ----------------
|
||||
static const unsigned char A0 = PIN_A0;
|
||||
static const unsigned char D0 = PIN_D0;
|
||||
static const unsigned char D1 = PIN_D1;
|
||||
static const unsigned char D2 = PIN_D2;
|
||||
static const unsigned char D3 = PIN_D3;
|
||||
static const unsigned char D4 = PIN_D4;
|
||||
static const unsigned char D5 = PIN_D5;
|
||||
static const unsigned char D6 = PIN_D6;
|
||||
static const unsigned char D7 = PIN_D7;
|
||||
static const unsigned char D8 = PIN_D8;
|
||||
static const unsigned char D9 = PIN_D9;
|
||||
static const unsigned char D10 = PIN_D10;
|
||||
@@ -14,14 +14,19 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,15 +14,21 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PIN_WIRE1_SCL 20u // GPIO20
|
||||
#define PIN_WIRE1_SDA 21u // GPIO21
|
||||
#define PIN_WIRE2_SCL 0u // GPIO0
|
||||
#define PIN_WIRE2_SDA 1u // GPIO1
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){20u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){21u}
|
||||
#define PINS_WIRE2_SCL (pin_size_t[]){0u}
|
||||
#define PINS_WIRE2_SDA (pin_size_t[]){1u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PIN_SERIAL1_RX 10u // GPIO10
|
||||
#define PIN_SERIAL1_TX 11u // GPIO11
|
||||
#define PIN_SERIAL2_RX 1u // GPIO1
|
||||
#define PIN_SERIAL2_TX 0u // GPIO0
|
||||
#define PINS_SERIAL1_RX (pin_size_t[]){10u}
|
||||
#define PINS_SERIAL1_TX (pin_size_t[]){11u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){1u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){0u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 19u // PA_19
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u, 22u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){30u, 19u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -62,7 +80,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 14u // PA_14
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM4 29u // PA_29
|
||||
@@ -72,9 +89,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 22u // PA_22
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 19u // PA_19
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 19u // PA_19
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u, 22u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){30u, 19u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -62,7 +80,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 14u // PA_14
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
#define PIN_PWM4 29u // PA_29
|
||||
@@ -72,9 +89,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 22u // PA_22
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 19u // PA_19
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE0_SCL 29u // PA_29
|
||||
#define PIN_WIRE0_SDA 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PIN_WIRE0_SCL 29u // PA_29
|
||||
#define PIN_WIRE0_SDA 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -40,7 +48,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 14u // PA_14
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
|
||||
@@ -19,14 +19,23 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -46,7 +55,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 14u // PA_14
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
#define PIN_PWM4 29u // PA_29
|
||||
@@ -56,7 +64,6 @@
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 29u // PA_29
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){22u, 29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -63,7 +81,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -74,9 +91,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 29u // PA_29
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 19u // PA_19
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u, 22u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){30u, 19u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -63,7 +81,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -74,9 +91,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 22u // PA_22
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 19u // PA_19
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){22u, 29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){19u, 30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -63,7 +81,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -74,9 +91,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 29u // PA_29
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 30u // PA_30
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
|
||||
// SPI Interfaces
|
||||
// --------------
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PIN_SPI0_CS 19u // PA_19
|
||||
#define PIN_SPI0_MISO 22u // PA_22
|
||||
#define PIN_SPI0_MOSI 23u // PA_23
|
||||
#define PIN_SPI0_SCK 18u // PA_18
|
||||
#define PIN_SPI1_CS 19u // PA_19
|
||||
#define PIN_SPI1_MISO 22u // PA_22
|
||||
#define PIN_SPI1_MOSI 23u // PA_23
|
||||
#define PIN_SPI1_SCK 18u // PA_18
|
||||
#define PINS_SPI0_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI0_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI0_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI0_SCK (pin_size_t[]){18u}
|
||||
#define PINS_SPI1_CS (pin_size_t[]){19u}
|
||||
#define PINS_SPI1_MISO (pin_size_t[]){22u}
|
||||
#define PINS_SPI1_MOSI (pin_size_t[]){23u}
|
||||
#define PINS_SPI1_SCK (pin_size_t[]){18u}
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
@@ -31,15 +39,25 @@
|
||||
#define PIN_WIRE0_SDA_1 19u // PA_19
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u, 22u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){30u, 19u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_CTS 19u // PA_19
|
||||
#define PIN_SERIAL0_RTS 22u // PA_22
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_CTS (pin_size_t[]){19u}
|
||||
#define PINS_SERIAL0_RTS (pin_size_t[]){22u}
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -63,7 +81,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
@@ -74,9 +91,7 @@
|
||||
#define PIN_RX2 29u // PA_29
|
||||
#define PIN_SCK0 18u // PA_18
|
||||
#define PIN_SCK1 18u // PA_18
|
||||
#define PIN_SCL0 22u // PA_22
|
||||
#define PIN_SCL1 18u // PA_18
|
||||
#define PIN_SDA0 19u // PA_19
|
||||
#define PIN_SDA1 23u // PA_23
|
||||
#define PIN_TX0 23u // PA_23
|
||||
#define PIN_TX2 30u // PA_30
|
||||
|
||||
@@ -14,17 +14,25 @@
|
||||
|
||||
// Wire Interfaces
|
||||
// ---------------
|
||||
#define PIN_WIRE0_SCL 29u // PA_29
|
||||
#define PIN_WIRE0_SDA 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PIN_WIRE0_SCL 29u // PA_29
|
||||
#define PIN_WIRE0_SDA 30u // PA_30
|
||||
#define PIN_WIRE1_SCL 18u // PA_18
|
||||
#define PIN_WIRE1_SDA 23u // PA_23
|
||||
#define PINS_WIRE0_SCL (pin_size_t[]){29u}
|
||||
#define PINS_WIRE0_SDA (pin_size_t[]){30u}
|
||||
#define PINS_WIRE1_SCL (pin_size_t[]){18u}
|
||||
#define PINS_WIRE1_SDA (pin_size_t[]){23u}
|
||||
|
||||
// Serial ports
|
||||
// ------------
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PIN_SERIAL0_RX 18u // PA_18
|
||||
#define PIN_SERIAL0_TX 23u // PA_23
|
||||
#define PIN_SERIAL2_RX 29u // PA_29
|
||||
#define PIN_SERIAL2_TX 30u // PA_30
|
||||
#define PINS_SERIAL0_RX (pin_size_t[]){18u}
|
||||
#define PINS_SERIAL0_TX (pin_size_t[]){23u}
|
||||
#define PINS_SERIAL2_RX (pin_size_t[]){29u}
|
||||
#define PINS_SERIAL2_TX (pin_size_t[]){30u}
|
||||
|
||||
// Pin function macros
|
||||
// -------------------
|
||||
@@ -40,7 +48,6 @@
|
||||
#define PIN_PA23 23u // PA_23
|
||||
#define PIN_PA29 29u // PA_29
|
||||
#define PIN_PA30 30u // PA_30
|
||||
#define PIN_PWM0 23u // PA_23
|
||||
#define PIN_PWM1 15u // PA_15
|
||||
#define PIN_PWM2 0u // PA_0
|
||||
#define PIN_PWM3 12u // PA_12
|
||||
|
||||
@@ -17,6 +17,13 @@ env: Environment = DefaultEnvironment()
|
||||
platform: PlatformBase = env.PioPlatform()
|
||||
board: PlatformBoardConfig = env.BoardConfig()
|
||||
|
||||
python_deps = {
|
||||
"ltchiptool": ">=4.5.1,<5.0",
|
||||
}
|
||||
env.SConscript("python-venv.py", exports="env")
|
||||
env.ConfigurePythonVenv()
|
||||
env.InstallPythonDependencies(python_deps)
|
||||
|
||||
# Utilities
|
||||
env.SConscript("utils/config.py", exports="env")
|
||||
env.SConscript("utils/cores.py", exports="env")
|
||||
@@ -24,7 +31,7 @@ env.SConscript("utils/env.py", exports="env")
|
||||
env.SConscript("utils/flash.py", exports="env")
|
||||
env.SConscript("utils/libs-external.py", exports="env")
|
||||
env.SConscript("utils/libs-queue.py", exports="env")
|
||||
env.SConscript("utils/ltchiptool.py", exports="env")
|
||||
env.SConscript("utils/ltchiptool-util.py", exports="env")
|
||||
|
||||
# Firmware name
|
||||
if env.get("PROGNAME", "program") == "program":
|
||||
|
||||
122
builder/python-venv.py
Normal file
122
builder/python-venv.py
Normal file
@@ -0,0 +1,122 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2023-09-07.
|
||||
|
||||
import json
|
||||
import site
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import semantic_version
|
||||
from platformio.compat import IS_WINDOWS
|
||||
from platformio.package.version import pepver_to_semver
|
||||
from platformio.platform.base import PlatformBase
|
||||
from SCons.Script import DefaultEnvironment, Environment
|
||||
|
||||
env: Environment = DefaultEnvironment()
|
||||
platform: PlatformBase = env.PioPlatform()
|
||||
|
||||
# code borrowed and modified from espressif32/builder/frameworks/espidf.py
|
||||
|
||||
|
||||
def env_configure_python_venv(env: Environment):
|
||||
venv_path = Path(env.subst("${PROJECT_CORE_DIR}"), "penv", ".libretiny")
|
||||
|
||||
pip_path = venv_path.joinpath(
|
||||
"Scripts" if IS_WINDOWS else "bin",
|
||||
"pip" + (".exe" if IS_WINDOWS else ""),
|
||||
)
|
||||
python_path = venv_path.joinpath(
|
||||
"Scripts" if IS_WINDOWS else "bin",
|
||||
"python" + (".exe" if IS_WINDOWS else ""),
|
||||
)
|
||||
site_path = venv_path.joinpath(
|
||||
"Lib" if IS_WINDOWS else "lib",
|
||||
"." if IS_WINDOWS else f"python{sys.version_info[0]}.{sys.version_info[1]}",
|
||||
"site-packages",
|
||||
)
|
||||
|
||||
if not pip_path.is_file():
|
||||
# Use the built-in PlatformIO Python to create a standalone virtual env
|
||||
result = env.Execute(
|
||||
env.VerboseAction(
|
||||
f'"$PYTHONEXE" -m venv --clear "{venv_path.absolute()}"',
|
||||
"LibreTiny: Creating a virtual environment for Python dependencies",
|
||||
)
|
||||
)
|
||||
if not python_path.is_file():
|
||||
# Creating the venv failed
|
||||
raise RuntimeError(
|
||||
f"Failed to create virtual environment. Error code {result}"
|
||||
)
|
||||
if not pip_path.is_file():
|
||||
# Creating the venv succeeded but pip didn't get installed
|
||||
# (i.e. Debian/Ubuntu without ensurepip)
|
||||
print(
|
||||
"LibreTiny: Failed to install pip, running get-pip.py", file=sys.stderr
|
||||
)
|
||||
import requests
|
||||
|
||||
with requests.get("https://bootstrap.pypa.io/get-pip.py") as r:
|
||||
p = subprocess.Popen(
|
||||
args=str(python_path.absolute()),
|
||||
stdin=subprocess.PIPE,
|
||||
)
|
||||
p.communicate(r.content)
|
||||
p.wait()
|
||||
|
||||
assert (
|
||||
pip_path.is_file()
|
||||
), f"Error: Missing the pip binary in virtual environment `{pip_path.absolute()}`"
|
||||
assert (
|
||||
python_path.is_file()
|
||||
), f"Error: Missing Python executable file `{python_path.absolute()}`"
|
||||
assert (
|
||||
site_path.is_dir()
|
||||
), f"Error: Missing site-packages directory `{site_path.absolute()}`"
|
||||
|
||||
env.Replace(LTPYTHONEXE=python_path.absolute(), LTPYTHONENV=venv_path.absolute())
|
||||
site.addsitedir(str(site_path.absolute()))
|
||||
|
||||
|
||||
def env_install_python_dependencies(env: Environment, dependencies: dict):
|
||||
try:
|
||||
pip_output = subprocess.check_output(
|
||||
[
|
||||
env.subst("${LTPYTHONEXE}"),
|
||||
"-m",
|
||||
"pip",
|
||||
"list",
|
||||
"--format=json",
|
||||
"--disable-pip-version-check",
|
||||
]
|
||||
)
|
||||
pip_data = json.loads(pip_output)
|
||||
packages = {p["name"]: pepver_to_semver(p["version"]) for p in pip_data}
|
||||
except:
|
||||
print(
|
||||
"LibreTiny: Warning! Couldn't extract the list of installed Python packages"
|
||||
)
|
||||
packages = {}
|
||||
|
||||
to_install = []
|
||||
for name, spec in dependencies.items():
|
||||
install_spec = f'"{name}{dependencies[name]}"'
|
||||
if name not in packages:
|
||||
to_install.append(install_spec)
|
||||
elif spec:
|
||||
version_spec = semantic_version.Spec(spec)
|
||||
if not version_spec.match(packages[name]):
|
||||
to_install.append(install_spec)
|
||||
|
||||
if to_install:
|
||||
env.Execute(
|
||||
env.VerboseAction(
|
||||
'"${LTPYTHONEXE}" -m pip install --prefer-binary -U '
|
||||
+ " ".join(to_install),
|
||||
"LibreTiny: Installing Python dependencies",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
env.AddMethod(env_configure_python_venv, "ConfigurePythonVenv")
|
||||
env.AddMethod(env_install_python_dependencies, "InstallPythonDependencies")
|
||||
@@ -8,6 +8,7 @@ from subprocess import PIPE, Popen
|
||||
from typing import Dict
|
||||
|
||||
from ltchiptool import Family, get_version
|
||||
from ltchiptool.util.lvm import LVM
|
||||
from ltchiptool.util.misc import sizeof
|
||||
from platformio.platform.base import PlatformBase
|
||||
from platformio.platform.board import PlatformBoardConfig
|
||||
@@ -77,7 +78,7 @@ def env_configure(
|
||||
# ltchiptool config:
|
||||
# -r output raw log messages
|
||||
# -i 1 indent log messages
|
||||
LTCHIPTOOL='"${PYTHONEXE}" -m ltchiptool -r -i 1',
|
||||
LTCHIPTOOL='"${LTPYTHONEXE}" -m ltchiptool -r -i 1 -L "${LT_DIR}"',
|
||||
# Fix for link2bin to get tmpfile name in argv
|
||||
LINKCOM="${LINK} ${LINKARGS}",
|
||||
LINKARGS="${TEMPFILE('-o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS', '$LINKCOMSTR')}",
|
||||
@@ -87,6 +88,8 @@ def env_configure(
|
||||
)
|
||||
# Store family parameters as environment variables
|
||||
env.Replace(**dict(family))
|
||||
# Set platform directory in ltchiptool (for use in this process only)
|
||||
LVM.add_path(platform.get_dir())
|
||||
return family
|
||||
|
||||
|
||||
@@ -123,7 +126,7 @@ def env_print_info(
|
||||
if env.get("FLASH_IS_CUSTOM", False):
|
||||
print("CUSTOM FLASH LAYOUT:")
|
||||
for name, layout in board.get("flash").items():
|
||||
(_, _, length) = v.partition("+")
|
||||
(_, _, length) = layout.partition("+")
|
||||
length = int(length, 16)
|
||||
print(f" - {name}: {layout} ({sizeof(length)})")
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
WiFiClass::WiFiClass() {
|
||||
data = (WiFiData *)calloc(1, sizeof(WiFiData));
|
||||
|
||||
DATA->scanSem = xSemaphoreCreateBinary();
|
||||
STA_CFG.dhcp_mode = DHCP_CLIENT;
|
||||
DATA->scanSem = xSemaphoreCreateBinary();
|
||||
STA_CFG.dhcp_mode = DHCP_CLIENT;
|
||||
STA_ADV_CFG.dhcp_mode = DHCP_CLIENT;
|
||||
}
|
||||
|
||||
WiFiClass::~WiFiClass() {
|
||||
|
||||
@@ -57,6 +57,7 @@ extern void wifiEventHandler(rw_evt_type event);
|
||||
|
||||
typedef struct {
|
||||
network_InitTypeDef_st configSta;
|
||||
network_InitTypeDef_adv_st configStaAdv;
|
||||
network_InitTypeDef_ap_st configAp;
|
||||
unsigned long scannedAt;
|
||||
SemaphoreHandle_t scanSem;
|
||||
@@ -73,6 +74,7 @@ typedef struct {
|
||||
#define cDATA ((WiFiData *)cls->data)
|
||||
|
||||
#define STA_CFG (DATA->configSta)
|
||||
#define STA_ADV_CFG (DATA->configStaAdv)
|
||||
#define AP_CFG (DATA->configAp)
|
||||
#define IP_STATUS (DATA->statusIp)
|
||||
#define LINK_STATUS (DATA->statusLink)
|
||||
|
||||
@@ -13,11 +13,26 @@ WiFiClass::begin(const char *ssid, const char *passphrase, int32_t channel, cons
|
||||
|
||||
disconnect(false);
|
||||
|
||||
strcpy(STA_CFG.wifi_ssid, ssid);
|
||||
if (passphrase) {
|
||||
strcpy(STA_CFG.wifi_key, passphrase);
|
||||
if (bssid) {
|
||||
strcpy(STA_ADV_CFG.ap_info.ssid, ssid);
|
||||
if (passphrase) {
|
||||
strcpy(STA_ADV_CFG.key, passphrase);
|
||||
STA_ADV_CFG.key_len = strlen(passphrase);
|
||||
} else {
|
||||
STA_ADV_CFG.key[0] = '\0';
|
||||
STA_ADV_CFG.key_len = 0;
|
||||
}
|
||||
STA_ADV_CFG.ap_info.channel = channel;
|
||||
STA_ADV_CFG.wifi_retry_interval = 100;
|
||||
} else {
|
||||
STA_CFG.wifi_bssid[0] = '\0';
|
||||
strcpy(STA_CFG.wifi_ssid, ssid);
|
||||
if (passphrase) {
|
||||
strcpy(STA_CFG.wifi_key, passphrase);
|
||||
} else {
|
||||
STA_CFG.wifi_key[0] = '\0';
|
||||
}
|
||||
STA_CFG.wifi_retry_interval = 100;
|
||||
STA_CFG.wifi_mode = BK_STATION;
|
||||
}
|
||||
|
||||
if (reconnect(bssid))
|
||||
@@ -27,21 +42,31 @@ WiFiClass::begin(const char *ssid, const char *passphrase, int32_t channel, cons
|
||||
}
|
||||
|
||||
bool WiFiClass::config(IPAddress localIP, IPAddress gateway, IPAddress subnet, IPAddress dns1, IPAddress dns2) {
|
||||
STA_CFG.dhcp_mode = localIP ? DHCP_DISABLE : DHCP_CLIENT;
|
||||
STA_CFG.dhcp_mode = localIP ? DHCP_DISABLE : DHCP_CLIENT;
|
||||
STA_ADV_CFG.dhcp_mode = localIP ? DHCP_DISABLE : DHCP_CLIENT;
|
||||
if (localIP) {
|
||||
sprintf(STA_CFG.local_ip_addr, IP_FMT, localIP[0], localIP[1], localIP[2], localIP[3]);
|
||||
sprintf(STA_CFG.net_mask, IP_FMT, subnet[0], subnet[1], subnet[2], subnet[3]);
|
||||
sprintf(STA_CFG.gateway_ip_addr, IP_FMT, gateway[0], gateway[1], gateway[2], gateway[3]);
|
||||
sprintf(STA_ADV_CFG.local_ip_addr, IP_FMT, localIP[0], localIP[1], localIP[2], localIP[3]);
|
||||
sprintf(STA_ADV_CFG.net_mask, IP_FMT, subnet[0], subnet[1], subnet[2], subnet[3]);
|
||||
sprintf(STA_ADV_CFG.gateway_ip_addr, IP_FMT, gateway[0], gateway[1], gateway[2], gateway[3]);
|
||||
if (dns1) {
|
||||
sprintf(STA_CFG.dns_server_ip_addr, IP_FMT, dns1[0], dns1[1], dns1[2], dns1[3]);
|
||||
sprintf(STA_ADV_CFG.dns_server_ip_addr, IP_FMT, dns1[0], dns1[1], dns1[2], dns1[3]);
|
||||
} else {
|
||||
STA_CFG.dns_server_ip_addr[0] = '\0';
|
||||
STA_CFG.dns_server_ip_addr[0] = '\0';
|
||||
STA_ADV_CFG.dns_server_ip_addr[0] = '\0';
|
||||
}
|
||||
} else {
|
||||
STA_CFG.local_ip_addr[0] = '\0';
|
||||
STA_CFG.net_mask[0] = '\0';
|
||||
STA_CFG.gateway_ip_addr[0] = '\0';
|
||||
STA_CFG.dns_server_ip_addr[0] = '\0';
|
||||
STA_CFG.local_ip_addr[0] = '\0';
|
||||
STA_CFG.net_mask[0] = '\0';
|
||||
STA_CFG.gateway_ip_addr[0] = '\0';
|
||||
STA_CFG.dns_server_ip_addr[0] = '\0';
|
||||
STA_ADV_CFG.local_ip_addr[0] = '\0';
|
||||
STA_ADV_CFG.net_mask[0] = '\0';
|
||||
STA_ADV_CFG.gateway_ip_addr[0] = '\0';
|
||||
STA_ADV_CFG.dns_server_ip_addr[0] = '\0';
|
||||
}
|
||||
|
||||
// from wlan_ui.c:1370
|
||||
@@ -74,10 +99,8 @@ bool WiFiClass::reconnect(const uint8_t *bssid) {
|
||||
|
||||
LT_DM(WIFI, "Data = %p", DATA->configSta);
|
||||
|
||||
STA_CFG.wifi_mode = BK_STATION;
|
||||
STA_CFG.wifi_retry_interval = 100;
|
||||
if (bssid)
|
||||
memcpy(STA_CFG.wifi_bssid, bssid, 6);
|
||||
memcpy(STA_ADV_CFG.ap_info.bssid, bssid, 6);
|
||||
else
|
||||
memset(STA_CFG.wifi_bssid, 0x00, 6);
|
||||
|
||||
@@ -91,7 +114,11 @@ bool WiFiClass::reconnect(const uint8_t *bssid) {
|
||||
LT_DM(WIFI, "Starting WiFi...");
|
||||
|
||||
__wrap_bk_printf_disable();
|
||||
bk_wlan_start_sta(&STA_CFG);
|
||||
if (bssid) {
|
||||
bk_wlan_start_sta_adv(&STA_ADV_CFG);
|
||||
} else {
|
||||
bk_wlan_start_sta(&STA_CFG);
|
||||
}
|
||||
__wrap_bk_printf_enable();
|
||||
|
||||
LT_DM(WIFI, "Start OK");
|
||||
|
||||
@@ -15,20 +15,27 @@ static void scanHandler(void *ctx, uint8_t param) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t apNum = 0;
|
||||
ScanResult_adv result;
|
||||
result.ApNum = 0;
|
||||
result.ApList = NULL;
|
||||
if (wlan_sta_scan_result(&result)) {
|
||||
LT_EM(WIFI, "Failed to get scan result");
|
||||
goto end;
|
||||
}
|
||||
LT_IM(WIFI, "Found %d APs", result.ApNum);
|
||||
|
||||
cls->scanAlloc(result.ApNum);
|
||||
if (!scan->ap) {
|
||||
apNum = cls->scanAlloc(result.ApNum);
|
||||
if (0 == apNum) {
|
||||
LT_WM(WIFI, "scan->ap alloc failed");
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < result.ApNum; i++) {
|
||||
if (apNum < result.ApNum) {
|
||||
LT_WM(WIFI, "alloc failed, only %d APs will be copied");
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < apNum; i++) {
|
||||
scan->ap[i].ssid = strdup(result.ApList[i].ssid);
|
||||
scan->ap[i].auth = securityTypeToAuthMode(result.ApList[i].security);
|
||||
scan->ap[i].rssi = result.ApList[i].ApPower;
|
||||
@@ -47,6 +54,9 @@ end:
|
||||
scan->running = false;
|
||||
xSemaphoreGive(cDATA->scanSem);
|
||||
}
|
||||
if (result.ApList) {
|
||||
free(result.ApList);
|
||||
}
|
||||
LT_HEAP_I();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,10 +108,13 @@ void pinRemoveMode(PinInfo *pin, uint32_t mask) {
|
||||
pinDisable(pin, PIN_IRQ);
|
||||
}
|
||||
if ((mask & PIN_PWM) && (pin->enabled & PIN_PWM)) {
|
||||
data->pwm->cfg.bits.en = PWM_DISABLE;
|
||||
__wrap_bk_printf_disable();
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_DEINIT_PARAM, data->pwm);
|
||||
__wrap_bk_printf_enable();
|
||||
if (data->pwmState != LT_PWM_STOPPED) {
|
||||
data->pwmState = LT_PWM_STOPPED;
|
||||
data->pwm.cfg.bits.en = PWM_DISABLE;
|
||||
__wrap_bk_printf_disable();
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_DEINIT_PARAM, &data->pwm);
|
||||
__wrap_bk_printf_enable();
|
||||
}
|
||||
pinDisable(pin, PIN_PWM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ static uint8_t gpioToAdc(GPIO_INDEX gpio) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static pwm_param_t pwm;
|
||||
static uint16_t adcData[1];
|
||||
|
||||
uint16_t analogReadVoltage(pin_size_t pinNumber) {
|
||||
@@ -66,13 +65,21 @@ uint16_t analogReadVoltage(pin_size_t pinNumber) {
|
||||
adc.pData = adcData;
|
||||
adc.data_buff_size = 1;
|
||||
handle = ddev_open(SARADC_DEV_NAME, &status, (uint32_t)&adc);
|
||||
if (status)
|
||||
if (handle == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (status != SARADC_SUCCESS) {
|
||||
ddev_close(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// wait for data
|
||||
while (!adc.has_data || adc.current_sample_data_cnt < 1) {
|
||||
delay(1);
|
||||
}
|
||||
ddev_control(handle, SARADC_CMD_RUN_OR_STOP_ADC, (void *)false);
|
||||
uint8_t run_stop = 0; // stop
|
||||
ddev_control(handle, SARADC_CMD_RUN_OR_STOP_ADC, &run_stop);
|
||||
ddev_close(handle);
|
||||
return adcData[0];
|
||||
}
|
||||
@@ -87,46 +94,57 @@ void analogWrite(pin_size_t pinNumber, int value) {
|
||||
// GPIO can't be used together with PWM
|
||||
pinRemoveMode(pin, PIN_GPIO | PIN_IRQ);
|
||||
|
||||
float percent = value * 1.0 / ((1 << _analogWriteResolution) - 1);
|
||||
uint32_t frequency = 26 * _analogWritePeriod - 1;
|
||||
|
||||
if (!pinEnabled(pin, PIN_PWM)) {
|
||||
pinEnable(pin, PIN_PWM);
|
||||
data->pwmState = LT_PWM_STOPPED;
|
||||
data->pwm.channel = gpioToPwm(pin->gpio);
|
||||
data->pwm.cfg.bits.en = PWM_ENABLE;
|
||||
data->pwm.cfg.bits.int_en = PWM_INT_DIS;
|
||||
data->pwm.cfg.bits.mode = PWM_PWM_MODE;
|
||||
data->pwm.cfg.bits.clk = PWM_CLK_26M;
|
||||
data->pwm.end_value = frequency;
|
||||
data->pwm.p_Int_Handler = NULL;
|
||||
}
|
||||
|
||||
float percent = value * 1.0 / ((1 << _analogWriteResolution) - 1);
|
||||
uint32_t dutyCycle = percent * frequency;
|
||||
pwm.channel = gpioToPwm(pin->gpio);
|
||||
uint32_t channel = data->pwm.channel;
|
||||
#if CFG_SOC_NAME != SOC_BK7231N
|
||||
pwm.duty_cycle = dutyCycle;
|
||||
data->pwm.duty_cycle = dutyCycle;
|
||||
#else
|
||||
pwm.duty_cycle1 = dutyCycle;
|
||||
pwm.duty_cycle2 = 0;
|
||||
pwm.duty_cycle3 = 0;
|
||||
data->pwm.duty_cycle1 = dutyCycle;
|
||||
data->pwm.duty_cycle2 = 0;
|
||||
data->pwm.duty_cycle3 = 0;
|
||||
#endif
|
||||
|
||||
if (dutyCycle) {
|
||||
if (!pinEnabled(pin, PIN_PWM)) {
|
||||
if ((data->pwmState == LT_PWM_STOPPED) || (data->pwmState == LT_PWM_PAUSED)) {
|
||||
if (dutyCycle) {
|
||||
// enable PWM and set its value
|
||||
pwm.cfg.bits.en = PWM_ENABLE;
|
||||
pwm.cfg.bits.int_en = PWM_INT_DIS;
|
||||
pwm.cfg.bits.mode = PWM_PWM_MODE;
|
||||
pwm.cfg.bits.clk = PWM_CLK_26M;
|
||||
pwm.end_value = frequency;
|
||||
pwm.p_Int_Handler = NULL;
|
||||
|
||||
__wrap_bk_printf_disable();
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_INIT_PARAM, &pwm);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_INIT_LEVL_SET_HIGH, &pwm.channel);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_UNIT_ENABLE, &pwm.channel);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_INIT_PARAM, &data->pwm);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_INIT_LEVL_SET_HIGH, &channel);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_UNIT_ENABLE, &channel);
|
||||
__wrap_bk_printf_enable();
|
||||
|
||||
data->pwmState = LT_PWM_RUNNING;
|
||||
}
|
||||
} else if (data->pwmState == LT_PWM_RUNNING) {
|
||||
if (dutyCycle) {
|
||||
__wrap_bk_printf_disable();
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_INIT_LEVL_SET_HIGH, &channel);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_SET_DUTY_CYCLE, &data->pwm);
|
||||
__wrap_bk_printf_enable();
|
||||
// pass global PWM object pointer
|
||||
data->pwm = &pwm;
|
||||
pinEnable(pin, PIN_PWM);
|
||||
} else {
|
||||
// update duty cycle
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_SET_DUTY_CYCLE, &pwm);
|
||||
__wrap_bk_printf_disable();
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_INIT_LEVL_SET_LOW, &channel);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_SET_DUTY_CYCLE, &data->pwm);
|
||||
sddev_control(PWM_DEV_NAME, CMD_PWM_UNIT_DISABLE, &channel);
|
||||
__wrap_bk_printf_enable();
|
||||
|
||||
data->pwmState = LT_PWM_PAUSED;
|
||||
}
|
||||
} else {
|
||||
if (pinEnabled(pin, PIN_PWM)) {
|
||||
// disable PWM
|
||||
pinRemoveMode(pin, PIN_PWM);
|
||||
}
|
||||
// force level as LOW
|
||||
pinMode(pinNumber, OUTPUT);
|
||||
digitalWrite(pinNumber, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum lt_pwm_state_tag { LT_PWM_STOPPED, LT_PWM_RUNNING, LT_PWM_PAUSED } lt_pwm_state_t;
|
||||
|
||||
struct PinData_s {
|
||||
pwm_param_t *pwm;
|
||||
pwm_param_t pwm;
|
||||
lt_pwm_state_t pwmState;
|
||||
PinMode gpioMode;
|
||||
PinStatus irqMode;
|
||||
void *irqHandler;
|
||||
|
||||
@@ -24,7 +24,7 @@ void SerialClass::adrParse(uint8_t c) {
|
||||
#endif
|
||||
|
||||
int SerialClass::available() {
|
||||
return this->buf && this->buf->available();
|
||||
return this->buf ? this->buf->available() : 0;
|
||||
}
|
||||
|
||||
int SerialClass::peek() {
|
||||
|
||||
@@ -39,13 +39,23 @@ void WiFiClass::scanDelete() {
|
||||
}
|
||||
|
||||
uint8_t WiFiClass::scanAlloc(uint8_t count) {
|
||||
uint8_t last = scan->count;
|
||||
scan->count = count;
|
||||
scan->ap = (WiFiScanAP *)realloc(scan->ap, count * sizeof(WiFiScanAP));
|
||||
if (!scan->ap)
|
||||
return 255;
|
||||
memset(scan->ap + last, 0, sizeof(WiFiScanAP));
|
||||
return last;
|
||||
if ((!scan->ap) || (count > scan->count)) {
|
||||
auto newMem = (WiFiScanAP *)realloc(scan->ap, count * sizeof(WiFiScanAP));
|
||||
if (!newMem) {
|
||||
return scan->count;
|
||||
}
|
||||
scan->ap = newMem;
|
||||
}
|
||||
if (!scan->ap) {
|
||||
scan->count = 0;
|
||||
return 0;
|
||||
}
|
||||
if (count > scan->count) {
|
||||
// clear only new entries
|
||||
memset(scan->ap + scan->count, 0, sizeof(WiFiScanAP) * (count - scan->count));
|
||||
}
|
||||
scan->count = count;
|
||||
return count;
|
||||
}
|
||||
|
||||
String WiFiClass::SSID(uint8_t networkItem) {
|
||||
|
||||
@@ -83,7 +83,8 @@ bool UpdateClass::end(bool evenIfRemaining) {
|
||||
// abort if not finished
|
||||
this->errArd = UPDATE_ERROR_ABORT;
|
||||
|
||||
this->md5Digest = static_cast<uint8_t *>(malloc(16));
|
||||
if (!this->md5Digest)
|
||||
this->md5Digest = static_cast<uint8_t *>(malloc(16));
|
||||
MD5Final(this->md5Digest, this->md5Ctx);
|
||||
|
||||
this->cleanup(/* clearError= */ evenIfRemaining);
|
||||
@@ -148,8 +149,8 @@ size_t UpdateClass::write(const uint8_t *data, size_t len) {
|
||||
if (!this->ctx)
|
||||
return 0;
|
||||
|
||||
size_t written = lt_ota_write(ctx, data, len);
|
||||
MD5Update(this->md5Ctx, data, len);
|
||||
size_t written = lt_ota_write(ctx, data, len);
|
||||
if (written != len)
|
||||
this->cleanup(/* clearError= */ false);
|
||||
return written;
|
||||
|
||||
@@ -77,7 +77,8 @@ bool UpdateClass::rollBack() {
|
||||
bool UpdateClass::setMD5(const char *md5) {
|
||||
if (strlen(md5) != 32)
|
||||
return false;
|
||||
this->md5Expected = static_cast<uint8_t *>(malloc(16));
|
||||
if (!this->md5Expected)
|
||||
this->md5Expected = static_cast<uint8_t *>(malloc(16));
|
||||
if (!this->md5Expected)
|
||||
return false;
|
||||
lt_xtob(md5, 32, this->md5Expected);
|
||||
|
||||
@@ -20,7 +20,10 @@ static rtw_result_t scanHandler(rtw_scan_handler_result_t *result) {
|
||||
if (!net->SSID.len)
|
||||
return RTW_SUCCESS;
|
||||
|
||||
uint8_t last = cls->scanAlloc(scan->count + 1);
|
||||
uint8_t last = scan->count + 1;
|
||||
if (cls->scanAlloc(last) < last) {
|
||||
return RTW_SUCCESS;
|
||||
}
|
||||
|
||||
scan->ap[last].ssid = strdup((char *)net->SSID.val);
|
||||
scan->ap[last].auth = securityTypeToAuthMode(net->security);
|
||||
|
||||
@@ -3,46 +3,60 @@
|
||||
Using LibreTiny is simple, just like every other PlatformIO development platform.
|
||||
|
||||
1. [Install PlatformIO](https://platformio.org/platformio-ide)
|
||||
2. `platformio platform install -f https://github.com/kuba2k2/libretiny`
|
||||
2. `pio pkg install --platform libretiny`
|
||||
|
||||
!!! tip
|
||||
See the [Cloudcutter video guide](https://www.youtube.com/watch?v=sSj8f-HCHQ0) for a complete tutorial on flashing with [Cloudcutter](https://github.com/tuya-cloudcutter/tuya-cloudcutter) and installing [LibreTiny-ESPHome](../projects/esphome.md). **Includes Home Assistant Add-On setup.**
|
||||
|
||||
More information on Cloudcutter can be found in the [Tuya Cloudcutter GitHub repository](https://github.com/tuya-cloudcutter/tuya-cloudcutter).
|
||||
|
||||
## Board selection
|
||||
|
||||
- Go to [Boards & CPU list](../status/supported.md).
|
||||
- Find the board your device has (usually, the model number is written on the silkscreen).
|
||||
- If your board isn't available yet, use one of the "Generic" boards that matches the CPU you have.
|
||||
- Click on the board name. From the documentation page, note the board code.
|
||||
- Use this code to create a PlatformIO project.
|
||||
1. Navigate to the [supported boards & CPUs](../status/supported.md) list.
|
||||
2. Find the board your device has (usually, the model number is written on the silkscreen). \
|
||||
*If your board isn't available yet, use one of the "Generic" boards that matches the CPU you your board has.*
|
||||
3. Click on the board name. A new page opens with information about the selected board name.
|
||||
4. Scroll down to the "Usage" section of the page, and copy the configuration section that is relevant to your use case.
|
||||
|
||||
## Run community projects
|
||||
|
||||
LibreTiny was developed with popular community projects in mind. Currently, unofficial [ESPHome port](../projects/esphome.md) is available ([the PR](https://github.com/esphome/esphome/pull/3509) will hopefully be merged into upstream at some point).
|
||||
LibreTiny was developed with popular community projects in mind.
|
||||
|
||||
There is an official [ESPHome port](../projects/esphome.md) available and integrated into the ESPHome project. No extra downloads or code compilations are needed to use ESPHome with LibreTiny-supported platforms.
|
||||
|
||||
## Develop your own project
|
||||
|
||||
If you're developing your own embedded software, and want it to run on LibreTiny-supported chips, create a project.
|
||||
Developing your own embedded software that runs on LibreTiny-supported platforms.
|
||||
|
||||
- use PlatformIO IDE (PIO Home -> Open -> New Project)
|
||||
- run `pio project init` in your desired project directory
|
||||
To get started with LibreTiny on your chosen platform, create a new project using your preferred method.
|
||||
|
||||
Next, read one of the [flashing guides](../flashing/SUMMARY.md) to run your project!
|
||||
There's a few ways to create a new PlatformIO Project. For example:
|
||||
|
||||
### LT configuration
|
||||
- using the PlatformIO IDE graphical interface (PIO Home -> Open -> New Project)
|
||||
- by running the `pio project init` command in your desired project directory \
|
||||
*See the [PlatformIO Core (CLI) documentation] for information on `pio project init` and other command line usage.*
|
||||
|
||||
LibreTiny has a few configuration options that change its behavior or features. Refer to [LT configuration](../dev/config.md) for details.
|
||||
Next, read one of the [flashing guides](../flashing/SUMMARY.md) to upload and run your project!
|
||||
|
||||
### Config options (platformio.ini)
|
||||
|
||||
LibreTiny has a few configuration options that allow you to change its behavior or features. These can be defined, specified or changed in the platformio.ini configuration file for your project.
|
||||
|
||||
Refer to the LibreTiny [Configuration](../dev/config.md) manual for details.
|
||||
|
||||
### GPIO usage - important change
|
||||
|
||||
!!! important
|
||||
Since v1.0.0, GPIOs are no longer meant to be referenced by `D#` numbers.
|
||||
As of LibreTiny release v1.0.0, references to GPIO pins using their `D#` numbers has been **deprecated** and should **no longer be used** in new projects.
|
||||
|
||||
If your program is using Arduino I/O functions, refer to the [Migration guide](../dev/migration_v1.0.0.md) to modify your program accordingly.
|
||||
If your program is using Arduino I/O functions, please refer to the [migration guide](../dev/migration_v1.0.0.md) on how to modify your code accordingly.
|
||||
|
||||
### Examples
|
||||
|
||||
{%
|
||||
include-markdown "../../examples/SUMMARY.md"
|
||||
start="# Examples\n"
|
||||
start="# Examples\n"
|
||||
%}
|
||||
|
||||
<!-- These are reference URL's, which can be used to shorten inline hyperlinks to just their contextual title or text. -->
|
||||
[PlatformIO Core (CLI) documentation]: https://docs.platformio.org/en/stable/core/quickstart.html#setting-up-the-project
|
||||
|
||||
4
docs/inc/flashing-note.md
Normal file
4
docs/inc/flashing-note.md
Normal file
@@ -0,0 +1,4 @@
|
||||
!!! danger "Read this!"
|
||||
This is probably the most important part of the docs - flashing firmware to the chip.
|
||||
|
||||
**This is why you're here**. Please read this section carefully, and only then start flashing firmware.
|
||||
@@ -1,4 +1,4 @@
|
||||
!!! note
|
||||
!!! note inline end
|
||||
"CEN" pin is the RESET pin - connecting it to GND will keep the chip in "reset" state. Disconnecting it will allow the chip to start back up.
|
||||
|
||||
If you're having issues with using CEN pin (or if it's not accessible on your device) you can toggle the 3.3V power instead. Removing power will keep it in "reset", and applying it back will start it again.
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
!!! note inline end "Also read"
|
||||
- [Finding encryption keys](keys.md) - what to do if LibreTiny doesn't boot because of incorrect flash encryption keys
|
||||
|
||||
Beken BK7231 is a family of Wi-Fi and BLE microcontrollers, of which most popular are BK7231N and BK7231T.
|
||||
|
||||
Features:
|
||||
@@ -28,8 +31,14 @@ Resources:
|
||||
include-markdown "../../inc/find-board.md"
|
||||
%}
|
||||
|
||||
---
|
||||
|
||||
## Flashing
|
||||
|
||||
{%
|
||||
include-markdown "../../inc/flashing-note.md"
|
||||
%}
|
||||
|
||||
BK7231 has two UART ports - UART2 (sometimes called LOG_UART) and UART1. The UART1 port is used for flashing (and external components, such as TuyaMCU) and has no text output. The UART2 port is used for log viewing only.
|
||||
|
||||
You need to find which pins correspond to UART1 TX and RX. If your board is supported, you'll find the pinout on its documentation page. Otherwise (and for generic boards), you'll have to find the pinout online.
|
||||
@@ -53,12 +62,12 @@ GND | GND
|
||||
include-markdown "../../inc/uart-power.md"
|
||||
%}
|
||||
|
||||
The download mode is entered when the chip communicates with the flasher program. Hence, the first step is running the flasher program (described below). While the program is trying to establish communication, **the chip has to be rebooted**. In order to do that, you need to bridge CEN pin to GND with a wire.
|
||||
|
||||
{%
|
||||
include-markdown "../../inc/uart-cen.md"
|
||||
%}
|
||||
|
||||
The download mode is entered when the chip communicates with the flasher program. Hence, the first step is running the flasher program (described below). While the program is trying to establish communication, **the chip has to be rebooted**. In order to do that, you need to bridge CEN pin to GND with a wire.
|
||||
|
||||
Keep in mind that BK7231T (not N) will exit the download mode when it can't communicate with the flasher (or when the flasher finishes its work). It's not possible to forcefully enter download mode without it.
|
||||
|
||||
After linking with the chip, the flasher program will begin writing (or reading) the firmware automatically. If that doesn't happen, try resetting the chip again until it works.
|
||||
@@ -79,7 +88,9 @@ The recommended tool to flash (or dump firmware) is `ltchiptool`.
|
||||
|
||||
`ltchiptool`'s Beken flashing program is based on [bk7231tools](https://github.com/tuya-cloudcutter/bk7231tools). Refer to the guide for information how to use it, but keep in mind that using the ltchiptool GUI is probably just easier.
|
||||
|
||||
### Auto-download-reboot
|
||||
---
|
||||
|
||||
## Auto-download-reboot
|
||||
|
||||
{%
|
||||
include-markdown "../../inc/uart-adr.md"
|
||||
|
||||
48
docs/platform/beken-72xx/keys.md
Normal file
48
docs/platform/beken-72xx/keys.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Finding encryption keys
|
||||
|
||||
## Introduction
|
||||
|
||||
!!! tip inline end
|
||||
Before proceeding with this method, try using [ltchiptool](../../flashing/tools/ltchiptool.md)'s `Get chip info`
|
||||
function. It will read eFuse, which may reveal the raw encryption key. If you see all `00000000`s, then the eFuse
|
||||
is readout-protected and the key cannot be extracted in this simple way.
|
||||
|
||||
3-rd party firmware for Beken chips must be compiled with a flash encryption key matching the one programmed into
|
||||
the chip. Incorrect keys will make the firmware unable to run.
|
||||
|
||||
The [`bk72xx-bootloader-dump`](https://github.com/libretiny-eu/bk72xx-bootloader-dump) firmware might make it easier
|
||||
to find the encryption key of BK7231N/BK7231T chips.
|
||||
|
||||
The key is made of four 32-bit integers; the default key is usually `510fb093 a3cbeadc 5993a17e c7adeb03`
|
||||
(used by Beken and Tuya on most devices), but devices with different keys have been recently discovered
|
||||
(likely from other manufacturers).
|
||||
|
||||
If your device doesn't use the default keys (i.e. 3-rd party firmware doesn't boot up, or it hangs on bootloader logs),
|
||||
you can try using this firmware file to extract the keys from the bootloader.
|
||||
|
||||
## Why this works (and when it doesn't)
|
||||
|
||||
The bootloader has its own copy of the keys. It uses that to encrypt firmware on-the-fly when applying OTA updates.
|
||||
|
||||
Files downloaded during an OTA update are *not* encrypted using the main encryption keys, so the bootloader
|
||||
must encrypt them before flashing to the app partition. **This method works by flashing firmware directly to the**
|
||||
**OTA partition**. It is then unpacked and encrypted properly by the bootloader.
|
||||
|
||||
However, OTA update packages *are* encrypted using AES - for this method to work, the AES key must be known in advance.
|
||||
|
||||
Most of the time, a simple `0123456789ABCDEF` key is used for OTA AES. We have seen manufacturers using different
|
||||
keys - this method will not work in that case.
|
||||
|
||||
Additionally, OTA packages **don't have to** be encrypted - some bootloaders allow that, some don't. Using an
|
||||
unencrypted package is worth trying if your device uses a non-standard OTA AES key.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. A working computer with a working UART flashing setup. The preferred flashing tool is
|
||||
[ltchiptool](../../flashing/tools/ltchiptool.md). You should have at least some prior experience with dumping
|
||||
or flashing firmware.
|
||||
2. **A full factory firmware dump** of the device you're working on. This is mostly in case something goes wrong,
|
||||
but may also be necessary to read OTA partition offsets from.
|
||||
3. A serial terminal (such as the [`ltchiptool-terminal`](https://github.com/libretiny-eu/ltchiptool-terminal) plugin).
|
||||
|
||||
## To be continued
|
||||
@@ -27,6 +27,8 @@ Resources:
|
||||
include-markdown "../../inc/find-board.md"
|
||||
%}
|
||||
|
||||
---
|
||||
|
||||
## Flashing
|
||||
|
||||
Realtek RTL8710B has two UART ports - UART2 (sometimes called LOG_UART) and UART0. The port used for flashing and viewing logs is UART2.
|
||||
@@ -54,6 +56,10 @@ GND | GND
|
||||
|
||||
In order to flash the chip, you need to enable **download mode**. This is done by resetting the chip while pulling down the TX2 pin.
|
||||
|
||||
{%
|
||||
include-markdown "../../inc/uart-cen.md"
|
||||
%}
|
||||
|
||||
Do this, in order:
|
||||
|
||||
- connect CEN to GND
|
||||
@@ -61,10 +67,6 @@ Do this, in order:
|
||||
- release CEN from GND
|
||||
- release TX2 from GND
|
||||
|
||||
{%
|
||||
include-markdown "../../inc/uart-cen.md"
|
||||
%}
|
||||
|
||||
To find out whether download mode is enabled, open a serial terminal (such as PuTTY) on your PC. You should see a few characters printed to the serial console every second (usually some kind of grey blocks, or other non-letter characters).
|
||||
|
||||
Note that you will not see any characters before you release TX2 from GND.
|
||||
@@ -86,7 +88,9 @@ The recommended tool to flash (or dump firmware) is `ltchiptool`.
|
||||
!!! tip
|
||||
Because the UART uploading code is programmed in the ROM of the chip, it can't be software-bricked, even if you damage the bootloader.
|
||||
|
||||
### Auto-download-reboot
|
||||
---
|
||||
|
||||
## Auto-download-reboot
|
||||
|
||||
{%
|
||||
include-markdown "../../inc/uart-adr.md"
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
!!! tip
|
||||
See the [Cloudcutter video guide](https://www.youtube.com/watch?v=sSj8f-HCHQ0) for a complete tutorial on flashing with [Cloudcutter](https://github.com/tuya-cloudcutter/tuya-cloudcutter) and installing LibreTiny-ESPHome. **Includes Home Assistant Add-On setup.**
|
||||
|
||||
Because ESPHome does not natively support running on non-ESP chips, you need to use a fork of the project.
|
||||
LibreTiny is now natively supported by ESPHome in versions 2023.9.0 and later.
|
||||
|
||||
There are three basic ways to install and use LibreTiny-ESPHome. You can choose the option that best suits you:
|
||||
There are three basic ways to install and use ESPHome. You can choose the option that best suits you:
|
||||
|
||||
- ESPHome Dashboard (GUI) - for new users, might be an easy way to go; config management & compilation using web-based dashboard
|
||||
- command line (CLI) - for more experienced users; compilation using CLI commands, somewhat easier to troubleshoot
|
||||
- [Home Assistant Add-On](https://github.com/libretiny-eu/esphome-hass-addon/pkgs/container/libretiny-esphome-hassio) - using LibreTiny-ESPHome in Home Assistant, alongside your normal ESPHome installation - click the link for more info
|
||||
- Home Assistant Add-On - using ESPHome in Home Assistant as an add-on
|
||||
|
||||
!!! tip
|
||||
You can use LibreTiny-ESPHome for ESP32/ESP8266 compilation as well - the forked version *extends* the base, and doesn't remove any existing features. Keep in mind that you might not have latest ESPHome updates until the fork gets updated (which usually happens at most every few weeks).
|
||||
!!! warning "Important"
|
||||
If you have the LibreTiny-ESPHome add-on installed in Home Assistant, migrate your YAML files over to the official ESPHome add-on.
|
||||
|
||||
The standalone add-on is now deprecated - after migrating your configs, uninstall the old add-on.
|
||||
|
||||
## Find your device's board
|
||||
|
||||
@@ -33,8 +35,8 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
|
||||
version: "3"
|
||||
services:
|
||||
esphome:
|
||||
container_name: esphome-libretiny
|
||||
image: docker pull ghcr.io/libretiny-eu/libretiny-esphome-docker:latest
|
||||
container_name: esphome
|
||||
image: ghcr.io/esphome/esphome:latest
|
||||
volumes:
|
||||
- ./configs:/config:rw # (1)!
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
@@ -51,20 +53,15 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
|
||||
!!! important
|
||||
Read [Getting started](../getting-started/README.md) first - most importantly, the first part about installation.
|
||||
|
||||
**It is very important that you have the latest version of LibreTiny installed** (not `libretiny-esphome` - this is a different thing!) **so that you don't face issues that are already resolved**.
|
||||
|
||||
Assuming you have PlatformIO, git and Python installed:
|
||||
|
||||
1. Open a terminal/cmd.exe, create `esphome` directory and `cd` into it.
|
||||
2. `git clone https://github.com/kuba2k2/libretiny-esphome`
|
||||
3. `cd` into the newly created `libretiny-esphome` directory.
|
||||
1. Open a terminal/cmd.exe
|
||||
2. `git clone https://github.com/esphome/esphome`
|
||||
3. `cd` into the newly created `esphome` directory.
|
||||
4. Check if it works by typing `python -m esphome`
|
||||
|
||||
!!! tip
|
||||
For Linux users (or if `python -m esphome` doesn't work for you):
|
||||
|
||||
- uninstall ESPHome first: `pip uninstall esphome`
|
||||
- install the forked version: `pip install -e .`
|
||||
You can alternately install ESPHome CLI using pip with `pip install esphome`
|
||||
|
||||
## Create your device config
|
||||
|
||||
@@ -74,11 +71,11 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
|
||||
2. Go through the wizard steps:
|
||||
- `New Device`
|
||||
- `Continue`
|
||||
- enter name and WiFi details
|
||||
- choose `LibreTiny`
|
||||
- choose the board that you found before
|
||||
- enter name and WiFi details (first time only)
|
||||
- LibreTiny will not currently be listed as an option, choose any of the boards and you will overwrite them later
|
||||
- select `Skip`
|
||||
3. A new config file will be added. Press `Edit` and proceed to the next section.
|
||||
4. Delete the entire generated configuration and replace it with the example configuration below or one generated by [UPK2ESPHome](https://upk.libretiny.eu/).
|
||||
|
||||
=== "CLI"
|
||||
|
||||
@@ -95,17 +92,15 @@ If your board isn't listed, use one of the **Generic** boards, depending on the
|
||||
version: latest
|
||||
|
||||
logger:
|
||||
web_server:
|
||||
captive_portal:
|
||||
api:
|
||||
password: ""
|
||||
ota:
|
||||
password: ""
|
||||
|
||||
wifi:
|
||||
ssid: "YourWiFiSSID"
|
||||
password: "SecretPa$$w0rd"
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
ap:
|
||||
ssid: "Yourdevice Fallback Hotspot"
|
||||
password: "Dv2hZMGZRUvy"
|
||||
```
|
||||
|
||||
## Automatically generate config
|
||||
@@ -149,6 +144,7 @@ bk72xx:
|
||||
LT_UART_DEFAULT_PORT: 2
|
||||
LT_UART_SILENT_ALL: 0
|
||||
```
|
||||
|
||||
(this is only an example)
|
||||
|
||||
Additionally, few options have their dedicated keys:
|
||||
@@ -166,4 +162,37 @@ bk72xx:
|
||||
# set to false if you want to attach a debugger
|
||||
gpio_recover: true
|
||||
```
|
||||
|
||||
(these values are defaults)
|
||||
|
||||
## Advanced: Using development versions with ESPHome
|
||||
|
||||
There are a two ways to use development versions of LibreTiny with ESPHome:
|
||||
|
||||
- `version` is a required field, and must match a specific format, it is recommended to use `"0.0.0"` for custom development
|
||||
- `source` must point to where your development version of LibreTiny resides.
|
||||
|
||||
=== "Git"
|
||||
|
||||
```yaml
|
||||
bk72xx:
|
||||
framework:
|
||||
version: "0.0.0"
|
||||
source: "https://github.com/libretiny-eu/libretiny"
|
||||
```
|
||||
|
||||
Source can be post-fixed to checkout a specified branch or a Pull Request:
|
||||
|
||||
- Branch: add `#branch_name` (ex: `source: "https://github.com/libretiny-eu/libretiny#experimental_branch_name"`)
|
||||
- Pull Requests: Pull requests currently require you to check out the source branch of the pull request. To get this information, visit the PR, click on the source branch, and copy their git address and apply the branch their PR uses (ex: `https://github.com/pr_user/libretiny#pr_branch`)
|
||||
|
||||
=== "Local"
|
||||
|
||||
Check out with Git (recommended) or download and extract a copy of LibreTiny to your local file system running ESPHome.
|
||||
|
||||
```yaml
|
||||
bk72xx:
|
||||
framework:
|
||||
version: "0.0.0"
|
||||
source: "/local_path_to_libretiny"
|
||||
```
|
||||
|
||||
@@ -4,4 +4,5 @@ mkdocs-literate-nav==0.5.0
|
||||
mkdocs-section-index
|
||||
mkdocs-include-markdown-plugin
|
||||
mkdocs-git-revision-date-localized-plugin
|
||||
-e git+https://github.com/kuba2k2/mkdoxy#egg=mkdoxy
|
||||
-e git+https://github.com/libretiny-eu/mkdoxy#egg=mkdoxy
|
||||
mkdocs-redirects
|
||||
|
||||
@@ -2,14 +2,21 @@
|
||||
|
||||
Device configuration (`user_param_key`) can be extracted to JSON, using bk7231tools from a full firmware dump.
|
||||
|
||||
Originally posted [by @blakadder](https://discord.com/channels/967863521511608370/983843871320580096/1059286760074530947) on Discord channel #resources, modified by me to include more keys and values.
|
||||
Also see:
|
||||
|
||||
- [UPK2ESPHome](https://upk.libretiny.eu/)
|
||||
|
||||
Sources:
|
||||
|
||||
- [`tuya_demo_light_pwm`](https://github.com/tuya/tuya-iotos-embeded-sdk-wifi-ble-bk7231n/blob/master/apps/tuya_demo_light_pwm/include/common/device_config_load.h) for *Lights/bulbs*
|
||||
- Original post [by @blakadder](https://discord.com/channels/967863521511608370/983843871320580096/1059286760074530947) on Discord channel #resources
|
||||
|
||||
Key(s) | Meaning | Possible values
|
||||
--------------------------------------------|---------------------------------------|---------------------------------------------------------
|
||||
`crc` | |
|
||||
`module` | |
|
||||
`category` | |
|
||||
`Jsonver`<br>`jv` | |
|
||||
--------------------------------------------|---------------------------------------|---------------------------------------------------------------------------------------
|
||||
`crc` | UPK data checksum |
|
||||
`module` | Tuya module used | `CB3S` / `WB3S` / `CBU`, etc.
|
||||
`category` | Device type as a number | 0502 - CW light<br>0505 - RGBCW light
|
||||
`Jsonver`<br>`jv` | "JSON" version |
|
||||
**Common** | |
|
||||
`netled_pin`<br>`netled1_pin`<br>`wfst_pin` | Status LED for WiFi |
|
||||
`netled_lv`<br>`netled1_lv`<br>`wfst_lv` | Status LED Active Level | 0 - Active low<br>1 - Active high
|
||||
@@ -20,27 +27,30 @@ Key(s) | Meaning
|
||||
`iicsda` | I²C SDA Pin |
|
||||
`net_trig` | |
|
||||
`net_type` | |
|
||||
`wfcfg` | | `spcl` / `spcl_auto` / `prod`
|
||||
`wfct` | |
|
||||
**Lights/bulbs** | |
|
||||
`cmod` | Color Mode | `rgbcw` / `rgb` / `cw` / `c` / `rgbc`
|
||||
`cwtype` | |
|
||||
`brightmin`, `brightmax` | Min/Max Brightness | 0%-100%
|
||||
`cwmin`, `cwmax` | Cold-Warm Min/Max Brightness | 0%-100%
|
||||
`cwmaxp` | Cold-Warm Max Power | 0%-100%
|
||||
`colormin`, `colormax` | RGB Min/Max Brightness | 0%-100%
|
||||
`colormaxp` | RGB Max Power | 0%-100%
|
||||
`brightstep`<br>`bristep` | Brightness Step |
|
||||
`defbright` | Default Brightness | 0%-100%
|
||||
`dmod` | Light driver type | 0 - PWM<br>1 - SM16726B<br>2 - SM2135E<br>3 - SM2135EH<br>4 - SM2135EJ<br>5 - BP1658CJ<br>6 - BP5758D<br>7 - SM2235/2335
|
||||
`cwtype` | Color temperature driver | 0 - cool and warm white (CW)<br>1 - correlated color temperature (CCT)
|
||||
`onoffmode` | On/off gradient enabled | 0 / 1
|
||||
`pmemory` | Power-off memory enabled | 0 / 1
|
||||
`defcolor` | Default Color | `c` / `r`
|
||||
`deftemp` | Default Color Temperature |
|
||||
`defbright` | Default Brightness | 0%-100%
|
||||
`deftemp` | Default Color Temperature | 0-100 when defcolor is cool white
|
||||
`cwmaxp` | Cold-Warm Max Power | 100-200 with a pitch of 10
|
||||
`brightmin`, `brightmax` | Min/Max Brightness | 0%-100%
|
||||
`colormin`, `colormax` | RGB Min/Max Brightness | 0%-100%
|
||||
`cwmin`, `cwmax` | Cold-Warm Min/Max Brightness | 0%-100%
|
||||
`colormaxp` | RGB Max Power | 0%-100%
|
||||
`colorpfun` | Color mixing power limit enabled | 0 / 1
|
||||
`brightstep`<br>`bristep` | Brightness Step |
|
||||
`hsvstep` | |
|
||||
`rgbt` | Used in prod.tests, not relevant |
|
||||
`title20` | "title20/T20" supported | 0 / 1
|
||||
**Gamma correction** | |
|
||||
`gmr`, `gmg`, `gmb` | |
|
||||
`gmkr`, `gmkg`, `gmkb` | |
|
||||
`gmwr`, `gmwg`, `gmwb` | |
|
||||
`hsvstep` | |
|
||||
`rgbt` | |
|
||||
`rstbr` | |
|
||||
`rstcor` | | `c`/`r`
|
||||
`rsttemp` | |
|
||||
**PWM Lights** | |
|
||||
`r_pin` + `r_lv` | Red Channel Pin + Active Level |
|
||||
`g_pin` + `g_lv` | Green Channel Pin + Active Level |
|
||||
@@ -52,8 +62,8 @@ Key(s) | Meaning
|
||||
`dccur`<br>`ehccur`<br>`cjccur` | Cold White Current |
|
||||
`dwcur`<br>`ehwcur`<br>`cjwcur` | Warm White Current |
|
||||
`drgbcur` | RGB Current |
|
||||
`campere` | |
|
||||
`wampere` | |
|
||||
`campere` | Max current of SM2135 colored output | 10-45 with a pitch of 5 and defaults to 20
|
||||
`wampere` | Max current of SM2135 white output | 10-80 with a pitch of 5 and defaults to 30
|
||||
`iicr` | Red Channel Number | 0-5
|
||||
`iicg` | Green Channel Number | 0-5
|
||||
`iicb` | Blue Channel Number | 0-5
|
||||
@@ -72,7 +82,7 @@ Key(s) | Meaning
|
||||
`rl_drvtime` | |
|
||||
`total_bt_pin` + `total_bt_lv` | |
|
||||
**Power monitoring** | |
|
||||
`ele_fun_en` | Power Monitoring Enabled | 1
|
||||
`ele_fun_en` | Power Monitoring Enabled | 0 / 1
|
||||
`chip_type` | Power Monitoring Chip Type | 0 - BL0937<br>1 - HLW8012<br>2 - HLW8032<br>4 - BL0942
|
||||
`ele_pin` | CF Pin |
|
||||
`vi_pin` | CF1 Pin |
|
||||
@@ -84,7 +94,7 @@ Key(s) | Meaning
|
||||
`vol_def` | Socket operating voltage | 0 - 220V<br>1 - 110V
|
||||
`work_voltage` | Socket operating voltage |
|
||||
**Infrared** | |
|
||||
`irfunc` | IR Function | 0, 1
|
||||
`irfunc` | IR Function enabled | 0 / 1
|
||||
`infre` | IR Transmitter Pin |
|
||||
`infrr`<br>`ir` | IR Receiver Pin |
|
||||
`irkXfun` + `irkXval` | IR Key X Function + Value | X in 1..30
|
||||
@@ -93,14 +103,20 @@ Key(s) | Meaning
|
||||
`wgmod`, `swgmod`, `scgmod` | |
|
||||
**PIR** | |
|
||||
`pirmod` | |
|
||||
`pirfreq` | |
|
||||
`pirlduty` | |
|
||||
`pirmduty` | |
|
||||
`pirhduty` | |
|
||||
`pirin_pin` + `pirin_lv` | |
|
||||
`pirsense_pin` + `pirsense_lv` | |
|
||||
`pirfreq` | PWM Operating Frequency (Hz) for PIR | 1000
|
||||
`pirlduty` | | 100
|
||||
`pirmduty` | | 50
|
||||
`pirhduty` | | 0
|
||||
`pirin_pin` + `pirin_lv` | Motion reporting GPIO + Active Level |
|
||||
`pirsense_pin` + `pirsense_lv` | PIR sensitivity (PWM) + Active Level |
|
||||
`pirrange` | |
|
||||
`pirwarn` | |
|
||||
**Ambient light sensor** | |
|
||||
`day` | Value to compare against ADC readout | ADC value range (0-3300)
|
||||
`dusk` | Value to compare against ADC readout | ADC value range (0-3300)
|
||||
`evenfall` | Value to compare against ADC readout | ADC value range (0-3300)
|
||||
`evening` | Value to compare against ADC readout | ADC value range (0-3300)
|
||||
`night` | Value to compare against ADC readout | ADC value range (0-3300)
|
||||
**Key-controlled** | |
|
||||
`key_pin` + `key_lv` | Key Pin + Active Level |
|
||||
`kXpin_pin` + `kXpin_lv` | |
|
||||
@@ -109,9 +125,23 @@ Key(s) | Meaning
|
||||
`keyccfg1`, `keyccfg2` | |
|
||||
`keyfunc`, `keyglobefunc` | |
|
||||
`keylt`, `keynumber` | |
|
||||
**Pairing-related** | |
|
||||
`wfcfg` | Wi-Fi pairing config | `spcl` / `spcl_auto` / `prod` / `old` / `low`
|
||||
`remdmode` | "light reset pairing mode" | 0 / 1
|
||||
`rstnum` | On/off cycles to reset |
|
||||
`rstcor` | Light color while connecting | `c` / `r`
|
||||
`rstbr` | Light brightness while connecting | 10-100
|
||||
`rsttemp` | Light temperature while connecting | 0-100
|
||||
`remdtime` | Pairing mode timeout | seconds
|
||||
`wfptime` | Light pairing time | minutes
|
||||
`cagt` | Used in prod.tests, not relevant | N/A
|
||||
`prodagain` | Used in prod.tests, not relevant | 0 / 1
|
||||
`rstmode` | Pairing related - not relevant |
|
||||
`pairt` | Pairing related - not relevant | 6-600
|
||||
`wt` | Used in prod.tests, not relevant | N/A
|
||||
**Other** | |
|
||||
`buzzer_pwm` | Buzzer working PWM frequency |
|
||||
`ismusic` | | 0, 1
|
||||
`ismusic` | | 0 / 1
|
||||
`ledX_pin` + `ledX_lv` | LED X Pin + Active Level |
|
||||
`led_pin` + `led_lv` | LED Pin + Active Level |
|
||||
**Unknown** | |
|
||||
@@ -127,7 +157,6 @@ Key(s) | Meaning
|
||||
`bleonoff` | |
|
||||
`blindt` | |
|
||||
`buzzer` | |
|
||||
`cagt` | |
|
||||
`cctseg` | |
|
||||
`cd_flag2` | |
|
||||
`cdsval` | |
|
||||
@@ -138,24 +167,18 @@ Key(s) | Meaning
|
||||
`ch_num` | |
|
||||
`clean_t` | |
|
||||
`cntdown1` | |
|
||||
`colorpfun` | |
|
||||
`ctrl_lv` | |
|
||||
`ctrl_pin` | |
|
||||
`customcode` | |
|
||||
`cyc_dpid` | |
|
||||
`day` | |
|
||||
`dctrl_select` | |
|
||||
`dimmod` | |
|
||||
`dimt` | |
|
||||
`dimval` | |
|
||||
`dmod` | |
|
||||
`door1_magt_lv` | |
|
||||
`door1_magt_pin` | |
|
||||
`door_alarm_st1` | |
|
||||
`door_mag1` | |
|
||||
`dusk` | |
|
||||
`evenfall` | |
|
||||
`evening` | |
|
||||
`ffc_select` | |
|
||||
`inch_dp` | |
|
||||
`indep_cfgbt` | |
|
||||
@@ -176,11 +199,10 @@ Key(s) | Meaning
|
||||
`netnc` | |
|
||||
`nety_led` | |
|
||||
`netyc` | |
|
||||
`night` | |
|
||||
`nightbrig` | |
|
||||
`nightcct` | |
|
||||
`nightled` | |
|
||||
`notdisturb` | |
|
||||
`notdisturb` | Do not disturb (DND) mode enabled | 0 / 1
|
||||
`on_off_cnt` | |
|
||||
`onoff1` | |
|
||||
`onoff_clear_t` | |
|
||||
@@ -188,23 +210,16 @@ Key(s) | Meaning
|
||||
`onoff_rst_m` | |
|
||||
`onoff_rst_type` | |
|
||||
`onoff_type` | |
|
||||
`onoffmode` | |
|
||||
`onofftime` | |
|
||||
`owm` | |
|
||||
`pairt` | |
|
||||
`pmemory` | |
|
||||
`preheatt` | |
|
||||
`prodagain` | |
|
||||
`rand_dpid` | |
|
||||
`remdmode` | |
|
||||
`remote_add_dp` | |
|
||||
`remote_list_dp` | |
|
||||
`remote_select` | |
|
||||
`resistor` | |
|
||||
`reuse_led_m` | |
|
||||
`rsthold` | |
|
||||
`rstmode` | |
|
||||
`rstnum` | |
|
||||
`scenespct` | |
|
||||
`series_ctrl` | |
|
||||
`sfunc` | |
|
||||
@@ -214,7 +229,6 @@ Key(s) | Meaning
|
||||
`switch1` | |
|
||||
`tempmix` | |
|
||||
`tempstep` | |
|
||||
`title20` | |
|
||||
`total_stat` | |
|
||||
`tracetime1` | |
|
||||
`trigdelay` | |
|
||||
@@ -223,5 +237,4 @@ Key(s) | Meaning
|
||||
`voice_ctrl1` | |
|
||||
`voice_ctrl_set1` | |
|
||||
`whiteseg` | |
|
||||
`wt` | |
|
||||
`zero_select` | |
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-05-31.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
while os.getcwd() in sys.path:
|
||||
sys.path.remove(os.getcwd())
|
||||
|
||||
import re
|
||||
from os.path import dirname, isfile, join
|
||||
|
||||
@@ -48,19 +54,41 @@ def get_families_json() -> dict[str, int]:
|
||||
}
|
||||
|
||||
|
||||
def get_mcus_boards(boards: list[Board]) -> dict[str, str]:
|
||||
def get_mcus_boards(boards: list[Board], aliases: dict[str, str]) -> dict[str, str]:
|
||||
out = {}
|
||||
for board in boards:
|
||||
mcu_name: str = board["build.mcu"].upper()
|
||||
family_name: str = board.family.short_name
|
||||
|
||||
def check_mcu(mcu_name, family_name):
|
||||
if mcu_name in out and out[mcu_name] != family_name:
|
||||
print(
|
||||
Fore.RED
|
||||
+ f"ERROR: MCU '{mcu_name}' of board '{board.name}' belongs to multiple families: '{out[mcu_name]}' and '{family_name}'"
|
||||
+ Style.RESET_ALL
|
||||
+ Style.RESET_ALL,
|
||||
file=sys.stderr,
|
||||
)
|
||||
continue
|
||||
out[mcu_name] = family_name
|
||||
|
||||
for board in boards:
|
||||
mcu_name: str = board["build.mcu"].upper()
|
||||
mcu_alias: str = board["doc.mcu"]
|
||||
family_name: str = board.family.short_name
|
||||
check_mcu(mcu_name, family_name)
|
||||
if mcu_alias:
|
||||
mcu_alias = mcu_alias.upper()
|
||||
check_mcu(mcu_alias, family_name)
|
||||
if mcu_alias not in aliases:
|
||||
print(
|
||||
Fore.RED
|
||||
+ f"ERROR: MCU alias '{mcu_alias}' of board '{board.name}' is not defined in enum"
|
||||
+ Style.RESET_ALL,
|
||||
file=sys.stderr,
|
||||
)
|
||||
elif aliases[mcu_alias] != mcu_name:
|
||||
print(
|
||||
Fore.RED
|
||||
+ f"ERROR: MCU alias '{mcu_alias}' of board '{board.name}' doesn't match real name '{mcu_name}'"
|
||||
+ Style.RESET_ALL,
|
||||
file=sys.stderr,
|
||||
)
|
||||
return out
|
||||
|
||||
|
||||
@@ -315,7 +343,8 @@ if __name__ == "__main__":
|
||||
print(
|
||||
Fore.RED
|
||||
+ f"ERROR: Invalid build.variant of '{board['source']}': '{board.name}'"
|
||||
+ Style.RESET_ALL
|
||||
+ Style.RESET_ALL,
|
||||
file=sys.stderr,
|
||||
)
|
||||
errors = True
|
||||
|
||||
@@ -323,8 +352,8 @@ if __name__ == "__main__":
|
||||
families_enum = get_families_enum(code)
|
||||
families_json_keys = set(families_json.keys())
|
||||
families_enum_keys = set(families_enum.keys())
|
||||
mcus_boards = get_mcus_boards(boards)
|
||||
mcus_enum, mcu_aliases = get_mcus_enum(code)
|
||||
mcus_boards = get_mcus_boards(boards, mcu_aliases)
|
||||
mcus_boards_keys = set(mcus_boards.keys())
|
||||
mcus_enum_keys = set(mcus_enum.keys())
|
||||
mcus_missing_in_boards = mcus_enum_keys - mcus_boards_keys
|
||||
@@ -332,14 +361,19 @@ if __name__ == "__main__":
|
||||
|
||||
# check if all families are defined in lt_types.h and families.json
|
||||
if families_json_keys != families_enum_keys:
|
||||
print(Fore.RED + f"ERROR: Inconsistent lt_types.h vs families.json:")
|
||||
print(
|
||||
"- Missing in JSON: " + ", ".join(families_enum_keys - families_json_keys)
|
||||
Fore.RED + f"ERROR: Inconsistent lt_types.h vs families.json:",
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(
|
||||
"- Missing in enum: " + ", ".join(families_json_keys - families_enum_keys)
|
||||
"- Missing in JSON: " + ", ".join(families_enum_keys - families_json_keys),
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(Style.RESET_ALL, end="")
|
||||
print(
|
||||
"- Missing in enum: " + ", ".join(families_json_keys - families_enum_keys),
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(Style.RESET_ALL, end="", file=sys.stderr)
|
||||
errors = True
|
||||
|
||||
# verify that family IDs match
|
||||
@@ -352,7 +386,8 @@ if __name__ == "__main__":
|
||||
print(
|
||||
Fore.RED
|
||||
+ f"ERROR: Family ID mismatch for '{family}': 0x{families_json[family]:08X} vs 0x{families_enum[family]:08X}"
|
||||
+ Style.RESET_ALL
|
||||
+ Style.RESET_ALL,
|
||||
file=sys.stderr,
|
||||
)
|
||||
errors = True
|
||||
|
||||
@@ -371,7 +406,8 @@ if __name__ == "__main__":
|
||||
Fore.RED
|
||||
+ f"ERROR: Undefined MCUs in lt_types.h: "
|
||||
+ ", ".join(mcus_missing_in_enum)
|
||||
+ Style.RESET_ALL
|
||||
+ Style.RESET_ALL,
|
||||
file=sys.stderr,
|
||||
)
|
||||
errors = True
|
||||
|
||||
@@ -385,7 +421,8 @@ if __name__ == "__main__":
|
||||
print(
|
||||
Fore.RED
|
||||
+ f"ERROR: MCU family mismatch for '{mcu}': '{mcus_boards[mcu]}' vs '{mcus_enum[mcu]}'"
|
||||
+ Style.RESET_ALL
|
||||
+ Style.RESET_ALL,
|
||||
file=sys.stderr,
|
||||
)
|
||||
errors = True
|
||||
|
||||
|
||||
17
mkdocs.yml
17
mkdocs.yml
@@ -2,7 +2,7 @@ site_name: LibreTiny
|
||||
docs_dir: .
|
||||
|
||||
site_url: https://docs.libretiny.eu/
|
||||
repo_url: https://github.com/kuba2k2/libretiny
|
||||
repo_url: https://github.com/libretiny-eu/libretiny
|
||||
|
||||
theme:
|
||||
name: material
|
||||
@@ -32,6 +32,19 @@ plugins:
|
||||
save-api: .
|
||||
- literate-nav:
|
||||
nav_file: SUMMARY.md
|
||||
- redirects:
|
||||
redirect_maps:
|
||||
"link/cloudcutter-video.md": 'https://www.youtube.com/watch?v=sSj8f-HCHQ0'
|
||||
"link/cloudcutter-digiblur.md": 'https://digiblur.com/2023/08/19/updated-tuya-cloudcutter-with-esphome-bk7231-how-to-guide/'
|
||||
"link/boards.md": "docs/status/supported.md"
|
||||
"link/gpio-access.md": "docs/getting-started/gpio.md"
|
||||
"link/config.md": "docs/dev/config.md"
|
||||
"link/config-debug.md": "docs/dev/config.md#per-module-logging-debugging"
|
||||
"link/config-serial.md": "docs/dev/config.md#serial-output"
|
||||
"link/flashing-beken-72xx.md": "docs/platform/beken-72xx/README.md#flashing"
|
||||
"link/flashing-realtek-ambz.md": "docs/platform/realtek-ambz/README.md#flashing"
|
||||
"link/bk72xx-keys.md": "docs/platform/beken-72xx/keys.md"
|
||||
"link/kickstart.md": "https://github.com/libretiny-eu/esphome-kickstart/releases/latest"
|
||||
- section-index
|
||||
- include-markdown
|
||||
- search
|
||||
@@ -54,6 +67,8 @@ markdown_extensions:
|
||||
anchor_linenums: true
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
- pymdownx.escapeall:
|
||||
hardbreak: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
"description": "PlatformIO development platform for IoT modules",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/kuba2k2/libretiny.git"
|
||||
"url": "https://github.com/libretiny-eu/libretiny.git"
|
||||
},
|
||||
"version": "1.3.0",
|
||||
"version": "1.5.0",
|
||||
"frameworks": {
|
||||
"base": {
|
||||
"title": "Base Framework (SDK only)",
|
||||
|
||||
90
platform.py
90
platform.py
@@ -1,12 +1,12 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-04-20.
|
||||
|
||||
import importlib
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import site
|
||||
import sys
|
||||
from os.path import dirname
|
||||
from subprocess import Popen
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
|
||||
import click
|
||||
@@ -15,73 +15,8 @@ from platformio.debug.exception import DebugInvalidOptionsError
|
||||
from platformio.package.meta import PackageItem
|
||||
from platformio.platform.base import PlatformBase
|
||||
from platformio.platform.board import PlatformBoardConfig
|
||||
from semantic_version import SimpleSpec, Version
|
||||
|
||||
LTCHIPTOOL_VERSION = "^4.2.3"
|
||||
|
||||
|
||||
# Install & import tools
|
||||
def check_ltchiptool(install: bool):
|
||||
if install:
|
||||
# update ltchiptool to a supported version
|
||||
print("Installing/updating ltchiptool")
|
||||
p = Popen(
|
||||
[
|
||||
sys.executable,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"-U",
|
||||
"--force-reinstall",
|
||||
f"ltchiptool >= {LTCHIPTOOL_VERSION[1:]}, < 5.0",
|
||||
],
|
||||
)
|
||||
p.wait()
|
||||
|
||||
# unload all modules from the old version
|
||||
for name, module in list(sorted(sys.modules.items())):
|
||||
if not name.startswith("ltchiptool"):
|
||||
continue
|
||||
del sys.modules[name]
|
||||
del module
|
||||
|
||||
# try to import it
|
||||
ltchiptool = importlib.import_module("ltchiptool")
|
||||
|
||||
# check if the version is known
|
||||
version = Version.coerce(ltchiptool.get_version()).truncate()
|
||||
if version in SimpleSpec(LTCHIPTOOL_VERSION):
|
||||
return
|
||||
if not install:
|
||||
raise ImportError(f"Version incompatible: {version}")
|
||||
|
||||
|
||||
def try_check_ltchiptool():
|
||||
install_modes = [False, True]
|
||||
exception = None
|
||||
for install in install_modes:
|
||||
try:
|
||||
check_ltchiptool(install)
|
||||
return
|
||||
except (ImportError, AttributeError) as ex:
|
||||
exception = ex
|
||||
print(
|
||||
"!!! Installing ltchiptool failed, or version outdated. "
|
||||
"Please install ltchiptool manually using pip. "
|
||||
f"Cannot continue. {type(exception).name}: {exception}"
|
||||
)
|
||||
raise exception
|
||||
|
||||
|
||||
try_check_ltchiptool()
|
||||
import ltchiptool
|
||||
|
||||
# Remove current dir so it doesn't conflict with PIO
|
||||
if dirname(__file__) in sys.path:
|
||||
sys.path.remove(dirname(__file__))
|
||||
|
||||
# Let ltchiptool know about LT's location
|
||||
ltchiptool.lt_set_path(dirname(__file__))
|
||||
site.addsitedir(Path(__file__).absolute().parent.joinpath("tools"))
|
||||
|
||||
|
||||
def get_os_specifiers():
|
||||
@@ -119,6 +54,12 @@ class LibretinyPlatform(PlatformBase):
|
||||
super().__init__(manifest_path)
|
||||
self.custom_opts = {}
|
||||
self.versions = {}
|
||||
self.verbose = (
|
||||
"-v" in sys.argv
|
||||
or "--verbose" in sys.argv
|
||||
or "PIOVERBOSE=1" in sys.argv
|
||||
or os.environ.get("PIOVERBOSE", "0") == "1"
|
||||
)
|
||||
|
||||
def print(self, *args, **kwargs):
|
||||
if not self.verbose:
|
||||
@@ -137,11 +78,8 @@ class LibretinyPlatform(PlatformBase):
|
||||
return spec
|
||||
|
||||
def configure_default_packages(self, options: dict, targets: List[str]):
|
||||
from ltchiptool.util.dict import RecursiveDict
|
||||
from libretiny import RecursiveDict
|
||||
|
||||
self.verbose = (
|
||||
"-v" in sys.argv or "--verbose" in sys.argv or "PIOVERBOSE=1" in sys.argv
|
||||
)
|
||||
self.print(f"configure_default_packages(targets={targets})")
|
||||
|
||||
pioframework = options.get("pioframework") or ["base"]
|
||||
@@ -298,19 +236,19 @@ class LibretinyPlatform(PlatformBase):
|
||||
return result
|
||||
|
||||
def update_board(self, board: PlatformBoardConfig):
|
||||
from libretiny import Board, Family, merge_dicts
|
||||
|
||||
if "_base" in board:
|
||||
board._manifest = ltchiptool.Board.get_data(board._manifest)
|
||||
board._manifest = Board.get_data(board._manifest)
|
||||
board._manifest.pop("_base")
|
||||
|
||||
if self.custom("board"):
|
||||
from ltchiptool.util.dict import merge_dicts
|
||||
|
||||
with open(self.custom("board"), "r") as f:
|
||||
custom_board = json.load(f)
|
||||
board._manifest = merge_dicts(board._manifest, custom_board)
|
||||
|
||||
family = board.get("build.family")
|
||||
family = ltchiptool.Family.get(short_name=family)
|
||||
family = Family.get(short_name=family)
|
||||
# add "frameworks" key with the default "base"
|
||||
board.manifest["frameworks"] = ["base"]
|
||||
# add "arduino" framework if supported
|
||||
|
||||
14
tools/libretiny/__init__.py
Normal file
14
tools/libretiny/__init__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2023-09-07.
|
||||
|
||||
from .board import Board
|
||||
from .dict import RecursiveDict, merge_dicts
|
||||
from .family import Family
|
||||
|
||||
# TODO refactor and remove all this from here
|
||||
|
||||
__all__ = [
|
||||
"Board",
|
||||
"Family",
|
||||
"RecursiveDict",
|
||||
"merge_dicts",
|
||||
]
|
||||
34
tools/libretiny/board.py
Normal file
34
tools/libretiny/board.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-07-29.
|
||||
|
||||
from typing import Union
|
||||
|
||||
from genericpath import isfile
|
||||
|
||||
from .dict import merge_dicts
|
||||
from .fileio import readjson
|
||||
from .lvm import lvm_load_json
|
||||
|
||||
|
||||
class Board:
|
||||
@staticmethod
|
||||
def get_data(board: Union[str, dict]) -> dict:
|
||||
if not isinstance(board, dict):
|
||||
if isfile(board):
|
||||
board = readjson(board)
|
||||
if not board:
|
||||
raise FileNotFoundError(f"Board not found: {board}")
|
||||
else:
|
||||
source = board
|
||||
board = lvm_load_json(f"boards/{board}.json")
|
||||
board["source"] = source
|
||||
if "_base" in board:
|
||||
base = board["_base"]
|
||||
if not isinstance(base, list):
|
||||
base = [base]
|
||||
result = {}
|
||||
for base_name in base:
|
||||
board_base = lvm_load_json(f"boards/_base/{base_name}.json")
|
||||
merge_dicts(result, board_base)
|
||||
merge_dicts(result, board)
|
||||
board = result
|
||||
return board
|
||||
65
tools/libretiny/dict.py
Normal file
65
tools/libretiny/dict.py
Normal file
@@ -0,0 +1,65 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-07-29.
|
||||
|
||||
from .obj import get, has, pop, set_
|
||||
|
||||
|
||||
class RecursiveDict(dict):
|
||||
def __init__(self, data: dict = None):
|
||||
if data:
|
||||
data = {
|
||||
key: RecursiveDict(value) if isinstance(value, dict) else value
|
||||
for key, value in data.items()
|
||||
}
|
||||
super().__init__(data)
|
||||
else:
|
||||
super().__init__()
|
||||
|
||||
def __getitem__(self, key):
|
||||
if "." not in key:
|
||||
return super().get(key, None)
|
||||
return get(self, key)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if "." not in key:
|
||||
return super().__setitem__(key, value)
|
||||
set_(self, key, value, newtype=RecursiveDict)
|
||||
|
||||
def __delitem__(self, key):
|
||||
if "." not in key:
|
||||
return super().pop(key, None)
|
||||
return pop(self, key)
|
||||
|
||||
def __contains__(self, key) -> bool:
|
||||
if "." not in key:
|
||||
return super().__contains__(key)
|
||||
return has(self, key)
|
||||
|
||||
def get(self, key, default=None):
|
||||
if "." not in key:
|
||||
return super().get(key, default)
|
||||
return get(self, key) or default
|
||||
|
||||
def pop(self, key, default=None):
|
||||
if "." not in key:
|
||||
return super().pop(key, default)
|
||||
return pop(self, key, default)
|
||||
|
||||
|
||||
def merge_dicts(d1, d2):
|
||||
# force RecursiveDict instances to be treated as regular dicts
|
||||
d1_type = dict if isinstance(d1, RecursiveDict) else type(d1)
|
||||
d2_type = dict if isinstance(d2, RecursiveDict) else type(d2)
|
||||
if d1 is not None and d1_type != d2_type:
|
||||
raise TypeError(f"d1 and d2 are of different types: {type(d1)} vs {type(d2)}")
|
||||
if isinstance(d2, list):
|
||||
if d1 is None:
|
||||
d1 = []
|
||||
d1.extend(merge_dicts(None, item) for item in d2)
|
||||
elif isinstance(d2, dict):
|
||||
if d1 is None:
|
||||
d1 = {}
|
||||
for key in d2:
|
||||
d1[key] = merge_dicts(d1.get(key, None), d2[key])
|
||||
else:
|
||||
d1 = d2
|
||||
return d1
|
||||
97
tools/libretiny/family.py
Normal file
97
tools/libretiny/family.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-06-02.
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from .lvm import lvm_load_json, lvm_path
|
||||
|
||||
LT_FAMILIES: List["Family"] = []
|
||||
|
||||
|
||||
@dataclass
|
||||
class Family:
|
||||
name: str
|
||||
parent: Union["Family", None]
|
||||
code: str
|
||||
description: str
|
||||
id: Optional[int] = None
|
||||
short_name: Optional[str] = None
|
||||
package: Optional[str] = None
|
||||
mcus: List[str] = field(default_factory=lambda: [])
|
||||
children: List["Family"] = field(default_factory=lambda: [])
|
||||
|
||||
# noinspection PyTypeChecker
|
||||
def __post_init__(self):
|
||||
if self.id:
|
||||
self.id = int(self.id, 16)
|
||||
self.mcus = set(self.mcus)
|
||||
|
||||
@classmethod
|
||||
def get_all(cls) -> List["Family"]:
|
||||
global LT_FAMILIES
|
||||
if LT_FAMILIES:
|
||||
return LT_FAMILIES
|
||||
families = lvm_load_json("families.json")
|
||||
LT_FAMILIES = [
|
||||
cls(name=k, **v) for k, v in families.items() if isinstance(v, dict)
|
||||
]
|
||||
# attach parents and children to all families
|
||||
for family in LT_FAMILIES:
|
||||
if family.parent is None:
|
||||
continue
|
||||
try:
|
||||
parent = next(f for f in LT_FAMILIES if f.name == family.parent)
|
||||
except StopIteration:
|
||||
raise ValueError(
|
||||
f"Family parent '{family.parent}' of '{family.name}' doesn't exist"
|
||||
)
|
||||
family.parent = parent
|
||||
parent.children.append(family)
|
||||
return LT_FAMILIES
|
||||
|
||||
@classmethod
|
||||
def get(
|
||||
cls,
|
||||
any: str = None,
|
||||
id: Union[str, int] = None,
|
||||
short_name: str = None,
|
||||
name: str = None,
|
||||
code: str = None,
|
||||
description: str = None,
|
||||
) -> "Family":
|
||||
if any:
|
||||
id = any
|
||||
short_name = any
|
||||
name = any
|
||||
code = any
|
||||
description = any
|
||||
if id and isinstance(id, str) and id.startswith("0x"):
|
||||
id = int(id, 16)
|
||||
for family in cls.get_all():
|
||||
if id and family.id == id:
|
||||
return family
|
||||
if short_name and family.short_name == short_name.upper():
|
||||
return family
|
||||
if name and family.name == name.lower():
|
||||
return family
|
||||
if code and family.code == code.lower():
|
||||
return family
|
||||
if description and family.description == description:
|
||||
return family
|
||||
if any:
|
||||
raise ValueError(f"Family not found - {any}")
|
||||
items = [hex(id) if id else None, short_name, name, code, description]
|
||||
text = ", ".join(filter(None, items))
|
||||
raise ValueError(f"Family not found - {text}")
|
||||
|
||||
@property
|
||||
def has_arduino_core(self) -> bool:
|
||||
if lvm_path().joinpath("cores", self.name, "arduino").is_dir():
|
||||
return True
|
||||
if self.parent:
|
||||
return self.parent.has_arduino_core
|
||||
return False
|
||||
|
||||
@property
|
||||
def target_package(self) -> Optional[str]:
|
||||
return self.package or self.parent and self.parent.target_package
|
||||
17
tools/libretiny/fileio.py
Normal file
17
tools/libretiny/fileio.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-06-10.
|
||||
|
||||
import json
|
||||
from json import JSONDecodeError
|
||||
from os.path import isfile
|
||||
from typing import Optional, Union
|
||||
|
||||
|
||||
def readjson(file: str) -> Optional[Union[dict, list]]:
|
||||
"""Read a JSON file into a dict or list."""
|
||||
if not isfile(file):
|
||||
return None
|
||||
with open(file, "r", encoding="utf-8") as f:
|
||||
try:
|
||||
return json.load(f)
|
||||
except JSONDecodeError:
|
||||
return None
|
||||
19
tools/libretiny/lvm.py
Normal file
19
tools/libretiny/lvm.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2023-3-18.
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, Union
|
||||
|
||||
json_cache: Dict[str, Union[list, dict]] = {}
|
||||
libretiny_path = Path(__file__).parents[2]
|
||||
|
||||
|
||||
def lvm_load_json(path: str) -> Union[list, dict]:
|
||||
if path not in json_cache:
|
||||
with libretiny_path.joinpath(path).open("rb") as f:
|
||||
json_cache[path] = json.load(f)
|
||||
return json_cache[path]
|
||||
|
||||
|
||||
def lvm_path() -> Path:
|
||||
return libretiny_path
|
||||
62
tools/libretiny/obj.py
Normal file
62
tools/libretiny/obj.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-06-02.
|
||||
|
||||
from enum import Enum
|
||||
from typing import Type
|
||||
|
||||
# The following helpers force using base dict class' methods.
|
||||
# Because RecursiveDict uses these helpers, this prevents it
|
||||
# from running into endless nested loops.
|
||||
|
||||
|
||||
def get(data: dict, path: str):
|
||||
if not isinstance(data, dict) or not path:
|
||||
return None
|
||||
if dict.__contains__(data, path):
|
||||
return dict.get(data, path, None)
|
||||
key, _, path = path.partition(".")
|
||||
return get(dict.get(data, key, None), path)
|
||||
|
||||
|
||||
def pop(data: dict, path: str, default=None):
|
||||
if not isinstance(data, dict) or not path:
|
||||
return default
|
||||
if dict.__contains__(data, path):
|
||||
return dict.pop(data, path, default)
|
||||
key, _, path = path.partition(".")
|
||||
return pop(dict.get(data, key, None), path, default)
|
||||
|
||||
|
||||
def has(data: dict, path: str) -> bool:
|
||||
if not isinstance(data, dict) or not path:
|
||||
return False
|
||||
if dict.__contains__(data, path):
|
||||
return True
|
||||
key, _, path = path.partition(".")
|
||||
return has(dict.get(data, key, None), path)
|
||||
|
||||
|
||||
def set_(data: dict, path: str, value, newtype=dict):
|
||||
if not isinstance(data, dict) or not path:
|
||||
return
|
||||
# can't use __contains__ here, as we're setting,
|
||||
# so it's obvious 'data' doesn't have the item
|
||||
if "." not in path:
|
||||
dict.__setitem__(data, path, value)
|
||||
else:
|
||||
key, _, path = path.partition(".")
|
||||
# allow creation of parent objects
|
||||
if key in data:
|
||||
sub_data = dict.__getitem__(data, key)
|
||||
else:
|
||||
sub_data = newtype()
|
||||
dict.__setitem__(data, key, sub_data)
|
||||
set_(sub_data, path, value)
|
||||
|
||||
|
||||
def str2enum(cls: Type[Enum], key: str):
|
||||
if not key:
|
||||
return None
|
||||
try:
|
||||
return next(e for e in cls if e.name.lower() == key.lower())
|
||||
except StopIteration:
|
||||
return None
|
||||
Reference in New Issue
Block a user