From b97825d552a5a55497b0b2baa0e38c6e5ff8620d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 14 Nov 2023 22:30:13 +0100 Subject: [PATCH] [boards] Add T112_V1.1 board, change scaling of small boards --- boards/_base/pcb/cb1s-test.json | 2 +- boards/_base/pcb/cb2l-test.json | 1 - boards/_base/pcb/cb2s-test.json | 1 - boards/_base/pcb/t102.json | 3 +- boards/_base/pcb/t112.json | 70 ++++++++++++++++ boards/_base/pcb/wa2.json | 2 +- boards/_base/pcb/wb2l-test.json | 1 - boards/_base/pcb/wb2s.json | 1 - boards/_base/pcb/wb3l.json | 2 +- boards/_base/pcb/wr2.json | 4 +- boards/_base/pcb/wr2e.json | 4 +- boards/_base/pcb/wr3n.json | 2 +- boards/t112-v1.1.json | 21 +++++ boards/templates/tuya2.json | 2 +- boards/templates/tuya2l.json | 2 +- boards/templates/tuyau.json | 2 +- boards/variants/t112-v1.1.c | 48 +++++++++++ boards/variants/t112-v1.1.h | 138 ++++++++++++++++++++++++++++++++ 18 files changed, 290 insertions(+), 16 deletions(-) create mode 100644 boards/_base/pcb/t112.json create mode 100644 boards/t112-v1.1.json create mode 100644 boards/variants/t112-v1.1.c create mode 100644 boards/variants/t112-v1.1.h diff --git a/boards/_base/pcb/cb1s-test.json b/boards/_base/pcb/cb1s-test.json index d7b3f9906..05e534208 100644 --- a/boards/_base/pcb/cb1s-test.json +++ b/boards/_base/pcb/cb1s-test.json @@ -1,6 +1,6 @@ { "pcb": { - "scale": 10, + "scale": 14, "test_pads": { "TSCK": "cb1s.back.sck.anchor", "TCSN": "cb1s.back.csn.anchor", diff --git a/boards/_base/pcb/cb2l-test.json b/boards/_base/pcb/cb2l-test.json index 160fcc0d7..4148cf484 100644 --- a/boards/_base/pcb/cb2l-test.json +++ b/boards/_base/pcb/cb2l-test.json @@ -1,6 +1,5 @@ { "pcb": { - "scale": 11, "test_pads": { "TRST": "cb2l.back.rst.anchor", "TRX1": "cb2l.back.u1_rxd.anchor", diff --git a/boards/_base/pcb/cb2s-test.json b/boards/_base/pcb/cb2s-test.json index 321b98080..d22bef664 100644 --- a/boards/_base/pcb/cb2s-test.json +++ b/boards/_base/pcb/cb2s-test.json @@ -1,6 +1,5 @@ { "pcb": { - "scale": 11, "test_pads": { "TTX2": "cb2s.back.u2_txd.anchor", "TRX2": "cb2s.back.u2_rxd.anchor", diff --git a/boards/_base/pcb/t102.json b/boards/_base/pcb/t102.json index b331806dd..58a86ac85 100644 --- a/boards/_base/pcb/t102.json +++ b/boards/_base/pcb/t102.json @@ -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 diff --git a/boards/_base/pcb/t112.json b/boards/_base/pcb/t112.json new file mode 100644 index 000000000..0bcb3a1ba --- /dev/null +++ b/boards/_base/pcb/t112.json @@ -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 + } + } + } +} diff --git a/boards/_base/pcb/wa2.json b/boards/_base/pcb/wa2.json index 181cb80f1..55e1fe7d5 100644 --- a/boards/_base/pcb/wa2.json +++ b/boards/_base/pcb/wa2.json @@ -1,6 +1,6 @@ { "pcb": { - "scale": 10.5, + "scale": 11, "templates": [ "tuya2", "pcb-blue-light", diff --git a/boards/_base/pcb/wb2l-test.json b/boards/_base/pcb/wb2l-test.json index cffdc3f06..265cc9539 100644 --- a/boards/_base/pcb/wb2l-test.json +++ b/boards/_base/pcb/wb2l-test.json @@ -1,6 +1,5 @@ { "pcb": { - "scale": 11, "test_pads": { "TRST": "wb2l.back.rst.anchor", "TRX1": "wb2l.back.u1_rxd.anchor", diff --git a/boards/_base/pcb/wb2s.json b/boards/_base/pcb/wb2s.json index 45d1a7453..a47d327a8 100644 --- a/boards/_base/pcb/wb2s.json +++ b/boards/_base/pcb/wb2s.json @@ -1,6 +1,5 @@ { "pcb": { - "scale": 10.5, "templates": [ "tuya2", "pcb-blue-light", diff --git a/boards/_base/pcb/wb3l.json b/boards/_base/pcb/wb3l.json index 85e197b63..75247f5a0 100644 --- a/boards/_base/pcb/wb3l.json +++ b/boards/_base/pcb/wb3l.json @@ -9,7 +9,7 @@ "vars": { "PINHOLE": 0 }, - "pinout_hidden": "I2S,SD,SPI", + "pinout_hidden": "I2S,SD", "pinout": { "1": { "NC": null diff --git a/boards/_base/pcb/wr2.json b/boards/_base/pcb/wr2.json index ccb957fa7..2988706eb 100644 --- a/boards/_base/pcb/wr2.json +++ b/boards/_base/pcb/wr2.json @@ -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 diff --git a/boards/_base/pcb/wr2e.json b/boards/_base/pcb/wr2e.json index 44f380de2..91316d5a7 100644 --- a/boards/_base/pcb/wr2e.json +++ b/boards/_base/pcb/wr2e.json @@ -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 diff --git a/boards/_base/pcb/wr3n.json b/boards/_base/pcb/wr3n.json index d93d90878..6686f1b1b 100644 --- a/boards/_base/pcb/wr3n.json +++ b/boards/_base/pcb/wr3n.json @@ -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 diff --git a/boards/t112-v1.1.json b/boards/t112-v1.1.json new file mode 100644 index 000000000..548be1dd3 --- /dev/null +++ b/boards/t112-v1.1.json @@ -0,0 +1,21 @@ +{ + "_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" + }, + "pcb": { + "symbol": "T112_V1.1" + } +} diff --git a/boards/templates/tuya2.json b/boards/templates/tuya2.json index ca2f0e705..e7f11a76f 100644 --- a/boards/templates/tuya2.json +++ b/boards/templates/tuya2.json @@ -37,7 +37,7 @@ }, { "type": "text", - "pos": "7.0,5.0", + "pos": "6.0,5.5", "text": "${SYMBOL}", "font_size": 1.0, "fill": { diff --git a/boards/templates/tuya2l.json b/boards/templates/tuya2l.json index c99134239..8098c9301 100644 --- a/boards/templates/tuya2l.json +++ b/boards/templates/tuya2l.json @@ -39,7 +39,7 @@ }, { "type": "text", - "pos": "4.0,5.5", + "pos": "6.0,5.5", "text": "${SYMBOL}", "font_size": 1.0, "fill": { diff --git a/boards/templates/tuyau.json b/boards/templates/tuyau.json index 5ee814e60..7fe5aec89 100644 --- a/boards/templates/tuyau.json +++ b/boards/templates/tuyau.json @@ -79,7 +79,7 @@ }, { "type": "text", - "pos": "4.0,5.5", + "pos": "6.5,5.0", "text": "${SYMBOL}", "font_size": 1.0, "fill": { diff --git a/boards/variants/t112-v1.1.c b/boards/variants/t112-v1.1.c new file mode 100644 index 000000000..03dda234e --- /dev/null +++ b/boards/variants/t112-v1.1.c @@ -0,0 +1,48 @@ +/* This file was auto-generated from t112-v1.1.json using boardgen */ + +#include + +#ifdef LT_VARIANT_INCLUDE +#include LT_VARIANT_INCLUDE +#endif + +// clang-format off +PinInfo lt_arduino_pin_info_list[PINS_COUNT] = { + // D0: 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 diff --git a/boards/variants/t112-v1.1.h b/boards/variants/t112-v1.1.h new file mode 100644 index 000000000..30b548d2c --- /dev/null +++ b/boards/variants/t112-v1.1.h @@ -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;