forked from petejohanson/zmk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): Generate new shield interconnect docs.
* Add to metadata schema for interconnects. * New conventional location for pinout diagrams/pics. * New component to generate the tabs for the new shield doc section on interconnects. * Add XIAO and arduino uno pinout diagram. Co-authored-by: Cem Aksoylar <[email protected]>
- Loading branch information
1 parent
d993b03
commit c23443a
Showing
15 changed files
with
149 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from "react"; | ||
|
||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
|
||
import { HardwareMetadata, Interconnect } from "../hardware-metadata"; | ||
import { groupedMetadata, InterconnectDetails } from "./hardware-utils"; | ||
|
||
interface InterconnectTabsProps { | ||
items: HardwareMetadata[]; | ||
} | ||
|
||
function mapInterconnect(interconnect: Interconnect) { | ||
let content = require(`@site/src/data/interconnects/${interconnect.id}/design_guideline.md`); | ||
let imageUrl = require(`@site/docs/assets/interconnects/${interconnect.id}/pinout.png`); | ||
|
||
return ( | ||
<TabItem value={interconnect.id}> | ||
<img src={imageUrl.default} /> | ||
|
||
<content.default /> | ||
|
||
{interconnect.node_labels && ( | ||
<> | ||
The following node labels are available: | ||
<ul> | ||
<li> | ||
GPIO: <code>&{interconnect.node_labels.gpio}</code> | ||
</li> | ||
{interconnect.node_labels.i2c && ( | ||
<li> | ||
I2C bus: <code>&{interconnect.node_labels.i2c}</code> | ||
</li> | ||
)} | ||
{interconnect.node_labels.spi && ( | ||
<li> | ||
SPI bus: <code>&{interconnect.node_labels.spi}</code> | ||
</li> | ||
)} | ||
{interconnect.node_labels.uart && ( | ||
<li> | ||
UART: <code>&{interconnect.node_labels.uart}</code> | ||
</li> | ||
)} | ||
{interconnect.node_labels.adc && ( | ||
<li> | ||
ADC: <code>&{interconnect.node_labels.adc}</code> | ||
</li> | ||
)} | ||
</ul> | ||
</> | ||
)} | ||
</TabItem> | ||
); | ||
} | ||
|
||
function mapInterconnectValue(interconnect: Interconnect) { | ||
return { label: `${interconnect.name} Shields`, value: interconnect.id }; | ||
} | ||
|
||
function InterconnectTabs({ items }: InterconnectTabsProps) { | ||
let grouped = Object.values(groupedMetadata(items).interconnects) | ||
.map((i) => i?.interconnect as Interconnect) | ||
.filter((i) => i?.design_guideline) | ||
.sort((a, b) => a.id.localeCompare(b.id)); | ||
|
||
return ( | ||
<Tabs defaultValue={"pro_micro"} values={grouped.map(mapInterconnectValue)}> | ||
{grouped.map(mapInterconnect)} | ||
</Tabs> | ||
); | ||
} | ||
|
||
export default InterconnectTabs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters