first commit

This commit is contained in:
liyp 2024-09-09 17:40:33 +08:00 committed by iorebuild
parent f165960913
commit 602872fb07
35 changed files with 5278 additions and 0 deletions

7
package.json Normal file
View File

@ -0,0 +1,7 @@
{
"scripts": {
"dev": "npm run dev",
"tauri": "tauri",
"build": "npm run build"
}
}

0
readme.txt Normal file
View File

3
src-tauri/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Generated by Cargo
# will have compiled files and executables
/target/

3680
src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

26
src-tauri/Cargo.toml Normal file
View File

@ -0,0 +1,26 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.60"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.5.1", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.5.4", features = [] }
[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
# DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]

3
src-tauri/build.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}

BIN
src-tauri/icons/128x128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
src-tauri/icons/32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src-tauri/icons/icon.icns Normal file

Binary file not shown.

BIN
src-tauri/icons/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
src-tauri/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

8
src-tauri/src/main.rs Normal file
View File

@ -0,0 +1,8 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

65
src-tauri/tauri.conf.json Normal file
View File

@ -0,0 +1,65 @@
{
"build": {
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "npm run dev",
"devPath": "../ui",
"distDir": "../ui"
},
"package": {
"productName": "EmbTools",
"version": "0.1.0"
},
"tauri": {
"allowlist": {
"all": false
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"deb": {
"depends": []
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "com.tauri.dev",
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"resources": [],
"shortDescription": "",
"targets": "all",
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"security": {
"csp": null
},
"updater": {
"active": false
},
"windows": [
{
"fullscreen": false,
"height": 600,
"resizable": true,
"title": "EmbTools",
"width": 1152
}
]
}
}

10
ui/css/base.css Normal file
View File

@ -0,0 +1,10 @@
*{
padding: 0px;
margin: 0px;
}
#app_title{
margin-left: 0.5%;
}
#mainbox{
border: 1px solid black;
}

62
ui/css/file_create.css Normal file
View File

@ -0,0 +1,62 @@
#file_create{
width: 99%;
border-radius: 8px;
background-color: #EEEEEEEE;
margin-top: 3px;
text-align: initial;
}
#file_create h3
{
text-align: center;
}
#file_create input
{
font-size: 18px;
margin-left: 10px;
}
#file_create select
{
font-size: 18px;
margin-left: 10px;
}
#file_create hr
{
width: 98%;
margin: 0 auto;
margin-top: 3px;
margin-bottom: 3px;
}
.conf_title
{
font-size: 18px;
display: inline;
width: 30%;
margin-left: 6px;
}
#board_h_click
{
text-align: center;
vertical-align: top;
margin-bottom: 5px;
font-size: 18px;
width: 55%;
}
#board_h
{
font-family: "SimHei", Arial, sans-serif; /* 黑体 */
text-align: left;
vertical-align: top;
width: 99%;
height: 1000px;
font-size: 16px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #333; /* 文本颜色 */
background-color: #fff; /* 背景色 */
}
#do_box , #di_box
{
float: right;
margin-right: 10px;
margin-bottom: 10px;
}

20
ui/css/jldjs.css Normal file
View File

@ -0,0 +1,20 @@
#jld_calc
{
width: 99%;
border-radius: 8px;
background-color: #EEEEEEEE;
}
#jld_calc tr{
line-height: 35px;
}
#jld_calc td{
text-align: center;
width: 33%;
}
#jld_calc td input{
border-radius: 3px;
background-color: #EEEEEEEE;
width: 100%;
height: 30px;
border: 0.5px solid black;
}

903
ui/index.html Normal file
View File

