diff --git a/boards/_base/pcb/wbr3-test.json b/boards/_base/pcb/wbr3-test.json new file mode 100644 index 000000000..d56fb9b34 --- /dev/null +++ b/boards/_base/pcb/wbr3-test.json @@ -0,0 +1,60 @@ +{ + "pcb": { + "scale": 10, + "test_pads": { + "TA_15": "wbr3.back.a_15.anchor", + "TA_0": "wbr3.back.a_0.anchor", + "TA_1": "wbr3.back.a_1.anchor" + }, + "back": [ + { + "type": "rect", + "pos": "5.8,14.6", + "size": "3.6,3.6", + "preset": "copper1" + }, + { + "id": "a_15", + "name": "label_line_up", + "pos": "2.4,11.5", + "vars": { + "DIR": "left", + "W": 0, + "H": 0 + } + }, + { + "name": "test_pad_1mm", + "pos": "3.2,11.4" + }, + { + "id": "a_0", + "name": "label_line_up", + "pos": "11.6,17.6", + "vars": { + "DIR": "left", + "W": 0.7, + "H": 0 + } + }, + { + "name": "test_pad_1mm", + "pos": "12.4,17.5" + }, + { + "id": "a_1", + "name": "label_line_up", + "pos": "10.9,19.6", + "vars": { + "DIR": "left", + "W": 0, + "H": 0 + } + }, + { + "name": "test_pad_1mm", + "pos": "11.7,19.5" + } + ] + } +} diff --git a/boards/_base/pcb/wbr3.json b/boards/_base/pcb/wbr3.json new file mode 100644 index 000000000..f3b29b0bb --- /dev/null +++ b/boards/_base/pcb/wbr3.json @@ -0,0 +1,85 @@ +{ + "pcb": { + "templates": [ + "esp12s", + "tuya-16x24", + "rf-type1", + "pcb-blue-light" + ], + "pinout_hidden": "I2S,WAKE,SD,JTAG,SWD,FLASH,TRIG,CTS,RTS", + "pinout": { + "1": { + "NC": null + }, + "2": { + "IC": 21, + "ARD": "D0" + }, + "3": { + "IC": 14 + }, + "4": { + "IC": 25, + "ARD": "D1" + }, + "5": { + "IC": 18, + "ARD": "D2" + }, + "6": { + "IC": 19, + "ARD": "D3" + }, + "7": { + "IC": 20, + "ARD": "D4" + }, + "8": { + "PWR": 3.3 + }, + "9": { + "GND": null + }, + "10": { + "IC": 26, + "ARD": "D5" + }, + "11": { + "IC": 37, + "ARD": "D6" + }, + "12": { + "IC": 38, + "ARD": "D7" + }, + "13": { + "IC": 39, + "ARD": "D8" + }, + "14": { + "IC": 40, + "ARD": "D9" + }, + "15": { + "IC": 33, + "ARD": "D10" + }, + "16": { + "IC": 34, + "ARD": "D11" + }, + "TA_15": { + "IC": 36, + "ARD": "D12" + }, + "TA_0": { + "IC": 15, + "ARD": "D13" + }, + "TA_1": { + "IC": 16, + "ARD": "D14" + } + } + } +} diff --git a/boards/variants/wbr3.c b/boards/variants/wbr3.c new file mode 100644 index 000000000..5d2618004 --- /dev/null +++ b/boards/variants/wbr3.c @@ -0,0 +1,60 @@ +/* This file was auto-generated from wbr3.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: PA07, ^FCS, SPI0_CS + {PIN_A7, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D1: PA11, FD0, UART0_TX, I2C0_SCL, PWM0 + {PIN_A11, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D2: PA02, TDO, UART1_RX, SPI0_CS, I2C0_SCL, PWM2 + {PIN_A2, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D3: PA03, TDI, UART1_TX, SPI0_SCK, I2C0_SDA, PWM3 + {PIN_A3, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D4: PA04, tRST, UART1_CTS, SPI0_MOSI, PWM4 + {PIN_A4, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D5: PA12, FD3, UART0_RX, I2C0_SDA, PWM1 + {PIN_A12, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D6: PA16, SD_D3, SPI0_SCK, UART2_TX, I2C0_SDA, PWM4 + {PIN_A16, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D7: PA17, SD_CMD, PWM5 + {PIN_A17, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D8: PA18, SD_CLK, PWM6 + {PIN_A18, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D9: PA19, SD_D0, SPI0_MOSI, UART2_CTS, I2C0_SCL, PWM7 + {PIN_A19, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D10: PA13, UART0_RX, PWM7 + {PIN_A13, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_UART, PIN_NONE, 0}, + // D11: PA14, SD_INT, UART0_TX, PWM2 + {PIN_A14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_UART, PIN_NONE, 0}, + // D12: PA15, SD_D2, SPI0_CS, UART2_RX, I2C0_SCL, PWM3 + {PIN_A15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D13: PA00, TCK, UART1_RX, PWM0, SWCLK + {PIN_A0, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SWD | PIN_UART, PIN_NONE, 0}, + // D14: PA01, TMS, UART1_TX, PWM1, SWDIO + {PIN_A1, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_JTAG | PIN_SWD | PIN_UART, PIN_NONE, 0}, +}; + +PinInfo *lt_arduino_pin_gpio_map[] = { + [0] = &(lt_arduino_pin_info_list[13]), // PIN_A0 (D13) + [1] = &(lt_arduino_pin_info_list[14]), // PIN_A1 (D14) + [2] = &(lt_arduino_pin_info_list[2]), // PIN_A2 (D2) + [3] = &(lt_arduino_pin_info_list[3]), // PIN_A3 (D3) + [4] = &(lt_arduino_pin_info_list[4]), // PIN_A4 (D4) + [7] = &(lt_arduino_pin_info_list[0]), // PIN_A7 (D0) + [11] = &(lt_arduino_pin_info_list[1]), // PIN_A11 (D1) + [12] = &(lt_arduino_pin_info_list[5]), // PIN_A12 (D5) + [13] = &(lt_arduino_pin_info_list[10]), // PIN_A13 (D10) + [14] = &(lt_arduino_pin_info_list[11]), // PIN_A14 (D11) + [15] = &(lt_arduino_pin_info_list[12]), // PIN_A15 (D12) + [16] = &(lt_arduino_pin_info_list[6]), // PIN_A16 (D6) + [17] = &(lt_arduino_pin_info_list[7]), // PIN_A17 (D7) + [18] = &(lt_arduino_pin_info_list[8]), // PIN_A18 (D8) + [19] = &(lt_arduino_pin_info_list[9]), // PIN_A19 (D9) +}; +// clang-format on diff --git a/boards/variants/wbr3.h b/boards/variants/wbr3.h new file mode 100644 index 000000000..40f6595dd --- /dev/null +++ b/boards/variants/wbr3.h @@ -0,0 +1,119 @@ +/* This file was auto-generated from wbr3.json using boardgen */ + +#pragma once + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 15 // Total GPIO count +#define NUM_DIGITAL_PINS 15 // Digital inputs/outputs +#define NUM_ANALOG_INPUTS 0 // ADC inputs +#define NUM_ANALOG_OUTPUTS 14 // PWM & DAC outputs +#define PINS_GPIO_MAX 19 // Last usable GPIO number + +// Wire Interfaces +// --------------- +#define PIN_WIRE0_SCL_0 11u // PIN_A11 +#define PIN_WIRE0_SCL_1 2u // PIN_A2 +#define PIN_WIRE0_SCL_2 19u // PIN_A19 +#define PIN_WIRE0_SCL_3 15u // PIN_A15 +#define PIN_WIRE0_SDA_0 3u // PIN_A3 +#define PIN_WIRE0_SDA_1 12u // PIN_A12 +#define PIN_WIRE0_SDA_2 16u // PIN_A16 +#define PINS_WIRE0_SCL (pin_size_t[]){11u, 2u, 19u, 15u} +#define PINS_WIRE0_SDA (pin_size_t[]){3u, 12u, 16u} + +// Serial ports +// ------------ +#define PIN_SERIAL0_RX_0 12u // PIN_A12 +#define PIN_SERIAL0_RX_1 13u // PIN_A13 +#define PIN_SERIAL0_TX_0 11u // PIN_A11 +#define PIN_SERIAL0_TX_1 14u // PIN_A14 +#define PIN_SERIAL1_CTS 4u // PIN_A4 +#define PIN_SERIAL1_RX_0 2u // PIN_A2 +#define PIN_SERIAL1_RX_1 0u // PIN_A0 +#define PIN_SERIAL1_TX_0 3u // PIN_A3 +#define PIN_SERIAL1_TX_1 1u // PIN_A1 +#define PIN_SERIAL2_CTS 19u // PIN_A19 +#define PIN_SERIAL2_RX 15u // PIN_A15 +#define PIN_SERIAL2_TX 16u // PIN_A16 +#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[]){2u, 0u} +#define PINS_SERIAL1_TX (pin_size_t[]){3u, 1u} +#define PINS_SERIAL2_CTS (pin_size_t[]){19u} +#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_PA00 0u // PIN_A0 +#define PIN_PA01 1u // PIN_A1 +#define PIN_PA02 2u // PIN_A2 +#define PIN_PA03 3u // PIN_A3 +#define PIN_PA04 4u // PIN_A4 +#define PIN_PA07 7u // PIN_A7 +#define PIN_PA11 11u // PIN_A11 +#define PIN_PA12 12u // PIN_A12 +#define PIN_PA13 13u // PIN_A13 +#define PIN_PA14 14u // PIN_A14 +#define PIN_PA15 15u // PIN_A15 +#define PIN_PA16 16u // PIN_A16 +#define PIN_PA17 17u // PIN_A17 +#define PIN_PA18 18u // PIN_A18 +#define PIN_PA19 19u // PIN_A19 +#define PIN_PWM5 17u // PIN_A17 +#define PIN_PWM6 18u // PIN_A18 +#define PIN_RX2 15u // PIN_A15 +#define PIN_SDA0 16u // PIN_A16 +#define PIN_TX2 16u // PIN_A16 + +// Port availability +// ----------------- +#define HAS_SERIAL0 1 +#define HAS_SERIAL1 1 +#define HAS_SERIAL2 1 +#define HAS_WIRE0 1 +#define SERIAL_INTERFACES_COUNT 3 +#define WIRE_INTERFACES_COUNT 1 + +// Arduino pin names +// ----------------- +#define PIN_D0 7u // PIN_A7 +#define PIN_D1 11u // PIN_A11 +#define PIN_D2 2u // PIN_A2 +#define PIN_D3 3u // PIN_A3 +#define PIN_D4 4u // PIN_A4 +#define PIN_D5 12u // PIN_A12 +#define PIN_D6 16u // PIN_A16 +#define PIN_D7 17u // PIN_A17 +#define PIN_D8 18u // PIN_A18 +#define PIN_D9 19u // PIN_A19 +#define PIN_D10 13u // PIN_A13 +#define PIN_D11 14u // PIN_A14 +#define PIN_D12 15u // PIN_A15 +#define PIN_D13 0u // PIN_A0 +#define PIN_D14 1u // PIN_A1 + +// Static pin names +// ---------------- +static const unsigned char D0 = PIN_D0; +static const unsigned char D1 = PIN_D1; +static const unsigned char D2 = PIN_D2; +static const unsigned char D3 = PIN_D3; +static const unsigned char D4 = PIN_D4; +static const unsigned char D5 = PIN_D5; +static const unsigned char D6 = PIN_D6; +static const unsigned char D7 = PIN_D7; +static const unsigned char D8 = PIN_D8; +static const unsigned char D9 = PIN_D9; +static const unsigned char D10 = PIN_D10; +static const unsigned char D11 = PIN_D11; +static const unsigned char D12 = PIN_D12; +static const unsigned char D13 = PIN_D13; +static const unsigned char D14 = PIN_D14; diff --git a/boards/wbr3.json b/boards/wbr3.json new file mode 100644 index 000000000..0aff232e7 --- /dev/null +++ b/boards/wbr3.json @@ -0,0 +1,25 @@ +{ + "_base": [ + "realtek-ambz2", + "realtek-ambz2-8720", + "realtek-ambz2-tuya", + "realtek-ambz2-image", + "realtek-ambz2-2mb-900k", + "ic/rtl8720cf", + "pcb/wbr3", + "pcb/wbr3-test" + ], + "build": { + "mcu": "rtl8720cf", + "variant": "wbr3" + }, + "name": "WBR3 Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wbr3-module-datasheet?id=K9dujs2k5nriy", + "vendor": "Tuya Inc.", + "doc": { + "fccid": "2ANDL-WBR3" + }, + "pcb": { + "symbol": "WBR3" + } +}