Metadata-Version: 2.4
Name: pinocchiout
Version: 0.3.0
Summary: Pinout solver STM32 for microcontrollers
License-File: LICENSE
Requires-Python: >=3.13
Requires-Dist: groupie>=0.1.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.11.7
Requires-Dist: rich>=14.0.0
Requires-Dist: ruamel-yaml>=0.18.14
Requires-Dist: typer>=0.16.0
Requires-Dist: z3-solver>=4.15.1.0
Description-Content-Type: text/markdown

# `pinocchiout` - STM32 Pinout Solver

![screenshot](https://raw.githubusercontent.com/mawildoer/pinocchiout/refs/heads/main/screenshot.png)

## Installation

I recommend using [`uv`](https://docs.astral.sh/uv/getting-started/installation/) to install this project.

Then, all you need to do is run `uvx pinocchiout` and it'll handle the rest.

## Usage

### With a `reqs.yaml/json` file

`reqs.yaml/json` is a simple file describing the requirements of your project.

```yaml title="reqs.yaml"
chip: STM32G431C6
package: UFQFPN48
requirements:
  - name: position-sensor
    kind: spi
    signals:
      - MOSI
      - MISO
      - SCK

reserved_pins:
 - PB8  # boot select pin

```

This one, for example, says you're trying to find a pinout for the STM32G431C6 microcontroller, in the UFQFPN48 package, with a SPI peripheral. It also reserves the boot select pin, PB8.

YAML is preferred, because it allows for comments, but JSON is also supported:

```json title="reqs.json"
{
    "chip": "STM32G431C6",
    "package": "UFQFPN48",
    "requirements": [
        {
            "name": "spi",
            "peripheral": "spi",
            "kind": "spi",
            "signals": ["MOSI", "MISO", "SCK"]
        }
    ]
}
```

You can print out a table of the pinout like so:

```bash title="Printing the pinout"
uvx pinocchiout solve --reqs "examples/reqs.yaml"
```

### Listing peripherals

You can also list all available peripherals for a chip/package:

```bash title="Listing peripherals"
uvx pinocchiout list --reqs "examples/reqs.yaml"
# or specify chip and package directly
uvx pinocchiout list --chip STM32G431C6 --package UFQFPN48
```

Peripheral names ("peripheral") and signal names ("signals") are treated as regular expressions, so you can use them to match multiple.

### As a library

Honestly, it could be better, but see `example.py` for a simple example of how to use it as a library.