@ -0,0 +1,903 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/jldjs.css">
<link rel="stylesheet" href="css/file_create.css">
<title>EmbTools</title>
</head>
<body>
<h1 id="app_title">EmbTools</h1>
<div id="mainbox">
<!-- 电压计算开始 -->
<center>
<table id="jld_calc">
<tr>
<td></td>
<td><h3>交流电计算器</h3></td>
</tr>
<tr>
<td>相电压 -> 线电压</td>
<td><input type="text" placeholder=" 0.0" id="input_xiang"></td>
<td></td>
</tr>
<tr>
<td>线电压 -> 相电压</td>
<td><input type="text" placeholder=" 0.0" id="input_line"></td>
<td></td>
</tr>
</table>
</center>
<script src="js/jldcalc.js"></script>
<!-- 电压计算结束 -->
<!-- 文件生成器开始 -->
<center>
<div id="file_create">
<h3>文件生成器</h3>
<div class="conf_title">选择单片机系列</div>
<select id="mcu_type">
<option value="gd32f4xx.h">GD32f4xx</option>
</select>
<hr></hr>
<div class="conf_title">软件名称:</div>
<input type="text" name="" id="software_name">
<hr></hr>
<div class="conf_title">硬件版本:</div>
<input type="text" name="" id="hardware_ver">
<hr></hr>
<div class="conf_title">软件版本:</div>
<input type="text" name="" id="softwar_ver">
<hr></hr>
<input type="checkbox" name="com" id="com0">
<label for="com0" class="conf_title">COM0</label>
<div class="conf_title">GPIO:</div>
<select id="com0_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="com0_TX">
</select>
<div class="conf_title">RX:</div>
<select id="com0_RX">
</select>
<hr></hr>
<input type="checkbox" name="com" id="com1">
<label for="com1" class="conf_title">COM1</label>
<div class="conf_title">GPIO:</div>
<select id="com1_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="com1_TX">
</select>
<div class="conf_title">RX:</div>
<select id="com1_RX">
</select>
<hr></hr>
<input type="checkbox" name="com" id="com2">
<label for="com2" class="conf_title">COM2</label>
<div class="conf_title">GPIO:</div>
<select id="com2_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="com2_TX">
</select>
<div class="conf_title">RX:</div>
<select id="com2_RX">
</select>
<hr></hr>
<input type="checkbox" name="com" id="com3">
<label for="com3" class="conf_title">COM3</label>
<div class="conf_title">GPIO:</div>
<select id="com3_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="com3_TX">
</select>
<div class="conf_title">RX:</div>
<select id="com3_RX">
</select>
<hr></hr>
<input type="checkbox" name="com" id="com4">
<label for="com4" class="conf_title">COM4</label>
<div class="conf_title">GPIO:</div>
<select id="com4_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="com4_TX">
</select>
<div class="conf_title">RX:</div>
<select id="com4_RX">
</select>
<hr></hr>
<input type="checkbox" name="com" id="com5">
<label for="com5" class="conf_title">COM5</label>
<div class="conf_title">GPIO:</div>
<select id="com5_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="com5_TX">
</select>
<div class="conf_title">RX:</div>
<select id="com5_RX">
</select>
<hr></hr>
<input type="checkbox" name="com" id="shell_com">
<label for="shell_com" class="conf_title">SHELL_COM</label>
<select id="shell_com_COM">
<option value="COM0">COM0</option>
<option value="COM1">COM1</option>
<option value="COM2">COM2</option>
<option value="COM3">COM3</option>
<option value="COM4">COM4</option>
<option value="COM5">COM5</option>
</select>
<hr></hr>
<input type="checkbox" name="com" id="rs4851_com">
<label for="rs4851_com" class="conf_title">RS4851_COM</label>
<select id="rs4851_com_COM">
<option value="COM0">COM0</option>
<option value="COM1">COM1</option>
<option value="COM2">COM2</option>
<option value="COM3">COM3</option>
<option value="COM4">COM4</option>
<option value="COM5">COM5</option>
</select>
<div class="conf_title">EN_GPIO:</div>
<select id="rs4851_EN_gpio">
</select>
<div class="conf_title">EN_PIN:</div>
<select id="rs4851_EN_pin">
</select>
<hr></hr>
<input type="checkbox" name="com" id="rs4852_com">
<label for="rs4852_com" class="conf_title">RS4852_COM</label>
<select id="rs4852_com_COM">
<option value="COM0">COM0</option>
<option value="COM1">COM1</option>
<option value="COM2">COM2</option>
<option value="COM3">COM3</option>
<option value="COM4">COM4</option>
<option value="COM5">COM5</option>
</select>
<div class="conf_title">EN_GPIO:</div>
<select id="rs4852_EN_gpio">
</select>
<div class="conf_title">EN_PIN:</div>
<select id="rs4852_EN_pin">
</select>
<hr></hr>
<!-- DO的GPIO口选择 -->
<input type="checkbox" name="gpio_out" id="gpio_out">
<label for="gpio_out" class="conf_title">GPIO_OUT</label>
<div id="do_box">
<!-- DO1 -->
<input type="checkbox" name="do_Val" id="do_1">
<label for="do_1" class="conf_title">DO1&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_1_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_1_PIN">
</select>
<!-- DO2 -->
<input type="checkbox" name="do_Val" id="do_2">
<label for="do_2" class="conf_title">DO2&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_2_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_2_PIN">
</select>
</br>
<!-- DO3 -->
<input type="checkbox" name="do_Val" id="do_3">
<label for="do_3" class="conf_title">DO3&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_3_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_3_PIN">
</select>
<!-- DO4 -->
<input type="checkbox" name="do_Val" id="do_4">
<label for="do_4" class="conf_title">DO4&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_4_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_4_PIN">
</select>
</br>
<!-- DO5 -->
<input type="checkbox" name="do_Val" id="do_5">
<label for="do_5" class="conf_title">DO5&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_5_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_5_PIN">
</select>
<!-- DO6 -->
<input type="checkbox" name="do_Val" id="do_6">
<label for="do_6" class="conf_title">DO6&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_6_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_6_PIN">
</select>
</br>
<!-- DO7 -->
<input type="checkbox" name="do_Val" id="do_7">
<label for="do_7" class="conf_title">DO7&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_7_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_7_PIN">
</select>
<!-- DO8 -->
<input type="checkbox" name="do_Val" id="do_8">
<label for="do_8" class="conf_title">DO8&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_8_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_8_PIN">
</select>
</br>
<!-- DO9 -->
<input type="checkbox" name="do_Val" id="do_9">
<label for="do_9" class="conf_title">DO9&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="do_9_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_9_PIN">
</select>
<!-- DO10 -->
<input type="checkbox" name="do_Val" id="do_10">
<label for="do_10" class="conf_title">DO10</label>
<div class="conf_title">GPIO:</div>
<select id="do_10_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_10_PIN">
</select>
</br>
<!-- DO11 -->
<input type="checkbox" name="do_Val" id="do_11">
<label for="do_11" class="conf_title">DO11</label>
<div class="conf_title">GPIO:</div>
<select id="do_11_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_11_PIN">
</select>
<!-- DO12 -->
<input type="checkbox" name="do_Val" id="do_12">
<label for="do_12" class="conf_title">DO12</label>
<div class="conf_title">GPIO:</div>
<select id="do_12_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_12_PIN">
</select>
</br>
<!-- DO13 -->
<input type="checkbox" name="do_Val" id="do_13">
<label for="do_13" class="conf_title">DO13</label>
<div class="conf_title">GPIO:</div>
<select id="do_13_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_13_PIN">
</select>
<!-- DO14 -->
<input type="checkbox" name="do_Val" id="do_14">
<label for="do_14" class="conf_title">DO14</label>
<div class="conf_title">GPIO:</div>
<select id="do_14_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_14_PIN">
</select>
</br>
<!-- DO15 -->
<input type="checkbox" name="do_Val" id="do_15">
<label for="do_15" class="conf_title">DO15</label>
<div class="conf_title">GPIO:</div>
<select id="do_15_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_15_PIN">
</select>
<!-- DO16 -->
<input type="checkbox" name="do_Val" id="do_16">
<label for="do_16" class="conf_title">DO16</label>
<div class="conf_title">GPIO:</div>
<select id="do_16_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_16_PIN">
</select>
</br>
<!-- DO17 -->
<input type="checkbox" name="do_Val" id="do_17">
<label for="do_17" class="conf_title">DO17</label>
<div class="conf_title">GPIO:</div>
<select id="do_17_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_17_PIN">
</select>
<!-- DO18 -->
<input type="checkbox" name="do_Val" id="do_18">
<label for="do_18" class="conf_title">DO18</label>
<div class="conf_title">GPIO:</div>
<select id="do_18_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_18_PIN">
</select>
</br>
<!-- DO19 -->
<input type="checkbox" name="do_Val" id="do_19">
<label for="do_19" class="conf_title">DO19</label>
<div class="conf_title">GPIO:</div>
<select id="do_19_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_19_PIN">
</select>
<!-- DO20 -->
<input type="checkbox" name="do_Val" id="do_20">
<label for="do_20" class="conf_title">DO20</label>
<div class="conf_title">GPIO:</div>
<select id="do_20_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_20_PIN">
</select>
</br>
<!-- DO21 -->
<input type="checkbox" name="do_Val" id="do_21">
<label for="do_21" class="conf_title">DO21</label>
<div class="conf_title">GPIO:</div>
<select id="do_21_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_21_PIN">
</select>
<!-- DO22 -->
<input type="checkbox" name="do_Val" id="do_22">
<label for="do_22" class="conf_title">DO22</label>
<div class="conf_title">GPIO:</div>
<select id="do_22_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_22_PIN">
</select>
</br>
<!-- DO23 -->
<input type="checkbox" name="do_Val" id="do_23">
<label for="do_23" class="conf_title">DO23</label>
<div class="conf_title">GPIO:</div>
<select id="do_23_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_23_PIN">
</select>
<!-- DO24 -->
<input type="checkbox" name="do_Val" id="do_24">
<label for="do_24" class="conf_title">DO24</label>
<div class="conf_title">GPIO:</div>
<select id="do_24_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_24_PIN">
</select>
</br>
<!-- DO25 -->
<input type="checkbox" name="do_Val" id="do_25">
<label for="do_25" class="conf_title">DO25</label>
<div class="conf_title">GPIO:</div>
<select id="do_25_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_25_PIN">
</select>
<!-- DO26 -->
<input type="checkbox" name="do_Val" id="do_26">
<label for="do_26" class="conf_title">DO26</label>
<div class="conf_title">GPIO:</div>
<select id="do_26_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_26_PIN">
</select>
</br>
<!-- DO27 -->
<input type="checkbox" name="do_Val" id="do_27">
<label for="do_27" class="conf_title">DO27</label>
<div class="conf_title">GPIO:</div>
<select id="do_27_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_27_PIN">
</select>
<!-- DO28 -->
<input type="checkbox" name="do_Val" id="do_28">
<label for="do_28" class="conf_title">DO28</label>
<div class="conf_title">GPIO:</div>
<select id="do_28_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_28_PIN">
</select>
</br>
<!-- DO29 -->
<input type="checkbox" name="do_Val" id="do_29">
<label for="do_29" class="conf_title">DO29</label>
<div class="conf_title">GPIO:</div>
<select id="do_29_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_29_PIN">
</select>
<!-- DO30 -->
<input type="checkbox" name="do_Val" id="do_30">
<label for="do_30" class="conf_title">DO30</label>
<div class="conf_title">GPIO:</div>
<select id="do_30_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="do_30_PIN">
</select>
</br>
</div>
<hr></hr>
<!-- DO的GPIO口选择 -->
<input type="checkbox" name="gpio_in" id="gpio_in">
<label for="gpio_in" class="conf_title">GPIO_IN</label>
<div id="di_box">
<!-- DI1 -->
<input type="checkbox" name="di_Val" id="di_1">
<label for="di_1" class="conf_title">DI1&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_1_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_1_PIN">
</select>
<!-- DI2 -->
<input type="checkbox" name="di_Val" id="di_2">
<label for="di_2" class="conf_title">DI2&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_2_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_2_PIN">
</select>
</br>
<!-- DI3 -->
<input type="checkbox" name="di_Val" id="di_3">
<label for="di_3" class="conf_title">DI3&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_3_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_3_PIN">
</select>
<!-- DI4 -->
<input type="checkbox" name="di_Val" id="di_4">
<label for="di_4" class="conf_title">DI4&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_4_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_4_PIN">
</select>
</br>
<!-- DI5 -->
<input type="checkbox" name="di_Val" id="di_5">
<label for="di_5" class="conf_title">DI5&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_5_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_5_PIN">
</select>
<!-- DI6 -->
<input type="checkbox" name="di_Val" id="di_6">
<label for="di_6" class="conf_title">DI6&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_6_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_6_PIN">
</select>
</br>
<!-- DI7 -->
<input type="checkbox" name="di_Val" id="di_7">
<label for="di_7" class="conf_title">DI7&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_7_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_7_PIN">
</select>
<!-- DI8 -->
<input type="checkbox" name="di_Val" id="di_8">
<label for="di_8" class="conf_title">DI8&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_8_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_8_PIN">
</select>
</br>
<!-- DI9 -->
<input type="checkbox" name="di_Val" id="di_9">
<label for="di_9" class="conf_title">DI9&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_9_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_9_PIN">
</select>
<!-- DI10 -->
<input type="checkbox" name="di_Val" id="di_10">
<label for="di_10" class="conf_title">DI10&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_10_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_10_PIN">
</select>
</br>
<!-- DI11 -->
<input type="checkbox" name="di_Val" id="di_11">
<label for="di_11" class="conf_title">DI11&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_11_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_11_PIN">
</select>
<!-- DI12 -->
<input type="checkbox" name="di_Val" id="di_12">
<label for="di_12" class="conf_title">DI12&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_12_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_12_PIN">
</select>
</br>
<!-- DI13 -->
<input type="checkbox" name="di_Val" id="di_13">
<label for="di_13" class="conf_title">DI13&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_13_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_13_PIN">
</select>
<!-- DI14 -->
<input type="checkbox" name="di_Val" id="di_14">
<label for="di_14" class="conf_title">DI14&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_14_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_14_PIN">
</select>
</br>
<!-- DI15 -->
<input type="checkbox" name="di_Val" id="di_15">
<label for="di_15" class="conf_title">DI15&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_15_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_15_PIN">
</select>
<!-- DI16 -->
<input type="checkbox" name="di_Val" id="di_16">
<label for="di_16" class="conf_title">DI16&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_16_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_16_PIN">
</select>
</br>
<!-- DI17 -->
<input type="checkbox" name="di_Val" id="di_17">
<label for="di_17" class="conf_title">DI17&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_17_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_17_PIN">
</select>
<!-- DI18 -->
<input type="checkbox" name="di_Val" id="di_18">
<label for="di_18" class="conf_title">DI18&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_18_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_18_PIN">
</select>
</br>
<!-- DI19 -->
<input type="checkbox" name="di_Val" id="di_19">
<label for="di_19" class="conf_title">DI19&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_19_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_19_PIN">
</select>
<!-- DI20 -->
<input type="checkbox" name="di_Val" id="di_20">
<label for="di_20" class="conf_title">DI20&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_20_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_20_PIN">
</select>
</br>
<!-- DI21 -->
<input type="checkbox" name="di_Val" id="di_21">
<label for="di_21" class="conf_title">DI21&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_21_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_21_PIN">
</select>
<!-- DI22 -->
<input type="checkbox" name="di_Val" id="di_22">
<label for="di_22" class="conf_title">DI22&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_22_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_22_PIN">
</select>
</br>
<!-- DI23 -->
<input type="checkbox" name="di_Val" id="di_23">
<label for="di_23" class="conf_title">DI23&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_23_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_23_PIN">
</select>
<!-- DI24 -->
<input type="checkbox" name="di_Val" id="di_24">
<label for="di_24" class="conf_title">DI24&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_24_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_24_PIN">
</select>
</br>
<!-- DI25 -->
<input type="checkbox" name="di_Val" id="di_25">
<label for="di_25" class="conf_title">DI25&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_25_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_25_PIN">
</select>
<!-- DI26 -->
<input type="checkbox" name="di_Val" id="di_26">
<label for="di_26" class="conf_title">DI26&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_26_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_26_PIN">
</select>
</br>
<!-- DI27 -->
<input type="checkbox" name="di_Val" id="di_27">
<label for="di_27" class="conf_title">DI27&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_27_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_27_PIN">
</select>
<!-- DI28 -->
<input type="checkbox" name="di_Val" id="di_28">
<label for="di_28" class="conf_title">DI28&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_28_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_28_PIN">
</select>
</br>
<!-- DI29 -->
<input type="checkbox" name="di_Val" id="di_29">
<label for="di_29" class="conf_title">DI29&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_29_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_29_PIN">
</select>
<!-- DI30 -->
<input type="checkbox" name="di_Val" id="di_30">
<label for="di_30" class="conf_title">DI30&nbsp;&nbsp;</label>
<div class="conf_title">GPIO:</div>
<select id="di_30_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="di_30_PIN">
</select>
</br>
</div>
<hr></hr>
<input type="checkbox" name="com" id="ai_1">
<label for="ai_1" class="conf_title">ADC1_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_1_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_1_PIN">
</select>
<hr></hr>
<input type="checkbox" name="com" id="ai_2">
<label for="ai_2" class="conf_title">ADC2_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_2_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_2_PIN">
</select>
<hr></hr>
<input type="checkbox" name="com" id="ai_3">
<label for="ai_3" class="conf_title">ADC3_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_3_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_3_PIN">
</select>
<hr></hr>
<input type="checkbox" name="com" id="ai_4">
<label for="ai_4" class="conf_title">ADC4_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_4_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_4_PIN">
</select>
<hr></hr>
<input type="checkbox" name="com" id="ai_5">
<label for="ai_5" class="conf_title">ADC5_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_5_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_5_PIN">
</select>
<hr></hr>
<input type="checkbox" name="com" id="ai_6">
<label for="ai_6" class="conf_title">ADC6_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_6_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_6_PIN">
</select>
<hr></hr>
<input type="checkbox" name="com" id="ai_7">
<label for="ai_7" class="conf_title">ADC7_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_7_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_7_PIN">
</select>
<hr></hr>
<input type="checkbox" name="com" id="ai_8">
<label for="ai_8" class="conf_title">ADC8_CHANNEL:</label>
<div class="conf_title">GPIO:</div>
<select id="ai_8_GPIO">
</select>
<div class="conf_title">PIN:</div>
<select id="ai_8_PIN">
</select>
<hr></hr>
<!-- CAN总线 -->
<input type="checkbox" name="can" id="can0">
<label for="can0" class="conf_title">CAN0</label>
<div class="conf_title">GPIO:</div>
<select id="can0_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="can0_TX">
</select>
<div class="conf_title">RX:</div>
<select id="can0_RX">
</select>
<hr></hr>
<input type="checkbox" name="can" id="can1">
<label for="can1" class="conf_title">CAN1</label>
<div class="conf_title">GPIO:</div>
<select id="can1_GPIO">
</select>
<div class="conf_title">TX:</div>
<select id="can1_TX">
</select>
<div class="conf_title">RX:</div>
<select id="can1_RX">
</select>
<hr></hr>
<center>
<button id="board_h_click">一键生成board.h与syslib.c文件</button>
</center>
<center>
<textarea id="board_h" rows="5" cols="78"></textarea>
</center>
</div>
</center>
<script src="js/file_board_h.js"></script>
<!-- 文件生成器结束 -->
</div>
</body>
</html>

