309 lines
6.6 KiB
HTML
309 lines
6.6 KiB
HTML
<html>
|
|
<head>
|
|
|
|
<style>
|
|
.pin-marker {
|
|
position: absolute;
|
|
z-index: 1;
|
|
border-radius: 50%;
|
|
background-color: white;
|
|
border: 2px blue solid;
|
|
cursor: pointer;
|
|
color: black;
|
|
text-align: center;
|
|
line-height: 200%;
|
|
}
|
|
|
|
.pin-marker:hover {
|
|
background-color: #f15a24;
|
|
color: white;
|
|
transform: scale(2);
|
|
z-index: 2;
|
|
}
|
|
|
|
.pin-marker.highlight {
|
|
border: 2px #f15a24 solid;
|
|
}
|
|
|
|
.pin-marker.selected {
|
|
background-color: #fc935a;
|
|
}
|
|
|
|
#connector-container {
|
|
width: 100%;
|
|
height: 50%;
|
|
overflow-x: scroll;
|
|
position: relative;
|
|
}
|
|
|
|
#connector-div {
|
|
height: 100%;
|
|
position: relative;
|
|
z-index: 0;
|
|
}
|
|
|
|
#connector-img {
|
|
height: 100%;
|
|
z-index: 0;
|
|
}
|
|
|
|
table {
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
border-collapse: collapse;
|
|
width: clamp(100%, 100%, 1000px);
|
|
text-align: left;
|
|
}
|
|
|
|
@media (min-width: 1000px) {
|
|
table {
|
|
font-size: 1rem;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 1000px) {
|
|
table {
|
|
font-size: 3rem;
|
|
}
|
|
}
|
|
|
|
table tbody tr {
|
|
cursor: pointer;
|
|
}
|
|
|
|
table td, table th {
|
|
border: 1px solid black;
|
|
padding: 8px;
|
|
}
|
|
|
|
table tr:nth-child(even){
|
|
background-color: #fc935a;
|
|
}
|
|
|
|
table tr:hover {
|
|
background-color: #f15a24;
|
|
}
|
|
|
|
table th {
|
|
padding-top: 12px;
|
|
padding-bottom: 12px;
|
|
text-align: left;
|
|
background-color: #f15a24;
|
|
color: black;
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
html {
|
|
background-color: black;
|
|
color: white;
|
|
}
|
|
|
|
table td, table th {
|
|
border: 1px solid #ddd;
|
|
}
|
|
|
|
table th {
|
|
color: white
|
|
}
|
|
|
|
table tr:nth-child(even){
|
|
background-color: #230c00;
|
|
color: white;
|
|
}
|
|
|
|
table tr:hover {
|
|
background-color: #f15a24;
|
|
}
|
|
}
|
|
|
|
</style>
|
|
|
|
<script type="text/javascript" src="yaml.min.js"></script>
|
|
<script type="text/javascript">
|
|
var connectorYaml = `
|
|
pins:
|
|
- pin: 3
|
|
id: GPIOB_8
|
|
class: outputs
|
|
function: I2C1_SCL or CAN1_RX
|
|
ts_name: AUX J2 PB8
|
|
|
|
- pin: 6
|
|
id: GPIOB_9
|
|
class: outputs
|
|
function: I2C1_SDA or CAN1_TX
|
|
ts_name: AUX J2 PB9
|
|
|
|
- pin: 10
|
|
id: GPIOC_12
|
|
class: outputs
|
|
function: SPI3_MOSI or USART3_CK or UART5_TX
|
|
ts_name: AUX J2 PC12
|
|
|
|
- pin: 7
|
|
id: GPIOA_15
|
|
class: outputs
|
|
function: SPI3_NSS (Chip Select)
|
|
ts_name: AUX J2 PA15
|
|
`;
|
|
|
|
function addRow(table, pin, pdiv) {
|
|
var template = document.getElementById("table-template");
|
|
var clone = template.content.cloneNode(true);
|
|
var row = clone.querySelector(".data");
|
|
var pdata = clone.querySelector(".pin-data");
|
|
var idata = clone.querySelector(".id-data");
|
|
var tdata = clone.querySelector(".type-data");
|
|
var fdata = clone.querySelector(".function-data");
|
|
var cdata = clone.querySelector(".color-data");
|
|
pdata.textContent = pin.pin;
|
|
idata.textContent = pin.id;
|
|
tdata.textContent = pin.type
|
|
fdata.textContent = pin.function;
|
|
cdata.textContent = pin.color
|
|
row.addEventListener('click', function(pin, pdiv) {
|
|
clickPin(pin, pdiv);
|
|
}.bind(null, pin, pdiv));
|
|
table.appendChild(clone);
|
|
}
|
|
|
|
function clickPin(pin, pdiv) {
|
|
var table = document.getElementById("info-table").querySelector("tbody");
|
|
table.innerHTML = "";
|
|
if (Array.isArray(pin.id)) {
|
|
var pinIds = pin.id.filter((value, index) => {
|
|
return pin.id.indexOf(value) === index;
|
|
});
|
|
for (var i = 0; i < pinIds.length; i++) {
|
|
addRow(table, {pin: pin.pin, id: pinIds[i], function: pin.function}, pdiv);
|
|
}
|
|
} else {
|
|
addRow(table, pin, pdiv);
|
|
}
|
|
var pins = document.querySelectorAll(".pin-marker");
|
|
for (var i = 0; i < pins.length; i++) {
|
|
if (pins[i].dataset.type == pin.type) {
|
|
pins[i].classList.add("highlight");
|
|
} else {
|
|
pins[i].classList.remove("highlight");
|
|
}
|
|
pins[i].classList.remove("selected");
|
|
}
|
|
pdiv.classList.add("selected");
|
|
}
|
|
|
|
function adjustMarkers() {
|
|
var cdiv = document.getElementById("connector-div");
|
|
cdiv.style.width = document.getElementById("connector-img").clientWidth;
|
|
var pins = document.querySelectorAll(".pin-marker");
|
|
for (var i = 0; i < pins.length; i++) {
|
|
var height = cdiv.clientHeight * 0.05;
|
|
pins[i].style.height = height + "px";
|
|
pins[i].style.width = height + "px";
|
|
pins[i].style.marginTop = "-" + (height * 0.5) + "px";
|
|
pins[i].style.marginLeft = "-" + (height * 0.5) + "px";
|
|
pins[i].style.fontSize = (height * 0.5) + "px";
|
|
}
|
|
}
|
|
|
|
window.addEventListener('load', function() {
|
|
var connector = YAML.parse(connectorYaml);
|
|
document.getElementById("connector-img").addEventListener('load', function() {
|
|
for (var i = 0; i < connector.pins.length; i++) {
|
|
var pin = connector.pins[i];
|
|
if (!pin.pin) {
|
|
continue;
|
|
}
|
|
var pinfo;
|
|
for (var ii = 0; ii < connector.info.pins.length; ii++) {
|
|
if (connector.info.pins[ii].pin == pin.pin) {
|
|
pinfo = connector.info.pins[ii];
|
|
break;
|
|
}
|
|
}
|
|
var cdiv = document.getElementById("connector-div");
|
|
var template = document.getElementById("pin-template");
|
|
var clone = template.content.cloneNode(true);
|
|
var pdiv = clone.querySelector("div");
|
|
var img = document.getElementById("connector-img");
|
|
var imgHeight = img.naturalHeight;
|
|
var imgWidth = img.naturalWidth;
|
|
pdiv.textContent = pinfo.pin;
|
|
pdiv.style.top = ((pinfo.y / imgHeight) * 100) + "%";
|
|
pdiv.style.left = ((pinfo.x / imgWidth) * 100) + "%";
|
|
pdiv.dataset.type = pin.type;
|
|
pdiv.addEventListener("click", function(pin, pdiv) {
|
|
clickPin(pin, pdiv);
|
|
}.bind(null, pin, pdiv));
|
|
cdiv.appendChild(pdiv);
|
|
var fullTable = document.getElementById("pinout-table").querySelector("tbody");
|
|
addRow(fullTable, connector.pins[i], pdiv);
|
|
}
|
|
adjustMarkers();
|
|
});
|
|
document.getElementById("connector-img").src = connector.info.image.file;
|
|
});
|
|
|
|
window.addEventListener('resize', function() {
|
|
adjustMarkers();
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<template id="pin-template">
|
|
<div class="pin-marker"></div>
|
|
</template>
|
|
|
|
<div id="connector-container">
|
|
<div id="connector-div">
|
|
<img id="connector-img"></img>
|
|
</div>
|
|
</div>
|
|
|
|
<template id="table-template">
|
|
<tr class="data">
|
|
<td class="pin-data"></td>
|
|
<td class="id-data"></td>
|
|
<td class="type-data"></td>
|
|
<td class="function-data"></td>
|
|
<td class="color-data"></td>
|
|
</tr>
|
|
</template>
|
|
|
|
<table id="info-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Pin Number</th>
|
|
<th>Firmware ID</th>
|
|
<th>Type</th>
|
|
<th>Typical Function</th>
|
|
<th>Pigtail Color</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
<br/>
|
|
<br/>
|
|
|
|
<h2>Full Pinout Table</h2>
|
|
<table id="pinout-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Pin Number</th>
|
|
<th>Firmware ID</th>
|
|
<th>Type</th>
|
|
<th>Typical Function</th>
|
|
<th>Pigtail Color</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
|
|
</body>
|
|
</html>
|