From 96dbbe0919837262fa863d828a2e18929bf8f15e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Sun, 18 Jun 2023 16:11:55 +0200 Subject: [PATCH] [boards] Move custom templates from boardgen, add WB2L_M1 board --- boards/_base/pcb/wb2l-m1-test.json | 16 ++ boards/shapes/tuya2_pcb.json | 54 ++++++ boards/shapes/tuyau_pcb.json | 54 ++++++ boards/templates/custom-20x24-22.json | 141 ++++++++++++++ boards/templates/tuya-16x24.json | 27 +++ boards/templates/tuya2.json | 80 ++++++++ boards/templates/tuya2l.json | 73 ++++++++ boards/templates/tuyalc5.json | 255 ++++++++++++++++++++++++++ boards/templates/tuyau.json | 162 ++++++++++++++++ boards/variants/wb2l-m1.c | 54 ++++++ boards/variants/wb2l-m1.h | 100 ++++++++++ boards/wb2l-m1.json | 21 +++ 12 files changed, 1037 insertions(+) create mode 100644 boards/_base/pcb/wb2l-m1-test.json create mode 100644 boards/shapes/tuya2_pcb.json create mode 100644 boards/shapes/tuyau_pcb.json create mode 100644 boards/templates/custom-20x24-22.json create mode 100644 boards/templates/tuya-16x24.json create mode 100644 boards/templates/tuya2.json create mode 100644 boards/templates/tuya2l.json create mode 100644 boards/templates/tuyalc5.json create mode 100644 boards/templates/tuyau.json create mode 100644 boards/variants/wb2l-m1.c create mode 100644 boards/variants/wb2l-m1.h create mode 100644 boards/wb2l-m1.json diff --git a/boards/_base/pcb/wb2l-m1-test.json b/boards/_base/pcb/wb2l-m1-test.json new file mode 100644 index 0000000..b56840c --- /dev/null +++ b/boards/_base/pcb/wb2l-m1-test.json @@ -0,0 +1,16 @@ +{ + "pcb": { + "test_pads": { + "TRST": "wb2l-m1.back.rst.anchor", + "TRX1": "wb2l-m1.back.u1_rxd.anchor", + "TTX1": "wb2l-m1.back.u1_txd.anchor", + "TRX2": "wb2l-m1.back.u2_rxd.anchor", + "TTX2": "wb2l-m1.back.u2_txd.anchor", + "TGND": "wb2l-m1.back.gnd.anchor", + "TSCK": "wb2l-m1.back.f_sck.anchor", + "TCSN": "wb2l-m1.back.f_csn.anchor", + "TSI": "wb2l-m1.back.f_si.anchor", + "TSO": "wb2l-m1.back.f_so.anchor" + } + } +} diff --git a/boards/shapes/tuya2_pcb.json b/boards/shapes/tuya2_pcb.json new file mode 100644 index 0000000..74ccba2 --- /dev/null +++ b/boards/shapes/tuya2_pcb.json @@ -0,0 +1,54 @@ +[ + { + "type": "rect", + "pos": "0,0", + "size": "15,17.9", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Left cut stroke horizontal", + "type": "rect", + "pos": "0,14.35", + "size": "1.60,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Left cut stroke vertical", + "type": "rect", + "pos": "1.60,14.35", + "size": "0.1,3.45", + "preset": "pcb_stroke" + }, + { + "comment": "Left cut background", + "type": "rect", + "pos": "-0.1,14.45", + "size": "1.70,3.55", + "fill": { + "color": "white" + } + }, + { + "comment": "Right cut stroke horizontal", + "type": "rect", + "pos": "13.3,14.35", + "size": "1.60,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut stroke vertical", + "type": "rect", + "pos": "13.3,14.35", + "size": "0.1,3.45", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut background", + "type": "rect", + "pos": "13.4,14.45", + "size": "1.70,3.55", + "fill": { + "color": "white" + } + } +] diff --git a/boards/shapes/tuyau_pcb.json b/boards/shapes/tuyau_pcb.json new file mode 100644 index 0000000..ec813bb --- /dev/null +++ b/boards/shapes/tuyau_pcb.json @@ -0,0 +1,54 @@ +[ + { + "type": "rect", + "pos": "0,0", + "size": "15.8,20.3", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Left cut stroke horizontal", + "type": "rect", + "pos": "0,17.4", + "size": "1.50,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Left cut stroke vertical", + "type": "rect", + "pos": "1.50,17.4", + "size": "0.1,2.8", + "preset": "pcb_stroke" + }, + { + "comment": "Left cut background", + "type": "rect", + "pos": "-0.1,17.5", + "size": "1.60,2.85", + "fill": { + "color": "white" + } + }, + { + "comment": "Right cut stroke horizontal", + "type": "rect", + "pos": "14.1,17.4", + "size": "1.60,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut stroke vertical", + "type": "rect", + "pos": "14.1,17.4", + "size": "0.1,2.8", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut background", + "type": "rect", + "pos": "14.2,17.5", + "size": "1.70,2.85", + "fill": { + "color": "white" + } + } +] diff --git a/boards/templates/custom-20x24-22.json b/boards/templates/custom-20x24-22.json new file mode 100644 index 0000000..c17eb8e --- /dev/null +++ b/boards/templates/custom-20x24-22.json @@ -0,0 +1,141 @@ +{ + "name": "custom-20x24-22", + "title": "Custom 20x24mm form factor (22-pin)", + "width": 20, + "height": 24, + "vars": { + "PINTYPE_VERT": "pin_vert_cast_nohole", + "PINTYPE_HORZ": "pin_horz_cast_nohole", + "RASTER": 2, + "RF_W": 20, + "RF_H": 6.5 + }, + "front": [ + { + "comment": "PCB soldermask", + "type": "rect", + "pos": "0,0", + "size": "20,24", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Pins (1-7)", + "id": "left", + "name": "r_pins_vert", + "repeat": 7, + "pos": "0,8.5", + "vars": { + "PINDIR": "left" + } + }, + { + "comment": "Pins (8-15)", + "id": "right", + "name": "r_pins_vert", + "repeat": 7, + "pos": "20,8.5", + "vars": { + "PINDIR": "right" + } + }, + { + "comment": "Pins (16-22)", + "name": "r_pins_horz", + "repeat": 8, + "pos": "3,24", + "vars": { + "PINDIR": "down" + } + }, + { + "comment": "Pin labels (16-22)", + "id": "down", + "name": "r_labels_horz", + "repeat": 8, + "pos": "3,24", + "vars": { + "PINDIR": "down" + } + }, + { + "comment": "Metal shielding", + "type": "rect", + "pos": "1.2,6.95", + "size": "17.6,15.8", + "preset": "shield" + } + ], + "back": [ + { + "comment": "PCB soldermask", + "type": "rect", + "pos": "0,0", + "size": "20,24", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Pins (8-15)", + "id": "right", + "name": "r_pins_vert", + "repeat": 7, + "pos": "0,8.5", + "vars": { + "PINDIR": "left" + } + }, + { + "comment": "Pins (1-7)", + "id": "left", + "name": "r_pins_vert", + "repeat": 7, + "pos": "20,8.5", + "vars": { + "PINDIR": "right" + } + }, + { + "comment": "Pins (16-22)", + "name": "r_pins_horz", + "repeat": 8, + "pos": "3,24", + "vars": { + "PINDIR": "down" + } + }, + { + "comment": "Pin labels (16-22)", + "id": "down", + "name": "r_labels_horz", + "repeat": 8, + "pos": "3,24", + "vars": { + "PINDIR": "down" + } + } + ], + "pads": { + "1": "custom-20x24-22.front.left.pin1", + "2": "custom-20x24-22.front.left.pin2", + "3": "custom-20x24-22.front.left.pin3", + "4": "custom-20x24-22.front.left.pin4", + "5": "custom-20x24-22.front.left.pin5", + "6": "custom-20x24-22.front.left.pin6", + "7": "custom-20x24-22.front.left.pin7", + "8": "custom-20x24-22.front.right.pin7", + "9": "custom-20x24-22.front.right.pin6", + "10": "custom-20x24-22.front.right.pin5", + "11": "custom-20x24-22.front.right.pin4", + "12": "custom-20x24-22.front.right.pin3", + "13": "custom-20x24-22.front.right.pin2", + "14": "custom-20x24-22.front.right.pin1", + "15": "custom-20x24-22.front.down.label1.anchor", + "16": "custom-20x24-22.front.down.label2.anchor", + "17": "custom-20x24-22.front.down.label3.anchor", + "18": "custom-20x24-22.front.down.label4.anchor", + "19": "custom-20x24-22.front.down.label5.anchor", + "20": "custom-20x24-22.front.down.label6.anchor", + "21": "custom-20x24-22.front.down.label7.anchor", + "22": "custom-20x24-22.front.down.label8.anchor" + }, + "test_pads": {} +} diff --git a/boards/templates/tuya-16x24.json b/boards/templates/tuya-16x24.json new file mode 100644 index 0000000..4fe6873 --- /dev/null +++ b/boards/templates/tuya-16x24.json @@ -0,0 +1,27 @@ +{ + "name": "tuya-16x24", + "title": "Tuya boards; 16x24mm; 16 or 22 pin", + "width": 16, + "height": 24, + "front": [ + { + "comment": "Line below model name", + "type": "rect", + "pos": "0.5,6.2", + "size": "15,0.15", + "fill": { + "color": "${SILK_COLOR}" + } + }, + { + "comment": "Board model name", + "type": "text", + "pos": "7.0,5.5", + "text": "${SYMBOL}", + "font_size": 1.0, + "fill": { + "color": "${SILK_COLOR}" + } + } + ] +} diff --git a/boards/templates/tuya2.json b/boards/templates/tuya2.json new file mode 100644 index 0000000..ca2f0e7 --- /dev/null +++ b/boards/templates/tuya2.json @@ -0,0 +1,80 @@ +{ + "name": "tuya2", + "title": "Tuya boards; 2 series", + "width": 15, + "height": 17.9, + "vars": { + "PINTYPE_HORZ": "pad_10x25", + "PINDIR": "down", + "RASTER": 2, + "RF_W": 15, + "RF_H": 5.5 + }, + "front": [ + { + "name": "tuya2_pcb", + "pos": "0,0" + }, + { + "comment": "Metal shielding", + "type": "rect", + "pos": "0.3,6", + "size": "14.4,8", + "preset": "shield" + }, + { + "comment": "Pins (10,8,6,4,2)", + "name": "r_pins_horz", + "repeat": 5, + "pos": "3.5,16.3" + }, + { + "comment": "Pin labels (10,8,6,4,2)", + "id": "pins", + "name": "r_labels_horz", + "repeat": 5, + "pos": "3.5,17.9" + }, + { + "type": "text", + "pos": "7.0,5.0", + "text": "${SYMBOL}", + "font_size": 1.0, + "fill": { + "color": "${SILK_COLOR}" + } + } + ], + "back": [ + { + "name": "tuya2_pcb", + "pos": "0,0" + }, + { + "comment": "Pins (1,3,5,7,9,11)", + "name": "r_pins_horz", + "repeat": 6, + "pos": "2.5,16.3" + }, + { + "comment": "Pin labels (1,3,5,7,9,11)", + "id": "pins", + "name": "r_labels_horz", + "repeat": 6, + "pos": "2.5,17.9" + } + ], + "pads": { + "1": "tuya2.back.pins.label1.anchor", + "2": "tuya2.front.pins.label5.anchor", + "3": "tuya2.back.pins.label2.anchor", + "4": "tuya2.front.pins.label4.anchor", + "5": "tuya2.back.pins.label3.anchor", + "6": "tuya2.front.pins.label3.anchor", + "7": "tuya2.back.pins.label4.anchor", + "8": "tuya2.front.pins.label2.anchor", + "9": "tuya2.back.pins.label5.anchor", + "10": "tuya2.front.pins.label1.anchor", + "11": "tuya2.back.pins.label6.anchor" + } +} diff --git a/boards/templates/tuya2l.json b/boards/templates/tuya2l.json new file mode 100644 index 0000000..c991342 --- /dev/null +++ b/boards/templates/tuya2l.json @@ -0,0 +1,73 @@ +{ + "name": "tuya2l", + "title": "Tuya boards; 2L series", + "width": 15, + "height": 17.3, + "vars": { + "PINTYPE_HORZ": "pin_horz_cast_hole", + "PINDIR": "down", + "RASTER": 2, + "RF_W": 15, + "RF_H": 5.5 + }, + "front": [ + { + "type": "rect", + "pos": "0,0", + "size": "15,17.3", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Metal shielding", + "type": "rect", + "pos": "0.7,6", + "size": "13.6,9", + "preset": "shield" + }, + { + "comment": "Pins (1-7)", + "name": "r_pins_horz", + "repeat": 7, + "pos": "1.5,17.3" + }, + { + "comment": "Pin labels (1-7)", + "id": "pins", + "name": "r_labels_horz", + "repeat": 7, + "pos": "1.5,17.3" + }, + { + "type": "text", + "pos": "4.0,5.5", + "text": "${SYMBOL}", + "font_size": 1.0, + "fill": { + "color": "${SILK_COLOR}" + } + } + ], + "back": [ + { + "type": "rect", + "pos": "0,0", + "size": "15,17.3", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Pins (1-7)", + "name": "r_pins_horz", + "repeat": 7, + "pos": "1.5,17.3" + } + ], + "pads": { + "1": "tuya2l.front.pins.label1.anchor", + "2": "tuya2l.front.pins.label2.anchor", + "3": "tuya2l.front.pins.label3.anchor", + "4": "tuya2l.front.pins.label4.anchor", + "5": "tuya2l.front.pins.label5.anchor", + "6": "tuya2l.front.pins.label6.anchor", + "7": "tuya2l.front.pins.label7.anchor" + } +} diff --git a/boards/templates/tuyalc5.json b/boards/templates/tuyalc5.json new file mode 100644 index 0000000..174b138 --- /dev/null +++ b/boards/templates/tuyalc5.json @@ -0,0 +1,255 @@ +{ + "name": "tuyalc5", + "title": "Tuya boards; LC5 series", + "width": 15.8, + "height": 20.3, + "vars": { + "RASTER": 2 + }, + "front": [ + { + "type": "rect", + "pos": "0,0", + "size": "8.5,12.7", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Middle cut background", + "type": "rect", + "pos": "4,10.3", + "size": "2.5,2.4", + "fill": { + "color": "white" + } + }, + { + "comment": "Middle cut stroke top", + "type": "rect", + "pos": "3.9,10.2", + "size": "2.7,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Middle cut stroke left", + "type": "rect", + "pos": "3.9,10.3", + "size": "0.1,2.4", + "preset": "pcb_stroke" + }, + { + "comment": "Middle cut stroke right", + "type": "rect", + "pos": "6.5,10.3", + "size": "0.1,2.4", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut background", + "type": "rect", + "pos": "7.7,10.3", + "size": "0.8,2.4", + "fill": { + "color": "white" + } + }, + { + "comment": "Right cut stroke top", + "type": "rect", + "pos": "7.6,10.2", + "size": "0.9,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut stroke left", + "type": "rect", + "pos": "7.6,10.3", + "size": "0.1,2.4", + "preset": "pcb_stroke" + }, + { + "comment": "Pins (1-2)", + "id": "left", + "name": "r_pins_horz", + "repeat": 2, + "pos": "1.26,11.58", + "vars": { + "PINTYPE_HORZ": "pad", + "PINDIR": "down", + "RASTER": 2, + "W": 1, + "H": 2, + "R": 0.3 + } + }, + { + "comment": "Pins (3)", + "name": "pad", + "pos": "7.13,11.58", + "vars": { + "W": 1, + "H": 2, + "R": 0.3 + } + }, + { + "comment": "Pin label (1)", + "id": "pin1", + "name": "label_line_down", + "pos": "1.26,12.7", + "vars": { + "DIR": "left", + "W": 0, + "H": 2 + } + }, + { + "comment": "Pin label (2)", + "id": "pin2", + "name": "label_line_down", + "pos": "3.26,12.7", + "vars": { + "DIR": "left", + "W": 2, + "H": 4 + } + }, + { + "comment": "Pin label (3)", + "id": "pin3", + "name": "label_line_down", + "pos": "7.13,12.7", + "vars": { + "DIR": "left", + "W": 5.87, + "H": 6 + } + } + ], + "back": [ + { + "type": "rect", + "pos": "0,0", + "size": "8.5,12.7", + "preset": "${MASK_PRESET}" + }, + { + "comment": "Middle cut background", + "type": "rect", + "pos": "8.5-4-2.5,10.3", + "size": "2.5,2.4", + "fill": { + "color": "white" + } + }, + { + "comment": "Middle cut stroke top", + "type": "rect", + "pos": "8.5-3.9-2.7,10.2", + "size": "2.7,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Middle cut stroke left", + "type": "rect", + "pos": "8.5-3.9-0.1,10.3", + "size": "0.1,2.4", + "preset": "pcb_stroke" + }, + { + "comment": "Middle cut stroke right", + "type": "rect", + "pos": "8.5-6.5-0.1,10.3", + "size": "0.1,2.4", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut background", + "type": "rect", + "pos": "8.5-7.7-0.8,10.3", + "size": "0.8,2.4", + "fill": { + "color": "white" + } + }, + { + "comment": "Right cut stroke top", + "type": "rect", + "pos": "8.5-7.6-0.9,10.2", + "size": "0.9,0.1", + "preset": "pcb_stroke" + }, + { + "comment": "Right cut stroke left", + "type": "rect", + "pos": "8.5-7.6-0.1,10.3", + "size": "0.1,2.4", + "preset": "pcb_stroke" + }, + { + "comment": "Pins (1-2)", + "id": "left", + "name": "r_pins_horz", + "repeat": 2, + "pos": "8.5-1.26-2,11.58", + "vars": { + "PINTYPE_HORZ": "pad", + "PINDIR": "down", + "RASTER": 2, + "W": 1, + "H": 2, + "R": 0.3 + } + }, + { + "comment": "Pins (3)", + "name": "pad", + "pos": "8.5-7.13,11.58", + "vars": { + "W": 1, + "H": 2, + "R": 0.3 + } + }, + { + "comment": "Pin label (1)", + "id": "pin1", + "name": "label_line_down", + "pos": "8.5-1.26,12.7", + "vars": { + "DIR": "right", + "W": 0, + "H": 2 + } + }, + { + "comment": "Pin label (2)", + "id": "pin2", + "name": "label_line_down", + "pos": "8.5-3.26,12.7", + "vars": { + "DIR": "right", + "W": 2, + "H": 4 + } + }, + { + "comment": "Pin label (3)", + "id": "pin3", + "name": "label_line_down", + "pos": "8.5-7.13,12.7", + "vars": { + "DIR": "right", + "W": 5.87, + "H": 6 + } + } + ], + "pads": { + "1": "tuyalc5.front.pin1.anchor", + "2": "tuyalc5.back.pin1.anchor", + "3": "tuyalc5.front.pin2.anchor", + "4": "tuyalc5.back.pin2.anchor", + "5": "tuyalc5.front.pin3.anchor", + "6": "tuyalc5.back.pin3.anchor" + } +} diff --git a/boards/templates/tuyau.json b/boards/templates/tuyau.json new file mode 100644 index 0000000..5ee814e --- /dev/null +++ b/boards/templates/tuyau.json @@ -0,0 +1,162 @@ +{ + "name": "tuyau", + "title": "Tuya boards; U series", + "width": 15.8, + "height": 20.3, + "vars": { + "PINTYPE_VERT": "pin_vert_cast_nohole", + "PINTYPE_HORZ": "pin_horz_cast_nohole", + "RF_W": 15.8, + "RF_H": 5.2 + }, + "front": [ + { + "name": "tuyau_pcb", + "pos": "0,0" + }, + { + "comment": "Metal shielding", + "type": "rect", + "pos": "1.1,5.6", + "size": "13.6,11.5", + "preset": "shield" + }, + { + "comment": "Pins (1-7)", + "id": "left", + "name": "r_pins_vert", + "repeat": 7, + "pos": "0,6.1", + "vars": { + "PINDIR": "left", + "RASTER": 1.4 + } + }, + { + "comment": "Pins (8-14)", + "name": "r_pins_horz", + "repeat": 7, + "pos": "2.5,20.3", + "vars": { + "PINDIR": "down", + "RASTER": 1.8 + } + }, + { + "comment": "Long pads (8-14)", + "name": "r_pins_horz", + "repeat": 7, + "pos": "2.5,17.5 + 1.2", + "vars": { + "PINTYPE_HORZ": "pad", + "W": "0.6 * 1.8", + "H": 2.4, + "R": 0, + "RASTER": 1.8 + } + }, + { + "comment": "Pin labels (8-14)", + "id": "down", + "name": "r_labels_horz", + "repeat": 7, + "pos": "2.5,20.3", + "vars": { + "PINDIR": "down", + "RASTER": 1.8 + } + }, + { + "comment": "Pins (15-21)", + "id": "right", + "name": "r_pins_vert", + "repeat": 7, + "pos": "15.8,6.1", + "vars": { + "PINDIR": "right", + "RASTER": 1.4 + } + }, + { + "type": "text", + "pos": "4.0,5.5", + "text": "${SYMBOL}", + "font_size": 1.0, + "fill": { + "color": "${SILK_COLOR}" + } + } + ], + "back": [ + { + "name": "tuyau_pcb", + "pos": "0,0" + }, + { + "comment": "Pins (1-7)", + "name": "r_pins_vert", + "repeat": 7, + "pos": "0,6.1", + "vars": { + "PINDIR": "left", + "RASTER": 1.4 + } + }, + { + "comment": "Pins (8-14)", + "name": "r_pins_horz", + "repeat": 7, + "pos": "2.5,20.3", + "vars": { + "PINDIR": "down", + "RASTER": 1.8 + } + }, + { + "comment": "Long pads (8-14)", + "name": "r_pins_horz", + "repeat": 7, + "pos": "2.5,17.5 + 1.2", + "vars": { + "PINTYPE_HORZ": "pad", + "W": "0.6 * 1.8", + "H": 2.4, + "R": 0, + "RASTER": 1.8 + } + }, + { + "comment": "Pins (15-21)", + "name": "r_pins_vert", + "repeat": 7, + "pos": "15.8,6.1", + "vars": { + "PINDIR": "right", + "RASTER": 1.4 + } + } + ], + "pads": { + "1": "tuyau.front.left.pin1", + "2": "tuyau.front.left.pin2", + "3": "tuyau.front.left.pin3", + "4": "tuyau.front.left.pin4", + "5": "tuyau.front.left.pin5", + "6": "tuyau.front.left.pin6", + "7": "tuyau.front.left.pin7", + "8": "tuyau.front.down.label1.anchor", + "9": "tuyau.front.down.label2.anchor", + "10": "tuyau.front.down.label3.anchor", + "11": "tuyau.front.down.label4.anchor", + "12": "tuyau.front.down.label5.anchor", + "13": "tuyau.front.down.label6.anchor", + "14": "tuyau.front.down.label7.anchor", + "15": "tuyau.front.right.pin7", + "16": "tuyau.front.right.pin6", + "17": "tuyau.front.right.pin5", + "18": "tuyau.front.right.pin4", + "19": "tuyau.front.right.pin3", + "20": "tuyau.front.right.pin2", + "21": "tuyau.front.right.pin1" + } +} diff --git a/boards/variants/wb2l-m1.c b/boards/variants/wb2l-m1.c new file mode 100644 index 0000000..6ec0255 --- /dev/null +++ b/boards/variants/wb2l-m1.c @@ -0,0 +1,54 @@ +/* This file was auto-generated from wb2l-m1.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: P8, PWM2 + {GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D1: P7, PWM1 + {GPIO7, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D2: P6, PWM0 + {GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D3: P26, PWM5, IRDA + {GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D4: P24, PWM4 + {GPIO24, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D5: P10, UART1_RX + {GPIO10, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0}, + // D6: P11, UART1_TX + {GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0}, + // D7: P1, UART2_RX, I2C2_SDA + {GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D8: P0, UART2_TX, I2C2_SCL + {GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D9: P20, I2C1_SCL, TCK, FSCK + {GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0}, + // D10: P21, I2C1_SDA, TMS, MCLK, ^FCS + {GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0}, + // D11: P23, ADC3, TDO, FSO + {GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0}, + // D12: P22, TDI, FSI + {GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0}, +}; + +PinInfo *lt_arduino_pin_gpio_map[] = { + [0] = &(lt_arduino_pin_info_list[8]), // GPIO0 (D8) + [1] = &(lt_arduino_pin_info_list[7]), // GPIO1 (D7) + [6] = &(lt_arduino_pin_info_list[2]), // GPIO6 (D2) + [7] = &(lt_arduino_pin_info_list[1]), // GPIO7 (D1) + [8] = &(lt_arduino_pin_info_list[0]), // GPIO8 (D0) + [10] = &(lt_arduino_pin_info_list[5]), // GPIO10 (D5) + [11] = &(lt_arduino_pin_info_list[6]), // GPIO11 (D6) + [20] = &(lt_arduino_pin_info_list[9]), // GPIO20 (D9) + [21] = &(lt_arduino_pin_info_list[10]), // GPIO21 (D10) + [22] = &(lt_arduino_pin_info_list[12]), // GPIO22 (D12) + [23] = &(lt_arduino_pin_info_list[11]), // GPIO23 (D11) + [24] = &(lt_arduino_pin_info_list[4]), // GPIO24 (D4) + [26] = &(lt_arduino_pin_info_list[3]), // GPIO26 (D3) +}; +// clang-format on diff --git a/boards/variants/wb2l-m1.h b/boards/variants/wb2l-m1.h new file mode 100644 index 0000000..d9a0aff --- /dev/null +++ b/boards/variants/wb2l-m1.h @@ -0,0 +1,100 @@ +/* This file was auto-generated from wb2l-m1.json using boardgen */ + +#pragma once + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 13 // Total GPIO count +#define NUM_DIGITAL_PINS 13 // Digital inputs/outputs +#define NUM_ANALOG_INPUTS 1 // ADC inputs +#define NUM_ANALOG_OUTPUTS 5 // PWM & DAC outputs +#define PINS_GPIO_MAX 26 // Last usable GPIO number + +// 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 + +// 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 + +// Pin function macros +// ------------------- +#define PIN_ADC3 23u // GPIO23 +#define PIN_P0 0u // GPIO0 +#define PIN_P1 1u // GPIO1 +#define PIN_P6 6u // GPIO6 +#define PIN_P7 7u // GPIO7 +#define PIN_P8 8u // GPIO8 +#define PIN_P10 10u // GPIO10 +#define PIN_P11 11u // GPIO11 +#define PIN_P20 20u // GPIO20 +#define PIN_P21 21u // GPIO21 +#define PIN_P22 22u // GPIO22 +#define PIN_P23 23u // GPIO23 +#define PIN_P24 24u // GPIO24 +#define PIN_P26 26u // GPIO26 +#define PIN_PWM0 6u // GPIO6 +#define PIN_PWM1 7u // GPIO7 +#define PIN_PWM2 8u // GPIO8 +#define PIN_PWM4 24u // GPIO24 +#define PIN_PWM5 26u // GPIO26 +#define PIN_RX1 10u // GPIO10 +#define PIN_RX2 1u // GPIO1 +#define PIN_SCL1 20u // GPIO20 +#define PIN_SCL2 0u // GPIO0 +#define PIN_SDA1 21u // GPIO21 +#define PIN_SDA2 1u // GPIO1 +#define PIN_TX1 11u // GPIO11 +#define PIN_TX2 0u // GPIO0 + +// Port availability +// ----------------- +#define HAS_SERIAL1 1 +#define HAS_SERIAL2 1 +#define HAS_WIRE1 1 +#define HAS_WIRE2 1 +#define SERIAL_INTERFACES_COUNT 2 +#define WIRE_INTERFACES_COUNT 2 + +// Arduino pin names +// ----------------- +#define PIN_D0 8u // GPIO8 +#define PIN_D1 7u // GPIO7 +#define PIN_D2 6u // GPIO6 +#define PIN_D3 26u // GPIO26 +#define PIN_D4 24u // GPIO24 +#define PIN_D5 10u // GPIO10 +#define PIN_D6 11u // GPIO11 +#define PIN_D7 1u // GPIO1 +#define PIN_D8 0u // GPIO0 +#define PIN_D9 20u // GPIO20 +#define PIN_D10 21u // GPIO21 +#define PIN_D11 23u // GPIO23 +#define PIN_D12 22u // GPIO22 +#define PIN_A0 23u // GPIO23 + +// 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; +static const unsigned char D11 = PIN_D11; +static const unsigned char D12 = PIN_D12; diff --git a/boards/wb2l-m1.json b/boards/wb2l-m1.json new file mode 100644 index 0000000..4e62358 --- /dev/null +++ b/boards/wb2l-m1.json @@ -0,0 +1,21 @@ +{ + "_base": [ + "beken-72xx", + "beken-7231n", + "beken-7231n-tuya", + "ic/bk7231-qfn32", + "pcb/wb2l", + "pcb/wb2l-test", + "pcb/wb2l-m1-test" + ], + "build": { + "mcu": "bk7231n", + "variant": "wb2l-m1" + }, + "name": "WB2L_M1 Wi-Fi Module", + "url": "https://docs.libretiny.eu/boards/wb2l-m1/", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WB2L_M1" + } +}