0
ui/js/base.js Normal file
View File

0
ui/js/define_create.js Normal file
View File

461
ui/js/file_board_h.js Normal file
View File

@ -0,0 +1,461 @@
//最大GPIO组,应该根据芯片进行区分
var MAX_GPIO_NUM = 7
//每一组的最大GPIO口PIN数量
var MAX_GPIO_PIN_NUM = 15
//最大ADC数量
var MAX_ADC_NUM = 8
//最大485数量
var MAX_RS485_NUM = 2
//最大ADC采样值
var MAX_ADC_VALUE = 4096
//最大CAN数量
var MAX_CAN_NUM = 2
//最大串口数量
var MAX_COM_NUM = 6
//最大DO数量
var MAX_DO_NUM = 30
//最大DI数量
var MAX_DI_NUM = 30
//获取整个文件空间的id
var board_h = document.querySelector("#board_h")
//获取CPU类型
var mcu_type = document.querySelector("#mcu_type")
//获取串口
var com0 = document.querySelector("#com0")
var com1 = document.querySelector("#com1")
var com2 = document.querySelector("#com2")
var com3 = document.querySelector("#com3")
var com4 = document.querySelector("#com4")
var com5 = document.querySelector("#com5")
let comIndex = ["com0","com1","com2","com3","com4","com5"]
let canIndex = ["can0","can1"]
let comIndexSwitch = []
var rs4851 = document.querySelector("#rs4851_com")
var rs4852 = document.querySelector("#rs4852_com")
//获取一键生成按钮
var click_button = document.querySelector("#board_h_click");
function addHead(mcu_type){
//头标记
board_h.textContent += "/* 存放板子的资源配置文件 */\n"
board_h.textContent += "#ifndef __BOARD_H_\n"
board_h.textContent += "#define __BOARD_H_\n\n"
board_h.textContent += "/* 不同的CPU 选择不同的头文件 */\n"
//引入头文件
board_h.textContent += "#include "
board_h.textContent += "\"" + mcu_type.value + "\"" + "\n"
//版本号
//软件名称
board_h.textContent += "\n"
board_h.textContent += "/* 软件名称" + " */\n"
board_h.textContent += "#define SOFTWARE_NAME \"" + document.querySelector("#software_name").value + "\"\n"
board_h.textContent += "/* 硬件版本" + " */\n"
board_h.textContent += "#define HARDWARE_VER \"" + document.querySelector("#hardware_ver").value + "\"\n"
board_h.textContent += "/* 软件版本" + " */\n"
board_h.textContent += "#define SOFTWARE_VER \"" + document.querySelector("#softwar_ver").value + "\"\n"
}
function addCom()
{
for(var i = 0;i < MAX_COM_NUM;i++)
{
var canid = document.querySelector("#com" + i)
if (canid.checked == true)
{
board_h.textContent += "\n"
board_h.textContent += "/* 添加串口" + i + " */\n"
board_h.textContent += "#define INCLUDE_COM" + i + "\n"
board_h.textContent += "#ifdef " + "INCLUDE_COM" + i + "\n"
board_h.textContent += " #define COM" + i + "_PORT " + document.querySelector("#com" + i + "_GPIO").value + "\n"
board_h.textContent += " #define COM" + i + "_TX_PIN " + "GPIO_" +document.querySelector("#com" + i + "_TX").value + "\n"
board_h.textContent += " #define COM" + i + "_RX_PIN " + "GPIO_" +document.querySelector("#com" + i + "_RX").value + "\n"
board_h.textContent += "#endif\n"
}
}
}
function addShell()
{
if (document.querySelector("#shell_com").checked == true)
{
board_h.textContent += "\n"
board_h.textContent += "/* 添加SHELL口" + " */\n"
board_h.textContent += "#define INCLUDE_SHELL\n"
board_h.textContent += "#ifdef INCLUDE_SHELL\n"
board_h.textContent += " #define SHELL_COM " + document.querySelector("#shell_com_COM").value + "\n"
board_h.textContent += "#endif\n"
}
}
function addRs485(rs485_com,index)
{
if (rs485_com.checked == true)
{
board_h.textContent += "\n"
board_h.textContent += "/* RS485" + index + " */\n"
board_h.textContent += "#define INCLUDE_RS485" + index + "\n"
board_h.textContent += "#ifdef INCLUDE_RS485" + index + "\n"
board_h.textContent += " #define RS485" + index + "_COM " + document.querySelector("#rs485" + index + "_com" + "_COM").value + "\n"
board_h.textContent += "#endif\n"
}
}
function addEndif(){
board_h.textContent += "\n"
board_h.textContent += "#endif\n"
}
function getRs485EnNum()
{
var en_id
var en_SUM = 0
for(var i = 1;i < MAX_RS485_NUM + 1;i++)
{
en_id = document.querySelector("#rs485" + i + "_EN_gpio")
if(en_id.value != "NONE")
{
en_SUM++
}
}
return en_SUM
}
function getDoNum(){
var do_id
var do_SUM = 0
var en_id
for(var i = 1;i < MAX_DO_NUM + 1;i++)
{
do_id = document.querySelector("#do_" + i)
if(do_id.checked == true)
{
do_SUM++
}
}
for(var i = 1;i < MAX_RS485_NUM + 1;i++)
{
en_id = document.querySelector("#rs485" + i + "_EN_gpio")
if(en_id.value != "NONE")
{
do_SUM++
}
}
return do_SUM
}
function getDiNum(){
var di_id
var di_SUM = 0
for(var i = 1;i < MAX_DI_NUM + 1;i++)
{
di_id = document.querySelector("#di_" + i)
if(di_id.checked == true)
{
di_SUM++
}
}
return di_SUM
}
function addDo(){
var do_id
var do_gpio
var do_pin
var do_index = 0
var en_id
var en_pin
var do_num = getDoNum()
var en_index = 0
board_h.textContent += "\n"
board_h.textContent += "#define INCLUDE_GPIO\n"
board_h.textContent += "#ifdef INCLUDE_GPIO\n"
board_h.textContent += "#define GPIO_OUTPUT_NUM " + do_num + "\n"
for(var i = 1;i < MAX_DO_NUM + 1;i++)
{
do_id = document.querySelector("#do_" + i)
if(do_id.checked == true)
{
do_index++
do_gpio = document.querySelector("#do_" + i + "_GPIO").value
do_pin = document.querySelector("#do_" + i + "_PIN").value
board_h.textContent += " #define DO" + i + " " + (do_index -1)
board_h.textContent += " /* P" + do_gpio[do_gpio.length - 1] + "_" + do_pin[do_pin.length - 1] + " */\n"
}
}
for(var i = 1;i < MAX_RS485_NUM + 1;i++)
{
en_id = document.querySelector("#rs485" + i + "_EN_gpio").value
en_pin = document.querySelector("#rs485" + i + "_EN_pin").value
if(en_id != "NONE")
{
board_h.textContent += " #define rs485" + i +"_TX_EN" + " " + (do_num - getRs485EnNum() + en_index)
board_h.textContent += " /* P" + en_id[en_id.length - 1] + "_" + en_pin[en_pin.length - 1] + " */\n"
en_index++
}
}
}
function addDi(){
var di_id
var di_gpio
var di_pin
var di_index = 0
board_h.textContent += "\n"
board_h.textContent += "#define GPIO_INPUT_NUM " + getDiNum() + "\n"
for(var i = 1;i < MAX_DI_NUM + 1;i++)
{
di_id = document.querySelector("#di_" + i)
if(di_id.checked == true)
{
di_index++
di_gpio = document.querySelector("#di_" + i + "_GPIO").value
di_pin = document.querySelector("#di_" + i + "_PIN").value
board_h.textContent += " #define DI" + i + " " + (di_index -1)
board_h.textContent += " /* P" + di_gpio[di_gpio.length - 1] + "_" + di_pin[di_pin.length - 1] + " */\n"
}
}
board_h.textContent += "#endif\n"
}
function getAdcNum()
{
var adcNum = 0
var adc_id
for(var i = 1;i < MAX_ADC_NUM + 1;i++)
{
adc_id = document.querySelector("#ai_" + i)
if(adc_id.checked == true)
{
adcNum++
}
}
return adcNum
}
function addAdc(){
var adc_id
var adc_index = 0
board_h.textContent += "\n"
board_h.textContent += "#define INCLUDE_ADC\n"
board_h.textContent += "#ifdef INCLUDE_ADC\n"
board_h.textContent += " #define ADC_CHANNEL_NUM " + getAdcNum() + "\n"
board_h.textContent += " #define ADC_MAX_VALUE " + MAX_ADC_VALUE + ".0f\n"
for (var i = 1;i < MAX_ADC_NUM + 1;i++)
{
adc_id = document.querySelector("#ai_" + i)
if (adc_id.checked == true)
{
adc_gpio = document.querySelector("#ai_" + i + "_GPIO").value
adc_pin = document.querySelector("#ai_" + i + "_PIN").value
board_h.textContent += " #define AI" + adc_index + " " + adc_index + " "
board_h.textContent += "/* P" + adc_gpio[adc_gpio.length - 1] + "_" + adc_pin[adc_pin.length - 1] + " */" + "\n"
adc_index++
}
}
board_h.textContent += "#endif\n"
}
function getCanNum()
{
var canNum = 0
var can_id
for(var i = 1;i < MAX_ADC_NUM + 1;i++)
{
can_id = document.querySelector("#can" + i)
if(can_id.checked == true)
{
canNum++
}
}
return canNum
}
function addCan()
{
for(var i = 0;i < MAX_CAN_NUM;i++)
{
var canid = document.querySelector("#can" + i)
if (canid.checked == true)
{
board_h.textContent += "\n"
board_h.textContent += "/* 添加CAN" + i + " */\n"
board_h.textContent += "#define INCLUDE_CAN" + i + "\n"
board_h.textContent += "#ifdef " + "INCLUDE_CAN" + i + "\n"
board_h.textContent += " #define CAN" + i + "_PORT " + document.querySelector("#can" + i + "_GPIO").value + "\n"
board_h.textContent += " #define CAN" + i + "_TX_PIN " + "GPIO_" +document.querySelector("#can" + i + "_TX").value + "\n"
board_h.textContent += " #define CAN" + i + "_RX_PIN " + "GPIO_" +document.querySelector("#can" + i + "_RX").value + "\n"
board_h.textContent += "#endif\n"
}
}
}
function addGpioOptions(gpio,index)
{
// GOIO组的数量应该根据芯片决定后续会修改
var option_gpio = document.createElement('option')
option_gpio.value = "GPIO" + String.fromCharCode(65 + index)
option_gpio.text = "GPIO" + String.fromCharCode(65 + index)
gpio.appendChild(option_gpio);
}
function addPinOptions(pin,index)
{
var option_pin = document.createElement('option')
option_pin.value = "PIN_" + index
option_pin.text = "PIN_" + index
pin.appendChild(option_pin);
}
//启动之后的进程
function startProcess()
{
//添加COM口的GPIO选择元素
for(var i = 0;i < MAX_COM_NUM;i++)
{
var com_gpio = document.querySelector("#" + "com" + i + "_GPIO")
for(var j = 0;j < MAX_GPIO_NUM;j++)
{
addGpioOptions(com_gpio,j)
}
}
//添加COM口的pin脚选择
for(var i = 0;i < MAX_COM_NUM;i++)
{
var com_pin = document.querySelector("#" + "com" + i + "_TX")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(com_pin,j)
}
}
for(var i = 0;i < MAX_COM_NUM;i++)
{
var com_pin = document.querySelector("#" + "com" + i + "_RX")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(com_pin,j)
}
}
//添加30路DO的管脚
var do_gpio
var do_pin
for(var i = 1;i < MAX_DO_NUM + 1;i++)
{
//添加GPIO组
do_gpio = document.querySelector("#do_" + i + "_GPIO")
for(var j = 0;j < MAX_GPIO_NUM;j++)
{
addGpioOptions(do_gpio,j)
}
//添加GPIO引脚
do_pin = document.querySelector("#do_" + i + "_PIN")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(do_pin,j)
}
}
//添加30路DI的管脚
var di_gpio
var di_pin
for(var i = 1;i < MAX_DI_NUM + 1;i++)
{
//添加GPIO组
di_gpio = document.querySelector("#di_" + i + "_GPIO")
for(var j = 0;j < MAX_GPIO_NUM;j++)
{
addGpioOptions(di_gpio,j)
}
//添加GPIO引脚
di_pin = document.querySelector("#di_" + i + "_PIN")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(di_pin,j)
}
}
//添加EN引脚
var rs485_EN
var rs485_EN_PIN
for(var i = 1;i < MAX_RS485_NUM + 1;i++)
{
rs485_EN = document.querySelector("#rs485" + i + "_EN_gpio")
var option_gpio = document.createElement('option')
option_gpio.value = "NONE"
option_gpio.text = "NONE"
rs485_EN.appendChild(option_gpio);
for(var j = 0;j < MAX_GPIO_NUM;j++)
{
addGpioOptions(rs485_EN,j)
}
rs485_EN_PIN = document.querySelector("#rs485" + i + "_EN_pin")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(rs485_EN_PIN,j)
}
}
//添加ADC的GPIO和PIN
var adc_gpio
var adc_pin
for(var i = 1;i < MAX_ADC_NUM + 1;i++)
{
adc_gpio = document.querySelector("#ai_" + i + "_GPIO")
for(var j = 0;j < MAX_GPIO_NUM;j++)
{
addGpioOptions(adc_gpio,j)
}
adc_pin = document.querySelector("#ai_" + i + "_PIN")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(adc_pin,j)
}
}
//添加CAN
for(var i = 0;i < MAX_CAN_NUM;i++)
{
var can_gpio = document.querySelector("#" + "can" + i + "_GPIO")
for(var j = 0;j < MAX_GPIO_NUM;j++)
{
addGpioOptions(can_gpio,j)
}
var can_pin = document.querySelector("#" + "can" + i + "_TX")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(can_pin,j)
}
var can_pin = document.querySelector("#" + "can" + i + "_RX")
for(var j = 0;j < MAX_GPIO_PIN_NUM;j++)
{
addPinOptions(can_pin,j)
}
}
//添加SPI
//添加IIC
}
startProcess()
//一键生成
click_button.addEventListener("click", function() {
board_h.textContent = ""
//添加固定头和头文件
addHead(mcu_type)
//添加串口
addCom()
//添加shell
addShell()
//添加RS485
addRs485(rs4851,1)
addRs485(rs4852,2)
//添加30路DO
addDo()
//添加30路DI
addDi()
//添加ADC
addAdc()
//添加CAn
addCan()
//添加结尾
addEndif()
});

0
ui/js/file_crc_calc.js Normal file
View File

0
ui/js/file_syslib_c.js Normal file
View File

0
ui/js/file_syslib_h.js Normal file
View File

30
ui/js/jldcalc.js Normal file
View File

@ -0,0 +1,30 @@
var gen3 = 1.732050807569
var jld_calc_table = document.querySelector("#jld_calc");
//最终的线电压索引
var line_value_index_row = 1
var line_value_index_cell = 2
//最终的相电压索引
var xiang_value_index_row = 2
var xinag_value_index_cell = 2
// 计算线电压
function calc_line(xiang)
{
return xiang * gen3
}
//计算相电压
function calc_xiang(line)
{
return line / gen3
}
//实时刷新两个值
function refreshFunction() {
//计算线电压
jld_calc_table.rows[line_value_index_row].cells[line_value_index_cell].textContent =
calc_line(document.querySelector("#input_xiang").value)
//计算相电压
jld_calc_table.rows[xiang_value_index_row].cells[xinag_value_index_cell].textContent =
calc_xiang(document.querySelector("#input_line").value)
}
setInterval(refreshFunction, 500);
//设置样式