ShiboSoftwareDev/f1c100s-linux-stepper-controller

A four-layer Linux motor-control carrier built around an Allwinner F1C100S SoC, USB‑C, SPI flash, multi-rail power regulation, DRV8825 stepper-driver stage with protection/current sensing, temperature monitoring, and external I/O connectors.

Version
0.1.1
License
unset
Stars
0

fixed-board-router.ts

import savedBoardTraces from "./saved-board-traces.json"

export async function fixedBoardRouter(input: any) {
  const handlers: Record<string, Array<(event: any) => void>> = {
    complete: [], error: [], progress: [],
  }
  let isRouting = false
  return {
    input,
    get isRouting() { return isRouting },
    on(event: string, handler: (event: any) => void) {
      handlers[event]?.push(handler)
    },
    start() {
      isRouting = true
      queueMicrotask(() => {
        if (!isRouting) return
        isRouting = false
        handlers.complete.forEach((handler) => handler({
          type: "complete",
          traces: savedBoardTraces,
        }))
      })
    },
    stop() { isRouting = false },
    solveSync() { return savedBoardTraces },
  }
}