Skip to content

Commit

Permalink
Enable all targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatekii committed Nov 12, 2023
1 parent 953f711 commit 175ac35
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 7 deletions.
1 change: 1 addition & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 71 additions & 1 deletion src/_includes/layouts/target.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import Base from "./base.jsx";
import humanFileSize from "./../helpers.js";

export default (
export default async (
{ target, title },
filters,
) => {
let svd = undefined;
if (target.svd) {
const decoder = new TextDecoder("utf-8");
const data = await Deno.readFile(`src/targets/nrf52.json`);
const json = decoder.decode(data);
svd = JSON.parse(json);
}

return (
<Base pageCss="target.css" title={title}>
<main className="target">
<section>
<h1>{target.name}</h1>
</section>
<Memory target={target} />
<SVD svd={svd} />
</main>
</Base>
);
Expand Down Expand Up @@ -102,3 +111,64 @@ const Memory = (
</section>
);
};

const SVD = (
{ svd },
filters,
) => {
if (!svd) {
return <></>;
}
return (
<section>
<div className="body">
<div className="container">
<div className="data">
<div className="svd" style={{ borderColor: "#ffb14e" }}>
{svd.peripherals.map((peripheral) => (
<Peripheral
peripheral={peripheral}
/>
))}
</div>
</div>
</div>
</div>
</section>
);
};

const Peripheral = (
{ peripheral },
filters,
) => {
return (
<div className="peripheral">
<div
style={{
width: "100%",
display: "flex",
justifyContent: "space-between",
}}
>
<h3>
{peripheral.name} @ 0x{peripheral.baseAddress.toString(16)} -{" "}
{peripheral.description}
</h3>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 256 256"
height="16"
width="16"
style={{ display: "inline", paddingTop: "2.5px" }}
>
<rect width="256" height="256" fill="none" />
<path
d="M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34Z"
fill="white"
/>
</svg>
</div>
</div>
);
};
34 changes: 29 additions & 5 deletions src/styles/pages/target.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@
border-bottom: solid 1px var(--color-background-2);
padding: 20px;

& .body {
&>.body {
width: 100%;
display: flex;
flex-direction: row;
justify-content: start;

& .column {
&>.column {
width: 50%;

& .data {
&>.data {
width: 100%;
display: flex;
flex-direction: row;
justify-content: start;
flex-wrap: wrap;
gap: 5px;

& .item {
&>.item {
width: 160px;
height: 160px;
padding: 20px;
Expand All @@ -57,12 +57,36 @@
background-color: var(--color-background-1);
}

& pre {
&>pre {
margin-top: 5px;
}
}
}
}

&>.container {
width: 100%;

& .data {
width: 100%;
display: flex;
flex-direction: row;
justify-content: start;
flex-wrap: wrap;
gap: 5px;

& .svd {
width: 100%;

& .peripheral {
width: calc(100% - 2 * 2 * 10px);
padding: 10px;
margin: 10px;
border: solid 1px var(--color-background-2);
}
}
}
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/targets/pages.tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default async function* ({ loadTargets, latestRelease }) {
const { targets: targetsLatest } = await loadTargets(latestReleasedVersion);
const { targets: targetsMaster } = await loadTargets("master");
for (const target of targetsLatest) {
if (target.name.includes("nRF52")) {
if (filter(target) || Deno.env.get("GITHUB_ACTIONS")) {
yield {
url: `/targets/${latestReleasedVersion}/${target.name}.html`,
title: target.name,
Expand All @@ -15,3 +15,7 @@ export default async function* ({ loadTargets, latestRelease }) {
}
}
}

function filter(target) {
return target.name.includes("nRF52");
}

0 comments on commit 175ac35

Please sign in to comment.