1 Commits

Author SHA1 Message Date
45171346bd add configuration options to enable mqtt user login 2025-06-21 11:07:10 +02:00
443 changed files with 73841 additions and 403970 deletions

14
.gitignore vendored
View File

@@ -1,19 +1,13 @@
*.sch-bak
PlantCtrlESP32-backups/
board/production/PlantCtrlESP32_2023-11-08_00-45-35/PlantCtrlESP32.zip
board/production/PlantCtrlESP32_2023-11-08_00-45-35/netlist.ipc
.vscode
.embuild/
target/
target
Cargo.lock
node_modules/
rust/src/webserver/bundle.js
rust/src/webserver/index.html
rust/build/
rust/image.bin
*.zip
fp-info-cache
production/
_autosave*
~_autosave*
\#auto_saved_files#
*.lck
build/
image.bin

Binary file not shown.

View File

@@ -1,4 +0,0 @@
(fp_lib_table
(version 7)
(lib (name "Modules")(type "KiCad")(uri "../_Shared/footprint/Modules.pretty")(options "")(descr ""))
)

View File

@@ -1,4 +0,0 @@
(sym_lib_table
(version 7)
(lib (name "Light")(type "KiCad")(uri "/home/empire/workspace/PlantCtrl/Hardware/_Shared/symbols/Light.kicad_sym")(options "")(descr ""))
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-battery-charging" viewBox="0 0 16 16">
<path d="M9.585 2.568a.5.5 0 0 1 .226.58L8.677 6.832h1.99a.5.5 0 0 1 .364.843l-5.334 5.667a.5.5 0 0 1-.842-.49L5.99 9.167H4a.5.5 0 0 1-.364-.843l5.333-5.667a.5.5 0 0 1 .616-.09z"/>
<path d="M2 4h4.332l-.94 1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h2.38l-.308 1H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"/>
<path d="M2 6h2.45L2.908 7.639A1.5 1.5 0 0 0 3.313 10H2zm8.595-2-.308 1H12a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H9.276l-.942 1H12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"/>
<path d="M12 10h-1.783l1.542-1.639q.146-.156.241-.34zm0-3.354V6h-.646a1.5 1.5 0 0 1 .646.646M16 8a1.5 1.5 0 0 1-1.5 1.5v-3A1.5 1.5 0 0 1 16 8"/>
</svg>

Before

Width:  |  Height:  |  Size: 738 B

File diff suppressed because it is too large Load Diff

View File

@@ -1,39 +0,0 @@
(footprint SOIC127P600X175-8N (layer F.Cu) (tedit 68EBCB5D)
(descr "")
(attr smd)
(fp_text reference REF** (at -0.268 -3.2064 0) (layer F.SilkS)
(effects (font (size 0.64 0.64) (thickness 0.15)))
)
(fp_text value SOIC127P600X175-8N (at 5.0152 3.1936 0) (layer F.Fab)
(effects (font (size 0.64 0.64) (thickness 0.15)))
)
(pad 1 smd roundrect (roundrect_rratio 0.25) (at -2.475 -1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 2 smd roundrect (roundrect_rratio 0.25) (at -2.475 -0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 3 smd roundrect (roundrect_rratio 0.25) (at -2.475 0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 4 smd roundrect (roundrect_rratio 0.25) (at -2.475 1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 5 smd roundrect (roundrect_rratio 0.25) (at 2.475 1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 6 smd roundrect (roundrect_rratio 0.25) (at 2.475 0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 7 smd roundrect (roundrect_rratio 0.25) (at 2.475 -0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 8 smd roundrect (roundrect_rratio 0.25) (at 2.475 -1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(fp_line (start -2.0 2.5) (end -2.0 -2.5) (layer F.Fab) (width 0.127))
(fp_line (start -2.0 -2.5) (end 2.0 -2.5) (layer F.Fab) (width 0.127))
(fp_line (start 2.0 -2.5) (end 2.0 2.5) (layer F.Fab) (width 0.127))
(fp_line (start 2.0 2.5) (end -2.0 2.5) (layer F.Fab) (width 0.127))
(fp_line (start -2.0 -2.519) (end 2.0 -2.519) (layer F.SilkS) (width 0.127))
(fp_line (start -2.0 2.519) (end 2.0 2.519) (layer F.SilkS) (width 0.127))
(fp_line (start -3.71 -2.46) (end -2.25 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 -2.46) (end -2.25 -2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 -2.75) (end 2.25 -2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 -2.75) (end 2.25 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 -2.46) (end 3.71 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 3.71 2.46) (end 2.25 2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 2.46) (end 2.25 2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 2.75) (end -2.25 2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 2.75) (end -2.25 2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 2.46) (end -3.71 2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start -3.71 2.46) (end -3.71 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 3.71 -2.46) (end 3.71 2.46) (layer F.CrtYd) (width 0.05))
(fp_circle (center -4.1 -1.9) (end -4.0 -1.9) (layer F.SilkS) (width 0.2))
(fp_circle (center -4.1 -1.9) (end -4.0 -1.9) (layer F.Fab) (width 0.2))
)

View File

@@ -1,6 +0,0 @@
(fp_lib_table
(version 7)
(lib (name "amass")(type "KiCad")(uri "${KIPRJMOD}/footprints/amass")(options "")(descr ""))
(lib (name "Modules")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/footprint/Modules.pretty")(options "")(descr ""))
(lib (name "4435")(type "KiCad")(uri "${KIPRJMOD}/footprints/4435")(options "")(descr ""))
)

View File

@@ -1,182 +0,0 @@
(kicad_symbol_lib (version 20211014) (generator kicad_symbol_editor)
(symbol "AO4435" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)
(property "Reference" "Q" (id 0) (at -11.43 8.89 0)
(effects (font (size 1.27 1.27)) (justify bottom left))
)
(property "Value" "AO4435" (id 1) (at -11.43 6.35 0)
(effects (font (size 1.27 1.27)) (justify bottom left))
)
(property "Footprint" "AO4435:SOIC127P600X175-8N" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MF" "Alpha &" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Description" "\n \n P-Channel 30 V 10.5A (Ta) 3.1W (Ta) Surface Mount 8-SOIC\n \n" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Package" "SOIC-8 Alpha &amp; Omega Semiconductor" (id 6) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Price" "None" (id 7) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Check_prices" "https://www.snapeda.com/parts/AO4435/Alpha/view-part/?ref=eda" (id 8) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "STANDARD" "IPC 7351B" (id 9) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "SnapEDA_Link" "https://www.snapeda.com/parts/AO4435/Alpha/view-part/?ref=snap" (id 10) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MP" "AO4435" (id 11) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Availability" "In Stock" (id 12) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MANUFACTURER" "ALPHA & OMEGA SEMICONDUCTOR" (id 13) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(symbol "AO4435_0_0"
(polyline
(pts (xy -1.778 0.762) (xy -1.778 0.0)) (stroke (width 0.254))
)
(polyline
(pts (xy -1.778 0.0) (xy -1.778 -0.762)) (stroke (width 0.254))
)
(polyline
(pts (xy -1.778 3.175) (xy -1.778 2.54)) (stroke (width 0.254))
)
(polyline
(pts (xy -1.778 2.54) (xy -1.778 1.905)) (stroke (width 0.254))
)
(polyline
(pts (xy -1.778 0.0) (xy 0.0 0.0)) (stroke (width 0.1524))
)
(polyline
(pts (xy 0.0 0.0) (xy 0.0 -2.54)) (stroke (width 0.1524))
)
(polyline
(pts (xy -1.778 -1.905) (xy -1.778 -2.54)) (stroke (width 0.254))
)
(polyline
(pts (xy -1.778 -2.54) (xy -1.778 -3.175)) (stroke (width 0.254))
)
(polyline
(pts (xy -2.54 2.54) (xy -2.54 -2.54)) (stroke (width 0.254))
)
(polyline
(pts (xy 0.0 -2.54) (xy -1.778 -2.54)) (stroke (width 0.1524))
)
(polyline
(pts (xy 1.27 2.54) (xy 1.27 -0.508)) (stroke (width 0.1524))
)
(polyline
(pts (xy 1.27 -0.508) (xy 1.27 -2.54)) (stroke (width 0.1524))
)
(polyline
(pts (xy 0.0 -2.54) (xy 1.27 -2.54)) (stroke (width 0.1524))
)
(polyline
(pts (xy -1.778 2.54) (xy 1.27 2.54)) (stroke (width 0.1524))
)
(polyline
(pts (xy 0.762 -0.508) (xy 1.27 -0.508)) (stroke (width 0.1524))
)
(polyline
(pts (xy 1.27 -0.508) (xy 1.778 -0.508)) (stroke (width 0.1524))
)
(circle (center 0.0 -2.54) (radius 0.3592)
(stroke (width 0.0)) (fill (type none))
)
(circle (center 0.0 2.54) (radius 0.3592)
(stroke (width 0.0)) (fill (type none))
)
(polyline
(pts
(xy 1.27 -0.508)
(xy 1.778 0.254)
(xy 0.762 0.254)
(xy 1.27 -0.508)
)
(stroke (width 0.1524)) (fill (type outline))
)
(polyline
(pts
(xy 0.0 0.0)
(xy -1.016 -0.762)
(xy -1.016 0.762)
(xy 0.0 0.0)
)
(stroke (width 0.1524)) (fill (type outline))
)
(pin passive line (at 0.0 -5.08 90.0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "1"
(effects (font (size 1.016 1.016)))
)
)
(pin passive line (at 0.0 -5.08 90.0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "2"
(effects (font (size 1.016 1.016)))
)
)
(pin passive line (at 0.0 -5.08 90.0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "3"
(effects (font (size 1.016 1.016)))
)
)
(pin passive line (at -5.08 -2.54 0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "4"
(effects (font (size 1.016 1.016)))
)
)
(pin passive line (at 0.0 5.08 270.0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "5"
(effects (font (size 1.016 1.016)))
)
)
(pin passive line (at 0.0 5.08 270.0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "6"
(effects (font (size 1.016 1.016)))
)
)
(pin passive line (at 0.0 5.08 270.0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "7"
(effects (font (size 1.016 1.016)))
)
)
(pin passive line (at 0.0 5.08 270.0) (length 2.54)
(name "~"
(effects (font (size 1.016 1.016)))
)
(number "8"
(effects (font (size 1.016 1.016)))
)
)
)
)
)

View File

@@ -1,5 +0,0 @@
(kicad_symbol_lib
(version 20241209)
(generator "kicad_symbol_editor")
(generator_version "9.0")
)

View File

@@ -1,5 +0,0 @@
(fp_lib_table
(version 7)
(lib (name "esp32c6")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/footprint/esp32c6.pretty")(options "")(descr ""))
(lib (name "Modules")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/footprint/Modules.pretty")(options "")(descr ""))
)

View File

@@ -1,8 +0,0 @@
(sym_lib_table
(version 7)
(lib (name "ESP32-C6-WROOM-1-N8")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/symbols/ESP32-C6-WROOM-1-N8.kicad_sym")(options "")(descr ""))
(lib (name "Sensor_Module")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/symbols/Sensor_Module.kicad_sym")(options "")(descr ""))
(lib (name "Pump")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/symbols/Pump.kicad_sym")(options "")(descr ""))
(lib (name "Light")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/symbols/Light.kicad_sym")(options "")(descr ""))
(lib (name "MPPT")(type "KiCad")(uri "${KIPRJMOD}/../_Shared/symbols/MPPT.kicad_sym")(options "")(descr ""))
)

View File

@@ -1 +0,0 @@
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}

View File

@@ -1,5 +0,0 @@
(fp_lib_table
(version 7)
(lib (name "Modules")(type "KiCad")(uri "/home/empire/workspace/PlantCtrl/Hardware/_Shared/footprint/Modules.pretty")(options "")(descr ""))
(lib (name "4435")(type "KiCad")(uri "${KIPRJMOD}/hardware/footprints/4435")(options "")(descr ""))
)

View File

@@ -1,39 +0,0 @@
(footprint SOIC127P600X175-8N (layer F.Cu) (tedit 68EBCB5D)
(descr "")
(attr smd)
(fp_text reference REF** (at -0.268 -3.2064 0) (layer F.SilkS)
(effects (font (size 0.64 0.64) (thickness 0.15)))
)
(fp_text value SOIC127P600X175-8N (at 5.0152 3.1936 0) (layer F.Fab)
(effects (font (size 0.64 0.64) (thickness 0.15)))
)
(pad 1 smd roundrect (roundrect_rratio 0.25) (at -2.475 -1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 2 smd roundrect (roundrect_rratio 0.25) (at -2.475 -0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 3 smd roundrect (roundrect_rratio 0.25) (at -2.475 0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 4 smd roundrect (roundrect_rratio 0.25) (at -2.475 1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 5 smd roundrect (roundrect_rratio 0.25) (at 2.475 1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 6 smd roundrect (roundrect_rratio 0.25) (at 2.475 0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 7 smd roundrect (roundrect_rratio 0.25) (at 2.475 -0.635) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(pad 8 smd roundrect (roundrect_rratio 0.25) (at 2.475 -1.905) (size 1.97 0.6) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102))
(fp_line (start -2.0 2.5) (end -2.0 -2.5) (layer F.Fab) (width 0.127))
(fp_line (start -2.0 -2.5) (end 2.0 -2.5) (layer F.Fab) (width 0.127))
(fp_line (start 2.0 -2.5) (end 2.0 2.5) (layer F.Fab) (width 0.127))
(fp_line (start 2.0 2.5) (end -2.0 2.5) (layer F.Fab) (width 0.127))
(fp_line (start -2.0 -2.519) (end 2.0 -2.519) (layer F.SilkS) (width 0.127))
(fp_line (start -2.0 2.519) (end 2.0 2.519) (layer F.SilkS) (width 0.127))
(fp_line (start -3.71 -2.46) (end -2.25 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 -2.46) (end -2.25 -2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 -2.75) (end 2.25 -2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 -2.75) (end 2.25 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 -2.46) (end 3.71 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 3.71 2.46) (end 2.25 2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 2.46) (end 2.25 2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.25 2.75) (end -2.25 2.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 2.75) (end -2.25 2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.25 2.46) (end -3.71 2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start -3.71 2.46) (end -3.71 -2.46) (layer F.CrtYd) (width 0.05))
(fp_line (start 3.71 -2.46) (end 3.71 2.46) (layer F.CrtYd) (width 0.05))
(fp_circle (center -4.1 -1.9) (end -4.0 -1.9) (layer F.SilkS) (width 0.2))
(fp_circle (center -4.1 -1.9) (end -4.0 -1.9) (layer F.Fab) (width 0.2))
)

View File

@@ -1,278 +0,0 @@
(kicad_symbol_lib
(version 20241209)
(generator "kicad_symbol_editor")
(generator_version "9.0")
(symbol "SL2300"
(pin_names
(offset 1.016)
)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "Q"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "SL2300"
(at 7.62 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "SL2300_1_1"
(polyline
(pts
(xy -1.016 1.905) (xy -1.016 -1.905)
)
(stroke
(width 0.254)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy -1.016 0) (xy -3.81 0)
)
(stroke
(width 0)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy -0.508 2.286) (xy -0.508 1.27)
)
(stroke
(width 0.254)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy -0.508 0.508) (xy -0.508 -0.508)
)
(stroke
(width 0.254)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy -0.508 -1.27) (xy -0.508 -2.286)
)
(stroke
(width 0.254)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy -0.508 -1.778) (xy 2.032 -1.778) (xy 2.032 1.778) (xy -0.508 1.778)
)
(stroke
(width 0)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy -0.254 0) (xy 0.762 0.381) (xy 0.762 -0.381) (xy -0.254 0)
)
(stroke
(width 0)
(type solid)
)
(fill
(type outline)
)
)
(circle
(center 0.381 0)
(radius 2.794)
(stroke
(width 0.254)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy 1.27 2.54) (xy 1.27 1.778)
)
(stroke
(width 0)
(type solid)
)
(fill
(type none)
)
)
(circle
(center 1.27 1.778)
(radius 0.254)
(stroke
(width 0)
(type solid)
)
(fill
(type outline)
)
)
(circle
(center 1.27 -1.778)
(radius 0.254)
(stroke
(width 0)
(type solid)
)
(fill
(type outline)
)
)
(polyline
(pts
(xy 1.27 -2.54) (xy 1.27 0) (xy -0.508 0)
)
(stroke
(width 0)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy 1.524 0.508) (xy 1.651 0.381) (xy 2.413 0.381) (xy 2.54 0.254)
)
(stroke
(width 0)
(type solid)
)
(fill
(type none)
)
)
(polyline
(pts
(xy 2.032 0.381) (xy 1.651 -0.254) (xy 2.413 -0.254) (xy 2.032 0.381)
)
(stroke
(width 0)
(type solid)
)
(fill
(type none)
)
)
(pin input line
(at -6.35 0 0)
(length 2.54)
(name "G"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin passive line
(at 1.27 5.08 270)
(length 2.54)
(name "D"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "3"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin passive line
(at 1.27 -5.08 90)
(length 2.54)
(name "S"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
(embedded_fonts no)
)
)

View File

@@ -1,5 +0,0 @@
(sym_lib_table
(version 7)
(lib (name "Pump")(type "KiCad")(uri "/home/empire/workspace/PlantCtrl/Hardware/_Shared/symbols/Pump.kicad_sym")(options "")(descr ""))
(lib (name "SL2300")(type "KiCad")(uri "${KIPRJMOD}/hardware/symbols/SL2300.kicad_sym")(options "")(descr ""))
)

File diff suppressed because it is too large Load Diff

View File

@@ -1,175 +0,0 @@
(kicad_symbol_lib
(version 20241209)
(generator "kicad_symbol_editor")
(generator_version "9.0")
(symbol "LightPowerSupply"
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "U"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "LightPowerSupply_1_1"
(rectangle
(start -6.35 -1.27)
(end 6.35 -19.05)
(stroke
(width 0)
(type solid)
)
(fill
(type background)
)
)
(pin input line
(at -8.89 -2.54 0)
(length 2.54)
(name "LED_ENABLE"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at -8.89 -5.08 0)
(length 2.54)
(name "VBAT"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin input line
(at -8.89 -7.62 0)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "3"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin input line
(at -8.89 -10.16 0)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "4"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin input line
(at -8.89 -12.7 0)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "5"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin input line
(at -8.89 -15.24 0)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "6"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
(embedded_fonts no)
)
)

View File

@@ -1,211 +0,0 @@
(kicad_symbol_lib
(version 20241209)
(generator "kicad_symbol_editor")
(generator_version "9.0")
(symbol "Pump_Output"
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "U"
(at -6.35 15.24 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "Pump_Output_1_1"
(rectangle
(start -12.7 12.7)
(end 10.16 -15.24)
(stroke
(width 0)
(type solid)
)
(fill
(type background)
)
)
(pin bidirectional line
(at -15.24 1.27 0)
(length 2.54)
(name "SCL"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "5"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin bidirectional line
(at -15.24 -1.27 0)
(length 2.54)
(name "SDA"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "6"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at -3.81 15.24 270)
(length 2.54)
(name "3V3"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "7"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at -1.27 15.24 270)
(length 2.54)
(name "VCC"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "8"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at -1.27 -17.78 90)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 1.27 -17.78 90)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 3.81 -17.78 90)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "3"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 6.35 -17.78 90)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "4"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
(embedded_fonts no)
)
)

View File

@@ -1,265 +0,0 @@
(kicad_symbol_lib
(version 20241209)
(generator "kicad_symbol_editor")
(generator_version "9.0")
(symbol "sensor"
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "U"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "sensor_1_1"
(rectangle
(start -5.08 -1.27)
(end 5.08 -30.48)
(stroke
(width 0)
(type solid)
)
(fill
(type background)
)
)
(pin power_in line
(at 7.62 -2.54 180)
(length 2.54)
(name "3V3"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 7.62 -5.08 180)
(length 2.54)
(name "VBAT"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 7.62 -7.62 180)
(length 2.54)
(name "SDA"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "3"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 7.62 -10.16 180)
(length 2.54)
(name "SCL"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "4"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -12.7 180)
(length 2.54)
(name "Signal"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "5"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -15.24 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "8"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -17.78 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "9"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -20.32 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "10"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -22.86 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "11"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -25.4 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "12"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -27.94 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "13"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
(embedded_fonts no)
)
)

View File

@@ -1,247 +0,0 @@
(kicad_symbol_lib
(version 20241209)
(generator "kicad_symbol_editor")
(generator_version "9.0")
(symbol "sensor"
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "U"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" ""
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "sensor_1_1"
(rectangle
(start -5.08 -1.27)
(end 5.08 -26.67)
(stroke
(width 0)
(type solid)
)
(fill
(type background)
)
)
(pin power_in line
(at 7.62 -2.54 180)
(length 2.54)
(name "3V3"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 7.62 -5.08 180)
(length 2.54)
(name "VBAT"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 7.62 -7.62 180)
(length 2.54)
(name "SDA"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "3"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin power_in line
(at 7.62 -10.16 180)
(length 2.54)
(name "SCL"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "4"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -12.7 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "8"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -15.24 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "9"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -17.78 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "10"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -20.32 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "11"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -22.86 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "12"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin output line
(at 7.62 -25.4 180)
(length 2.54)
(name "GND"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "13"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
(embedded_fonts no)
)
)

View File

@@ -1 +0,0 @@
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}

View File

@@ -1 +0,0 @@
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}

View File

@@ -1,135 +0,0 @@
{
"board": {
"active_layer": 6,
"active_layer_preset": "All Layers",
"auto_track_width": false,
"hidden_netclasses": [],
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"images": 0.6,
"pads": 1.0,
"shapes": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": false,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
"vias",
"footprint_text",
"footprint_anchors",
"grid",
"footprints_front",
"footprints_back",
"footprint_values",
"footprint_references",
"tracks",
"drc_errors",
"drawing_sheet",
"bitmaps",
"pads",
"zones",
"drc_warnings",
"locked_item_shadows",
"conflict_shadows",
"shapes"
],
"visible_layers": "ffffffff_ffffffff_ffffffff_ffffffff",
"zone_display_mode": 1
},
"git": {
"repo_type": "",
"repo_username": "",
"ssh_key": ""
},
"meta": {
"filename": "Sensors.kicad_prl",
"version": 5
},
"net_inspector_panel": {
"col_hidden": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
],
"col_order": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11
],
"col_widths": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"custom_group_rules": [],
"expanded_rows": [],
"filter_by_net_name": true,
"filter_by_netclass": true,
"filter_text": "",
"group_by_constraint": false,
"group_by_netclass": false,
"show_unconnected_nets": false,
"show_zero_pad_nets": false,
"sort_ascending": true,
"sorting_column": 0
},
"open_jobsets": [],
"project": {
"files": []
},
"schematic": {
"selection_filter": {
"graphics": true,
"images": true,
"labels": true,
"lockedItems": false,
"otherItems": true,
"pins": true,
"symbols": true,
"text": true,
"wires": true
}
}
}

View File

@@ -1,675 +0,0 @@
{
"board": {
"3dviewports": [],
"design_settings": {
"defaults": {
"apply_defaults_to_fp_fields": false,
"apply_defaults_to_fp_shapes": false,
"apply_defaults_to_fp_text": false,
"board_outline_line_width": 0.05,
"copper_line_width": 0.2,
"copper_text_italic": false,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"copper_text_upright": false,
"courtyard_line_width": 0.05,
"dimension_precision": 4,
"dimension_units": 3,
"dimensions": {
"arrow_length": 1270000,
"extension_offset": 500000,
"keep_text_aligned": true,
"suppress_zeroes": true,
"text_position": 0,
"units_format": 0
},
"fab_line_width": 0.1,
"fab_text_italic": false,
"fab_text_size_h": 1.0,
"fab_text_size_v": 1.0,
"fab_text_thickness": 0.15,
"fab_text_upright": false,
"other_line_width": 0.1,
"other_text_italic": false,
"other_text_size_h": 1.0,
"other_text_size_v": 1.0,
"other_text_thickness": 0.15,
"other_text_upright": false,
"pads": {
"drill": 0.8,
"height": 1.27,
"width": 2.54
},
"silk_line_width": 0.1,
"silk_text_italic": false,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.1,
"silk_text_upright": false,
"zones": {
"min_clearance": 0.5
}
},
"diff_pair_dimensions": [
{
"gap": 0.0,
"via_gap": 0.0,
"width": 0.0
}
],
"drc_exclusions": [],
"meta": {
"version": 2
},
"rule_severities": {
"annular_width": "error",
"clearance": "error",
"connection_width": "warning",
"copper_edge_clearance": "error",
"copper_sliver": "warning",
"courtyards_overlap": "error",
"creepage": "error",
"diff_pair_gap_out_of_range": "error",
"diff_pair_uncoupled_length_too_long": "error",
"drill_out_of_range": "error",
"duplicate_footprints": "warning",
"extra_footprint": "warning",
"footprint": "error",
"footprint_filters_mismatch": "ignore",
"footprint_symbol_mismatch": "warning",
"footprint_type_mismatch": "ignore",
"hole_clearance": "error",
"hole_to_hole": "warning",
"holes_co_located": "warning",
"invalid_outline": "error",
"isolated_copper": "warning",
"item_on_disabled_layer": "error",
"items_not_allowed": "error",
"length_out_of_range": "error",
"lib_footprint_issues": "warning",
"lib_footprint_mismatch": "warning",
"malformed_courtyard": "ignore",
"microvia_drill_out_of_range": "error",
"mirrored_text_on_front_layer": "warning",
"missing_courtyard": "ignore",
"missing_footprint": "warning",
"net_conflict": "warning",
"nonmirrored_text_on_back_layer": "warning",
"npth_inside_courtyard": "ignore",
"padstack": "warning",
"pth_inside_courtyard": "ignore",
"shorting_items": "error",
"silk_edge_clearance": "ignore",
"silk_over_copper": "warning",
"silk_overlap": "warning",
"skew_out_of_range": "error",
"solder_mask_bridge": "error",
"starved_thermal": "warning",
"text_height": "warning",
"text_on_edge_cuts": "error",
"text_thickness": "warning",
"through_hole_pad_without_hole": "error",
"too_many_vias": "error",
"track_angle": "error",
"track_dangling": "warning",
"track_segment_length": "error",
"track_width": "error",
"tracks_crossing": "error",
"unconnected_items": "error",
"unresolved_variable": "error",
"via_dangling": "warning",
"zones_intersect": "error"
},
"rules": {
"max_error": 0.005,
"min_clearance": 0.0,
"min_connection": 0.0,
"min_copper_edge_clearance": 0.5,
"min_groove_width": 0.0,
"min_hole_clearance": 0.15,
"min_hole_to_hole": 0.25,
"min_microvia_diameter": 0.2,
"min_microvia_drill": 0.1,
"min_resolved_spokes": 2,
"min_silk_clearance": 0.0,
"min_text_height": 0.8,
"min_text_thickness": 0.08,
"min_through_hole_diameter": 0.25,
"min_track_width": 0.0,
"min_via_annular_width": 0.05,
"min_via_diameter": 0.25,
"solder_mask_to_copper_clearance": 0.005,
"use_height_for_length_calcs": true
},
"teardrop_options": [
{
"td_onpthpad": true,
"td_onroundshapesonly": false,
"td_onsmdpad": true,
"td_ontrackend": false,
"td_onvia": true
}
],
"teardrop_parameters": [
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_round_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_rect_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_track_end",
"td_width_to_size_filter_ratio": 0.9
}
],
"track_widths": [
0.0,
0.1,
0.2,
0.5
],
"tuning_pattern_settings": {
"diff_pair_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 1.0
},
"diff_pair_skew_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
},
"single_track_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
}
},
"via_dimensions": [
{
"diameter": 0.0,
"drill": 0.0
},
{
"diameter": 0.3,
"drill": 0.25
}
],
"zones_allow_external_fillets": false
},
"ipc2581": {
"dist": "",
"distpn": "",
"internal_id": "",
"mfg": "",
"mpn": ""
},
"layer_pairs": [],
"layer_presets": [],
"viewports": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"endpoint_off_grid": "warning",
"extra_units": "error",
"footprint_filter": "ignore",
"footprint_link_issues": "warning",
"four_way_junction": "ignore",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"label_multiple_wires": "warning",
"lib_symbol_issues": "warning",
"lib_symbol_mismatch": "warning",
"missing_bidi_pin": "warning",
"missing_input_pin": "warning",
"missing_power_pin": "error",
"missing_unit": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "ignore",
"power_pin_not_driven": "ignore",
"same_local_global_label": "warning",
"similar_label_and_power": "warning",
"similar_labels": "warning",
"similar_power": "warning",
"simulation_model_issue": "ignore",
"single_global_label": "ignore",
"unannotated": "error",
"unconnected_wire_endpoint": "warning",
"undefined_netclass": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "Sensors.kicad_pro",
"version": 3
},
"net_settings": {
"classes": [
{
"bus_width": 12,
"clearance": 0.15,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"priority": 2147483647,
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.2,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
}
],
"meta": {
"version": 4
},
"net_colors": null,
"netclass_assignments": null,
"netclass_patterns": []
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"plot": "",
"pos_files": "",
"specctra_dsn": "",
"step": "Sensors.step",
"svg": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"bom_export_filename": "${PROJECTNAME}.csv",
"bom_fmt_presets": [],
"bom_fmt_settings": {
"field_delimiter": ",",
"keep_line_breaks": false,
"keep_tabs": false,
"name": "CSV",
"ref_delimiter": ",",
"ref_range_delimiter": "",
"string_delimiter": "\""
},
"bom_presets": [],
"bom_settings": {
"exclude_dnp": false,
"fields_ordered": [
{
"group_by": false,
"label": "Reference",
"name": "Reference",
"show": true
},
{
"group_by": true,
"label": "Value",
"name": "Value",
"show": true
},
{
"group_by": true,
"label": "Footprint",
"name": "Footprint",
"show": true
},
{
"group_by": false,
"label": "Datasheet",
"name": "Datasheet",
"show": true
},
{
"group_by": false,
"label": "Description",
"name": "Description",
"show": false
},
{
"group_by": false,
"label": "Qty",
"name": "${QUANTITY}",
"show": true
},
{
"group_by": false,
"label": "#",
"name": "${ITEM_NUMBER}",
"show": false
},
{
"group_by": false,
"label": "LCSC_PART_NUMBER",
"name": "LCSC_PART_NUMBER",
"show": true
},
{
"group_by": false,
"label": "Sim.Device",
"name": "Sim.Device",
"show": false
},
{
"group_by": false,
"label": "Sim.Pins",
"name": "Sim.Pins",
"show": false
},
{
"group_by": false,
"label": "Sim.Type",
"name": "Sim.Type",
"show": false
},
{
"group_by": true,
"label": "DNP",
"name": "${DNP}",
"show": true
},
{
"group_by": true,
"label": "Exclude from BOM",
"name": "${EXCLUDE_FROM_BOM}",
"show": true
},
{
"group_by": true,
"label": "Exclude from Board",
"name": "${EXCLUDE_FROM_BOARD}",
"show": true
}
],
"filter_string": "",
"group_symbols": true,
"include_excluded_from_bom": true,
"name": "",
"sort_asc": true,
"sort_field": "Reference"
},
"connection_grid_size": 50.0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"operating_point_overlay_i_precision": 3,
"operating_point_overlay_i_range": "~A",
"operating_point_overlay_v_precision": 3,
"operating_point_overlay_v_range": "~V",
"overbar_offset_ratio": 1.23,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"page_layout_descr_file": "",
"plot_directory": "",
"space_save_all_events": true,
"spice_current_sheet_as_root": false,
"spice_external_command": "spice \"%I\"",
"spice_model_current_sheet_as_root": true,
"spice_save_all_currents": false,
"spice_save_all_dissipations": false,
"spice_save_all_voltages": false,
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"46346c04-8bed-48b4-837b-9342dd403232",
"Root"
]
],
"text_variables": {}
}

View File

@@ -1 +0,0 @@
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}

View File

@@ -1,4 +0,0 @@
(fp_lib_table
(version 7)
(lib (name "Sensor")(type "KiCad")(uri "/home/empire/workspace/PlantCtrl/board/modules/Sensors/Sensors/Sensor.pretty")(options "")(descr ""))
)

View File

@@ -1,14 +0,0 @@
[build]
target = "riscv32imc-unknown-none-elf"
[target."riscv32imc-unknown-none-elf"]
rustflags = [
# "-C", "link-arg=-Tlink.x",
]
# runner = "riscv64-unknown-elf-gdb -q -x openocd.gdb"
# runner = "riscv-none-embed-gdb -q -x openocd.gdb"
# runner = "gdb -q -x openocd.gdb"
# runner = "wlink -v flash"
runner = "wlink -v flash --enable-sdi-print --watch-serial --erase"
# runner = "wlink -v flash"

View File

@@ -1,32 +0,0 @@
;;; .doomrc --- doom runtime config -*- mode: emacs-lisp; lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'doom) ; be silent, byte-compiler
(after! dape
(add-to-list
'dape-configs
`(gdb-dap-openocd
ensure (lambda (config)
(dape-ensure-command config)
(let* ((default-directory
(or (dape-config-get config 'command-cwd)
default-directory))
(command (dape-config-get config 'command))
(output (shell-command-to-string (format "%s --version" command)))
(version (save-match-data
(when (string-match "GNU gdb \\(?:(.*) \\)?\\([0-9.]+\\)" output)
(string-to-number (match-string 1 output))))))
(unless (>= version 14.1)
(user-error "Requires gdb version >= 14.1"))))
modes ()
command-cwd dape-command-cwd
command "gdb"
command-args ("--interpreter=dap")
:request nil
:program nil
:args []
:stopAtBeginningOfMainSubprogram nil))
)
;;; .doomrc ends here

View File

@@ -1,7 +0,0 @@
target extended-remote :3333
set remotetimeout 2000
#symbol-file target/riscv32imc-unknown-none-elf/release/ch32v203-examples
file target/riscv32imc-unknown-none-elf/release/bms
monitor reset halt

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ch32-sensor.iml" filepath="$PROJECT_DIR$/.idea/ch32-sensor.iml" />
</modules>
</component>
</project>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../../../website/themes/blowfish" vcs="Git" />
</component>
</project>

View File

@@ -1,43 +0,0 @@
[package]
name = "bms"
version = "0.1.0"
edition = "2021"
[dependencies]
ch32-hal = { git = "https://github.com/ch32-rs/ch32-hal", features = [
"ch32v203c8t6",
"memory-x",
"embassy",
"rt",
"time-driver-tim2",
], default-features = false }
embassy-executor = { version = "0.7.0", features = [
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.4.0" }
embassy-usb = { version = "0.3.0" }
embassy-futures = { version = "0.1.0" }
# This is okay because we should automatically use whatever ch32-hal uses
qingke-rt = "*"
qingke = "*"
panic-halt = "1.0"
embedded-hal = "1.0.0"
heapless = "0.8.0"
micromath = { version = "2.1.0", features = ["num-traits"] }
embedded-can = "0.4.1"
[profile.dev]
#lto = true
opt-level = 1
[profile.release]
strip = false # symbols are not flashed to the microcontroller, so don't strip them.
#lto = true
debug = true
opt-level = "z" # Optimize for size.

View File

@@ -1,72 +0,0 @@
# ch32v203-bms
A simple battery management controller software.
## CAN bus and hardware address
This firmware exposes a CAN interface on the CH32V203 and uses 4 hardware address pins to allow up to 16 sensors on the same bus.
- CAN pins (default mapping):
- CAN RX: PA11
- CAN TX: PA12
- Address select pins (with internal pull-ups):
- A0: PA0
- A1: PA1
- A2: PA2
- A3: PA3
Wire each address pin to GND to set its corresponding bit to 1. The 4-bit address range is 0..15. The nodes CAN Standard ID is `0x100 | addr`, i.e. 0x100..0x10F. The CAN acceptance filter is configured to only accept frames with the nodes own ID.
Adjust the pins above if your PCB routes CAN or address lines to different pads.
## 555 timer (software) emulation mode
To save the BOM cost of a classic NE555 in simple oscillator applications, this firmware implements a minimal 555-like Schmitt trigger using the MCUs ADC and a GPIO, approximating the behavior when the capacitor is charged/discharged via Q through a resistor, and the combined Trigger/Threshold senses the capacitor node.
- Pins used:
- Q output: PB2
- Combined Trigger/Threshold (ADC input): PA0
- Wiring:
- PB2 (Q) -> series resistor R -> capacitor node
- Capacitor node -> capacitor to GND
- Capacitor node -> PA0 (ADC input)
- Behavior:
- When ADC(PA0) <= ~1/3 Vref, PB2 is driven High.
- When ADC(PA0) >= ~2/3 Vref, PB2 is driven Low.
- Hysteresis avoids chatter; the actual charge/discharge dynamics follow your chosen R and C.
- Notes:
- Use an appropriate resistor from PB2 to the capacitor to set oscillation frequency. Start with 10k..100k and adjust with C.
- Ensure PA0 is routed to the capacitor node and left high impedance (no strong pull-ups/downs) so the ADC can sense the analog voltage.
- PB2 drives the on-board LED (if present), so the LED might blink at the oscillation frequency.
This mode is implemented in `src/main.rs` using `hal::adc::Adc::convert(&mut pin, SampleTime::...)` to take periodic samples and a simple state machine to toggle the Q output based on ~1/3 and ~2/3 Vref thresholds.
## Building
``` sh
cargo build --release
```
## Flash
``` sh
wchisp config reset
wchip wchisp flash target/riscv32imc-unknown-none-elf/release/bms
```
## Debugging
For debugging purposes a container file is provided together with wrapper scripts to start the containerized `openocd` and `riscv-gdb` transparently. The wrapper scripts assume that `podman` is setup.
Starting Debug server
```
./bin/openocd
```
Connecting with gdb for interactive debugging
```
./bin/gdb -f target/riscv32imc-unknown-none-elf/release/bms
```

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CONTAINER_NAME="localhost/wch-dev-tools:latest"
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
pushd "$CONTAINER_TOOLS_BASEDIR"
podman build -t "$CONTAINER_NAME" -f "../wch-tools.Containerfile" .
popd

View File

@@ -1,29 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CONTAINER_IMAGE="localhost/wch-dev-tools:latest"
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
function _fatal {
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
exit 1
}
declare -a PODMAN_ARGS=(
"--rm" "-i" "--log-driver=none"
"--network=host"
"--pid=host"
"-v" "$PWD:$PWD:rw"
"-w" "$PWD"
)
[[ -t 1 ]] && PODMAN_ARGS+=("-t")
if ! podman image exists "$CONTAINER_IMAGE"; then
#attempt to build container
"$CONTAINER_TOOLS_BASEDIR/build-wch-tools-container.sh" 1>&2 ||
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
fi
podman run "${PODMAN_ARGS[@]}" --entrypoint riscv-none-elf-gdb-py3 "$CONTAINER_IMAGE" "$@"

View File

@@ -1,44 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CONTAINER_IMAGE="localhost/wch-dev-tools:latest"
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
function _fatal {
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
exit 1
}
declare -a PODMAN_ARGS=(
"--rm" "-i" "--log-driver=none"
"--network=host"
"-v" "$PWD:$PWD:rw"
"-w" "$PWD"
)
for device in /dev/bus/usb/*/*; do
if udevadm info "$device" | grep -q "ID_VENDOR=wch.cn" && \
udevadm info "$device" | grep -q "ID_MODEL=WCH-Link"; then
DEBUGGER_DEV_PATH="$device"
break
fi
done
if [[ -z "${DEBUGGER_DEV_PATH:-}" ]]; then
echo "Could not find hardware debugger … Exiting!" 1>&2
exit 1
else
# add jlink to podman device
PODMAN_ARGS+=("--device=$DEBUGGER_DEV_PATH")
fi
[[ -t 1 ]] && PODMAN_ARGS+=("-t")
if ! podman image exists "$CONTAINER_IMAGE"; then
#attempt to build container
"$CONTAINER_TOOLS_BASEDIR/build-wch-tools-container.sh" 1>&2 ||
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
fi
podman run "${PODMAN_ARGS[@]}" --entrypoint openocd "$CONTAINER_IMAGE" "$@"

View File

@@ -1,11 +0,0 @@
fn main() {
// println!("cargo:rustc-link-arg-bins=--nmagic");
println!("cargo:rustc-link-arg-bins=-Tlink.x");
// println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
let out_dir = std::env::var("OUT_DIR").unwrap();
let out_dir = std::path::PathBuf::from(out_dir);
std::fs::write(out_dir.join("memory.x"), include_bytes!("memory.x")).unwrap();
println!("cargo:rustc-link-search={}", out_dir.display());
println!("cargo:rerun-if-changed=memory.x");
}

View File

@@ -1,125 +0,0 @@
/* CH32V203c8t6 */
MEMORY
{
FLASH : ORIGIN = 0x00000000, LENGTH = 64K /* BANK_1 */
RAM : ORIGIN = 0x20000000, LENGTH = 20K
}
REGION_ALIAS("REGION_TEXT", FLASH);
REGION_ALIAS("REGION_RODATA", FLASH);
REGION_ALIAS("REGION_DATA", RAM);
REGION_ALIAS("REGION_BSS", RAM);
REGION_ALIAS("REGION_HEAP", RAM);
REGION_ALIAS("REGION_STACK", RAM);
/* fault handlers */
PROVIDE(InstructionMisaligned = ExceptionHandler);
PROVIDE(InstructionFault = ExceptionHandler);
PROVIDE(IllegalInstruction = ExceptionHandler);
PROVIDE(Breakpoint = ExceptionHandler);
PROVIDE(LoadMisaligned = ExceptionHandler);
PROVIDE(LoadFault = ExceptionHandler);
PROVIDE(StoreMisaligned = ExceptionHandler);
PROVIDE(StoreFault = ExceptionHandler);;
PROVIDE(UserEnvCall = ExceptionHandler);
PROVIDE(SupervisorEnvCall = ExceptionHandler);
PROVIDE(MachineEnvCall = ExceptionHandler);
PROVIDE(InstructionPageFault = ExceptionHandler);
PROVIDE(LoadPageFault = ExceptionHandler);
PROVIDE(StorePageFault = ExceptionHandler);
/* core interrupt handlers */
PROVIDE(NonMaskableInt = DefaultHandler);
PROVIDE(Software = DefaultHandler);
/* external interrupt handlers */
PROVIDE(WWDG = DefaultHandler);
PROVIDE(PVD = DefaultHandler);
PROVIDE(TAMPER = DefaultHandler);
PROVIDE(RTC = DefaultHandler);
PROVIDE(FLASH = DefaultHandler);
PROVIDE(RCC = DefaultHandler);
PROVIDE(EXTI0 = DefaultHandler);
PROVIDE(EXTI1 = DefaultHandler);
PROVIDE(EXTI2 = DefaultHandler);
PROVIDE(EXTI3 = DefaultHandler);
PROVIDE(EXTI4 = DefaultHandler);
PROVIDE(DMA1_CHANNEL1 = DefaultHandler);
PROVIDE(DMA1_CHANNEL2 = DefaultHandler);
PROVIDE(DMA1_CHANNEL3 = DefaultHandler);
PROVIDE(DMA1_CHANNEL4 = DefaultHandler);
PROVIDE(DMA1_CHANNEL5 = DefaultHandler);
PROVIDE(DMA1_CHANNEL6 = DefaultHandler);
PROVIDE(DMA1_CHANNEL7 = DefaultHandler);
PROVIDE(ADC = DefaultHandler);
PROVIDE(USB_HP_CAN1_TX = DefaultHandler);
/*PROVIDE(USB_LP_CAN1_RX0 = DefaultHandler);*/
PROVIDE(CAN1_RX1 = DefaultHandler);
PROVIDE(CAN1_SCE = DefaultHandler);
PROVIDE(EXTI9_5 = DefaultHandler);
PROVIDE(TIM1_BRK = DefaultHandler);
PROVIDE(TIM1_UP_ = DefaultHandler);
PROVIDE(TIM1_TRG_COM = DefaultHandler);
PROVIDE(TIM1_CC = DefaultHandler);
PROVIDE(TIM2 = DefaultHandler);
PROVIDE(TIM3 = DefaultHandler);
PROVIDE(TIM4 = DefaultHandler);
PROVIDE(I2C1_EV = DefaultHandler);
PROVIDE(I2C1_ER = DefaultHandler);
PROVIDE(I2C2_EV = DefaultHandler);
PROVIDE(I2C2_ER = DefaultHandler);
PROVIDE(SPI1 = DefaultHandler);
PROVIDE(SPI2 = DefaultHandler);
PROVIDE(USART1 = DefaultHandler);
PROVIDE(USART2 = DefaultHandler);
PROVIDE(USART3 = DefaultHandler);
PROVIDE(EXTI15_10 = DefaultHandler);
PROVIDE(RTCALARM = DefaultHandler);
PROVIDE(USBWAKE_UP = DefaultHandler);
PROVIDE(TIM8_BRK = DefaultHandler);
PROVIDE(TIM8_UP_ = DefaultHandler);
PROVIDE(TIM8_TRG_COM = DefaultHandler);
PROVIDE(TIM8_CC = DefaultHandler);
PROVIDE(RNG = DefaultHandler);
PROVIDE(FSMC = DefaultHandler);
PROVIDE(SDIO = DefaultHandler);
PROVIDE(TIM5 = DefaultHandler);
PROVIDE(SPI3 = DefaultHandler);
PROVIDE(UART4 = DefaultHandler);
PROVIDE(UART5 = DefaultHandler);
PROVIDE(TIM6 = DefaultHandler);
PROVIDE(TIM7 = DefaultHandler);
PROVIDE(DMA2_CHANNEL1 = DefaultHandler);
PROVIDE(DMA2_CHANNEL2 = DefaultHandler);
PROVIDE(DMA2_CHANNEL3 = DefaultHandler);
PROVIDE(DMA2_CHANNEL4 = DefaultHandler);
PROVIDE(DMA2_CHANNEL5 = DefaultHandler);
PROVIDE(ETH = DefaultHandler);
PROVIDE(ETH_WKUP = DefaultHandler);
PROVIDE(CAN2_TX = DefaultHandler);
PROVIDE(CAN2_RX0 = DefaultHandler);
PROVIDE(CAN2_RX1 = DefaultHandler);
PROVIDE(CAN2_SCE = DefaultHandler);
PROVIDE(OTG_FS = DefaultHandler);
PROVIDE(USBHSWAKEUP = DefaultHandler);
PROVIDE(USBHS = DefaultHandler);
PROVIDE(DVP = DefaultHandler);
PROVIDE(UART6 = DefaultHandler);
PROVIDE(UART7 = DefaultHandler);
PROVIDE(UART8 = DefaultHandler);
PROVIDE(TIM9_BRK = DefaultHandler);
PROVIDE(TIM9_UP_ = DefaultHandler);
PROVIDE(TIM9_TRG_COM = DefaultHandler);
PROVIDE(TIM9_CC = DefaultHandler);
PROVIDE(TIM10_BRK = DefaultHandler);
PROVIDE(TIM10_UP_ = DefaultHandler);
PROVIDE(TIM10_TRG_COM = DefaultHandler);
PROVIDE(TIM10_CC = DefaultHandler);
PROVIDE(DMA2_CHANNEL6 = DefaultHandler);
PROVIDE(DMA2_CHANNEL7 = DefaultHandler);
PROVIDE(DMA2_CHANNEL8 = DefaultHandler);
PROVIDE(DMA2_CHANNEL9 = DefaultHandler);
PROVIDE(DMA2_CHANNEL10 = DefaultHandler);
PROVIDE(DMA2_CHANNEL11 = DefaultHandler);

View File

@@ -1,17 +0,0 @@
set _CHIPNAME ch32v203
set _TARGETNAME $_CHIPNAME.cpu
#bindto 0.0.0.0
adapter driver wlinke
adapter speed 6000
transport select sdi
sdi newtap $_CHIPNAME cpu -irlen 5 --expected-id 0x00001
target create $_TARGETNAME.0 wch_riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME wch_rsicv 0x00000000 0 0 0 $_TARGETNAME.0
init

View File

@@ -1,61 +0,0 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]
// Simple 555-like oscillator implemented in firmware.
// - Q output: PB2 (also drives the on-board LED if present)
// - Combined Trigger/Threshold analog input: PA0 (capacitor node)
// Wiring suggestion:
// Q (PB2) --[R]--+-- C -- GND
// |
// PA0 (ADC input)
// The firmware toggles Q high when PA0 <= 1/3 Vref and low when PA0 >= 2/3 Vref.
use embassy_executor::Spawner;
use embassy_time::Timer;
use hal::gpio::{Level, Output};
use {ch32_hal as hal, panic_halt as _};
use hal::adc::{Adc, SampleTime};
#[embassy_executor::main(entry = "qingke_rt::entry")]
async fn main(_spawner: Spawner) -> ! {
let p = hal::init(Default::default());
// Q output on PB2
let mut q = Output::new(p.PB2, Level::Low, Default::default());
// ADC on PA0 for combined Trigger/Threshold input
let mut adc = Adc::new(p.ADC1, Default::default());
let mut trig_thres = p.PA0; // analog-capable pin used as ADC channel
// ADC characteristics: assume 12-bit if HAL doesn't expose it.
// If the HAL provides a method to query resolution, prefer that.
let full_scale: u16 = 4095; // 12-bit default
let thr_low: u16 = (full_scale as u32 / 3) as u16; // ~1/3 Vref
let thr_high: u16 = ((full_scale as u32 * 2) / 3) as u16; // ~2/3 Vref
// Start with Q low. State variable to avoid redundant toggles.
let mut q_high = false;
q.set_low();
loop {
// Read capacitor node voltage via ADC
let sample: u16 = adc.convert(&mut trig_thres, SampleTime::CYCLES239_5);
// Implement Schmitt trigger behavior like NE555 using thresholds
if !q_high && sample <= thr_low {
// Trigger: voltage fell below 1/3 Vref -> set output high
q.set_high();
q_high = true;
} else if q_high && sample >= thr_high {
// Threshold: voltage rose above 2/3 Vref -> set output low
q.set_low();
q_high = false;
}
// Small delay to reduce CPU usage; adjust for responsiveness/noise
Timer::after_micros(200).await;
}
}

View File

@@ -1,27 +0,0 @@
FROM debian:bookworm
RUN apt update -y && apt upgrade -y && apt install git libjaylink-dev libusb-1.0-0 unzip curl libhidapi-hidraw0 xz-utils -y
RUN cd /root && \
curl -L -o mrs-toolchain.tar.xz "https://github.com/ch32-riscv-ug/MounRiver_Studio_Community_miror/releases/download/1.92-toolchain/MRS_Toolchain_Linux_x64_V1.92.tar.xz" && \
mkdir mrs-toolchain && \
tar -xvf mrs-toolchain.tar.xz -C mrs-toolchain --strip-components=1 && \
mv mrs-toolchain/OpenOCD/bin/openocd /usr/local/bin && \
mv mrs-toolchain/OpenOCD/share/openocd /usr/local/share && \
# mv mrs-toolchain/RISC-V_Embedded_GCC12/bin/riscv-none-elf-gdb /usr/local/bin && \ # both toolchains in MRS are to old to work with emacs dape
# mv mrs-toolchain/RISC-V_Embedded_GCC12/libexec /usr/local && \ # both toolchains in MRS are to old to work with emacs dape
rm -rf mrs-toolchain mrs-toolchain.tar.xz && \
# Use up to date xpack toolchains for gdb
curl -L -o xpack-riscv-toolchain.tar.gz "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/xpack-riscv-none-elf-gcc-14.2.0-3-linux-x64.tar.gz" && \
mkdir xpack-toolchain && \
tar -xvf xpack-riscv-toolchain.tar.gz -C xpack-toolchain --strip-components=1 && \
mv xpack-toolchain/bin/* /usr/local/bin && \
mv xpack-toolchain/lib/ /usr/local && \
mv xpack-toolchain/lib64/ /usr/local && \
mv xpack-toolchain/libexec /usr/local && \
mv xpack-toolchain/riscv-none-elf /usr/local && \
rm -rf xpack-toolchain xpack-riscv-toolchain.tar.gz
RUN mkdir -p /root/.config/gdb && echo "set auto-load safe-path /" >> /root/.config/gdb/gdbinit
ENTRYPOINT [ "/usr/bin/bash" ]

View File

@@ -1 +0,0 @@
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}

View File

@@ -1,4 +0,0 @@
(fp_lib_table
(version 7)
(lib (name "Sensor")(type "KiCad")(uri "${KIPRJMOD}/Sensor.pretty")(options "")(descr ""))
)

View File

@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1325px"
height="675px" viewBox="0 0 1325 675" enable-background="new 0 0 1325 675" xml:space="preserve">
<g id="back">
<rect width="1325" height="675"/>
</g>
<g id="logo">
<g>
<path fill="#FFFFFF" d="M109.818,477.621H75.827v34.299h33.992v-11.638l12.612,2.614v6.409c0,4.956-0.932,8.331-2.794,10.126
c-1.864,1.794-5.409,2.691-10.639,2.691H76.647c-5.264,0-8.818-0.897-10.664-2.691c-1.846-1.795-2.769-5.17-2.769-10.126v-28.558
c0-4.922,0.923-8.287,2.769-10.1c1.846-1.812,5.4-2.717,10.664-2.717h32.351c5.229,0,8.775,0.905,10.639,2.717
c1.862,1.813,2.794,5.178,2.794,10.1v5.127l-12.612,2V477.621z"/>
<path fill="#FFFFFF" d="M148.424,522.123v-54.191h12.612v21.02h39.375v-21.02h12.715v54.191h-12.715v-23.328h-39.375v23.328
H148.424z"/>
<path fill="#FFFFFF" d="M230.456,522.123l30.659-54.191h12.151l31.069,54.191h-14.15l-6.511-11.844h-34.351l-6.306,11.844H230.456
z M254.706,500.487h23.738l-11.689-22.046L254.706,500.487z"/>
<path fill="#FFFFFF" d="M318.793,480.748c0-4.922,0.923-8.287,2.769-10.1c1.846-1.812,5.4-2.717,10.664-2.717h39.888
c5.263,0,8.818,0.905,10.664,2.717c1.846,1.813,2.769,5.178,2.769,10.1v28.558c0,4.956-0.923,8.331-2.769,10.126
c-1.846,1.794-5.401,2.691-10.664,2.691h-39.888c-5.264,0-8.818-0.897-10.664-2.691c-1.846-1.795-2.769-5.17-2.769-10.126V480.748
z M331.405,511.92h41.58v-34.299h-41.58V511.92z"/>
<path fill="#FFFFFF" d="M459.066,477.416h-35.479v11.639h33.787c5.297,0,8.877,0.905,10.741,2.717
c1.863,1.813,2.794,5.178,2.794,10.1v7.435c0,4.922-0.932,8.289-2.794,10.101c-1.863,1.812-5.443,2.717-10.741,2.717h-33.479
c-5.298,0-8.878-0.905-10.741-2.717c-1.863-1.812-2.794-5.179-2.794-10.101v-1.487l11.125-2.307v6.408h38.298v-12.355h-33.787
c-5.264,0-8.818-0.905-10.664-2.717s-2.769-5.179-2.769-10.101v-5.999c0-4.922,0.923-8.287,2.769-10.1
c1.846-1.812,5.4-2.717,10.664-2.717h30.762c5.092,0,8.604,0.871,10.536,2.614c1.931,1.743,2.897,4.837,2.897,9.28v1.127
l-11.125,2.615V477.416z"/>
<path fill="#FFFFFF" d="M537.714,522.123v-54.191h12.612v54.191H537.714z"/>
<path fill="#FFFFFF" d="M577.909,522.123v-54.191h10.203l25.532,32.761l24.968-32.761h10.1v54.191h-11.689v-33.479
c0-0.649,0.042-1.47,0.128-2.461c0.084-0.991,0.196-2.103,0.333-3.333c-0.684,1.402-1.282,2.556-1.794,3.461
c-0.513,0.906-0.974,1.649-1.384,2.229l-20.354,27.07h-2.512l-20.405-27.172c-0.752-1.025-1.393-1.991-1.923-2.897
c-0.53-0.905-0.966-1.785-1.307-2.64c0.103,1.127,0.179,2.152,0.231,3.076c0.051,0.922,0.077,1.812,0.077,2.666v33.479H577.909z"
/>
<path fill="#FFFFFF" d="M714.748,480.748c0-4.922,0.923-8.287,2.769-10.1c1.846-1.812,5.4-2.717,10.664-2.717h39.888
c5.263,0,8.818,0.905,10.664,2.717c1.846,1.813,2.769,5.178,2.769,10.1v28.558c0,4.956-0.923,8.331-2.769,10.126
c-1.846,1.794-5.401,2.691-10.664,2.691h-5.845l6.819,13.945h-12.51l-6.102-13.945h-22.251c-5.264,0-8.818-0.897-10.664-2.691
c-1.846-1.795-2.769-5.17-2.769-10.126V480.748z M727.36,511.92h18.56l-5.024-11.74l9.126-3.691l7.332,15.432h11.586v-34.299
H727.36V511.92z"/>
<path fill="#FFFFFF" d="M820.67,467.932v43.988h35.939v-43.988h12.562v41.374c0,4.956-0.923,8.331-2.769,10.126
c-1.846,1.794-5.401,2.691-10.664,2.691H821.49c-5.229,0-8.776-0.897-10.639-2.691c-1.863-1.795-2.794-5.17-2.794-10.126v-41.374
H820.67z"/>
<path fill="#FFFFFF" d="M884.244,522.123l30.659-54.191h12.151l31.068,54.191h-14.15l-6.511-11.844h-34.351l-6.307,11.844H884.244
z M908.494,500.487h23.738l-11.689-22.046L908.494,500.487z"/>
<path fill="#FFFFFF" d="M975.556,522.123v-54.191h34.863c9.946,0,17.594,2.324,22.943,6.973
c5.349,4.648,8.023,11.245,8.023,19.789c0,5.06-1.043,9.613-3.128,13.664c-2.085,4.05-5.023,7.237-8.818,9.562
c-2.357,1.47-5.289,2.538-8.792,3.204c-3.504,0.667-7.99,1-13.458,1H975.556z M988.168,511.92h16.304
c8.682,0,14.834-1.35,18.457-4.05c3.622-2.699,5.435-7.16,5.435-13.382c0-5.537-1.505-9.731-4.512-12.586
c-3.008-2.854-7.452-4.281-13.33-4.281h-22.354V511.92z"/>
<path fill="#FFFFFF" d="M1064.509,522.123v-54.191h46.348c4.307,0,7.425,0.829,9.356,2.486c1.931,1.658,2.896,4.332,2.896,8.023
v12.715c0,3.658-0.966,6.324-2.896,7.998c-1.932,1.675-5.05,2.512-9.356,2.512h-7.075l25.02,20.457h-18.098l-21.842-20.457
h-11.945v20.457H1064.509z M1105.268,477.313h-28.352v15.073h28.352c2.188,0,3.683-0.315,4.486-0.948
c0.803-0.632,1.205-1.751,1.205-3.358v-6.512c0-1.571-0.402-2.674-1.205-3.307C1108.95,477.63,1107.455,477.313,1105.268,477.313z
"/>
<path fill="#FFFFFF" d="M1134.594,522.123l30.659-54.191h12.151l31.068,54.191h-14.15l-6.511-11.844h-34.351l-6.307,11.844
H1134.594z M1158.844,500.487h23.738l-11.689-22.046L1158.844,500.487z"/>
<path fill="#FFFFFF" d="M1244.003,477.621v44.502h-12.612v-44.502h-24.865v-9.689h62.445v9.689H1244.003z"/>
<path fill="#FFFFFF" d="M71.188,626.523l-17.29-44.902h10.79l11.385,30.119l11.937-30.119h7.307l12.149,30.119l10.875-30.119
h9.346l-17.332,44.902h-7.052l-12.362-31.053l-12.532,31.053H71.188z"/>
<path fill="#FFFFFF" d="M151.73,626.523l-17.29-44.902h10.79l11.385,30.119l11.937-30.119h7.307l12.149,30.119l10.875-30.119
h9.346l-17.332,44.902h-7.052l-12.362-31.053l-12.532,31.053H151.73z"/>
<path fill="#FFFFFF" d="M232.273,626.523l-17.29-44.902h10.79l11.385,30.119l11.937-30.119h7.307l12.149,30.119l10.875-30.119
h9.346l-17.332,44.902h-7.052l-12.362-31.053l-12.532,31.053H232.273z"/>
<path fill="#FFFFFF" d="M303.301,613.057h1.572c0.765,0,1.302,0.22,1.614,0.659c0.312,0.439,0.467,1.281,0.467,2.527v7.052
c0,1.359-0.17,2.237-0.51,2.634s-1.388,0.595-3.144,0.595h-7.774c-0.765,0-1.303-0.227-1.614-0.68
c-0.312-0.453-0.467-1.303-0.467-2.549v-7.052c0-1.331,0.17-2.194,0.51-2.591s1.387-0.596,3.144-0.596H303.301z"/>
<path fill="#FFFFFF" d="M363.75,589.65h-28.165v28.42h28.165v-9.644l10.45,2.167v5.31c0,4.106-0.772,6.903-2.315,8.39
c-1.544,1.487-4.482,2.23-8.815,2.23h-26.805c-4.361,0-7.307-0.743-8.836-2.23c-1.529-1.486-2.294-4.283-2.294-8.39v-23.661
c0-4.078,0.765-6.868,2.294-8.369s4.475-2.252,8.836-2.252h26.805c4.333,0,7.271,0.751,8.815,2.252
c1.543,1.501,2.315,4.291,2.315,8.369v4.248l-10.45,1.656V589.65z"/>
<path fill="#FFFFFF" d="M433.418,589.65h-28.165v28.42h28.165v-9.644l10.45,2.167v5.31c0,4.106-0.772,6.903-2.315,8.39
c-1.544,1.487-4.482,2.23-8.815,2.23h-26.805c-4.361,0-7.307-0.743-8.836-2.23c-1.529-1.486-2.294-4.283-2.294-8.39v-23.661
c0-4.078,0.765-6.868,2.294-8.369s4.475-2.252,8.836-2.252h26.805c4.333,0,7.271,0.751,8.815,2.252
c1.543,1.501,2.315,4.291,2.315,8.369v4.248l-10.45,1.656V589.65z"/>
<path fill="#FFFFFF" d="M503.086,589.65h-28.165v28.42h28.165v-9.644l10.45,2.167v5.31c0,4.106-0.772,6.903-2.315,8.39
c-1.544,1.487-4.482,2.23-8.815,2.23h-26.805c-4.361,0-7.307-0.743-8.836-2.23c-1.529-1.486-2.294-4.283-2.294-8.39v-23.661
c0-4.078,0.765-6.868,2.294-8.369s4.475-2.252,8.836-2.252h26.805c4.333,0,7.271,0.751,8.815,2.252
c1.543,1.501,2.315,4.291,2.315,8.369v4.248l-10.45,1.656V589.65z"/>
<path fill="#FFFFFF" d="M527.768,607.832v-8.963h20.263v8.963H527.768z"/>
<path fill="#FFFFFF" d="M563.706,626.523v-44.902h8.454l21.155,27.146l20.688-27.146h8.369v44.902h-9.686v-27.74
c0-0.537,0.035-1.217,0.106-2.039c0.071-0.82,0.163-1.741,0.276-2.761c-0.567,1.161-1.062,2.117-1.487,2.867
c-0.425,0.751-0.807,1.367-1.147,1.849l-16.865,22.43h-2.082l-16.907-22.516c-0.623-0.85-1.154-1.649-1.593-2.399
c-0.439-0.75-0.801-1.479-1.083-2.188c0.085,0.936,0.149,1.785,0.191,2.549c0.043,0.766,0.064,1.502,0.064,2.209v27.74H563.706z"
/>
<path fill="#FFFFFF" d="M635.753,626.523l25.403-44.902h10.068l25.742,44.902h-11.725l-5.395-9.813h-28.462l-5.225,9.813H635.753z
M655.846,608.597h19.668l-9.686-18.267L655.846,608.597z"/>
<path fill="#FFFFFF" d="M711.326,626.523v-44.902h7.137l31.605,26.466c1.076,0.878,2.024,1.706,2.846,2.485s1.572,1.579,2.252,2.4
c-0.17-2.521-0.283-4.305-0.34-5.354c-0.057-1.047-0.085-1.854-0.085-2.421v-23.577h9.388v44.902h-7.137l-32.965-27.74
c-0.793-0.707-1.486-1.345-2.081-1.911s-1.147-1.147-1.657-1.741c0.142,1.388,0.248,2.697,0.319,3.929
c0.07,1.232,0.106,2.302,0.106,3.208v24.256H711.326z"/>
<path fill="#FFFFFF" d="M786.941,626.523v-44.902h7.137l31.605,26.466c1.076,0.878,2.024,1.706,2.846,2.485s1.572,1.579,2.252,2.4
c-0.17-2.521-0.283-4.305-0.34-5.354c-0.057-1.047-0.085-1.854-0.085-2.421v-23.577h9.388v44.902h-7.137l-32.965-27.74
c-0.793-0.707-1.486-1.345-2.081-1.911s-1.147-1.147-1.657-1.741c0.142,1.388,0.248,2.697,0.319,3.929
c0.07,1.232,0.106,2.302,0.106,3.208v24.256H786.941z"/>
<path fill="#FFFFFF" d="M862.642,626.523v-44.902h10.45v17.418h32.625v-17.418h10.535v44.902h-10.535v-19.328h-32.625v19.328
H862.642z"/>
<path fill="#FFFFFF" d="M939.19,626.523v-44.902h45.964v7.646h-35.514v10.025h20.73v7.646h-20.73v11.131h35.938v8.453H939.19z"/>
<path fill="#FFFFFF" d="M1004.866,626.523v-44.902h10.45v44.902H1004.866z"/>
<path fill="#FFFFFF" d="M1038.17,626.523v-44.902h8.453l21.156,27.146l20.688-27.146h8.369v44.902h-9.686v-27.74
c0-0.537,0.035-1.217,0.105-2.039c0.07-0.82,0.163-1.741,0.276-2.761c-0.566,1.161-1.062,2.117-1.487,2.867
c-0.424,0.751-0.807,1.367-1.146,1.849l-16.865,22.43h-2.081l-16.907-22.516c-0.623-0.85-1.154-1.649-1.593-2.399
c-0.439-0.75-0.801-1.479-1.083-2.188c0.084,0.936,0.148,1.785,0.19,2.549c0.043,0.766,0.063,1.502,0.063,2.209v27.74H1038.17z"/>
<path fill="#FFFFFF" d="M1124.83,613.057h1.572c0.764,0,1.302,0.22,1.613,0.659s0.468,1.281,0.468,2.527v7.052
c0,1.359-0.17,2.237-0.51,2.634s-1.388,0.595-3.144,0.595h-7.773c-0.766,0-1.304-0.227-1.615-0.68s-0.467-1.303-0.467-2.549
v-7.052c0-1.331,0.17-2.194,0.51-2.591s1.388-0.596,3.144-0.596H1124.83z"/>
<path fill="#FFFFFF" d="M1147.601,626.523v-44.902h28.887c8.241,0,14.577,1.927,19.01,5.777c4.433,3.853,6.648,9.318,6.648,16.398
c0,4.191-0.864,7.965-2.591,11.32c-1.729,3.356-4.164,5.997-7.307,7.923c-1.955,1.218-4.383,2.103-7.286,2.655
c-2.903,0.552-6.62,0.828-11.151,0.828H1147.601z M1158.051,618.07h13.509c7.193,0,12.291-1.119,15.293-3.356
s4.503-5.933,4.503-11.087c0-4.588-1.246-8.064-3.738-10.43c-2.492-2.364-6.174-3.547-11.045-3.547h-18.521V618.07z"/>
<path fill="#FFFFFF" d="M1221.304,626.523v-44.902h45.964v7.646h-35.514v10.025h20.73v7.646h-20.73v11.131h35.938v8.453H1221.304z
"/>
</g>
<g>
<polygon fill="#FFFFFF" points="1050.25,150.292 1050.25,100.292 1000.25,100.292 1000.25,49.792 799.75,49.792 799.75,100.25
749.75,100.25 749.75,349.791 799.75,349.791 799.75,400.292 1000.25,400.292 1000.25,349.791 1050.25,349.791 1050.25,300.292
950.25,300.292 950.25,349.791 849.75,349.791 849.75,100.292 950.25,100.292 950.25,150.292 "/>
</g>
<g>
<path fill="#FFFFFF" d="M1100.25,49.792v174.75h175V49.792H1100.25z M1251,124.042h-24.75v25h-50.75v24.75h75.5v25.125h-125.75
v-25.125h25.25v-24.75h25v-25h50.75v-25h-75.75v25h-25.25v-25h25.25v-25.25h75.75v25.25H1251V124.042z"/>
</g>
<g>
<polygon fill="#FFFFFF" points="700.25,150.292 700.25,100.292 650.25,100.292 650.25,49.792 449.75,49.792 449.75,100.25
399.75,100.25 399.75,349.791 449.75,349.791 449.75,400.292 650.25,400.292 650.25,349.791 700.25,349.791 700.25,300.292
600.25,300.292 600.25,349.791 499.75,349.791 499.75,100.292 600.25,100.292 600.25,150.292 "/>
</g>
<g>
<polygon fill="#FFFFFF" points="350.25,150.292 350.25,100.292 300.25,100.292 300.25,49.792 99.75,49.792 99.75,100.25
49.75,100.25 49.75,349.791 99.75,349.791 99.75,400.292 300.25,400.292 300.25,349.791 350.25,349.791 350.25,300.292
250.25,300.292 250.25,349.791 149.75,349.791 149.75,100.292 250.25,100.292 250.25,150.292 "/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,131 +0,0 @@
{
"board": {
"active_layer": 25,
"active_layer_preset": "",
"auto_track_width": false,
"hidden_netclasses": [],
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"images": 0.6,
"pads": 1.0,
"shapes": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": false,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
"vias",
"footprint_text",
"footprint_anchors",
"ratsnest",
"grid",
"footprints_front",
"footprints_back",
"footprint_values",
"footprint_references",
"tracks",
"drc_errors",
"drawing_sheet",
"bitmaps",
"pads",
"zones",
"drc_warnings",
"drc_exclusions",
"locked_item_shadows",
"conflict_shadows",
"shapes"
],
"visible_layers": "ffffffff_ffffffff_ffffffff_ffffffff",
"zone_display_mode": 0
},
"git": {
"repo_type": "",
"repo_username": "",
"ssh_key": ""
},
"meta": {
"filename": "sensor-programmer.kicad_prl",
"version": 5
},
"net_inspector_panel": {
"col_hidden": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
],
"col_order": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
],
"col_widths": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"custom_group_rules": [],
"expanded_rows": [],
"filter_by_net_name": true,
"filter_by_netclass": true,
"filter_text": "",
"group_by_constraint": false,
"group_by_netclass": false,
"show_unconnected_nets": false,
"show_zero_pad_nets": false,
"sort_ascending": true,
"sorting_column": 0
},
"open_jobsets": [],
"project": {
"files": []
},
"schematic": {
"selection_filter": {
"graphics": true,
"images": true,
"labels": true,
"lockedItems": false,
"otherItems": true,
"pins": true,
"symbols": true,
"text": true,
"wires": true
}
}
}

View File

@@ -1,911 +0,0 @@
{
"board": {
"3dviewports": [],
"design_settings": {
"defaults": {
"apply_defaults_to_fp_fields": false,
"apply_defaults_to_fp_shapes": false,
"apply_defaults_to_fp_text": false,
"board_outline_line_width": 0.05,
"copper_line_width": 0.2,
"copper_text_italic": false,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"copper_text_upright": false,
"courtyard_line_width": 0.05,
"dimension_precision": 4,
"dimension_units": 3,
"dimensions": {
"arrow_length": 1270000,
"extension_offset": 500000,
"keep_text_aligned": true,
"suppress_zeroes": true,
"text_position": 0,
"units_format": 0
},
"fab_line_width": 0.1,
"fab_text_italic": false,
"fab_text_size_h": 1.0,
"fab_text_size_v": 1.0,
"fab_text_thickness": 0.15,
"fab_text_upright": false,
"other_line_width": 0.1,
"other_text_italic": false,
"other_text_size_h": 1.0,
"other_text_size_v": 1.0,
"other_text_thickness": 0.15,
"other_text_upright": false,
"pads": {
"drill": 0.8,
"height": 1.27,
"width": 2.54
},
"silk_line_width": 0.1,
"silk_text_italic": false,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.1,
"silk_text_upright": false,
"zones": {
"min_clearance": 0.5
}
},
"diff_pair_dimensions": [
{
"gap": 0.0,
"via_gap": 0.0,
"width": 0.0
}
],
"drc_exclusions": [],
"meta": {
"version": 2
},
"rule_severities": {
"annular_width": "error",
"clearance": "error",
"connection_width": "warning",
"copper_edge_clearance": "ignore",
"copper_sliver": "warning",
"courtyards_overlap": "error",
"creepage": "error",
"diff_pair_gap_out_of_range": "error",
"diff_pair_uncoupled_length_too_long": "error",
"drill_out_of_range": "error",
"duplicate_footprints": "warning",
"extra_footprint": "warning",
"footprint": "error",
"footprint_filters_mismatch": "ignore",
"footprint_symbol_mismatch": "warning",
"footprint_type_mismatch": "ignore",
"hole_clearance": "error",
"hole_to_hole": "warning",
"holes_co_located": "warning",
"invalid_outline": "error",
"isolated_copper": "warning",
"item_on_disabled_layer": "error",
"items_not_allowed": "error",
"length_out_of_range": "error",
"lib_footprint_issues": "warning",
"lib_footprint_mismatch": "warning",
"malformed_courtyard": "error",
"microvia_drill_out_of_range": "error",
"mirrored_text_on_front_layer": "warning",
"missing_courtyard": "ignore",
"missing_footprint": "warning",
"net_conflict": "warning",
"nonmirrored_text_on_back_layer": "warning",
"npth_inside_courtyard": "ignore",
"padstack": "warning",
"pth_inside_courtyard": "ignore",
"shorting_items": "error",
"silk_edge_clearance": "warning",
"silk_over_copper": "ignore",
"silk_overlap": "ignore",
"skew_out_of_range": "error",
"solder_mask_bridge": "error",
"starved_thermal": "ignore",
"text_height": "warning",
"text_on_edge_cuts": "error",
"text_thickness": "warning",
"through_hole_pad_without_hole": "error",
"too_many_vias": "error",
"track_angle": "error",
"track_dangling": "warning",
"track_segment_length": "error",
"track_width": "error",
"tracks_crossing": "error",
"unconnected_items": "error",
"unresolved_variable": "error",
"via_dangling": "warning",
"zones_intersect": "error"
},
"rules": {
"max_error": 0.005,
"min_clearance": 0.0,
"min_connection": 0.0,
"min_copper_edge_clearance": 0.5,
"min_groove_width": 0.0,
"min_hole_clearance": 0.25,
"min_hole_to_hole": 0.25,
"min_microvia_diameter": 0.2,
"min_microvia_drill": 0.1,
"min_resolved_spokes": 2,
"min_silk_clearance": 0.0,
"min_text_height": 0.8,
"min_text_thickness": 0.08,
"min_through_hole_diameter": 0.3,
"min_track_width": 0.0,
"min_via_annular_width": 0.1,
"min_via_diameter": 0.5,
"solder_mask_to_copper_clearance": 0.005,
"use_height_for_length_calcs": true
},
"teardrop_options": [
{
"td_onpthpad": true,
"td_onroundshapesonly": false,
"td_onsmdpad": true,
"td_ontrackend": false,
"td_onvia": true
}
],
"teardrop_parameters": [
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_round_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_rect_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_track_end",
"td_width_to_size_filter_ratio": 0.9
}
],
"track_widths": [
0.0,
0.2,
0.5,
1.0
],
"tuning_pattern_settings": {
"diff_pair_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 1.0
},
"diff_pair_skew_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
},
"single_track_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
}
},
"via_dimensions": [
{
"diameter": 0.0,
"drill": 0.0
}
],
"zones_allow_external_fillets": false
},
"ipc2581": {
"dist": "",
"distpn": "",
"internal_id": "",
"mfg": "",
"mpn": ""
},
"layer_pairs": [],
"layer_presets": [],
"viewports": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"endpoint_off_grid": "warning",
"extra_units": "error",
"footprint_filter": "ignore",
"footprint_link_issues": "warning",
"four_way_junction": "ignore",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"label_multiple_wires": "warning",
"lib_symbol_issues": "warning",
"lib_symbol_mismatch": "warning",
"missing_bidi_pin": "warning",
"missing_input_pin": "warning",
"missing_power_pin": "error",
"missing_unit": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "ignore",
"same_local_global_label": "warning",
"similar_label_and_power": "warning",
"similar_labels": "warning",
"similar_power": "warning",
"simulation_model_issue": "ignore",
"single_global_label": "ignore",
"unannotated": "error",
"unconnected_wire_endpoint": "warning",
"undefined_netclass": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "sensor-programmer.kicad_pro",
"version": 3
},
"net_settings": {
"classes": [
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"priority": 2147483647,
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.2,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
}
],
"meta": {
"version": 4
},
"net_colors": null,
"netclass_assignments": null,
"netclass_patterns": []
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"plot": "",
"pos_files": "",
"specctra_dsn": "",
"step": "",
"svg": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"bom_export_filename": "${PROJECTNAME}.csv",
"bom_fmt_presets": [],
"bom_fmt_settings": {
"field_delimiter": ",",
"keep_line_breaks": false,
"keep_tabs": false,
"name": "CSV",
"ref_delimiter": ",",
"ref_range_delimiter": "",
"string_delimiter": "\""
},
"bom_presets": [],
"bom_settings": {
"exclude_dnp": false,
"fields_ordered": [
{
"group_by": false,
"label": "Reference",
"name": "Reference",
"show": true
},
{
"group_by": false,
"label": "Qty",
"name": "${QUANTITY}",
"show": true
},
{
"group_by": true,
"label": "Value",
"name": "Value",
"show": true
},
{
"group_by": true,
"label": "DNP",
"name": "${DNP}",
"show": true
},
{
"group_by": true,
"label": "Exclude from BOM",
"name": "${EXCLUDE_FROM_BOM}",
"show": true
},
{
"group_by": true,
"label": "Exclude from Board",
"name": "${EXCLUDE_FROM_BOARD}",
"show": true
},
{
"group_by": true,
"label": "Footprint",
"name": "Footprint",
"show": true
},
{
"group_by": false,
"label": "Datasheet",
"name": "Datasheet",
"show": true
},
{
"group_by": false,
"label": "Actuator/Cap Color",
"name": "Actuator/Cap Color",
"show": false
},
{
"group_by": false,
"label": "Attrition Qty",
"name": "Attrition Qty",
"show": false
},
{
"group_by": false,
"label": "Capacitance",
"name": "Capacitance",
"show": false
},
{
"group_by": false,
"label": "Category",
"name": "Category",
"show": false
},
{
"group_by": false,
"label": "Circuit",
"name": "Circuit",
"show": false
},
{
"group_by": false,
"label": "Class",
"name": "Class",
"show": false
},
{
"group_by": false,
"label": "Contact Current",
"name": "Contact Current",
"show": false
},
{
"group_by": false,
"label": "Diode Configuration",
"name": "Diode Configuration",
"show": false
},
{
"group_by": false,
"label": "Forward Voltage (Vf@If)",
"name": "Forward Voltage (Vf@If)",
"show": false
},
{
"group_by": false,
"label": "Insulation Resistance",
"name": "Insulation Resistance",
"show": false
},
{
"group_by": false,
"label": "LCSC",
"name": "LCSC",
"show": false
},
{
"group_by": false,
"label": "Manufacturer",
"name": "Manufacturer",
"show": false
},
{
"group_by": false,
"label": "Mechanical Life",
"name": "Mechanical Life",
"show": false
},
{
"group_by": false,
"label": "Minimum Qty",
"name": "Minimum Qty",
"show": false
},
{
"group_by": false,
"label": "Mounting Style",
"name": "Mounting Style",
"show": false
},
{
"group_by": false,
"label": "Operating Force",
"name": "Operating Force",
"show": false
},
{
"group_by": false,
"label": "Operating Temperature",
"name": "Operating Temperature",
"show": false
},
{
"group_by": false,
"label": "Operating Temperature Range",
"name": "Operating Temperature Range",
"show": false
},
{
"group_by": false,
"label": "Overload Voltage (Max)",
"name": "Overload Voltage (Max)",
"show": false
},
{
"group_by": false,
"label": "Part",
"name": "Part",
"show": false
},
{
"group_by": false,
"label": "Pin Style",
"name": "Pin Style",
"show": false
},
{
"group_by": false,
"label": "Power(Watts)",
"name": "Power(Watts)",
"show": false
},
{
"group_by": false,
"label": "Price",
"name": "Price",
"show": false
},
{
"group_by": false,
"label": "Process",
"name": "Process",
"show": false
},
{
"group_by": false,
"label": "Rectified Current",
"name": "Rectified Current",
"show": false
},
{
"group_by": false,
"label": "Resistance",
"name": "Resistance",
"show": false
},
{
"group_by": false,
"label": "Reverse Leakage Current",
"name": "Reverse Leakage Current",
"show": false
},
{
"group_by": false,
"label": "Reverse Voltage (Vr)",
"name": "Reverse Voltage (Vr)",
"show": false
},
{
"group_by": false,
"label": "Sim.Pins",
"name": "Sim.Pins",
"show": false
},
{
"group_by": false,
"label": "Stock",
"name": "Stock",
"show": false
},
{
"group_by": false,
"label": "Strike Gundam",
"name": "Strike Gundam",
"show": false
},
{
"group_by": false,
"label": "Switch Height",
"name": "Switch Height",
"show": false
},
{
"group_by": false,
"label": "Switch Length",
"name": "Switch Length",
"show": false
},
{
"group_by": false,
"label": "Switch Width",
"name": "Switch Width",
"show": false
},
{
"group_by": false,
"label": "Temperature Coefficient",
"name": "Temperature Coefficient",
"show": false
},
{
"group_by": false,
"label": "Tolerance",
"name": "Tolerance",
"show": false
},
{
"group_by": false,
"label": "Type",
"name": "Type",
"show": false
},
{
"group_by": false,
"label": "Voltage Rated",
"name": "Voltage Rated",
"show": false
},
{
"group_by": false,
"label": "Voltage Rating (Dc)",
"name": "Voltage Rating (Dc)",
"show": false
},
{
"group_by": false,
"label": "With Lamp",
"name": "With Lamp",
"show": false
},
{
"group_by": false,
"label": "Actuator Style",
"name": "Actuator Style",
"show": false
},
{
"group_by": false,
"label": "Description",
"name": "Description",
"show": false
},
{
"group_by": false,
"label": "#",
"name": "${ITEM_NUMBER}",
"show": false
},
{
"group_by": false,
"label": "LCSC_PART_NUMBER",
"name": "LCSC_PART_NUMBER",
"show": false
},
{
"group_by": false,
"label": "Sim.Device",
"name": "Sim.Device",
"show": false
},
{
"group_by": false,
"label": "Sim.Type",
"name": "Sim.Type",
"show": false
}
],
"filter_string": "",
"group_symbols": true,
"include_excluded_from_bom": true,
"name": "",
"sort_asc": true,
"sort_field": "Reference"
},
"connection_grid_size": 50.0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"operating_point_overlay_i_precision": 3,
"operating_point_overlay_i_range": "~A",
"operating_point_overlay_v_precision": 3,
"operating_point_overlay_v_range": "~V",
"overbar_offset_ratio": 1.23,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"page_layout_descr_file": "",
"plot_directory": "",
"space_save_all_events": true,
"spice_current_sheet_as_root": false,
"spice_external_command": "spice \"%I\"",
"spice_model_current_sheet_as_root": true,
"spice_save_all_currents": false,
"spice_save_all_dissipations": false,
"spice_save_all_voltages": false,
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"a6275404-53d1-4c49-9128-131a51db8de5",
"Root"
]
],
"text_variables": {}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}

File diff suppressed because it is too large Load Diff

View File

@@ -1,131 +0,0 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": false,
"hidden_netclasses": [],
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"images": 0.6,
"pads": 1.0,
"shapes": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": false,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
"vias",
"footprint_text",
"footprint_anchors",
"ratsnest",
"grid",
"footprints_front",
"footprints_back",
"footprint_values",
"footprint_references",
"tracks",
"drc_errors",
"drawing_sheet",
"bitmaps",
"pads",
"zones",
"drc_warnings",
"drc_exclusions",
"locked_item_shadows",
"conflict_shadows",
"shapes"
],
"visible_layers": "ffffffff_ffffffff_ffffffff_ffffffff",
"zone_display_mode": 0
},
"git": {
"repo_type": "",
"repo_username": "",
"ssh_key": ""
},
"meta": {
"filename": "sensor.kicad_prl",
"version": 5
},
"net_inspector_panel": {
"col_hidden": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
],
"col_order": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
],
"col_widths": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"custom_group_rules": [],
"expanded_rows": [],
"filter_by_net_name": true,
"filter_by_netclass": true,
"filter_text": "",
"group_by_constraint": false,
"group_by_netclass": false,
"show_unconnected_nets": false,
"show_zero_pad_nets": false,
"sort_ascending": true,
"sorting_column": 0
},
"open_jobsets": [],
"project": {
"files": []
},
"schematic": {
"selection_filter": {
"graphics": true,
"images": true,
"labels": true,
"lockedItems": false,
"otherItems": true,
"pins": true,
"symbols": true,
"text": true,
"wires": true
}
}
}

View File

@@ -1,911 +0,0 @@
{
"board": {
"3dviewports": [],
"design_settings": {
"defaults": {
"apply_defaults_to_fp_fields": false,
"apply_defaults_to_fp_shapes": false,
"apply_defaults_to_fp_text": false,
"board_outline_line_width": 0.05,
"copper_line_width": 0.2,
"copper_text_italic": false,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"copper_text_upright": false,
"courtyard_line_width": 0.05,
"dimension_precision": 4,
"dimension_units": 3,
"dimensions": {
"arrow_length": 1270000,
"extension_offset": 500000,
"keep_text_aligned": true,
"suppress_zeroes": true,
"text_position": 0,
"units_format": 0
},
"fab_line_width": 0.1,
"fab_text_italic": false,
"fab_text_size_h": 1.0,
"fab_text_size_v": 1.0,
"fab_text_thickness": 0.15,
"fab_text_upright": false,
"other_line_width": 0.1,
"other_text_italic": false,
"other_text_size_h": 1.0,
"other_text_size_v": 1.0,
"other_text_thickness": 0.15,
"other_text_upright": false,
"pads": {
"drill": 0.8,
"height": 1.27,
"width": 2.54
},
"silk_line_width": 0.1,
"silk_text_italic": false,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.1,
"silk_text_upright": false,
"zones": {
"min_clearance": 0.5
}
},
"diff_pair_dimensions": [
{
"gap": 0.0,
"via_gap": 0.0,
"width": 0.0
}
],
"drc_exclusions": [],
"meta": {
"version": 2
},
"rule_severities": {
"annular_width": "error",
"clearance": "error",
"connection_width": "warning",
"copper_edge_clearance": "error",
"copper_sliver": "warning",
"courtyards_overlap": "error",
"creepage": "error",
"diff_pair_gap_out_of_range": "error",
"diff_pair_uncoupled_length_too_long": "error",
"drill_out_of_range": "error",
"duplicate_footprints": "warning",
"extra_footprint": "warning",
"footprint": "error",
"footprint_filters_mismatch": "warning",
"footprint_symbol_mismatch": "warning",
"footprint_type_mismatch": "warning",
"hole_clearance": "error",
"hole_to_hole": "warning",
"holes_co_located": "warning",
"invalid_outline": "error",
"isolated_copper": "warning",
"item_on_disabled_layer": "error",
"items_not_allowed": "error",
"length_out_of_range": "error",
"lib_footprint_issues": "warning",
"lib_footprint_mismatch": "warning",
"malformed_courtyard": "error",
"microvia_drill_out_of_range": "error",
"mirrored_text_on_front_layer": "warning",
"missing_courtyard": "warning",
"missing_footprint": "warning",
"net_conflict": "warning",
"nonmirrored_text_on_back_layer": "warning",
"npth_inside_courtyard": "warning",
"padstack": "warning",
"pth_inside_courtyard": "warning",
"shorting_items": "error",
"silk_edge_clearance": "warning",
"silk_over_copper": "warning",
"silk_overlap": "warning",
"skew_out_of_range": "error",
"solder_mask_bridge": "error",
"starved_thermal": "warning",
"text_height": "warning",
"text_on_edge_cuts": "error",
"text_thickness": "warning",
"through_hole_pad_without_hole": "error",
"too_many_vias": "error",
"track_angle": "error",
"track_dangling": "warning",
"track_segment_length": "error",
"track_width": "error",
"tracks_crossing": "error",
"unconnected_items": "error",
"unresolved_variable": "error",
"via_dangling": "warning",
"zones_intersect": "error"
},
"rules": {
"max_error": 0.005,
"min_clearance": 0.0,
"min_connection": 0.0,
"min_copper_edge_clearance": 0.3,
"min_groove_width": 0.0,
"min_hole_clearance": 0.25,
"min_hole_to_hole": 0.25,
"min_microvia_diameter": 0.2,
"min_microvia_drill": 0.1,
"min_resolved_spokes": 2,
"min_silk_clearance": 0.0,
"min_text_height": 0.8,
"min_text_thickness": 0.08,
"min_through_hole_diameter": 0.3,
"min_track_width": 0.0,
"min_via_annular_width": 0.1,
"min_via_diameter": 0.5,
"solder_mask_to_copper_clearance": 0.005,
"use_height_for_length_calcs": true
},
"teardrop_options": [
{
"td_onpthpad": true,
"td_onroundshapesonly": false,
"td_onsmdpad": true,
"td_ontrackend": false,
"td_onvia": true
}
],
"teardrop_parameters": [
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_round_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_rect_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_track_end",
"td_width_to_size_filter_ratio": 0.9
}
],
"track_widths": [
0.0,
0.2,
0.5,
1.0
],
"tuning_pattern_settings": {
"diff_pair_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 1.0
},
"diff_pair_skew_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
},
"single_track_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
}
},
"via_dimensions": [
{
"diameter": 0.0,
"drill": 0.0
}
],
"zones_allow_external_fillets": false
},
"ipc2581": {
"dist": "",
"distpn": "",
"internal_id": "",
"mfg": "",
"mpn": ""
},
"layer_pairs": [],
"layer_presets": [],
"viewports": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"endpoint_off_grid": "warning",
"extra_units": "error",
"footprint_filter": "ignore",
"footprint_link_issues": "warning",
"four_way_junction": "ignore",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"label_multiple_wires": "warning",
"lib_symbol_issues": "warning",
"lib_symbol_mismatch": "warning",
"missing_bidi_pin": "warning",
"missing_input_pin": "warning",
"missing_power_pin": "error",
"missing_unit": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "ignore",
"same_local_global_label": "warning",
"similar_label_and_power": "warning",
"similar_labels": "warning",
"similar_power": "warning",
"simulation_model_issue": "ignore",
"single_global_label": "ignore",
"unannotated": "error",
"unconnected_wire_endpoint": "warning",
"undefined_netclass": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "sensor.kicad_pro",
"version": 3
},
"net_settings": {
"classes": [
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"priority": 2147483647,
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.2,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
}
],
"meta": {
"version": 4
},
"net_colors": null,
"netclass_assignments": null,
"netclass_patterns": []
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"plot": "",
"pos_files": "",
"specctra_dsn": "",
"step": "sensor.step",
"svg": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"bom_export_filename": "${PROJECTNAME}.csv",
"bom_fmt_presets": [],
"bom_fmt_settings": {
"field_delimiter": ",",
"keep_line_breaks": false,
"keep_tabs": false,
"name": "CSV",
"ref_delimiter": ",",
"ref_range_delimiter": "",
"string_delimiter": "\""
},
"bom_presets": [],
"bom_settings": {
"exclude_dnp": false,
"fields_ordered": [
{
"group_by": false,
"label": "Reference",
"name": "Reference",
"show": true
},
{
"group_by": false,
"label": "Qty",
"name": "${QUANTITY}",
"show": true
},
{
"group_by": true,
"label": "Value",
"name": "Value",
"show": true
},
{
"group_by": true,
"label": "DNP",
"name": "${DNP}",
"show": true
},
{
"group_by": true,
"label": "Exclude from BOM",
"name": "${EXCLUDE_FROM_BOM}",
"show": true
},
{
"group_by": true,
"label": "Exclude from Board",
"name": "${EXCLUDE_FROM_BOARD}",
"show": true
},
{
"group_by": true,
"label": "Footprint",
"name": "Footprint",
"show": true
},
{
"group_by": false,
"label": "Datasheet",
"name": "Datasheet",
"show": true
},
{
"group_by": false,
"label": "Actuator/Cap Color",
"name": "Actuator/Cap Color",
"show": false
},
{
"group_by": false,
"label": "Attrition Qty",
"name": "Attrition Qty",
"show": false
},
{
"group_by": false,
"label": "Capacitance",
"name": "Capacitance",
"show": false
},
{
"group_by": false,
"label": "Category",
"name": "Category",
"show": false
},
{
"group_by": false,
"label": "Circuit",
"name": "Circuit",
"show": false
},
{
"group_by": false,
"label": "Class",
"name": "Class",
"show": false
},
{
"group_by": false,
"label": "Contact Current",
"name": "Contact Current",
"show": false
},
{
"group_by": false,
"label": "Diode Configuration",
"name": "Diode Configuration",
"show": false
},
{
"group_by": false,
"label": "Forward Voltage (Vf@If)",
"name": "Forward Voltage (Vf@If)",
"show": false
},
{
"group_by": false,
"label": "Insulation Resistance",
"name": "Insulation Resistance",
"show": false
},
{
"group_by": false,
"label": "LCSC",
"name": "LCSC",
"show": false
},
{
"group_by": false,
"label": "Manufacturer",
"name": "Manufacturer",
"show": false
},
{
"group_by": false,
"label": "Mechanical Life",
"name": "Mechanical Life",
"show": false
},
{
"group_by": false,
"label": "Minimum Qty",
"name": "Minimum Qty",
"show": false
},
{
"group_by": false,
"label": "Mounting Style",
"name": "Mounting Style",
"show": false
},
{
"group_by": false,
"label": "Operating Force",
"name": "Operating Force",
"show": false
},
{
"group_by": false,
"label": "Operating Temperature",
"name": "Operating Temperature",
"show": false
},
{
"group_by": false,
"label": "Operating Temperature Range",
"name": "Operating Temperature Range",
"show": false
},
{
"group_by": false,
"label": "Overload Voltage (Max)",
"name": "Overload Voltage (Max)",
"show": false
},
{
"group_by": false,
"label": "Part",
"name": "Part",
"show": false
},
{
"group_by": false,
"label": "Pin Style",
"name": "Pin Style",
"show": false
},
{
"group_by": false,
"label": "Power(Watts)",
"name": "Power(Watts)",
"show": false
},
{
"group_by": false,
"label": "Price",
"name": "Price",
"show": false
},
{
"group_by": false,
"label": "Process",
"name": "Process",
"show": false
},
{
"group_by": false,
"label": "Rectified Current",
"name": "Rectified Current",
"show": false
},
{
"group_by": false,
"label": "Resistance",
"name": "Resistance",
"show": false
},
{
"group_by": false,
"label": "Reverse Leakage Current",
"name": "Reverse Leakage Current",
"show": false
},
{
"group_by": false,
"label": "Reverse Voltage (Vr)",
"name": "Reverse Voltage (Vr)",
"show": false
},
{
"group_by": false,
"label": "Sim.Pins",
"name": "Sim.Pins",
"show": false
},
{
"group_by": false,
"label": "Stock",
"name": "Stock",
"show": false
},
{
"group_by": false,
"label": "Strike Gundam",
"name": "Strike Gundam",
"show": false
},
{
"group_by": false,
"label": "Switch Height",
"name": "Switch Height",
"show": false
},
{
"group_by": false,
"label": "Switch Length",
"name": "Switch Length",
"show": false
},
{
"group_by": false,
"label": "Switch Width",
"name": "Switch Width",
"show": false
},
{
"group_by": false,
"label": "Temperature Coefficient",
"name": "Temperature Coefficient",
"show": false
},
{
"group_by": false,
"label": "Tolerance",
"name": "Tolerance",
"show": false
},
{
"group_by": false,
"label": "Type",
"name": "Type",
"show": false
},
{
"group_by": false,
"label": "Voltage Rated",
"name": "Voltage Rated",
"show": false
},
{
"group_by": false,
"label": "Voltage Rating (Dc)",
"name": "Voltage Rating (Dc)",
"show": false
},
{
"group_by": false,
"label": "With Lamp",
"name": "With Lamp",
"show": false
},
{
"group_by": false,
"label": "Actuator Style",
"name": "Actuator Style",
"show": false
},
{
"group_by": false,
"label": "Description",
"name": "Description",
"show": false
},
{
"group_by": false,
"label": "#",
"name": "${ITEM_NUMBER}",
"show": false
},
{
"group_by": false,
"label": "LCSC_PART_NUMBER",
"name": "LCSC_PART_NUMBER",
"show": false
},
{
"group_by": false,
"label": "Sim.Device",
"name": "Sim.Device",
"show": false
},
{
"group_by": false,
"label": "Sim.Type",
"name": "Sim.Type",
"show": false
}
],
"filter_string": "",
"group_symbols": true,
"include_excluded_from_bom": true,
"name": "",
"sort_asc": true,
"sort_field": "Reference"
},
"connection_grid_size": 50.0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"operating_point_overlay_i_precision": 3,
"operating_point_overlay_i_range": "~A",
"operating_point_overlay_v_precision": 3,
"operating_point_overlay_v_range": "~V",
"overbar_offset_ratio": 1.23,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"page_layout_descr_file": "",
"plot_directory": "",
"space_save_all_events": true,
"spice_current_sheet_as_root": false,
"spice_external_command": "spice \"%I\"",
"spice_model_current_sheet_as_root": true,
"spice_save_all_currents": false,
"spice_save_all_dissipations": false,
"spice_save_all_voltages": false,
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"a6275404-53d1-4c49-9128-131a51db8de5",
"Root"
]
],
"text_variables": {}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +0,0 @@
(kicad_pcb (version 20241229) (generator "pcbnew") (generator_version "9.0")
)

View File

@@ -1,98 +0,0 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": true,
"hidden_netclasses": [],
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"images": 0.6,
"pads": 1.0,
"shapes": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": false,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
"vias",
"footprint_text",
"footprint_anchors",
"ratsnest",
"grid",
"footprints_front",
"footprints_back",
"footprint_values",
"footprint_references",
"tracks",
"drc_errors",
"drawing_sheet",
"bitmaps",
"pads",
"zones",
"drc_warnings",
"drc_exclusions",
"locked_item_shadows",
"conflict_shadows",
"shapes"
],
"visible_layers": "ffffffff_ffffffff_ffffffff_ffffffff",
"zone_display_mode": 0
},
"git": {
"repo_type": "",
"repo_username": "",
"ssh_key": ""
},
"meta": {
"filename": "bms.kicad_prl",
"version": 5
},
"net_inspector_panel": {
"col_hidden": [],
"col_order": [],
"col_widths": [],
"custom_group_rules": [],
"expanded_rows": [],
"filter_by_net_name": true,
"filter_by_netclass": true,
"filter_text": "",
"group_by_constraint": false,
"group_by_netclass": false,
"show_unconnected_nets": false,
"show_zero_pad_nets": false,
"sort_ascending": true,
"sorting_column": -1
},
"open_jobsets": [],
"project": {
"files": []
},
"schematic": {
"selection_filter": {
"graphics": true,
"images": true,
"labels": true,
"lockedItems": false,
"otherItems": true,
"pins": true,
"symbols": true,
"text": true,
"wires": true
}
}
}

View File

@@ -1,418 +0,0 @@
{
"board": {
"3dviewports": [],
"design_settings": {
"defaults": {},
"diff_pair_dimensions": [],
"drc_exclusions": [],
"rules": {},
"track_widths": [],
"via_dimensions": []
},
"ipc2581": {
"dist": "",
"distpn": "",
"internal_id": "",
"mfg": "",
"mpn": ""
},
"layer_pairs": [],
"layer_presets": [],
"viewports": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"endpoint_off_grid": "warning",
"extra_units": "error",
"footprint_filter": "ignore",
"footprint_link_issues": "warning",
"four_way_junction": "ignore",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"label_multiple_wires": "warning",
"lib_symbol_issues": "warning",
"lib_symbol_mismatch": "warning",
"missing_bidi_pin": "warning",
"missing_input_pin": "warning",
"missing_power_pin": "error",
"missing_unit": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"same_local_global_label": "warning",
"similar_label_and_power": "warning",
"similar_labels": "warning",
"similar_power": "warning",
"simulation_model_issue": "ignore",
"single_global_label": "ignore",
"unannotated": "error",
"unconnected_wire_endpoint": "warning",
"undefined_netclass": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "bms.kicad_pro",
"version": 3
},
"net_settings": {
"classes": [
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"priority": 2147483647,
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.2,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
}
],
"meta": {
"version": 4
},
"net_colors": null,
"netclass_assignments": null,
"netclass_patterns": []
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"plot": "",
"pos_files": "",
"specctra_dsn": "",
"step": "",
"svg": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"bom_export_filename": "${PROJECTNAME}.csv",
"bom_fmt_presets": [],
"bom_fmt_settings": {
"field_delimiter": ",",
"keep_line_breaks": false,
"keep_tabs": false,
"name": "CSV",
"ref_delimiter": ",",
"ref_range_delimiter": "",
"string_delimiter": "\""
},
"bom_presets": [],
"bom_settings": {
"exclude_dnp": false,
"fields_ordered": [
{
"group_by": false,
"label": "Reference",
"name": "Reference",
"show": true
},
{
"group_by": false,
"label": "Qty",
"name": "${QUANTITY}",
"show": true
},
{
"group_by": true,
"label": "Value",
"name": "Value",
"show": true
},
{
"group_by": true,
"label": "DNP",
"name": "${DNP}",
"show": true
},
{
"group_by": true,
"label": "Exclude from BOM",
"name": "${EXCLUDE_FROM_BOM}",
"show": true
},
{
"group_by": true,
"label": "Exclude from Board",
"name": "${EXCLUDE_FROM_BOARD}",
"show": true
},
{
"group_by": true,
"label": "Footprint",
"name": "Footprint",
"show": true
},
{
"group_by": false,
"label": "Datasheet",
"name": "Datasheet",
"show": true
}
],
"filter_string": "",
"group_symbols": true,
"include_excluded_from_bom": true,
"name": "Default Editing",
"sort_asc": true,
"sort_field": "Reference"
},
"connection_grid_size": 50.0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"operating_point_overlay_i_precision": 3,
"operating_point_overlay_i_range": "~A",
"operating_point_overlay_v_precision": 3,
"operating_point_overlay_v_range": "~V",
"overbar_offset_ratio": 1.23,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"page_layout_descr_file": "",
"plot_directory": "",
"space_save_all_events": true,
"spice_current_sheet_as_root": false,
"spice_external_command": "spice \"%I\"",
"spice_model_current_sheet_as_root": true,
"spice_save_all_currents": false,
"spice_save_all_dissipations": false,
"spice_save_all_voltages": false,
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"7972d0e7-2611-420d-b298-ef8307db6186",
"Root"
]
],
"text_variables": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +0,0 @@
[build]
target = "riscv32imc-unknown-none-elf"
[target."riscv32imc-unknown-none-elf"]
rustflags = [
# "-C", "link-arg=-Tlink.x",
]
# runner = "riscv64-unknown-elf-gdb -q -x openocd.gdb"
# runner = "riscv-none-embed-gdb -q -x openocd.gdb"
# runner = "gdb -q -x openocd.gdb"
# runner = "wlink -v flash"
runner = "wchisp flash"
#runner = "wlink -v flash --enable-sdi-print --watch-serial --erase"
# runner = "wlink -v flash"

View File

@@ -1,32 +0,0 @@
;;; .doomrc --- doom runtime config -*- mode: emacs-lisp; lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'doom) ; be silent, byte-compiler
(after! dape
(add-to-list
'dape-configs
`(gdb-dap-openocd
ensure (lambda (config)
(dape-ensure-command config)
(let* ((default-directory
(or (dape-config-get config 'command-cwd)
default-directory))
(command (dape-config-get config 'command))
(output (shell-command-to-string (format "%s --version" command)))
(version (save-match-data
(when (string-match "GNU gdb \\(?:(.*) \\)?\\([0-9.]+\\)" output)
(string-to-number (match-string 1 output))))))
(unless (>= version 14.1)
(user-error "Requires gdb version >= 14.1"))))
modes ()
command-cwd dape-command-cwd
command "gdb"
command-args ("--interpreter=dap")
:request nil
:program nil
:args []
:stopAtBeginningOfMainSubprogram nil))
)
;;; .doomrc ends here

View File

@@ -1,7 +0,0 @@
target extended-remote :3333
set remotetimeout 2000
#symbol-file target/riscv32imc-unknown-none-elf/release/ch32v203-examples
file target/riscv32imc-unknown-none-elf/release/bms
monitor reset halt

View File

@@ -1,2 +0,0 @@
target
vendor

View File

@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ch32-sensor.iml" filepath="$PROJECT_DIR$/.idea/ch32-sensor.iml" />
</modules>
</component>
</project>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../website/themes/blowfish" vcs="Git" />
</component>
<component name="VcsProjectSettings">
<option name="detectVcsMappingsAutomatically" value="false" />
</component>
</project>

View File

@@ -1,905 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "ahash"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "autocfg"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "bincode"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740"
dependencies = [
"bincode_derive",
"unty",
]
[[package]]
name = "bincode_derive"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09"
dependencies = [
"virtue",
]
[[package]]
name = "bit_field"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
[[package]]
name = "bitfield"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac"
[[package]]
name = "bms"
version = "0.1.0"
dependencies = [
"canapi",
"ch32-hal",
"embassy-executor",
"embassy-futures",
"embassy-sync 0.6.2",
"embassy-time",
"embassy-usb",
"embedded-alloc",
"embedded-can",
"heapless",
"log",
"nb 1.1.0",
"panic-halt",
"qingke",
"qingke-rt",
"static_cell",
]
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "canapi"
version = "0.1.0"
dependencies = [
"bincode",
]
[[package]]
name = "cfg-if"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]]
name = "ch32-hal"
version = "0.1.0"
source = "git+https://github.com/empirephoenix/ch32-hal.git#8f0fc9a36a603cfc130295a79dbb336c504f659c"
dependencies = [
"ch32-metapac",
"critical-section",
"embassy-futures",
"embassy-hal-internal",
"embassy-sync 0.6.2",
"embassy-time",
"embassy-time-driver",
"embassy-time-queue-utils",
"embassy-usb-driver",
"embedded-can",
"embedded-hal 0.2.7",
"embedded-hal 1.0.0",
"embedded-hal-async",
"embedded-hal-nb",
"futures",
"nb 1.1.0",
"proc-macro2",
"qingke",
"qingke-rt",
"quote",
"rand_core",
"sdio-host",
]
[[package]]
name = "ch32-metapac"
version = "0.1.0"
source = "git+https://github.com/ch32-rs/ch32-metapac?rev=b1cbc7a98e43af3fd3170821654784e2c01cb26b#b1cbc7a98e43af3fd3170821654784e2c01cb26b"
dependencies = [
"riscv 0.11.1",
"vcell",
]
[[package]]
name = "critical-section"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
[[package]]
name = "darling"
version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 2.0.106",
]
[[package]]
name = "darling_macro"
version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
dependencies = [
"darling_core",
"quote",
"syn 2.0.106",
]
[[package]]
name = "document-features"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
dependencies = [
"litrs",
]
[[package]]
name = "embassy-executor"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6"
dependencies = [
"critical-section",
"document-features",
"embassy-executor-macros",
]
[[package]]
name = "embassy-executor-macros"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "embassy-futures"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01"
[[package]]
name = "embassy-hal-internal"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59"
dependencies = [
"num-traits",
]
[[package]]
name = "embassy-net-driver"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d"
[[package]]
name = "embassy-net-driver-channel"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7b2739fbcf6cd206ae08779c7d709087b16577d255f2ea4a45bc4bbbf305b3f"
dependencies = [
"embassy-futures",
"embassy-net-driver",
"embassy-sync 0.7.2",
]
[[package]]
name = "embassy-sync"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049"
dependencies = [
"cfg-if",
"critical-section",
"embedded-io-async",
"futures-sink",
"futures-util",
"heapless",
]
[[package]]
name = "embassy-sync"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b"
dependencies = [
"cfg-if",
"critical-section",
"embedded-io-async",
"futures-core",
"futures-sink",
"heapless",
]
[[package]]
name = "embassy-time"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8"
dependencies = [
"cfg-if",
"critical-section",
"document-features",
"embassy-time-driver",
"embedded-hal 0.2.7",
"embedded-hal 1.0.0",
"embedded-hal-async",
"futures-util",
]
[[package]]
name = "embassy-time-driver"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6"
dependencies = [
"document-features",
]
[[package]]
name = "embassy-time-queue-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83"
dependencies = [
"embassy-executor",
"heapless",
]
[[package]]
name = "embassy-usb"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d0b882133fa684b9d4652351cd7aac5afe8a2c2bf4a7da59f442ff61087cda2"
dependencies = [
"embassy-futures",
"embassy-net-driver-channel",
"embassy-sync 0.6.2",
"embassy-usb-driver",
"heapless",
"ssmarshal",
"usbd-hid",
]
[[package]]
name = "embassy-usb-driver"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "340c5ce591ef58c6449e43f51d2c53efe1bf0bb6a40cbf80afa0d259c7d52c76"
dependencies = [
"embedded-io-async",
]
[[package]]
name = "embedded-alloc"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f2de9133f68db0d4627ad69db767726c99ff8585272716708227008d3f1bddd"
dependencies = [
"critical-section",
"linked_list_allocator",
]
[[package]]
name = "embedded-can"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438"
dependencies = [
"nb 1.1.0",
]
[[package]]
name = "embedded-hal"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff"
dependencies = [
"nb 0.1.3",
"void",
]
[[package]]
name = "embedded-hal"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"
[[package]]
name = "embedded-hal-async"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884"
dependencies = [
"embedded-hal 1.0.0",
]
[[package]]
name = "embedded-hal-nb"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605"
dependencies = [
"embedded-hal 1.0.0",
"nb 1.1.0",
]
[[package]]
name = "embedded-io"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
[[package]]
name = "embedded-io-async"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"
dependencies = [
"embedded-io",
]
[[package]]
name = "encode_unicode"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "futures"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
[[package]]
name = "futures-io"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-macro"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "futures-sink"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
[[package]]
name = "futures-task"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
[[package]]
name = "futures-util"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-core",
"futures-macro",
"futures-sink",
"futures-task",
"pin-project-lite",
"pin-utils",
]
[[package]]
name = "hash32"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
dependencies = [
"byteorder",
]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash",
]
[[package]]
name = "heapless"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
dependencies = [
"hash32",
"portable-atomic",
"stable_deref_trait",
]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "linked_list_allocator"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286"
[[package]]
name = "litrs"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed"
[[package]]
name = "log"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
[[package]]
name = "nb"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
dependencies = [
"nb 1.1.0",
]
[[package]]
name = "nb"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "panic-halt"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a513e167849a384b7f9b746e517604398518590a9142f4846a32e3c2a4de7b11"
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pin-project-lite"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "portable-atomic"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
dependencies = [
"critical-section",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
"unicode-ident",
]
[[package]]
name = "qingke"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0230c5310b68c08a3cf8b59fbeec3e9d8e352bc6500f62cbaf9c677f42c8dfc"
dependencies = [
"bit_field",
"critical-section",
"riscv 0.12.1",
]
[[package]]
name = "qingke-rt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b955c60adac70c6d40205b1dbe9f57e1151d06aa842069cdbaef7bc07ad283fd"
dependencies = [
"qingke",
"qingke-rt-macros",
]
[[package]]
name = "qingke-rt-macros"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2ed46d18953ea5765ab26a07d1f092dffac2da1b4830c4397e02c3cec08501"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "quote"
version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "riscv"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9"
dependencies = [
"critical-section",
"embedded-hal 1.0.0",
]
[[package]]
name = "riscv"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7"
dependencies = [
"critical-section",
"embedded-hal 1.0.0",
"paste",
"riscv-macros",
"riscv-pac",
]
[[package]]
name = "riscv-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "riscv-pac"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436"
[[package]]
name = "sdio-host"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a"
[[package]]
name = "serde"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
]
[[package]]
name = "serde_core"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "ssmarshal"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850"
dependencies = [
"encode_unicode",
"serde",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "static_cell"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23"
dependencies = [
"portable-atomic",
]
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
[[package]]
name = "unty"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"
[[package]]
name = "usb-device"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
dependencies = [
"heapless",
"portable-atomic",
]
[[package]]
name = "usbd-hid"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c"
dependencies = [
"serde",
"ssmarshal",
"usb-device",
"usbd-hid-macros",
]
[[package]]
name = "usbd-hid-descriptors"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee54712c5d778d2fb2da43b1ce5a7b5060886ef7b09891baeb4bf36910a3ed"
dependencies = [
"bitfield",
]
[[package]]
name = "usbd-hid-macros"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb573c76e7884035ac5e1ab4a81234c187a82b6100140af0ab45757650ccda38"
dependencies = [
"byteorder",
"hashbrown",
"log",
"proc-macro2",
"quote",
"serde",
"syn 1.0.109",
"usbd-hid-descriptors",
]
[[package]]
name = "vcell"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "virtue"
version = "0.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "zerocopy"
version = "0.8.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]

View File

@@ -1,62 +0,0 @@
[package]
name = "bms"
version = "0.1.0"
edition = "2021"
[dependencies]
# Shared CAN API
canapi = { path = "../Shared/canapi" }
ch32-hal = { git = "https://github.com/empirephoenix/ch32-hal.git", features = [
"ch32v203c8t6",
"memory-x",
"embassy",
"rt",
"time-driver-tim2",
], default-features = false }
embassy-executor = { version = "0.7.0", features = [
# "arch-riscv32",
"arch-spin", # TODO: Required for USBD to connect properl
"executor-thread",
] }
#embassy-time = { version = "0.3.2" }
embassy-usb = { version = "0.3.0" }
embassy-futures = { version = "0.1.0" }
embassy-sync = { version = "0.6.0" }
embedded-can = "0.4.1"
nb = "1.1"
embedded-alloc = { version = "0.6.0", default-features = false, features = ["llff"] }
# This is okay because we should automatically use whatever ch32-hal uses
qingke-rt = "*"
qingke = "*"
panic-halt = "1.0"
heapless = { version = "0.8.0", features = ["portable-atomic-critical-section"] }
embassy-time = { version = "0.4.0" }
static_cell = "2.1.1"
log = "0.4.28"
[profile.dev]
#lto = true
opt-level = 1
[profile.release]
strip = true # symbols are not flashed to the microcontroller, so don't strip them.
lto = true
debug = false
opt-level = "z" # Optimize for size.
[[bin]]
name = "sensor"
path = "src/main.rs"
test = false
bench = false
doctest = false

View File

@@ -1,99 +0,0 @@
# ch32v203-bms
A simple battery management controller software.
## WeActStudio BluePill Plus CH32 Pin Labels
The BluePill Plus CH32 board from WeActStudio uses standard MCU port naming printed on the PCB silkscreen:
- PAx: GPIO Port A pins, labeled PA0 .. PA15
- PBx: GPIO Port B pins, labeled PB0 .. PB15
- PCx: GPIO Port C pins, commonly PC13 .. PC15 are broken out
- Other labels typically present: 3V3, 5V, G (GND), NRST (reset), BOOT (BOOT0), and SWD/RVSWD pads for programming/debug (SWCLK/SWDIO or similar).
For the exact header layout and picture of the silkscreen labels, please refer to the official WeActStudio documentation:
- https://github.com/WeActStudio/WeActStudio.BluePill-Plus-CH32
Pins used by this firmware (as referenced in `src/main.rs`):
- PA1: ADC analog input (combined Trigger/Threshold in the 555-timer example)
- PB0: Digital output (Q in the 555-timer example)
If you need to map a label to code, use the same letter+number as in the silkscreen. For example, `p.PA1` in code corresponds to pin labeled "PA1" on the PCB header, and `p.PB0` corresponds to "PB0".
## Building
``` sh
cargo build --release
```
- Wire the MCUs USB pins to a USB connector:
- D+ (PA12)
- D (PA11)
- GND and 5V (as appropriate for your board; ensure you have a data-capable cable)
After flashing and powering via USB, your OS should enumerate a virtual serial port (e.g., /dev/ttyACM0 on Linux, COMx on Windows, /dev/tty.usbmodem* on macOS). Open it with any terminal program (baud setting is ignored by CDC but 115200 is fine).
Example:
- Linux: `screen /dev/ttyACM0 115200`
- macOS: `screen /dev/tty.usbmodemXXXX 115200`
- Windows: Use PuTTY on the shown COM port.
You can flash the built ELF using wchisp (WCH ISP tool):
``` sh
wchisp flash target/riscv32imc-unknown-none-elf/release/bms
# or, if using a wrapper on your system/container, the command may be:
# wchip wchisp flash target/riscv32imc-unknown-none-elf/release/bms
```
## Unlock / Remove MCU Protection (fix "checksum error")
Some CH32 devices ship with flash protection enabled. When protected, tools may report a checksum error and refuse to program. You can clear the protection by performing a full chip erase with wchisp. This will erase all flash contents.
Steps:
- Ensure WCH-Link/WCH-LinkE is connected to the target and your OS has permissions to access it.
- Verify connection and current status:
``` sh
wchisp info
```
- Mass erase the chip (this also clears protection/lock bits):
``` sh
* start the device (while pressing boot)
wchisp erase
* powercycle the device (while pressing boot)
wchisp config reset
* powercycle the device again (while pressing boot), flash should not work
```
- Flash your firmware again:
``` sh
wchisp flash target/riscv32imc-unknown-none-elf/release/bms
```
Notes:
- The target used in this project is CH32V203C8T6; wchisp detects it automatically with WCH-Link.
- If your wchisp version differs, run `wchisp --help`, `wchisp erase --help`, or consult the tool's README for the exact flag name.
- If the tool still reports protection, look for commands named `unprotect` or `protect --off` in `wchisp --help`. The mass/chip erase is the typical way to clear protection.
## Debugging
For debugging purposes a container file is provided together with wrapper scripts to start the containerized `openocd` and `riscv-gdb` transparently. The wrapper scripts assume that `podman` is setup.
Starting Debug server
```
./bin/openocd
```
Connecting with gdb for interactive debugging
```
./bin/gdb -f target/riscv32imc-unknown-none-elf/release/bms
```

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CONTAINER_NAME="localhost/wch-dev-tools:latest"
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
pushd "$CONTAINER_TOOLS_BASEDIR"
podman build -t "$CONTAINER_NAME" -f "../wch-tools.Containerfile" .
popd

View File

@@ -1,29 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CONTAINER_IMAGE="localhost/wch-dev-tools:latest"
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
function _fatal {
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
exit 1
}
declare -a PODMAN_ARGS=(
"--rm" "-i" "--log-driver=none"
"--network=host"
"--pid=host"
"-v" "$PWD:$PWD:rw"
"-w" "$PWD"
)
[[ -t 1 ]] && PODMAN_ARGS+=("-t")
if ! podman image exists "$CONTAINER_IMAGE"; then
#attempt to build container
"$CONTAINER_TOOLS_BASEDIR/build-wch-tools-container.sh" 1>&2 ||
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
fi
podman run "${PODMAN_ARGS[@]}" --entrypoint riscv-none-elf-gdb-py3 "$CONTAINER_IMAGE" "$@"

View File

@@ -1,44 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CONTAINER_IMAGE="localhost/wch-dev-tools:latest"
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
function _fatal {
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
exit 1
}
declare -a PODMAN_ARGS=(
"--rm" "-i" "--log-driver=none"
"--network=host"
"-v" "$PWD:$PWD:rw"
"-w" "$PWD"
)
for device in /dev/bus/usb/*/*; do
if udevadm info "$device" | grep -q "ID_VENDOR=wch.cn" && \
udevadm info "$device" | grep -q "ID_MODEL=WCH-Link"; then
DEBUGGER_DEV_PATH="$device"
break
fi
done
if [[ -z "${DEBUGGER_DEV_PATH:-}" ]]; then
echo "Could not find hardware debugger … Exiting!" 1>&2
exit 1
else
# add jlink to podman device
PODMAN_ARGS+=("--device=$DEBUGGER_DEV_PATH")
fi
[[ -t 1 ]] && PODMAN_ARGS+=("-t")
if ! podman image exists "$CONTAINER_IMAGE"; then
#attempt to build container
"$CONTAINER_TOOLS_BASEDIR/build-wch-tools-container.sh" 1>&2 ||
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
fi
podman run "${PODMAN_ARGS[@]}" --entrypoint openocd "$CONTAINER_IMAGE" "$@"

View File

@@ -1,11 +0,0 @@
fn main() {
// println!("cargo:rustc-link-arg-bins=--nmagic");
println!("cargo:rustc-link-arg-bins=-Tlink.x");
// println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
let out_dir = std::env::var("OUT_DIR").unwrap();
let out_dir = std::path::PathBuf::from(out_dir);
std::fs::write(out_dir.join("memory.x"), include_bytes!("memory.x")).unwrap();
println!("cargo:rustc-link-search={}", out_dir.display());
println!("cargo:rerun-if-changed=memory.x");
}

View File

@@ -1,125 +0,0 @@
/* CH32V203c8t6 */
MEMORY
{
FLASH : ORIGIN = 0x00000000, LENGTH = 64K /* BANK_1 */
RAM : ORIGIN = 0x20000000, LENGTH = 20K
}
REGION_ALIAS("REGION_TEXT", FLASH);
REGION_ALIAS("REGION_RODATA", FLASH);
REGION_ALIAS("REGION_DATA", RAM);
REGION_ALIAS("REGION_BSS", RAM);
REGION_ALIAS("REGION_HEAP", RAM);
REGION_ALIAS("REGION_STACK", RAM);
/* fault handlers */
PROVIDE(InstructionMisaligned = ExceptionHandler);
PROVIDE(InstructionFault = ExceptionHandler);
PROVIDE(IllegalInstruction = ExceptionHandler);
PROVIDE(Breakpoint = ExceptionHandler);
PROVIDE(LoadMisaligned = ExceptionHandler);
PROVIDE(LoadFault = ExceptionHandler);
PROVIDE(StoreMisaligned = ExceptionHandler);
PROVIDE(StoreFault = ExceptionHandler);;
PROVIDE(UserEnvCall = ExceptionHandler);
PROVIDE(SupervisorEnvCall = ExceptionHandler);
PROVIDE(MachineEnvCall = ExceptionHandler);
PROVIDE(InstructionPageFault = ExceptionHandler);
PROVIDE(LoadPageFault = ExceptionHandler);
PROVIDE(StorePageFault = ExceptionHandler);
/* core interrupt handlers */
PROVIDE(NonMaskableInt = DefaultHandler);
PROVIDE(Software = DefaultHandler);
/* external interrupt handlers */
PROVIDE(WWDG = DefaultHandler);
PROVIDE(PVD = DefaultHandler);
PROVIDE(TAMPER = DefaultHandler);
PROVIDE(RTC = DefaultHandler);
PROVIDE(FLASH = DefaultHandler);
PROVIDE(RCC = DefaultHandler);
PROVIDE(EXTI0 = DefaultHandler);
PROVIDE(EXTI1 = DefaultHandler);
PROVIDE(EXTI2 = DefaultHandler);
PROVIDE(EXTI3 = DefaultHandler);
PROVIDE(EXTI4 = DefaultHandler);
PROVIDE(DMA1_CHANNEL1 = DefaultHandler);
PROVIDE(DMA1_CHANNEL2 = DefaultHandler);
PROVIDE(DMA1_CHANNEL3 = DefaultHandler);
PROVIDE(DMA1_CHANNEL4 = DefaultHandler);
PROVIDE(DMA1_CHANNEL5 = DefaultHandler);
PROVIDE(DMA1_CHANNEL6 = DefaultHandler);
PROVIDE(DMA1_CHANNEL7 = DefaultHandler);
PROVIDE(ADC = DefaultHandler);
PROVIDE(USB_HP_CAN1_TX = DefaultHandler);
/*PROVIDE(USB_LP_CAN1_RX0 = DefaultHandler);*/
PROVIDE(CAN1_RX1 = DefaultHandler);
PROVIDE(CAN1_SCE = DefaultHandler);
PROVIDE(EXTI9_5 = DefaultHandler);
PROVIDE(TIM1_BRK = DefaultHandler);
PROVIDE(TIM1_UP_ = DefaultHandler);
PROVIDE(TIM1_TRG_COM = DefaultHandler);
PROVIDE(TIM1_CC = DefaultHandler);
PROVIDE(TIM2 = DefaultHandler);
PROVIDE(TIM3 = DefaultHandler);
PROVIDE(TIM4 = DefaultHandler);
PROVIDE(I2C1_EV = DefaultHandler);
PROVIDE(I2C1_ER = DefaultHandler);
PROVIDE(I2C2_EV = DefaultHandler);
PROVIDE(I2C2_ER = DefaultHandler);
PROVIDE(SPI1 = DefaultHandler);
PROVIDE(SPI2 = DefaultHandler);
PROVIDE(USART1 = DefaultHandler);
PROVIDE(USART2 = DefaultHandler);
PROVIDE(USART3 = DefaultHandler);
PROVIDE(EXTI15_10 = DefaultHandler);
PROVIDE(RTCALARM = DefaultHandler);
PROVIDE(USBWAKE_UP = DefaultHandler);
PROVIDE(TIM8_BRK = DefaultHandler);
PROVIDE(TIM8_UP_ = DefaultHandler);
PROVIDE(TIM8_TRG_COM = DefaultHandler);
PROVIDE(TIM8_CC = DefaultHandler);
PROVIDE(RNG = DefaultHandler);
PROVIDE(FSMC = DefaultHandler);
PROVIDE(SDIO = DefaultHandler);
PROVIDE(TIM5 = DefaultHandler);
PROVIDE(SPI3 = DefaultHandler);
PROVIDE(UART4 = DefaultHandler);
PROVIDE(UART5 = DefaultHandler);
PROVIDE(TIM6 = DefaultHandler);
PROVIDE(TIM7 = DefaultHandler);
PROVIDE(DMA2_CHANNEL1 = DefaultHandler);
PROVIDE(DMA2_CHANNEL2 = DefaultHandler);
PROVIDE(DMA2_CHANNEL3 = DefaultHandler);
PROVIDE(DMA2_CHANNEL4 = DefaultHandler);
PROVIDE(DMA2_CHANNEL5 = DefaultHandler);
PROVIDE(ETH = DefaultHandler);
PROVIDE(ETH_WKUP = DefaultHandler);
PROVIDE(CAN2_TX = DefaultHandler);
PROVIDE(CAN2_RX0 = DefaultHandler);
PROVIDE(CAN2_RX1 = DefaultHandler);
PROVIDE(CAN2_SCE = DefaultHandler);
PROVIDE(OTG_FS = DefaultHandler);
PROVIDE(USBHSWAKEUP = DefaultHandler);
PROVIDE(USBHS = DefaultHandler);
PROVIDE(DVP = DefaultHandler);
PROVIDE(UART6 = DefaultHandler);
PROVIDE(UART7 = DefaultHandler);
PROVIDE(UART8 = DefaultHandler);
PROVIDE(TIM9_BRK = DefaultHandler);
PROVIDE(TIM9_UP_ = DefaultHandler);
PROVIDE(TIM9_TRG_COM = DefaultHandler);
PROVIDE(TIM9_CC = DefaultHandler);
PROVIDE(TIM10_BRK = DefaultHandler);
PROVIDE(TIM10_UP_ = DefaultHandler);
PROVIDE(TIM10_TRG_COM = DefaultHandler);
PROVIDE(TIM10_CC = DefaultHandler);
PROVIDE(DMA2_CHANNEL6 = DefaultHandler);
PROVIDE(DMA2_CHANNEL7 = DefaultHandler);
PROVIDE(DMA2_CHANNEL8 = DefaultHandler);
PROVIDE(DMA2_CHANNEL9 = DefaultHandler);
PROVIDE(DMA2_CHANNEL10 = DefaultHandler);
PROVIDE(DMA2_CHANNEL11 = DefaultHandler);

View File

@@ -1,17 +0,0 @@
set _CHIPNAME ch32v203
set _TARGETNAME $_CHIPNAME.cpu
#bindto 0.0.0.0
adapter driver wlinke
adapter speed 6000
transport select sdi
sdi newtap $_CHIPNAME cpu -irlen 5 --expected-id 0x00001
target create $_TARGETNAME.0 wch_riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME wch_rsicv 0x00000000 0 0 0 $_TARGETNAME.0
init

View File

@@ -1,2 +0,0 @@
[toolchain]
channel = "nightly"

View File

@@ -1,565 +0,0 @@
#![no_std]
#![no_main]
extern crate alloc;
use crate::hal::peripherals::CAN1;
use canapi::id::{plant_id, IDENTIFY_CMD_OFFSET, MOISTURE_DATA_OFFSET};
use canapi::SensorSlot;
use ch32_hal::adc::{Adc, SampleTime, ADC_MAX};
use ch32_hal::{pac};
use ch32_hal::can::{Can, CanFifo, CanFilter, CanFrame, CanMode};
use ch32_hal::gpio::{Flex, Level, Output, Pull, Speed};
use ch32_hal::mode::NonBlocking;
use ch32_hal::peripherals::USBD;
use core::fmt::Write as _;
use core::sync::atomic::{AtomicBool, Ordering};
use embassy_executor::{task, Spawner};
use embassy_futures::yield_now;
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_sync::channel::Channel;
use embassy_time::{Duration, Instant, Timer};
use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
use embassy_usb::{Builder, UsbDevice};
use embedded_alloc::LlffHeap as Heap;
use embedded_can::nb::Can as nb_can;
use embedded_can::{Id, StandardId};
use hal::bind_interrupts;
use hal::usbd::Driver;
use {ch32_hal as hal, panic_halt as _};
macro_rules! mk_static {
($t:ty,$val:expr) => {{
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
#[deny(unused_attributes)]
let x = STATIC_CELL.uninit().write(($val));
x
}};
}
bind_interrupts!(struct Irqs {
USB_LP_CAN1_RX0 => hal::usbd::InterruptHandler<hal::peripherals::USBD>;
});
#[global_allocator]
static HEAP: Heap = Heap::empty();
static LOG_CH: Channel<CriticalSectionRawMutex, heapless::String<128>, 8> = Channel::new();
static CAN_TX_CH: Channel<CriticalSectionRawMutex, CanFrame, 4> = Channel::new();
static BEACON: AtomicBool = AtomicBool::new(false);
#[embassy_executor::main(entry = "qingke_rt::entry")]
async fn main(spawner: Spawner) {
ch32_hal::pac::AFIO.pcfr1().write(|w| w.set_can1_rm(2));
unsafe {
#[allow(static_mut_refs)]
static mut HEAP_SPACE: [u8; 4096] = [0; 4096]; // 4 KiB heap
#[allow(static_mut_refs)]
HEAP.init(HEAP_SPACE.as_ptr() as usize, HEAP_SPACE.len());
}
let p = hal::init(hal::Config {
rcc: hal::rcc::Config::SYSCLK_FREQ_144MHZ_HSI,
..Default::default()
});
// Build driver and USB stack using 'static buffers
let driver = Driver::new(p.USBD, Irqs, p.PA12, p.PA11);
let mut probe_gnd = Flex::new(p.PA2);
probe_gnd.set_as_input(Pull::None);
// Create GPIO for 555 Q output (PB0)
let q_out = Output::new(p.PA0, Level::Low, Speed::Low);
let info = mk_static!(Output, Output::new(p.PA10, Level::Low, Speed::Low));
let warn = mk_static!(Output, Output::new(p.PA9, Level::Low, Speed::Low));
// Read configuration switches on PB3..PB7 at startup with floating detection
// PB3: Sensor A/B selector (Low=A, High=B)
// PB4..PB7: address bits (1,2,4,8)
let mut sensor_ab_pin = Flex::new(p.PA3);
let mut sensor_address_bit_1_pin = Flex::new(p.PA4);
let mut sensor_address_bit_2_pin = Flex::new(p.PA5);
let mut sensor_address_bit_3_pin = Flex::new(p.PA6);
let mut sensor_address_bit_4_pin = Flex::new(p.PA7);
// Validate all config pins; if any is floating, stay in an error loop until fixed
// Try read PB3..PB7
let sensor_ab_config = detect_stable_pin(&mut sensor_ab_pin).await;
let sensor_address_bit_1_config = detect_stable_pin(&mut sensor_address_bit_1_pin).await;
let sensor_address_bit_2_config = detect_stable_pin(&mut sensor_address_bit_2_pin).await;
let sensor_address_bit_3_config = detect_stable_pin(&mut sensor_address_bit_3_pin).await;
let sensor_address_bit_4_config = detect_stable_pin(&mut sensor_address_bit_4_pin).await;
let slot = if sensor_ab_config.unwrap_or(false) {
SensorSlot::B
} else {
SensorSlot::A
};
let mut addr: u8 = 0;
if sensor_address_bit_1_config.unwrap_or(false) {
addr |= 1;
}
if sensor_address_bit_2_config.unwrap_or(false) {
addr |= 2;
}
if sensor_address_bit_3_config.unwrap_or(false) {
addr |= 4;
}
if sensor_address_bit_4_config.unwrap_or(false) {
addr |= 8;
}
let moisture_id = plant_id(MOISTURE_DATA_OFFSET, slot, addr as u16);
let identify_id = plant_id(IDENTIFY_CMD_OFFSET, slot, addr as u16);
let standard_identify_id = StandardId::new(identify_id).unwrap();
//is any floating, or invalid addr (only 1-8 are valid)
let invalid_config = sensor_ab_config.is_none()
|| sensor_address_bit_1_config.is_none()
|| sensor_address_bit_2_config.is_none()
|| sensor_address_bit_3_config.is_none()
|| sensor_address_bit_4_config.is_none()
|| addr == 0
|| addr > 8;
let mut config = embassy_usb::Config::new(0xC0DE, 0xCAFE);
config.manufacturer = Some("Can Sensor v0.2");
let msg = mk_static!(heapless::String<128>, heapless::String::new());
if invalid_config {
let _ = core::fmt::Write::write_fmt(
msg,
format_args!(
"CFG err: {:?} {:?} {:?} {:?} {:?}",
to_info(sensor_ab_config), to_info(sensor_address_bit_1_config), to_info(sensor_address_bit_2_config), to_info(sensor_address_bit_3_config), to_info(sensor_address_bit_4_config)
),
);
} else {
let _ = core::fmt::Write::write_fmt(msg, format_args!("Sensor {:?} plant {}", slot, addr));
}
config.product = Some(msg.as_str());
config.serial_number = Some("12345678");
config.max_power = 100;
config.max_packet_size_0 = 64;
// Windows compatibility requires these; CDC-ACM
config.device_class = 0x02;
config.device_sub_class = 0x02;
config.device_protocol = 0x00;
config.composite_with_iads = false;
let mut builder = Builder::new(
driver,
config,
mk_static!([u8; 256], [0; 256]),
mk_static!([u8; 256], [0; 256]),
&mut [], // no msos descriptors
mk_static!([u8; 64], [0; 64]),
);
// Initialize CDC state and create CDC-ACM class
let class = mk_static!(
CdcAcmClass<'static, Driver<'static, hal::peripherals::USBD>>,
CdcAcmClass::new(&mut builder, mk_static!(State, State::new()), 64)
);
// Build USB device
let usb = mk_static!(UsbDevice<Driver<USBD>>, builder.build());
spawner.spawn(usb_task(usb)).unwrap();
spawner.spawn(usb_writer(class)).unwrap();
if invalid_config {
// At least one floating: report and blink code for the first one found.
let mut msg: heapless::String<128> = heapless::String::new();
let code = if sensor_address_bit_1_config.is_none() {
1
} else if sensor_address_bit_2_config.is_none() {
2
} else if sensor_address_bit_3_config.is_none() {
3
} else if sensor_address_bit_4_config.is_none() {
4
} else if sensor_ab_config.is_none() {
5
} else {
6 // Invalid address (0 or > 8)
};
let which = match code {
1 => "PB4 (bit 1)",
2 => "PB5 (bit 2)",
3 => "PB6 (bit 3)",
4 => "PB7 (bit 4)",
5 => "PB3 (A/B)",
_ => "Address (0 or > 8)",
};
if code == 6 {
let _ = core::fmt::Write::write_fmt(
&mut msg,
format_args!(
"Invalid address {} (only 1-8 allowed) -> blinking code {}. Fix jumpers.\r\n",
addr, code
),
);
} else {
let _ = core::fmt::Write::write_fmt(
&mut msg,
format_args!(
"Config pin floating detected on {} -> blinking code {}. Fix jumpers.\r\n",
which, code
),
);
}
log(msg);
spawner.spawn(blink_error_task(warn, info, 2, code)).unwrap();
} else {
// Log startup configuration and derived CAN IDs
{
let mut msg: heapless::String<128> = heapless::String::new();
let slot_chr = match slot {
SensorSlot::A => 'a',
SensorSlot::B => 'b',
};
let _ = core::fmt::Write::write_fmt(
&mut msg,
format_args!(
"Startup: slot={} addr={} moisture_id=0x{:03X} identity_id=0x{:03X}\r\n",
slot_chr, addr, moisture_id, identify_id
),
);
log(msg);
}
// Create ADC on ADC1 and use PA1 as analog input (Threshold/Trigger)
let adc = Adc::new(p.ADC1, Default::default());
let ain = p.PA1;
let config = Default::default();
let can: Can<CAN1, NonBlocking> = Can::new_nb(
p.CAN1,
p.PB8,
p.PB9,
CanFifo::Fifo0,
CanMode::Normal,
20_000,
config,
)
.expect("Valid");
ch32_hal::pac::AFIO.pcfr1().write(|w| w.set_can1_rm(2));
can.add_filter(CanFilter::accept_all());
// Improve CAN robustness for longer cables:
// 1. Enable Automatic Bus-Off Management (ABOM)
// 2. Disable Automatic Retransmission (NART) as we send regular measurements anyway
// 3. Enable Receive FIFO Overwrite Mode (RFLM = 0, default)
// 4. Increase Resync Jump Width (SJW) if possible by patching BTIMR
hal::pac::CAN1.ctlr().modify(|w| {
w.set_abom(false);
w.set_nart(true);
});
// SJW is bits 24-25 of BTIMR. HAL sets it to 0 (SJW=1).
// Let's try to set it to 3 (SJW=4) for better jitter tolerance.
hal::pac::CAN1.btimr().modify(|w| {
w.set_sjw(3); // 3 means 4TQ
});
// let mut filter = CanFilter::new_id_list();
// filter.get(0).unwrap().set(Id::Standard(standard_identify_id), Default::default());
// can.add_filter(filter);
let standard_moisture_id = StandardId::new(moisture_id).unwrap();
spawner
.spawn(can_task(can,info, warn, standard_identify_id, standard_moisture_id))
.unwrap();
// move Q output, LED, ADC and analog input into worker task
spawner
.spawn(worker(
probe_gnd,
q_out,
adc,
ain,
standard_moisture_id,
standard_identify_id,
))
.unwrap();
}
// Prevent main from exiting
core::future::pending::<()>().await;
}
fn to_info(res: Option<bool>) -> i8 {
match res {
Some(true) => 1,
Some(false) => -1,
None => 0,
}
}
// Helper closure: detect stable pin by comparing readings under Pull::Down and Pull::Up
async fn detect_stable_pin(pin: &mut Flex<'static>) -> Option<bool> {
pin.set_as_input(Pull::Down);
Timer::after_millis(2).await;
let low_read = pin.is_high();
pin.set_as_input(Pull::Up);
Timer::after_millis(2).await;
let high_read = pin.is_high();
if low_read == high_read {
Some(high_read)
} else {
None
}
}
async fn blink_error_loop(info_led: &mut Output<'static>, warn_led: &mut Output<'static>, c_i: u8, c_w: u8) -> ! {
for _loop_count in 0..5 {
// code: 1-4 for PB4..PB7, 5 for PB3 (A/B), 7 for CAN address collision
for _ in 0..c_i {
info_led.set_high();
Timer::after_millis(200).await;
info_led.set_low();
Timer::after_millis(200).await;
}
for _ in 0..c_w {
warn_led.set_high();
Timer::after_millis(200).await;
warn_led.set_low();
Timer::after_millis(200).await;
}
// Pause between sequences
Timer::after_millis(400).await;
}
for _ in 0..5 {
info_led.set_high();
Timer::after_millis(50).await;
info_led.set_low();
Timer::after_millis(50).await;
warn_led.set_high();
Timer::after_millis(50).await;
warn_led.set_low();
Timer::after_millis(50).await;
}
pac::PFIC.cfgr().modify(|w| {
w.set_resetsys(true);
w.set_keycode(pac::pfic::vals::Keycode::KEY3); // KEY3 is 0xBEEF, the System Reset key
});
loop{
}
}
#[task]
async fn blink_error_task(info_led: &'static mut Output<'static>, warn_led: &'static mut Output<'static>, c_i: u8, c_w: u8) -> ! {
blink_error_loop(info_led, warn_led, c_i, c_w).await
}
#[task]
async fn can_task(
mut can: Can<'static, CAN1, NonBlocking>,
info: &'static mut Output<'static>,
warn: &'static mut Output<'static>,
identify_id: StandardId,
moisture_id: StandardId,
) {
// Non-blocking beacon blink timing.
// We keep this inside the CAN task so it can't stall other tasks (like `worker`) with `await`s.
let mut next_beacon_toggle = Instant::now();
let beacon_period = Duration::from_millis(50);
loop {
match can.receive() {
Ok(frame) => {
match frame.id() {
Id::Standard(s_frame) => {
let mut msg: heapless::String<128> = heapless::String::new();
let _ = write!(
&mut msg,
"Received from canbus: {:?} ident is {:?} \r\n",
s_frame.as_raw(),
identify_id.as_raw()
);
log(msg);
if s_frame.as_raw() == moisture_id.as_raw() {
//trigger collision detection on other side as well
let _ = can.transmit(&frame);
// We should never receive moisture packets addressed to ourselves.
// If we do, another node likely uses the same jumper configuration.
blink_error_loop(info, warn, 1,2).await;
}
if s_frame.as_raw() == identify_id.as_raw() {
BEACON.store(true, Ordering::Relaxed);
}
}
Id::Extended(_) => {}
}
}
Err(nb::Error::WouldBlock) => {
// No frame available
}
Err(nb::Error::Other(err)) => {
for _ in 0..3 {
warn.set_high();
Timer::after_millis(100).await;
warn.set_low();
Timer::after_millis(100).await;
}
let mut msg: heapless::String<128> = heapless::String::new();
let _ = write!(&mut msg, "rx err {:?}", err);
log(msg);
}
}
if BEACON.load(Ordering::Relaxed) {
let now = Instant::now();
if now >= next_beacon_toggle {
info.toggle();
// Move the schedule forward; if we fell behind, resync to "now".
next_beacon_toggle = now + beacon_period;
}
}
while let Ok(mut frame) = CAN_TX_CH.try_receive() {
match can.transmit(&mut frame) {
Ok(..) => {
}
Err(nb::Error::WouldBlock) => {
for _ in 0..2 {
warn.set_high();
Timer::after_millis(100).await;
warn.set_low();
Timer::after_millis(100).await;
}
let mut msg: heapless::String<128> = heapless::String::new();
let _ = write!(&mut msg, "canbus out buffer full");
log(msg);
}
Err(nb::Error::Other(err)) => {
for _ in 0..3 {
warn.set_high();
Timer::after_millis(100).await;
warn.set_low();
Timer::after_millis(100).await;
}
let mut msg: heapless::String<128> = heapless::String::new();
let _ = write!(&mut msg, "tx err {:?}", err);
log(msg);
}
}
}
yield_now().await;
}
}
#[task]
async fn worker(
mut probe_gnd: Flex<'static>,
mut q: Output<'static>,
mut adc: Adc<'static, hal::peripherals::ADC1>,
mut ain: hal::peripherals::PA1,
moisture_id: StandardId,
identify_id: StandardId,
) {
// 555 emulation state: Q initially Low
let mut q_high = false;
let low_th: u16 = (ADC_MAX as u16) / 3; // ~1/3 Vref
let high_th: u16 = ((ADC_MAX as u32 * 2) / 3) as u16; // ~2/3 Vref
loop {
// Count rising edges of Q in a 100 ms window
let start = Instant::now();
let mut pulses: u32 = 0;
let mut last_q = q_high;
probe_gnd.set_as_output(Speed::Low);
probe_gnd.set_low();
let probe_duration = Duration::from_millis(100);
while Instant::now()
.checked_duration_since(start)
.unwrap_or(Duration::from_millis(0))
< probe_duration
{
// Sample the analog input (Threshold/Trigger on A1)
let val: u16 = adc.convert(&mut ain, SampleTime::CYCLES28_5);
// 555 core behavior:
// - If input <= 1/3 Vref => set Q high (trigger)
// - If input >= 2/3 Vref => set Q low (threshold)
// - Otherwise keep previous Q state (hysteresis)
if val <= low_th {
q_high = true;
} else if val >= high_th {
q_high = false;
}
// Drive output pin accordingly
if q_high {
q.set_high();
} else {
q.set_low();
}
// Count rising edges
if !last_q && q_high {
pulses = pulses.saturating_add(1);
}
last_q = q_high;
// Yield to allow USB and other tasks to run
yield_now().await;
}
probe_gnd.set_as_input(Pull::None);
let freq_hz: u32 = pulses * (1000 / probe_duration.as_millis()) as u32; // pulses per 0.1s => Hz
let mut msg: heapless::String<128> = heapless::String::new();
let _ = write!(
&mut msg,
"555 window={}ms pulses={} freq={} Hz (A1->Q on PB0) id={:?}\r\n",
probe_duration.as_millis(),
pulses,
freq_hz,
identify_id.as_raw()
);
log(msg);
let moisture = CanFrame::new(moisture_id, &(freq_hz as u32).to_be_bytes()).unwrap();
CAN_TX_CH.send(moisture).await;
}
}
fn log(message: heapless::String<128>) {
match LOG_CH.try_send(message) {
Ok(_) => {}
Err(_) => {}
}
}
#[task]
async fn usb_task(usb: &'static mut UsbDevice<'static, Driver<'static, hal::peripherals::USBD>>) {
usb.run().await;
}
#[task]
async fn usb_writer(
class: &'static mut CdcAcmClass<'static, Driver<'static, hal::peripherals::USBD>>,
) {
loop {
class.wait_connection().await;
printer(class).await;
}
}
async fn printer(class: &mut CdcAcmClass<'static, Driver<'static, USBD>>) {
loop {
let msg = LOG_CH.receive().await;
match class.write_packet(msg.as_bytes()).await {
Ok(_) => {}
Err(_) => {
// Disconnected or endpoint disabled
return;
}
}
}
}

View File

@@ -1,27 +0,0 @@
FROM debian:bookworm
RUN apt update -y && apt upgrade -y && apt install git libjaylink-dev libusb-1.0-0 unzip curl libhidapi-hidraw0 xz-utils -y
RUN cd /root && \
curl -L -o mrs-toolchain.tar.xz "https://github.com/ch32-riscv-ug/MounRiver_Studio_Community_miror/releases/download/1.92-toolchain/MRS_Toolchain_Linux_x64_V1.92.tar.xz" && \
mkdir mrs-toolchain && \
tar -xvf mrs-toolchain.tar.xz -C mrs-toolchain --strip-components=1 && \
mv mrs-toolchain/OpenOCD/bin/openocd /usr/local/bin && \
mv mrs-toolchain/OpenOCD/share/openocd /usr/local/share && \
# mv mrs-toolchain/RISC-V_Embedded_GCC12/bin/riscv-none-elf-gdb /usr/local/bin && \ # both toolchains in MRS are to old to work with emacs dape
# mv mrs-toolchain/RISC-V_Embedded_GCC12/libexec /usr/local && \ # both toolchains in MRS are to old to work with emacs dape
rm -rf mrs-toolchain mrs-toolchain.tar.xz && \
# Use up to date xpack toolchains for gdb
curl -L -o xpack-riscv-toolchain.tar.gz "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/xpack-riscv-none-elf-gcc-14.2.0-3-linux-x64.tar.gz" && \
mkdir xpack-toolchain && \
tar -xvf xpack-riscv-toolchain.tar.gz -C xpack-toolchain --strip-components=1 && \
mv xpack-toolchain/bin/* /usr/local/bin && \
mv xpack-toolchain/lib/ /usr/local && \
mv xpack-toolchain/lib64/ /usr/local && \
mv xpack-toolchain/libexec /usr/local && \
mv xpack-toolchain/riscv-none-elf /usr/local && \
rm -rf xpack-toolchain xpack-riscv-toolchain.tar.gz
RUN mkdir -p /root/.config/gdb && echo "set auto-load safe-path /" >> /root/.config/gdb/gdbinit
ENTRYPOINT [ "/usr/bin/bash" ]

View File

@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/rust/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/rust/tests" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/rust/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/MainBoard.iml" filepath="$PROJECT_DIR$/.idea/MainBoard.iml" />
</modules>
</component>
</project>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/../../website/themes/blowfish" vcs="Git" />
</component>
</project>

View File

@@ -1,10 +0,0 @@
# ESP-IDF build artifacts
build/
.sdkconfig*
CMakeFiles/
CMakeCache.txt
cmake-build-*/
*.log
*.bin
*.elf
*.map

View File

@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Some files were not shown because too many files have changed in this diff Show More