MustafaMulla29/rp2040-bldc-motor-controller

Hardware assembly metadata and PCB geometry for a controller board with a snap-off rotary-encoder section, plus four parallel 150 µF/50 V bulk electrolytic capacitors filtering the motor supply.

Version
2.0.40
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone MustafaMulla29/rp2040-bldc-motor-controller  # download the package files into ./rp2040-bldc-motor-controller
tsci add MustafaMulla29/rp2040-bldc-motor-controller    # add it to your project as @tsci/MustafaMulla29.rp2040-bldc-motor-controller

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

firmware/test_status_led.py

import unittest
from status_led import StatusLed


class FakePin:
    OUT = 1

    def __init__(self, number, mode, value):
        self.number, self.mode, self.level = number, mode, value

    def value(self, value):
        self.level = value


class StatusLedTest(unittest.TestCase):
    def test_board_pin_mapping_and_reset_off(self):
        led = StatusLed(FakePin)
        self.assertEqual([p.number for p in led.pins], [10, 25, 18])
        self.assertEqual([p.level for p in led.pins], [0, 0, 0])

    def test_contract_loss_and_error_clear_ready_color(self):
        led = StatusLed(FakePin)
        for state, expected in [("pd_ready", [0, 1, 0]),
                                ("waiting", [0, 0, 1]),
                                ("negotiating", [0, 0, 1]),
                                ("commanding", [0, 1, 1]),
                                ("fault", [1, 0, 0]),
                                ("pd_ready", [0, 1, 0]),
                                ("unknown", [1, 0, 0])]:
            led.show(state)
            self.assertEqual([p.level for p in led.pins], expected)
        led.off()
        self.assertEqual([p.level for p in led.pins], [0, 0, 0])