Heinrich-XIAO/stno
This code defines a keyboard matrix hardware design featuring a 3-row by 8-column array of keys and diodes, connected to an XIAO_S3 microcontroller with traces linking keys, diodes, and columns.
Usage: To import and use the "@tsci/Heinrich-XIAO.stno" component: 1. Import the component: ```tsx import SomeComponent from "@tsci/Heinrich-XIAO.stno" ``` 2. Use the component within a board or circuit: ```tsx <board> <SomeComponent /> </board> ``` The component appears to be a keyboard matrix design utilizing a XIAO S3 microcontroller, keys, and diodes. It creates a 3x8 matrix keyboard layout with predefined row and column configurations. Key usage details: - Supports automatic key and diode placement - Uses XIAO S3 microcontroller for matrix management - Configurable row and column positions - Includes optional y-coordinate overrides for specific keys
- Version
- 0.0.7
- License
- unset
- Stars
- 3
index.tsx
PCB
Schematic
import { A_1N4148WS } from "@tsci/seveibar.keyboard-utils"
import { Key } from "@tsci/seveibar.Key"
import { useXIAO_S3 } from "@tsci/vencax.XIAO_S3"
export default () => {
const U1 = useXIAO_S3("U1")
// keep all positions exactly as before, except last two of ROW2 moved up
const rows = [
{ name: "ROW0", y: 5, x: [-100, -80, -60, -40, -20, 40, 60, 80], yOverrides: { 4: -15 } },
{ name: "ROW1", y: -15, x: [-100, -80, -60, -40, 20, 40, 60, 80] },
{
name: "ROW2",
y: -45,
x: [-90, -70, -50, 50, 70, 90, 100, 100],
yOverrides: { 6: -15, 7: 5 } // move colIdx 4 & 5 keys upward by 10 units
},
]
return (
<board>
<U1 pcbY={1} />
{/* Keys and diodes wired into a 3×8 matrix */}
{rows.map((row, rowIdx) =>
row.x.map((x, colIdx) => {
const keyIndex = rowIdx * 8 + colIdx + 1
const keyName = `K${keyIndex}`
const diodeName = `D${keyIndex}`
// check if this key has a yOverride (only last two in row2)
const keyY = row.yOverrides?.[colIdx] ?? row.y
return (
<React.Fragment key={keyName}>
<Key
name={keyName}
footprint="0402"
pcbX={x}
pcbY={keyY}
connections={{ pin2: `net.COL${colIdx}` }}
/>
<A_1N4148WS
name={diodeName}
footprint="axial_p0.2in"
pcbX={x + 0.4}
pcbY={keyY - 13.7}
rotation={90}
/>
<trace from={`net.ROW${rowIdx}`} to={`.${diodeName} > .pin2`} />
<trace from={`.${keyName} > .pin1`} to={`.${diodeName} > .pin1`} />
</React.Fragment>
)
})
)}
{/* MCU traces for rows */}
<trace from={U1.D0} to="net.ROW0" />
<trace from={U1.D1} to="net.ROW1" />
<trace from={U1.D2} to="net.ROW2" />
{/* MCU traces for 8 columns */}
{Array.from({ length: 8 }).map((_, idx) => (
<trace key={`col-trace-${idx}`} from={U1[`D${idx + 3}`]} to={`net.COL${idx}`} />
))}
</board>
)
}