Package: boardgen
boardgenAutomagically generate beautiful Adafruit-like pinout diagrams for IoT boards ✨IntroductionBoardgen allows to generate vector images, containing pinout diagrams for any IoT module. The images are inspired by Adafruit's great, well-recognized pinouts, and look like this one:It is a Python tool that uses simple JSON files for defining shapes, colors, pin layouts and numbers. These files are then processed and drawn onto a .SVG image.Defining new boards is fully done in JSON and doesn't require Python programming, nor SVG knowledge.UsageBoardgen can be used as a library (seecli.pyfor an example) or with its built-in CLI program.pip install boardgenboardgen --helpboardgen list boardsto get a list of available boardsboardgen draw <board name>to produce an image file in your working directoryUsage: boardgen [OPTIONS] COMMAND [ARGS]...

  boardgen CLI v0.1.0

Options:
  --boards TEXT     Custom boards directories
  --shapes TEXT     Custom shapes directories
  --templates TEXT  Custom templates directories
  --presets TEXT    Custom presets .json
  --roles TEXT      Custom roles .json
  --flash TEXT      Custom flash regions .json
  --help            Show this message and exit.

Commands:
  draw  Draw board diagrams
  list  List boards/templates/etcBoard definitionsWriting board definitions means putting a .JSON file to a directory and specifying this directory using the--boardsoption.Boardgen is meant to be used with PlatformIO-style board definition files. An example of such a board can be foundhere (libretiny/boards/wr3.json).Note that the board manifest uses"_base"definitions. These are merged recursively with the manifest, and this result is expected to produce a complete file.Apart from PlatformIO default variables (such asbuild,debug,uploadorname,urlandvendor) the board definition contains aPcbobject.TemplatesATemplateis a JSON object containing lists of shapes for each side of a PCB. Additionally, it contains a mapping of pin names to shape IDs to allow automatic alignment of pinout labels.{"name":"demo-template","title":"Demo template","width":10,"height":20,"front":[{"info":"List of front side shapes goes here"},{"comment":"this is a sample rectangle","id":"shape1","type":"rect","pos":"0,0","size":"10,20","fill":{"color":"black"}}],"back":[],"pads":{"1":"demo-template.front.shape1","2":"demo-template.front.shape2","3":"demo-template.front.shape3","4":"demo-template.front.shape4",}}ShapesA shape JSON file is an array of multiple shape objects. Including shape JSON files is possible. For example, to includemy-shape.json:{"name":"my-shape","id":"id-of-my-shape","pos":"5,10"}Each shape is a JSON object, which has a common set of attributes:pos- REQUIRED: defines the anchor of a shape (in milimeters)preset(or apresetsarray) - used to merge the shape object with apreset object(see "boardgen list presets")id- used to refer to the shape's anchor from thepadsmappingvars- mapping of variables for${VAR}substitution, optionalRectanglestype: must be"rect"pos: REQUIRED: rectangle top-left corner positionsize: REQUIRED: rectangle size ("width,height") in milimetersfill: see FillStyle belowstroke: see FillStyle belowrx: X corner radiusry: Y corner radiusCirclestype: must be"circle"pos: REQUIRED: circle center positiond: diameter (milimeters), OR:r: radius (milimeters) - one ofdandris requiredfill: see FillStyle belowstroke: see FillStyle belowTexttype: must be"text"pos: REQUIRED: text center positionfont_size: REQUIRED: font sizetext: REQUIRED: string to drawfill: see FillStyle belowFillStylecolor: string (color name, HTML hex), fill/stroke colorlgrad: linear gradient as a list ["x,y", "color", "x,y", "color"]1st stop position1st stop color2nd stop position2nd stop colorwidth: stroke width (not used for "fill")SupportAs this project is just a quick solution that'll be used inLibreTinyfor generating pinouts, it's not really well documented. If you find this project interesting and need any help using it, feel free to open an issue and I'll try to provide more examples and info on how to use it.