mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-11 16:32:52 +00:00
Compare commits
166 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eab535db98 | |||
| f3d0d99ce4 | |||
| 76f5da0125 | |||
| 7871e92dbe | |||
| fb17b7e75b | |||
| ae539e27f6 | |||
| a99fe56aae | |||
| 909915730b | |||
| 5bbbb6c011 | |||
| 8950bd6917 | |||
| 56936aed10 | |||
| 5208e083f3 | |||
| 200a225add | |||
| 568c2af9e6 | |||
| 681450f4ad | |||
| 82884c1305 | |||
| b194a6df2c | |||
| 2ed6066609 | |||
| cd11501074 | |||
| 52b4b625fb | |||
| 1ac9a14811 | |||
| e50bde197d | |||
| 1d953adaf2 | |||
| f6a0d2d9dc | |||
| 642c5ca59e | |||
| 103b595abb | |||
| 0664c1e7bd | |||
| 9fd8c5636e | |||
| 7ceed80128 | |||
| b538e07577 | |||
| e92d61adca | |||
| a6bcecc34f | |||
| 554fca0582 | |||
| 25e425a601 | |||
| 1c0124edcc | |||
| a0c6601cda | |||
| 82cbb126a9 | |||
| ce8e1dde92 | |||
| ee620d4e77 | |||
| 04c492271c | |||
| 30ad2dc67f | |||
| 6e4812e6b8 | |||
| 1fdd296784 | |||
| 1e416a3457 | |||
| 2400fac7df | |||
| 950e1e8094 | |||
| e878a61313 | |||
| 66bbf8639e | |||
| d98cc8acad | |||
| 67ba8e774c | |||
| 1877bb0658 | |||
| 02b370dd06 | |||
| 77ff4652fd | |||
| 12ddd3d3c0 | |||
| c895034bb2 | |||
| 0b0c9335f9 | |||
| fb130559e2 | |||
| d4e05a6da9 | |||
| 8141bd3f15 | |||
| d717855a63 | |||
| 024acdc779 | |||
| 2a195972a8 | |||
| c8a3797b82 | |||
| d6340d41a3 | |||
| 796c868255 | |||
| 355b01964f | |||
| 59b8bd0a54 | |||
| 0464261b6e | |||
| 8350f1d426 | |||
| aefd539715 | |||
| c4648694fe | |||
| 981bbb68e3 | |||
| 6f61cf11b3 | |||
| dd3406c056 | |||
| 95925b563a | |||
| 26b0d6c55f | |||
| d054806567 | |||
| c95ac93ca7 | |||
| fee74e05c8 | |||
| e8082fa249 | |||
| 0830cf06dc | |||
| 60d39c1c2f | |||
| 09782495ab | |||
| c366454c8f | |||
| da17c724d6 | |||
| c591e87c98 | |||
| 6a9b8affa2 | |||
| 3d0f92c824 | |||
| 819058c8a0 | |||
| 051d8dbe99 | |||
| c2440d5118 | |||
| 83a614ed3b | |||
| 6e108d07a7 | |||
| e8630557d7 | |||
| c0bb9c4018 | |||
| 9fbaa7a55f | |||
| 79516796d5 | |||
| 4d4b08f67d | |||
| 57d0513d04 | |||
| d09aa684f8 | |||
| 83271ef0d2 | |||
| 87f0ddc2d4 | |||
| f68fa5ab60 | |||
| 877e88fcd0 | |||
| 194c3928f9 | |||
| 99ca75ce45 | |||
| 1fa9d63ac5 | |||
| aefc698fca | |||
| e5797b598a | |||
| b510eaaef8 | |||
| 28ddf2139b | |||
| 9baa57d6d9 | |||
| 263b7c1753 | |||
| cc65542842 | |||
| 423fafb709 | |||
| 042521a744 | |||
| 551cdaa23c | |||
| 62f755c265 | |||
| 1e715d1daa | |||
| a0071ea862 | |||
| 746551351f | |||
| 8caee73765 | |||
| 6b45648314 | |||
| ceea8b79a0 | |||
| 4de22e01f3 | |||
| bdb1a8af0d | |||
| 18c5a28410 | |||
| c904bc2c89 | |||
| 9b2c71fa6e | |||
| a37140a779 | |||
| 67cec49a60 | |||
| 28db9fb6b5 | |||
| 9d044cd1f7 | |||
| 3d67e0a2ca | |||
| 6adffe1619 | |||
| 628ec2de5f | |||
| d465bb38c7 | |||
| 2d29a9a59d | |||
| cbb1c1a30d | |||
| 6e8d9eb35f | |||
| 9354fa3ce6 | |||
| 3448224939 | |||
| 448df3c5aa | |||
| b0d0703234 | |||
| fe180c008e | |||
| 977041bd67 | |||
| b9382b26d7 | |||
| 8506e3bfb8 | |||
| 1c1b9e961d | |||
| e857bbb09f | |||
| fadd2c4259 | |||
| 18ae9a48cc | |||
| 5b97eff725 | |||
| 326d4ced99 | |||
| f80f2f1376 | |||
| 218b4320dd | |||
| c656281275 | |||
| dbe8b8b877 | |||
| c4831b1b48 | |||
| b0b3d9f34e | |||
| dea335af7f | |||
| c906725a0c | |||
| 6d62fc4095 | |||
| 67608e789f | |||
| 9c0fcb0bcb | |||
| 84f426f39f |
@@ -6,4 +6,5 @@ AllowShortBlocksOnASingleLine: Empty
|
|||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
IndentPPDirectives: BeforeHash
|
IndentPPDirectives: BeforeHash
|
||||||
AlignConsecutiveMacros: Consecutive
|
AlignConsecutiveMacros: Consecutive
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
...
|
...
|
||||||
|
|||||||
+32
-18
@@ -1,10 +1,38 @@
|
|||||||
---
|
---
|
||||||
Checks: "-*,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-core.NullDereference,bugprone-*,misc-*,modernize-*,performance-*"
|
Checks: |
|
||||||
|
-*,
|
||||||
|
bugprone-*,
|
||||||
|
cppcoreguidelines-
|
||||||
|
clang-diagnostic-*,
|
||||||
|
clang-analyzer-*,
|
||||||
|
misc-*,
|
||||||
|
modernize-*,
|
||||||
|
performance-*,
|
||||||
|
readability-*,
|
||||||
|
-clang-analyzer-core.NullDereference,
|
||||||
|
-modernize-use-nodiscard,
|
||||||
|
-modernize-use-trailing-return-type,
|
||||||
|
-readability-braces-around-statements,
|
||||||
|
-modernize-avoid-c-arrays,
|
||||||
|
-modernize-use-std-print,
|
||||||
|
-readability-magic-numbers,
|
||||||
|
-readability-function-cognitive-complexity,
|
||||||
|
-misc-non-private-member-variables-in-classes
|
||||||
WarningsAsErrors: ""
|
WarningsAsErrors: ""
|
||||||
HeaderFilterRegex: ""
|
ExcludeHeaderFilterRegex: 'out/build'
|
||||||
AnalyzeTemporaryDtors: false
|
HeaderFilterRegex: '^src/.*'
|
||||||
|
SystemHeaders: false
|
||||||
|
# AnalyzeTemporaryDtors: false
|
||||||
FormatStyle: none
|
FormatStyle: none
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
|
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues
|
||||||
|
value: "true"
|
||||||
|
- key: readability-magic-numbers.IgnoredIntegerValues
|
||||||
|
value: "3;10;0x80;0xc0;0xFF;0x7f;0xf"
|
||||||
|
- key: readability-identifier-length.IgnoredVariableNames
|
||||||
|
value: "(in|to|id)"
|
||||||
|
- key: readability-identifier-length.IgnoredParameterNames
|
||||||
|
value: "(in|to|x)"
|
||||||
- key: bugprone-argument-comment.CommentBoolLiterals
|
- key: bugprone-argument-comment.CommentBoolLiterals
|
||||||
value: "0"
|
value: "0"
|
||||||
- key: bugprone-argument-comment.CommentCharacterLiterals
|
- key: bugprone-argument-comment.CommentCharacterLiterals
|
||||||
@@ -31,8 +59,6 @@ CheckOptions:
|
|||||||
value: __builtin_expect
|
value: __builtin_expect
|
||||||
- key: bugprone-dangling-handle.HandleClasses
|
- key: bugprone-dangling-handle.HandleClasses
|
||||||
value: "std::basic_string_view;std::experimental::basic_string_view"
|
value: "std::basic_string_view;std::experimental::basic_string_view"
|
||||||
- key: bugprone-dynamic-static-initializers.HeaderFileExtensions
|
|
||||||
value: ";h;hh;hpp;hxx"
|
|
||||||
- key: bugprone-easily-swappable-parameters.IgnoredParameterNames
|
- key: bugprone-easily-swappable-parameters.IgnoredParameterNames
|
||||||
value: '"";iterator;Iterator;begin;Begin;end;End;first;First;last;Last;lhs;LHS;rhs;RHS'
|
value: '"";iterator;Iterator;begin;Begin;end;End;first;First;last;Last;lhs;LHS;rhs;RHS'
|
||||||
- key: bugprone-easily-swappable-parameters.IgnoredParameterTypeSuffixes
|
- key: bugprone-easily-swappable-parameters.IgnoredParameterTypeSuffixes
|
||||||
@@ -105,10 +131,6 @@ CheckOptions:
|
|||||||
value: llvm
|
value: llvm
|
||||||
- key: bugprone-suspicious-enum-usage.StrictMode
|
- key: bugprone-suspicious-enum-usage.StrictMode
|
||||||
value: "false"
|
value: "false"
|
||||||
- key: bugprone-suspicious-include.HeaderFileExtensions
|
|
||||||
value: ";h;hh;hpp;hxx"
|
|
||||||
- key: bugprone-suspicious-include.ImplementationFileExtensions
|
|
||||||
value: "c;cc;cpp;cxx"
|
|
||||||
- key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens
|
- key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens
|
||||||
value: "5"
|
value: "5"
|
||||||
- key: bugprone-suspicious-missing-comma.RatioThreshold
|
- key: bugprone-suspicious-missing-comma.RatioThreshold
|
||||||
@@ -151,19 +173,13 @@ CheckOptions:
|
|||||||
value: "false"
|
value: "false"
|
||||||
- key: llvm-qualified-auto.AddConstToQualified
|
- key: llvm-qualified-auto.AddConstToQualified
|
||||||
value: "false"
|
value: "false"
|
||||||
- key: misc-definitions-in-headers.HeaderFileExtensions
|
|
||||||
value: ";h;hh;hpp;hxx"
|
|
||||||
- key: misc-definitions-in-headers.UseHeaderFileExtension
|
|
||||||
value: "true"
|
|
||||||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||||
value: "false"
|
value: "false"
|
||||||
- key: misc-non-private-member-variables-in-classes.IgnorePublicMemberVariables
|
- key: misc-non-private-member-variables-in-classes.IgnorePublicMemberVariables
|
||||||
value: "false"
|
value: "false"
|
||||||
- key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries
|
- key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries
|
||||||
value: "true"
|
value: "true"
|
||||||
- key: misc-throw-by-value-catch-by-reference.MaxSize
|
- key: misc-throw-by-value-catch-by-reference.WarnOnLargeObject
|
||||||
value: "-1"
|
|
||||||
- key: misc-throw-by-value-catch-by-reference.WarnOnLargeObjects
|
|
||||||
value: "false"
|
value: "false"
|
||||||
- key: misc-uniqueptr-reset-release.IncludeStyle
|
- key: misc-uniqueptr-reset-release.IncludeStyle
|
||||||
value: llvm
|
value: llvm
|
||||||
@@ -243,8 +259,6 @@ CheckOptions:
|
|||||||
value: "true"
|
value: "true"
|
||||||
- key: modernize-use-equals-delete.IgnoreMacros
|
- key: modernize-use-equals-delete.IgnoreMacros
|
||||||
value: "true"
|
value: "true"
|
||||||
- key: modernize-use-nodiscard.ReplacementString
|
|
||||||
value: "[[nodiscard]]"
|
|
||||||
- key: modernize-use-noexcept.ReplacementString
|
- key: modernize-use-noexcept.ReplacementString
|
||||||
value: ""
|
value: ""
|
||||||
- key: modernize-use-noexcept.UseNoexceptFalse
|
- key: modernize-use-noexcept.UseNoexceptFalse
|
||||||
|
|||||||
@@ -3,19 +3,19 @@
|
|||||||
{
|
{
|
||||||
"name": "AVR toolchain",
|
"name": "AVR toolchain",
|
||||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
"image": "mcr.microsoft.com/devcontainers/base:alpine-3.18",
|
"image": "mcr.microsoft.com/devcontainers/base:alpine-3.22",
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
"features": {},
|
"features": {},
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
"postCreateCommand": "bash scripts/install-toolchain.sh",
|
"postCreateCommand": "bash scripts/install-toolchain.sh",
|
||||||
|
"postAttachCommand": "bash scripts/chown-usb.sh",
|
||||||
// Configure tool-specific properties.
|
// Configure tool-specific properties.
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"ms-vscode.cpptools",
|
"ms-vscode.cpptools-extension-pack",
|
||||||
"ms-vscode.cmake-tools",
|
|
||||||
"rockcat.avr-support",
|
"rockcat.avr-support",
|
||||||
"harikrishnan94.cxx-compiler-explorer"
|
"harikrishnan94.cxx-compiler-explorer"
|
||||||
],
|
],
|
||||||
@@ -31,10 +31,14 @@
|
|||||||
"*.S": "avr"
|
"*.S": "avr"
|
||||||
},
|
},
|
||||||
"cmake.configureOnOpen": true,
|
"cmake.configureOnOpen": true,
|
||||||
"compilerexplorer.compilationDirectory": "${workspaceFolder}/build",
|
"compilerexplorer.compilationDirectory": "${workspaceFolder}/build"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// "runArgs": [
|
||||||
|
// "--device=/dev/ttyUSB0",
|
||||||
|
// "--device=/dev/ttyUSB1"
|
||||||
|
// ]
|
||||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
// "remoteUser": "root"
|
// "remoteUser": "root"
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Pre-commit: keep the C++ Device/Action enums in sync with the Lua dissector
|
||||||
|
# (scripts/sync_avclan_enums.py in its default lint + drift-check mode). A
|
||||||
|
# non-zero exit blocks the commit; fix with `scripts/sync_avclan_enums.py --fix`.
|
||||||
|
#
|
||||||
|
# Installed by the top-level CMake configure step, which points core.hooksPath
|
||||||
|
# at this directory. Bypass a single commit with `git commit --no-verify`.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
repo_root="$(git rev-parse --show-toplevel)"
|
||||||
|
exec python3 "$repo_root/scripts/sync_avclan_enums.py"
|
||||||
+12
-1
@@ -1,4 +1,15 @@
|
|||||||
*.o
|
*.o
|
||||||
*.elf
|
*.elf
|
||||||
*.hex
|
*.hex
|
||||||
build/
|
*.zip
|
||||||
|
*.db
|
||||||
|
*.bak
|
||||||
|
out/
|
||||||
|
build/
|
||||||
|
_autosave*
|
||||||
|
fp-info-cache
|
||||||
|
__pycache__/
|
||||||
|
~*
|
||||||
|
\#*
|
||||||
|
/CMakeUserPresets.json
|
||||||
|
.cache/
|
||||||
|
|||||||
+152
-121
@@ -1,139 +1,170 @@
|
|||||||
cmake_minimum_required(VERSION 3.24)
|
cmake_minimum_required(VERSION 3.24)
|
||||||
include(CMakeDependentOption)
|
|
||||||
|
|
||||||
set(WITH_MCU OFF)
|
project(avclan-mockingboard VERSION 1.1 LANGUAGES C CXX)
|
||||||
set(AVR_MCU "attiny3216")
|
|
||||||
set(AVR_UPLOADTOOL_PORT /dev/ttyUSB0)
|
|
||||||
set(AVR_PROGRAMMER serialupdi)
|
|
||||||
set(AVR_UPLOADTOOL_BAUDRATE 230400)
|
|
||||||
|
|
||||||
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/avr-gcc-toolchain.cmake")
|
set(CMAKE_C_STANDARD 23)
|
||||||
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
project(avclan-mockingboard VERSION 1 LANGUAGES C CXX ASM)
|
add_compile_options(
|
||||||
|
-Wall -Wswitch-enum -Werror
|
||||||
set(FREQSEL 16MHz CACHE STRING "Select the operating frequency")
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-threadsafe-statics>
|
||||||
set_property(CACHE FREQSEL PROPERTY STRINGS "20MHz" "16MHz")
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
||||||
if(FREQSEL MATCHES "20MHz")
|
# Debug must not be -O0: both the vendored usart.h and avr-libc's
|
||||||
set(FREQSEL 20000000L)
|
# <util/delay.h> #warning when __OPTIMIZE__ is undefined, and -Werror makes
|
||||||
set(AVR_UPLOADTOOL_BASE_OPTIONS ${AVR_UPLOADTOOL_BASE_OPTIONS} -U osccfg:w:0x2:m)
|
# that fatal.
|
||||||
else()
|
$<$<CONFIG:Debug>:-Og>
|
||||||
set(FREQSEL 16000000L)
|
$<$<CONFIG:Debug>:-fanalyzer>
|
||||||
set(AVR_UPLOADTOOL_BASE_OPTIONS ${AVR_UPLOADTOOL_BASE_OPTIONS} -U osccfg:w:0x1:m)
|
$<$<CONFIG:Debug>:-Wno-analyzer-use-of-uninitialized-value>)
|
||||||
endif()
|
|
||||||
|
|
||||||
option(CLK_PRESCALE "Enable the main clock prescaler")
|
|
||||||
cmake_dependent_option(CLK_PRESCALE_DIV "Prescaler divisor" CLKCTRL_PDIV_2X_gc STRING "CLK_PRESCALE")
|
|
||||||
if(DEFINED CACHE{CLK_PRESCALE_DIV})
|
|
||||||
set_property(CACHE CLK_PRESCALE_DIV PROPERTY STRINGS
|
|
||||||
CLKCTRL_PDIV_2X_gc
|
|
||||||
CLKCTRL_PDIV_4X_gc
|
|
||||||
CLKCTRL_PDIV_8X_gc
|
|
||||||
CLKCTRL_PDIV_16X_gc
|
|
||||||
CLKCTRL_PDIV_32X_gc
|
|
||||||
CLKCTRL_PDIV_64X_gc
|
|
||||||
CLKCTRL_PDIV_6X_gc
|
|
||||||
CLKCTRL_PDIV_10X_gc
|
|
||||||
CLKCTRL_PDIV_12X_gc
|
|
||||||
CLKCTRL_PDIV_24X_gc
|
|
||||||
CLKCTRL_PDIV_48X_gc
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
set(CLK_PRESCALE_DIV CLKCTRL_PDIV_2X_gc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(TCB_CLKSEL "TCB_CLKSEL_CLKDIV2_gc" CACHE STRING "Choose the clock for TCB")
|
|
||||||
set_property(CACHE TCB_CLKSEL PROPERTY STRINGS
|
|
||||||
TCB_CLKSEL_CLKDIV1_gc
|
|
||||||
TCB_CLKSEL_CLKDIV2_gc
|
|
||||||
TCB_CLKSEL_CLKTCA_gc
|
|
||||||
)
|
|
||||||
|
|
||||||
set(USART_RXMODE "USART_RXMODE_CLK2X_gc" CACHE STRING "USART at normal or double speed operation")
|
|
||||||
set_property(CACHE USART_RXMODE PROPERTY STRINGS
|
|
||||||
USART_RXMODE_CLK2X_gc
|
|
||||||
USART_RXMODE_NORMAL_gc
|
|
||||||
)
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.3")
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13")
|
||||||
message(FATAL_ERROR "Insufficient AVR-GCC version; Support for ATtiny3216 was added in GCC v8")
|
message(FATAL_ERROR "This project requires at least GCC v13")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Handle libc versioning
|
# Install the repository's git hooks (see .githooks/) by pointing core.hooksPath
|
||||||
try_compile(LIBC_VERSION_TEST
|
# at them at configure time.
|
||||||
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/libc-version-test.cpp"
|
# Opt out with -DINSTALL_GIT_HOOKS=OFF; a custom core.hooksPath is left untouched,
|
||||||
COMPILE_DEFINITIONS -mmcu=${AVR_MCU}
|
# and `git commit --no-verify` bypasses a single commit.
|
||||||
)
|
option(INSTALL_GIT_HOOKS "Point git core.hooksPath at .githooks/" ON)
|
||||||
|
if(INSTALL_GIT_HOOKS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
if(NOT LIBC_VERSION_TEST)
|
find_program(GIT_EXECUTABLE git)
|
||||||
include(FetchContent)
|
if(GIT_EXECUTABLE)
|
||||||
FetchContent_Declare(
|
execute_process(
|
||||||
attiny_atpack
|
COMMAND "${GIT_EXECUTABLE}" config --get core.hooksPath
|
||||||
URL http://packs.download.atmel.com/Atmel.ATtiny_DFP.2.0.368.atpack
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
URL_HASH SHA512=ee16a8ebecb57bd998a9cd4373368e3d45982cbbc3825e18d1dcac58215db6b9d907ad1ba2020cba9187fed7ba8c6f255a4fa1214e40c7a17ab2d18474f4d079
|
OUTPUT_VARIABLE _git_hooks_path
|
||||||
DOWNLOAD_NAME Atmel.ATtiny_DFP.2.0.368.atpack.zip
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
ERROR_QUIET)
|
||||||
FetchContent_MakeAvailable(attiny_atpack)
|
if(_git_hooks_path STREQUAL "" OR _git_hooks_path STREQUAL ".githooks")
|
||||||
try_compile(LIBC_VERSION_TEST
|
execute_process(
|
||||||
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/libc-version-test.cpp"
|
COMMAND "${GIT_EXECUTABLE}" config core.hooksPath .githooks
|
||||||
COMPILE_DEFINITIONS
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
-B "${attiny_atpack_SOURCE_DIR}/gcc/dev/${AVR_MCU}"
|
message(STATUS "git hooks: core.hooksPath -> .githooks")
|
||||||
-isystem "${attiny_atpack_SOURCE_DIR}/include"
|
|
||||||
-mmcu=${AVR_MCU}
|
|
||||||
)
|
|
||||||
if(NOT LIBC_VERSION_TEST)
|
|
||||||
message(FATAL_ERROR "Insufficient AVR-LIBC/Microchip pack for chosen MCU '${AVR_MCU}'")
|
|
||||||
else()
|
else()
|
||||||
include_directories(SYSTEM "${attiny_atpack_SOURCE_DIR}/include")
|
message(STATUS "git hooks: core.hooksPath already '${_git_hooks_path}'; leaving as-is")
|
||||||
add_compile_options(
|
|
||||||
-B "${attiny_atpack_SOURCE_DIR}/gcc/dev/${AVR_MCU}"
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Hardware target (port) selection. The chosen target/<name>/ directory supplies
|
||||||
|
# the port implementation sources, the per-target include path, and all
|
||||||
|
# hardware-specific build configuration (compile defs/options, device-pack
|
||||||
|
# handling, flashing) via its own CMakeLists, pulled in with add_subdirectory
|
||||||
|
# below. The matching cross-compiler is selected separately by a toolchain file
|
||||||
|
# (e.g. cmake/avr-gcc-toolchain.cmake) named in a CMake preset. Adding a new
|
||||||
|
# board = a sibling target/ directory + a toolchain file + a preset wiring them.
|
||||||
|
set(AVCLAN_TARGET avr-attiny3216 CACHE STRING "Hardware target (port) to build")
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 17)
|
# The AVC-LAN stack as a static library: the target-agnostic generic core (no
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
# <avr/...>, no register access). The selected target's port sources and flags
|
||||||
|
# are contributed by its subdirectory.
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Release)
|
add_library(avclan STATIC
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-Os")
|
src/avclan/frame.cc
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES Release)
|
src/avclan/cdchanger.cc
|
||||||
|
src/avclan/bus.cc
|
||||||
if(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -save-temps -g -gdwarf-3 -gstrict-dwarf")
|
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -save-temps -g -gdwarf-3 -gstrict-dwarf")
|
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
|
|
||||||
# Set startup time to 8 ms (0x4)
|
|
||||||
set(AVR_UPLOADTOOL_BASE_OPTIONS ${AVR_UPLOADTOOL_BASE_OPTIONS} -U syscfg1:w:0x4:m)
|
|
||||||
|
|
||||||
add_avr_executable(mockingboard
|
|
||||||
src/sniffer.c
|
|
||||||
src/com232.c
|
|
||||||
src/avclandrv.c)
|
|
||||||
|
|
||||||
target_link_options(mockingboard PUBLIC
|
|
||||||
-B "${attiny_atpack_SOURCE_DIR}/gcc/dev/${AVR_MCU}"
|
|
||||||
)
|
|
||||||
target_compile_definitions(mockingboard PRIVATE
|
|
||||||
FREQSEL=${FREQSEL}
|
|
||||||
CLK_PRESCALE=$<IF:$<BOOL:${CLK_PRESCALE}>,0x01,0x00>
|
|
||||||
CLK_PRESCALE_DIV=${CLK_PRESCALE_DIV}
|
|
||||||
__CLK_PRESCALE_DIV=__${CLK_PRESCALE_DIV}
|
|
||||||
TCB_CLKSEL=${TCB_CLKSEL}
|
|
||||||
USART_RXMODE=${USART_RXMODE}
|
|
||||||
)
|
|
||||||
target_compile_options(mockingboard PRIVATE
|
|
||||||
--param=min-pagesize=0
|
|
||||||
-ffunction-sections
|
|
||||||
-fdata-sections
|
|
||||||
-fshort-enums
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# avclan exports its public generic headers (src/avclan) to consumers and
|
||||||
|
# reaches into src/ for sibling headers (stdio.h, board.h) during its own
|
||||||
|
# build. The selected target adds its own per-target include path.
|
||||||
|
target_include_directories(avclan PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/avclan)
|
||||||
|
|
||||||
|
add_executable(mockingboard
|
||||||
|
src/sniffer.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(mockingboard avclan)
|
||||||
|
|
||||||
|
# Report firmware section sizes on every build, when the toolchain provides a
|
||||||
|
# size tool (CMAKE_SIZE). A standalone custom target (rather than a POST_BUILD
|
||||||
|
# command on mockingboard) so it prints even when the link is up to date:
|
||||||
|
# custom targets with no output are always considered stale and re-run.
|
||||||
|
# add_dependencies orders it after the link.
|
||||||
|
if(CMAKE_SIZE)
|
||||||
|
add_custom_target(mockingboard-size ALL
|
||||||
|
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:mockingboard>
|
||||||
|
COMMENT "Section sizes: mockingboard firmware"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_dependencies(mockingboard-size mockingboard)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Pull in the selected hardware target: its port sources, per-target headers,
|
||||||
|
# hardware-specific compile options/definitions, device-pack handling, and the
|
||||||
|
# flashing target. Added after the targets above so it can extend them.
|
||||||
|
add_subdirectory(src/avclan/target/${AVCLAN_TARGET})
|
||||||
|
|
||||||
|
# --- Polyfill headers for std facilities the toolchain may lack -------------
|
||||||
|
# tl::expected / tl::optional back-fill std::expected / std::optional (with
|
||||||
|
# C++23 monadic ops) when the build's stdlib predates them. Runs after the port
|
||||||
|
# subdirectory to provide a port-supplied freestanding stdlib via
|
||||||
|
# CMAKE_REQUIRED_INCLUDES, if necessary.
|
||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
include(FetchContent)
|
||||||
|
find_program(GIT_EXECUTABLE git REQUIRED)
|
||||||
|
|
||||||
|
if(TARGET libstdcpp)
|
||||||
|
get_target_property(_stdlib_incs libstdcpp INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${_stdlib_incs})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <version>
|
||||||
|
#if !defined(__cpp_lib_expected) || __cpp_lib_expected < 202211L
|
||||||
|
#error no std::expected
|
||||||
|
#endif
|
||||||
|
int main() { return 0; }" HAVE_STD_EXPECTED)
|
||||||
|
# check_cxx_source_compiles("
|
||||||
|
# #include <version>
|
||||||
|
# #if !defined(__cpp_lib_optional) || __cpp_lib_optional < 202110L
|
||||||
|
# #error no C++23 std::optional
|
||||||
|
# #endif
|
||||||
|
# int main() { return 0; }" HAVE_STD_OPTIONAL)
|
||||||
|
unset(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
|
||||||
|
if(NOT HAVE_STD_EXPECTED)
|
||||||
|
FetchContent_Declare(
|
||||||
|
tl_expected
|
||||||
|
GIT_REPOSITORY https://github.com/TartanLlama/expected.git
|
||||||
|
GIT_TAG 1770e3559f2f6ea4a5fb4f577ad22aeb30fbd8e4
|
||||||
|
PATCH_COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
|
||||||
|
-DPATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/tl-expected-no-exception-header.patch
|
||||||
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/apply-patch.cmake
|
||||||
|
SYSTEM
|
||||||
|
)
|
||||||
|
set(EXPECTED_BUILD_TESTS OFF)
|
||||||
|
set(EXPECTED_BUILD_PACKAGE OFF)
|
||||||
|
FetchContent_MakeAvailable(tl_expected)
|
||||||
|
add_library(tl_expected_hdr INTERFACE)
|
||||||
|
target_include_directories(tl_expected_hdr
|
||||||
|
INTERFACE ${tl_expected_SOURCE_DIR}/include)
|
||||||
|
target_link_libraries(avclan PUBLIC tl_expected_hdr)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# std/tl::optional not currently used
|
||||||
|
# if(NOT HAVE_STD_OPTIONAL)
|
||||||
|
# FetchContent_Declare(
|
||||||
|
# tl_optional
|
||||||
|
# GIT_REPOSITORY https://github.com/TartanLlama/optional.git
|
||||||
|
# GIT_TAG 3a1209de8370bf5fe16362934956144b49591565
|
||||||
|
# PATCH_COMMAND ${CMAKE_COMMAND}
|
||||||
|
# -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
|
||||||
|
# -DPATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/tl-optional-no-exception-header.patch
|
||||||
|
# -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/apply-patch.cmake
|
||||||
|
# SYSTEM
|
||||||
|
# )
|
||||||
|
# set(OPTIONAL_BUILD_TESTS OFF)
|
||||||
|
# set(OPTIONAL_BUILD_PACKAGE OFF)
|
||||||
|
# FetchContent_MakeAvailable(tl_optional)
|
||||||
|
# add_library(tl_optional_hdr INTERFACE)
|
||||||
|
# target_include_directories(tl_optional_hdr
|
||||||
|
# INTERFACE ${tl_optional_SOURCE_DIR}/include)
|
||||||
|
# target_link_libraries(avclan PUBLIC tl_optional_hdr)
|
||||||
|
# endif()
|
||||||
|
|||||||
+92
-18
@@ -1,31 +1,105 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 3,
|
||||||
"configurePresets": [
|
"configurePresets": [
|
||||||
{
|
{
|
||||||
"name": "default",
|
"name": "usb0",
|
||||||
"displayName": "Debug",
|
"hidden": true,
|
||||||
"description": "Configure with Debug build settings",
|
"description": "Program over /dev/ttyUSB0",
|
||||||
"generator": "Unix Makefiles",
|
|
||||||
"binaryDir": "${sourceDir}/build",
|
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "Debug",
|
"AVRDUDE_PORT": "/dev/ttyUSB0"
|
||||||
"FREQSEL": "20MHz",
|
|
||||||
"TCB_CLKSEL": "TCB_CLKSEL_CLKDIV1_gc"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "relwithdebinfo",
|
"name": "usb1",
|
||||||
"displayName": "RelWithDebInfo",
|
"hidden": true,
|
||||||
"description": "Configure with RelWithDebInfo build settings",
|
"description": "Program over /dev/ttyUSB1",
|
||||||
"generator": "Unix Makefiles",
|
|
||||||
"binaryDir": "${sourceDir}/build",
|
|
||||||
"inherits": "default",
|
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
"AVRDUDE_PORT": "/dev/ttyUSB1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "avr-attiny3216",
|
||||||
|
"hidden": true,
|
||||||
|
"description": "AVR ATtiny3216 cross-compile toolchain + matching port",
|
||||||
|
"toolchainFile": "${sourceDir}/cmake/avr-gcc-toolchain.cmake",
|
||||||
|
"binaryDir": "${sourceDir}/out/build/avr-attiny3216",
|
||||||
|
"cacheVariables": {
|
||||||
|
"AVCLAN_TARGET": "avr-attiny3216",
|
||||||
"FREQSEL": "20MHz",
|
"FREQSEL": "20MHz",
|
||||||
"TCB_CLKSEL": "TCB_CLKSEL_CLKDIV1_gc",
|
"TCB_CLKSEL": "TCB_CLKSEL_CLKDIV1_gc",
|
||||||
"USART_RXMODE": "USART_RXMODE_CLK2X_gc"
|
"USART_RXMODE": "DOUBLE_SPEED"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "debug-base",
|
||||||
|
"hidden": true,
|
||||||
|
"description": "Debug build settings",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "relwithdebinfo-base",
|
||||||
|
"hidden": true,
|
||||||
|
"description": "RelWithDebInfo build settings",
|
||||||
|
"inherits": "debug-base",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-relwithdebinfo",
|
||||||
|
"hidden": true,
|
||||||
|
"description": "ATtiny3216 RelWithDebInfo build,",
|
||||||
|
"inherits": [
|
||||||
|
"avr-attiny3216",
|
||||||
|
"relwithdebinfo-base"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-debug",
|
||||||
|
"hidden": true,
|
||||||
|
"description": "ATtiny3216 Debug build",
|
||||||
|
"inherits": [
|
||||||
|
"avr-attiny3216",
|
||||||
|
"debug-base"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-relwithdebinfo-usb0",
|
||||||
|
"displayName": "ATtiny3216 RelWithDebInfo (ttyUSB0)",
|
||||||
|
"description": "ATtiny3216 RelWithDebInfo build, program over /dev/ttyUSB0",
|
||||||
|
"inherits": [
|
||||||
|
"attiny3216-relwithdebinfo",
|
||||||
|
"usb0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-relwithdebinfo-usb1",
|
||||||
|
"displayName": "ATtiny3216 RelWithDebInfo (ttyUSB1)",
|
||||||
|
"description": "ATtiny3216 RelWithDebInfo build, program over /dev/ttyUSB1",
|
||||||
|
"inherits": [
|
||||||
|
"attiny3216-relwithdebinfo",
|
||||||
|
"usb1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-debug-usb0",
|
||||||
|
"displayName": "ATtiny3216 Debug (ttyUSB0)",
|
||||||
|
"description": "ATtiny3216 Debug build, program over /dev/ttyUSB0",
|
||||||
|
"inherits": [
|
||||||
|
"attiny3216-debug",
|
||||||
|
"usb0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-debug-usb1",
|
||||||
|
"displayName": "ATtiny3216 Debug (ttyUSB1)",
|
||||||
|
"description": "ATtiny3216 Debug build, program over /dev/ttyUSB1",
|
||||||
|
"inherits": [
|
||||||
|
"attiny3216-debug",
|
||||||
|
"usb1"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# AVCLAN Mockingboard
|
||||||
|
|
||||||
|
<img src="./hardware/pcbv1.png" width=500\>
|
||||||
|
|
||||||
|
This project adds an aux in to the stock head unit of compatible Toyota vehicles by emulating an external CD changer. The Mockingboard communicates with the head unit over the AVC-LAN bus, Toyota's name for their messaging protocol over the NEC (now Renesas) IEBus. Also included is a Wireshark dissector for IEBus and AVC-LAN. AVC-LAN is sparsely documented publicly; this dissector collects what's known from prior art alongside my own findings.
|
||||||
|
|
||||||
|
# Features:
|
||||||
|
|
||||||
|
- Select/switch between internal CD player and mockingboard by pressing the "CD" button (repeated presses toggle between internal and external CD players)
|
||||||
|
- Generally complete handling of physical interface (track next/prev, fast-forward/rewind, track/disk repeat and random; "scan" button and change disc buttons are currently unimplemented for lack of use/purpose)
|
||||||
|
- Play/pause, next/prev control of connected phones via headset functions (mimicing the button press on a wired headset; requires phone support and connection using a TRRS aux cable)
|
||||||
|
|
||||||
|
## Future plans (Mockingboard v2)
|
||||||
|
|
||||||
|
- Bluetooth functionality
|
||||||
|
- "Scan" button repurposed to enter bluetooth pairing mode
|
||||||
|
- Button actions (play/pause, track skip, ff/rw, \[disc\] repeat/shuffle) mapped to AVRCP
|
||||||
|
- Song info/status (time, etc) relayed to head-unit (i.e. time display matches actual song/audio time)
|
||||||
|
- Redesigned hardware based on RPi Pico 2W (RP2350 + Bluetooth)
|
||||||
|
- PIO used to implement:
|
||||||
|
- AVCLAN comms
|
||||||
|
- I2S audio
|
||||||
|
- Dual audio input options (aux in, bluetooth)
|
||||||
|
- Switched audio jack to sense aux plug presence
|
||||||
|
- Audio codec with differential output (better rejection of electrical noise, e.g. from adjacent AVCLAN bus lines)
|
||||||
|
- Switching regulator (easier assembly)
|
||||||
|
- CAN transceiver
|
||||||
|
- TX/RX connected to different diodes (or different pads of a single dual/multicolor LED package) for observability
|
||||||
|
|
||||||
|
# Helpful links/prior art:
|
||||||
|
|
||||||
|
- IEBus/AVCLAN decoder and message dumps (inc. a CD changer) for Sigrok
|
||||||
|
- https://github.com/sigrokproject/sigrok-test/pull/22
|
||||||
|
- https://github.com/sigrokproject/sigrok-dumps/pull/43
|
||||||
|
- https://github.com/sigrokproject/libsigrokdecode/pull/106
|
||||||
|
- https://web.archive.org/web/20230319000356/http://softservice.com.pl/corolla/avc/avclan.php
|
||||||
|
- https://web.archive.org/web/20040617005106/http://www.interfacebus.com/Design_Connector_IEbus.html
|
||||||
|
- https://web.archive.org/web/2/https://old.pinouts.ru/Car-Stereo-Toyota-Lexus/Toyota_1990-2002_CD_Chang_pinout.shtml
|
||||||
|
- https://web.archive.org/web/20240519043021/https://pop.fsck.pl/hardware/toyota-corolla.html
|
||||||
|
- https://github.com/GadgetNutt/AVC-LAN-Module-Builder
|
||||||
|
|
||||||
|
# Firmware
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
#### With VS Code:
|
||||||
|
|
||||||
|
1. Install VS Code and Docker
|
||||||
|
- Required extensions: Dev Containers
|
||||||
|
2. Open repo in VS code and wait for notification asking to re-open in dev container.
|
||||||
|
- Wait for container to build and extensions to install
|
||||||
|
3. Select CMake build configuration
|
||||||
|
4. Start developing!
|
||||||
|
|
||||||
|
#### Natively/without VS Code Dev Containers
|
||||||
|
1. Install avr-gcc >= v13.1, binutils >= v2.39, cmake >= v3.24
|
||||||
|
2. Configure cmake with a hardware-target preset, `cmake --list-presets` to discover options
|
||||||
|
- Trigger builds with e.g. `cmake --build out/build/attiny3216`
|
||||||
|
3. Start developing!
|
||||||
|
|
||||||
|
# Hardware
|
||||||
|
|
||||||
|
## First generation
|
||||||
|
|
||||||
|
See [here](hardware/mockingboard-v1/README.md) for details.
|
||||||
|
|
||||||
|
## Second generation
|
||||||
|
|
||||||
|
Under development!
|
||||||
|
|
||||||
|
# Protocol reverse-engineering
|
||||||
|
|
||||||
|
The "scripts/packet-analysis" folder contains a [Wireshark](https://www.wireshark.org/) [Lua plugin](https://www.wireshark.org/docs/wsdg_html_chunked/wsluarm.html) that defines a dissector for IEBUS and AVC-LAN messages.
|
||||||
|
|
||||||
|
The dissector's `known_devices` / `known_actions` tables are the source of truth
|
||||||
|
for AVC-LAN device and action names. `scripts/sync_avclan_enums.py` reconciles
|
||||||
|
the firmware's C++ `Device` / `Action` enums (and every reference under `src/`)
|
||||||
|
against them, matching by value so renamed values are propagated. It runs as a
|
||||||
|
pre-commit hook — the top-level CMake configure step points `core.hooksPath` at
|
||||||
|
`.githooks/`, so `cmake --preset …` activates it automatically (opt out with
|
||||||
|
`-DINSTALL_GIT_HOOKS=OFF`; `git commit --no-verify` bypasses one commit). The
|
||||||
|
hook only reports drift; run `scripts/sync_avclan_enums.py --fix` to apply, and
|
||||||
|
`--lint` to check that the dissector's own names are valid identifiers.
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
The firmware for this project is licensed under the [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.html). The AVR-Attiny3216 hardware target depends on a vendored [MIT](https://spdx.org/licenses/MIT) licensed [UART library](https://github.com/jnk0le/AVR-UART-lib), and the [MPL-2.0](https://www.mozilla.org/MPL/2.0/) licensed [avr-libstdcpp](https://github.com/modm-io/avr-libstdcpp/) C++ STL subset.
|
||||||
|
The hardware is licensed under the [Solderpad Hardware License v2.1](http://solderpad.org/licenses/SHL-2.1/), a
|
||||||
|
wraparound license to the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0.txt).
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Idempotent patch driver for FetchContent PATCH_COMMAND steps.
|
||||||
|
#
|
||||||
|
# Usage: cmake -DGIT_EXECUTABLE=<git> -DPATCH_FILE=<patch> -P apply-patch.cmake
|
||||||
|
# (run with CWD = the populated source directory, as PATCH_COMMAND does).
|
||||||
|
#
|
||||||
|
# FetchContent re-runs PATCH_COMMAND after its update step on reconfigure, so a
|
||||||
|
# bare `git apply` fails the second time around. Skip if the patch is already
|
||||||
|
# applied (the reverse-apply dry run succeeds); otherwise apply it for real.
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" apply --reverse --check --ignore-whitespace
|
||||||
|
"${PATCH_FILE}"
|
||||||
|
RESULT_VARIABLE _already_applied
|
||||||
|
OUTPUT_QUIET ERROR_QUIET)
|
||||||
|
if(NOT _already_applied EQUAL 0)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" apply --ignore-whitespace "${PATCH_FILE}"
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY)
|
||||||
|
endif()
|
||||||
+18
-381
@@ -1,400 +1,37 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# "THE ANY BEVERAGE-WARE LICENSE" (Revision 42 - based on beer-ware
|
# AVR cross-compilation toolchain (ATtiny-0/1/2 series, UPDI programming).
|
||||||
# license):
|
|
||||||
# <dev@layer128.net> wrote this file. As long as you retain this notice
|
|
||||||
# you can do whatever you want with this stuff. If we meet some day, and
|
|
||||||
# you think this stuff is worth it, you can buy me a be(ve)er(age) in
|
|
||||||
# return. (I don't like beer much.)
|
|
||||||
#
|
#
|
||||||
# Matthias Kleemann
|
# Originally based on Matthias Kleemann's avr-cmake module
|
||||||
##########################################################################
|
# (<dev@layer128.net>, "THE ANY BEVERAGE-WARE LICENSE"), but slimmed to just
|
||||||
|
# the cross-compiler definition, the AVR-wide compile/link flags, and the
|
||||||
##########################################################################
|
# avrdude configuration the `flash` target needs.
|
||||||
# The toolchain requires some variables set.
|
|
||||||
#
|
#
|
||||||
# AVR_MCU (default: atmega8)
|
|
||||||
# the type of AVR the application is built for
|
|
||||||
# AVR_L_FUSE (NO DEFAULT)
|
|
||||||
# the LOW fuse value for the MCU used
|
|
||||||
# AVR_H_FUSE (NO DEFAULT)
|
|
||||||
# the HIGH fuse value for the MCU used
|
|
||||||
# AVR_UPLOADTOOL (default: avrdude)
|
|
||||||
# the application used to upload to the MCU
|
|
||||||
# NOTE: The toolchain is currently quite specific about
|
|
||||||
# the commands used, so it needs tweaking.
|
|
||||||
# AVR_UPLOADTOOL_PORT (default: usb)
|
|
||||||
# the port used for the upload tool, e.g. usb
|
|
||||||
# AVR_PROGRAMMER (default: avrispmkII)
|
|
||||||
# the programmer hardware used, e.g. avrispmkII
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# options
|
# Cross-compiler definition
|
||||||
##########################################################################
|
|
||||||
option(WITH_MCU "Add the mCU type to the target file name." ON)
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# executables in use
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
find_program(AVR_CC avr-gcc REQUIRED)
|
find_program(AVR_CC avr-gcc REQUIRED)
|
||||||
find_program(AVR_CXX avr-g++ REQUIRED)
|
find_program(AVR_CXX avr-g++ REQUIRED)
|
||||||
find_program(AVR_OBJCOPY avr-objcopy REQUIRED)
|
# Section-size reporter; consumed by an optional POST_BUILD in the top-level
|
||||||
find_program(AVR_SIZE_TOOL avr-size REQUIRED)
|
# CMakeLists (left unset -> no size report) so the top level stays HW-agnostic.
|
||||||
find_program(AVR_OBJDUMP avr-objdump REQUIRED)
|
find_program(CMAKE_SIZE avr-size)
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# toolchain starts with defining mandatory variables
|
|
||||||
##########################################################################
|
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR avr)
|
set(CMAKE_SYSTEM_PROCESSOR avr)
|
||||||
set(CMAKE_C_COMPILER ${AVR_CC})
|
set(CMAKE_C_COMPILER ${AVR_CC})
|
||||||
set(CMAKE_CXX_COMPILER ${AVR_CXX})
|
set(CMAKE_CXX_COMPILER ${AVR_CXX})
|
||||||
|
|
||||||
##########################################################################
|
set(AVR_MCU attiny3216 CACHE STRING "Target AVR device" FORCE)
|
||||||
# Identification
|
|
||||||
##########################################################################
|
set(CMAKE_C_FLAGS_INIT "-mmcu=${AVR_MCU}")
|
||||||
set(AVR 1)
|
set(CMAKE_CXX_FLAGS_INIT "-mmcu=${AVR_MCU}")
|
||||||
|
set(CMAKE_ASM_FLAGS_INIT "-mmcu=${AVR_MCU}")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections -mrelax")
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# some necessary tools and variables for AVR builds, which may not
|
# Bypass the link step in CMake's compiler sanity check (and the
|
||||||
# defined yet
|
# libc-version try_compile): this is a cross compiler, so a full executable
|
||||||
# - AVR_UPLOADTOOL
|
# link would fail. See https://stackoverflow.com/q/53633705
|
||||||
# - AVR_UPLOADTOOL_PORT
|
|
||||||
# - AVR_PROGRAMMER
|
|
||||||
# - AVR_MCU
|
|
||||||
# - AVR_SIZE_ARGS
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
# default upload tool
|
|
||||||
if(NOT AVR_UPLOADTOOL)
|
|
||||||
set(
|
|
||||||
AVR_UPLOADTOOL avrdude
|
|
||||||
CACHE STRING "Set default upload tool: avrdude"
|
|
||||||
)
|
|
||||||
find_program(AVR_UPLOADTOOL avrdude)
|
|
||||||
endif(NOT AVR_UPLOADTOOL)
|
|
||||||
|
|
||||||
# default upload tool port
|
|
||||||
if(NOT AVR_UPLOADTOOL_PORT)
|
|
||||||
set(
|
|
||||||
AVR_UPLOADTOOL_PORT usb
|
|
||||||
CACHE STRING "Set default upload tool port: usb"
|
|
||||||
)
|
|
||||||
endif(NOT AVR_UPLOADTOOL_PORT)
|
|
||||||
|
|
||||||
# default programmer (hardware)
|
|
||||||
if(NOT AVR_PROGRAMMER)
|
|
||||||
set(
|
|
||||||
AVR_PROGRAMMER avrispmkII
|
|
||||||
CACHE STRING "Set default programmer hardware model: avrispmkII"
|
|
||||||
)
|
|
||||||
endif(NOT AVR_PROGRAMMER)
|
|
||||||
|
|
||||||
# default MCU (chip)
|
|
||||||
if(NOT AVR_MCU)
|
|
||||||
set(
|
|
||||||
AVR_MCU atmega8
|
|
||||||
CACHE STRING "Set default MCU: atmega8 (see 'avr-gcc --target-help' for valid values)"
|
|
||||||
)
|
|
||||||
endif(NOT AVR_MCU)
|
|
||||||
|
|
||||||
#default avr-size args
|
|
||||||
if(NOT AVR_SIZE_ARGS)
|
|
||||||
if(APPLE)
|
|
||||||
set(AVR_SIZE_ARGS -B)
|
|
||||||
else(APPLE)
|
|
||||||
set(AVR_SIZE_ARGS -G)
|
|
||||||
endif(APPLE)
|
|
||||||
endif(NOT AVR_SIZE_ARGS)
|
|
||||||
|
|
||||||
# prepare base flags for upload tool
|
|
||||||
set(AVR_UPLOADTOOL_BASE_OPTIONS -p ${AVR_MCU} -c ${AVR_PROGRAMMER})
|
|
||||||
|
|
||||||
# use AVR_UPLOADTOOL_BAUDRATE as baudrate for upload tool (if defined)
|
|
||||||
if(AVR_UPLOADTOOL_BAUDRATE)
|
|
||||||
set(AVR_UPLOADTOOL_BASE_OPTIONS ${AVR_UPLOADTOOL_BASE_OPTIONS} -b ${AVR_UPLOADTOOL_BAUDRATE})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# check build types:
|
|
||||||
# - Debug
|
|
||||||
# - Release
|
|
||||||
# - RelWithDebInfo
|
|
||||||
#
|
|
||||||
# Release is chosen, because of some optimized functions in the
|
|
||||||
# AVR toolchain, e.g. _delay_ms().
|
|
||||||
##########################################################################
|
|
||||||
if(NOT ((CMAKE_BUILD_TYPE MATCHES Release) OR
|
|
||||||
(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) OR
|
|
||||||
(CMAKE_BUILD_TYPE MATCHES Debug) OR
|
|
||||||
(CMAKE_BUILD_TYPE MATCHES MinSizeRel)))
|
|
||||||
set(
|
|
||||||
CMAKE_BUILD_TYPE Release
|
|
||||||
CACHE STRING "Choose cmake build type: Debug Release RelWithDebInfo MinSizeRel"
|
|
||||||
FORCE
|
|
||||||
)
|
|
||||||
endif(NOT ((CMAKE_BUILD_TYPE MATCHES Release) OR
|
|
||||||
(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) OR
|
|
||||||
(CMAKE_BUILD_TYPE MATCHES Debug) OR
|
|
||||||
(CMAKE_BUILD_TYPE MATCHES MinSizeRel)))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# target file name add-on
|
|
||||||
##########################################################################
|
|
||||||
if(WITH_MCU)
|
|
||||||
set(MCU_TYPE_FOR_FILENAME "-${AVR_MCU}")
|
|
||||||
else(WITH_MCU)
|
|
||||||
set(MCU_TYPE_FOR_FILENAME "")
|
|
||||||
endif(WITH_MCU)
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# add_avr_executable
|
|
||||||
# - IN_VAR: EXECUTABLE_NAME
|
|
||||||
#
|
|
||||||
# Creates targets and dependencies for AVR toolchain, building an
|
|
||||||
# executable. Calls add_executable with ELF file as target name, so
|
|
||||||
# any link dependencies need to be using that target, e.g. for
|
|
||||||
# target_link_libraries(<EXECUTABLE_NAME>-${AVR_MCU}.elf ...).
|
|
||||||
##########################################################################
|
|
||||||
function(add_avr_executable EXECUTABLE_NAME)
|
|
||||||
|
|
||||||
if(NOT ARGN)
|
|
||||||
message(FATAL_ERROR "No source files given for ${EXECUTABLE_NAME}.")
|
|
||||||
endif(NOT ARGN)
|
|
||||||
|
|
||||||
# set file names
|
|
||||||
set(hex_file ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}.hex)
|
|
||||||
set(lst_file ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}.lst)
|
|
||||||
set(map_file ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}.map)
|
|
||||||
set(eeprom_image ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}-eeprom.hex)
|
|
||||||
|
|
||||||
set (${EXECUTABLE_NAME}_ELF_TARGET ${EXECUTABLE_NAME} PARENT_SCOPE)
|
|
||||||
set (${EXECUTABLE_NAME}_HEX_TARGET ${hex_file} PARENT_SCOPE)
|
|
||||||
set (${EXECUTABLE_NAME}_LST_TARGET ${lst_file} PARENT_SCOPE)
|
|
||||||
set (${EXECUTABLE_NAME}_MAP_TARGET ${map_file} PARENT_SCOPE)
|
|
||||||
set (${EXECUTABLE_NAME}_EEPROM_TARGET ${eeprom_file} PARENT_SCOPE)
|
|
||||||
# elf file
|
|
||||||
add_executable(${EXECUTABLE_NAME} ${ARGN})
|
|
||||||
|
|
||||||
set_target_properties(
|
|
||||||
${EXECUTABLE_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
COMPILE_FLAGS "-mmcu=${AVR_MCU}"
|
|
||||||
LINK_FLAGS "-mmcu=${AVR_MCU} -Wl,--gc-sections -mrelax -Wl,-Map,${map_file}"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${lst_file}
|
|
||||||
COMMAND
|
|
||||||
${AVR_OBJDUMP} -d ${EXECUTABLE_NAME} > ${lst_file}
|
|
||||||
DEPENDS ${EXECUTABLE_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
# eeprom
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${eeprom_image}
|
|
||||||
COMMAND
|
|
||||||
${AVR_OBJCOPY} -j .eeprom --set-section-flags=.eeprom=alloc,load
|
|
||||||
--change-section-lma .eeprom=0 --no-change-warnings
|
|
||||||
-O ihex ${EXECUTABLE_NAME} ${eeprom_image}
|
|
||||||
DEPENDS ${EXECUTABLE_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
# clean
|
|
||||||
get_directory_property(clean_files ADDITIONAL_MAKE_CLEAN_FILES)
|
|
||||||
set_directory_properties(
|
|
||||||
PROPERTIES
|
|
||||||
ADDITIONAL_MAKE_CLEAN_FILES "${map_file}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# upload - with avrdude
|
|
||||||
add_custom_target(
|
|
||||||
upload_${EXECUTABLE_NAME}
|
|
||||||
${AVR_UPLOADTOOL} ${AVR_UPLOADTOOL_BASE_OPTIONS} ${AVR_UPLOADTOOL_OPTIONS}
|
|
||||||
-U flash:w:${EXECUTABLE_NAME}:e
|
|
||||||
-P ${AVR_UPLOADTOOL_PORT}
|
|
||||||
DEPENDS ${EXECUTABLE_NAME}
|
|
||||||
COMMENT "Uploading ${hex_file} to ${AVR_MCU} using ${AVR_PROGRAMMER}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# upload eeprom only - with avrdude
|
|
||||||
# see also bug http://savannah.nongnu.org/bugs/?40142
|
|
||||||
add_custom_target(
|
|
||||||
upload_${EXECUTABLE_NAME}_eeprom
|
|
||||||
${AVR_UPLOADTOOL} ${AVR_UPLOADTOOL_BASE_OPTIONS} ${AVR_UPLOADTOOL_OPTIONS}
|
|
||||||
-U eeprom:w:${eeprom_image}
|
|
||||||
-P ${AVR_UPLOADTOOL_PORT}
|
|
||||||
DEPENDS ${eeprom_image}
|
|
||||||
COMMENT "Uploading ${eeprom_image} to ${AVR_MCU} using ${AVR_PROGRAMMER}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# disassemble
|
|
||||||
add_custom_target(
|
|
||||||
disassemble_${EXECUTABLE_NAME}
|
|
||||||
${AVR_OBJDUMP} -h -S ${EXECUTABLE_NAME} > ${EXECUTABLE_NAME}.lst
|
|
||||||
DEPENDS ${EXECUTABLE_NAME}
|
|
||||||
)
|
|
||||||
endfunction(add_avr_executable)
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# add_avr_library
|
|
||||||
# - IN_VAR: LIBRARY_NAME
|
|
||||||
#
|
|
||||||
# Calls add_library with an optionally concatenated name
|
|
||||||
# <LIBRARY_NAME>${MCU_TYPE_FOR_FILENAME}.
|
|
||||||
# This needs to be used for linking against the library, e.g. calling
|
|
||||||
# target_link_libraries(...).
|
|
||||||
##########################################################################
|
|
||||||
function(add_avr_library LIBRARY_NAME)
|
|
||||||
if(NOT ARGN)
|
|
||||||
message(FATAL_ERROR "No source files given for ${LIBRARY_NAME}.")
|
|
||||||
endif(NOT ARGN)
|
|
||||||
|
|
||||||
set(lib_file ${LIBRARY_NAME}${MCU_TYPE_FOR_FILENAME})
|
|
||||||
set (${LIBRARY_NAME}_LIB_TARGET ${elf_file} PARENT_SCOPE)
|
|
||||||
|
|
||||||
add_library(${lib_file} STATIC ${ARGN})
|
|
||||||
|
|
||||||
set_target_properties(
|
|
||||||
${lib_file}
|
|
||||||
PROPERTIES
|
|
||||||
COMPILE_FLAGS "-mmcu=${AVR_MCU}"
|
|
||||||
OUTPUT_NAME "${lib_file}"
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT TARGET ${LIBRARY_NAME})
|
|
||||||
add_custom_target(
|
|
||||||
${LIBRARY_NAME}
|
|
||||||
ALL
|
|
||||||
DEPENDS ${lib_file}
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(
|
|
||||||
${LIBRARY_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
OUTPUT_NAME "${lib_file}"
|
|
||||||
)
|
|
||||||
endif(NOT TARGET ${LIBRARY_NAME})
|
|
||||||
|
|
||||||
endfunction(add_avr_library)
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# avr_target_link_libraries
|
|
||||||
# - IN_VAR: EXECUTABLE_TARGET
|
|
||||||
# - ARGN : targets and files to link to
|
|
||||||
#
|
|
||||||
# Calls target_link_libraries with AVR target names (concatenation,
|
|
||||||
# extensions and so on.
|
|
||||||
##########################################################################
|
|
||||||
function(avr_target_link_libraries EXECUTABLE_TARGET)
|
|
||||||
if(NOT ARGN)
|
|
||||||
message(FATAL_ERROR "Nothing to link to ${EXECUTABLE_TARGET}.")
|
|
||||||
endif(NOT ARGN)
|
|
||||||
|
|
||||||
get_target_property(TARGET_LIST ${EXECUTABLE_TARGET} OUTPUT_NAME)
|
|
||||||
|
|
||||||
foreach(TGT ${ARGN})
|
|
||||||
if(TARGET ${TGT})
|
|
||||||
get_target_property(ARG_NAME ${TGT} OUTPUT_NAME)
|
|
||||||
list(APPEND NON_TARGET_LIST ${ARG_NAME})
|
|
||||||
else(TARGET ${TGT})
|
|
||||||
list(APPEND NON_TARGET_LIST ${TGT})
|
|
||||||
endif(TARGET ${TGT})
|
|
||||||
endforeach(TGT ${ARGN})
|
|
||||||
|
|
||||||
target_link_libraries(${TARGET_LIST} ${NON_TARGET_LIST})
|
|
||||||
endfunction(avr_target_link_libraries EXECUTABLE_TARGET)
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# avr_target_include_directories
|
|
||||||
#
|
|
||||||
# Calls target_include_directories with AVR target names
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
function(avr_target_include_directories EXECUTABLE_TARGET)
|
|
||||||
if(NOT ARGN)
|
|
||||||
message(FATAL_ERROR "No include directories to add to ${EXECUTABLE_TARGET}.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(TARGET_LIST ${EXECUTABLE_TARGET} OUTPUT_NAME)
|
|
||||||
set(extra_args ${ARGN})
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_LIST} ${extra_args})
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# avr_target_compile_definitions
|
|
||||||
#
|
|
||||||
# Calls target_compile_definitions with AVR target names
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
function(avr_target_compile_definitions EXECUTABLE_TARGET)
|
|
||||||
if(NOT ARGN)
|
|
||||||
message(FATAL_ERROR "No compile definitions to add to ${EXECUTABLE_TARGET}.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(TARGET_LIST ${EXECUTABLE_TARGET} OUTPUT_NAME)
|
|
||||||
set(extra_args ${ARGN})
|
|
||||||
|
|
||||||
target_compile_definitions(${TARGET_LIST} ${extra_args})
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(avr_generate_fixed_targets)
|
|
||||||
# get status
|
|
||||||
add_custom_target(
|
|
||||||
get_status
|
|
||||||
${AVR_UPLOADTOOL} ${AVR_UPLOADTOOL_BASE_OPTIONS} -P ${AVR_UPLOADTOOL_PORT} -n -v
|
|
||||||
COMMENT "Get status from ${AVR_MCU}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# get fuses
|
|
||||||
add_custom_target(
|
|
||||||
get_fuses
|
|
||||||
${AVR_UPLOADTOOL} ${AVR_UPLOADTOOL_BASE_OPTIONS} -P ${AVR_UPLOADTOOL_PORT} -n
|
|
||||||
-U lfuse:r:-:b
|
|
||||||
-U hfuse:r:-:b
|
|
||||||
COMMENT "Get fuses from ${AVR_MCU}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# set fuses
|
|
||||||
add_custom_target(
|
|
||||||
set_fuses
|
|
||||||
${AVR_UPLOADTOOL} ${AVR_UPLOADTOOL_BASE_OPTIONS} -P ${AVR_UPLOADTOOL_PORT}
|
|
||||||
-U lfuse:w:${AVR_L_FUSE}:m
|
|
||||||
-U hfuse:w:${AVR_H_FUSE}:m
|
|
||||||
COMMENT "Setup: High Fuse: ${AVR_H_FUSE} Low Fuse: ${AVR_L_FUSE}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# get oscillator calibration
|
|
||||||
add_custom_target(
|
|
||||||
get_calibration
|
|
||||||
${AVR_UPLOADTOOL} ${AVR_UPLOADTOOL_BASE_OPTIONS} -P ${AVR_UPLOADTOOL_PORT}
|
|
||||||
-U calibration:r:${AVR_MCU}_calib.tmp:r
|
|
||||||
COMMENT "Write calibration status of internal oscillator to ${AVR_MCU}_calib.tmp."
|
|
||||||
)
|
|
||||||
|
|
||||||
# set oscillator calibration
|
|
||||||
add_custom_target(
|
|
||||||
set_calibration
|
|
||||||
${AVR_UPLOADTOOL} ${AVR_UPLOADTOOL_BASE_OPTIONS} -P ${AVR_UPLOADTOOL_PORT}
|
|
||||||
-U calibration:w:${AVR_MCU}_calib.hex
|
|
||||||
COMMENT "Program calibration status of internal oscillator from ${AVR_MCU}_calib.hex."
|
|
||||||
)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# Bypass the link step in CMake's "compiler sanity test" check
|
|
||||||
#
|
|
||||||
# CMake throws in a try_compile() target test in some generators, but does
|
|
||||||
# not know that this is a cross compiler so the executable can't link.
|
|
||||||
# Change the target type:
|
|
||||||
#
|
|
||||||
# https://stackoverflow.com/q/53633705
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
diff --git a/include/tl/expected.hpp b/include/tl/expected.hpp
|
||||||
|
index 59e59aa..75857bd 100644
|
||||||
|
--- a/include/tl/expected.hpp
|
||||||
|
+++ b/include/tl/expected.hpp
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
#define TL_EXPECTED_VERSION_MINOR 3
|
||||||
|
#define TL_EXPECTED_VERSION_PATCH 1
|
||||||
|
|
||||||
|
-#include <exception>
|
||||||
|
+#include <cstdlib>
|
||||||
|
#include <functional>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
@@ -222,7 +222,7 @@ static constexpr unexpect_t unexpect{};
|
||||||
|
#ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
|
||||||
|
#define TL_EXPECTED_THROW_EXCEPTION(e) throw((e));
|
||||||
|
#else
|
||||||
|
-#define TL_EXPECTED_THROW_EXCEPTION(e) std::terminate();
|
||||||
|
+#define TL_EXPECTED_THROW_EXCEPTION(e) std::abort();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
@@ -1249,11 +1249,11 @@ template <class T, class E> struct expected_default_ctor_base<T, E, false> {
|
||||||
|
};
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
-template <class E> class bad_expected_access : public std::exception {
|
||||||
|
+template <class E> class bad_expected_access {
|
||||||
|
public:
|
||||||
|
explicit bad_expected_access(E e) : m_val(std::move(e)) {}
|
||||||
|
|
||||||
|
- virtual const char *what() const noexcept override {
|
||||||
|
+ virtual const char *what() const noexcept {
|
||||||
|
return "Bad expected access";
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
diff --git a/include/tl/optional.hpp b/include/tl/optional.hpp
|
||||||
|
index e9c59c2..1ff3d4a 100644
|
||||||
|
--- a/include/tl/optional.hpp
|
||||||
|
+++ b/include/tl/optional.hpp
|
||||||
|
@@ -21,7 +21,6 @@
|
||||||
|
#define TL_OPTIONAL_VERSION_MINOR 1
|
||||||
|
#define TL_OPTIONAL_VERSION_PATCH 0
|
||||||
|
|
||||||
|
-#include <exception>
|
||||||
|
#include <functional>
|
||||||
|
#include <new>
|
||||||
|
#include <type_traits>
|
||||||
|
@@ -664,7 +663,7 @@ struct nullopt_t {
|
||||||
|
static constexpr nullopt_t nullopt{nullopt_t::do_not_use{},
|
||||||
|
nullopt_t::do_not_use{}};
|
||||||
|
|
||||||
|
-class bad_optional_access : public std::exception {
|
||||||
|
+class bad_optional_access {
|
||||||
|
public:
|
||||||
|
bad_optional_access() = default;
|
||||||
|
const char *what() const noexcept { return "Optional has no value"; }
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
Solderpad Hardware License v2.1
|
||||||
|
|
||||||
|
This license operates as a wraparound license to the Apache License Version 2.0 (the “Apache License”) and incorporates the terms and conditions of the Apache License (which can be found here: http://apache.org/licenses/LICENSE-2.0), with the following additions and modifications. It must be read in conjunction with the Apache License. Section 1 below modifies definitions and terminology in the Apache License and Section 2 below replaces Section 2 of the Apache License. The Appendix replaces the Appendix in the Apache License. You may, at your option, choose to treat any Work released under this license as released under the Apache License (thus ignoring all sections written below entirely).
|
||||||
|
|
||||||
|
1. Terminology in the Apache License is supplemented or modified as follows:
|
||||||
|
|
||||||
|
“Authorship”: any reference to ‘authorship’ shall be taken to read “authorship or design”.
|
||||||
|
|
||||||
|
“Copyright owner”: any reference to ‘copyright owner’ shall be taken to read “Rights owner”.
|
||||||
|
|
||||||
|
“Copyright statement”: the reference to ‘copyright statement’ shall be taken to read ‘copyright or other statement pertaining to Rights’.
|
||||||
|
|
||||||
|
The following new definition shall be added to the Definitions section of the Apache License:
|
||||||
|
|
||||||
|
“Rights” means copyright and any similar right including design right (whether registered or unregistered), rights in semiconductor topographies (mask works) and database rights (but excluding Patents and Trademarks).
|
||||||
|
|
||||||
|
The following definitions shall replace the corresponding definitions in the Apache License:
|
||||||
|
|
||||||
|
“License” shall mean this Solderpad Hardware License version 2.1, being the terms and conditions for use, manufacture, instantiation, adaptation, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
“Licensor” shall mean the owner of the Rights or entity authorized by the owner of the Rights that is granting the License.
|
||||||
|
|
||||||
|
“Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship or design. For the purposes of this License, Derivative Works shall not include works that remain reversibly separable from, or merely link (or bind by name) or physically connect to or interoperate with the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
“Object” form shall mean any form resulting from mechanical transformation or translation of a Source form or the application of a Source form to physical material, including but not limited to compiled object code, generated documentation, the instantiation of a hardware design or physical object or material and conversions to other media types, including intermediate forms such as bytecodes, FPGA bitstreams, moulds, artwork and semiconductor topographies (mask works).
|
||||||
|
|
||||||
|
“Source” form shall mean the preferred form for making modifications, including but not limited to source code, net lists, board layouts, CAD files, documentation source, and configuration files.
|
||||||
|
|
||||||
|
“Work” shall mean the work of authorship or design, whether in Source or Object form, made available under the License, as indicated by a notice relating to Rights that is included in or attached to the work (an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
2. Grant of License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license under the Rights to reproduce, prepare Derivative Works of, make, adapt, repair, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form and do anything in relation to the Work as if the Rights did not exist.
|
||||||
|
|
||||||
|
APPENDIX
|
||||||
|
|
||||||
|
Copyright 2023 Allen Hill
|
||||||
|
SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
|
||||||
|
Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file except in compliance with the License, or, at your option, the Apache License version 2.0. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
https://solderpad.org/licenses/SHL-2.1/
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, any work distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
(footprint "LOGO" (version 20221018) (generator pcbnew)
|
||||||
|
(layer "F.Cu")
|
||||||
|
(fp_text reference "G***" (at 0 2.65176) (layer "F.SilkS") hide
|
||||||
|
(effects (font (size 0.22606 0.22606) (thickness 0.04318)))
|
||||||
|
(tstamp f5008734-4f8c-480e-9150-6066c4d15e62)
|
||||||
|
)
|
||||||
|
(fp_text value "LOGO" (at 0 -2.65176) (layer "F.SilkS") hide
|
||||||
|
(effects (font (size 0.22606 0.22606) (thickness 0.04318)))
|
||||||
|
(tstamp d485c02f-25a5-4145-a68b-5c44bbcce627)
|
||||||
|
)
|
||||||
|
(fp_poly
|
||||||
|
(pts
|
||||||
|
(xy -1.51384 2.24536)
|
||||||
|
(xy -1.48844 2.23012)
|
||||||
|
(xy -1.43002 2.19456)
|
||||||
|
(xy -1.3462 2.13868)
|
||||||
|
(xy -1.24714 2.07264)
|
||||||
|
(xy -1.14808 2.0066)
|
||||||
|
(xy -1.0668 1.95326)
|
||||||
|
(xy -1.01092 1.91516)
|
||||||
|
(xy -0.98552 1.90246)
|
||||||
|
(xy -0.97282 1.90754)
|
||||||
|
(xy -0.9271 1.9304)
|
||||||
|
(xy -0.85852 1.96596)
|
||||||
|
(xy -0.81788 1.98628)
|
||||||
|
(xy -0.75692 2.01168)
|
||||||
|
(xy -0.7239 2.0193)
|
||||||
|
(xy -0.71882 2.00914)
|
||||||
|
(xy -0.69596 1.96088)
|
||||||
|
(xy -0.6604 1.8796)
|
||||||
|
(xy -0.61468 1.77038)
|
||||||
|
(xy -0.5588 1.64338)
|
||||||
|
(xy -0.50292 1.50876)
|
||||||
|
(xy -0.4445 1.36906)
|
||||||
|
(xy -0.38862 1.23444)
|
||||||
|
(xy -0.34036 1.11506)
|
||||||
|
(xy -0.29972 1.01854)
|
||||||
|
(xy -0.27432 0.94996)
|
||||||
|
(xy -0.26416 0.92202)
|
||||||
|
(xy -0.2667 0.9144)
|
||||||
|
(xy -0.29972 0.88392)
|
||||||
|
(xy -0.35306 0.84328)
|
||||||
|
(xy -0.47244 0.74676)
|
||||||
|
(xy -0.58928 0.60198)
|
||||||
|
(xy -0.6604 0.43688)
|
||||||
|
(xy -0.68326 0.25146)
|
||||||
|
(xy -0.66294 0.08128)
|
||||||
|
(xy -0.5969 -0.08128)
|
||||||
|
(xy -0.4826 -0.2286)
|
||||||
|
(xy -0.3429 -0.33782)
|
||||||
|
(xy -0.18034 -0.4064)
|
||||||
|
(xy 0 -0.42926)
|
||||||
|
(xy 0.17272 -0.40894)
|
||||||
|
(xy 0.34036 -0.3429)
|
||||||
|
(xy 0.48768 -0.23114)
|
||||||
|
(xy 0.55118 -0.16002)
|
||||||
|
(xy 0.63754 -0.01016)
|
||||||
|
(xy 0.6858 0.14732)
|
||||||
|
(xy 0.69088 0.18796)
|
||||||
|
(xy 0.68326 0.36322)
|
||||||
|
(xy 0.63246 0.5334)
|
||||||
|
(xy 0.53848 0.68326)
|
||||||
|
(xy 0.40894 0.80772)
|
||||||
|
(xy 0.3937 0.81788)
|
||||||
|
(xy 0.33528 0.8636)
|
||||||
|
(xy 0.29464 0.89408)
|
||||||
|
(xy 0.26416 0.91948)
|
||||||
|
(xy 0.48768 1.45796)
|
||||||
|
(xy 0.52324 1.54178)
|
||||||
|
(xy 0.5842 1.6891)
|
||||||
|
(xy 0.63754 1.8161)
|
||||||
|
(xy 0.68072 1.9177)
|
||||||
|
(xy 0.7112 1.98374)
|
||||||
|
(xy 0.7239 2.01168)
|
||||||
|
(xy 0.7239 2.01422)
|
||||||
|
(xy 0.74422 2.01676)
|
||||||
|
(xy 0.78486 2.00152)
|
||||||
|
(xy 0.86106 1.96596)
|
||||||
|
(xy 0.90932 1.94056)
|
||||||
|
(xy 0.96774 1.91262)
|
||||||
|
(xy 0.99314 1.90246)
|
||||||
|
(xy 1.016 1.91516)
|
||||||
|
(xy 1.06934 1.95072)
|
||||||
|
(xy 1.15062 2.00406)
|
||||||
|
(xy 1.24714 2.06756)
|
||||||
|
(xy 1.33858 2.13106)
|
||||||
|
(xy 1.4224 2.18694)
|
||||||
|
(xy 1.48336 2.22504)
|
||||||
|
(xy 1.51384 2.24282)
|
||||||
|
(xy 1.51892 2.24282)
|
||||||
|
(xy 1.54432 2.22758)
|
||||||
|
(xy 1.59258 2.18694)
|
||||||
|
(xy 1.66624 2.11836)
|
||||||
|
(xy 1.77038 2.01422)
|
||||||
|
(xy 1.78562 1.99898)
|
||||||
|
(xy 1.87198 1.91262)
|
||||||
|
(xy 1.94056 1.83896)
|
||||||
|
(xy 1.98628 1.78816)
|
||||||
|
(xy 2.00406 1.7653)
|
||||||
|
(xy 1.98882 1.73482)
|
||||||
|
(xy 1.95072 1.67386)
|
||||||
|
(xy 1.89484 1.5875)
|
||||||
|
(xy 1.82626 1.48844)
|
||||||
|
(xy 1.64846 1.22936)
|
||||||
|
(xy 1.74498 0.98552)
|
||||||
|
(xy 1.77546 0.90932)
|
||||||
|
(xy 1.81356 0.82042)
|
||||||
|
(xy 1.8415 0.75438)
|
||||||
|
(xy 1.85674 0.72644)
|
||||||
|
(xy 1.88214 0.71628)
|
||||||
|
(xy 1.95072 0.70104)
|
||||||
|
(xy 2.04724 0.68072)
|
||||||
|
(xy 2.16154 0.6604)
|
||||||
|
(xy 2.2733 0.64008)
|
||||||
|
(xy 2.37236 0.61976)
|
||||||
|
(xy 2.44348 0.60706)
|
||||||
|
(xy 2.4765 0.59944)
|
||||||
|
(xy 2.48412 0.59436)
|
||||||
|
(xy 2.49174 0.57912)
|
||||||
|
(xy 2.49428 0.5461)
|
||||||
|
(xy 2.49682 0.48514)
|
||||||
|
(xy 2.49936 0.39116)
|
||||||
|
(xy 2.49936 0.25146)
|
||||||
|
(xy 2.49936 0.23622)
|
||||||
|
(xy 2.49682 0.10668)
|
||||||
|
(xy 2.49428 0)
|
||||||
|
(xy 2.49174 -0.06604)
|
||||||
|
(xy 2.48666 -0.09398)
|
||||||
|
(xy 2.45618 -0.1016)
|
||||||
|
(xy 2.38506 -0.11684)
|
||||||
|
(xy 2.286 -0.13462)
|
||||||
|
(xy 2.16662 -0.15748)
|
||||||
|
(xy 2.159 -0.16002)
|
||||||
|
(xy 2.04216 -0.18288)
|
||||||
|
(xy 1.9431 -0.2032)
|
||||||
|
(xy 1.87198 -0.21844)
|
||||||
|
(xy 1.84404 -0.2286)
|
||||||
|
(xy 1.83642 -0.23622)
|
||||||
|
(xy 1.81356 -0.28194)
|
||||||
|
(xy 1.78054 -0.3556)
|
||||||
|
(xy 1.7399 -0.4445)
|
||||||
|
(xy 1.7018 -0.53848)
|
||||||
|
(xy 1.66878 -0.6223)
|
||||||
|
(xy 1.64592 -0.68326)
|
||||||
|
(xy 1.6383 -0.7112)
|
||||||
|
(xy 1.64084 -0.71374)
|
||||||
|
(xy 1.65862 -0.74168)
|
||||||
|
(xy 1.69926 -0.80264)
|
||||||
|
(xy 1.75514 -0.88646)
|
||||||
|
(xy 1.82372 -0.98806)
|
||||||
|
(xy 1.8288 -0.99568)
|
||||||
|
(xy 1.89738 -1.09474)
|
||||||
|
(xy 1.95326 -1.1811)
|
||||||
|
(xy 1.98882 -1.23952)
|
||||||
|
(xy 2.00406 -1.26746)
|
||||||
|
(xy 2.00406 -1.27)
|
||||||
|
(xy 1.9812 -1.30048)
|
||||||
|
(xy 1.9304 -1.35636)
|
||||||
|
(xy 1.85674 -1.43256)
|
||||||
|
(xy 1.77038 -1.52146)
|
||||||
|
(xy 1.74244 -1.54686)
|
||||||
|
(xy 1.64338 -1.64338)
|
||||||
|
(xy 1.57734 -1.70434)
|
||||||
|
(xy 1.53416 -1.73736)
|
||||||
|
(xy 1.51384 -1.74498)
|
||||||
|
(xy 1.48336 -1.7272)
|
||||||
|
(xy 1.41986 -1.68656)
|
||||||
|
(xy 1.33604 -1.62814)
|
||||||
|
(xy 1.23444 -1.55956)
|
||||||
|
(xy 1.22682 -1.55448)
|
||||||
|
(xy 1.12776 -1.4859)
|
||||||
|
(xy 1.04394 -1.43002)
|
||||||
|
(xy 0.98552 -1.38938)
|
||||||
|
(xy 0.95758 -1.37414)
|
||||||
|
(xy 0.95504 -1.37414)
|
||||||
|
(xy 0.9144 -1.38684)
|
||||||
|
(xy 0.84328 -1.41224)
|
||||||
|
(xy 0.75438 -1.44526)
|
||||||
|
(xy 0.66294 -1.48336)
|
||||||
|
(xy 0.57912 -1.51892)
|
||||||
|
(xy 0.51562 -1.54686)
|
||||||
|
(xy 0.48514 -1.56464)
|
||||||
|
(xy 0.47498 -1.6002)
|
||||||
|
(xy 0.4572 -1.6764)
|
||||||
|
(xy 0.43688 -1.778)
|
||||||
|
(xy 0.41148 -1.89992)
|
||||||
|
(xy 0.40894 -1.92024)
|
||||||
|
(xy 0.38608 -2.03962)
|
||||||
|
(xy 0.3683 -2.13868)
|
||||||
|
(xy 0.35306 -2.20726)
|
||||||
|
(xy 0.34544 -2.2352)
|
||||||
|
(xy 0.3302 -2.23774)
|
||||||
|
(xy 0.27178 -2.24282)
|
||||||
|
(xy 0.18288 -2.24536)
|
||||||
|
(xy 0.07366 -2.24536)
|
||||||
|
(xy -0.0381 -2.24536)
|
||||||
|
(xy -0.14732 -2.24282)
|
||||||
|
(xy -0.2413 -2.24028)
|
||||||
|
(xy -0.30988 -2.2352)
|
||||||
|
(xy -0.33782 -2.23012)
|
||||||
|
(xy -0.33782 -2.22758)
|
||||||
|
(xy -0.34798 -2.18948)
|
||||||
|
(xy -0.36576 -2.11582)
|
||||||
|
(xy -0.38608 -2.01168)
|
||||||
|
(xy -0.40894 -1.88976)
|
||||||
|
(xy -0.41402 -1.8669)
|
||||||
|
(xy -0.43688 -1.75006)
|
||||||
|
(xy -0.4572 -1.651)
|
||||||
|
(xy -0.4699 -1.58496)
|
||||||
|
(xy -0.47752 -1.55702)
|
||||||
|
(xy -0.49022 -1.55194)
|
||||||
|
(xy -0.53848 -1.53162)
|
||||||
|
(xy -0.61722 -1.4986)
|
||||||
|
(xy -0.71628 -1.45796)
|
||||||
|
(xy -0.94488 -1.36652)
|
||||||
|
(xy -1.22682 -1.55702)
|
||||||
|
(xy -1.25222 -1.5748)
|
||||||
|
(xy -1.35382 -1.64338)
|
||||||
|
(xy -1.4351 -1.69926)
|
||||||
|
(xy -1.49352 -1.73736)
|
||||||
|
(xy -1.51638 -1.75006)
|
||||||
|
(xy -1.51892 -1.75006)
|
||||||
|
(xy -1.54686 -1.72466)
|
||||||
|
(xy -1.60274 -1.67132)
|
||||||
|
(xy -1.67894 -1.59766)
|
||||||
|
(xy -1.76784 -1.5113)
|
||||||
|
(xy -1.83134 -1.44526)
|
||||||
|
(xy -1.91008 -1.36652)
|
||||||
|
(xy -1.95834 -1.31318)
|
||||||
|
(xy -1.98628 -1.28016)
|
||||||
|
(xy -1.9939 -1.25984)
|
||||||
|
(xy -1.99136 -1.2446)
|
||||||
|
(xy -1.97358 -1.21666)
|
||||||
|
(xy -1.93294 -1.1557)
|
||||||
|
(xy -1.87452 -1.06934)
|
||||||
|
(xy -1.80594 -0.97028)
|
||||||
|
(xy -1.75006 -0.88646)
|
||||||
|
(xy -1.6891 -0.79248)
|
||||||
|
(xy -1.651 -0.72644)
|
||||||
|
(xy -1.63576 -0.69342)
|
||||||
|
(xy -1.64084 -0.68072)
|
||||||
|
(xy -1.65862 -0.62484)
|
||||||
|
(xy -1.69418 -0.54102)
|
||||||
|
(xy -1.73482 -0.44196)
|
||||||
|
(xy -1.83388 -0.22098)
|
||||||
|
(xy -1.97866 -0.19304)
|
||||||
|
(xy -2.06756 -0.17526)
|
||||||
|
(xy -2.18948 -0.1524)
|
||||||
|
(xy -2.30886 -0.12954)
|
||||||
|
(xy -2.49174 -0.09398)
|
||||||
|
(xy -2.49936 0.58166)
|
||||||
|
(xy -2.47142 0.59436)
|
||||||
|
(xy -2.44348 0.60198)
|
||||||
|
(xy -2.3749 0.61722)
|
||||||
|
(xy -2.27838 0.63754)
|
||||||
|
(xy -2.16154 0.65786)
|
||||||
|
(xy -2.06502 0.67564)
|
||||||
|
(xy -1.96596 0.69596)
|
||||||
|
(xy -1.89484 0.70866)
|
||||||
|
(xy -1.86436 0.71628)
|
||||||
|
(xy -1.8542 0.72644)
|
||||||
|
(xy -1.83134 0.7747)
|
||||||
|
(xy -1.79578 0.8509)
|
||||||
|
(xy -1.75514 0.94234)
|
||||||
|
(xy -1.71704 1.03632)
|
||||||
|
(xy -1.68148 1.12522)
|
||||||
|
(xy -1.65862 1.19126)
|
||||||
|
(xy -1.64846 1.22428)
|
||||||
|
(xy -1.66116 1.25222)
|
||||||
|
(xy -1.69926 1.31064)
|
||||||
|
(xy -1.7526 1.39192)
|
||||||
|
(xy -1.82118 1.49098)
|
||||||
|
(xy -1.88722 1.5875)
|
||||||
|
(xy -1.94564 1.67132)
|
||||||
|
(xy -1.98374 1.73228)
|
||||||
|
(xy -2.00152 1.76022)
|
||||||
|
(xy -1.99136 1.778)
|
||||||
|
(xy -1.95326 1.82626)
|
||||||
|
(xy -1.8796 1.90246)
|
||||||
|
(xy -1.76784 2.01168)
|
||||||
|
(xy -1.75006 2.02946)
|
||||||
|
(xy -1.6637 2.11328)
|
||||||
|
(xy -1.59004 2.18186)
|
||||||
|
(xy -1.5367 2.22758)
|
||||||
|
(xy -1.51384 2.24536)
|
||||||
|
)
|
||||||
|
|
||||||
|
(stroke (width 0.00254) (type solid)) (fill solid) (layer "F.SilkS") (tstamp 52e078f1-f855-4e08-8c35-aff7775e153a))
|
||||||
|
)
|
||||||
@@ -0,0 +1,293 @@
|
|||||||
|
PCBNEW-LibModule-V1
|
||||||
|
$INDEX
|
||||||
|
LOGO
|
||||||
|
$EndINDEX
|
||||||
|
#
|
||||||
|
# LOGO
|
||||||
|
# pixmap w = 400, h = 400
|
||||||
|
#
|
||||||
|
$MODULE LOGO
|
||||||
|
Po 0 0 0 15 00000000 00000000 ~~
|
||||||
|
Li LOGO
|
||||||
|
T0 0 1044 89 89 0 17 N I 21 N "G***"
|
||||||
|
T1 0 -1044 89 89 0 17 N I 21 N "LOGO"
|
||||||
|
DP 0 0 0 0 277 1 21
|
||||||
|
Dl -596 884
|
||||||
|
Dl -586 878
|
||||||
|
Dl -563 864
|
||||||
|
Dl -530 842
|
||||||
|
Dl -491 816
|
||||||
|
Dl -452 790
|
||||||
|
Dl -420 769
|
||||||
|
Dl -398 754
|
||||||
|
Dl -388 749
|
||||||
|
Dl -383 751
|
||||||
|
Dl -365 760
|
||||||
|
Dl -338 774
|
||||||
|
Dl -322 782
|
||||||
|
Dl -298 792
|
||||||
|
Dl -285 795
|
||||||
|
Dl -283 791
|
||||||
|
Dl -274 772
|
||||||
|
Dl -260 740
|
||||||
|
Dl -242 697
|
||||||
|
Dl -220 647
|
||||||
|
Dl -198 594
|
||||||
|
Dl -175 539
|
||||||
|
Dl -153 486
|
||||||
|
Dl -134 439
|
||||||
|
Dl -118 401
|
||||||
|
Dl -108 374
|
||||||
|
Dl -104 363
|
||||||
|
Dl -105 360
|
||||||
|
Dl -118 348
|
||||||
|
Dl -139 332
|
||||||
|
Dl -186 294
|
||||||
|
Dl -232 237
|
||||||
|
Dl -260 172
|
||||||
|
Dl -269 99
|
||||||
|
Dl -261 32
|
||||||
|
Dl -235 -32
|
||||||
|
Dl -190 -90
|
||||||
|
Dl -135 -133
|
||||||
|
Dl -71 -160
|
||||||
|
Dl 0 -169
|
||||||
|
Dl 68 -161
|
||||||
|
Dl 134 -135
|
||||||
|
Dl 192 -91
|
||||||
|
Dl 217 -63
|
||||||
|
Dl 251 -4
|
||||||
|
Dl 270 58
|
||||||
|
Dl 272 74
|
||||||
|
Dl 269 143
|
||||||
|
Dl 249 210
|
||||||
|
Dl 212 269
|
||||||
|
Dl 161 318
|
||||||
|
Dl 155 322
|
||||||
|
Dl 132 340
|
||||||
|
Dl 116 352
|
||||||
|
Dl 104 362
|
||||||
|
Dl 192 574
|
||||||
|
Dl 206 607
|
||||||
|
Dl 230 665
|
||||||
|
Dl 251 715
|
||||||
|
Dl 268 755
|
||||||
|
Dl 280 781
|
||||||
|
Dl 285 792
|
||||||
|
Dl 285 793
|
||||||
|
Dl 293 794
|
||||||
|
Dl 309 788
|
||||||
|
Dl 339 774
|
||||||
|
Dl 358 764
|
||||||
|
Dl 381 753
|
||||||
|
Dl 391 749
|
||||||
|
Dl 400 754
|
||||||
|
Dl 421 768
|
||||||
|
Dl 453 789
|
||||||
|
Dl 491 814
|
||||||
|
Dl 527 839
|
||||||
|
Dl 560 861
|
||||||
|
Dl 584 876
|
||||||
|
Dl 596 883
|
||||||
|
Dl 598 883
|
||||||
|
Dl 608 877
|
||||||
|
Dl 627 861
|
||||||
|
Dl 656 834
|
||||||
|
Dl 697 793
|
||||||
|
Dl 703 787
|
||||||
|
Dl 737 753
|
||||||
|
Dl 764 724
|
||||||
|
Dl 782 704
|
||||||
|
Dl 789 695
|
||||||
|
Dl 789 695
|
||||||
|
Dl 783 683
|
||||||
|
Dl 768 659
|
||||||
|
Dl 746 625
|
||||||
|
Dl 719 586
|
||||||
|
Dl 649 484
|
||||||
|
Dl 687 388
|
||||||
|
Dl 699 358
|
||||||
|
Dl 714 323
|
||||||
|
Dl 725 297
|
||||||
|
Dl 731 286
|
||||||
|
Dl 741 282
|
||||||
|
Dl 768 276
|
||||||
|
Dl 806 268
|
||||||
|
Dl 851 260
|
||||||
|
Dl 895 252
|
||||||
|
Dl 934 244
|
||||||
|
Dl 962 239
|
||||||
|
Dl 975 236
|
||||||
|
Dl 978 234
|
||||||
|
Dl 981 228
|
||||||
|
Dl 982 215
|
||||||
|
Dl 983 191
|
||||||
|
Dl 984 154
|
||||||
|
Dl 984 99
|
||||||
|
Dl 984 93
|
||||||
|
Dl 983 42
|
||||||
|
Dl 982 0
|
||||||
|
Dl 981 -26
|
||||||
|
Dl 979 -37
|
||||||
|
Dl 979 -37
|
||||||
|
Dl 967 -40
|
||||||
|
Dl 939 -46
|
||||||
|
Dl 900 -53
|
||||||
|
Dl 853 -62
|
||||||
|
Dl 850 -63
|
||||||
|
Dl 804 -72
|
||||||
|
Dl 765 -80
|
||||||
|
Dl 737 -86
|
||||||
|
Dl 726 -90
|
||||||
|
Dl 723 -93
|
||||||
|
Dl 714 -111
|
||||||
|
Dl 701 -140
|
||||||
|
Dl 685 -175
|
||||||
|
Dl 670 -212
|
||||||
|
Dl 657 -245
|
||||||
|
Dl 648 -269
|
||||||
|
Dl 645 -280
|
||||||
|
Dl 646 -281
|
||||||
|
Dl 653 -292
|
||||||
|
Dl 669 -316
|
||||||
|
Dl 691 -349
|
||||||
|
Dl 718 -389
|
||||||
|
Dl 720 -392
|
||||||
|
Dl 747 -431
|
||||||
|
Dl 769 -465
|
||||||
|
Dl 783 -488
|
||||||
|
Dl 789 -499
|
||||||
|
Dl 789 -500
|
||||||
|
Dl 780 -512
|
||||||
|
Dl 760 -534
|
||||||
|
Dl 731 -564
|
||||||
|
Dl 697 -599
|
||||||
|
Dl 686 -609
|
||||||
|
Dl 647 -647
|
||||||
|
Dl 621 -671
|
||||||
|
Dl 604 -684
|
||||||
|
Dl 596 -687
|
||||||
|
Dl 596 -687
|
||||||
|
Dl 584 -680
|
||||||
|
Dl 559 -664
|
||||||
|
Dl 526 -641
|
||||||
|
Dl 486 -614
|
||||||
|
Dl 483 -612
|
||||||
|
Dl 444 -585
|
||||||
|
Dl 411 -563
|
||||||
|
Dl 388 -547
|
||||||
|
Dl 377 -541
|
||||||
|
Dl 376 -541
|
||||||
|
Dl 360 -546
|
||||||
|
Dl 332 -556
|
||||||
|
Dl 297 -569
|
||||||
|
Dl 261 -584
|
||||||
|
Dl 228 -598
|
||||||
|
Dl 203 -609
|
||||||
|
Dl 191 -616
|
||||||
|
Dl 191 -616
|
||||||
|
Dl 187 -630
|
||||||
|
Dl 180 -660
|
||||||
|
Dl 172 -700
|
||||||
|
Dl 162 -748
|
||||||
|
Dl 161 -756
|
||||||
|
Dl 152 -803
|
||||||
|
Dl 145 -842
|
||||||
|
Dl 139 -869
|
||||||
|
Dl 136 -880
|
||||||
|
Dl 130 -881
|
||||||
|
Dl 107 -883
|
||||||
|
Dl 72 -884
|
||||||
|
Dl 29 -884
|
||||||
|
Dl -15 -884
|
||||||
|
Dl -58 -883
|
||||||
|
Dl -95 -882
|
||||||
|
Dl -122 -880
|
||||||
|
Dl -133 -878
|
||||||
|
Dl -133 -877
|
||||||
|
Dl -137 -862
|
||||||
|
Dl -144 -833
|
||||||
|
Dl -152 -792
|
||||||
|
Dl -161 -744
|
||||||
|
Dl -163 -735
|
||||||
|
Dl -172 -689
|
||||||
|
Dl -180 -650
|
||||||
|
Dl -185 -624
|
||||||
|
Dl -188 -613
|
||||||
|
Dl -193 -611
|
||||||
|
Dl -212 -603
|
||||||
|
Dl -243 -590
|
||||||
|
Dl -282 -574
|
||||||
|
Dl -372 -538
|
||||||
|
Dl -483 -613
|
||||||
|
Dl -493 -620
|
||||||
|
Dl -533 -647
|
||||||
|
Dl -565 -669
|
||||||
|
Dl -588 -684
|
||||||
|
Dl -597 -689
|
||||||
|
Dl -598 -689
|
||||||
|
Dl -609 -679
|
||||||
|
Dl -631 -658
|
||||||
|
Dl -661 -629
|
||||||
|
Dl -696 -595
|
||||||
|
Dl -721 -569
|
||||||
|
Dl -752 -538
|
||||||
|
Dl -771 -517
|
||||||
|
Dl -782 -504
|
||||||
|
Dl -785 -496
|
||||||
|
Dl -784 -490
|
||||||
|
Dl -777 -479
|
||||||
|
Dl -761 -455
|
||||||
|
Dl -738 -421
|
||||||
|
Dl -711 -382
|
||||||
|
Dl -689 -349
|
||||||
|
Dl -665 -312
|
||||||
|
Dl -650 -286
|
||||||
|
Dl -644 -273
|
||||||
|
Dl -646 -268
|
||||||
|
Dl -653 -246
|
||||||
|
Dl -667 -213
|
||||||
|
Dl -683 -174
|
||||||
|
Dl -722 -87
|
||||||
|
Dl -779 -76
|
||||||
|
Dl -814 -69
|
||||||
|
Dl -862 -60
|
||||||
|
Dl -909 -51
|
||||||
|
Dl -981 -37
|
||||||
|
Dl -984 229
|
||||||
|
Dl -973 234
|
||||||
|
Dl -962 237
|
||||||
|
Dl -935 243
|
||||||
|
Dl -897 251
|
||||||
|
Dl -851 259
|
||||||
|
Dl -813 266
|
||||||
|
Dl -774 274
|
||||||
|
Dl -746 279
|
||||||
|
Dl -734 282
|
||||||
|
Dl -730 286
|
||||||
|
Dl -721 305
|
||||||
|
Dl -707 335
|
||||||
|
Dl -691 371
|
||||||
|
Dl -676 408
|
||||||
|
Dl -662 443
|
||||||
|
Dl -653 469
|
||||||
|
Dl -649 482
|
||||||
|
Dl -654 493
|
||||||
|
Dl -669 516
|
||||||
|
Dl -690 548
|
||||||
|
Dl -717 587
|
||||||
|
Dl -743 625
|
||||||
|
Dl -766 658
|
||||||
|
Dl -781 682
|
||||||
|
Dl -788 693
|
||||||
|
Dl -784 700
|
||||||
|
Dl -769 719
|
||||||
|
Dl -740 749
|
||||||
|
Dl -696 792
|
||||||
|
Dl -689 799
|
||||||
|
Dl -655 832
|
||||||
|
Dl -626 859
|
||||||
|
Dl -605 877
|
||||||
|
Dl -596 884
|
||||||
|
$EndMODULE LOGO
|
||||||
|
$EndLIBRARY
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Hardware
|
||||||
|
|
||||||
|
## Cable harness
|
||||||
|
|
||||||
|
I ordered a [cable harness](https://www.amazon.com/dp/B01EUZ8CFU) from Amazon to acquire the head-unit side connector. I then cut the male end off a DB9 cable and connected the wires according to the following cable harness diagram:
|
||||||
|
|
||||||
|

|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
EESchema-LIBRARY Version 2.3
|
||||||
|
#encoding utf-8
|
||||||
|
#(c) SnapEDA 2016 (snapeda.com)
|
||||||
|
#This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA) with Design Exception 1.0
|
||||||
|
#
|
||||||
|
# SJ-43514
|
||||||
|
#
|
||||||
|
DEF SJ-43514 J 0 40 Y N 1 L N
|
||||||
|
F0 "J" -300 330 50 H V L BNN
|
||||||
|
F1 "SJ-43514" -300 -400 50 H V L BNN
|
||||||
|
F2 "CUI_SJ-43514" 0 0 50 H I L BNN
|
||||||
|
F3 "" 0 0 50 H I L BNN
|
||||||
|
F4 "CUI INC" 0 0 50 H I L BNN "MANUFACTURER"
|
||||||
|
F5 "1.04" 0 0 50 H I L BNN "PART_REV"
|
||||||
|
F6 "MANUFACTURER RECOMMENDATIONS" 0 0 50 H I L BNN "STANDARD"
|
||||||
|
DRAW
|
||||||
|
P 2 0 0 10 -240 85 -240 -95 N
|
||||||
|
P 2 0 0 10 -240 -95 -160 -95 N
|
||||||
|
P 2 0 0 10 -160 -95 -160 85 N
|
||||||
|
P 2 0 0 10 -160 85 -240 85 N
|
||||||
|
P 2 0 0 10 -90 200 -40 130 N
|
||||||
|
P 2 0 0 10 -40 130 10 200 N
|
||||||
|
P 2 0 0 10 85 -100 300 -100 N
|
||||||
|
P 2 0 0 10 -15 -100 35 -30 N
|
||||||
|
P 2 0 0 10 35 -30 85 -100 N
|
||||||
|
P 2 0 0 10 15 200 300 200 N
|
||||||
|
P 2 0 0 10 195 100 300 100 N
|
||||||
|
P 2 0 0 10 95 100 145 40 N
|
||||||
|
P 2 0 0 10 145 40 195 100 N
|
||||||
|
P 2 0 0 10 -200 -100 -200 -200 N
|
||||||
|
P 2 0 0 10 -200 -200 300 -200 N
|
||||||
|
S -300 -300 300 300 0 0 10 f
|
||||||
|
X ~ 4 400 200 100 L 40 40 0 0 P
|
||||||
|
X ~ 1 400 -200 100 L 40 40 0 0 P
|
||||||
|
X ~ 2 400 100 100 L 40 40 0 0 P
|
||||||
|
X ~ 3 400 -100 100 L 40 40 0 0 P
|
||||||
|
ENDDRAW
|
||||||
|
ENDDEF
|
||||||
|
#
|
||||||
|
# End Library
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
Id Description Qty Unit Designators
|
||||||
|
1 Cable, 9 x 24 AWG 1.5 ft W1
|
||||||
|
2 Connector, CN701, female, 11 pins 1 Y1
|
||||||
|
3 Connector, D-Sub, female, 9 pins 1 X1
|
||||||
|
@@ -0,0 +1,403 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"><head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="generator" content="WireViz 0.4.1 - https://github.com/wireviz/WireViz">
|
||||||
|
<title>harness</title>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
#bom table, th, td {
|
||||||
|
border: 1px solid black;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bom th, td {
|
||||||
|
padding: 4px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bom_col_qty {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head><body style="font-family:arial;background-color:#ffffff">
|
||||||
|
<h1>harness</h1>
|
||||||
|
<h2>Diagram</h2>
|
||||||
|
|
||||||
|
<div id="description">
|
||||||
|
<!-- %description% -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="diagram">
|
||||||
|
<!-- XML and DOCTYPE declarations from SVG file removed -->
|
||||||
|
<!-- Generated by graphviz version 2.43.0 (0)
|
||||||
|
-->
|
||||||
|
<!-- Title: %3 Pages: 1 -->
|
||||||
|
<svg width="935pt" height="340pt"
|
||||||
|
viewBox="0.00 0.00 935.00 340.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 336)">
|
||||||
|
<title>%3</title>
|
||||||
|
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-336 931,-336 931,4 -4,4"/>
|
||||||
|
<!-- X1 -->
|
||||||
|
<g id="node1" class="node">
|
||||||
|
<title>X1</title>
|
||||||
|
<polygon fill="#ffffff" stroke="black" points="136,-296.5 0,-296.5 0,-43.5 136,-43.5 136,-296.5"/>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-273 0,-296 136,-296 136,-273 0,-273"/>
|
||||||
|
<text text-anchor="start" x="59.5" y="-280.8" font-family="arial" font-size="14.00">X1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-250 0,-273 47,-273 47,-250 0,-250"/>
|
||||||
|
<text text-anchor="start" x="4" y="-257.8" font-family="arial" font-size="14.00">D-Sub</text>
|
||||||
|
<polygon fill="none" stroke="black" points="47,-250 47,-273 97,-273 97,-250 47,-250"/>
|
||||||
|
<text text-anchor="start" x="51" y="-257.8" font-family="arial" font-size="14.00">female</text>
|
||||||
|
<polygon fill="none" stroke="black" points="97,-250 97,-273 136,-273 136,-250 97,-250"/>
|
||||||
|
<text text-anchor="start" x="101" y="-257.8" font-family="arial" font-size="14.00">9-pin</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-227 0,-250 84,-250 84,-227 0,-227"/>
|
||||||
|
<text text-anchor="start" x="25.5" y="-234.8" font-family="arial" font-size="14.00">+12V</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-227 84,-250 136,-250 136,-227 84,-227"/>
|
||||||
|
<text text-anchor="start" x="106" y="-234.8" font-family="arial" font-size="14.00">1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-204 0,-227 84,-227 84,-204 0,-204"/>
|
||||||
|
<text text-anchor="start" x="29" y="-211.8" font-family="arial" font-size="14.00">TX+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-204 84,-227 136,-227 136,-204 84,-204"/>
|
||||||
|
<text text-anchor="start" x="106" y="-211.8" font-family="arial" font-size="14.00">2</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-181 0,-204 84,-204 84,-181 0,-181"/>
|
||||||
|
<text text-anchor="start" x="26.5" y="-188.8" font-family="arial" font-size="14.00">GND</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-181 84,-204 136,-204 136,-181 84,-181"/>
|
||||||
|
<text text-anchor="start" x="106" y="-188.8" font-family="arial" font-size="14.00">3</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-158 0,-181 84,-181 84,-158 0,-158"/>
|
||||||
|
<text text-anchor="start" x="34.5" y="-165.8" font-family="arial" font-size="14.00">R-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-158 84,-181 136,-181 136,-158 84,-158"/>
|
||||||
|
<text text-anchor="start" x="106" y="-165.8" font-family="arial" font-size="14.00">4</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-135 0,-158 84,-158 84,-135 0,-135"/>
|
||||||
|
<text text-anchor="start" x="32.5" y="-142.8" font-family="arial" font-size="14.00">R+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-135 84,-158 136,-158 136,-135 84,-135"/>
|
||||||
|
<text text-anchor="start" x="106" y="-142.8" font-family="arial" font-size="14.00">5</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-112 0,-135 84,-135 84,-112 0,-112"/>
|
||||||
|
<text text-anchor="start" x="22" y="-119.8" font-family="arial" font-size="14.00">MUTE</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-112 84,-135 136,-135 136,-112 84,-112"/>
|
||||||
|
<text text-anchor="start" x="106" y="-119.8" font-family="arial" font-size="14.00">6</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-89 0,-112 84,-112 84,-89 0,-89"/>
|
||||||
|
<text text-anchor="start" x="31" y="-96.8" font-family="arial" font-size="14.00">TX-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-89 84,-112 136,-112 136,-89 84,-89"/>
|
||||||
|
<text text-anchor="start" x="106" y="-96.8" font-family="arial" font-size="14.00">7</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-66 0,-89 84,-89 84,-66 0,-66"/>
|
||||||
|
<text text-anchor="start" x="35.5" y="-73.8" font-family="arial" font-size="14.00">L-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-66 84,-89 136,-89 136,-66 84,-66"/>
|
||||||
|
<text text-anchor="start" x="106" y="-73.8" font-family="arial" font-size="14.00">8</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-43 0,-66 84,-66 84,-43 0,-43"/>
|
||||||
|
<text text-anchor="start" x="34" y="-50.8" font-family="arial" font-size="14.00">L+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-43 84,-66 136,-66 136,-43 84,-43"/>
|
||||||
|
<text text-anchor="start" x="106" y="-50.8" font-family="arial" font-size="14.00">9</text>
|
||||||
|
</g>
|
||||||
|
<!-- W1 -->
|
||||||
|
<g id="node3" class="node">
|
||||||
|
<title>W1</title>
|
||||||
|
<polygon fill="#ffffff" stroke="black" points="637,-332 280,-332 280,0 637,0 637,-332"/>
|
||||||
|
<polygon fill="none" stroke="black" points="280.5,-309 280.5,-332 637.5,-332 637.5,-309 280.5,-309"/>
|
||||||
|
<text text-anchor="start" x="448" y="-316.8" font-family="arial" font-size="14.00">W1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="280.5,-286 280.5,-309 382.5,-309 382.5,-286 280.5,-286"/>
|
||||||
|
<text text-anchor="start" x="324" y="-293.8" font-family="arial" font-size="14.00">9x</text>
|
||||||
|
<polygon fill="none" stroke="black" points="382.5,-286 382.5,-309 520.5,-309 520.5,-286 382.5,-286"/>
|
||||||
|
<text text-anchor="start" x="425.5" y="-293.8" font-family="arial" font-size="14.00">24 AWG</text>
|
||||||
|
<polygon fill="none" stroke="black" points="520.5,-286 520.5,-309 637.5,-309 637.5,-286 520.5,-286"/>
|
||||||
|
<text text-anchor="start" x="563.5" y="-293.8" font-family="arial" font-size="14.00">1.5 ft</text>
|
||||||
|
<text text-anchor="start" x="338.5" y="-272.8" font-family="arial" font-size="14.00"> </text>
|
||||||
|
<text text-anchor="start" x="308.5" y="-253.8" font-family="arial" font-size="14.00">X1:1:+12V</text>
|
||||||
|
<text text-anchor="start" x="427" y="-253.8" font-family="arial" font-size="14.00">     1:RD    </text>
|
||||||
|
<text text-anchor="start" x="546" y="-253.8" font-family="arial" font-size="14.00">Y1:5:+12V</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-246 280.5,-248 637.5,-248 637.5,-246 280.5,-246"/>
|
||||||
|
<polygon fill="#ff0000" stroke="transparent" points="280.5,-244 280.5,-246 637.5,-246 637.5,-244 280.5,-244"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-242 280.5,-244 637.5,-244 637.5,-242 280.5,-242"/>
|
||||||
|
<text text-anchor="start" x="311.5" y="-228.8" font-family="arial" font-size="14.00">X1:2:TX+</text>
|
||||||
|
<text text-anchor="start" x="425" y="-228.8" font-family="arial" font-size="14.00">     2:WH    </text>
|
||||||
|
<text text-anchor="start" x="545.5" y="-228.8" font-family="arial" font-size="14.00">Y1:10:TX+</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-221 280.5,-223 637.5,-223 637.5,-221 280.5,-221"/>
|
||||||
|
<polygon fill="#ffffff" stroke="transparent" points="280.5,-219 280.5,-221 637.5,-221 637.5,-219 280.5,-219"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-217 280.5,-219 637.5,-219 637.5,-217 280.5,-217"/>
|
||||||
|
<text text-anchor="start" x="309" y="-203.8" font-family="arial" font-size="14.00">X1:3:GND</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-203.8" font-family="arial" font-size="14.00">     3:YE    </text>
|
||||||
|
<text text-anchor="start" x="546.5" y="-203.8" font-family="arial" font-size="14.00">Y1:8:GND</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-196 280.5,-198 637.5,-198 637.5,-196 280.5,-196"/>
|
||||||
|
<polygon fill="#ffff00" stroke="transparent" points="280.5,-194 280.5,-196 637.5,-196 637.5,-194 280.5,-194"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-192 280.5,-194 637.5,-194 637.5,-192 280.5,-192"/>
|
||||||
|
<text text-anchor="start" x="317.5" y="-178.8" font-family="arial" font-size="14.00">X1:4:R-</text>
|
||||||
|
<text text-anchor="start" x="426" y="-178.8" font-family="arial" font-size="14.00">     4:GN    </text>
|
||||||
|
<text text-anchor="start" x="555" y="-178.8" font-family="arial" font-size="14.00">Y1:6:R-</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-171 280.5,-173 637.5,-173 637.5,-171 280.5,-171"/>
|
||||||
|
<polygon fill="#00ff00" stroke="transparent" points="280.5,-169 280.5,-171 637.5,-171 637.5,-169 280.5,-169"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-167 280.5,-169 637.5,-169 637.5,-167 280.5,-167"/>
|
||||||
|
<text text-anchor="start" x="315.5" y="-153.8" font-family="arial" font-size="14.00">X1:5:R+</text>
|
||||||
|
<text text-anchor="start" x="425.5" y="-153.8" font-family="arial" font-size="14.00">     5:OG    </text>
|
||||||
|
<text text-anchor="start" x="553" y="-153.8" font-family="arial" font-size="14.00">Y1:1:R+</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-146 280.5,-148 637.5,-148 637.5,-146 280.5,-146"/>
|
||||||
|
<polygon fill="#ff8000" stroke="transparent" points="280.5,-144 280.5,-146 637.5,-146 637.5,-144 280.5,-144"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-142 280.5,-144 637.5,-144 637.5,-142 280.5,-142"/>
|
||||||
|
<text text-anchor="start" x="305" y="-128.8" font-family="arial" font-size="14.00">X1:6:MUTE</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-128.8" font-family="arial" font-size="14.00">     6:BU    </text>
|
||||||
|
<text text-anchor="start" x="542.5" y="-128.8" font-family="arial" font-size="14.00">Y1:4:MUTE</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-121 280.5,-123 637.5,-123 637.5,-121 280.5,-121"/>
|
||||||
|
<polygon fill="#0066ff" stroke="transparent" points="280.5,-119 280.5,-121 637.5,-121 637.5,-119 280.5,-119"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-117 280.5,-119 637.5,-119 637.5,-117 280.5,-117"/>
|
||||||
|
<text text-anchor="start" x="313.5" y="-103.8" font-family="arial" font-size="14.00">X1:7:TX-</text>
|
||||||
|
<text text-anchor="start" x="428" y="-103.8" font-family="arial" font-size="14.00">     7:VT    </text>
|
||||||
|
<text text-anchor="start" x="551" y="-103.8" font-family="arial" font-size="14.00">Y1:9:TX-</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-96 280.5,-98 637.5,-98 637.5,-96 280.5,-96"/>
|
||||||
|
<polygon fill="#8000ff" stroke="transparent" points="280.5,-94 280.5,-96 637.5,-96 637.5,-94 280.5,-94"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-92 280.5,-94 637.5,-94 637.5,-92 280.5,-92"/>
|
||||||
|
<text text-anchor="start" x="318.5" y="-78.8" font-family="arial" font-size="14.00">X1:8:L-</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-78.8" font-family="arial" font-size="14.00">     8:BN    </text>
|
||||||
|
<text text-anchor="start" x="556" y="-78.8" font-family="arial" font-size="14.00">Y1:7:L-</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-71 280.5,-73 637.5,-73 637.5,-71 280.5,-71"/>
|
||||||
|
<polygon fill="#895956" stroke="transparent" points="280.5,-69 280.5,-71 637.5,-71 637.5,-69 280.5,-69"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-67 280.5,-69 637.5,-69 637.5,-67 280.5,-67"/>
|
||||||
|
<text text-anchor="start" x="316.5" y="-53.8" font-family="arial" font-size="14.00">X1:9:L+</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-53.8" font-family="arial" font-size="14.00">     9:BK    </text>
|
||||||
|
<text text-anchor="start" x="554" y="-53.8" font-family="arial" font-size="14.00">Y1:2:L+</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-46 280.5,-48 637.5,-48 637.5,-46 280.5,-46"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-44 280.5,-46 637.5,-46 637.5,-44 280.5,-44"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-42 280.5,-44 637.5,-44 637.5,-42 280.5,-42"/>
|
||||||
|
<text text-anchor="start" x="338.5" y="-28.8" font-family="arial" font-size="14.00"> </text>
|
||||||
|
<polygon fill="none" stroke="black" points="280.5,0 280.5,-23 637.5,-23 637.5,0 280.5,0"/>
|
||||||
|
<text text-anchor="start" x="284.5" y="-7.8" font-family="arial" font-size="14.00">(colors of DSub cable; colors of CN701 harness may vary)</text>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge1" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-237C200.76,-237.13 216.65,-243.13 280,-243"/>
|
||||||
|
<path fill="none" stroke="#ff0000" stroke-width="2" d="M136,-239C200.06,-239 215.94,-245 280,-245"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-241C199.35,-240.87 215.24,-246.87 280,-247"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge3" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-214C200.51,-214.06 216.46,-218.06 280,-218"/>
|
||||||
|
<path fill="none" stroke="#ffffff" stroke-width="2" d="M136,-216C200.02,-216 215.98,-220 280,-220"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-218C199.54,-217.94 215.49,-221.94 280,-222"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge5" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-191C200.25,-191.02 216.24,-193.02 280,-193"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M136,-193C200.01,-193 215.99,-195 280,-195"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-195C199.76,-194.98 215.75,-196.98 280,-197"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge7" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-167C200.13,-167 216.12,-168 280,-168"/>
|
||||||
|
<path fill="none" stroke="#00ff00" stroke-width="2" d="M136,-169C200,-169 216,-170 280,-170"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-171C199.88,-171 215.87,-172 280,-172"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge9" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-144C199.88,-144 215.87,-143 280,-143"/>
|
||||||
|
<path fill="none" stroke="#ff8000" stroke-width="2" d="M136,-146C200,-146 216,-145 280,-145"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-148C200.13,-148 216.12,-147 280,-147"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge11" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-121C199.64,-121.03 215.62,-118.03 280,-118"/>
|
||||||
|
<path fill="none" stroke="#0066ff" stroke-width="2" d="M136,-123C200.01,-123 215.99,-120 280,-120"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-125C200.38,-124.97 216.36,-121.97 280,-122"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge13" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-98C199.44,-98.09 215.36,-93.09 280,-93"/>
|
||||||
|
<path fill="none" stroke="#8000ff" stroke-width="2" d="M136,-100C200.04,-100 215.96,-95 280,-95"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-102C200.64,-101.91 216.56,-96.91 280,-97"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge15" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-75C199.27,-75.17 215.12,-68.17 280,-68"/>
|
||||||
|
<path fill="none" stroke="#895956" stroke-width="2" d="M136,-77C200.08,-77 215.92,-70 280,-70"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-79C200.88,-78.83 216.73,-71.83 280,-72"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge17" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-52C199.13,-52.26 214.88,-43.26 280,-43"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-54C200.12,-54 215.88,-45 280,-45"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-56C201.12,-55.74 216.87,-46.74 280,-47"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge19" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-191C200.25,-191.02 216.24,-193.02 280,-193"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M136,-193C200.01,-193 215.99,-195 280,-195"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-195C199.76,-194.98 215.75,-196.98 280,-197"/>
|
||||||
|
</g>
|
||||||
|
<!-- Y1 -->
|
||||||
|
<g id="node2" class="node">
|
||||||
|
<title>Y1</title>
|
||||||
|
<polygon fill="#ffffff" stroke="black" points="927,-317.5 781,-317.5 781,-18.5 927,-18.5 927,-317.5"/>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-294 781,-317 927,-317 927,-294 781,-294"/>
|
||||||
|
<text text-anchor="start" x="845.5" y="-301.8" font-family="arial" font-size="14.00">Y1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-271 781,-294 832,-294 832,-271 781,-271"/>
|
||||||
|
<text text-anchor="start" x="785" y="-278.8" font-family="arial" font-size="14.00">CN701</text>
|
||||||
|
<polygon fill="none" stroke="black" points="832,-271 832,-294 882,-294 882,-271 832,-271"/>
|
||||||
|
<text text-anchor="start" x="836" y="-278.8" font-family="arial" font-size="14.00">female</text>
|
||||||
|
<polygon fill="none" stroke="black" points="882,-271 882,-294 927,-294 927,-271 882,-271"/>
|
||||||
|
<text text-anchor="start" x="886" y="-278.8" font-family="arial" font-size="14.00">11-pin</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-248 781,-271 842,-271 842,-248 781,-248"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-255.8" font-family="arial" font-size="14.00">1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-248 842,-271 927,-271 927,-248 842,-248"/>
|
||||||
|
<text text-anchor="start" x="875" y="-255.8" font-family="arial" font-size="14.00">R+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-225 781,-248 842,-248 842,-225 781,-225"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-232.8" font-family="arial" font-size="14.00">2</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-225 842,-248 927,-248 927,-225 842,-225"/>
|
||||||
|
<text text-anchor="start" x="876.5" y="-232.8" font-family="arial" font-size="14.00">L+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-202 781,-225 842,-225 842,-202 781,-202"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-209.8" font-family="arial" font-size="14.00">3</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-202 842,-225 927,-225 927,-202 842,-202"/>
|
||||||
|
<text text-anchor="start" x="864.5" y="-209.8" font-family="arial" font-size="14.00">SGND</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-179 781,-202 842,-202 842,-179 781,-179"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-186.8" font-family="arial" font-size="14.00">4</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-179 842,-202 927,-202 927,-179 842,-179"/>
|
||||||
|
<text text-anchor="start" x="864.5" y="-186.8" font-family="arial" font-size="14.00">MUTE</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-156 781,-179 842,-179 842,-156 781,-156"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-163.8" font-family="arial" font-size="14.00">5</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-156 842,-179 927,-179 927,-156 842,-156"/>
|
||||||
|
<text text-anchor="start" x="868" y="-163.8" font-family="arial" font-size="14.00">+12V</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-133 781,-156 842,-156 842,-133 781,-133"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-140.8" font-family="arial" font-size="14.00">6</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-133 842,-156 927,-156 927,-133 842,-133"/>
|
||||||
|
<text text-anchor="start" x="877" y="-140.8" font-family="arial" font-size="14.00">R-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-110 781,-133 842,-133 842,-110 781,-110"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-117.8" font-family="arial" font-size="14.00">7</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-110 842,-133 927,-133 927,-110 842,-110"/>
|
||||||
|
<text text-anchor="start" x="878" y="-117.8" font-family="arial" font-size="14.00">L-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-87 781,-110 842,-110 842,-87 781,-87"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-94.8" font-family="arial" font-size="14.00">8</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-87 842,-110 927,-110 927,-87 842,-87"/>
|
||||||
|
<text text-anchor="start" x="869" y="-94.8" font-family="arial" font-size="14.00">GND</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-64 781,-87 842,-87 842,-64 781,-64"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-71.8" font-family="arial" font-size="14.00">9</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-64 842,-87 927,-87 927,-64 842,-64"/>
|
||||||
|
<text text-anchor="start" x="873.5" y="-71.8" font-family="arial" font-size="14.00">TX-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-41 781,-64 842,-64 842,-41 781,-41"/>
|
||||||
|
<text text-anchor="start" x="803.5" y="-48.8" font-family="arial" font-size="14.00">10</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-41 842,-64 927,-64 927,-41 842,-41"/>
|
||||||
|
<text text-anchor="start" x="871.5" y="-48.8" font-family="arial" font-size="14.00">TX+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-18 781,-41 842,-41 842,-18 781,-18"/>
|
||||||
|
<text text-anchor="start" x="803.5" y="-25.8" font-family="arial" font-size="14.00">12</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-18 842,-41 927,-41 927,-18 842,-18"/>
|
||||||
|
<text text-anchor="start" x="870" y="-25.8" font-family="arial" font-size="14.00">ACC</text>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge2" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-243C707.79,-245.04 706.21,-167.04 781,-165"/>
|
||||||
|
<path fill="none" stroke="#ff0000" stroke-width="2" d="M637,-245C709.79,-245 708.21,-167 781,-167"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-247C711.79,-244.96 710.21,-166.96 781,-169"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge4" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-218C733.43,-220.6 680.75,-52.6 781,-50"/>
|
||||||
|
<path fill="none" stroke="#ffffff" stroke-width="2" d="M637,-220C735.34,-220 682.66,-52 781,-52"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-222C737.25,-219.4 684.57,-51.4 781,-54"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge6" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-193C712.18,-195.21 701.85,-98.21 781,-96"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M637,-195C714.17,-195 703.83,-98 781,-98"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-197C716.15,-194.79 705.82,-97.79 781,-100"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge8" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-168C700.27,-169.06 714.2,-143.06 781,-142"/>
|
||||||
|
<path fill="none" stroke="#00ff00" stroke-width="2" d="M637,-170C702.03,-170 715.97,-144 781,-144"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-172C703.8,-170.94 717.73,-144.94 781,-146"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge10" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-143C720.88,-145.34 701.07,-260.34 781,-258"/>
|
||||||
|
<path fill="none" stroke="#ff8000" stroke-width="2" d="M637,-145C718.9,-145 699.1,-260 781,-260"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-147C716.93,-144.66 697.12,-259.66 781,-262"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge12" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-118C710.36,-119.96 711.64,-190.96 781,-189"/>
|
||||||
|
<path fill="none" stroke="#0066ff" stroke-width="2" d="M637,-120C708.36,-120 709.64,-191 781,-191"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-122C706.36,-120.04 707.64,-191.04 781,-193"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge14" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-93C700.01,-93.81 714.78,-73.81 781,-73"/>
|
||||||
|
<path fill="none" stroke="#8000ff" stroke-width="2" d="M637,-95C701.61,-95 716.39,-75 781,-75"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-97C703.22,-96.19 717.99,-76.19 781,-77"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge16" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-68C706.87,-69.68 715.08,-120.68 781,-119"/>
|
||||||
|
<path fill="none" stroke="#895956" stroke-width="2" d="M637,-70C704.9,-70 713.1,-121 781,-121"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-72C702.92,-70.32 711.13,-121.32 781,-123"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge18" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-43C745.55,-45.68 676.21,-237.68 781,-235"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-45C743.67,-45 674.33,-237 781,-237"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-47C741.79,-44.32 672.45,-236.32 781,-239"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge20" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-193C703.13,-193.77 718.02,-212.77 781,-212"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M637,-195C701.55,-195 716.45,-214 781,-214"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-197C699.98,-196.23 714.87,-215.23 781,-216"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="notes">
|
||||||
|
<!-- %notes% -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>Bill of Materials</h2>
|
||||||
|
|
||||||
|
<div id="bom">
|
||||||
|
<table class="bom">
|
||||||
|
<tr>
|
||||||
|
<th class="bom_col_id">Id</th>
|
||||||
|
<th class="bom_col_description">Description</th>
|
||||||
|
<th class="bom_col_qty">Qty</th>
|
||||||
|
<th class="bom_col_unit">Unit</th>
|
||||||
|
<th class="bom_col_designators">Designators</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="bom_col_id">1</td>
|
||||||
|
<td class="bom_col_description">Cable, 9 x 24 AWG</td>
|
||||||
|
<td class="bom_col_qty">1.5</td>
|
||||||
|
<td class="bom_col_unit">ft</td>
|
||||||
|
<td class="bom_col_designators">W1</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="bom_col_id">2</td>
|
||||||
|
<td class="bom_col_description">Connector, CN701, female, 11 pins</td>
|
||||||
|
<td class="bom_col_qty">1</td>
|
||||||
|
<td class="bom_col_unit"></td>
|
||||||
|
<td class="bom_col_designators">Y1</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="bom_col_id">3</td>
|
||||||
|
<td class="bom_col_description">Connector, D-Sub, female, 9 pins</td>
|
||||||
|
<td class="bom_col_qty">1</td>
|
||||||
|
<td class="bom_col_unit"></td>
|
||||||
|
<td class="bom_col_designators">X1</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body></html>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
@@ -0,0 +1,330 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<!-- Generated by graphviz version 2.43.0 (0)
|
||||||
|
-->
|
||||||
|
<!-- Title: %3 Pages: 1 -->
|
||||||
|
<svg width="935pt" height="340pt"
|
||||||
|
viewBox="0.00 0.00 935.00 340.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 336)">
|
||||||
|
<title>%3</title>
|
||||||
|
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-336 931,-336 931,4 -4,4"/>
|
||||||
|
<!-- X1 -->
|
||||||
|
<g id="node1" class="node">
|
||||||
|
<title>X1</title>
|
||||||
|
<polygon fill="#ffffff" stroke="black" points="136,-296.5 0,-296.5 0,-43.5 136,-43.5 136,-296.5"/>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-273 0,-296 136,-296 136,-273 0,-273"/>
|
||||||
|
<text text-anchor="start" x="59.5" y="-280.8" font-family="arial" font-size="14.00">X1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-250 0,-273 47,-273 47,-250 0,-250"/>
|
||||||
|
<text text-anchor="start" x="4" y="-257.8" font-family="arial" font-size="14.00">D-Sub</text>
|
||||||
|
<polygon fill="none" stroke="black" points="47,-250 47,-273 97,-273 97,-250 47,-250"/>
|
||||||
|
<text text-anchor="start" x="51" y="-257.8" font-family="arial" font-size="14.00">female</text>
|
||||||
|
<polygon fill="none" stroke="black" points="97,-250 97,-273 136,-273 136,-250 97,-250"/>
|
||||||
|
<text text-anchor="start" x="101" y="-257.8" font-family="arial" font-size="14.00">9-pin</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-227 0,-250 84,-250 84,-227 0,-227"/>
|
||||||
|
<text text-anchor="start" x="25.5" y="-234.8" font-family="arial" font-size="14.00">+12V</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-227 84,-250 136,-250 136,-227 84,-227"/>
|
||||||
|
<text text-anchor="start" x="106" y="-234.8" font-family="arial" font-size="14.00">1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-204 0,-227 84,-227 84,-204 0,-204"/>
|
||||||
|
<text text-anchor="start" x="29" y="-211.8" font-family="arial" font-size="14.00">TX+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-204 84,-227 136,-227 136,-204 84,-204"/>
|
||||||
|
<text text-anchor="start" x="106" y="-211.8" font-family="arial" font-size="14.00">2</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-181 0,-204 84,-204 84,-181 0,-181"/>
|
||||||
|
<text text-anchor="start" x="26.5" y="-188.8" font-family="arial" font-size="14.00">GND</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-181 84,-204 136,-204 136,-181 84,-181"/>
|
||||||
|
<text text-anchor="start" x="106" y="-188.8" font-family="arial" font-size="14.00">3</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-158 0,-181 84,-181 84,-158 0,-158"/>
|
||||||
|
<text text-anchor="start" x="34.5" y="-165.8" font-family="arial" font-size="14.00">R-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-158 84,-181 136,-181 136,-158 84,-158"/>
|
||||||
|
<text text-anchor="start" x="106" y="-165.8" font-family="arial" font-size="14.00">4</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-135 0,-158 84,-158 84,-135 0,-135"/>
|
||||||
|
<text text-anchor="start" x="32.5" y="-142.8" font-family="arial" font-size="14.00">R+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-135 84,-158 136,-158 136,-135 84,-135"/>
|
||||||
|
<text text-anchor="start" x="106" y="-142.8" font-family="arial" font-size="14.00">5</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-112 0,-135 84,-135 84,-112 0,-112"/>
|
||||||
|
<text text-anchor="start" x="22" y="-119.8" font-family="arial" font-size="14.00">MUTE</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-112 84,-135 136,-135 136,-112 84,-112"/>
|
||||||
|
<text text-anchor="start" x="106" y="-119.8" font-family="arial" font-size="14.00">6</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-89 0,-112 84,-112 84,-89 0,-89"/>
|
||||||
|
<text text-anchor="start" x="31" y="-96.8" font-family="arial" font-size="14.00">TX-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-89 84,-112 136,-112 136,-89 84,-89"/>
|
||||||
|
<text text-anchor="start" x="106" y="-96.8" font-family="arial" font-size="14.00">7</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-66 0,-89 84,-89 84,-66 0,-66"/>
|
||||||
|
<text text-anchor="start" x="35.5" y="-73.8" font-family="arial" font-size="14.00">L-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-66 84,-89 136,-89 136,-66 84,-66"/>
|
||||||
|
<text text-anchor="start" x="106" y="-73.8" font-family="arial" font-size="14.00">8</text>
|
||||||
|
<polygon fill="none" stroke="black" points="0,-43 0,-66 84,-66 84,-43 0,-43"/>
|
||||||
|
<text text-anchor="start" x="34" y="-50.8" font-family="arial" font-size="14.00">L+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="84,-43 84,-66 136,-66 136,-43 84,-43"/>
|
||||||
|
<text text-anchor="start" x="106" y="-50.8" font-family="arial" font-size="14.00">9</text>
|
||||||
|
</g>
|
||||||
|
<!-- W1 -->
|
||||||
|
<g id="node3" class="node">
|
||||||
|
<title>W1</title>
|
||||||
|
<polygon fill="#ffffff" stroke="black" points="637,-332 280,-332 280,0 637,0 637,-332"/>
|
||||||
|
<polygon fill="none" stroke="black" points="280.5,-309 280.5,-332 637.5,-332 637.5,-309 280.5,-309"/>
|
||||||
|
<text text-anchor="start" x="448" y="-316.8" font-family="arial" font-size="14.00">W1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="280.5,-286 280.5,-309 382.5,-309 382.5,-286 280.5,-286"/>
|
||||||
|
<text text-anchor="start" x="324" y="-293.8" font-family="arial" font-size="14.00">9x</text>
|
||||||
|
<polygon fill="none" stroke="black" points="382.5,-286 382.5,-309 520.5,-309 520.5,-286 382.5,-286"/>
|
||||||
|
<text text-anchor="start" x="425.5" y="-293.8" font-family="arial" font-size="14.00">24 AWG</text>
|
||||||
|
<polygon fill="none" stroke="black" points="520.5,-286 520.5,-309 637.5,-309 637.5,-286 520.5,-286"/>
|
||||||
|
<text text-anchor="start" x="563.5" y="-293.8" font-family="arial" font-size="14.00">1.5 ft</text>
|
||||||
|
<text text-anchor="start" x="338.5" y="-272.8" font-family="arial" font-size="14.00"> </text>
|
||||||
|
<text text-anchor="start" x="308.5" y="-253.8" font-family="arial" font-size="14.00">X1:1:+12V</text>
|
||||||
|
<text text-anchor="start" x="427" y="-253.8" font-family="arial" font-size="14.00">     1:RD    </text>
|
||||||
|
<text text-anchor="start" x="546" y="-253.8" font-family="arial" font-size="14.00">Y1:5:+12V</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-246 280.5,-248 637.5,-248 637.5,-246 280.5,-246"/>
|
||||||
|
<polygon fill="#ff0000" stroke="transparent" points="280.5,-244 280.5,-246 637.5,-246 637.5,-244 280.5,-244"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-242 280.5,-244 637.5,-244 637.5,-242 280.5,-242"/>
|
||||||
|
<text text-anchor="start" x="311.5" y="-228.8" font-family="arial" font-size="14.00">X1:2:TX+</text>
|
||||||
|
<text text-anchor="start" x="425" y="-228.8" font-family="arial" font-size="14.00">     2:WH    </text>
|
||||||
|
<text text-anchor="start" x="545.5" y="-228.8" font-family="arial" font-size="14.00">Y1:10:TX+</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-221 280.5,-223 637.5,-223 637.5,-221 280.5,-221"/>
|
||||||
|
<polygon fill="#ffffff" stroke="transparent" points="280.5,-219 280.5,-221 637.5,-221 637.5,-219 280.5,-219"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-217 280.5,-219 637.5,-219 637.5,-217 280.5,-217"/>
|
||||||
|
<text text-anchor="start" x="309" y="-203.8" font-family="arial" font-size="14.00">X1:3:GND</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-203.8" font-family="arial" font-size="14.00">     3:YE    </text>
|
||||||
|
<text text-anchor="start" x="546.5" y="-203.8" font-family="arial" font-size="14.00">Y1:8:GND</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-196 280.5,-198 637.5,-198 637.5,-196 280.5,-196"/>
|
||||||
|
<polygon fill="#ffff00" stroke="transparent" points="280.5,-194 280.5,-196 637.5,-196 637.5,-194 280.5,-194"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-192 280.5,-194 637.5,-194 637.5,-192 280.5,-192"/>
|
||||||
|
<text text-anchor="start" x="317.5" y="-178.8" font-family="arial" font-size="14.00">X1:4:R-</text>
|
||||||
|
<text text-anchor="start" x="426" y="-178.8" font-family="arial" font-size="14.00">     4:GN    </text>
|
||||||
|
<text text-anchor="start" x="555" y="-178.8" font-family="arial" font-size="14.00">Y1:6:R-</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-171 280.5,-173 637.5,-173 637.5,-171 280.5,-171"/>
|
||||||
|
<polygon fill="#00ff00" stroke="transparent" points="280.5,-169 280.5,-171 637.5,-171 637.5,-169 280.5,-169"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-167 280.5,-169 637.5,-169 637.5,-167 280.5,-167"/>
|
||||||
|
<text text-anchor="start" x="315.5" y="-153.8" font-family="arial" font-size="14.00">X1:5:R+</text>
|
||||||
|
<text text-anchor="start" x="425.5" y="-153.8" font-family="arial" font-size="14.00">     5:OG    </text>
|
||||||
|
<text text-anchor="start" x="553" y="-153.8" font-family="arial" font-size="14.00">Y1:1:R+</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-146 280.5,-148 637.5,-148 637.5,-146 280.5,-146"/>
|
||||||
|
<polygon fill="#ff8000" stroke="transparent" points="280.5,-144 280.5,-146 637.5,-146 637.5,-144 280.5,-144"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-142 280.5,-144 637.5,-144 637.5,-142 280.5,-142"/>
|
||||||
|
<text text-anchor="start" x="305" y="-128.8" font-family="arial" font-size="14.00">X1:6:MUTE</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-128.8" font-family="arial" font-size="14.00">     6:BU    </text>
|
||||||
|
<text text-anchor="start" x="542.5" y="-128.8" font-family="arial" font-size="14.00">Y1:4:MUTE</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-121 280.5,-123 637.5,-123 637.5,-121 280.5,-121"/>
|
||||||
|
<polygon fill="#0066ff" stroke="transparent" points="280.5,-119 280.5,-121 637.5,-121 637.5,-119 280.5,-119"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-117 280.5,-119 637.5,-119 637.5,-117 280.5,-117"/>
|
||||||
|
<text text-anchor="start" x="313.5" y="-103.8" font-family="arial" font-size="14.00">X1:7:TX-</text>
|
||||||
|
<text text-anchor="start" x="428" y="-103.8" font-family="arial" font-size="14.00">     7:VT    </text>
|
||||||
|
<text text-anchor="start" x="551" y="-103.8" font-family="arial" font-size="14.00">Y1:9:TX-</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-96 280.5,-98 637.5,-98 637.5,-96 280.5,-96"/>
|
||||||
|
<polygon fill="#8000ff" stroke="transparent" points="280.5,-94 280.5,-96 637.5,-96 637.5,-94 280.5,-94"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-92 280.5,-94 637.5,-94 637.5,-92 280.5,-92"/>
|
||||||
|
<text text-anchor="start" x="318.5" y="-78.8" font-family="arial" font-size="14.00">X1:8:L-</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-78.8" font-family="arial" font-size="14.00">     8:BN    </text>
|
||||||
|
<text text-anchor="start" x="556" y="-78.8" font-family="arial" font-size="14.00">Y1:7:L-</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-71 280.5,-73 637.5,-73 637.5,-71 280.5,-71"/>
|
||||||
|
<polygon fill="#895956" stroke="transparent" points="280.5,-69 280.5,-71 637.5,-71 637.5,-69 280.5,-69"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-67 280.5,-69 637.5,-69 637.5,-67 280.5,-67"/>
|
||||||
|
<text text-anchor="start" x="316.5" y="-53.8" font-family="arial" font-size="14.00">X1:9:L+</text>
|
||||||
|
<text text-anchor="start" x="427.5" y="-53.8" font-family="arial" font-size="14.00">     9:BK    </text>
|
||||||
|
<text text-anchor="start" x="554" y="-53.8" font-family="arial" font-size="14.00">Y1:2:L+</text>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-46 280.5,-48 637.5,-48 637.5,-46 280.5,-46"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-44 280.5,-46 637.5,-46 637.5,-44 280.5,-44"/>
|
||||||
|
<polygon fill="#000000" stroke="transparent" points="280.5,-42 280.5,-44 637.5,-44 637.5,-42 280.5,-42"/>
|
||||||
|
<text text-anchor="start" x="338.5" y="-28.8" font-family="arial" font-size="14.00"> </text>
|
||||||
|
<polygon fill="none" stroke="black" points="280.5,0 280.5,-23 637.5,-23 637.5,0 280.5,0"/>
|
||||||
|
<text text-anchor="start" x="284.5" y="-7.8" font-family="arial" font-size="14.00">(colors of DSub cable; colors of CN701 harness may vary)</text>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge1" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-237C200.76,-237.13 216.65,-243.13 280,-243"/>
|
||||||
|
<path fill="none" stroke="#ff0000" stroke-width="2" d="M136,-239C200.06,-239 215.94,-245 280,-245"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-241C199.35,-240.87 215.24,-246.87 280,-247"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge3" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-214C200.51,-214.06 216.46,-218.06 280,-218"/>
|
||||||
|
<path fill="none" stroke="#ffffff" stroke-width="2" d="M136,-216C200.02,-216 215.98,-220 280,-220"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-218C199.54,-217.94 215.49,-221.94 280,-222"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge5" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-191C200.25,-191.02 216.24,-193.02 280,-193"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M136,-193C200.01,-193 215.99,-195 280,-195"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-195C199.76,-194.98 215.75,-196.98 280,-197"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge7" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-167C200.13,-167 216.12,-168 280,-168"/>
|
||||||
|
<path fill="none" stroke="#00ff00" stroke-width="2" d="M136,-169C200,-169 216,-170 280,-170"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-171C199.88,-171 215.87,-172 280,-172"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge9" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-144C199.88,-144 215.87,-143 280,-143"/>
|
||||||
|
<path fill="none" stroke="#ff8000" stroke-width="2" d="M136,-146C200,-146 216,-145 280,-145"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-148C200.13,-148 216.12,-147 280,-147"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge11" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-121C199.64,-121.03 215.62,-118.03 280,-118"/>
|
||||||
|
<path fill="none" stroke="#0066ff" stroke-width="2" d="M136,-123C200.01,-123 215.99,-120 280,-120"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-125C200.38,-124.97 216.36,-121.97 280,-122"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge13" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-98C199.44,-98.09 215.36,-93.09 280,-93"/>
|
||||||
|
<path fill="none" stroke="#8000ff" stroke-width="2" d="M136,-100C200.04,-100 215.96,-95 280,-95"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-102C200.64,-101.91 216.56,-96.91 280,-97"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge15" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-75C199.27,-75.17 215.12,-68.17 280,-68"/>
|
||||||
|
<path fill="none" stroke="#895956" stroke-width="2" d="M136,-77C200.08,-77 215.92,-70 280,-70"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-79C200.88,-78.83 216.73,-71.83 280,-72"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge17" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-52C199.13,-52.26 214.88,-43.26 280,-43"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-54C200.12,-54 215.88,-45 280,-45"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-56C201.12,-55.74 216.87,-46.74 280,-47"/>
|
||||||
|
</g>
|
||||||
|
<!-- X1--W1 -->
|
||||||
|
<g id="edge19" class="edge">
|
||||||
|
<title>X1:e--W1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-191C200.25,-191.02 216.24,-193.02 280,-193"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M136,-193C200.01,-193 215.99,-195 280,-195"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M136,-195C199.76,-194.98 215.75,-196.98 280,-197"/>
|
||||||
|
</g>
|
||||||
|
<!-- Y1 -->
|
||||||
|
<g id="node2" class="node">
|
||||||
|
<title>Y1</title>
|
||||||
|
<polygon fill="#ffffff" stroke="black" points="927,-317.5 781,-317.5 781,-18.5 927,-18.5 927,-317.5"/>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-294 781,-317 927,-317 927,-294 781,-294"/>
|
||||||
|
<text text-anchor="start" x="845.5" y="-301.8" font-family="arial" font-size="14.00">Y1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-271 781,-294 832,-294 832,-271 781,-271"/>
|
||||||
|
<text text-anchor="start" x="785" y="-278.8" font-family="arial" font-size="14.00">CN701</text>
|
||||||
|
<polygon fill="none" stroke="black" points="832,-271 832,-294 882,-294 882,-271 832,-271"/>
|
||||||
|
<text text-anchor="start" x="836" y="-278.8" font-family="arial" font-size="14.00">female</text>
|
||||||
|
<polygon fill="none" stroke="black" points="882,-271 882,-294 927,-294 927,-271 882,-271"/>
|
||||||
|
<text text-anchor="start" x="886" y="-278.8" font-family="arial" font-size="14.00">11-pin</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-248 781,-271 842,-271 842,-248 781,-248"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-255.8" font-family="arial" font-size="14.00">1</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-248 842,-271 927,-271 927,-248 842,-248"/>
|
||||||
|
<text text-anchor="start" x="875" y="-255.8" font-family="arial" font-size="14.00">R+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-225 781,-248 842,-248 842,-225 781,-225"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-232.8" font-family="arial" font-size="14.00">2</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-225 842,-248 927,-248 927,-225 842,-225"/>
|
||||||
|
<text text-anchor="start" x="876.5" y="-232.8" font-family="arial" font-size="14.00">L+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-202 781,-225 842,-225 842,-202 781,-202"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-209.8" font-family="arial" font-size="14.00">3</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-202 842,-225 927,-225 927,-202 842,-202"/>
|
||||||
|
<text text-anchor="start" x="864.5" y="-209.8" font-family="arial" font-size="14.00">SGND</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-179 781,-202 842,-202 842,-179 781,-179"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-186.8" font-family="arial" font-size="14.00">4</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-179 842,-202 927,-202 927,-179 842,-179"/>
|
||||||
|
<text text-anchor="start" x="864.5" y="-186.8" font-family="arial" font-size="14.00">MUTE</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-156 781,-179 842,-179 842,-156 781,-156"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-163.8" font-family="arial" font-size="14.00">5</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-156 842,-179 927,-179 927,-156 842,-156"/>
|
||||||
|
<text text-anchor="start" x="868" y="-163.8" font-family="arial" font-size="14.00">+12V</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-133 781,-156 842,-156 842,-133 781,-133"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-140.8" font-family="arial" font-size="14.00">6</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-133 842,-156 927,-156 927,-133 842,-133"/>
|
||||||
|
<text text-anchor="start" x="877" y="-140.8" font-family="arial" font-size="14.00">R-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-110 781,-133 842,-133 842,-110 781,-110"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-117.8" font-family="arial" font-size="14.00">7</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-110 842,-133 927,-133 927,-110 842,-110"/>
|
||||||
|
<text text-anchor="start" x="878" y="-117.8" font-family="arial" font-size="14.00">L-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-87 781,-110 842,-110 842,-87 781,-87"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-94.8" font-family="arial" font-size="14.00">8</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-87 842,-110 927,-110 927,-87 842,-87"/>
|
||||||
|
<text text-anchor="start" x="869" y="-94.8" font-family="arial" font-size="14.00">GND</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-64 781,-87 842,-87 842,-64 781,-64"/>
|
||||||
|
<text text-anchor="start" x="807.5" y="-71.8" font-family="arial" font-size="14.00">9</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-64 842,-87 927,-87 927,-64 842,-64"/>
|
||||||
|
<text text-anchor="start" x="873.5" y="-71.8" font-family="arial" font-size="14.00">TX-</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-41 781,-64 842,-64 842,-41 781,-41"/>
|
||||||
|
<text text-anchor="start" x="803.5" y="-48.8" font-family="arial" font-size="14.00">10</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-41 842,-64 927,-64 927,-41 842,-41"/>
|
||||||
|
<text text-anchor="start" x="871.5" y="-48.8" font-family="arial" font-size="14.00">TX+</text>
|
||||||
|
<polygon fill="none" stroke="black" points="781,-18 781,-41 842,-41 842,-18 781,-18"/>
|
||||||
|
<text text-anchor="start" x="803.5" y="-25.8" font-family="arial" font-size="14.00">12</text>
|
||||||
|
<polygon fill="none" stroke="black" points="842,-18 842,-41 927,-41 927,-18 842,-18"/>
|
||||||
|
<text text-anchor="start" x="870" y="-25.8" font-family="arial" font-size="14.00">ACC</text>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge2" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-243C707.79,-245.04 706.21,-167.04 781,-165"/>
|
||||||
|
<path fill="none" stroke="#ff0000" stroke-width="2" d="M637,-245C709.79,-245 708.21,-167 781,-167"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-247C711.79,-244.96 710.21,-166.96 781,-169"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge4" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-218C733.43,-220.6 680.75,-52.6 781,-50"/>
|
||||||
|
<path fill="none" stroke="#ffffff" stroke-width="2" d="M637,-220C735.34,-220 682.66,-52 781,-52"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-222C737.25,-219.4 684.57,-51.4 781,-54"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge6" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-193C712.18,-195.21 701.85,-98.21 781,-96"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M637,-195C714.17,-195 703.83,-98 781,-98"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-197C716.15,-194.79 705.82,-97.79 781,-100"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge8" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-168C700.27,-169.06 714.2,-143.06 781,-142"/>
|
||||||
|
<path fill="none" stroke="#00ff00" stroke-width="2" d="M637,-170C702.03,-170 715.97,-144 781,-144"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-172C703.8,-170.94 717.73,-144.94 781,-146"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge10" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-143C720.88,-145.34 701.07,-260.34 781,-258"/>
|
||||||
|
<path fill="none" stroke="#ff8000" stroke-width="2" d="M637,-145C718.9,-145 699.1,-260 781,-260"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-147C716.93,-144.66 697.12,-259.66 781,-262"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge12" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-118C710.36,-119.96 711.64,-190.96 781,-189"/>
|
||||||
|
<path fill="none" stroke="#0066ff" stroke-width="2" d="M637,-120C708.36,-120 709.64,-191 781,-191"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-122C706.36,-120.04 707.64,-191.04 781,-193"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge14" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-93C700.01,-93.81 714.78,-73.81 781,-73"/>
|
||||||
|
<path fill="none" stroke="#8000ff" stroke-width="2" d="M637,-95C701.61,-95 716.39,-75 781,-75"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-97C703.22,-96.19 717.99,-76.19 781,-77"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge16" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-68C706.87,-69.68 715.08,-120.68 781,-119"/>
|
||||||
|
<path fill="none" stroke="#895956" stroke-width="2" d="M637,-70C704.9,-70 713.1,-121 781,-121"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-72C702.92,-70.32 711.13,-121.32 781,-123"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge18" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-43C745.55,-45.68 676.21,-237.68 781,-235"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-45C743.67,-45 674.33,-237 781,-237"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-47C741.79,-44.32 672.45,-236.32 781,-239"/>
|
||||||
|
</g>
|
||||||
|
<!-- W1--Y1 -->
|
||||||
|
<g id="edge20" class="edge">
|
||||||
|
<title>W1:e--Y1:w</title>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-193C703.13,-193.77 718.02,-212.77 781,-212"/>
|
||||||
|
<path fill="none" stroke="#ffff00" stroke-width="2" d="M637,-195C701.55,-195 716.45,-214 781,-214"/>
|
||||||
|
<path fill="none" stroke="#000000" stroke-width="2" d="M637,-197C699.98,-196.23 714.87,-215.23 781,-216"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,26 @@
|
|||||||
|
connectors:
|
||||||
|
X1:
|
||||||
|
type: D-Sub
|
||||||
|
subtype: female
|
||||||
|
pinlabels: [+12V, TX+, GND, R-, R+, MUTE, TX-, L-, L+]
|
||||||
|
Y1:
|
||||||
|
type: CN701
|
||||||
|
subtype: female
|
||||||
|
pins: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12]
|
||||||
|
pinlabels: [R+, L+, SGND, MUTE, +12V, R-, L-, GND, TX-, TX+, ACC]
|
||||||
|
|
||||||
|
cables:
|
||||||
|
W1:
|
||||||
|
wirecount: 9
|
||||||
|
length: 1.5 ft
|
||||||
|
gauge: 24 AWG
|
||||||
|
colors: [RD, WH, YE, GN, OG, BU, VT, BN, BK]
|
||||||
|
notes: (colors of DSub cable; colors of CN701 harness may vary)
|
||||||
|
|
||||||
|
connections:
|
||||||
|
- - X1: [1-9]
|
||||||
|
- W1: [1-9]
|
||||||
|
- Y1: [5, 10, 8, 6, 1, 4, 9, 7, 2]
|
||||||
|
- - X1: 3
|
||||||
|
- W1: 3
|
||||||
|
- Y1: 3
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)
|
||||||
|
(symbol "XC6701" (in_bom yes) (on_board yes)
|
||||||
|
(property "Reference" "U" (at 0 5.08 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)
|
||||||
|
)
|
||||||
|
(property "Datasheet" "" (at 0 0 0)
|
||||||
|
(effects (font (size 1.27 1.27)) hide)
|
||||||
|
)
|
||||||
|
(symbol "XC6701_0_0"
|
||||||
|
(pin power_in line (at -8.89 1.27 0) (length 2.54)
|
||||||
|
(name "Vin" (effects (font (size 1.27 1.27))))
|
||||||
|
(number "1" (effects (font (size 1.27 1.27))))
|
||||||
|
)
|
||||||
|
(pin power_in line (at 0 -6.35 90) (length 2.54)
|
||||||
|
(name "GND" (effects (font (size 1.27 1.27))))
|
||||||
|
(number "2" (effects (font (size 1.27 1.27))))
|
||||||
|
)
|
||||||
|
(pin power_out line (at 8.89 1.27 180) (length 2.54)
|
||||||
|
(name "Vout" (effects (font (size 1.27 1.27))))
|
||||||
|
(number "3" (effects (font (size 1.27 1.27))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(symbol "XC6701_1_1"
|
||||||
|
(rectangle (start -6.35 3.81) (end 6.35 -3.81)
|
||||||
|
(stroke (width 0) (type default))
|
||||||
|
(fill (type background))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 189 KiB |
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,171 @@
|
|||||||
|
(footprint "CUI_SJ-43514" (version 20221018) (generator pcbnew)
|
||||||
|
(layer "F.Cu")
|
||||||
|
(attr through_hole)
|
||||||
|
(fp_text reference "REF**" (at -2.979703 -6.81327) (layer "F.SilkS")
|
||||||
|
(effects (font (size 0.480598 0.480598) (thickness 0.15)))
|
||||||
|
(tstamp bfeda05e-5925-424c-8f77-4d0de2d9f221)
|
||||||
|
)
|
||||||
|
(fp_text value "CUI_SJ-43514" (at -1.094318 6.206094) (layer "F.Fab")
|
||||||
|
(effects (font (size 0.480844 0.480844) (thickness 0.15)))
|
||||||
|
(tstamp bdc14a89-1821-43fc-a9f8-40f3b142a63d)
|
||||||
|
)
|
||||||
|
(fp_text user "PCB EDGE" (at -5.75332 8.5049) (layer "F.Fab")
|
||||||
|
(effects (font (size 0.480277 0.480277) (thickness 0.120069)))
|
||||||
|
(tstamp 6a88ca6f-a53e-4950-bbc8-44c4d11c2a0a)
|
||||||
|
)
|
||||||
|
(fp_line (start -8.5 -3) (end -5.5 -3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 0050636b-6e15-4ce3-9ac3-09473598b5da))
|
||||||
|
(fp_line (start -8.5 3) (end -8.5 -3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp ecac6353-2236-4d1a-834d-0a75abb5cee1))
|
||||||
|
(fp_line (start -5.5 -4.7) (end -5.5 -3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp bf6fd2e2-0049-48bb-a736-39561152d911))
|
||||||
|
(fp_line (start -5.5 -3) (end -5.5 -2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp dede3ff1-9dd4-49de-979e-95dfa9478423))
|
||||||
|
(fp_line (start -5.5 -2.25) (end -4.2 -2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 5eb5c318-7dc4-4e7f-989a-f4ba5dc0821f))
|
||||||
|
(fp_line (start -5.5 2.25) (end -5.5 3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 9013f407-26c3-41ed-8b0e-8d3226919b1a))
|
||||||
|
(fp_line (start -5.5 3) (end -8.5 3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 0fd41d69-9ce9-4ef0-a762-a71b1aac4fd6))
|
||||||
|
(fp_line (start -5.5 3) (end -5.5 4.3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 658d99e0-a80a-4367-a8a5-4c5f9dba1178))
|
||||||
|
(fp_line (start -5.5 4.3) (end -3.75 4.3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 7b5ba43a-3077-4f09-add7-a178895e80ae))
|
||||||
|
(fp_line (start -5.05 4.3) (end -4.55 5.35)
|
||||||
|
(stroke (width 0.1) (type default)) (layer "F.SilkS") (tstamp 5a1481a0-0072-4fb0-b82f-9002c5f87269))
|
||||||
|
(fp_line (start -4.55 5.35) (end -3.6 5.35)
|
||||||
|
(stroke (width 0.1) (type default)) (layer "F.SilkS") (tstamp 5bf00677-c1d9-484b-8a50-5cd0c873eeb5))
|
||||||
|
(fp_line (start -4.2 -2.25) (end -4.2 2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp ffee2b26-d7e4-4284-9263-c6aca5b9749a))
|
||||||
|
(fp_line (start -4.2 2.25) (end -5.5 2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 32f065d2-8bb4-4f1a-84da-02bc6ff17e4d))
|
||||||
|
(fp_line (start -3.8 -4.7) (end -5.5 -4.7)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp abfac670-5770-42a2-a09b-98c42789dc0a))
|
||||||
|
(fp_line (start -3.6 5.35) (end -3.6 5)
|
||||||
|
(stroke (width 0.1) (type default)) (layer "F.SilkS") (tstamp 12653866-eba9-48de-9c11-2db40ab42242))
|
||||||
|
(fp_line (start -1.4 -4.7) (end 6.1 -4.7)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp e7e22f9d-9cb3-4f0f-81d0-1e6f401e1325))
|
||||||
|
(fp_line (start 0.4 4.3) (end 0.4 5.4)
|
||||||
|
(stroke (width 0.1) (type default)) (layer "F.SilkS") (tstamp 44432717-bbe5-4b53-abc2-4fff5060c314))
|
||||||
|
(fp_line (start 0.4 5.4) (end 1.3 5.4)
|
||||||
|
(stroke (width 0.1) (type default)) (layer "F.SilkS") (tstamp dd54a902-0e87-4221-9694-bf2b3bf84625))
|
||||||
|
(fp_line (start 1.3 5.4) (end 1.7 4.6)
|
||||||
|
(stroke (width 0.1) (type default)) (layer "F.SilkS") (tstamp 1d9fc1f8-7c3b-4056-8cd2-e1b881e3711f))
|
||||||
|
(fp_line (start 1.5 4.3) (end -1.55 4.3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp ed42dbf6-5647-4586-a2ce-063b416c4194))
|
||||||
|
(fp_line (start 6.1 -4.7) (end 6.1 -2.7)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 4619c36d-b0cd-415b-ae48-395ee76ef585))
|
||||||
|
(fp_line (start 6.1 -0.35) (end 6.1 4.3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp c05166e3-0591-4801-8c91-d3dd803cca16))
|
||||||
|
(fp_line (start 6.1 4.3) (end 3.4 4.3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 3c5ea8b3-2ced-4df4-9fc4-309b967f50ce))
|
||||||
|
(fp_circle (center -4 -5.5) (end -3.8 -5.5)
|
||||||
|
(stroke (width 0.4) (type solid)) (fill none) (layer "F.SilkS") (tstamp 1a0330d0-db00-4dfa-9914-25086b1fbfbf))
|
||||||
|
(fp_line (start -5.5 -8.35) (end -5.5 -2.25)
|
||||||
|
(stroke (width 0.01) (type solid)) (layer "Edge.Cuts") (tstamp ecdf0e30-8453-4e73-b5ab-aa93010d888d))
|
||||||
|
(fp_line (start -5.5 -2.25) (end -4.2 -2.25)
|
||||||
|
(stroke (width 0.01) (type solid)) (layer "Edge.Cuts") (tstamp d61220d3-0c4a-46fe-966c-fa6d3205a6bd))
|
||||||
|
(fp_line (start -5.5 2.25) (end -5.5 8.85)
|
||||||
|
(stroke (width 0.01) (type solid)) (layer "Edge.Cuts") (tstamp 4b0c47eb-fff4-443f-a38b-fabcc1e8eb82))
|
||||||
|
(fp_line (start -4.2 -2.25) (end -4.2 2.25)
|
||||||
|
(stroke (width 0.01) (type solid)) (layer "Edge.Cuts") (tstamp 89f05533-9365-4886-8c31-515ca2e0d00b))
|
||||||
|
(fp_line (start -4.2 2.25) (end -5.5 2.25)
|
||||||
|
(stroke (width 0.01) (type solid)) (layer "Edge.Cuts") (tstamp ae1988c7-803b-4b56-b7fd-d8e2dd7b830c))
|
||||||
|
(fp_line (start -8.75 -3.25) (end -5.75 -3.25)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 940af57e-dd0f-4060-9be4-fe34e7aa903e))
|
||||||
|
(fp_line (start -8.75 3.25) (end -8.75 -3.25)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 266b0d05-a27e-450f-8538-bc9affd19b04))
|
||||||
|
(fp_line (start -5.75 -5) (end -3.65 -5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 3b5bc2e3-9f5a-409a-993b-83f5f819c072))
|
||||||
|
(fp_line (start -5.75 -3.25) (end -5.75 -5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 9ae91dfe-d4b6-4dfa-bddf-91c145ccc5f6))
|
||||||
|
(fp_line (start -5.75 3.25) (end -8.75 3.25)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 62e06b49-3ebe-49ed-a4c2-3e93da53c16d))
|
||||||
|
(fp_line (start -5.75 4.5) (end -5.75 3.25)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 097944c5-fe4f-4da3-8780-42e8a8eeff4d))
|
||||||
|
(fp_line (start -5.25 4.5) (end -5.75 4.5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 7233d18f-b358-4e74-9555-a6a75d6127dc))
|
||||||
|
(fp_line (start -5.25 5.55) (end -5.25 4.5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 5dd71fc4-88f7-45c2-b6be-97a22f0df7f9))
|
||||||
|
(fp_line (start -3.65 -5.85) (end -1.5 -5.85)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp ccba6cef-50a5-421e-9d4f-7f2a0e8b80a4))
|
||||||
|
(fp_line (start -3.65 -5) (end -3.65 -5.85)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 135bbc13-e01b-436c-a876-d8b74759ae6d))
|
||||||
|
(fp_line (start -1.5 -5.85) (end -1.5 -5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 396eebd4-23db-4244-bfb5-c7a05b73ec13))
|
||||||
|
(fp_line (start -1.5 -5) (end 6.3 -5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 2f5078ca-1522-4faf-96ff-fa75e32013ee))
|
||||||
|
(fp_line (start 2 5.55) (end -5.25 5.55)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp dbe5204d-c99e-4064-98e1-bdf7b7b37874))
|
||||||
|
(fp_line (start 2 5.55) (end 2 4.6)
|
||||||
|
(stroke (width 0.05) (type default)) (layer "F.CrtYd") (tstamp cdd79330-522a-4535-8c78-14c4608d4d55))
|
||||||
|
(fp_line (start 6.3 -5) (end 6.3 -2.6)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 570b790c-1c58-4b29-bc5e-93fbc00a1601))
|
||||||
|
(fp_line (start 6.3 -2.6) (end 6.5 -2.6)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 167c1098-293c-4d8b-b749-92216e026450))
|
||||||
|
(fp_line (start 6.3 -0.5) (end 6.3 4.6)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp e3966f22-fca2-4ca3-b5f0-05222dd717de))
|
||||||
|
(fp_line (start 6.3 4.6) (end 2 4.6)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 9cdb0a50-a0c6-4a55-87c8-48783fc5368e))
|
||||||
|
(fp_line (start 6.5 -2.6) (end 6.5 -0.5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp e8cc2a6b-ffb6-4f90-90f4-d497d1f0a692))
|
||||||
|
(fp_line (start 6.5 -0.5) (end 6.3 -0.5)
|
||||||
|
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp d29942c8-f25a-41dc-9e05-ac32b1a9f741))
|
||||||
|
(fp_line (start -8.5 -3) (end -8.5 3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp a27f1ab1-c6f9-4b28-9728-cc59daa92ea7))
|
||||||
|
(fp_line (start -8.5 3) (end -5.5 3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp e5e3bbf8-cd0b-4d9e-9f24-64dd16354f96))
|
||||||
|
(fp_line (start -5.5 -4.7) (end -5.5 -3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp 4242f01b-41cd-4da5-b700-6107f22cd2ee))
|
||||||
|
(fp_line (start -5.5 -4.7) (end 6.1 -4.7)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp 27a82db8-2858-4f01-baec-c0c199045d07))
|
||||||
|
(fp_line (start -5.5 -3) (end -8.5 -3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp f5372e4a-5bde-4c18-81bf-5e6b13679292))
|
||||||
|
(fp_line (start -5.5 -3) (end -5.5 -2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp 203ba3fa-cb1d-4968-b9f5-596155c2dadf))
|
||||||
|
(fp_line (start -5.5 -2.25) (end -4.2 -2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp fc87e254-1807-4d59-b472-92b5dc84a38e))
|
||||||
|
(fp_line (start -5.5 2.25) (end -5.5 3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp 11b2e23c-dadb-4b7a-aca5-7f204e0de401))
|
||||||
|
(fp_line (start -5.5 3) (end -5.5 4.3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp 981f06cf-dc71-4fbc-83d9-b9bff68dddc8))
|
||||||
|
(fp_line (start -5.5 4.3) (end -5.05 4.3)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp b939b474-cc9b-403b-a66e-5145b84f511b))
|
||||||
|
(fp_line (start -5.05 4.3) (end -4.55 5.35)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp b365aa16-9e8d-43a4-992e-7f39a81b3c25))
|
||||||
|
(fp_line (start -4.55 5.35) (end -3.6 5.35)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp 1c73b2ee-5dc0-4690-9ed4-932d3c0a1b18))
|
||||||
|
(fp_line (start -4.2 -2.25) (end -4.2 2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp ab5dcbaa-38c1-4be7-9a9d-f958f0e3a05e))
|
||||||
|
(fp_line (start -4.2 2.25) (end -5.5 2.25)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp 0356b2dc-c9bc-4829-8343-27ed86d2e19b))
|
||||||
|
(fp_line (start -3.6 4.3) (end 0.4 4.3)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp 28bf17a6-3221-4254-b5e3-442590091c92))
|
||||||
|
(fp_line (start -3.6 5.35) (end -3.6 4.3)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp fede174c-82d4-4214-9a80-dee671777d81))
|
||||||
|
(fp_line (start 0.4 4.3) (end 0.4 5.4)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp 86c7aabb-f8c0-4c73-b019-b85bebb71f06))
|
||||||
|
(fp_line (start 0.4 5.4) (end 1.3 5.4)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp b346b889-f83f-4e44-ac3c-b9c18c4bfeca))
|
||||||
|
(fp_line (start 1.3 5.4) (end 1.85 4.3)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp 83601258-2c7d-4c55-9996-ee590a16f411))
|
||||||
|
(fp_line (start 1.85 4.3) (end 6.1 4.3)
|
||||||
|
(stroke (width 0.127) (type default)) (layer "F.Fab") (tstamp decc39a6-5210-4338-a0bf-27444887de8e))
|
||||||
|
(fp_line (start 6.1 -4.7) (end 6.1 4.3)
|
||||||
|
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp f0bcef93-c605-4782-9671-50816bcff153))
|
||||||
|
(pad "" np_thru_hole circle (at -2.6 0) (size 1.1 1.1) (drill 1.1) (layers "*.Cu" "*.Mask") (tstamp 4bf3c14b-548d-46b8-b495-96bd6a488313))
|
||||||
|
(pad "" np_thru_hole circle (at 2.4 0) (size 1.1 1.1) (drill 1.1) (layers "*.Cu" "*.Mask") (tstamp d20a6657-1fc2-4113-8548-24694ff1e021))
|
||||||
|
(pad "1" thru_hole rect (at -2.6 -4.8) (size 1.65 1.65) (drill 1.1) (layers "*.Cu" "*.Mask")
|
||||||
|
(solder_mask_margin 0.102) (tstamp 32f3146d-6082-43d2-96fd-12e0385460bd))
|
||||||
|
(pad "2" thru_hole circle (at 2.4 3.6) (size 1.65 1.65) (drill 1.1) (layers "*.Cu" "*.Mask")
|
||||||
|
(solder_mask_margin 0.102) (tstamp 49f2bf78-3fd2-4bd7-9f90-9e57a7203293))
|
||||||
|
(pad "3" thru_hole circle (at 5.5 -1.6) (size 1.65 1.65) (drill 1.1) (layers "*.Cu" "*.Mask")
|
||||||
|
(solder_mask_margin 0.102) (tstamp dc557e88-b134-41f4-966a-5f977c97ee79))
|
||||||
|
(pad "4" thru_hole circle (at -2.6 4.5) (size 1.65 1.65) (drill 1.1) (layers "*.Cu" "*.Mask")
|
||||||
|
(solder_mask_margin 0.102) (tstamp 076cf2ff-8dd7-4070-a098-78b9ee4a7912))
|
||||||
|
(model "${KIPRJMOD}/CUI_DEVICES_SJ-43514.step"
|
||||||
|
(offset (xyz -5.5 0 2.25))
|
||||||
|
(scale (xyz 1 1 1))
|
||||||
|
(rotate (xyz -90 0 180))
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Hardware
|
||||||
|
|
||||||
|
I ordered the boards partially assembled from JLCPCB (to keep costs down, I ordered and soldered some non-standard/stocked parts myself.)
|
||||||
|
|
||||||
|
The non-populated/assembled BOM is:
|
||||||
|
|
||||||
|
| Mouser #: | Mfr. #: | Desc.: | Order Qty. | Unit Price (USD) |
|
||||||
|
| ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------ | ---------- | ----------- |
|
||||||
|
| 579-ATTINY3216-SNR | ATTINY3216-SNR | 8-bit Microcontrollers - MCU 8-bit Microcontrollers - MCU 20MHz, 32KB, SOIC20, Ind 105C, Green, T&R | 1 | $1.27 |
|
||||||
|
| 523-L717SDE09PA4CH4 | L717SDE09PA4CH4F | D-Sub Standard Connectors D-Sub Standard Connectors D SUB R/A | 1 | $1.98 |
|
||||||
|
| 490-SJ-43514 | SJ-43514 | Phone Connectors Phone Connectors audio jack, 3.5 mm, rt, 4 conductor, through hole, 0 switches | 1 | $1.35 |
|
||||||
|
| 667-ERZ-V20D220 | ERZ-V20D220 | Varistors Varistors 22V 2000A ZNR SUR ABSORBER 20MM | 1 | $1.24 |
|
||||||
|
| 538-22-28-8093 | 22-28-8093 | Headers & Wire Housings Headers & Wire Housings 2.54MM BREAKAWAY RA 9 CKT Gold | 2 | $0.76 |
|
||||||
|
| 865-XC6701D502JR-G | XC6701D502JR-G | LDO Voltage Regulators LDO Voltage Regulators 28V High Speed Voltage Regulator | 1 | $1.36 |
|
||||||
|
| 563-EXN-23350-BK | EXN-23350-BK | Enclosures, Boxes, & Cases Enclosures, Boxes, & Cases Extruded Aluminum Enclosure Black (1.4 X 2.7 X 1.9 In) | 1 | $14.40 |
|
||||||
|
|
||||||
|
An earlier version of the board* lacked cutouts in the corners to fit the ends of the intended housing, so I haven't used the listed enclosure (yet).
|
||||||
|
|
||||||
|
*Only version of the board I have ordered so far.
|
||||||
|
|
||||||
|
### Flashing
|
||||||
|
|
||||||
|
The CMake target `flash` uses the AVRDude utility using the "serialupdi" programmer type. I use a [USB => Serial converter](https://www.adafruit.com/product/5335) with the Rx and Tx lines connected, using one of the options described [by SpenceKonde here](https://github.com/SpenceKonde/AVR-Guidance/blob/master/UPDI/jtag2updi.md).
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"board": {
|
||||||
|
"active_layer": 0,
|
||||||
|
"active_layer_preset": "All Layers",
|
||||||
|
"auto_track_width": true,
|
||||||
|
"hidden_netclasses": [],
|
||||||
|
"hidden_nets": [],
|
||||||
|
"high_contrast_mode": 0,
|
||||||
|
"net_color_mode": 1,
|
||||||
|
"opacity": {
|
||||||
|
"images": 0.6,
|
||||||
|
"pads": 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": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
17,
|
||||||
|
18,
|
||||||
|
19,
|
||||||
|
20,
|
||||||
|
21,
|
||||||
|
22,
|
||||||
|
23,
|
||||||
|
24,
|
||||||
|
25,
|
||||||
|
26,
|
||||||
|
27,
|
||||||
|
28,
|
||||||
|
29,
|
||||||
|
30,
|
||||||
|
32,
|
||||||
|
33,
|
||||||
|
34,
|
||||||
|
35,
|
||||||
|
36,
|
||||||
|
39,
|
||||||
|
40
|
||||||
|
],
|
||||||
|
"visible_layers": "fffffff_ffffffff",
|
||||||
|
"zone_display_mode": 0
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"filename": "avclan-mockingboard-rounded.kicad_prl",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,509 @@
|
|||||||
|
{
|
||||||
|
"board": {
|
||||||
|
"3dviewports": [],
|
||||||
|
"design_settings": {
|
||||||
|
"defaults": {
|
||||||
|
"board_outline_line_width": 0.09999999999999999,
|
||||||
|
"copper_line_width": 0.19999999999999998,
|
||||||
|
"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.049999999999999996,
|
||||||
|
"dimension_precision": 4,
|
||||||
|
"dimension_units": 3,
|
||||||
|
"dimensions": {
|
||||||
|
"arrow_length": 1270000,
|
||||||
|
"extension_offset": 500000,
|
||||||
|
"keep_text_aligned": true,
|
||||||
|
"suppress_zeroes": false,
|
||||||
|
"text_position": 0,
|
||||||
|
"units_format": 1
|
||||||
|
},
|
||||||
|
"fab_line_width": 0.09999999999999999,
|
||||||
|
"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.15,
|
||||||
|
"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.762,
|
||||||
|
"height": 1.524,
|
||||||
|
"width": 1.524
|
||||||
|
},
|
||||||
|
"silk_line_width": 0.15,
|
||||||
|
"silk_text_italic": false,
|
||||||
|
"silk_text_size_h": 1.0,
|
||||||
|
"silk_text_size_v": 1.0,
|
||||||
|
"silk_text_thickness": 0.15,
|
||||||
|
"silk_text_upright": false,
|
||||||
|
"zones": {
|
||||||
|
"min_clearance": 0.33299999999999996
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"diff_pair_dimensions": [
|
||||||
|
{
|
||||||
|
"gap": 0.0,
|
||||||
|
"via_gap": 0.0,
|
||||||
|
"width": 0.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"drc_exclusions": [
|
||||||
|
"extra_footprint|155000000|98300000|9eb14f8d-8889-43ee-98f8-14d7ff3a00d4|00000000-0000-0000-0000-000000000000",
|
||||||
|
"silk_edge_clearance|127600000|75600000|3c9aeeb6-9bf2-4b70-8ccb-4aa674772f2c|3bc1c510-8140-48c6-9e1d-e37afa6a5a79",
|
||||||
|
"silk_edge_clearance|136600000|75600000|6e55689b-dfcc-4b1b-b6da-416a34456e20|6d777aef-3d67-44dd-a85d-1dbda6171f02",
|
||||||
|
"silk_edge_clearance|138470000|75600000|6e55689b-dfcc-4b1b-b6da-416a34456e20|c93e5386-3bd1-45c9-bd03-1ef6229305ed",
|
||||||
|
"silk_edge_clearance|169440000|75600000|6e55689b-dfcc-4b1b-b6da-416a34456e20|44ebb4f7-c13a-4c59-b036-8212144cec66"
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"version": 2
|
||||||
|
},
|
||||||
|
"rule_severities": {
|
||||||
|
"annular_width": "error",
|
||||||
|
"clearance": "error",
|
||||||
|
"connection_width": "warning",
|
||||||
|
"copper_edge_clearance": "error",
|
||||||
|
"copper_sliver": "warning",
|
||||||
|
"courtyards_overlap": "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_type_mismatch": "ignore",
|
||||||
|
"hole_clearance": "error",
|
||||||
|
"hole_near_hole": "error",
|
||||||
|
"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": "ignore",
|
||||||
|
"malformed_courtyard": "error",
|
||||||
|
"microvia_drill_out_of_range": "error",
|
||||||
|
"missing_courtyard": "ignore",
|
||||||
|
"missing_footprint": "warning",
|
||||||
|
"net_conflict": "warning",
|
||||||
|
"npth_inside_courtyard": "ignore",
|
||||||
|
"padstack": "warning",
|
||||||
|
"pth_inside_courtyard": "ignore",
|
||||||
|
"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": "error",
|
||||||
|
"text_height": "warning",
|
||||||
|
"text_thickness": "warning",
|
||||||
|
"through_hole_pad_without_hole": "error",
|
||||||
|
"too_many_vias": "error",
|
||||||
|
"track_dangling": "warning",
|
||||||
|
"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.09,
|
||||||
|
"min_connection": 0.0,
|
||||||
|
"min_copper_edge_clearance": 0.3,
|
||||||
|
"min_hole_clearance": 0.254,
|
||||||
|
"min_hole_to_hole": 0.5,
|
||||||
|
"min_microvia_diameter": 0.19999999999999998,
|
||||||
|
"min_microvia_drill": 0.09999999999999999,
|
||||||
|
"min_resolved_spokes": 2,
|
||||||
|
"min_silk_clearance": 0.049999999999999996,
|
||||||
|
"min_text_height": 1.0,
|
||||||
|
"min_text_thickness": 0.153,
|
||||||
|
"min_through_hole_diameter": 0.3,
|
||||||
|
"min_track_width": 0.09,
|
||||||
|
"min_via_annular_width": 0.15,
|
||||||
|
"min_via_diameter": 0.5,
|
||||||
|
"solder_mask_clearance": 0.0,
|
||||||
|
"solder_mask_min_width": 0.0,
|
||||||
|
"solder_mask_to_copper_clearance": 0.0,
|
||||||
|
"use_height_for_length_calcs": true
|
||||||
|
},
|
||||||
|
"teardrop_options": [
|
||||||
|
{
|
||||||
|
"td_allow_use_two_tracks": true,
|
||||||
|
"td_curve_segcount": 5,
|
||||||
|
"td_on_pad_in_zone": false,
|
||||||
|
"td_onpadsmd": true,
|
||||||
|
"td_onroundshapesonly": false,
|
||||||
|
"td_ontrackend": false,
|
||||||
|
"td_onviapad": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"teardrop_parameters": [
|
||||||
|
{
|
||||||
|
"td_curve_segcount": 5,
|
||||||
|
"td_height_ratio": 1.0,
|
||||||
|
"td_length_ratio": 0.75,
|
||||||
|
"td_maxheight": 2.0,
|
||||||
|
"td_maxlen": 1.0,
|
||||||
|
"td_target_name": "td_round_shape",
|
||||||
|
"td_width_to_size_filter_ratio": 0.9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"td_curve_segcount": 5,
|
||||||
|
"td_height_ratio": 1.0,
|
||||||
|
"td_length_ratio": 0.75,
|
||||||
|
"td_maxheight": 2.0,
|
||||||
|
"td_maxlen": 1.0,
|
||||||
|
"td_target_name": "td_rect_shape",
|
||||||
|
"td_width_to_size_filter_ratio": 0.9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"td_curve_segcount": 5,
|
||||||
|
"td_height_ratio": 1.0,
|
||||||
|
"td_length_ratio": 0.75,
|
||||||
|
"td_maxheight": 2.0,
|
||||||
|
"td_maxlen": 1.0,
|
||||||
|
"td_target_name": "td_track_end",
|
||||||
|
"td_width_to_size_filter_ratio": 0.9
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"track_widths": [
|
||||||
|
0.0,
|
||||||
|
0.1,
|
||||||
|
0.2,
|
||||||
|
0.5,
|
||||||
|
0.75,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"via_dimensions": [
|
||||||
|
{
|
||||||
|
"diameter": 0.0,
|
||||||
|
"drill": 0.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"zones_allow_external_fillets": false
|
||||||
|
},
|
||||||
|
"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",
|
||||||
|
"conflicting_netclasses": "error",
|
||||||
|
"different_unit_footprint": "error",
|
||||||
|
"different_unit_net": "error",
|
||||||
|
"duplicate_reference": "error",
|
||||||
|
"duplicate_sheet_names": "error",
|
||||||
|
"endpoint_off_grid": "warning",
|
||||||
|
"extra_units": "error",
|
||||||
|
"global_label_dangling": "warning",
|
||||||
|
"hier_label_mismatch": "error",
|
||||||
|
"label_dangling": "error",
|
||||||
|
"lib_symbol_issues": "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": "error",
|
||||||
|
"no_connect_dangling": "warning",
|
||||||
|
"pin_not_connected": "warning",
|
||||||
|
"pin_not_driven": "error",
|
||||||
|
"pin_to_pin": "error",
|
||||||
|
"power_pin_not_driven": "error",
|
||||||
|
"similar_labels": "warning",
|
||||||
|
"simulation_model_issue": "ignore",
|
||||||
|
"unannotated": "error",
|
||||||
|
"unit_value_mismatch": "error",
|
||||||
|
"unresolved_variable": "error",
|
||||||
|
"wire_dangling": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"pinned_footprint_libs": [],
|
||||||
|
"pinned_symbol_libs": []
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"filename": "avclan-mockingboard-rounded.kicad_pro",
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
"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)",
|
||||||
|
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||||
|
"track_width": 0.25,
|
||||||
|
"via_diameter": 0.8,
|
||||||
|
"via_drill": 0.4,
|
||||||
|
"wire_width": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"net_colors": null,
|
||||||
|
"netclass_assignments": null,
|
||||||
|
"netclass_patterns": []
|
||||||
|
},
|
||||||
|
"pcbnew": {
|
||||||
|
"last_paths": {
|
||||||
|
"gencad": "",
|
||||||
|
"idf": "",
|
||||||
|
"netlist": "low-power-ATtiny-board.net",
|
||||||
|
"specctra_dsn": "",
|
||||||
|
"step": "avclan-mockingboard-rounded.step",
|
||||||
|
"vrml": ""
|
||||||
|
},
|
||||||
|
"page_layout_descr_file": ""
|
||||||
|
},
|
||||||
|
"schematic": {
|
||||||
|
"annotate_start_num": 0,
|
||||||
|
"drawing": {
|
||||||
|
"dashed_lines_dash_length_ratio": 12.0,
|
||||||
|
"dashed_lines_gap_length_ratio": 3.0,
|
||||||
|
"default_line_thickness": 6.0,
|
||||||
|
"default_text_size": 44.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,
|
||||||
|
"pin_symbol_size": 25.0,
|
||||||
|
"text_offset_ratio": 0.15
|
||||||
|
},
|
||||||
|
"legacy_lib_dir": "",
|
||||||
|
"legacy_lib_list": [],
|
||||||
|
"meta": {
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
"net_format_name": "KiCad",
|
||||||
|
"ngspice": {
|
||||||
|
"fix_include_paths": true,
|
||||||
|
"meta": {
|
||||||
|
"version": 0
|
||||||
|
},
|
||||||
|
"model_mode": 0,
|
||||||
|
"workbook_filename": ""
|
||||||
|
},
|
||||||
|
"page_layout_descr_file": "",
|
||||||
|
"plot_directory": "./",
|
||||||
|
"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_voltages": false,
|
||||||
|
"subpart_first_id": 65,
|
||||||
|
"subpart_id_separator": 0
|
||||||
|
},
|
||||||
|
"sheets": [
|
||||||
|
[
|
||||||
|
"85a07af0-16ab-4d5b-a3f1-1b717cf4da63",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"text_variables": {}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"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,
|
||||||
|
"tracks": 1.0,
|
||||||
|
"vias": 1.0,
|
||||||
|
"zones": 0.6
|
||||||
|
},
|
||||||
|
"selection_filter": {
|
||||||
|
"dimensions": true,
|
||||||
|
"footprints": true,
|
||||||
|
"graphics": true,
|
||||||
|
"keepouts": true,
|
||||||
|
"lockedItems": true,
|
||||||
|
"otherItems": true,
|
||||||
|
"pads": true,
|
||||||
|
"text": true,
|
||||||
|
"tracks": true,
|
||||||
|
"vias": true,
|
||||||
|
"zones": true
|
||||||
|
},
|
||||||
|
"visible_items": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
18,
|
||||||
|
19,
|
||||||
|
20,
|
||||||
|
21,
|
||||||
|
22,
|
||||||
|
23,
|
||||||
|
24,
|
||||||
|
25,
|
||||||
|
26,
|
||||||
|
27,
|
||||||
|
28,
|
||||||
|
29,
|
||||||
|
30,
|
||||||
|
32,
|
||||||
|
33,
|
||||||
|
34,
|
||||||
|
35,
|
||||||
|
36,
|
||||||
|
39,
|
||||||
|
40
|
||||||
|
],
|
||||||
|
"visible_layers": "002f3ff_80000001",
|
||||||
|
"zone_display_mode": 0
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"repo_password": "",
|
||||||
|
"repo_type": "",
|
||||||
|
"repo_username": "",
|
||||||
|
"ssh_key": ""
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"filename": "avclan-mockingboard.kicad_prl",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,615 @@
|
|||||||
|
{
|
||||||
|
"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.1,
|
||||||
|
"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": false,
|
||||||
|
"text_position": 0,
|
||||||
|
"units_format": 1
|
||||||
|
},
|
||||||
|
"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.15,
|
||||||
|
"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.0,
|
||||||
|
"height": 1.0,
|
||||||
|
"width": 1.0
|
||||||
|
},
|
||||||
|
"silk_line_width": 0.15,
|
||||||
|
"silk_text_italic": false,
|
||||||
|
"silk_text_size_h": 1.0,
|
||||||
|
"silk_text_size_v": 1.0,
|
||||||
|
"silk_text_thickness": 0.15,
|
||||||
|
"silk_text_upright": false,
|
||||||
|
"zones": {
|
||||||
|
"min_clearance": 0.25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"diff_pair_dimensions": [
|
||||||
|
{
|
||||||
|
"gap": 0.0,
|
||||||
|
"via_gap": 0.0,
|
||||||
|
"width": 0.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"drc_exclusions": [
|
||||||
|
"courtyards_overlap|142951435|95185001|740497d3-ece2-41b1-a2fd-b8f316ceb15a|a16457de-07cc-4841-9375-dde6a241c692"
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"version": 2
|
||||||
|
},
|
||||||
|
"rule_severities": {
|
||||||
|
"annular_width": "error",
|
||||||
|
"clearance": "error",
|
||||||
|
"connection_width": "warning",
|
||||||
|
"copper_edge_clearance": "error",
|
||||||
|
"copper_sliver": "warning",
|
||||||
|
"courtyards_overlap": "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_symbol_mismatch": "warning",
|
||||||
|
"footprint_type_mismatch": "ignore",
|
||||||
|
"hole_clearance": "error",
|
||||||
|
"hole_near_hole": "error",
|
||||||
|
"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": "ignore",
|
||||||
|
"malformed_courtyard": "error",
|
||||||
|
"microvia_drill_out_of_range": "error",
|
||||||
|
"missing_courtyard": "ignore",
|
||||||
|
"missing_footprint": "warning",
|
||||||
|
"net_conflict": "warning",
|
||||||
|
"npth_inside_courtyard": "ignore",
|
||||||
|
"padstack": "warning",
|
||||||
|
"pth_inside_courtyard": "ignore",
|
||||||
|
"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": "error",
|
||||||
|
"text_height": "warning",
|
||||||
|
"text_thickness": "warning",
|
||||||
|
"through_hole_pad_without_hole": "error",
|
||||||
|
"too_many_vias": "error",
|
||||||
|
"track_dangling": "warning",
|
||||||
|
"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.09,
|
||||||
|
"min_connection": 0.0,
|
||||||
|
"min_copper_edge_clearance": 0.3,
|
||||||
|
"min_hole_clearance": 0.254,
|
||||||
|
"min_hole_to_hole": 0.5,
|
||||||
|
"min_microvia_diameter": 0.2,
|
||||||
|
"min_microvia_drill": 0.1,
|
||||||
|
"min_resolved_spokes": 2,
|
||||||
|
"min_silk_clearance": 0.05,
|
||||||
|
"min_text_height": 1.0,
|
||||||
|
"min_text_thickness": 0.153,
|
||||||
|
"min_through_hole_diameter": 0.3,
|
||||||
|
"min_track_width": 0.09,
|
||||||
|
"min_via_annular_width": 0.15,
|
||||||
|
"min_via_diameter": 0.5,
|
||||||
|
"solder_mask_clearance": 0.0,
|
||||||
|
"solder_mask_min_width": 0.0,
|
||||||
|
"solder_mask_to_copper_clearance": 0.0,
|
||||||
|
"use_height_for_length_calcs": true
|
||||||
|
},
|
||||||
|
"teardrop_options": [
|
||||||
|
{
|
||||||
|
"td_onpadsmd": true,
|
||||||
|
"td_onroundshapesonly": false,
|
||||||
|
"td_ontrackend": false,
|
||||||
|
"td_onviapad": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"teardrop_parameters": [
|
||||||
|
{
|
||||||
|
"td_allow_use_two_tracks": true,
|
||||||
|
"td_curve_segcount": 5,
|
||||||
|
"td_height_ratio": 1.0,
|
||||||
|
"td_length_ratio": 0.75,
|
||||||
|
"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": 5,
|
||||||
|
"td_height_ratio": 1.0,
|
||||||
|
"td_length_ratio": 0.75,
|
||||||
|
"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": 5,
|
||||||
|
"td_height_ratio": 1.0,
|
||||||
|
"td_length_ratio": 0.75,
|
||||||
|
"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.3,
|
||||||
|
0.5,
|
||||||
|
0.75,
|
||||||
|
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_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",
|
||||||
|
"conflicting_netclasses": "error",
|
||||||
|
"different_unit_footprint": "error",
|
||||||
|
"different_unit_net": "error",
|
||||||
|
"duplicate_reference": "error",
|
||||||
|
"duplicate_sheet_names": "error",
|
||||||
|
"endpoint_off_grid": "warning",
|
||||||
|
"extra_units": "error",
|
||||||
|
"global_label_dangling": "warning",
|
||||||
|
"hier_label_mismatch": "error",
|
||||||
|
"label_dangling": "error",
|
||||||
|
"lib_symbol_issues": "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": "error",
|
||||||
|
"no_connect_dangling": "warning",
|
||||||
|
"pin_not_connected": "warning",
|
||||||
|
"pin_not_driven": "error",
|
||||||
|
"pin_to_pin": "error",
|
||||||
|
"power_pin_not_driven": "error",
|
||||||
|
"similar_labels": "warning",
|
||||||
|
"simulation_model_issue": "ignore",
|
||||||
|
"unannotated": "error",
|
||||||
|
"unit_value_mismatch": "error",
|
||||||
|
"unresolved_variable": "error",
|
||||||
|
"wire_dangling": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"pinned_footprint_libs": [],
|
||||||
|
"pinned_symbol_libs": []
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"filename": "avclan-mockingboard.kicad_pro",
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
"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)",
|
||||||
|
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||||
|
"track_width": 0.25,
|
||||||
|
"via_diameter": 0.8,
|
||||||
|
"via_drill": 0.4,
|
||||||
|
"wire_width": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"net_colors": null,
|
||||||
|
"netclass_assignments": null,
|
||||||
|
"netclass_patterns": []
|
||||||
|
},
|
||||||
|
"pcbnew": {
|
||||||
|
"last_paths": {
|
||||||
|
"gencad": "",
|
||||||
|
"idf": "",
|
||||||
|
"netlist": "low-power-ATtiny-board.net",
|
||||||
|
"plot": "",
|
||||||
|
"pos_files": "",
|
||||||
|
"specctra_dsn": "",
|
||||||
|
"step": "low-power-ATtiny-board-rounded.step",
|
||||||
|
"svg": "",
|
||||||
|
"vrml": ""
|
||||||
|
},
|
||||||
|
"page_layout_descr_file": ""
|
||||||
|
},
|
||||||
|
"schematic": {
|
||||||
|
"annotate_start_num": 0,
|
||||||
|
"bom_export_filename": "",
|
||||||
|
"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": false,
|
||||||
|
"label": "Datasheet",
|
||||||
|
"name": "Datasheet",
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"group_by": false,
|
||||||
|
"label": "Footprint",
|
||||||
|
"name": "Footprint",
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"group_by": false,
|
||||||
|
"label": "Qty",
|
||||||
|
"name": "${QUANTITY}",
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"group_by": true,
|
||||||
|
"label": "DNP",
|
||||||
|
"name": "${DNP}",
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filter_string": "",
|
||||||
|
"group_symbols": true,
|
||||||
|
"name": "Grouped By Value",
|
||||||
|
"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": 44.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": "KiCad",
|
||||||
|
"ngspice": {
|
||||||
|
"fix_include_paths": true,
|
||||||
|
"meta": {
|
||||||
|
"version": 0
|
||||||
|
},
|
||||||
|
"model_mode": 0,
|
||||||
|
"workbook_filename": ""
|
||||||
|
},
|
||||||
|
"page_layout_descr_file": "",
|
||||||
|
"plot_directory": "./",
|
||||||
|
"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": [
|
||||||
|
[
|
||||||
|
"85a07af0-16ab-4d5b-a3f1-1b717cf4da63",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"text_variables": {}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,2 @@
|
|||||||
|
Default True 2.0 3
|
||||||
|
True True False
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
(fp_lib_table
|
||||||
|
(version 7)
|
||||||
|
(lib (name "cui_audio")(type "KiCad")(uri "${KIPRJMOD}")(options "")(descr ""))
|
||||||
|
)
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
|||||||
|
%TF.GenerationSoftware,KiCad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1*%
|
||||||
|
%TF.CreationDate,2023-09-02T15:09:26-04:00*%
|
||||||
|
%TF.ProjectId,avclan-mockingboard-rounded,6176636c-616e-42d6-9d6f-636b696e6762,rev?*%
|
||||||
|
%TF.SameCoordinates,Original*%
|
||||||
|
%TF.FileFunction,Profile,NP*%
|
||||||
|
%FSLAX46Y46*%
|
||||||
|
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||||
|
G04 Created by KiCad (PCBNEW 7.0.7-7.0.7~ubuntu22.04.1) date 2023-09-02 15:09:26*
|
||||||
|
%MOMM*%
|
||||||
|
%LPD*%
|
||||||
|
G01*
|
||||||
|
G04 APERTURE LIST*
|
||||||
|
%TA.AperFunction,Profile*%
|
||||||
|
%ADD10C,0.100000*%
|
||||||
|
%TD*%
|
||||||
|
G04 APERTURE END LIST*
|
||||||
|
D10*
|
||||||
|
X0Y-37000000D02*
|
||||||
|
X0Y-2000000D01*
|
||||||
|
X53000000Y-2000000D02*
|
||||||
|
G75*
|
||||||
|
G03*
|
||||||
|
X51000000Y0I-2000000J0D01*
|
||||||
|
G01*
|
||||||
|
X7000000Y0D02*
|
||||||
|
X7000000Y-1500000D01*
|
||||||
|
X2000000Y0D02*
|
||||||
|
X7000000Y0D01*
|
||||||
|
X7000000Y-1500000D02*
|
||||||
|
X12000000Y-1500000D01*
|
||||||
|
X12000000Y0D02*
|
||||||
|
X51000000Y0D01*
|
||||||
|
X2000000Y0D02*
|
||||||
|
G75*
|
||||||
|
G03*
|
||||||
|
X0Y-2000000I0J-2000000D01*
|
||||||
|
G01*
|
||||||
|
X12000000Y-1500000D02*
|
||||||
|
X12000000Y0D01*
|
||||||
|
X51000000Y-39000000D02*
|
||||||
|
X2000000Y-39000000D01*
|
||||||
|
X53000000Y-2000000D02*
|
||||||
|
X53000000Y-37000000D01*
|
||||||
|
X0Y-37000000D02*
|
||||||
|
G75*
|
||||||
|
G03*
|
||||||
|
X2000000Y-39000000I2000000J0D01*
|
||||||
|
G01*
|
||||||
|
X51000000Y-39000000D02*
|
||||||
|
G75*
|
||||||
|
G03*
|
||||||
|
X53000000Y-37000000I0J2000000D01*
|
||||||
|
G01*
|
||||||
|
M02*
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
%TF.GenerationSoftware,KiCad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1*%
|
||||||
|
%TF.CreationDate,2023-09-02T15:09:26-04:00*%
|
||||||
|
%TF.ProjectId,avclan-mockingboard-rounded,6176636c-616e-42d6-9d6f-636b696e6762,rev?*%
|
||||||
|
%TF.SameCoordinates,Original*%
|
||||||
|
%TF.FileFunction,Soldermask,Bot*%
|
||||||
|
%TF.FilePolarity,Negative*%
|
||||||
|
%FSLAX46Y46*%
|
||||||
|
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||||
|
G04 Created by KiCad (PCBNEW 7.0.7-7.0.7~ubuntu22.04.1) date 2023-09-02 15:09:26*
|
||||||
|
%MOMM*%
|
||||||
|
%LPD*%
|
||||||
|
G01*
|
||||||
|
G04 APERTURE LIST*
|
||||||
|
G04 Aperture macros list*
|
||||||
|
%AMRoundRect*
|
||||||
|
0 Rectangle with rounded corners*
|
||||||
|
0 $1 Rounding radius*
|
||||||
|
0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*
|
||||||
|
0 Add a 4 corners polygon primitive as box body*
|
||||||
|
4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*
|
||||||
|
0 Add four circle primitives for the rounded corners*
|
||||||
|
1,1,$1+$1,$2,$3*
|
||||||
|
1,1,$1+$1,$4,$5*
|
||||||
|
1,1,$1+$1,$6,$7*
|
||||||
|
1,1,$1+$1,$8,$9*
|
||||||
|
0 Add four rect primitives between the rounded corners*
|
||||||
|
20,1,$1+$1,$2,$3,$4,$5,0*
|
||||||
|
20,1,$1+$1,$4,$5,$6,$7,0*
|
||||||
|
20,1,$1+$1,$6,$7,$8,$9,0*
|
||||||
|
20,1,$1+$1,$8,$9,$2,$3,0*%
|
||||||
|
G04 Aperture macros list end*
|
||||||
|
%ADD10C,2.000000*%
|
||||||
|
%ADD11R,1.700000X1.700000*%
|
||||||
|
%ADD12O,1.700000X1.700000*%
|
||||||
|
%ADD13C,1.100000*%
|
||||||
|
%ADD14RoundRect,0.102000X-0.825000X0.825000X-0.825000X-0.825000X0.825000X-0.825000X0.825000X0.825000X0*%
|
||||||
|
%ADD15C,1.854000*%
|
||||||
|
%ADD16C,4.000000*%
|
||||||
|
%ADD17R,1.600000X1.600000*%
|
||||||
|
%ADD18C,1.600000*%
|
||||||
|
G04 APERTURE END LIST*
|
||||||
|
D10*
|
||||||
|
%TO.C,RV1*%
|
||||||
|
X49175000Y-22400000D03*
|
||||||
|
X47025000Y-32400000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,J4*%
|
||||||
|
X17500000Y-36200000D03*
|
||||||
|
D12*
|
||||||
|
X14960000Y-36200000D03*
|
||||||
|
X12420000Y-36200000D03*
|
||||||
|
X9880000Y-36200000D03*
|
||||||
|
X7340000Y-36200000D03*
|
||||||
|
X4800000Y-36200000D03*
|
||||||
|
%TD*%
|
||||||
|
D13*
|
||||||
|
%TO.C,J1*%
|
||||||
|
X9500000Y-2750000D03*
|
||||||
|
X9500000Y-7750000D03*
|
||||||
|
D14*
|
||||||
|
X14300000Y-2750000D03*
|
||||||
|
D15*
|
||||||
|
X5900000Y-7750000D03*
|
||||||
|
X11100000Y-10850000D03*
|
||||||
|
X5000000Y-2750000D03*
|
||||||
|
%TD*%
|
||||||
|
D16*
|
||||||
|
%TO.C,J2*%
|
||||||
|
X44055000Y-9020000D03*
|
||||||
|
X19055000Y-9020000D03*
|
||||||
|
D17*
|
||||||
|
X37095000Y-10440000D03*
|
||||||
|
D18*
|
||||||
|
X34325000Y-10440000D03*
|
||||||
|
X31555000Y-10440000D03*
|
||||||
|
X28785000Y-10440000D03*
|
||||||
|
X26015000Y-10440000D03*
|
||||||
|
X35710000Y-7600000D03*
|
||||||
|
X32940000Y-7600000D03*
|
||||||
|
X30170000Y-7600000D03*
|
||||||
|
X27400000Y-7600000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,J3*%
|
||||||
|
X9850000Y-31200000D03*
|
||||||
|
D12*
|
||||||
|
X7310000Y-31200000D03*
|
||||||
|
X4770000Y-31200000D03*
|
||||||
|
%TD*%
|
||||||
|
M02*
|
||||||
@@ -0,0 +1,323 @@
|
|||||||
|
%TF.GenerationSoftware,KiCad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1*%
|
||||||
|
%TF.CreationDate,2023-09-02T15:09:26-04:00*%
|
||||||
|
%TF.ProjectId,avclan-mockingboard-rounded,6176636c-616e-42d6-9d6f-636b696e6762,rev?*%
|
||||||
|
%TF.SameCoordinates,Original*%
|
||||||
|
%TF.FileFunction,Soldermask,Top*%
|
||||||
|
%TF.FilePolarity,Negative*%
|
||||||
|
%FSLAX46Y46*%
|
||||||
|
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||||
|
G04 Created by KiCad (PCBNEW 7.0.7-7.0.7~ubuntu22.04.1) date 2023-09-02 15:09:26*
|
||||||
|
%MOMM*%
|
||||||
|
%LPD*%
|
||||||
|
G01*
|
||||||
|
G04 APERTURE LIST*
|
||||||
|
G04 Aperture macros list*
|
||||||
|
%AMRoundRect*
|
||||||
|
0 Rectangle with rounded corners*
|
||||||
|
0 $1 Rounding radius*
|
||||||
|
0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*
|
||||||
|
0 Add a 4 corners polygon primitive as box body*
|
||||||
|
4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*
|
||||||
|
0 Add four circle primitives for the rounded corners*
|
||||||
|
1,1,$1+$1,$2,$3*
|
||||||
|
1,1,$1+$1,$4,$5*
|
||||||
|
1,1,$1+$1,$6,$7*
|
||||||
|
1,1,$1+$1,$8,$9*
|
||||||
|
0 Add four rect primitives between the rounded corners*
|
||||||
|
20,1,$1+$1,$2,$3,$4,$5,0*
|
||||||
|
20,1,$1+$1,$4,$5,$6,$7,0*
|
||||||
|
20,1,$1+$1,$6,$7,$8,$9,0*
|
||||||
|
20,1,$1+$1,$8,$9,$2,$3,0*%
|
||||||
|
G04 Aperture macros list end*
|
||||||
|
%ADD10RoundRect,0.200000X0.275000X-0.200000X0.275000X0.200000X-0.275000X0.200000X-0.275000X-0.200000X0*%
|
||||||
|
%ADD11RoundRect,0.200000X0.200000X0.275000X-0.200000X0.275000X-0.200000X-0.275000X0.200000X-0.275000X0*%
|
||||||
|
%ADD12RoundRect,0.250000X-0.325000X-0.650000X0.325000X-0.650000X0.325000X0.650000X-0.325000X0.650000X0*%
|
||||||
|
%ADD13RoundRect,0.218750X-0.218750X-0.256250X0.218750X-0.256250X0.218750X0.256250X-0.218750X0.256250X0*%
|
||||||
|
%ADD14RoundRect,0.225000X-0.225000X-0.250000X0.225000X-0.250000X0.225000X0.250000X-0.225000X0.250000X0*%
|
||||||
|
%ADD15RoundRect,0.250000X0.450000X-0.262500X0.450000X0.262500X-0.450000X0.262500X-0.450000X-0.262500X0*%
|
||||||
|
%ADD16RoundRect,0.250000X-1.000000X-0.900000X1.000000X-0.900000X1.000000X0.900000X-1.000000X0.900000X0*%
|
||||||
|
%ADD17RoundRect,0.250000X-1.000000X-0.650000X1.000000X-0.650000X1.000000X0.650000X-1.000000X0.650000X0*%
|
||||||
|
%ADD18C,2.000000*%
|
||||||
|
%ADD19RoundRect,0.150000X-0.512500X-0.150000X0.512500X-0.150000X0.512500X0.150000X-0.512500X0.150000X0*%
|
||||||
|
%ADD20RoundRect,0.140000X-0.170000X0.140000X-0.170000X-0.140000X0.170000X-0.140000X0.170000X0.140000X0*%
|
||||||
|
%ADD21RoundRect,0.200000X-0.200000X-0.275000X0.200000X-0.275000X0.200000X0.275000X-0.200000X0.275000X0*%
|
||||||
|
%ADD22RoundRect,0.250000X-0.850000X-0.350000X0.850000X-0.350000X0.850000X0.350000X-0.850000X0.350000X0*%
|
||||||
|
%ADD23RoundRect,0.249997X-2.950003X-2.650003X2.950003X-2.650003X2.950003X2.650003X-2.950003X2.650003X0*%
|
||||||
|
%ADD24RoundRect,0.250000X0.325000X0.650000X-0.325000X0.650000X-0.325000X-0.650000X0.325000X-0.650000X0*%
|
||||||
|
%ADD25RoundRect,0.250000X0.400000X0.600000X-0.400000X0.600000X-0.400000X-0.600000X0.400000X-0.600000X0*%
|
||||||
|
%ADD26RoundRect,0.250000X-0.262500X-0.450000X0.262500X-0.450000X0.262500X0.450000X-0.262500X0.450000X0*%
|
||||||
|
%ADD27RoundRect,0.140000X-0.140000X-0.170000X0.140000X-0.170000X0.140000X0.170000X-0.140000X0.170000X0*%
|
||||||
|
%ADD28R,1.700000X1.700000*%
|
||||||
|
%ADD29O,1.700000X1.700000*%
|
||||||
|
%ADD30RoundRect,0.150000X0.875000X0.150000X-0.875000X0.150000X-0.875000X-0.150000X0.875000X-0.150000X0*%
|
||||||
|
%ADD31C,1.100000*%
|
||||||
|
%ADD32RoundRect,0.102000X-0.825000X0.825000X-0.825000X-0.825000X0.825000X-0.825000X0.825000X0.825000X0*%
|
||||||
|
%ADD33C,1.854000*%
|
||||||
|
%ADD34C,4.000000*%
|
||||||
|
%ADD35R,1.600000X1.600000*%
|
||||||
|
%ADD36C,1.600000*%
|
||||||
|
%ADD37RoundRect,0.250000X0.650000X-0.325000X0.650000X0.325000X-0.650000X0.325000X-0.650000X-0.325000X0*%
|
||||||
|
%ADD38RoundRect,0.250000X-0.650000X0.325000X-0.650000X-0.325000X0.650000X-0.325000X0.650000X0.325000X0*%
|
||||||
|
%ADD39RoundRect,0.250000X-0.650000X1.000000X-0.650000X-1.000000X0.650000X-1.000000X0.650000X1.000000X0*%
|
||||||
|
G04 APERTURE END LIST*
|
||||||
|
D10*
|
||||||
|
%TO.C,R9*%
|
||||||
|
X26550000Y-15425000D03*
|
||||||
|
X26550000Y-13775000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R6*%
|
||||||
|
X14850000Y-11950331D03*
|
||||||
|
X13200000Y-11950331D03*
|
||||||
|
%TD*%
|
||||||
|
D12*
|
||||||
|
%TO.C,C3*%
|
||||||
|
X41450000Y-28100000D03*
|
||||||
|
X44400000Y-28100000D03*
|
||||||
|
%TD*%
|
||||||
|
D13*
|
||||||
|
%TO.C,D9*%
|
||||||
|
X16384118Y-18700000D03*
|
||||||
|
X17959118Y-18700000D03*
|
||||||
|
%TD*%
|
||||||
|
D14*
|
||||||
|
%TO.C,C5*%
|
||||||
|
X35900000Y-28700000D03*
|
||||||
|
X37450000Y-28700000D03*
|
||||||
|
%TD*%
|
||||||
|
D15*
|
||||||
|
%TO.C,R2*%
|
||||||
|
X32512500Y-17400000D03*
|
||||||
|
X32512500Y-15575000D03*
|
||||||
|
%TD*%
|
||||||
|
D16*
|
||||||
|
%TO.C,D4*%
|
||||||
|
X39400000Y-22300000D03*
|
||||||
|
X43700000Y-22300000D03*
|
||||||
|
%TD*%
|
||||||
|
D17*
|
||||||
|
%TO.C,D2*%
|
||||||
|
X39700000Y-18200000D03*
|
||||||
|
X43700000Y-18200000D03*
|
||||||
|
%TD*%
|
||||||
|
D18*
|
||||||
|
%TO.C,RV1*%
|
||||||
|
X49175000Y-22400000D03*
|
||||||
|
X47025000Y-32400000D03*
|
||||||
|
%TD*%
|
||||||
|
D19*
|
||||||
|
%TO.C,D6*%
|
||||||
|
X25662500Y-29050000D03*
|
||||||
|
X25662500Y-30950000D03*
|
||||||
|
X27937500Y-30000000D03*
|
||||||
|
%TD*%
|
||||||
|
D20*
|
||||||
|
%TO.C,C10*%
|
||||||
|
X18662500Y-15050000D03*
|
||||||
|
X18662500Y-16010000D03*
|
||||||
|
%TD*%
|
||||||
|
D21*
|
||||||
|
%TO.C,R7*%
|
||||||
|
X23500000Y-15325000D03*
|
||||||
|
X25150000Y-15325000D03*
|
||||||
|
%TD*%
|
||||||
|
D22*
|
||||||
|
%TO.C,U1*%
|
||||||
|
X35500000Y-30745000D03*
|
||||||
|
X35500000Y-33025000D03*
|
||||||
|
D23*
|
||||||
|
X41800000Y-33025000D03*
|
||||||
|
D22*
|
||||||
|
X35500000Y-35305000D03*
|
||||||
|
%TD*%
|
||||||
|
D24*
|
||||||
|
%TO.C,C1*%
|
||||||
|
X42875000Y-14100000D03*
|
||||||
|
X39925000Y-14100000D03*
|
||||||
|
%TD*%
|
||||||
|
%TO.C,C11*%
|
||||||
|
X10100000Y-13800000D03*
|
||||||
|
X7150000Y-13800000D03*
|
||||||
|
%TD*%
|
||||||
|
D25*
|
||||||
|
%TO.C,D10*%
|
||||||
|
X26550000Y-17250000D03*
|
||||||
|
X23050000Y-17250000D03*
|
||||||
|
%TD*%
|
||||||
|
D21*
|
||||||
|
%TO.C,R12*%
|
||||||
|
X7175000Y-11900000D03*
|
||||||
|
X8825000Y-11900000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R11*%
|
||||||
|
X6450000Y-28600000D03*
|
||||||
|
X4800000Y-28600000D03*
|
||||||
|
%TD*%
|
||||||
|
D26*
|
||||||
|
%TO.C,R3*%
|
||||||
|
X32587500Y-13775000D03*
|
||||||
|
X34412500Y-13775000D03*
|
||||||
|
%TD*%
|
||||||
|
D27*
|
||||||
|
%TO.C,C9*%
|
||||||
|
X22968236Y-33385000D03*
|
||||||
|
X23928236Y-33385000D03*
|
||||||
|
%TD*%
|
||||||
|
D28*
|
||||||
|
%TO.C,J4*%
|
||||||
|
X17500000Y-36200000D03*
|
||||||
|
D29*
|
||||||
|
X14960000Y-36200000D03*
|
||||||
|
X12420000Y-36200000D03*
|
||||||
|
X9880000Y-36200000D03*
|
||||||
|
X7340000Y-36200000D03*
|
||||||
|
X4800000Y-36200000D03*
|
||||||
|
%TD*%
|
||||||
|
D19*
|
||||||
|
%TO.C,D8*%
|
||||||
|
X28600000Y-34700000D03*
|
||||||
|
X28600000Y-36600000D03*
|
||||||
|
X30875000Y-35650000D03*
|
||||||
|
%TD*%
|
||||||
|
D30*
|
||||||
|
%TO.C,U2*%
|
||||||
|
X23278236Y-31950000D03*
|
||||||
|
X23278236Y-30680000D03*
|
||||||
|
X23278236Y-29410000D03*
|
||||||
|
X23278236Y-28140000D03*
|
||||||
|
X23278236Y-26870000D03*
|
||||||
|
X23278236Y-25600000D03*
|
||||||
|
X23278236Y-24330000D03*
|
||||||
|
X23278236Y-23060000D03*
|
||||||
|
X23278236Y-21790000D03*
|
||||||
|
X23278236Y-20520000D03*
|
||||||
|
X13978236Y-20520000D03*
|
||||||
|
X13978236Y-21790000D03*
|
||||||
|
X13978236Y-23060000D03*
|
||||||
|
X13978236Y-24330000D03*
|
||||||
|
X13978236Y-25600000D03*
|
||||||
|
X13978236Y-26870000D03*
|
||||||
|
X13978236Y-28140000D03*
|
||||||
|
X13978236Y-29410000D03*
|
||||||
|
X13978236Y-30680000D03*
|
||||||
|
X13978236Y-31950000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R13*%
|
||||||
|
X4050000Y-4600000D03*
|
||||||
|
X2400000Y-4600000D03*
|
||||||
|
%TD*%
|
||||||
|
D17*
|
||||||
|
%TO.C,D1*%
|
||||||
|
X45400000Y-14600000D03*
|
||||||
|
X49400000Y-14600000D03*
|
||||||
|
%TD*%
|
||||||
|
D31*
|
||||||
|
%TO.C,J1*%
|
||||||
|
X9500000Y-2750000D03*
|
||||||
|
X9500000Y-7750000D03*
|
||||||
|
D32*
|
||||||
|
X14300000Y-2750000D03*
|
||||||
|
D33*
|
||||||
|
X5900000Y-7750000D03*
|
||||||
|
X11100000Y-10850000D03*
|
||||||
|
X5000000Y-2750000D03*
|
||||||
|
%TD*%
|
||||||
|
D12*
|
||||||
|
%TO.C,C2*%
|
||||||
|
X41450000Y-25800000D03*
|
||||||
|
X44400000Y-25800000D03*
|
||||||
|
%TD*%
|
||||||
|
D19*
|
||||||
|
%TO.C,D7*%
|
||||||
|
X25600000Y-24100000D03*
|
||||||
|
X25600000Y-26000000D03*
|
||||||
|
X27875000Y-25050000D03*
|
||||||
|
%TD*%
|
||||||
|
D34*
|
||||||
|
%TO.C,J2*%
|
||||||
|
X44055000Y-9020000D03*
|
||||||
|
X19055000Y-9020000D03*
|
||||||
|
D35*
|
||||||
|
X37095000Y-10440000D03*
|
||||||
|
D36*
|
||||||
|
X34325000Y-10440000D03*
|
||||||
|
X31555000Y-10440000D03*
|
||||||
|
X28785000Y-10440000D03*
|
||||||
|
X26015000Y-10440000D03*
|
||||||
|
X35710000Y-7600000D03*
|
||||||
|
X32940000Y-7600000D03*
|
||||||
|
X30170000Y-7600000D03*
|
||||||
|
X27400000Y-7600000D03*
|
||||||
|
%TD*%
|
||||||
|
D37*
|
||||||
|
%TO.C,C7*%
|
||||||
|
X33000000Y-32200000D03*
|
||||||
|
X33000000Y-29250000D03*
|
||||||
|
%TD*%
|
||||||
|
D14*
|
||||||
|
%TO.C,C6*%
|
||||||
|
X35350000Y-37300000D03*
|
||||||
|
X36900000Y-37300000D03*
|
||||||
|
%TD*%
|
||||||
|
D10*
|
||||||
|
%TO.C,R4*%
|
||||||
|
X36212500Y-17300000D03*
|
||||||
|
X36212500Y-15650000D03*
|
||||||
|
%TD*%
|
||||||
|
D19*
|
||||||
|
%TO.C,U3*%
|
||||||
|
X14925000Y-15100000D03*
|
||||||
|
X14925000Y-16050000D03*
|
||||||
|
X14925000Y-17000000D03*
|
||||||
|
X17200000Y-17000000D03*
|
||||||
|
X17200000Y-15100000D03*
|
||||||
|
%TD*%
|
||||||
|
D28*
|
||||||
|
%TO.C,J3*%
|
||||||
|
X9850000Y-31200000D03*
|
||||||
|
D29*
|
||||||
|
X7310000Y-31200000D03*
|
||||||
|
X4770000Y-31200000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R10*%
|
||||||
|
X14984118Y-18700000D03*
|
||||||
|
X13334118Y-18700000D03*
|
||||||
|
%TD*%
|
||||||
|
%TO.C,R5*%
|
||||||
|
X14850000Y-13440331D03*
|
||||||
|
X13200000Y-13440331D03*
|
||||||
|
%TD*%
|
||||||
|
D38*
|
||||||
|
%TO.C,C8*%
|
||||||
|
X33000000Y-33900000D03*
|
||||||
|
X33000000Y-36850000D03*
|
||||||
|
%TD*%
|
||||||
|
D39*
|
||||||
|
%TO.C,D3*%
|
||||||
|
X49395000Y-6609669D03*
|
||||||
|
X49395000Y-10609669D03*
|
||||||
|
%TD*%
|
||||||
|
D37*
|
||||||
|
%TO.C,C12*%
|
||||||
|
X3200000Y-9150000D03*
|
||||||
|
X3200000Y-6200000D03*
|
||||||
|
%TD*%
|
||||||
|
D15*
|
||||||
|
%TO.C,R1*%
|
||||||
|
X34412500Y-17400000D03*
|
||||||
|
X34412500Y-15575000D03*
|
||||||
|
%TD*%
|
||||||
|
D37*
|
||||||
|
%TO.C,C4*%
|
||||||
|
X39400000Y-28400000D03*
|
||||||
|
X39400000Y-25450000D03*
|
||||||
|
%TD*%
|
||||||
|
D21*
|
||||||
|
%TO.C,R8*%
|
||||||
|
X23500000Y-13825000D03*
|
||||||
|
X25150000Y-13825000D03*
|
||||||
|
%TD*%
|
||||||
|
M02*
|
||||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
|||||||
|
M48
|
||||||
|
; DRILL file {KiCad 7.0.7-7.0.7~ubuntu22.04.1} date Sat 02 Sep 2023 03:09:26 PM EDT
|
||||||
|
; FORMAT={-:-/ absolute / inch / decimal}
|
||||||
|
; #@! TF.CreationDate,2023-09-02T15:09:26-04:00
|
||||||
|
; #@! TF.GenerationSoftware,Kicad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1
|
||||||
|
; #@! TF.FileFunction,NonPlated,1,4,NPTH
|
||||||
|
FMAT,2
|
||||||
|
INCH
|
||||||
|
; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill
|
||||||
|
T1C0.0433
|
||||||
|
%
|
||||||
|
G90
|
||||||
|
G05
|
||||||
|
T1
|
||||||
|
X0.374Y-0.1083
|
||||||
|
X0.374Y-0.3051
|
||||||
|
T0
|
||||||
|
M30
|
||||||
Binary file not shown.
@@ -0,0 +1,110 @@
|
|||||||
|
M48
|
||||||
|
; DRILL file {KiCad 7.0.7-7.0.7~ubuntu22.04.1} date Sat 02 Sep 2023 03:09:26 PM EDT
|
||||||
|
; FORMAT={-:-/ absolute / inch / decimal}
|
||||||
|
; #@! TF.CreationDate,2023-09-02T15:09:26-04:00
|
||||||
|
; #@! TF.GenerationSoftware,Kicad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1
|
||||||
|
; #@! TF.FileFunction,Plated,1,4,PTH
|
||||||
|
FMAT,2
|
||||||
|
INCH
|
||||||
|
; #@! TA.AperFunction,Plated,PTH,ViaDrill
|
||||||
|
T1C0.0157
|
||||||
|
; #@! TA.AperFunction,Plated,PTH,ComponentDrill
|
||||||
|
T2C0.0394
|
||||||
|
; #@! TA.AperFunction,Plated,PTH,ComponentDrill
|
||||||
|
T3C0.0433
|
||||||
|
; #@! TA.AperFunction,Plated,PTH,ComponentDrill
|
||||||
|
T4C0.1260
|
||||||
|
%
|
||||||
|
G90
|
||||||
|
G05
|
||||||
|
T1
|
||||||
|
X0.0591Y-0.0591
|
||||||
|
X0.0591Y-0.3543
|
||||||
|
X0.0591Y-0.6496
|
||||||
|
X0.2362Y-0.0394
|
||||||
|
X0.2441Y-0.4055
|
||||||
|
X0.4035Y-0.2402
|
||||||
|
X0.4843Y-1.2598
|
||||||
|
X0.4882Y-0.5
|
||||||
|
X0.5118Y-0.0394
|
||||||
|
X0.5197Y-1.2953
|
||||||
|
X0.5315Y-0.6417
|
||||||
|
X0.5492Y-0.3878
|
||||||
|
X0.563Y-0.3465
|
||||||
|
X0.6102Y-0.2382
|
||||||
|
X0.7087Y-0.4921
|
||||||
|
X0.7677Y-0.5925
|
||||||
|
X0.7692Y-0.6358
|
||||||
|
X0.7874Y-0.0394
|
||||||
|
X0.9646Y-0.2874
|
||||||
|
X0.9843Y-1.3031
|
||||||
|
X1.0236Y-0.4921
|
||||||
|
X1.0551Y-1.2579
|
||||||
|
X1.0748Y-1.3681
|
||||||
|
X1.1811Y-0.0394
|
||||||
|
X1.2047Y-1.2362
|
||||||
|
X1.2126Y-1.4764
|
||||||
|
X1.2205Y-1.0709
|
||||||
|
X1.2992Y-1.1024
|
||||||
|
X1.4567Y-0.0394
|
||||||
|
X1.4665Y-0.8071
|
||||||
|
X1.4764Y-0.3346
|
||||||
|
X1.4833Y-1.3012
|
||||||
|
X1.4862Y-1.0039
|
||||||
|
X1.4951Y-1.2382
|
||||||
|
X1.4951Y-1.3602
|
||||||
|
X1.5059Y-1.4764
|
||||||
|
X1.5236Y-0.6024
|
||||||
|
X1.5778Y-1.1732
|
||||||
|
X1.5787Y-1.437
|
||||||
|
X1.6447Y-1.1732
|
||||||
|
X1.6457Y-1.437
|
||||||
|
X1.7116Y-1.1634
|
||||||
|
X1.7126Y-1.437
|
||||||
|
X1.752Y-0.0394
|
||||||
|
X1.7904Y-1.2382
|
||||||
|
X1.7904Y-1.3031
|
||||||
|
X1.7904Y-1.3602
|
||||||
|
X1.7913Y-1.4764
|
||||||
|
X1.8012Y-1.0138
|
||||||
|
X1.8012Y-1.1122
|
||||||
|
X1.8504Y-0.4823
|
||||||
|
X1.8819Y-0.2598
|
||||||
|
X1.9449Y-0.189
|
||||||
|
X2.0079Y-0.2598
|
||||||
|
X2.0276Y-0.0591
|
||||||
|
X2.0276Y-0.4134
|
||||||
|
X2.0276Y-0.7677
|
||||||
|
X2.0276Y-1.122
|
||||||
|
X2.0276Y-1.4764
|
||||||
|
T2
|
||||||
|
X0.1878Y-1.2283
|
||||||
|
X0.189Y-1.4252
|
||||||
|
X0.2878Y-1.2283
|
||||||
|
X0.289Y-1.4252
|
||||||
|
X0.3878Y-1.2283
|
||||||
|
X0.389Y-1.4252
|
||||||
|
X0.489Y-1.4252
|
||||||
|
X0.589Y-1.4252
|
||||||
|
X0.689Y-1.4252
|
||||||
|
X1.0242Y-0.411
|
||||||
|
X1.0787Y-0.2992
|
||||||
|
X1.1333Y-0.411
|
||||||
|
X1.1878Y-0.2992
|
||||||
|
X1.2423Y-0.411
|
||||||
|
X1.2969Y-0.2992
|
||||||
|
X1.3514Y-0.411
|
||||||
|
X1.4059Y-0.2992
|
||||||
|
X1.4604Y-0.411
|
||||||
|
X1.8514Y-1.2756
|
||||||
|
X1.936Y-0.8819
|
||||||
|
T3
|
||||||
|
X0.1969Y-0.1083
|
||||||
|
X0.2323Y-0.3051
|
||||||
|
X0.437Y-0.4272
|
||||||
|
X0.563Y-0.1083
|
||||||
|
T4
|
||||||
|
X0.7502Y-0.3551
|
||||||
|
X1.7344Y-0.3551
|
||||||
|
T0
|
||||||
|
M30
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
%TF.GenerationSoftware,KiCad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1*%
|
||||||
|
%TF.CreationDate,2023-09-02T15:09:26-04:00*%
|
||||||
|
%TF.ProjectId,avclan-mockingboard-rounded,6176636c-616e-42d6-9d6f-636b696e6762,rev?*%
|
||||||
|
%TF.SameCoordinates,Original*%
|
||||||
|
%TF.FileFunction,Paste,Bot*%
|
||||||
|
%TF.FilePolarity,Positive*%
|
||||||
|
%FSLAX46Y46*%
|
||||||
|
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||||
|
G04 Created by KiCad (PCBNEW 7.0.7-7.0.7~ubuntu22.04.1) date 2023-09-02 15:09:26*
|
||||||
|
%MOMM*%
|
||||||
|
%LPD*%
|
||||||
|
G01*
|
||||||
|
G04 APERTURE LIST*
|
||||||
|
G04 APERTURE END LIST*
|
||||||
|
M02*
|
||||||
@@ -0,0 +1,268 @@
|
|||||||
|
%TF.GenerationSoftware,KiCad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1*%
|
||||||
|
%TF.CreationDate,2023-09-02T15:09:26-04:00*%
|
||||||
|
%TF.ProjectId,avclan-mockingboard-rounded,6176636c-616e-42d6-9d6f-636b696e6762,rev?*%
|
||||||
|
%TF.SameCoordinates,Original*%
|
||||||
|
%TF.FileFunction,Paste,Top*%
|
||||||
|
%TF.FilePolarity,Positive*%
|
||||||
|
%FSLAX46Y46*%
|
||||||
|
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||||
|
G04 Created by KiCad (PCBNEW 7.0.7-7.0.7~ubuntu22.04.1) date 2023-09-02 15:09:26*
|
||||||
|
%MOMM*%
|
||||||
|
%LPD*%
|
||||||
|
G01*
|
||||||
|
G04 APERTURE LIST*
|
||||||
|
G04 Aperture macros list*
|
||||||
|
%AMRoundRect*
|
||||||
|
0 Rectangle with rounded corners*
|
||||||
|
0 $1 Rounding radius*
|
||||||
|
0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*
|
||||||
|
0 Add a 4 corners polygon primitive as box body*
|
||||||
|
4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*
|
||||||
|
0 Add four circle primitives for the rounded corners*
|
||||||
|
1,1,$1+$1,$2,$3*
|
||||||
|
1,1,$1+$1,$4,$5*
|
||||||
|
1,1,$1+$1,$6,$7*
|
||||||
|
1,1,$1+$1,$8,$9*
|
||||||
|
0 Add four rect primitives between the rounded corners*
|
||||||
|
20,1,$1+$1,$2,$3,$4,$5,0*
|
||||||
|
20,1,$1+$1,$4,$5,$6,$7,0*
|
||||||
|
20,1,$1+$1,$6,$7,$8,$9,0*
|
||||||
|
20,1,$1+$1,$8,$9,$2,$3,0*%
|
||||||
|
G04 Aperture macros list end*
|
||||||
|
%ADD10RoundRect,0.200000X0.275000X-0.200000X0.275000X0.200000X-0.275000X0.200000X-0.275000X-0.200000X0*%
|
||||||
|
%ADD11RoundRect,0.200000X0.200000X0.275000X-0.200000X0.275000X-0.200000X-0.275000X0.200000X-0.275000X0*%
|
||||||
|
%ADD12RoundRect,0.250000X-0.325000X-0.650000X0.325000X-0.650000X0.325000X0.650000X-0.325000X0.650000X0*%
|
||||||
|
%ADD13RoundRect,0.218750X-0.218750X-0.256250X0.218750X-0.256250X0.218750X0.256250X-0.218750X0.256250X0*%
|
||||||
|
%ADD14RoundRect,0.225000X-0.225000X-0.250000X0.225000X-0.250000X0.225000X0.250000X-0.225000X0.250000X0*%
|
||||||
|
%ADD15RoundRect,0.250000X0.450000X-0.262500X0.450000X0.262500X-0.450000X0.262500X-0.450000X-0.262500X0*%
|
||||||
|
%ADD16RoundRect,0.250000X-1.000000X-0.900000X1.000000X-0.900000X1.000000X0.900000X-1.000000X0.900000X0*%
|
||||||
|
%ADD17RoundRect,0.250000X-1.000000X-0.650000X1.000000X-0.650000X1.000000X0.650000X-1.000000X0.650000X0*%
|
||||||
|
%ADD18RoundRect,0.150000X-0.512500X-0.150000X0.512500X-0.150000X0.512500X0.150000X-0.512500X0.150000X0*%
|
||||||
|
%ADD19RoundRect,0.140000X-0.170000X0.140000X-0.170000X-0.140000X0.170000X-0.140000X0.170000X0.140000X0*%
|
||||||
|
%ADD20RoundRect,0.200000X-0.200000X-0.275000X0.200000X-0.275000X0.200000X0.275000X-0.200000X0.275000X0*%
|
||||||
|
%ADD21RoundRect,0.250000X-0.850000X-0.350000X0.850000X-0.350000X0.850000X0.350000X-0.850000X0.350000X0*%
|
||||||
|
%ADD22RoundRect,0.250000X-1.275000X-1.125000X1.275000X-1.125000X1.275000X1.125000X-1.275000X1.125000X0*%
|
||||||
|
%ADD23RoundRect,0.250000X0.325000X0.650000X-0.325000X0.650000X-0.325000X-0.650000X0.325000X-0.650000X0*%
|
||||||
|
%ADD24RoundRect,0.250000X0.400000X0.600000X-0.400000X0.600000X-0.400000X-0.600000X0.400000X-0.600000X0*%
|
||||||
|
%ADD25RoundRect,0.250000X-0.262500X-0.450000X0.262500X-0.450000X0.262500X0.450000X-0.262500X0.450000X0*%
|
||||||
|
%ADD26RoundRect,0.140000X-0.140000X-0.170000X0.140000X-0.170000X0.140000X0.170000X-0.140000X0.170000X0*%
|
||||||
|
%ADD27RoundRect,0.150000X0.875000X0.150000X-0.875000X0.150000X-0.875000X-0.150000X0.875000X-0.150000X0*%
|
||||||
|
%ADD28RoundRect,0.250000X0.650000X-0.325000X0.650000X0.325000X-0.650000X0.325000X-0.650000X-0.325000X0*%
|
||||||
|
%ADD29RoundRect,0.250000X-0.650000X0.325000X-0.650000X-0.325000X0.650000X-0.325000X0.650000X0.325000X0*%
|
||||||
|
%ADD30RoundRect,0.250000X-0.650000X1.000000X-0.650000X-1.000000X0.650000X-1.000000X0.650000X1.000000X0*%
|
||||||
|
G04 APERTURE END LIST*
|
||||||
|
D10*
|
||||||
|
%TO.C,R9*%
|
||||||
|
X26550000Y-15425000D03*
|
||||||
|
X26550000Y-13775000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R6*%
|
||||||
|
X14850000Y-11950331D03*
|
||||||
|
X13200000Y-11950331D03*
|
||||||
|
%TD*%
|
||||||
|
D12*
|
||||||
|
%TO.C,C3*%
|
||||||
|
X41450000Y-28100000D03*
|
||||||
|
X44400000Y-28100000D03*
|
||||||
|
%TD*%
|
||||||
|
D13*
|
||||||
|
%TO.C,D9*%
|
||||||
|
X16384118Y-18700000D03*
|
||||||
|
X17959118Y-18700000D03*
|
||||||
|
%TD*%
|
||||||
|
D14*
|
||||||
|
%TO.C,C5*%
|
||||||
|
X35900000Y-28700000D03*
|
||||||
|
X37450000Y-28700000D03*
|
||||||
|
%TD*%
|
||||||
|
D15*
|
||||||
|
%TO.C,R2*%
|
||||||
|
X32512500Y-17400000D03*
|
||||||
|
X32512500Y-15575000D03*
|
||||||
|
%TD*%
|
||||||
|
D16*
|
||||||
|
%TO.C,D4*%
|
||||||
|
X39400000Y-22300000D03*
|
||||||
|
X43700000Y-22300000D03*
|
||||||
|
%TD*%
|
||||||
|
D17*
|
||||||
|
%TO.C,D2*%
|
||||||
|
X39700000Y-18200000D03*
|
||||||
|
X43700000Y-18200000D03*
|
||||||
|
%TD*%
|
||||||
|
D18*
|
||||||
|
%TO.C,D6*%
|
||||||
|
X25662500Y-29050000D03*
|
||||||
|
X25662500Y-30950000D03*
|
||||||
|
X27937500Y-30000000D03*
|
||||||
|
%TD*%
|
||||||
|
D19*
|
||||||
|
%TO.C,C10*%
|
||||||
|
X18662500Y-15050000D03*
|
||||||
|
X18662500Y-16010000D03*
|
||||||
|
%TD*%
|
||||||
|
D20*
|
||||||
|
%TO.C,R7*%
|
||||||
|
X23500000Y-15325000D03*
|
||||||
|
X25150000Y-15325000D03*
|
||||||
|
%TD*%
|
||||||
|
D21*
|
||||||
|
%TO.C,U1*%
|
||||||
|
X35500000Y-30745000D03*
|
||||||
|
X35500000Y-33025000D03*
|
||||||
|
D22*
|
||||||
|
X40125000Y-31500000D03*
|
||||||
|
X40125000Y-34550000D03*
|
||||||
|
X43475000Y-31500000D03*
|
||||||
|
X43475000Y-34550000D03*
|
||||||
|
D21*
|
||||||
|
X35500000Y-35305000D03*
|
||||||
|
%TD*%
|
||||||
|
D23*
|
||||||
|
%TO.C,C1*%
|
||||||
|
X42875000Y-14100000D03*
|
||||||
|
X39925000Y-14100000D03*
|
||||||
|
%TD*%
|
||||||
|
%TO.C,C11*%
|
||||||
|
X10100000Y-13800000D03*
|
||||||
|
X7150000Y-13800000D03*
|
||||||
|
%TD*%
|
||||||
|
D24*
|
||||||
|
%TO.C,D10*%
|
||||||
|
X26550000Y-17250000D03*
|
||||||
|
X23050000Y-17250000D03*
|
||||||
|
%TD*%
|
||||||
|
D20*
|
||||||
|
%TO.C,R12*%
|
||||||
|
X7175000Y-11900000D03*
|
||||||
|
X8825000Y-11900000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R11*%
|
||||||
|
X6450000Y-28600000D03*
|
||||||
|
X4800000Y-28600000D03*
|
||||||
|
%TD*%
|
||||||
|
D25*
|
||||||
|
%TO.C,R3*%
|
||||||
|
X32587500Y-13775000D03*
|
||||||
|
X34412500Y-13775000D03*
|
||||||
|
%TD*%
|
||||||
|
D26*
|
||||||
|
%TO.C,C9*%
|
||||||
|
X22968236Y-33385000D03*
|
||||||
|
X23928236Y-33385000D03*
|
||||||
|
%TD*%
|
||||||
|
D18*
|
||||||
|
%TO.C,D8*%
|
||||||
|
X28600000Y-34700000D03*
|
||||||
|
X28600000Y-36600000D03*
|
||||||
|
X30875000Y-35650000D03*
|
||||||
|
%TD*%
|
||||||
|
D27*
|
||||||
|
%TO.C,U2*%
|
||||||
|
X23278236Y-31950000D03*
|
||||||
|
X23278236Y-30680000D03*
|
||||||
|
X23278236Y-29410000D03*
|
||||||
|
X23278236Y-28140000D03*
|
||||||
|
X23278236Y-26870000D03*
|
||||||
|
X23278236Y-25600000D03*
|
||||||
|
X23278236Y-24330000D03*
|
||||||
|
X23278236Y-23060000D03*
|
||||||
|
X23278236Y-21790000D03*
|
||||||
|
X23278236Y-20520000D03*
|
||||||
|
X13978236Y-20520000D03*
|
||||||
|
X13978236Y-21790000D03*
|
||||||
|
X13978236Y-23060000D03*
|
||||||
|
X13978236Y-24330000D03*
|
||||||
|
X13978236Y-25600000D03*
|
||||||
|
X13978236Y-26870000D03*
|
||||||
|
X13978236Y-28140000D03*
|
||||||
|
X13978236Y-29410000D03*
|
||||||
|
X13978236Y-30680000D03*
|
||||||
|
X13978236Y-31950000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R13*%
|
||||||
|
X4050000Y-4600000D03*
|
||||||
|
X2400000Y-4600000D03*
|
||||||
|
%TD*%
|
||||||
|
D17*
|
||||||
|
%TO.C,D1*%
|
||||||
|
X45400000Y-14600000D03*
|
||||||
|
X49400000Y-14600000D03*
|
||||||
|
%TD*%
|
||||||
|
D12*
|
||||||
|
%TO.C,C2*%
|
||||||
|
X41450000Y-25800000D03*
|
||||||
|
X44400000Y-25800000D03*
|
||||||
|
%TD*%
|
||||||
|
D18*
|
||||||
|
%TO.C,D7*%
|
||||||
|
X25600000Y-24100000D03*
|
||||||
|
X25600000Y-26000000D03*
|
||||||
|
X27875000Y-25050000D03*
|
||||||
|
%TD*%
|
||||||
|
D28*
|
||||||
|
%TO.C,C7*%
|
||||||
|
X33000000Y-32200000D03*
|
||||||
|
X33000000Y-29250000D03*
|
||||||
|
%TD*%
|
||||||
|
D14*
|
||||||
|
%TO.C,C6*%
|
||||||
|
X35350000Y-37300000D03*
|
||||||
|
X36900000Y-37300000D03*
|
||||||
|
%TD*%
|
||||||
|
D10*
|
||||||
|
%TO.C,R4*%
|
||||||
|
X36212500Y-17300000D03*
|
||||||
|
X36212500Y-15650000D03*
|
||||||
|
%TD*%
|
||||||
|
D18*
|
||||||
|
%TO.C,U3*%
|
||||||
|
X14925000Y-15100000D03*
|
||||||
|
X14925000Y-16050000D03*
|
||||||
|
X14925000Y-17000000D03*
|
||||||
|
X17200000Y-17000000D03*
|
||||||
|
X17200000Y-15100000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,R10*%
|
||||||
|
X14984118Y-18700000D03*
|
||||||
|
X13334118Y-18700000D03*
|
||||||
|
%TD*%
|
||||||
|
%TO.C,R5*%
|
||||||
|
X14850000Y-13440331D03*
|
||||||
|
X13200000Y-13440331D03*
|
||||||
|
%TD*%
|
||||||
|
D29*
|
||||||
|
%TO.C,C8*%
|
||||||
|
X33000000Y-33900000D03*
|
||||||
|
X33000000Y-36850000D03*
|
||||||
|
%TD*%
|
||||||
|
D30*
|
||||||
|
%TO.C,D3*%
|
||||||
|
X49395000Y-6609669D03*
|
||||||
|
X49395000Y-10609669D03*
|
||||||
|
%TD*%
|
||||||
|
D28*
|
||||||
|
%TO.C,C12*%
|
||||||
|
X3200000Y-9150000D03*
|
||||||
|
X3200000Y-6200000D03*
|
||||||
|
%TD*%
|
||||||
|
D15*
|
||||||
|
%TO.C,R1*%
|
||||||
|
X34412500Y-17400000D03*
|
||||||
|
X34412500Y-15575000D03*
|
||||||
|
%TD*%
|
||||||
|
D28*
|
||||||
|
%TO.C,C4*%
|
||||||
|
X39400000Y-28400000D03*
|
||||||
|
X39400000Y-25450000D03*
|
||||||
|
%TD*%
|
||||||
|
D20*
|
||||||
|
%TO.C,R8*%
|
||||||
|
X23500000Y-13825000D03*
|
||||||
|
X25150000Y-13825000D03*
|
||||||
|
%TD*%
|
||||||
|
M02*
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
%TF.GenerationSoftware,KiCad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1*%
|
||||||
|
%TF.CreationDate,2023-09-02T15:09:26-04:00*%
|
||||||
|
%TF.ProjectId,avclan-mockingboard-rounded,6176636c-616e-42d6-9d6f-636b696e6762,rev?*%
|
||||||
|
%TF.SameCoordinates,Original*%
|
||||||
|
%TF.FileFunction,Legend,Bot*%
|
||||||
|
%TF.FilePolarity,Positive*%
|
||||||
|
%FSLAX46Y46*%
|
||||||
|
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||||
|
G04 Created by KiCad (PCBNEW 7.0.7-7.0.7~ubuntu22.04.1) date 2023-09-02 15:09:26*
|
||||||
|
%MOMM*%
|
||||||
|
%LPD*%
|
||||||
|
G01*
|
||||||
|
G04 APERTURE LIST*
|
||||||
|
G04 Aperture macros list*
|
||||||
|
%AMRoundRect*
|
||||||
|
0 Rectangle with rounded corners*
|
||||||
|
0 $1 Rounding radius*
|
||||||
|
0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*
|
||||||
|
0 Add a 4 corners polygon primitive as box body*
|
||||||
|
4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*
|
||||||
|
0 Add four circle primitives for the rounded corners*
|
||||||
|
1,1,$1+$1,$2,$3*
|
||||||
|
1,1,$1+$1,$4,$5*
|
||||||
|
1,1,$1+$1,$6,$7*
|
||||||
|
1,1,$1+$1,$8,$9*
|
||||||
|
0 Add four rect primitives between the rounded corners*
|
||||||
|
20,1,$1+$1,$2,$3,$4,$5,0*
|
||||||
|
20,1,$1+$1,$4,$5,$6,$7,0*
|
||||||
|
20,1,$1+$1,$6,$7,$8,$9,0*
|
||||||
|
20,1,$1+$1,$8,$9,$2,$3,0*%
|
||||||
|
G04 Aperture macros list end*
|
||||||
|
%ADD10C,2.000000*%
|
||||||
|
%ADD11R,1.700000X1.700000*%
|
||||||
|
%ADD12O,1.700000X1.700000*%
|
||||||
|
%ADD13C,1.100000*%
|
||||||
|
%ADD14RoundRect,0.102000X-0.825000X0.825000X-0.825000X-0.825000X0.825000X-0.825000X0.825000X0.825000X0*%
|
||||||
|
%ADD15C,1.854000*%
|
||||||
|
%ADD16C,4.000000*%
|
||||||
|
%ADD17R,1.600000X1.600000*%
|
||||||
|
%ADD18C,1.600000*%
|
||||||
|
G04 APERTURE END LIST*
|
||||||
|
%LPC*%
|
||||||
|
D10*
|
||||||
|
%TO.C,RV1*%
|
||||||
|
X49175000Y-22400000D03*
|
||||||
|
X47025000Y-32400000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,J4*%
|
||||||
|
X17500000Y-36200000D03*
|
||||||
|
D12*
|
||||||
|
X14960000Y-36200000D03*
|
||||||
|
X12420000Y-36200000D03*
|
||||||
|
X9880000Y-36200000D03*
|
||||||
|
X7340000Y-36200000D03*
|
||||||
|
X4800000Y-36200000D03*
|
||||||
|
%TD*%
|
||||||
|
D13*
|
||||||
|
%TO.C,J1*%
|
||||||
|
X9500000Y-2750000D03*
|
||||||
|
X9500000Y-7750000D03*
|
||||||
|
D14*
|
||||||
|
X14300000Y-2750000D03*
|
||||||
|
D15*
|
||||||
|
X5900000Y-7750000D03*
|
||||||
|
X11100000Y-10850000D03*
|
||||||
|
X5000000Y-2750000D03*
|
||||||
|
%TD*%
|
||||||
|
D16*
|
||||||
|
%TO.C,J2*%
|
||||||
|
X44055000Y-9020000D03*
|
||||||
|
X19055000Y-9020000D03*
|
||||||
|
D17*
|
||||||
|
X37095000Y-10440000D03*
|
||||||
|
D18*
|
||||||
|
X34325000Y-10440000D03*
|
||||||
|
X31555000Y-10440000D03*
|
||||||
|
X28785000Y-10440000D03*
|
||||||
|
X26015000Y-10440000D03*
|
||||||
|
X35710000Y-7600000D03*
|
||||||
|
X32940000Y-7600000D03*
|
||||||
|
X30170000Y-7600000D03*
|
||||||
|
X27400000Y-7600000D03*
|
||||||
|
%TD*%
|
||||||
|
D11*
|
||||||
|
%TO.C,J3*%
|
||||||
|
X9850000Y-31200000D03*
|
||||||
|
D12*
|
||||||
|
X7310000Y-31200000D03*
|
||||||
|
X4770000Y-31200000D03*
|
||||||
|
%TD*%
|
||||||
|
%LPD*%
|
||||||
|
M02*
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
|||||||
|
%TF.GenerationSoftware,KiCad,Pcbnew,7.0.7-7.0.7~ubuntu22.04.1*%
|
||||||
|
%TF.CreationDate,2023-09-02T15:09:26-04:00*%
|
||||||
|
%TF.ProjectId,avclan-mockingboard-rounded,6176636c-616e-42d6-9d6f-636b696e6762,rev?*%
|
||||||
|
%TF.SameCoordinates,Original*%
|
||||||
|
%TF.FileFunction,Other,Comment*%
|
||||||
|
%FSLAX46Y46*%
|
||||||
|
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||||
|
G04 Created by KiCad (PCBNEW 7.0.7-7.0.7~ubuntu22.04.1) date 2023-09-02 15:09:26*
|
||||||
|
%MOMM*%
|
||||||
|
%LPD*%
|
||||||
|
G01*
|
||||||
|
G04 APERTURE LIST*
|
||||||
|
G04 APERTURE END LIST*
|
||||||
|
M02*
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Comment,Designator,Footprint,LCSC
|
||||||
|
SM6T15A,D4,D_SMB,C118275
|
||||||
|
"BAT54A,215",D7,SOT-23-3,C130910
|
||||||
|
10u 50V,"C2,C3,C4",C_1206_3216Metric,C13585
|
||||||
|
SS210,"D1,D2",D_SMA,C14996
|
||||||
|
1u 50V,"C5,C6",C_0603_1608Metric,C15849
|
||||||
|
10k,"R4,R5,R6,R7,R8,R9",R_0603_1608Metric,C17414
|
||||||
|
120,R3,R_0805_2012Metric,C17437
|
||||||
|
15,"R12,R13",R_0603_1608Metric,C22810
|
||||||
|
KT-0603R,D9,LED_0603_1608Metric,C2286
|
||||||
|
470,"R10,R11",R_0603_1608Metric,C23179
|
||||||
|
4u7,"C10,C9",C_0402_1005Metric,C23733
|
||||||
|
180,"R1,R2",R_0805_2012Metric,C25270
|
||||||
|
1SMAF4742A,D3,D_SMA,C3013762
|
||||||
|
"BAT54C,215","D6,D8",SOT-23-3,C37704
|
||||||
|
74LVC1G66,U3,SOT-23-5,C5375974
|
||||||
|
3V3,D10,D_MiniMELF,C8056
|
||||||
|
1n 100V,C1,C_1206_3216Metric,C9196
|
||||||
|
47u 10V,"C11,C12,C7,C8",C_1206_3216Metric,C96123
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
Designator,Val,Package,Mid X,Mid Y,Rotation,Layer
|
||||||
|
C1,1n 100V,C_1206_3216Metric,41.4,-14.1,180,top
|
||||||
|
C2,10u 50V,C_1206_3216Metric,42.925,-25.8,0,top
|
||||||
|
C3,10u 50V,C_1206_3216Metric,42.925,-28.1,0,top
|
||||||
|
C4,10u 50V,C_1206_3216Metric,39.4,-26.925,90,top
|
||||||
|
C5,1u 50V,C_0603_1608Metric,36.675,-28.7,0,top
|
||||||
|
C6,1u 50V,C_0603_1608Metric,36.125,-37.3,0,top
|
||||||
|
C7,47u 10V,C_1206_3216Metric,33,-30.725,90,top
|
||||||
|
C8,47u 10V,C_1206_3216Metric,33,-35.375,-90,top
|
||||||
|
C9,4u7,C_0402_1005Metric,23.448236,-33.385,0,top
|
||||||
|
C10,4u7,C_0402_1005Metric,18.6625,-15.53,-90,top
|
||||||
|
C11,47u 10V,C_1206_3216Metric,8.625,-13.8,180,top
|
||||||
|
C12,47u 10V,C_1206_3216Metric,3.2,-7.675,90,top
|
||||||
|
D1,SS210,D_SMA,47.4,-14.6,0,top
|
||||||
|
D2,SS210,D_SMA,41.7,-18.2,0,top
|
||||||
|
D3,1SMAF4742A,D_SMA,49.395,-8.609669,-90,top
|
||||||
|
D4,SM6T15A,D_SMB,41.55,-22.3,0,top
|
||||||
|
D6,"BAT54C,215",SOT-23-3,26.8,-30,180,top
|
||||||
|
D7,"BAT54A,215",SOT-23-3,26.7375,-25.05,180,top
|
||||||
|
D8,"BAT54C,215",SOT-23-3,29.7375,-35.65,180,top
|
||||||
|
D9,KT-0603R,LED_0603_1608Metric,17.171618,-18.7,0,top
|
||||||
|
D10,3V3,D_MiniMELF,24.8,-17.25,180,top
|
||||||
|
R1,180,R_0805_2012Metric,34.4125,-16.4875,90,top
|
||||||
|
R2,180,R_0805_2012Metric,32.5125,-16.4875,90,top
|
||||||
|
R3,120,R_0805_2012Metric,33.5,-13.775,0,top
|
||||||
|
R4,10k,R_0603_1608Metric,36.2125,-16.475,90,top
|
||||||
|
R5,10k,R_0603_1608Metric,14.025,-13.440331,180,top
|
||||||
|
R6,10k,R_0603_1608Metric,14.025,-11.950331,180,top
|
||||||
|
R7,10k,R_0603_1608Metric,24.325,-15.325,0,top
|
||||||
|
R8,10k,R_0603_1608Metric,24.325,-13.825,0,top
|
||||||
|
R9,10k,R_0603_1608Metric,26.55,-14.6,90,top
|
||||||
|
R10,470,R_0603_1608Metric,14.159118,-18.7,180,top
|
||||||
|
R11,470,R_0603_1608Metric,5.625,-28.6,180,top
|
||||||
|
R12,15,R_0603_1608Metric,8,-11.9,0,top
|
||||||
|
R13,15,R_0603_1608Metric,3.225,-4.6,180,top
|
||||||
|
U3,74LVC1G66,SOT-23-5,16.0625,-16.05,180,top
|
||||||
|
BIN
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 174 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
(sym_lib_table
|
||||||
|
(version 7)
|
||||||
|
(lib (name "local")(type "KiCad")(uri "${KIPRJMOD}/local.kicad_sym")(options "")(descr ""))
|
||||||
|
(lib (name "audio")(type "Legacy")(uri "${KIPRJMOD}/SJ-43514.lib")(options "")(descr ""))
|
||||||
|
)
|
||||||
Executable
+6
@@ -0,0 +1,6 @@
|
|||||||
|
if [[ -c /dev/ttyUSB0 ]]; then
|
||||||
|
sudo chown root:$(id -gn $(whoami)) /dev/ttyUSB0
|
||||||
|
fi
|
||||||
|
if [[ -c /dev/ttyUSB1 ]]; then
|
||||||
|
sudo chown root:$(id -gn $(whoami)) /dev/ttyUSB1
|
||||||
|
fi
|
||||||
@@ -1 +1,2 @@
|
|||||||
sudo apk add make cmake avrdude avr-libc gcc-avr
|
sudo apk add make cmake avrdude avr-libc gcc-avr tshark
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# Packet analysis with Wireshark
|
||||||
|
|
||||||
|
- Install the Lua IEBUS/AVCLAN packet dissector to the Wireshark Lua Plugins folder
|
||||||
|
- Look in Help > About Wireshark dialog, Folders tab, "Personal Lua Plugins". It was `~/.local/lib/wireshark/plugins` for me, but it didn't exist until I manually created it.
|
||||||
|
- Copy or link `avclan_plugin.lua` to the Wireshark Lua Pluginds folder
|
||||||
|
- Linking is more convenient if modifying/developing the dissector
|
||||||
|
`ln -s $(pwd)/avclan_plugin.lua ~/.local/lib/wireshark/plugins/avclan_plugin.lua`
|
||||||
|
- The bridge script ([extcap/avclan-pcap.py](extcap/avclan-pcap.py)) needs Python 3 and, for live capture only, [pyserial](https://pypi.org/project/pyserial/). Install pyserial so the `python3` that Wireshark runs can import it (e.g. `pip install pyserial`, or your distro's `python3-serial`). The `--convert` mode and the Wireshark interface listing work without it. (Alternatively, run the script via [uv](https://docs.astral.sh/uv/) — `uv run --script extcap/avclan-pcap.py …` — which resolves the inline PEP 723 dependency automatically; but the GUI extcap uses plain `python3`, so the install above is what makes capture work there.)
|
||||||
|
|
||||||
|
## Live capture (Wireshark GUI)
|
||||||
|
|
||||||
|
The easiest way to stream packets is as an [extcap](https://www.wireshark.org/docs/man-pages/extcap.html) interface, which appears right in Wireshark's capture list:
|
||||||
|
|
||||||
|
- Make the script executable and link it into Wireshark's **Personal Extcap path** (Help > About Wireshark, Folders tab — alongside the Lua plugin folder above):
|
||||||
|
|
||||||
|
chmod +x extcap/avclan-pcap.py
|
||||||
|
mkdir ~/.local/lib/wireshark/extcap
|
||||||
|
ln -s "$(pwd)/extcap/avclan-pcap.py" ~/.local/lib/wireshark/extcap/avclan-pcap.py
|
||||||
|
|
||||||
|
- Restart Wireshark. **AVC-LAN (serial)** now shows up in the interface list. The script autodetects a USB-UART adapter; to override, open the interface's gear/options and set the serial port. Click the shark fin to start. Wireshark owns the process, so stopping the capture (or unplugging the adapter) shuts the bridge down cleanly.
|
||||||
|
|
||||||
|
## Live capture (command line)
|
||||||
|
|
||||||
|
If you prefer the pipe, the same script works as a plain producer:
|
||||||
|
|
||||||
|
./extcap/avclan-pcap.py --port /dev/ttyUSB0 | wireshark -k -i -
|
||||||
|
|
||||||
|
Omit `--port` (or pass `--port auto`) to autodetect the adapter.
|
||||||
|
|
||||||
|
## Converting a text log to pcap
|
||||||
|
|
||||||
|
The Mockingboard's text-mode REPL output (e.g. [msgdumps/myfile.txt](msgdumps/myfile.txt)) can be turned into a capture file offline:
|
||||||
|
|
||||||
|
./extcap/avclan-pcap.py --convert msgdumps/myfile.txt -o out.pcap
|
||||||
|
|
||||||
|
Use a `.pcapng` extension to get pcapng instead (requires `editcap`, which ships with Wireshark). With the Lua dissector installed, the result is recognized and dissected as IEBUS/AVCLAN packets.
|
||||||
File diff suppressed because it is too large
Load Diff
+456
@@ -0,0 +1,456 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# /// script
|
||||||
|
# requires-python = ">=3.9"
|
||||||
|
# dependencies = ["pyserial"]
|
||||||
|
# ///
|
||||||
|
"""AVC-LAN Mockingboard -> pcap bridge for Wireshark.
|
||||||
|
|
||||||
|
Three modes, one script:
|
||||||
|
|
||||||
|
* extcap - invoked by Wireshark; appears as the "AVC-LAN (serial)" capture
|
||||||
|
interface. Wireshark owns the process lifecycle, so stopping the
|
||||||
|
capture (or unplugging the adapter) tears everything down cleanly.
|
||||||
|
* pipe - run by hand: `./avclan-pcap.py --port /dev/ttyUSB0 | wireshark -k -i -`
|
||||||
|
* convert - turn a text-mode serial log into a pcap file offline:
|
||||||
|
`./avclan-pcap.py --convert msgdumps/myfile.txt -o out.pcap`
|
||||||
|
|
||||||
|
The firmware emits frames over serial at 1.2 Mbaud, 8N1, in one of two formats
|
||||||
|
(selected at the REPL). This script understands both and emits pcap with
|
||||||
|
linktype 162 (USER15), matching the avclan_plugin.lua dissector.
|
||||||
|
|
||||||
|
Discovery (the extcap query phases), `--convert`, and argument handling run on
|
||||||
|
the standard library alone, so the script keeps a plain `python3` shebang and
|
||||||
|
Wireshark can always exec it -- Wireshark launches extcaps with a minimal PATH,
|
||||||
|
which is why a `uv` shebang here would make the interface vanish from the GUI.
|
||||||
|
The one dependency, `pyserial`, is only needed to actually read the serial port:
|
||||||
|
capture fails with a clear message if it is missing. Install it normally (so the
|
||||||
|
`python3` invocation Wireshark uses can find it), or run the script via
|
||||||
|
`uv run --script` to have uv resolve the inline dependency above.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import signal
|
||||||
|
import struct
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import time
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# pcap on-the-wire format. Mirrors the old Julia PcapTools output exactly:
|
||||||
|
# nanosecond magic, snaplen 64, linktype 162 (DLT_USER15 / wtap.USER15).
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
PCAP_MAGIC_NS = 0xA1B23C4D
|
||||||
|
SNAPLEN = 64
|
||||||
|
LINKTYPE_USER15 = 162
|
||||||
|
|
||||||
|
PCAP_GLOBAL_HEADER = struct.pack(
|
||||||
|
"<IHHiIII",
|
||||||
|
PCAP_MAGIC_NS, # magic (nanosecond resolution, little-endian)
|
||||||
|
2, # version major
|
||||||
|
4, # version minor
|
||||||
|
0, # thiszone
|
||||||
|
0, # sigfigs
|
||||||
|
SNAPLEN, # snaplen
|
||||||
|
LINKTYPE_USER15,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Serial framing bytes emitted by AVCLAN_printframe(..., binary=1).
|
||||||
|
DLE = 0x10 # start of a binary frame
|
||||||
|
ETB = 0x17 # end of a binary frame (followed by \n; CR tolerated, see below)
|
||||||
|
MAX_DATA_LEN = 32 # AVCLAN payload cap; longer "length" => bad framing
|
||||||
|
|
||||||
|
BAUD = 1_200_000
|
||||||
|
|
||||||
|
# USB-UART bridge vendor IDs worth preferring during autodetect.
|
||||||
|
PREFERRED_VIDS = {
|
||||||
|
0x0403, # FTDI
|
||||||
|
0x10C4, # Silicon Labs CP210x
|
||||||
|
0x1A86, # WCH CH340/CH341
|
||||||
|
0x067B, # Prolific PL2303
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# pcap writing
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
def write_global_header(out):
|
||||||
|
out.write(PCAP_GLOBAL_HEADER)
|
||||||
|
out.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def write_record(out, ts_ns, payload):
|
||||||
|
sec, nsec = divmod(ts_ns, 1_000_000_000)
|
||||||
|
out.write(struct.pack("<IIII", sec, nsec, len(payload), len(payload)))
|
||||||
|
out.write(payload)
|
||||||
|
out.flush()
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Binary frame extraction (live capture / pipe modes)
|
||||||
|
#
|
||||||
|
# Length-based rather than line-based: the firmware does not escape payload
|
||||||
|
# bytes, so a data byte of 0x0A/0x10/0x17 must not be allowed to split a frame.
|
||||||
|
# We locate a DLE, read the fixed 7-byte header, trust its `length` field, then
|
||||||
|
# require an ETB exactly where it should be -- resyncing on any mismatch.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
def extract_frames(buf):
|
||||||
|
"""Pull complete frame payloads out of `buf`, consuming what it returns.
|
||||||
|
|
||||||
|
Yields the dissector-ready payload for each frame:
|
||||||
|
[is_unicast, ctrl_hi, ctrl_lo, periph_hi, periph_lo, control, length, data...]
|
||||||
|
Leaves any trailing partial frame in `buf` for the next call.
|
||||||
|
"""
|
||||||
|
frames = []
|
||||||
|
pos = 0
|
||||||
|
while True:
|
||||||
|
dle = buf.find(DLE, pos)
|
||||||
|
if dle == -1:
|
||||||
|
buf.clear()
|
||||||
|
return frames
|
||||||
|
# Need DLE + 7 header bytes (the last of which is `length`).
|
||||||
|
if len(buf) < dle + 8:
|
||||||
|
del buf[:dle]
|
||||||
|
return frames
|
||||||
|
length = buf[dle + 7]
|
||||||
|
if length > MAX_DATA_LEN:
|
||||||
|
pos = dle + 1 # spurious DLE; resync past it
|
||||||
|
continue
|
||||||
|
etb = dle + 8 + length # index where ETB must sit
|
||||||
|
if len(buf) < etb + 1:
|
||||||
|
del buf[:dle]
|
||||||
|
return frames
|
||||||
|
if buf[etb] != ETB:
|
||||||
|
pos = dle + 1 # framing mismatch; this DLE was not a real start
|
||||||
|
continue
|
||||||
|
frames.append(bytes(buf[dle + 1:etb])) # 7 header bytes + data
|
||||||
|
pos = etb + 1
|
||||||
|
while pos < len(buf) and buf[pos] in (0x0D, 0x0A):
|
||||||
|
pos += 1 # swallow the trailing \r\n
|
||||||
|
del buf[:pos]
|
||||||
|
pos = 0
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Serial helpers (lazy pyserial import)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
def detect_port():
|
||||||
|
"""Best-guess serial device, or None. Prefers known USB-UART bridges.
|
||||||
|
|
||||||
|
Uses pyserial's enumeration when available, but falls back to a stdlib
|
||||||
|
glob so the extcap config dialog still offers a sensible default before
|
||||||
|
pyserial has been pulled in.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
from serial.tools import list_ports
|
||||||
|
except ImportError:
|
||||||
|
import glob
|
||||||
|
cands = sorted(glob.glob("/dev/ttyUSB*")) + sorted(glob.glob("/dev/ttyACM*"))
|
||||||
|
return cands[0] if cands else None
|
||||||
|
|
||||||
|
ports = list(list_ports.comports())
|
||||||
|
if not ports:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def score(p):
|
||||||
|
s = 0
|
||||||
|
if p.vid in PREFERRED_VIDS:
|
||||||
|
s += 10
|
||||||
|
dev = p.device or ""
|
||||||
|
if "ttyUSB" in dev:
|
||||||
|
s += 3
|
||||||
|
elif "ttyACM" in dev:
|
||||||
|
s += 2
|
||||||
|
return s
|
||||||
|
|
||||||
|
ports.sort(key=score, reverse=True)
|
||||||
|
return ports[0].device
|
||||||
|
|
||||||
|
|
||||||
|
def ensure_pyserial():
|
||||||
|
"""Fail with a clear message if pyserial (capture-only) is unavailable."""
|
||||||
|
try:
|
||||||
|
import serial # noqa: F401
|
||||||
|
except ImportError:
|
||||||
|
sys.exit("error: capture requires pyserial, which is not installed.\n"
|
||||||
|
"Install it (e.g. `pip install pyserial`), or run this script via "
|
||||||
|
"`uv run --script` to pull in the inline dependency.")
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_port(requested):
|
||||||
|
"""Map a requested port (possibly None/"auto") to a concrete device."""
|
||||||
|
if requested and requested != "auto":
|
||||||
|
return requested
|
||||||
|
port = detect_port()
|
||||||
|
if not port:
|
||||||
|
sys.exit("error: no serial port given and none could be autodetected "
|
||||||
|
"(pass --port /dev/ttyUSBx)")
|
||||||
|
return port
|
||||||
|
|
||||||
|
|
||||||
|
def open_serial(port):
|
||||||
|
import serial # lazy: only the serial modes need it
|
||||||
|
|
||||||
|
# Flow control fully off: the binary payload can legitimately contain
|
||||||
|
# 0x11 (XON) / 0x13 (XOFF), which a flow-controlled link would eat.
|
||||||
|
return serial.Serial(
|
||||||
|
port,
|
||||||
|
BAUD,
|
||||||
|
timeout=0.2, # short, so signal flags get checked promptly
|
||||||
|
xonxoff=False,
|
||||||
|
rtscts=False,
|
||||||
|
dsrdtr=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Capture (extcap + pipe)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
_stop = False
|
||||||
|
|
||||||
|
|
||||||
|
def _request_stop(signum, frame):
|
||||||
|
global _stop
|
||||||
|
_stop = True
|
||||||
|
|
||||||
|
|
||||||
|
def run_capture(out, port):
|
||||||
|
"""Stream frames from the serial port to `out` until told to stop."""
|
||||||
|
ensure_pyserial() # re-execs under uv if pyserial is missing
|
||||||
|
import serial # for SerialException
|
||||||
|
|
||||||
|
port = resolve_port(port)
|
||||||
|
try:
|
||||||
|
ser = open_serial(port)
|
||||||
|
except serial.SerialException as e:
|
||||||
|
sys.exit("error: could not open %s: %s" % (port, e))
|
||||||
|
|
||||||
|
# Put the firmware into binary-frame mode (REPL 'X').
|
||||||
|
try:
|
||||||
|
ser.write(b"X")
|
||||||
|
except serial.SerialException:
|
||||||
|
pass
|
||||||
|
|
||||||
|
buf = bytearray()
|
||||||
|
try:
|
||||||
|
write_global_header(out)
|
||||||
|
while not _stop:
|
||||||
|
try:
|
||||||
|
chunk = ser.read(ser.in_waiting or 1)
|
||||||
|
except serial.SerialException:
|
||||||
|
break # adapter went away -> stop cleanly
|
||||||
|
if not chunk:
|
||||||
|
continue
|
||||||
|
buf.extend(chunk)
|
||||||
|
for payload in extract_frames(buf):
|
||||||
|
write_record(out, time.time_ns(), payload)
|
||||||
|
except (BrokenPipeError, OSError):
|
||||||
|
pass # Wireshark closed the fifo/pipe -> we're done
|
||||||
|
finally:
|
||||||
|
ser.close()
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Convert (offline text log -> pcap), replacing Julia avclan_text_to_pcap
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
TIME_RE = re.compile(r"^(\d{1,2}):(\d{2}):(\d{2})\.(\d+)$")
|
||||||
|
|
||||||
|
|
||||||
|
def parse_text_line(line, base_date):
|
||||||
|
"""Parse one text-mode log line.
|
||||||
|
|
||||||
|
Returns (ts_ns_or_None, payload) or None if the line is not a frame.
|
||||||
|
Line format (whitespace separated):
|
||||||
|
[HH:MM:SS.mmm] is_unicast controller peripheral control length data...
|
||||||
|
with the numeric fields in C-style notation (0x.. or plain decimal).
|
||||||
|
"""
|
||||||
|
tokens = line.split()
|
||||||
|
if len(tokens) < 5:
|
||||||
|
return None
|
||||||
|
|
||||||
|
ts_ns = None
|
||||||
|
m = TIME_RE.match(tokens[0])
|
||||||
|
if m:
|
||||||
|
h, mn, s, frac = m.groups()
|
||||||
|
micros = int(frac.ljust(6, "0")[:6])
|
||||||
|
try:
|
||||||
|
dt = datetime(base_date.year, base_date.month, base_date.day,
|
||||||
|
int(h), int(mn), int(s))
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
ts_ns = int(dt.timestamp()) * 1_000_000_000 + micros * 1000
|
||||||
|
tokens = tokens[1:]
|
||||||
|
|
||||||
|
if len(tokens) < 5:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
is_unicast = int(tokens[0], 0)
|
||||||
|
controller = int(tokens[1], 0)
|
||||||
|
peripheral = int(tokens[2], 0)
|
||||||
|
control = int(tokens[3], 0)
|
||||||
|
length = int(tokens[4], 0)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
data_tokens = tokens[5:]
|
||||||
|
if length > MAX_DATA_LEN or len(data_tokens) != length:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
data = bytes(int(d, 0) & 0xFF for d in data_tokens)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
payload = bytes([
|
||||||
|
is_unicast & 0xFF,
|
||||||
|
(controller >> 8) & 0xFF, controller & 0xFF,
|
||||||
|
(peripheral >> 8) & 0xFF, peripheral & 0xFF,
|
||||||
|
control & 0xFF,
|
||||||
|
length & 0xFF,
|
||||||
|
]) + data
|
||||||
|
return ts_ns, payload
|
||||||
|
|
||||||
|
|
||||||
|
def run_convert(infile, output):
|
||||||
|
# Date comes from the log's mtime (the lines only carry a wall-clock time);
|
||||||
|
# falls back to today if that is unavailable.
|
||||||
|
try:
|
||||||
|
base_date = datetime.fromtimestamp(os.path.getmtime(infile))
|
||||||
|
except OSError:
|
||||||
|
base_date = datetime.now()
|
||||||
|
|
||||||
|
want_pcapng = bool(output) and output.endswith(".pcapng")
|
||||||
|
tmp_path = None
|
||||||
|
if want_pcapng:
|
||||||
|
fd, tmp_path = tempfile.mkstemp(suffix=".pcap")
|
||||||
|
out = os.fdopen(fd, "wb")
|
||||||
|
close_out = True
|
||||||
|
elif output:
|
||||||
|
out = open(output, "wb")
|
||||||
|
close_out = True
|
||||||
|
else:
|
||||||
|
out = sys.stdout.buffer
|
||||||
|
close_out = False
|
||||||
|
|
||||||
|
last_ts = None
|
||||||
|
count = 0
|
||||||
|
try:
|
||||||
|
write_global_header(out)
|
||||||
|
with open(infile, "r") as f:
|
||||||
|
for line in f:
|
||||||
|
parsed = parse_text_line(line, base_date)
|
||||||
|
if parsed is None:
|
||||||
|
continue
|
||||||
|
ts_ns, payload = parsed
|
||||||
|
if ts_ns is None:
|
||||||
|
# No timestamp on this line; nudge past the previous one so
|
||||||
|
# ordering is preserved (mirrors the old Julia behaviour).
|
||||||
|
base = last_ts if last_ts is not None else time.time_ns()
|
||||||
|
ts_ns = base + 1000
|
||||||
|
write_record(out, ts_ns, payload)
|
||||||
|
last_ts = ts_ns
|
||||||
|
count += 1
|
||||||
|
finally:
|
||||||
|
if close_out:
|
||||||
|
out.close()
|
||||||
|
|
||||||
|
if want_pcapng:
|
||||||
|
editcap = shutil.which("editcap")
|
||||||
|
if editcap:
|
||||||
|
subprocess.run([editcap, "-F", "pcapng", tmp_path, output], check=True)
|
||||||
|
os.unlink(tmp_path)
|
||||||
|
else:
|
||||||
|
fallback = output[: -len(".pcapng")] + ".pcap"
|
||||||
|
shutil.move(tmp_path, fallback)
|
||||||
|
print("warning: editcap not found; wrote pcap to %s instead of %s"
|
||||||
|
% (fallback, output), file=sys.stderr)
|
||||||
|
output = fallback
|
||||||
|
|
||||||
|
if output:
|
||||||
|
print("wrote %d frames to %s" % (count, output), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# extcap argument phases
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
def extcap_interfaces():
|
||||||
|
print("extcap {version=1.0}{help=https://github.com/}"
|
||||||
|
"{display=AVC-LAN Mockingboard}")
|
||||||
|
print("interface {value=avclan}{display=AVC-LAN (serial)}")
|
||||||
|
|
||||||
|
|
||||||
|
def extcap_dlts():
|
||||||
|
print("dlt {number=%d}{name=USER15}{display=AVC-LAN / IEBus}" % LINKTYPE_USER15)
|
||||||
|
|
||||||
|
|
||||||
|
def extcap_config():
|
||||||
|
default = detect_port() or "auto"
|
||||||
|
print('arg {number=0}{call=--port}{display=Serial port}{type=string}'
|
||||||
|
'{tooltip=Serial device path, or "auto" to autodetect}'
|
||||||
|
'{default=%s}' % default)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# main
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(add_help=True)
|
||||||
|
# extcap discovery/lifecycle flags (Wireshark-driven)
|
||||||
|
parser.add_argument("--extcap-interfaces", action="store_true")
|
||||||
|
parser.add_argument("--extcap-dlts", action="store_true")
|
||||||
|
parser.add_argument("--extcap-config", action="store_true")
|
||||||
|
parser.add_argument("--extcap-interface")
|
||||||
|
parser.add_argument("--extcap-version")
|
||||||
|
parser.add_argument("--capture", action="store_true")
|
||||||
|
parser.add_argument("--fifo")
|
||||||
|
parser.add_argument("--extcap-control-in")
|
||||||
|
parser.add_argument("--extcap-control-out")
|
||||||
|
# shared / CLI
|
||||||
|
parser.add_argument("--port", help='serial device, or "auto"')
|
||||||
|
parser.add_argument("--convert", metavar="LOGFILE",
|
||||||
|
help="convert a text-mode serial log to pcap")
|
||||||
|
parser.add_argument("-o", "--output",
|
||||||
|
help="output file for --convert (.pcap or .pcapng); "
|
||||||
|
"stdout if omitted")
|
||||||
|
args, _ = parser.parse_known_args()
|
||||||
|
|
||||||
|
if args.extcap_interfaces:
|
||||||
|
extcap_interfaces()
|
||||||
|
return
|
||||||
|
if args.extcap_dlts:
|
||||||
|
extcap_dlts()
|
||||||
|
return
|
||||||
|
if args.extcap_config:
|
||||||
|
extcap_config()
|
||||||
|
return
|
||||||
|
if args.convert:
|
||||||
|
run_convert(args.convert, args.output)
|
||||||
|
return
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, _request_stop)
|
||||||
|
signal.signal(signal.SIGTERM, _request_stop)
|
||||||
|
|
||||||
|
if args.capture:
|
||||||
|
if not args.fifo:
|
||||||
|
sys.exit("error: --capture requires --fifo")
|
||||||
|
with open(args.fifo, "wb") as fifo:
|
||||||
|
run_capture(fifo, args.port)
|
||||||
|
return
|
||||||
|
|
||||||
|
# No mode flags: behave as a plain pipe into `wireshark -k -i -`.
|
||||||
|
run_capture(sys.stdout.buffer, args.port)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
main()
|
||||||
|
except BrokenPipeError:
|
||||||
|
# Reader (Wireshark) went away; exit quietly without a traceback.
|
||||||
|
try:
|
||||||
|
sys.stdout.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
os._exit(0)
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""One-off: convert a bracketed-timestamp AVC-LAN `log` dump into a pcap.
|
||||||
|
|
||||||
|
The capture in `msgdumps/log` is a foreign text format (not the firmware's):
|
||||||
|
|
||||||
|
[ 08:50:12.793 ] 1901F1040025C0EF
|
||||||
|
|
||||||
|
Each hex blob is a tight nibble packing of an AVC-LAN frame, with no spaces and
|
||||||
|
no leading is_unicast byte (unlike the firmware text format that
|
||||||
|
extcap/avclan-pcap.py's --convert handles):
|
||||||
|
|
||||||
|
controller : 3 hex nibbles (12-bit address)
|
||||||
|
peripheral : 3 hex nibbles (12-bit address)
|
||||||
|
length : 2 hex nibbles (1 byte: data byte count)
|
||||||
|
data : length bytes (2*length hex nibbles)
|
||||||
|
|
||||||
|
There is no control field in this format; the dissector wants one, so we
|
||||||
|
synthesize the standard AVC-LAN value (0x0F).
|
||||||
|
|
||||||
|
It emits pcap with linktype 162 (DLT_USER15), the payload layout the
|
||||||
|
avclan_plugin.lua dissector expects -- byte-for-byte compatible with
|
||||||
|
avclan-pcap.py's output:
|
||||||
|
|
||||||
|
[is_unicast, ctrl_hi, ctrl_lo, periph_hi, periph_lo, control, length, data...]
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
# pcap on-the-wire format -- mirrors avclan-pcap.py exactly:
|
||||||
|
# nanosecond magic, snaplen 64, linktype 162 (DLT_USER15 / wtap.USER15).
|
||||||
|
PCAP_MAGIC_NS = 0xA1B23C4D
|
||||||
|
SNAPLEN = 64
|
||||||
|
LINKTYPE_USER15 = 162
|
||||||
|
|
||||||
|
PCAP_GLOBAL_HEADER = struct.pack(
|
||||||
|
"<IHHiIII",
|
||||||
|
PCAP_MAGIC_NS, # magic (nanosecond resolution, little-endian)
|
||||||
|
2, # version major
|
||||||
|
4, # version minor
|
||||||
|
0, # thiszone
|
||||||
|
0, # sigfigs
|
||||||
|
SNAPLEN, # snaplen
|
||||||
|
LINKTYPE_USER15,
|
||||||
|
)
|
||||||
|
|
||||||
|
# AVC-LAN broadcast destination addresses -- a frame to anything else is unicast.
|
||||||
|
BROADCAST_ADDRS = {0x1FF, 0xFFF}
|
||||||
|
# This format omits the control field; synthesize the standard AVC-LAN value.
|
||||||
|
STANDARD_CONTROL = 0x0F
|
||||||
|
|
||||||
|
LINE_RE = re.compile(
|
||||||
|
r"^\[\s*(\d+):(\d+):(\d+)\.(\d+)\s*\]\s*([0-9A-Fa-f]+)\s*$"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def write_global_header(out):
|
||||||
|
out.write(PCAP_GLOBAL_HEADER)
|
||||||
|
|
||||||
|
|
||||||
|
def write_record(out, ts_ns, payload):
|
||||||
|
sec, nsec = divmod(ts_ns, 1_000_000_000)
|
||||||
|
out.write(struct.pack("<IIII", sec, nsec, len(payload), len(payload)))
|
||||||
|
out.write(payload)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_line(line, base_date):
|
||||||
|
"""Parse one log line -> (ts_ns, payload) or None if not a frame."""
|
||||||
|
m = LINE_RE.match(line)
|
||||||
|
if not m:
|
||||||
|
return None
|
||||||
|
h, mn, s, frac, hx = m.groups()
|
||||||
|
|
||||||
|
# Header is controller(3) + peripheral(3) + length(2) = 8 nibbles, no control.
|
||||||
|
if len(hx) < 8:
|
||||||
|
return None
|
||||||
|
length = int(hx[6:8], 16)
|
||||||
|
if len(hx) != 8 + 2 * length:
|
||||||
|
return None
|
||||||
|
|
||||||
|
controller = int(hx[0:3], 16)
|
||||||
|
peripheral = int(hx[3:6], 16)
|
||||||
|
control = STANDARD_CONTROL # not present in the log; synthesize the standard
|
||||||
|
is_unicast = 0 if peripheral in BROADCAST_ADDRS else 1
|
||||||
|
data = bytes.fromhex(hx[8:])
|
||||||
|
|
||||||
|
payload = bytes([
|
||||||
|
is_unicast,
|
||||||
|
(controller >> 8) & 0xFF, controller & 0xFF,
|
||||||
|
(peripheral >> 8) & 0xFF, peripheral & 0xFF,
|
||||||
|
control & 0xFF,
|
||||||
|
length & 0xFF,
|
||||||
|
]) + data
|
||||||
|
|
||||||
|
micros = int(frac.ljust(6, "0")[:6])
|
||||||
|
dt = datetime(base_date.year, base_date.month, base_date.day,
|
||||||
|
int(h), int(mn), int(s))
|
||||||
|
return dt, micros, payload
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
here = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__,
|
||||||
|
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
|
parser.add_argument("infile", nargs="?",
|
||||||
|
default=os.path.join(here, "msgdumps", "log"),
|
||||||
|
help="input log file (default: msgdumps/log)")
|
||||||
|
parser.add_argument("-o", "--output",
|
||||||
|
help="output pcap (default: <infile>.pcap)")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
output = args.output or (args.infile + ".pcap")
|
||||||
|
|
||||||
|
# Lines carry only wall-clock time; take the date from the log's mtime.
|
||||||
|
try:
|
||||||
|
base_date = datetime.fromtimestamp(os.path.getmtime(args.infile))
|
||||||
|
except OSError:
|
||||||
|
base_date = datetime.now()
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
skipped = 0
|
||||||
|
prev_tod = None # previous (h,m,s,micros) for midnight-rollover detection
|
||||||
|
day_offset = timedelta(0)
|
||||||
|
|
||||||
|
with open(args.infile, "r") as f, open(output, "wb") as out:
|
||||||
|
write_global_header(out)
|
||||||
|
for lineno, line in enumerate(f, 1):
|
||||||
|
if not line.strip():
|
||||||
|
continue
|
||||||
|
parsed = parse_line(line, base_date)
|
||||||
|
if parsed is None:
|
||||||
|
skipped += 1
|
||||||
|
print("skip: malformed line %d: %r" % (lineno, line.rstrip()),
|
||||||
|
file=sys.stderr)
|
||||||
|
continue
|
||||||
|
dt, micros, payload = parsed
|
||||||
|
tod = (dt.hour, dt.minute, dt.second, micros)
|
||||||
|
if prev_tod is not None and tod < prev_tod:
|
||||||
|
day_offset += timedelta(days=1) # wall clock wrapped past midnight
|
||||||
|
prev_tod = tod
|
||||||
|
dt = dt + day_offset
|
||||||
|
ts_ns = int(dt.timestamp()) * 1_000_000_000 + micros * 1000
|
||||||
|
write_record(out, ts_ns, payload)
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
print("wrote %d frames to %s%s" % (
|
||||||
|
count, output,
|
||||||
|
" (%d skipped)" % skipped if skipped else ""), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
+551
@@ -0,0 +1,551 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Keep the C++ Device/Action enums in sync with the Lua dissector tables.
|
||||||
|
|
||||||
|
The Wireshark dissector in scripts/packet-analysis/avclan_plugin.lua is the
|
||||||
|
authoritative source of truth for AVC-LAN device and action names. Its
|
||||||
|
`known_devices` / `known_actions` tables and the firmware's C++ enums
|
||||||
|
(`enum class Device` in src/avclan/device.hpp, `enum ... Action` in
|
||||||
|
src/avclan/avclan.h) encode the same numeric values and drift apart by hand.
|
||||||
|
|
||||||
|
This tool reconciles them, matching entries *by value* so a value renamed in
|
||||||
|
the dissector is propagated into C++ (and to every reference under src/), not
|
||||||
|
just added/removed.
|
||||||
|
|
||||||
|
Default (no flags) lint the dissector names AND report enum drift; write
|
||||||
|
nothing; exit non-zero if either has problems. This is
|
||||||
|
what the pre-commit hook runs.
|
||||||
|
--fix lint first (never fold an invalid name into C++), then
|
||||||
|
apply: rewrite the enum bodies and search-replace the
|
||||||
|
renamed members across src/.
|
||||||
|
--lint validate the dissector names only.
|
||||||
|
--verbose list every reference-site replacement made by --fix.
|
||||||
|
|
||||||
|
Reconciliation rules (see the project plan for the full rationale):
|
||||||
|
|
||||||
|
* Match by value. Names are compared with a case/separator-insensitive
|
||||||
|
canonical key, so a case-only difference (LIST_FUNCTIONS_REQ vs
|
||||||
|
List_Functions_Req) is NOT a change -- the existing C++ spelling is kept.
|
||||||
|
* A beyond-case difference is a rename: the C++ member is renamed to the
|
||||||
|
house-style form of the dissector name and all references are updated.
|
||||||
|
* Full mirror: every active dissector entry missing from C++ is added; if C++
|
||||||
|
carries a value the dissector lacks, that is an error (reported, not
|
||||||
|
dropped). Commented-out ("pencil-in") Lua entries are ignored.
|
||||||
|
* New/renamed members follow each enum's house style: Device -> UPPER_SNAKE,
|
||||||
|
Action -> Title_Case (with a small acronym allowlist kept uppercase).
|
||||||
|
* New members are inserted at their position in the Lua table (adjacent to
|
||||||
|
their nearest Lua neighbour that already exists in C++).
|
||||||
|
|
||||||
|
The dissector is expected to keep *approximately* valid identifiers: spaces and
|
||||||
|
punctuation are silently converted to single underscores. Only two hard rules
|
||||||
|
are enforced by --lint (a name must not start with a digit, and must be at
|
||||||
|
least 3 characters); the 3-char floor also keeps the reference search-replace
|
||||||
|
from colliding on 2-character tokens.
|
||||||
|
|
||||||
|
Runs as a pre-commit hook via .githooks/pre-commit; that directory is wired up
|
||||||
|
by the top-level CMake configure step (core.hooksPath). `git commit --no-verify`
|
||||||
|
still bypasses it.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# ---- locations -------------------------------------------------------------
|
||||||
|
|
||||||
|
LUA_REL = os.path.join("scripts", "packet-analysis", "avclan_plugin.lua")
|
||||||
|
SRC_REL = "src"
|
||||||
|
SRC_EXTS = (".c", ".cc", ".h", ".hpp")
|
||||||
|
|
||||||
|
# Enum specs are matched to a Lua table by NAME; addresses are auto-detected
|
||||||
|
# separately (no Address enum exists yet). `style` picks the identifier casing,
|
||||||
|
# `hexfmt` the literal format for freshly added members (matched per file).
|
||||||
|
ENUM_SPECS = [
|
||||||
|
{
|
||||||
|
"name": "Action",
|
||||||
|
"path": os.path.join("src", "avclan", "avclan.h"),
|
||||||
|
"lua_table": "known_actions",
|
||||||
|
"style": "action",
|
||||||
|
"hexfmt": "0x%02x",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Device",
|
||||||
|
"path": os.path.join("src", "avclan", "device.hpp"),
|
||||||
|
"lua_table": "known_devices",
|
||||||
|
"style": "device",
|
||||||
|
"hexfmt": "0x%02X",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
# Tokens kept fully uppercase when Title-casing an Action name, matching the
|
||||||
|
# existing hand-written style (CD_Enable_Repeat, Report_TOC). Note LAN -> Lan.
|
||||||
|
ACTION_ACRONYMS = {"CD", "TOC"}
|
||||||
|
|
||||||
|
# ---- name helpers ----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def sanitize(name):
|
||||||
|
"""Convert an approximate identifier to a valid one: non-word chars become
|
||||||
|
underscores and runs of underscores collapse to one."""
|
||||||
|
s = re.sub(r"[^0-9A-Za-z_]", "_", name)
|
||||||
|
s = re.sub(r"_+", "_", s)
|
||||||
|
return s.strip("_")
|
||||||
|
|
||||||
|
|
||||||
|
def canonical(name):
|
||||||
|
"""Case/separator-insensitive key used to match names by identity."""
|
||||||
|
return re.sub(r"[^0-9A-Za-z]", "", name).upper()
|
||||||
|
|
||||||
|
|
||||||
|
def style_device(name):
|
||||||
|
return sanitize(name).upper()
|
||||||
|
|
||||||
|
|
||||||
|
def style_action(name):
|
||||||
|
parts = [p for p in sanitize(name).split("_") if p]
|
||||||
|
out = []
|
||||||
|
for p in parts:
|
||||||
|
if p.upper() in ACTION_ACRONYMS:
|
||||||
|
out.append(p.upper())
|
||||||
|
else:
|
||||||
|
out.append(p[:1].upper() + p[1:].lower())
|
||||||
|
return "_".join(out)
|
||||||
|
|
||||||
|
|
||||||
|
STYLERS = {"device": style_device, "action": style_action}
|
||||||
|
|
||||||
|
# ---- parsing ---------------------------------------------------------------
|
||||||
|
|
||||||
|
# An active Lua entry: ` [0x11] = "NAME",` with no leading `--`. The regex
|
||||||
|
# anchors `[` right after the indentation, so commented `-- [0x..]` lines and
|
||||||
|
# prose comment lines never match. The name is taken from inside the quotes,
|
||||||
|
# so trailing `-- ...` comments are ignored.
|
||||||
|
LUA_ENTRY_RE = re.compile(r'^\s*\[\s*0x([0-9A-Fa-f]+)\s*\]\s*=\s*"([^"]*)"')
|
||||||
|
LUA_TABLE_OPEN = "local %s = {"
|
||||||
|
LUA_TABLE_CLOSE_RE = re.compile(r"^\s*\}")
|
||||||
|
|
||||||
|
# A C++ enum member: ` Name = 0x11,` (or decimal). `//`-commented members are
|
||||||
|
# skipped by the caller, so they count as absent.
|
||||||
|
CPP_MEMBER_RE = re.compile(r"^\s*([A-Za-z_]\w*)\s*=\s*(0x[0-9A-Fa-f]+|\d+)")
|
||||||
|
|
||||||
|
|
||||||
|
class LuaEntry:
|
||||||
|
def __init__(self, value, name, lineno):
|
||||||
|
self.value = value
|
||||||
|
self.name = name
|
||||||
|
self.lineno = lineno
|
||||||
|
|
||||||
|
|
||||||
|
class CppMember:
|
||||||
|
def __init__(self, value, name, idx):
|
||||||
|
self.value = value
|
||||||
|
self.name = name
|
||||||
|
self.idx = idx # 0-based index into the file's line list
|
||||||
|
|
||||||
|
|
||||||
|
def read_lines(path):
|
||||||
|
with open(path, "r") as f:
|
||||||
|
return f.readlines()
|
||||||
|
|
||||||
|
|
||||||
|
def parse_lua_table(lines, table_name):
|
||||||
|
"""Return the active entries of a Lua table, in file order."""
|
||||||
|
open_marker = LUA_TABLE_OPEN % table_name
|
||||||
|
start = None
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
if line.strip().startswith(open_marker):
|
||||||
|
start = i
|
||||||
|
break
|
||||||
|
if start is None:
|
||||||
|
return None
|
||||||
|
entries = []
|
||||||
|
for j in range(start + 1, len(lines)):
|
||||||
|
line = lines[j]
|
||||||
|
if LUA_TABLE_CLOSE_RE.match(line):
|
||||||
|
break
|
||||||
|
if line.lstrip().startswith("--"):
|
||||||
|
continue
|
||||||
|
m = LUA_ENTRY_RE.match(line)
|
||||||
|
if m:
|
||||||
|
entries.append(LuaEntry(int(m.group(1), 16), m.group(2), j + 1))
|
||||||
|
return entries
|
||||||
|
|
||||||
|
|
||||||
|
def find_enum_body(lines, enum_name):
|
||||||
|
"""Locate `enum [macro] <name> ... {` and its closing brace. Returns
|
||||||
|
(open_idx, close_idx) as line indices, or None."""
|
||||||
|
open_re = re.compile(r"^\s*enum\b[^{;]*\b%s\b[^{;]*\{" % re.escape(enum_name))
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
if open_re.match(line):
|
||||||
|
for j in range(i + 1, len(lines)):
|
||||||
|
if LUA_TABLE_CLOSE_RE.match(lines[j]): # `^\s*}` works for C++ too
|
||||||
|
return i, j
|
||||||
|
return i, len(lines) - 1
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def parse_cpp_enum(lines, enum_name):
|
||||||
|
"""Return (members, open_idx, close_idx, indent) for a C++ enum, ignoring
|
||||||
|
commented-out members."""
|
||||||
|
body = find_enum_body(lines, enum_name)
|
||||||
|
if body is None:
|
||||||
|
return None
|
||||||
|
open_idx, close_idx = body
|
||||||
|
members = []
|
||||||
|
indent = " "
|
||||||
|
for j in range(open_idx + 1, close_idx):
|
||||||
|
stripped = lines[j].lstrip()
|
||||||
|
if stripped.startswith("//") or not stripped:
|
||||||
|
continue
|
||||||
|
m = CPP_MEMBER_RE.match(lines[j])
|
||||||
|
if m:
|
||||||
|
token = m.group(2)
|
||||||
|
value = int(token, 16) if token.lower().startswith("0x") else int(token)
|
||||||
|
members.append(CppMember(value, m.group(1), j))
|
||||||
|
indent = lines[j][: len(lines[j]) - len(lines[j].lstrip())]
|
||||||
|
return members, open_idx, close_idx, indent
|
||||||
|
|
||||||
|
|
||||||
|
def find_address_spec(root):
|
||||||
|
"""Auto-detect an `enum ... Address ... {` under src/, so addresses sync
|
||||||
|
automatically once such an enum is introduced. None today."""
|
||||||
|
addr_re = re.compile(r"^\s*enum\b[^{;]*\bAddress\b[^{;]*\{")
|
||||||
|
for path in iter_src_files(root):
|
||||||
|
if not path.endswith((".h", ".hpp")):
|
||||||
|
continue
|
||||||
|
with open(path, "r") as f:
|
||||||
|
for line in f:
|
||||||
|
if addr_re.match(line):
|
||||||
|
return {
|
||||||
|
"name": "Address",
|
||||||
|
"path": os.path.relpath(path, root),
|
||||||
|
"lua_table": "known_addresses",
|
||||||
|
"style": "device",
|
||||||
|
"hexfmt": "0x%03X",
|
||||||
|
}
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def iter_src_files(root):
|
||||||
|
"""List source files under src/, via `git ls-files` so paths excluded by
|
||||||
|
.gitignore (e.g. the ESP32 port's CMake build directory, which vendors
|
||||||
|
FetchContent'd third-party code) are never walked into."""
|
||||||
|
out = subprocess.run(
|
||||||
|
["git", "-C", root, "ls-files", "-z", "--cached", "--others",
|
||||||
|
"--exclude-standard", "--", SRC_REL],
|
||||||
|
capture_output=True, check=True, text=True,
|
||||||
|
).stdout
|
||||||
|
paths = sorted(p for p in out.split("\0") if p.endswith(SRC_EXTS))
|
||||||
|
return [os.path.join(root, p) for p in paths]
|
||||||
|
|
||||||
|
# ---- lint ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def lint_table(entries, path):
|
||||||
|
"""Return a list of (lineno, name, reason) for dissector names that break a
|
||||||
|
hard rule."""
|
||||||
|
problems = []
|
||||||
|
seen = {}
|
||||||
|
for e in entries:
|
||||||
|
s = sanitize(e.name)
|
||||||
|
if not s or s[0].isdigit():
|
||||||
|
problems.append((e.lineno, e.name, "starts with a digit"))
|
||||||
|
continue
|
||||||
|
if len(s) < 3:
|
||||||
|
problems.append((e.lineno, e.name, "shorter than 3 characters"))
|
||||||
|
key = s.upper()
|
||||||
|
if key in seen:
|
||||||
|
problems.append((e.lineno, e.name,
|
||||||
|
"collides with '%s' (line %d) after sanitize"
|
||||||
|
% (seen[key][0], seen[key][1])))
|
||||||
|
else:
|
||||||
|
seen[key] = (e.name, e.lineno)
|
||||||
|
return problems
|
||||||
|
|
||||||
|
# ---- reconciliation --------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
class Drift:
|
||||||
|
def __init__(self, spec):
|
||||||
|
self.spec = spec
|
||||||
|
self.renames = [] # (old_name, new_name, value)
|
||||||
|
self.adds = [] # (value, new_name)
|
||||||
|
self.cpp_only = [] # (value, name)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
return not (self.renames or self.adds or self.cpp_only)
|
||||||
|
|
||||||
|
|
||||||
|
def reconcile(spec, lua_entries, members):
|
||||||
|
stylefn = STYLERS[spec["style"]]
|
||||||
|
drift = Drift(spec)
|
||||||
|
cpp_by_val = {m.value: m for m in members}
|
||||||
|
lua_vals = set()
|
||||||
|
for e in lua_entries:
|
||||||
|
lua_vals.add(e.value)
|
||||||
|
target = stylefn(e.name)
|
||||||
|
if e.value in cpp_by_val:
|
||||||
|
cur = cpp_by_val[e.value].name
|
||||||
|
if canonical(cur) != canonical(e.name):
|
||||||
|
drift.renames.append((cur, target, e.value))
|
||||||
|
else:
|
||||||
|
drift.adds.append((e.value, target))
|
||||||
|
for m in members:
|
||||||
|
if m.value not in lua_vals:
|
||||||
|
drift.cpp_only.append((m.value, m.name))
|
||||||
|
return drift
|
||||||
|
|
||||||
|
# ---- fix: rewrite enum bodies + references ---------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def compute_insertions(adds, lua_order, present_idx, close_idx, indent, hexfmt):
|
||||||
|
"""Map each added value to the line index it should be inserted before,
|
||||||
|
mirroring the Lua table order. Returns {index: [rendered_line, ...]}."""
|
||||||
|
groups = {}
|
||||||
|
order_pos = {v: i for i, v in enumerate(lua_order)}
|
||||||
|
for value, name in adds: # adds are already in Lua order
|
||||||
|
pos = order_pos[value]
|
||||||
|
ins = None
|
||||||
|
for j in range(pos - 1, -1, -1):
|
||||||
|
if lua_order[j] in present_idx:
|
||||||
|
ins = present_idx[lua_order[j]] + 1
|
||||||
|
break
|
||||||
|
if ins is None:
|
||||||
|
for j in range(pos + 1, len(lua_order)):
|
||||||
|
if lua_order[j] in present_idx:
|
||||||
|
ins = present_idx[lua_order[j]]
|
||||||
|
break
|
||||||
|
if ins is None:
|
||||||
|
ins = close_idx
|
||||||
|
line = "%s%s = %s,\n" % (indent, name, hexfmt % value)
|
||||||
|
groups.setdefault(ins, []).append(line)
|
||||||
|
return groups
|
||||||
|
|
||||||
|
|
||||||
|
def apply_additions(path, spec, lua_entries, drift):
|
||||||
|
if not drift.adds:
|
||||||
|
return
|
||||||
|
lines = read_lines(path)
|
||||||
|
parsed = parse_cpp_enum(lines, spec["name"])
|
||||||
|
members, _open_idx, close_idx, indent = parsed
|
||||||
|
present_idx = {m.value: m.idx for m in members}
|
||||||
|
lua_order = [e.value for e in lua_entries]
|
||||||
|
groups = compute_insertions(drift.adds, lua_order, present_idx,
|
||||||
|
close_idx, indent, spec["hexfmt"])
|
||||||
|
for ins in sorted(groups, reverse=True):
|
||||||
|
lines[ins:ins] = groups[ins]
|
||||||
|
with open(path, "w") as f:
|
||||||
|
f.writelines(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def replace_in_code(content, pattern, repl):
|
||||||
|
"""Apply `pattern` only to code, leaving comments, string literals and char
|
||||||
|
literals untouched -- a bare token like a renamed enum member must not be
|
||||||
|
rewritten where it merely appears in prose (e.g. `CSMA/CD` in a comment)."""
|
||||||
|
out = []
|
||||||
|
i = 0
|
||||||
|
n = len(content)
|
||||||
|
while i < n:
|
||||||
|
c = content[i]
|
||||||
|
nxt = content[i + 1] if i + 1 < n else ""
|
||||||
|
if c == "/" and nxt == "/":
|
||||||
|
j = content.find("\n", i)
|
||||||
|
j = n if j == -1 else j
|
||||||
|
out.append(content[i:j])
|
||||||
|
i = j
|
||||||
|
elif c == "/" and nxt == "*":
|
||||||
|
j = content.find("*/", i + 2)
|
||||||
|
j = n if j == -1 else j + 2
|
||||||
|
out.append(content[i:j])
|
||||||
|
i = j
|
||||||
|
elif c == '"' or (c == "'" and not (i > 0 and (content[i - 1].isalnum()
|
||||||
|
or content[i - 1] == "_"))):
|
||||||
|
# string, or a char literal (not a C++ digit separator like 1'000)
|
||||||
|
quote = c
|
||||||
|
j = i + 1
|
||||||
|
while j < n:
|
||||||
|
if content[j] == "\\":
|
||||||
|
j += 2
|
||||||
|
continue
|
||||||
|
if content[j] == quote:
|
||||||
|
j += 1
|
||||||
|
break
|
||||||
|
j += 1
|
||||||
|
out.append(content[i:j])
|
||||||
|
i = j
|
||||||
|
else:
|
||||||
|
j = i
|
||||||
|
while j < n:
|
||||||
|
cj = content[j]
|
||||||
|
cj1 = content[j + 1] if j + 1 < n else ""
|
||||||
|
if cj == '"':
|
||||||
|
break
|
||||||
|
if cj == "'" and not (content[j - 1].isalnum() or content[j - 1] == "_"):
|
||||||
|
break
|
||||||
|
if cj == "/" and (cj1 == "/" or cj1 == "*"):
|
||||||
|
break
|
||||||
|
j += 1
|
||||||
|
out.append(pattern.sub(repl, content[i:j]))
|
||||||
|
i = j
|
||||||
|
return "".join(out)
|
||||||
|
|
||||||
|
|
||||||
|
# A token right after one of these keywords is *introducing a name* (a type,
|
||||||
|
# enum, etc.), not referencing our enum member -- skip it so a member name that
|
||||||
|
# collides with an unrelated type (e.g. `enum CD { ... }`) is left alone.
|
||||||
|
DECL_KEYWORD_RE = re.compile(r"\b(?:enum|class|struct|union|namespace|typedef)\s+$")
|
||||||
|
|
||||||
|
|
||||||
|
def apply_renames(root, renames, verbose):
|
||||||
|
"""Replace whole-word code occurrences of every renamed member across src/.
|
||||||
|
A single simultaneous pass (alternation) avoids A->B->C chaining."""
|
||||||
|
if not renames:
|
||||||
|
return
|
||||||
|
mapping = {old: new for old, new, _v in renames}
|
||||||
|
pattern = re.compile(r"\b(%s)\b" % "|".join(re.escape(o) for o in mapping))
|
||||||
|
for path in iter_src_files(root):
|
||||||
|
with open(path, "r") as f:
|
||||||
|
content = f.read()
|
||||||
|
count = [0]
|
||||||
|
|
||||||
|
def repl(m):
|
||||||
|
if DECL_KEYWORD_RE.search(m.string[: m.start()]):
|
||||||
|
return m.group(0) # a declaration, not a member reference
|
||||||
|
count[0] += 1
|
||||||
|
return mapping[m.group(1)]
|
||||||
|
|
||||||
|
new_content = replace_in_code(content, pattern, repl)
|
||||||
|
if new_content != content:
|
||||||
|
with open(path, "w") as f:
|
||||||
|
f.write(new_content)
|
||||||
|
if verbose:
|
||||||
|
print(" %s: %d replacement(s)" % (os.path.relpath(path, root), count[0]))
|
||||||
|
|
||||||
|
# ---- reporting -------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def print_lint(spec, path, problems):
|
||||||
|
for lineno, name, reason in problems:
|
||||||
|
print(" %s:%d: %r -- %s" % (path, lineno, name, reason))
|
||||||
|
|
||||||
|
|
||||||
|
def print_drift(drift):
|
||||||
|
spec = drift.spec
|
||||||
|
for old, new, value in drift.renames:
|
||||||
|
print(" rename %s -> %s (0x%02X)" % (old, new, value))
|
||||||
|
for value, name in drift.adds:
|
||||||
|
print(" add %s = 0x%02X" % (name, value))
|
||||||
|
for value, name in drift.cpp_only:
|
||||||
|
print(" ERROR %s (0x%02X) is in C++ %s but not the dissector"
|
||||||
|
% (name, value, spec["name"]))
|
||||||
|
|
||||||
|
# ---- driver ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def build_specs(root):
|
||||||
|
specs = list(ENUM_SPECS)
|
||||||
|
addr = find_address_spec(root)
|
||||||
|
if addr:
|
||||||
|
specs.append(addr)
|
||||||
|
return specs, addr is not None
|
||||||
|
|
||||||
|
|
||||||
|
def load(root, spec, lua_lines):
|
||||||
|
entries = parse_lua_table(lua_lines, spec["lua_table"])
|
||||||
|
if entries is None:
|
||||||
|
sys.exit("error: Lua table '%s' not found" % spec["lua_table"])
|
||||||
|
parsed = parse_cpp_enum(read_lines(os.path.join(root, spec["path"])), spec["name"])
|
||||||
|
if parsed is None:
|
||||||
|
sys.exit("error: C++ enum '%s' not found in %s" % (spec["name"], spec["path"]))
|
||||||
|
return entries, parsed[0]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
|
parser.add_argument("--fix", action="store_true",
|
||||||
|
help="apply the sync (rewrite enums + references)")
|
||||||
|
parser.add_argument("--lint", action="store_true",
|
||||||
|
help="validate dissector names only")
|
||||||
|
parser.add_argument("--verbose", action="store_true",
|
||||||
|
help="list every reference replacement made by --fix")
|
||||||
|
parser.add_argument("--root",
|
||||||
|
help="repo root (default: inferred from this script)")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
root = args.root or os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
lua_path = os.path.join(root, LUA_REL)
|
||||||
|
lua_lines = read_lines(lua_path)
|
||||||
|
specs, have_address = build_specs(root)
|
||||||
|
|
||||||
|
# ---- lint (all modes) ----
|
||||||
|
lint_failed = False
|
||||||
|
for spec in specs:
|
||||||
|
entries = parse_lua_table(lua_lines, spec["lua_table"])
|
||||||
|
if entries is None:
|
||||||
|
sys.exit("error: Lua table '%s' not found" % spec["lua_table"])
|
||||||
|
problems = lint_table(entries, LUA_REL)
|
||||||
|
if problems:
|
||||||
|
lint_failed = True
|
||||||
|
print("dissector name problems in %s (%s):" % (spec["lua_table"], LUA_REL))
|
||||||
|
print_lint(spec, LUA_REL, problems)
|
||||||
|
|
||||||
|
if args.lint:
|
||||||
|
if not have_address:
|
||||||
|
print("note: no Address enum found in src/ -- addresses not synced")
|
||||||
|
if lint_failed:
|
||||||
|
print("lint: FAILED")
|
||||||
|
return 1
|
||||||
|
print("lint: ok")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# ---- reconcile ----
|
||||||
|
drifts = []
|
||||||
|
for spec in specs:
|
||||||
|
entries, members = load(root, spec, lua_lines)
|
||||||
|
drifts.append((spec, entries, reconcile(spec, entries, members)))
|
||||||
|
|
||||||
|
has_cpp_only = any(d.cpp_only for _s, _e, d in drifts)
|
||||||
|
has_drift = any(not d.clean() for _s, _e, d in drifts)
|
||||||
|
|
||||||
|
if args.fix:
|
||||||
|
if not have_address:
|
||||||
|
print("note: no Address enum found in src/ -- addresses not synced")
|
||||||
|
if lint_failed:
|
||||||
|
print("fix aborted: resolve the dissector name problems above first")
|
||||||
|
return 1
|
||||||
|
if has_cpp_only:
|
||||||
|
for _s, _e, d in drifts:
|
||||||
|
if d.cpp_only:
|
||||||
|
print("%s:" % d.spec["name"])
|
||||||
|
print_drift(d)
|
||||||
|
print("fix aborted: C++ has values the dissector lacks (see ERRORs)")
|
||||||
|
return 1
|
||||||
|
all_renames = []
|
||||||
|
for spec, entries, drift in drifts:
|
||||||
|
apply_additions(os.path.join(root, spec["path"]), spec, entries, drift)
|
||||||
|
all_renames.extend(drift.renames)
|
||||||
|
apply_renames(root, all_renames, args.verbose)
|
||||||
|
for spec, entries, drift in drifts:
|
||||||
|
if not drift.clean():
|
||||||
|
print("%s: %d rename(s), %d addition(s)"
|
||||||
|
% (spec["name"], len(drift.renames), len(drift.adds)))
|
||||||
|
print("fix: applied" if has_drift else "fix: already in sync")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# ---- default: report (silent on success -- this is the pre-commit hook) ----
|
||||||
|
if not (lint_failed or has_drift):
|
||||||
|
return 0
|
||||||
|
if not have_address:
|
||||||
|
print("note: no Address enum found in src/ -- addresses not synced")
|
||||||
|
for spec, _entries, drift in drifts:
|
||||||
|
if not drift.clean():
|
||||||
|
print("%s drift:" % spec["name"])
|
||||||
|
print_drift(drift)
|
||||||
|
print("out of sync -- run: scripts/sync_avclan_enums.py --fix")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define AVCLAN_ENUM_CLASS class
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
|
||||||
|
#if defined(__cpp_lib_to_underlying) && __cpp_lib_to_underlying >= 202102L
|
||||||
|
using std::to_underlying;
|
||||||
|
#else
|
||||||
|
template <class Enum>
|
||||||
|
requires std::is_enum_v<Enum>
|
||||||
|
constexpr std::underlying_type_t<Enum> to_underlying(Enum e) noexcept {
|
||||||
|
return static_cast<std::underlying_type_t<Enum>>(e);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define AVCLAN_ENUM_CLASS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum AVCLAN_ENUM_CLASS Action : uint8_t {
|
||||||
|
// LAN related
|
||||||
|
List_Functions_Req = 0x00,
|
||||||
|
List_Functions_Resp = 0x10,
|
||||||
|
Lan_Init = 0x01,
|
||||||
|
Lan_Init_Complete = 0x58,
|
||||||
|
// Lan_Startup_Complete = 0x58,
|
||||||
|
Lancheck_End_Req = 0x08,
|
||||||
|
Lancheck_End_Resp = 0x18,
|
||||||
|
Lancheck_Scan_Req = 0x0a,
|
||||||
|
Lancheck_Scan_Resp = 0x1a,
|
||||||
|
Lancheck_Req = 0x0c,
|
||||||
|
Lancheck_Resp = 0x1c,
|
||||||
|
// Lancheck_UNK_Req = 0x0d,
|
||||||
|
// Lancheck_UNK_Resp = 0x1d,
|
||||||
|
Ping_Req = 0x20,
|
||||||
|
Ping_Resp = 0x30,
|
||||||
|
|
||||||
|
// Device switching
|
||||||
|
Enable_Function_Req = 0x42,
|
||||||
|
Enable_Function_Resp = 0x52,
|
||||||
|
Disable_Function_Req = 0x43,
|
||||||
|
Disable_Function_Resp = 0x53,
|
||||||
|
|
||||||
|
Advertise_Function = 0x45,
|
||||||
|
General_Query = 0x46,
|
||||||
|
|
||||||
|
// Events
|
||||||
|
Insertion = 0x50,
|
||||||
|
Ejection = 0x51,
|
||||||
|
|
||||||
|
// Physical interface
|
||||||
|
Backlight_Adjust = 0x59,
|
||||||
|
Beep = 0x60,
|
||||||
|
Screen_Press = 0x78,
|
||||||
|
Eject = 0x80,
|
||||||
|
Disc_Up = 0x90,
|
||||||
|
Disc_Down = 0x91,
|
||||||
|
Track_Seek_Up = 0x94,
|
||||||
|
Track_Seek_Down = 0x95,
|
||||||
|
Track_Fast_Forward = 0x98,
|
||||||
|
Track_Rewind = 0x99,
|
||||||
|
Pwrvol_Knob_Righthand_Turn = 0x9c,
|
||||||
|
Pwrvol_Knob_Lefthand_Turn = 0x9d,
|
||||||
|
Tape_Not_Ready = 0x9f,
|
||||||
|
CD_Enable_Repeat = 0xa0,
|
||||||
|
CD_Disable_Repeat = 0xa1,
|
||||||
|
CD_Enable_Disk_Repeat = 0xa3,
|
||||||
|
CD_Disable_Disk_Repeat = 0xa4,
|
||||||
|
CD_Enable_Scan = 0xa6,
|
||||||
|
CD_Disable_Scan = 0xa7,
|
||||||
|
CD_Enable_Disk_Scan = 0xa9,
|
||||||
|
CD_Disable_Disk_Scan = 0xaa,
|
||||||
|
CD_Enable_Random = 0xb0,
|
||||||
|
CD_Disable_Random = 0xb1,
|
||||||
|
CD_Enable_Disk_Random = 0xb3,
|
||||||
|
CD_Disable_Disk_Random = 0xb4,
|
||||||
|
|
||||||
|
// Requests and Response pairs
|
||||||
|
Initial_Report_Req = 0xe0,
|
||||||
|
Initial_Report_Resp = 0xf0,
|
||||||
|
|
||||||
|
Playback_Req = 0xe2,
|
||||||
|
Playback_Resp = 0xf2,
|
||||||
|
|
||||||
|
Loading_Req = 0xe4,
|
||||||
|
Loading_Resp = 0xf4,
|
||||||
|
|
||||||
|
Track_Name_Req = 0xed,
|
||||||
|
Track_Name_Resp = 0xfd,
|
||||||
|
|
||||||
|
// Reports
|
||||||
|
Playback_Status = 0xf1, // Typically unprompted, sent to Device::STATUS
|
||||||
|
Loading_Status = 0xf3, // Typically unprompted, sent to Device::STATUS
|
||||||
|
Report_TOC = 0xf9,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Media functions a source device can perform (ultimately bounded by the Action
|
||||||
|
// set above).
|
||||||
|
enum AVCLAN_ENUM_CLASS MediaAction : uint8_t {
|
||||||
|
Play = 0x01,
|
||||||
|
Pause = 0x02,
|
||||||
|
Play_Pause = Play | Pause,
|
||||||
|
Skip_Forward,
|
||||||
|
Skip_Backward,
|
||||||
|
Track_Next,
|
||||||
|
Track_Prev,
|
||||||
|
Repeat,
|
||||||
|
Repeat_Single,
|
||||||
|
Shuffle,
|
||||||
|
Volume_Up,
|
||||||
|
Volume_Down,
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
enum class Device : uint8_t;
|
||||||
|
|
||||||
|
// Sentinel for a frame with no owning device.
|
||||||
|
// Compile-time collision check lives in device.hpp
|
||||||
|
inline constexpr Device NoDevice = Device{0xFF};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
struct Error {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Error enums are ordered such that a lower numeric value corresponds to
|
||||||
|
// more progress/success before an error occured, with explicitly
|
||||||
|
// cast/constructed 0 (e.g. `Read{0}` in C++ or `(Read)0` in C) being no
|
||||||
|
// errors
|
||||||
|
enum AVCLAN_ENUM_CLASS Read : uint8_t {
|
||||||
|
BAD_DATA_PARITY = 0x01,
|
||||||
|
BAD_LENGTH_RANGE,
|
||||||
|
BAD_LENGTH_PARITY,
|
||||||
|
BAD_PERIPHERAL_PARITY,
|
||||||
|
BAD_CONTROLLER_PARITY,
|
||||||
|
BAD_CONTROL_PARITY,
|
||||||
|
BAD_PARITY, // generic bad parity has max severity
|
||||||
|
STARTBIT_MISSED,
|
||||||
|
STARTBIT_MALFORMED,
|
||||||
|
STARTBIT_TOO_LONG,
|
||||||
|
BAD_STARTBIT,
|
||||||
|
POOL_EMPTY, // non-bus error
|
||||||
|
};
|
||||||
|
|
||||||
|
enum AVCLAN_ENUM_CLASS Send : uint8_t {
|
||||||
|
NAK_DATA = 0x01,
|
||||||
|
NAK_MESSAGE_LENGTH,
|
||||||
|
NAK_CONTROL,
|
||||||
|
NAK_ADDRESS,
|
||||||
|
NAK, // generic NAK has max severity
|
||||||
|
BUSY,
|
||||||
|
MUTED,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum AVCLAN_ENUM_CLASS Parse : uint8_t {
|
||||||
|
TOO_SHORT = 0x01,
|
||||||
|
MISMATCH_LENGTH,
|
||||||
|
LENGTH_TOO_BIG,
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SendError {
|
||||||
|
Device owning_device;
|
||||||
|
uint8_t reaction;
|
||||||
|
Error::Send err;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum AVCLAN_ENUM_CLASS Bit : uint8_t {
|
||||||
|
bit_zero = 0x00,
|
||||||
|
bit_one = 0x01,
|
||||||
|
bit_start = 0x10
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace avclan
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef AVCLAN_ENUM_CLASS
|
||||||
@@ -0,0 +1,433 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
/*
|
||||||
|
AVC LAN Frame Format
|
||||||
|
│ Bits │ Description
|
||||||
|
────────────────────────────────────────
|
||||||
|
| 1 │ Start bit
|
||||||
|
| 1 │ Direct/broadcast
|
||||||
|
| 12 │ Controller address
|
||||||
|
| 1 │ Parity
|
||||||
|
| 12 │ Peripheral address
|
||||||
|
| 1 │ Parity
|
||||||
|
| 1 │ *Acknowledge* (read below)
|
||||||
|
| 4 │ Control
|
||||||
|
| 1 │ Parity
|
||||||
|
| 1 │ *Acknowledge*
|
||||||
|
| 8 │ Message length (n)
|
||||||
|
| 1 │ Parity
|
||||||
|
| 1 │ *Acknowledge*
|
||||||
|
────────
|
||||||
|
| 8 │ Data
|
||||||
|
| 1 │ Parity
|
||||||
|
| 1 │ *Acknowledge*
|
||||||
|
*repeat `n` times*
|
||||||
|
|
||||||
|
No acknowledge bits are sent for broadcast frames.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <concepts>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <memory>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
#include "bus.hpp"
|
||||||
|
#include "frame.hpp"
|
||||||
|
#include "hal/phy.h"
|
||||||
|
#include "stdshim.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using Read = avclan::detail::Error::Read;
|
||||||
|
using Send = avclan::detail::Error::Send;
|
||||||
|
using Bit = avclan::detail::Bit;
|
||||||
|
|
||||||
|
struct trailer_bits_t {};
|
||||||
|
struct no_parity_t : trailer_bits_t {}; // raw bits (the broadcast bit)
|
||||||
|
struct with_parity_t : trailer_bits_t {}; // bits + parity (controller address)
|
||||||
|
struct with_ack_t : trailer_bits_t {
|
||||||
|
}; // bits + parity + ACK slot (all other fields)
|
||||||
|
inline constexpr no_parity_t no_parity{};
|
||||||
|
inline constexpr with_parity_t with_parity{};
|
||||||
|
inline constexpr with_ack_t with_ack{};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
|
||||||
|
class Bus::Handle {
|
||||||
|
// A live handle exclusively borrows the Bus for the duration of a
|
||||||
|
// transaction; holding the reference is what forces `get()` (and thus
|
||||||
|
// `read`/`send`) to require a mutable Bus, even though the bus hardware
|
||||||
|
// itself is reached through free `phy_*` functions.
|
||||||
|
Bus &bus_;
|
||||||
|
explicit Handle(Bus &bus) : bus_{bus} { phy_guard_enter(); };
|
||||||
|
friend Bus;
|
||||||
|
|
||||||
|
public:
|
||||||
|
~Handle() { phy_guard_leave(); };
|
||||||
|
Handle(const Handle &) = delete;
|
||||||
|
Handle(Handle &&) = delete;
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
||||||
|
Send sendstartbit() { return phy_send_startbit(); };
|
||||||
|
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
||||||
|
Read readstartbit() { return phy_read_startbit(); };
|
||||||
|
|
||||||
|
template <auto N, std::unsigned_integral T,
|
||||||
|
std::derived_from<trailer_bits_t> Trailer>
|
||||||
|
requires(sizeof(T) < 3 && N < 16 && !std::same_as<Trailer, with_ack_t>)
|
||||||
|
Send send(T bits, Trailer /*tag*/) {
|
||||||
|
const Bit parity = sendbits<N>(bits);
|
||||||
|
|
||||||
|
if constexpr (std::is_same_v<Trailer, with_parity_t>)
|
||||||
|
sendbits<1>(to_underlying(parity));
|
||||||
|
|
||||||
|
return Send{0};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <auto N, std::unsigned_integral T>
|
||||||
|
requires(sizeof(T) < 3 && N < 16)
|
||||||
|
Send send(T bits, with_ack_t /*tag*/, bool expect_ack) {
|
||||||
|
send<N>(bits, with_parity);
|
||||||
|
|
||||||
|
if (expect_ack)
|
||||||
|
return read_ACK();
|
||||||
|
|
||||||
|
sendbits<1>(1U); // still need to fill the ack bit slot
|
||||||
|
return Send{0};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <auto N, std::unsigned_integral T,
|
||||||
|
std::derived_from<trailer_bits_t> Trailer>
|
||||||
|
requires(sizeof(T) < 3 && N < 16 && !std::same_as<Trailer, with_ack_t>)
|
||||||
|
Read read(T *bits, Trailer /*tag*/) {
|
||||||
|
const Bit calc_parity = readbits<N>(bits);
|
||||||
|
if constexpr (std::is_same_v<Trailer, with_parity_t>) {
|
||||||
|
uint8_t read_parity;
|
||||||
|
readbits<1>(&read_parity);
|
||||||
|
if (to_underlying(calc_parity) != read_parity)
|
||||||
|
return Read::BAD_PARITY;
|
||||||
|
}
|
||||||
|
return Read{0};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <auto N, std::unsigned_integral T, class F>
|
||||||
|
requires(sizeof(T) < 3 && N < 16)
|
||||||
|
Read read(T *bits, with_ack_t /*tag*/, F &&ack) {
|
||||||
|
if (read<N>(bits, with_parity) == Read::BAD_PARITY)
|
||||||
|
return Read::BAD_PARITY;
|
||||||
|
|
||||||
|
if (ack()) {
|
||||||
|
send_ACK();
|
||||||
|
} else {
|
||||||
|
uint8_t slot;
|
||||||
|
readbits<1>(&slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Read{0};
|
||||||
|
};
|
||||||
|
template <auto N, std::unsigned_integral T>
|
||||||
|
requires(sizeof(T) < 3 && N < 16)
|
||||||
|
Read read(T *bits, with_ack_t /*tag*/, bool ack) {
|
||||||
|
return read<N>(bits, with_ack, [=]() { return ack; });
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void send_ACK() { phy_send_ack(); };
|
||||||
|
static Send read_ACK() { return phy_read_ack(); };
|
||||||
|
|
||||||
|
template <auto N, class T> Bit sendbits(T bits);
|
||||||
|
template <auto N, class T> Bit readbits(T *bits);
|
||||||
|
|
||||||
|
template <auto N>
|
||||||
|
requires(N > 1 && N < 8)
|
||||||
|
Bit sendbits(uint8_t bits) {
|
||||||
|
return phy_send_bits_u8(&bits, N);
|
||||||
|
};
|
||||||
|
template <auto N>
|
||||||
|
requires(N <= 16)
|
||||||
|
Bit sendbits(uint16_t bits) {
|
||||||
|
return phy_send_bits_u16(&bits, N);
|
||||||
|
};
|
||||||
|
template <auto N>
|
||||||
|
requires(N < 8)
|
||||||
|
Bit readbits(uint8_t *bits) {
|
||||||
|
return static_cast<Bit>(phy_read_bits_u8(bits, N));
|
||||||
|
};
|
||||||
|
template <auto N>
|
||||||
|
requires(N <= 16)
|
||||||
|
Bit readbits(uint16_t *bits) {
|
||||||
|
return static_cast<Bit>(phy_read_bits_u16(bits, N));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> inline Bit Bus::Handle::sendbits<8>(uint8_t bits) {
|
||||||
|
return phy_send_byte(&bits);
|
||||||
|
};
|
||||||
|
template <> inline Bit Bus::Handle::sendbits<1>(uint8_t bits) {
|
||||||
|
const Bit bit{static_cast<Bit>(bits & 1U)};
|
||||||
|
phy_send_bit(bit);
|
||||||
|
return bit;
|
||||||
|
};
|
||||||
|
template <> inline Bit Bus::Handle::readbits<8>(uint8_t *bits) {
|
||||||
|
return phy_read_byte(bits);
|
||||||
|
};
|
||||||
|
|
||||||
|
void Bus::init() {
|
||||||
|
// Idempotent: the single Bus is shared by reference, so every Peripheral's
|
||||||
|
// ctor calls init() on it — but the hardware must be brought up exactly once
|
||||||
|
// (phy_init is not assumed re-entrant/idempotent).
|
||||||
|
if (inited_)
|
||||||
|
return;
|
||||||
|
phy_init();
|
||||||
|
muted_ = false; // phy_init leaves the bus TX unmuted
|
||||||
|
inited_ = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
||||||
|
bool Bus::is_active() const { return phy_active(); };
|
||||||
|
void Bus::mute(bool mute) {
|
||||||
|
phy_mute(mute);
|
||||||
|
muted_ = mute; // Only update muted_ *AFTER* hardware has finished muting
|
||||||
|
};
|
||||||
|
|
||||||
|
auto Bus::read(uint16_t address, Frame::Print print)
|
||||||
|
-> expected<std::unique_ptr<Frame>, Error::Read> {
|
||||||
|
struct errtype {
|
||||||
|
Read errno;
|
||||||
|
uint16_t val;
|
||||||
|
} err = {};
|
||||||
|
|
||||||
|
using enum Read;
|
||||||
|
|
||||||
|
std::unique_ptr<Frame> in(new (std::nothrow) Frame);
|
||||||
|
if (!in) {
|
||||||
|
err.errno = POOL_EMPTY;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // bound handle lifetime
|
||||||
|
auto handle = get();
|
||||||
|
|
||||||
|
bool shouldACK = false;
|
||||||
|
uint8_t tmp = 0;
|
||||||
|
|
||||||
|
err.errno = handle.readstartbit();
|
||||||
|
if (err.errno != Read{0})
|
||||||
|
goto handle_err;
|
||||||
|
|
||||||
|
handle.read<1>(&tmp, no_parity);
|
||||||
|
in->is_unicast = (tmp != 0U);
|
||||||
|
|
||||||
|
if (auto rerr = handle.read<12>(&in->controller_addr, with_parity);
|
||||||
|
rerr == BAD_PARITY) {
|
||||||
|
err.errno = BAD_CONTROLLER_PARITY;
|
||||||
|
if (print.verbose)
|
||||||
|
err.val = in->controller_addr;
|
||||||
|
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Using lambda for delayed evaluation of peripheral_addr field
|
||||||
|
// deref, which will be written by the time the lambda is evaluated
|
||||||
|
auto should_ack_lambda = [&]() {
|
||||||
|
shouldACK = !is_muted() && (in->peripheral_addr == address);
|
||||||
|
return shouldACK;
|
||||||
|
};
|
||||||
|
if (auto rerr =
|
||||||
|
handle.read<12>(&in->peripheral_addr, with_ack, should_ack_lambda);
|
||||||
|
rerr == BAD_PARITY) {
|
||||||
|
err.errno = BAD_PERIPHERAL_PARITY;
|
||||||
|
if (print.verbose)
|
||||||
|
err.val = in->peripheral_addr;
|
||||||
|
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto rerr = handle.read<4>(&in->control, with_ack, shouldACK);
|
||||||
|
rerr == BAD_PARITY) {
|
||||||
|
err.errno = BAD_CONTROL_PARITY;
|
||||||
|
if (print.verbose)
|
||||||
|
err.val = in->control;
|
||||||
|
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto rerr = handle.read<8>(&in->length, with_ack, shouldACK);
|
||||||
|
rerr == BAD_PARITY) {
|
||||||
|
err.errno = BAD_LENGTH_PARITY;
|
||||||
|
if (print.verbose)
|
||||||
|
err.val = in->length;
|
||||||
|
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in->length == 0 || in->length > Frame::MAXLENGTH) {
|
||||||
|
err.errno = BAD_LENGTH_RANGE;
|
||||||
|
err.val = in->length;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < in->length; i++) {
|
||||||
|
if (auto rerr = handle.read<8>(&in->data[i], with_ack, shouldACK);
|
||||||
|
rerr == BAD_PARITY) {
|
||||||
|
err.errno = BAD_DATA_PARITY;
|
||||||
|
if (print.verbose)
|
||||||
|
err.val = in->data[i];
|
||||||
|
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // destroy handle
|
||||||
|
|
||||||
|
if (false) { // NOLINT(readability-simplify-boolean-expr)
|
||||||
|
handle_err:;
|
||||||
|
fputs("ERR(read): ", stdout);
|
||||||
|
switch (err.errno) {
|
||||||
|
case POOL_EMPTY: puts("failed Frame alloc"); break;
|
||||||
|
case BAD_STARTBIT: fputs("bad start bit (other)", stdout); break;
|
||||||
|
case STARTBIT_MISSED: fputs("missed start bit", stdout); break;
|
||||||
|
case STARTBIT_MALFORMED:
|
||||||
|
fputs("malformed start bit (external cause)", stdout);
|
||||||
|
break;
|
||||||
|
case STARTBIT_TOO_LONG: fputs("bad start bit (long)", stdout); break;
|
||||||
|
case BAD_CONTROLLER_PARITY:
|
||||||
|
fputs("reading controller addr.", stdout);
|
||||||
|
goto VERBOSE;
|
||||||
|
case BAD_PERIPHERAL_PARITY:
|
||||||
|
fputs("reading peripheral addr.", stdout);
|
||||||
|
goto VERBOSE;
|
||||||
|
case BAD_CONTROL_PARITY: fputs("reading control", stdout); goto VERBOSE;
|
||||||
|
case BAD_LENGTH_PARITY: fputs("reading length", stdout); goto VERBOSE;
|
||||||
|
case BAD_LENGTH_RANGE: printf("bad length 0x%02X:", err.val); break;
|
||||||
|
case BAD_DATA_PARITY: fputs("reading data", stdout); goto VERBOSE;
|
||||||
|
case BAD_PARITY:
|
||||||
|
__builtin_unreachable();
|
||||||
|
VERBOSE:
|
||||||
|
if (print.verbose) {
|
||||||
|
printf("; read 0x%02X:", err.val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
putchar('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only print if some data has been correctly received
|
||||||
|
if (print.print && (err.errno < STARTBIT_MISSED)) {
|
||||||
|
if (err.errno > BAD_DATA_PARITY)
|
||||||
|
in->length = 0;
|
||||||
|
in->print(print);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err.errno != Read{0})
|
||||||
|
return unexpected(err.errno);
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Bus::send(const Frame &out, Frame::Print print) -> Send {
|
||||||
|
struct errtype {
|
||||||
|
// Error enum is ordered such that a lower numeric value corresponds to
|
||||||
|
// more success
|
||||||
|
Send errno;
|
||||||
|
uint8_t val;
|
||||||
|
} err = {};
|
||||||
|
|
||||||
|
using enum Send;
|
||||||
|
|
||||||
|
if (is_muted()) {
|
||||||
|
err.errno = MUTED;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // bound handle lifetime
|
||||||
|
auto handle = get();
|
||||||
|
|
||||||
|
if (handle.sendstartbit() == BUSY) {
|
||||||
|
// Some other device is already driving the bus
|
||||||
|
err.errno = BUSY;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle.send<1>(static_cast<uint8_t>(out.is_unicast), no_parity);
|
||||||
|
|
||||||
|
handle.send<12>(out.controller_addr, with_parity);
|
||||||
|
|
||||||
|
if (auto serr =
|
||||||
|
handle.send<12>(out.peripheral_addr, with_ack, out.is_unicast);
|
||||||
|
serr == NAK) {
|
||||||
|
err.errno = NAK_ADDRESS;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto serr = handle.send<4>(out.control, with_ack, out.is_unicast);
|
||||||
|
serr == NAK) {
|
||||||
|
err.errno = NAK_CONTROL;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto serr = handle.send<8>(out.length, with_ack, out.is_unicast);
|
||||||
|
serr == NAK) {
|
||||||
|
err.errno = NAK_MESSAGE_LENGTH;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < out.length; i++) {
|
||||||
|
// Based on the µPD6708 datasheet, ACK bit for broadcast doesn't seem
|
||||||
|
// necessary (i.e. This deviates from the previous broadcast specific
|
||||||
|
// function that sent an extra `1` bit after each byte/parity)
|
||||||
|
// Explanation for why audio-group broadcast state report isn't working?
|
||||||
|
if (auto serr = handle.send<8>(out.data[i], with_ack, out.is_unicast);
|
||||||
|
serr == NAK) {
|
||||||
|
err.errno = NAK_DATA;
|
||||||
|
err.val = i;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // destroy handle
|
||||||
|
|
||||||
|
// back to read mode
|
||||||
|
if (false) { // NOLINT(readability-simplify-boolean-expr)
|
||||||
|
handle_err:;
|
||||||
|
fputs("Error", stdout);
|
||||||
|
switch (err.errno) {
|
||||||
|
case MUTED: fputs(": Device muted", stdout); break;
|
||||||
|
case BUSY: fputs(": Busy bus", stdout); break;
|
||||||
|
case NAK_ADDRESS:
|
||||||
|
case NAK_CONTROL:
|
||||||
|
case NAK_MESSAGE_LENGTH:
|
||||||
|
case NAK_DATA:
|
||||||
|
case NAK:
|
||||||
|
fputs(" NAK: ", stdout);
|
||||||
|
switch (err.errno) {
|
||||||
|
case NAK_ADDRESS: fputs("address", stdout); break;
|
||||||
|
case NAK_CONTROL: fputs("Control", stdout); break;
|
||||||
|
case NAK_MESSAGE_LENGTH: fputs("Message length", stdout); break;
|
||||||
|
case NAK_DATA: printf(" data[%u]", err.val); break;
|
||||||
|
case NAK:
|
||||||
|
case MUTED:
|
||||||
|
case BUSY: __builtin_unreachable();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
putchar('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (print.print)
|
||||||
|
out.print(print);
|
||||||
|
|
||||||
|
return err.errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bus::Handle Bus::get() { return Handle{*this}; };
|
||||||
|
|
||||||
|
#if !defined(NDEBUG) && defined(MEASURE_BUS)
|
||||||
|
// Debug bit-timing measurement on the one physical bus; instance-scoped for the
|
||||||
|
// same reason as is_active().
|
||||||
|
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
||||||
|
void Bus::measure() { phy_measure(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
/*
|
||||||
|
AVC LAN Theory
|
||||||
|
|
||||||
|
The AVC LAN bus is an implementation of the IEBus (mode 1) which is a
|
||||||
|
differential signal; IEBus is electrically (but not logically) compatible with
|
||||||
|
CAN bus.
|
||||||
|
|
||||||
|
- Logical `1`: Potential difference between bus lines (BUS+ pin and BUS– pin)
|
||||||
|
is 20 mV or lower (floating).
|
||||||
|
- Logical `0`: Potential difference between bus lines (BUS+ pin and BUS– pin)
|
||||||
|
is 120 mV or higher (driving).
|
||||||
|
|
||||||
|
A nominal bit length is 39 us, composed of 3 periods: preparation,
|
||||||
|
synchronization, data.
|
||||||
|
|
||||||
|
Figure 1. AVCLAN Bus bit format
|
||||||
|
|
||||||
|
│ Prep │<─ Sync ─>│<─ Data ─>│ ...
|
||||||
|
Driving (logical `0`) ╭──────────╮──────────╮
|
||||||
|
│ │ │
|
||||||
|
Floating (logical `1`) ─────────╯ ╰──────────╰─────────
|
||||||
|
│ 6 μs │── 19 μs ─│─ 13 μs ──│
|
||||||
|
|
||||||
|
The logical value during the data period signifies the bit value, e.g. a bit
|
||||||
|
`0` continues the logical `0` (high potential difference between bus lines) of
|
||||||
|
the sync period thru the data period, and a bit `1` has a logical `1`
|
||||||
|
(low/floating potential between bus lines) during the data period. Using the
|
||||||
|
TCB pulse-width and frequency measure mode, the total bit length differs for
|
||||||
|
bit `1` and `0`; detailed bit timing can be found in "timing.h". The bus
|
||||||
|
idles at low potential (floating).
|
||||||
|
|
||||||
|
A start bit is nominally 169 us high followed by 20 us low.
|
||||||
|
|
||||||
|
A bit `0` is dominant on the bus, which is a design choice that affects
|
||||||
|
bit/interpretation:
|
||||||
|
- Low addresses have priority upon transmission conflicts
|
||||||
|
- The broadcast bit is `1` (floating, no effort) for normal communication
|
||||||
|
- For acknowledge bits, the receiver extends the logical '0' of the sync
|
||||||
|
period to the length of a normal bit `0`. Hence, a NAK (bit `1`) is
|
||||||
|
literally the absence of an ACK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
#include "frame.hpp"
|
||||||
|
#include "stdshim.hpp"
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
|
||||||
|
class Bus {
|
||||||
|
public:
|
||||||
|
using Error = detail::Error;
|
||||||
|
|
||||||
|
// There is exactly one physical bus (the HAL `phy_*` layer is a singleton).
|
||||||
|
// `Bus` models that single hardware instance: it is owned once and shared by
|
||||||
|
// reference (e.g. multiple `Peripheral`s hold a `Bus &`), never copied — a
|
||||||
|
// copy would fork `muted_`, which must stay coherent with the one hardware
|
||||||
|
// TX state.
|
||||||
|
Bus() = default;
|
||||||
|
Bus(const Bus &) = delete;
|
||||||
|
Bus &operator=(const Bus &) = delete;
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
bool is_active() const;
|
||||||
|
void mute(bool mute);
|
||||||
|
bool is_muted() const { return muted_; };
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
void measure();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
expected<std::unique_ptr<Frame>, Error::Read> read(uint16_t address,
|
||||||
|
Frame::Print print);
|
||||||
|
Error::Send send(const Frame &out, Frame::Print print);
|
||||||
|
|
||||||
|
private:
|
||||||
|
class Handle;
|
||||||
|
Handle get();
|
||||||
|
|
||||||
|
// Assume mute after default ctor; only viable after init call
|
||||||
|
bool muted_ = true;
|
||||||
|
bool inited_ = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,451 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
#include "cdchanger.hpp"
|
||||||
|
#include "device.hpp"
|
||||||
|
#include "frame.hpp"
|
||||||
|
#include "hal/cd_timer.h"
|
||||||
|
#include "hal/media.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using namespace avclan;
|
||||||
|
|
||||||
|
constexpr uint8_t cdloading_resp[] = {to_underlying(Device::CD_CHANGER),
|
||||||
|
to_underlying(Device::STATUS),
|
||||||
|
to_underlying(Action::Loading_Status),
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x02};
|
||||||
|
|
||||||
|
constexpr int WIRE_SIZE = 8; // cd state report size in bytes
|
||||||
|
constexpr int TIME_SKIP = 15; // seconds
|
||||||
|
constexpr int TWODIGIT_MAX = 99;
|
||||||
|
|
||||||
|
/* Pack a 0–TWODIGIT_MAX count into 2-digit BCD. Values >TWODIGIT_MAX (sentinels
|
||||||
|
such as 0xFF / 0x7F meaning "no time") pass through unchanged so they survive
|
||||||
|
the wire round-trip. */
|
||||||
|
constexpr uint8_t toBCD(uint8_t val) {
|
||||||
|
if (val > TWODIGIT_MAX)
|
||||||
|
return val;
|
||||||
|
return (uint8_t)(((val / 10) << 4) | (val % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void incrementTime_callback(void *self) {
|
||||||
|
static_cast<avclan::CDChanger *>(self)->incrementTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" bool isPlaying_callback(void *self) {
|
||||||
|
return static_cast<avclan::CDChanger *>(self)->isPlaying();
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
|
||||||
|
void CDChanger::init() {
|
||||||
|
media_init();
|
||||||
|
cdtimer_init(this, &incrementTime_callback, &isPlaying_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDChanger::handle(const Frame &in, Frame &out) {
|
||||||
|
if (in.length < 4)
|
||||||
|
return; // [Currently known] valid CDChanger frames have at least 4 bytes
|
||||||
|
|
||||||
|
const uint8_t *data = &in.data[1];
|
||||||
|
const auto from = static_cast<Device>(*data++);
|
||||||
|
/* const auto to = */ data++;
|
||||||
|
const auto action = static_cast<Action>(*data++);
|
||||||
|
|
||||||
|
static const uint8_t function_change_resp[] = {
|
||||||
|
0x00, to_underlying(Device::CD_CHANGER), 0xFF, 0xFF, 0x01};
|
||||||
|
|
||||||
|
using enum Action;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wswitch-enum"
|
||||||
|
// Unicast to CD changer: bytes are (0x00, from, to, action, [extra...]).
|
||||||
|
switch (action) {
|
||||||
|
case Enable_Function_Req:
|
||||||
|
out.is_unicast = true;
|
||||||
|
out.length = sizeof(function_change_resp);
|
||||||
|
memcpy(out.data, function_change_resp, sizeof(function_change_resp));
|
||||||
|
out.data[2] = to_underlying(from);
|
||||||
|
out.data[3] = to_underlying(Enable_Function_Resp);
|
||||||
|
state = 0;
|
||||||
|
flags2 = 0x80;
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case Disable_Function_Req:
|
||||||
|
// Head unit always expects a response, but the state change can be
|
||||||
|
// conditional
|
||||||
|
out.is_unicast = true;
|
||||||
|
out.length = sizeof(function_change_resp);
|
||||||
|
memcpy(out.data, function_change_resp, sizeof(function_change_resp));
|
||||||
|
out.data[2] = to_underlying(from);
|
||||||
|
out.data[3] = to_underlying(Disable_Function_Resp);
|
||||||
|
if (isPlaying()) {
|
||||||
|
stopPlaying();
|
||||||
|
state = 0;
|
||||||
|
flags2 = 0x80;
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
} else
|
||||||
|
out.reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
case Eject: {
|
||||||
|
// "Eject" label is multiply wrong; proper meaning unclear:
|
||||||
|
// - First observed on initial multiple presses of "CD" button,
|
||||||
|
// triggering (after {0x00, Device::CD_CHANGER, Device::COMM_v1,
|
||||||
|
// Insertion, 0x01} response) proper activation of
|
||||||
|
// mockingboard/cd-changer.
|
||||||
|
// - Subsequently observed when pressing (technically
|
||||||
|
// releasing?) the fast-forward button and rewind
|
||||||
|
if (static_cast<bool>(state & SEEKING)) { // FF/RW button released
|
||||||
|
state &= ~SEEKING;
|
||||||
|
} else {
|
||||||
|
out.is_unicast = true;
|
||||||
|
{
|
||||||
|
const uint8_t msg[] = {0x00, to_underlying(Device::CD_CHANGER),
|
||||||
|
to_underlying(Device::CMD_SW),
|
||||||
|
to_underlying(Insertion), 0x01};
|
||||||
|
out.length = sizeof(msg);
|
||||||
|
memcpy(out.data, msg, sizeof(msg));
|
||||||
|
}
|
||||||
|
out.reaction = r_SendOnly;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Initial_Report_Req: {
|
||||||
|
out.is_unicast = true;
|
||||||
|
// No knowledge/understanding of field meaning/interpretation
|
||||||
|
const uint8_t cdinitreport_resp[] = {0x00,
|
||||||
|
to_underlying(Device::CD_CHANGER),
|
||||||
|
to_underlying(from),
|
||||||
|
to_underlying(Initial_Report_Resp),
|
||||||
|
0x01,
|
||||||
|
0x31,
|
||||||
|
0x10,
|
||||||
|
0x01,
|
||||||
|
0x01};
|
||||||
|
out.length = sizeof(cdinitreport_resp);
|
||||||
|
memcpy(out.data, cdinitreport_resp, sizeof(cdinitreport_resp));
|
||||||
|
out.reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Playback_Req:
|
||||||
|
out.data[0] = 0x00;
|
||||||
|
out.data[1] = to_underlying(Device::CD_CHANGER);
|
||||||
|
out.data[2] = to_underlying(from);
|
||||||
|
out.data[3] = to_underlying(Playback_Resp);
|
||||||
|
out.length = WIRE_SIZE + 4;
|
||||||
|
serialize(&out.data[4]);
|
||||||
|
out.is_unicast = true;
|
||||||
|
out.reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
case Loading_Req:
|
||||||
|
out.data[0] = 0x00;
|
||||||
|
out.length = sizeof(cdloading_resp) + 1;
|
||||||
|
memcpy(&out.data[1], cdloading_resp, sizeof(cdloading_resp));
|
||||||
|
out.data[2] = to_underlying(from);
|
||||||
|
out.data[3] = to_underlying(Loading_Resp);
|
||||||
|
out.is_unicast = true;
|
||||||
|
out.reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
case Track_Seek_Up:
|
||||||
|
state = SEEKING_TRACK;
|
||||||
|
if (track < 98)
|
||||||
|
++track;
|
||||||
|
else
|
||||||
|
track = 1;
|
||||||
|
mins = 0xff;
|
||||||
|
secs = 0x7f;
|
||||||
|
flags2 = 0xc0;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
media_action(MediaAction::Track_Next);
|
||||||
|
out.reaction = r_TrackChange;
|
||||||
|
break;
|
||||||
|
case Track_Seek_Down:
|
||||||
|
state = SEEKING_TRACK;
|
||||||
|
// Track down returns to track beginning if in ~middle of song
|
||||||
|
if (mins == 0 && secs < 5) {
|
||||||
|
if (track > 1)
|
||||||
|
--track;
|
||||||
|
else
|
||||||
|
track = TWODIGIT_MAX;
|
||||||
|
|
||||||
|
media_action(MediaAction::Track_Prev);
|
||||||
|
}
|
||||||
|
mins = 0xff;
|
||||||
|
secs = 0x7f;
|
||||||
|
flags2 = 0xc0;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_TrackChange;
|
||||||
|
break;
|
||||||
|
case Track_Fast_Forward: {
|
||||||
|
state |= SEEKING;
|
||||||
|
secs += TIME_SKIP;
|
||||||
|
if (secs > 59) {
|
||||||
|
secs -= 60;
|
||||||
|
++mins;
|
||||||
|
}
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
media_action(MediaAction::Skip_Forward);
|
||||||
|
cdtimer_reset(); // Skipped to a whole/round sec; ensure next tick
|
||||||
|
// is ~1 sec from now
|
||||||
|
out.reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Track_Rewind: {
|
||||||
|
state |= SEEKING;
|
||||||
|
if (secs < TIME_SKIP) {
|
||||||
|
if (mins > 0) {
|
||||||
|
const uint8_t dif = TIME_SKIP - secs;
|
||||||
|
secs = 60 - dif;
|
||||||
|
--mins;
|
||||||
|
} else {
|
||||||
|
mins = 0;
|
||||||
|
secs = 0;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
secs -= TIME_SKIP;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
media_action(MediaAction::Skip_Backward);
|
||||||
|
cdtimer_reset(); // Skipped to a whole/round sec; ensure next tick
|
||||||
|
// is ~1 sec from now
|
||||||
|
out.reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CD_Enable_Random:
|
||||||
|
flags |= RANDOM;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case CD_Disable_Random:
|
||||||
|
flags &= ~RANDOM;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case CD_Enable_Repeat:
|
||||||
|
flags |= REPEAT;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case CD_Disable_Repeat:
|
||||||
|
flags &= ~REPEAT;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case CD_Enable_Disk_Random:
|
||||||
|
flags |= DISK_RANDOM;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case CD_Disable_Disk_Random:
|
||||||
|
flags &= ~DISK_RANDOM;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case CD_Enable_Disk_Repeat:
|
||||||
|
flags |= DISK_REPEAT;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
case CD_Disable_Disk_Repeat:
|
||||||
|
flags &= ~DISK_REPEAT;
|
||||||
|
generateStatus(out, true, Device::CMD_SW);
|
||||||
|
out.reaction = r_StatusReport;
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Frame> CDChanger::react(
|
||||||
|
expected<std::unique_ptr<Frame>, detail::SendError> exp) {
|
||||||
|
|
||||||
|
if (!exp) {
|
||||||
|
if (exp.error().reaction == to_underlying(r_StateReport) &&
|
||||||
|
exp.error().err == detail::Error::Send::NAK_ADDRESS &&
|
||||||
|
++failedStatusReports > 1) {
|
||||||
|
failedStatusReports = 0;
|
||||||
|
stopPlaying(); // Disable periodic updates if e.g. no-one's
|
||||||
|
// listening (car was turned off?)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
auto out = std::move(exp.value());
|
||||||
|
auto resp = static_cast<reaction_t>(out->reaction);
|
||||||
|
out->reaction = r_Nothing;
|
||||||
|
switch (resp) {
|
||||||
|
case r_Ejection: {
|
||||||
|
const uint8_t play[] = {0x00,
|
||||||
|
to_underlying(Device::COMM_CTRL),
|
||||||
|
to_underlying(Device::COMMUNICATION_V1),
|
||||||
|
to_underlying(Action::Insertion),
|
||||||
|
to_underlying(Device::CD_CHANGER),
|
||||||
|
0x01};
|
||||||
|
out->length = sizeof(play);
|
||||||
|
memcpy(out->data, play, sizeof(play));
|
||||||
|
}
|
||||||
|
out->reaction = r_Report_Load;
|
||||||
|
break;
|
||||||
|
case r_Report_Load:
|
||||||
|
out->is_unicast = false;
|
||||||
|
out->peripheral_addr = 0x1FF;
|
||||||
|
out->length = sizeof(cdloading_resp) + 1;
|
||||||
|
memcpy(out->data, cdloading_resp, sizeof(cdloading_resp));
|
||||||
|
out->data[1] = to_underlying(Device::STATUS);
|
||||||
|
out->data[2] = to_underlying(Action::Loading_Status);
|
||||||
|
out->reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
case r_TrackChange:
|
||||||
|
setTime(0, 0);
|
||||||
|
cdtimer_reset(); // Skipped to a whole/round sec; ensure next tick is
|
||||||
|
// ~1 sec from now
|
||||||
|
[[fallthrough]];
|
||||||
|
case r_NormalizeState:
|
||||||
|
normalizeState();
|
||||||
|
generateStatus(*out, false, Device::STATUS);
|
||||||
|
out->reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
case r_StartPlaying:
|
||||||
|
normalizeState();
|
||||||
|
generateStatus(*out, false, Device::STATUS);
|
||||||
|
out->reaction = r_BeganPlaying;
|
||||||
|
break;
|
||||||
|
case r_BeganPlaying:
|
||||||
|
startPlaying(); // only start PIT after normalizing state
|
||||||
|
out->reaction = r_Nothing;
|
||||||
|
break;
|
||||||
|
case r_StatusReport:
|
||||||
|
generateStatus(*out, false, Device::STATUS);
|
||||||
|
out->reaction = r_SendOnly;
|
||||||
|
break;
|
||||||
|
case r_StateReport: [[fallthrough]];
|
||||||
|
case r_SendOnly: [[fallthrough]];
|
||||||
|
case r_Nothing: [[fallthrough]];
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out->reaction > r_Nothing)
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDChanger::enable(Frame &out) {
|
||||||
|
if (!isPlaying()) {
|
||||||
|
if (mins > TWODIGIT_MAX)
|
||||||
|
mins = 0;
|
||||||
|
if (secs > TWODIGIT_MAX)
|
||||||
|
secs = 0;
|
||||||
|
state = SEEKING | SEEKING_TRACK;
|
||||||
|
flags2 = 0xc0;
|
||||||
|
generateStatus(out, false, Device::STATUS);
|
||||||
|
out.reaction = r_StartPlaying;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDChanger::pending() { return cdtimer_pending(); }
|
||||||
|
|
||||||
|
void CDChanger::emit(Frame &out) {
|
||||||
|
generateStatus(out, false, Device::STATUS);
|
||||||
|
out.reaction = r_StateReport;
|
||||||
|
cdtimer_clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDChanger::isPlaying() const { return playing; }
|
||||||
|
|
||||||
|
// Sets CD_mode to play and resets timer count (so that the next interrupt is in
|
||||||
|
// 1 sec)
|
||||||
|
void CDChanger::startPlaying() {
|
||||||
|
static bool havePlayed = false;
|
||||||
|
if (havePlayed)
|
||||||
|
media_action(MediaAction::Play);
|
||||||
|
havePlayed |= true;
|
||||||
|
playing = true;
|
||||||
|
cdtimer_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDChanger::stopPlaying() {
|
||||||
|
cdtimer_disable();
|
||||||
|
playing = false;
|
||||||
|
media_action(MediaAction::Pause);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serialize cd_status into the wire format.
|
||||||
|
// track/mins/secs, need converted from decimal to BCD
|
||||||
|
void CDChanger::serialize(uint8_t *dst) const {
|
||||||
|
*dst++ = cds;
|
||||||
|
*dst++ = state;
|
||||||
|
*dst++ = disc;
|
||||||
|
*dst++ = toBCD(track);
|
||||||
|
*dst++ = toBCD(mins);
|
||||||
|
*dst++ = toBCD(secs);
|
||||||
|
*dst++ = flags;
|
||||||
|
*dst++ = flags2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDChanger::setTime(uint8_t min, uint8_t sec) {
|
||||||
|
mins = min;
|
||||||
|
secs = sec;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDChanger::incrementTime() {
|
||||||
|
// Sentinel values (>TWODIGIT_MAX) mean "no time"; leave them alone until
|
||||||
|
// setTime() replaces them with a real count.
|
||||||
|
if (secs > TWODIGIT_MAX)
|
||||||
|
return;
|
||||||
|
if (secs == 59) {
|
||||||
|
secs = 0;
|
||||||
|
if (mins == TWODIGIT_MAX)
|
||||||
|
mins = 0;
|
||||||
|
else
|
||||||
|
mins++;
|
||||||
|
} else
|
||||||
|
secs++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used for changed status messages
|
||||||
|
void CDChanger::generateStatus(Frame &status, bool is_unicast,
|
||||||
|
Device to) const {
|
||||||
|
status.is_unicast = is_unicast;
|
||||||
|
if (!is_unicast)
|
||||||
|
status.peripheral_addr = 0x1FF;
|
||||||
|
status.control = 0xF;
|
||||||
|
status.length = WIRE_SIZE + ((is_unicast) ? 4 : 3);
|
||||||
|
|
||||||
|
uint8_t *data = status.data;
|
||||||
|
if (is_unicast)
|
||||||
|
*data++ = 0x00;
|
||||||
|
*data++ = to_underlying(Device::CD_CHANGER);
|
||||||
|
*data++ = to_underlying(to);
|
||||||
|
*data++ = to_underlying(Action::Playback_Status);
|
||||||
|
serialize(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDChanger::normalizeState() {
|
||||||
|
if (mins > TWODIGIT_MAX)
|
||||||
|
mins = 0;
|
||||||
|
if (secs > TWODIGIT_MAX)
|
||||||
|
secs = 0;
|
||||||
|
state = PLAYBACK;
|
||||||
|
flags &= (uint8_t)~(DISK_SCAN | SCAN);
|
||||||
|
flags2 = 0x80;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
void CDChanger::media_action(MediaAction action) { ::media_action(action); }
|
||||||
|
bool CDChanger::media_busy() const { return ::media_busy(); };
|
||||||
|
void CDChanger::mic_toggle() { media_mic_toggle(); };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
#include "device.hpp"
|
||||||
|
#include "frame.hpp"
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
|
||||||
|
class CDChanger {
|
||||||
|
public:
|
||||||
|
enum State : uint8_t {
|
||||||
|
OPEN = 0x01,
|
||||||
|
ERR1 = 0x02,
|
||||||
|
SEEKING = 0x08,
|
||||||
|
PLAYBACK = 0x10,
|
||||||
|
SEEKING_TRACK = 0x20,
|
||||||
|
LOADING = 0x80,
|
||||||
|
};
|
||||||
|
enum CD : uint8_t {
|
||||||
|
CD1 = 1 << 0,
|
||||||
|
CD2 = 1 << 1,
|
||||||
|
CD3 = 1 << 2,
|
||||||
|
CD4 = 1 << 3,
|
||||||
|
CD5 = 1 << 4,
|
||||||
|
CD6 = 1 << 5,
|
||||||
|
};
|
||||||
|
enum Flags : uint8_t {
|
||||||
|
DISK_RANDOM = 1 << 1,
|
||||||
|
RANDOM = 1 << 2,
|
||||||
|
DISK_REPEAT = 1 << 3,
|
||||||
|
REPEAT = 1 << 4,
|
||||||
|
DISK_SCAN = 1 << 5,
|
||||||
|
SCAN = 1 << 6,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Message state machine
|
||||||
|
// - r_Nothing (0x00) means don't send current message
|
||||||
|
// - All other instances mean send current message and imply the presence of
|
||||||
|
// follow-up messages within state machine
|
||||||
|
enum reaction_t : uint8_t {
|
||||||
|
r_Nothing = 0x00,
|
||||||
|
r_SendOnly, // No further follow-up needed (beyond sending current)
|
||||||
|
r_StatusReport, // Needs follow-up status report
|
||||||
|
r_NormalizeState, // cd_status needs normalized and resent
|
||||||
|
r_StartPlaying, // ~equivalent to normalizeState, but cycles to BeganPlaying
|
||||||
|
r_BeganPlaying,
|
||||||
|
r_TrackChange, // Time needs reset
|
||||||
|
r_Ejection,
|
||||||
|
r_Report_Load,
|
||||||
|
r_StateReport, // *IS* a status report (follow-up or unprompted)
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr Device id = Device::CD_CHANGER;
|
||||||
|
void init();
|
||||||
|
|
||||||
|
void handle(const Frame &in, Frame &out);
|
||||||
|
std::unique_ptr<Frame>
|
||||||
|
react(expected<std::unique_ptr<Frame>, detail::SendError> exp);
|
||||||
|
void enable(Frame &out);
|
||||||
|
void disable(Frame &out);
|
||||||
|
static bool pending();
|
||||||
|
void emit(Frame &out);
|
||||||
|
void incrementTime();
|
||||||
|
bool isPlaying() const;
|
||||||
|
#ifndef NDEBUG
|
||||||
|
void media_action(MediaAction action);
|
||||||
|
bool media_busy() const;
|
||||||
|
void mic_toggle();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
void startPlaying();
|
||||||
|
void stopPlaying();
|
||||||
|
void serialize(uint8_t *dst) const;
|
||||||
|
void setTime(uint8_t mins, uint8_t secs);
|
||||||
|
void generateStatus(Frame &status, bool is_unicast, Device to) const;
|
||||||
|
void normalizeState();
|
||||||
|
|
||||||
|
bool playing = false;
|
||||||
|
int failedStatusReports = 0;
|
||||||
|
uint8_t cds = CD1;
|
||||||
|
uint8_t state = SEEKING | SEEKING_TRACK;
|
||||||
|
uint8_t disc = 1;
|
||||||
|
uint8_t track = 1; // Decimal storage; serialize to BCD
|
||||||
|
uint8_t mins = 0xFF; // Decimal storage; serialize to BCD
|
||||||
|
uint8_t secs = 0x7F; // Decimal storage; serialize to BCD
|
||||||
|
uint8_t flags = 0;
|
||||||
|
uint8_t flags2 = 0xC0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <concepts>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
#include "frame.hpp"
|
||||||
|
#include "stdshim.hpp"
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
|
||||||
|
enum class Device : uint8_t {
|
||||||
|
LAN = 0x00,
|
||||||
|
COMM_CTRL = 0x01,
|
||||||
|
COMMUNICATION_V1 = 0x11,
|
||||||
|
COMMUNICATION_V2 = 0x12,
|
||||||
|
SW_AUDIO = 0x21,
|
||||||
|
SW_NAME = 0x23,
|
||||||
|
SW_CONVERTING = 0x24,
|
||||||
|
CMD_SW = 0x25,
|
||||||
|
STATUS = 0x31,
|
||||||
|
INFO_DISPLAY2 = 0x32,
|
||||||
|
BEEP_HU = 0x28,
|
||||||
|
BEEP_SPEAKERS = 0x29,
|
||||||
|
FRONT_PSNG_MONITOR = 0x34,
|
||||||
|
CD_CHANGER2 = 0x43,
|
||||||
|
BLUETOOTH_TEL = 0x55,
|
||||||
|
INFO_DRAWING = 0x56,
|
||||||
|
NAV_ECU = 0x58,
|
||||||
|
CAMERA = 0x5C,
|
||||||
|
CLIMATE_DRAWING = 0x5D,
|
||||||
|
AUDIO_DRAWING = 0x5E,
|
||||||
|
TRIP_INFO_DRAWING = 0x5F,
|
||||||
|
TUNER = 0x60,
|
||||||
|
TAPE_DECK = 0x61,
|
||||||
|
CD_SINGLE = 0x62,
|
||||||
|
CD_CHANGER = 0x63,
|
||||||
|
AUDIO_AMP = 0x74,
|
||||||
|
GPS = 0x80,
|
||||||
|
VOICE_CTRL = 0x85,
|
||||||
|
XM_TUNER = 0xC0,
|
||||||
|
CLIMATE_CTRL_DEV = 0xE0,
|
||||||
|
TRIP_INFO = 0xE5,
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
concept DeviceInterface =
|
||||||
|
requires { std::integral_constant<Device, T::id>{}; } &&
|
||||||
|
requires(T dev, const Frame &in, Frame &out,
|
||||||
|
expected<std::unique_ptr<Frame>, detail::SendError> exp) {
|
||||||
|
dev.init();
|
||||||
|
dev.handle(in, out);
|
||||||
|
dev.enable(out);
|
||||||
|
{
|
||||||
|
dev.react(std::move(exp))
|
||||||
|
} -> std::same_as<std::unique_ptr<Frame>>;
|
||||||
|
|
||||||
|
{ dev.pending() } -> std::convertible_to<bool>;
|
||||||
|
// Devices must clear `pending()` after `emit()` is called
|
||||||
|
dev.emit(out);
|
||||||
|
};
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "frame.hpp"
|
||||||
|
|
||||||
|
#if defined(AVCLAN_FRAME_POOL_N)
|
||||||
|
#include <array>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <limits>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
template <class T, std::uint8_t N>
|
||||||
|
requires(N >= 1 && N <= std::numeric_limits<uint8_t>::max())
|
||||||
|
class Pool {
|
||||||
|
public:
|
||||||
|
constexpr Pool() {
|
||||||
|
for (uint8_t i = 0; i < N; ++i)
|
||||||
|
ptrs_[i] = &storage_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
T *acquire() {
|
||||||
|
if (top_ == 0)
|
||||||
|
return nullptr;
|
||||||
|
return ptrs_[--top_];
|
||||||
|
}
|
||||||
|
|
||||||
|
void release(T *ptr) {
|
||||||
|
// Properly would need an origin check/confirmation if this was used more
|
||||||
|
// generally
|
||||||
|
ptrs_[top_++] = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::array<T, N> storage_;
|
||||||
|
std::array<T *, N> ptrs_;
|
||||||
|
uint8_t top_ = N;
|
||||||
|
};
|
||||||
|
|
||||||
|
Pool<avclan::Frame, AVCLAN_FRAME_POOL_N> pool;
|
||||||
|
} // namespace
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using Error = avclan::detail::Error;
|
||||||
|
using enum Error::Parse;
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
|
||||||
|
#if defined(AVCLAN_FRAME_POOL_N)
|
||||||
|
void *Frame::operator new(std::size_t /*count*/,
|
||||||
|
const std::nothrow_t & /*tag*/) noexcept {
|
||||||
|
return pool.acquire();
|
||||||
|
}
|
||||||
|
// NOLINTNEXTLINE(misc-new-delete-overloads) false-positive
|
||||||
|
void Frame::operator delete(void *ptr) noexcept {
|
||||||
|
pool.release(static_cast<Frame *>(ptr));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Frame::print(Frame::Print print) const {
|
||||||
|
if (print.binary) {
|
||||||
|
uint8_t buffer[8];
|
||||||
|
uint8_t *bptr = buffer;
|
||||||
|
*bptr++ = 0x10; // Data Link Escape, signaling binary data forthcoming
|
||||||
|
*bptr++ = static_cast<uint8_t>(is_unicast);
|
||||||
|
|
||||||
|
// Send addresses in big-endian order
|
||||||
|
*bptr++ = static_cast<uint8_t>(controller_addr >> 8);
|
||||||
|
*bptr++ = static_cast<uint8_t>(controller_addr);
|
||||||
|
*bptr++ = static_cast<uint8_t>(peripheral_addr >> 8);
|
||||||
|
*bptr++ = static_cast<uint8_t>(peripheral_addr);
|
||||||
|
|
||||||
|
*bptr++ = control;
|
||||||
|
*bptr++ = length;
|
||||||
|
fwrite(buffer, 1, 8, stdout);
|
||||||
|
fwrite(data, 1, length, stdout);
|
||||||
|
|
||||||
|
bptr = buffer;
|
||||||
|
*bptr++ = 0x17; // End of transmission block
|
||||||
|
*bptr++ = 0x0A; // \n
|
||||||
|
fwrite(buffer, 1, 2, stdout);
|
||||||
|
} else {
|
||||||
|
printf("%X", static_cast<unsigned>(is_unicast));
|
||||||
|
printf(" 0x%03X", static_cast<unsigned>(controller_addr & 0x0FFF));
|
||||||
|
printf(" 0x%03X", static_cast<unsigned>(peripheral_addr & 0x0FFF));
|
||||||
|
printf(" 0x%X", static_cast<unsigned>(control & 0x0F));
|
||||||
|
printf(" 0x%X", static_cast<unsigned>(length & 0x0F));
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < length; i++) {
|
||||||
|
printf(" 0x%02X", static_cast<unsigned>(data[i]));
|
||||||
|
}
|
||||||
|
putchar('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Error::Parse Frame::parse(const uint8_t *bytes, uint8_t len) {
|
||||||
|
struct errtype {
|
||||||
|
Error::Parse errno;
|
||||||
|
uint8_t val;
|
||||||
|
} err = {};
|
||||||
|
|
||||||
|
const uint8_t *last = bytes + len;
|
||||||
|
|
||||||
|
if (len < Frame::MIN_SIZE) {
|
||||||
|
err.errno = TOO_SHORT;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
is_unicast = (*bytes++ != 0U);
|
||||||
|
controller_addr = bytes[0] | ((uint16_t)bytes[1] << 8);
|
||||||
|
bytes += 2;
|
||||||
|
peripheral_addr = bytes[0] | ((uint16_t)bytes[1] << 8);
|
||||||
|
bytes += 2;
|
||||||
|
control = *bytes++;
|
||||||
|
length = *bytes++;
|
||||||
|
|
||||||
|
if (length > MAXLENGTH) {
|
||||||
|
err.errno = LENGTH_TOO_BIG;
|
||||||
|
err.val = length;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bytes + length) <= last) {
|
||||||
|
memcpy(data, bytes, length);
|
||||||
|
} else {
|
||||||
|
err.errno = MISMATCH_LENGTH;
|
||||||
|
goto handle_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false) { // NOLINT(readability-simplify-boolean-expr)
|
||||||
|
handle_err:;
|
||||||
|
fputs("ERR(parse): ", stdout);
|
||||||
|
switch (err.errno) {
|
||||||
|
case TOO_SHORT: puts("not enough bytes too fill AVCLAN frame"); break;
|
||||||
|
case MISMATCH_LENGTH:
|
||||||
|
puts("frame->length is longer than remaining data");
|
||||||
|
break;
|
||||||
|
case LENGTH_TOO_BIG:
|
||||||
|
printf("frame->length exceeds MAXLENGTH: 0x%02X\n",
|
||||||
|
static_cast<unsigned>(err.val));
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return err.errno;
|
||||||
|
}
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
|
||||||
|
#if defined(AVCLAN_FRAME_POOL_N)
|
||||||
|
#include <cstddef>
|
||||||
|
#include <new>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
enum class Device : uint8_t;
|
||||||
|
|
||||||
|
struct Frame {
|
||||||
|
struct Print {
|
||||||
|
bool print : 1 = false; // print at all
|
||||||
|
bool binary : 1 = false; // if printing, format as binary instead of text
|
||||||
|
bool verbose : 1 = false; // include extra context in error reports
|
||||||
|
};
|
||||||
|
using Error = detail::Error;
|
||||||
|
static constexpr int MAXLENGTH = 32;
|
||||||
|
static constexpr int MIN_SIZE = 7;
|
||||||
|
|
||||||
|
Error::Parse parse(const uint8_t *bytes, uint8_t len);
|
||||||
|
void print(Print print) const;
|
||||||
|
|
||||||
|
#if defined(AVCLAN_FRAME_POOL_N)
|
||||||
|
// O(1) heapless pooled allocation. Only `new (std::nothrow) Frame` is
|
||||||
|
// supported.
|
||||||
|
static void *operator new(std::size_t) = delete;
|
||||||
|
static void *operator new(std::size_t, const std::nothrow_t &) noexcept;
|
||||||
|
// NOLINTNEXTLINE(misc-new-delete-overloads) false-positive
|
||||||
|
static void operator delete(void *) noexcept;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// reaction has a Device-defined interpretation, with the sole invariant that
|
||||||
|
// 0 == inactive/non-sendable frame
|
||||||
|
uint8_t reaction = 0;
|
||||||
|
Device owning_device = NoDevice;
|
||||||
|
bool is_unicast;
|
||||||
|
uint16_t controller_addr; // formerly "master"
|
||||||
|
uint16_t peripheral_addr; // formerly "slave"
|
||||||
|
uint8_t control = 0xF;
|
||||||
|
uint8_t length = 0;
|
||||||
|
uint8_t data[MAXLENGTH];
|
||||||
|
};
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Clock setup + GPIO/pin configuration. Call once, first thing at startup
|
||||||
|
// (before any peripheral init).
|
||||||
|
void board_init(void);
|
||||||
|
|
||||||
|
// Globally enable interrupts. Call after all peripherals are initialized.
|
||||||
|
void board_enable_interrupts(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
// CDChanger periodic-timer HAL: the ~1 Hz tick that drives the CD changer's
|
||||||
|
// status updates. The timer hardware is target-specific; the CD changer owns
|
||||||
|
// what a tick means (see cdchanger.cc). The device polls cdtimer_pending() and
|
||||||
|
// clears the tick with cdtimer_clear().
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// One-time hardware bring-up. Leaves the tick disabled.
|
||||||
|
void cdtimer_init(void *ptr, void(clbk)(void *), bool(isplay)(void *));
|
||||||
|
|
||||||
|
// Reset the count so the next tick is ~1 s out, and enable the tick.
|
||||||
|
void cdtimer_reset(void);
|
||||||
|
|
||||||
|
// Restore / disable the ~1 Hz tick.
|
||||||
|
void cdtimer_restore(void);
|
||||||
|
void cdtimer_disable(void);
|
||||||
|
|
||||||
|
extern volatile bool cdtimer_pending_flag;
|
||||||
|
|
||||||
|
static inline bool cdtimer_pending() { return cdtimer_pending_flag; }
|
||||||
|
static inline void cdtimer_clear() { cdtimer_pending_flag = false; }
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
// Media-control HAL: emulate head-unit button presses to the audio source. This
|
||||||
|
// is device functionality (see CDChanger), so this contract is consumed only by
|
||||||
|
// the device implementation, not the app.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
using MediaAction = avclan::MediaAction;
|
||||||
|
extern "C" {
|
||||||
|
#else
|
||||||
|
typedef enum MediaAction MediaAction;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// One-time hardware bring-up for the media driver.
|
||||||
|
void media_init(void);
|
||||||
|
|
||||||
|
// Emulate a media function (button press) on the source device.
|
||||||
|
void media_action(MediaAction fn);
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
bool media_mic_toggle(void);
|
||||||
|
bool media_busy(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
using Read = avclan::detail::Error::Read;
|
||||||
|
using Send = avclan::detail::Error::Send;
|
||||||
|
using Bit = avclan::detail::Bit;
|
||||||
|
extern "C" {
|
||||||
|
#else
|
||||||
|
typedef enum Read Read;
|
||||||
|
typedef enum Send Send;
|
||||||
|
typedef enum Bit Bit;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// One-time bring-up of the bus hardware. Leaves the bus idle and TX unmuted.
|
||||||
|
void phy_init(void);
|
||||||
|
|
||||||
|
// Mute/unmute device TX. "Muted" means transmission is disabled (RX is
|
||||||
|
// unchanged/still allowed)
|
||||||
|
void phy_mute(bool mute);
|
||||||
|
|
||||||
|
// Non-mutating (e.g. theoretically const qualified/-able)
|
||||||
|
bool phy_is_muted(void);
|
||||||
|
|
||||||
|
// True when bus is driven/"dominant" (logical 0)
|
||||||
|
bool phy_active(void);
|
||||||
|
|
||||||
|
// Bus-transaction guard: quiesce the other async sources (e.g. interrupts)
|
||||||
|
// so that bus read/send timing isn't disturbed. Re-enable relevant async
|
||||||
|
// sources with `phy_guard_leave`. May be a no-op on a target where contention
|
||||||
|
// isn't a concern.
|
||||||
|
void phy_guard_enter(void);
|
||||||
|
void phy_guard_leave(void);
|
||||||
|
|
||||||
|
// Start-bit handling, factored out of read/sendframe so the framing layer holds
|
||||||
|
// no bus-timing or hardware-recovery logic.
|
||||||
|
// - phy_read_startbit waits for and validates an incoming start bit, doing
|
||||||
|
// any target-specific bus recovery; see avclan::detail::Error::Read.
|
||||||
|
// - phy_send_startbit acquires the bus and emits a start bit; may return BUSY
|
||||||
|
Read phy_read_startbit(void);
|
||||||
|
Send phy_send_startbit(void);
|
||||||
|
|
||||||
|
/* Returns 0 (`(Send)0`) if the peripheral sent an ACK bit, otherwise returns
|
||||||
|
NAK. An ACK bit is a cooperative bit, where the sender starts (drives the bus)
|
||||||
|
for the sync period, and allows the receiver to drive the bus (or not) to
|
||||||
|
finish a "1" bit.
|
||||||
|
*/
|
||||||
|
Send phy_read_ack(void);
|
||||||
|
void phy_send_ack(void);
|
||||||
|
|
||||||
|
// Per-symbol I/O. The send* helpers return the even parity of the bits sent;
|
||||||
|
// the read* helpers return the even parity of the bits read. The _u8/_u16
|
||||||
|
// suffixes name the source-operand width. The function implementations need not
|
||||||
|
// all be separate/independent (e.g. all send functions could be redirect to a
|
||||||
|
// single phy_send_bits_u16, etc).
|
||||||
|
// N.B: `len` is the number of bits to send. The
|
||||||
|
// C++ send/readbits templates are the only consumers and use constraints to
|
||||||
|
// enforce valid len values, so runtime checks are unnecessary.
|
||||||
|
|
||||||
|
// Intended for sending parity bits
|
||||||
|
void phy_send_bit(Bit bit);
|
||||||
|
|
||||||
|
// Variants available to minimize unnecessary work for max runtime efficiency
|
||||||
|
Bit phy_send_bits_u8(const uint8_t *bits, int8_t len);
|
||||||
|
Bit phy_send_bits_u16(const uint16_t *bits, int8_t len);
|
||||||
|
Bit phy_send_byte(const uint8_t *byte);
|
||||||
|
|
||||||
|
Bit phy_read_bits_u8(uint8_t *bits, uint8_t len);
|
||||||
|
Bit phy_read_bits_u16(uint16_t *bits, int8_t len);
|
||||||
|
Bit phy_read_byte(uint8_t *byte);
|
||||||
|
|
||||||
|
#if !defined(NDEBUG) && defined(MEASURE_BUS)
|
||||||
|
// Sample and dump bus bit timing over the serial link (REPL `M`).
|
||||||
|
void phy_measure(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Generic stdio interface initialization. All user I/O goes through <stdio.h>
|
||||||
|
// functions. Assumptions/invariants:
|
||||||
|
// - stdin MUST be non-blocking (ie. getchar() returns EOF immediately when
|
||||||
|
// empty). Necessary to avoid stalling the REPL poll loop.
|
||||||
|
// - stdout is *raw* — no '\n' -> "\r\n" translation: bare LF and binary frame
|
||||||
|
// payloads (fwrite) are emitted verbatim
|
||||||
|
void stdio_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
#include <new>
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "avclan.h"
|
||||||
|
#include "bus.hpp"
|
||||||
|
#include "device.hpp"
|
||||||
|
#include "frame.hpp"
|
||||||
|
#include "stdshim.hpp"
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
namespace detail {
|
||||||
|
enum class Party : uint8_t { Sender, Recipient };
|
||||||
|
}
|
||||||
|
|
||||||
|
template <DeviceInterface... Devs> class Peripheral {
|
||||||
|
using Party = detail::Party;
|
||||||
|
using enum Party;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using Error = detail::Error;
|
||||||
|
|
||||||
|
// lack of static reflection until C++26 limits our methods of doing a
|
||||||
|
// compile-time collision check. Within Peripheral, we can at least assert no
|
||||||
|
// collision with Devices *used in a particular instantiation* but it is not a
|
||||||
|
// universal check against all Device enum values
|
||||||
|
static_assert(((Devs::id != NoDevice) && ...),
|
||||||
|
"a registered Device id collides with the NoDevice sentinel; "
|
||||||
|
"update the sentinel value in avclan.h");
|
||||||
|
|
||||||
|
Peripheral(Bus &bus, uint16_t address) : bus{bus}, address_{address} {
|
||||||
|
bus.init();
|
||||||
|
(std::get<Devs>(devices_).init(), ...);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t controller() const { return controller_; };
|
||||||
|
template <DeviceInterface Dev> Dev &device() {
|
||||||
|
return std::get<Dev>(devices_);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool bus_is_active() const { return bus.is_active(); };
|
||||||
|
void mute(bool mute) { bus.mute(mute); };
|
||||||
|
bool is_muted() const { return bus.is_muted(); };
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
Bus &get_bus() { return bus; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
expected<std::unique_ptr<Frame>, Error::Read>
|
||||||
|
read(Frame::Print print = Frame::Print{}) {
|
||||||
|
return bus.read(address_, print);
|
||||||
|
};
|
||||||
|
|
||||||
|
expected<std::unique_ptr<Frame>, detail::SendError>
|
||||||
|
send(std::unique_ptr<Frame> out, Frame::Print print = Frame::Print{}) {
|
||||||
|
// To "forge" a controller_addr, instantiate a new/different Peripheral
|
||||||
|
stamp<Sender>(*out);
|
||||||
|
out->control = 0xF;
|
||||||
|
auto err = bus.send(*out, print);
|
||||||
|
if (err != Error::Send{0})
|
||||||
|
return unexpected{
|
||||||
|
detail::SendError{out->owning_device, out->reaction, err}};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PACK3(a, b, c) (((uint32_t)(a) << 16) | ((uint32_t)(b) << 8) | (c))
|
||||||
|
|
||||||
|
// expected needed to distinguish don't vs can't respond
|
||||||
|
expected<std::unique_ptr<Frame>, Error::Read> route(const Frame &in) {
|
||||||
|
using enum Device;
|
||||||
|
using enum Action;
|
||||||
|
|
||||||
|
if (is_muted() || in.length < 3)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
std::unique_ptr<Frame> out(new (std::nothrow) Frame);
|
||||||
|
if (!out) {
|
||||||
|
puts("!! failed Frame alloc in route !!");
|
||||||
|
return unexpected{Error::Read::POOL_EMPTY};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0xFF placeholders are variant bytes filled by writing directly to
|
||||||
|
// out->data[N] after memcpy.
|
||||||
|
static const uint8_t lancheck_resp[] = {0x00, to_underlying(COMM_CTRL),
|
||||||
|
to_underlying(LAN), 0xFF, 0xFF};
|
||||||
|
|
||||||
|
stamp<Recipient>(*out);
|
||||||
|
|
||||||
|
const uint8_t *data = in.data;
|
||||||
|
const uint8_t b0 = *data++;
|
||||||
|
const uint8_t b1 = *data++;
|
||||||
|
const uint8_t b2 = *data++;
|
||||||
|
|
||||||
|
// the shortest known/valid messages are 3 bytes long
|
||||||
|
const uint8_t b3 = (in.length > 3) ? *data++ : 0;
|
||||||
|
|
||||||
|
if (!in.is_unicast) {
|
||||||
|
const auto from = b0;
|
||||||
|
const auto to = b1;
|
||||||
|
const auto action = b2;
|
||||||
|
// Broadcast: bytes are (from, to, action, [extra...]).
|
||||||
|
// peripheral_addr unchecked — always 0xFFF or 0x1FF in known traffic.
|
||||||
|
switch (PACK3(from, to, action)) {
|
||||||
|
case PACK3(LAN, COMM_CTRL, to_underlying(Lancheck_Scan_Req)):
|
||||||
|
out->length = sizeof(lancheck_resp);
|
||||||
|
out->is_unicast = true;
|
||||||
|
memcpy(out->data, lancheck_resp, sizeof(lancheck_resp));
|
||||||
|
out->data[3] = to_underlying(Lancheck_Scan_Resp);
|
||||||
|
out->data[4] = 0x01;
|
||||||
|
out->reaction = 1;
|
||||||
|
break;
|
||||||
|
case PACK3(LAN, COMM_CTRL, to_underlying(Lancheck_Req)):
|
||||||
|
out->length = sizeof(lancheck_resp);
|
||||||
|
out->is_unicast = true;
|
||||||
|
memcpy(out->data, lancheck_resp, sizeof(lancheck_resp));
|
||||||
|
out->data[3] = to_underlying(Lancheck_Resp);
|
||||||
|
out->data[4] = 0x00;
|
||||||
|
out->reaction = 1;
|
||||||
|
break;
|
||||||
|
case PACK3(LAN, COMM_CTRL, to_underlying(Lancheck_End_Req)):
|
||||||
|
out->is_unicast = true;
|
||||||
|
out->length = sizeof(lancheck_resp) - 1;
|
||||||
|
memcpy(out->data, lancheck_resp, out->length);
|
||||||
|
out->data[3] = to_underlying(Lancheck_End_Resp);
|
||||||
|
out->reaction = 1;
|
||||||
|
break;
|
||||||
|
case PACK3(COMMUNICATION_V1, COMM_CTRL,
|
||||||
|
to_underlying(Advertise_Function)):
|
||||||
|
case PACK3(COMMUNICATION_V2, COMM_CTRL,
|
||||||
|
to_underlying(Advertise_Function)): {
|
||||||
|
auto enable_d = [](auto &d, auto &out) { d.enable(out); };
|
||||||
|
((Devs::id == static_cast<Device>(b3)
|
||||||
|
? originate(std::get<Devs>(devices_), *out, enable_d)
|
||||||
|
: void()),
|
||||||
|
...);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PACK3(COMMUNICATION_V1, COMM_CTRL, to_underlying(Ping_Req)):
|
||||||
|
case PACK3(COMMUNICATION_V2, COMM_CTRL, to_underlying(Ping_Req)): {
|
||||||
|
out->is_unicast = true;
|
||||||
|
const uint8_t ping_resp[] = {0x00, to_underlying(COMM_CTRL),
|
||||||
|
from, to_underlying(Ping_Resp),
|
||||||
|
0xFF, b3};
|
||||||
|
out->length = sizeof(ping_resp);
|
||||||
|
memcpy(out->data, ping_resp, sizeof(ping_resp));
|
||||||
|
out->reaction = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PACK3(COMMUNICATION_V1, COMM_CTRL,
|
||||||
|
to_underlying(List_Functions_Req)):
|
||||||
|
case PACK3(COMMUNICATION_V2, COMM_CTRL,
|
||||||
|
to_underlying(List_Functions_Req)): {
|
||||||
|
controller_ = in.controller_addr;
|
||||||
|
stamp<Recipient>(*out); // re-stamp now that controller_ is known
|
||||||
|
out->is_unicast = true;
|
||||||
|
const uint8_t list_functions_resp[] = {
|
||||||
|
0x00, to_underlying(COMM_CTRL), from,
|
||||||
|
to_underlying(List_Functions_Resp), to_underlying(Devs::id)...};
|
||||||
|
out->length = sizeof(list_functions_resp);
|
||||||
|
memcpy(out->data, list_functions_resp, sizeof(list_functions_resp));
|
||||||
|
out->reaction = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// case Restart_Lan: not handled
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
} else if (in.peripheral_addr == address_ && b0 == 0x00) {
|
||||||
|
auto handle_d = [&](auto &d, auto &out) { d.handle(in, out); };
|
||||||
|
((Devs::id == static_cast<Device>(b2)
|
||||||
|
? originate(std::get<Devs>(devices_), *out, handle_d)
|
||||||
|
: void()),
|
||||||
|
...);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out->reaction > 0)
|
||||||
|
return out;
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef PACK3
|
||||||
|
|
||||||
|
std::unique_ptr<Frame>
|
||||||
|
react(expected<std::unique_ptr<Frame>, detail::SendError> exp) {
|
||||||
|
const Device from =
|
||||||
|
exp ? exp.value()->owning_device : exp.error().owning_device;
|
||||||
|
|
||||||
|
std::unique_ptr<Frame> next;
|
||||||
|
((Devs::id == from &&
|
||||||
|
(next = std::get<Devs>(devices_).react(std::move(exp)))) ||
|
||||||
|
...);
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Service ready devices in round-robin order
|
||||||
|
std::unique_ptr<Frame> poll() {
|
||||||
|
using U = std::unique_ptr<Frame>;
|
||||||
|
auto does_emit = [&](DeviceInterface auto &dev) -> U {
|
||||||
|
if (!dev.pending())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
U out(new (std::nothrow) Frame);
|
||||||
|
if (!out) {
|
||||||
|
puts("!! failed Frame alloc in poll !!");
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
originate(dev, *out, [](auto &d, auto &out) { d.emit(out); });
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Runtime tuple index helper
|
||||||
|
auto does_index_emit = [&](std::size_t t) -> U {
|
||||||
|
return [&]<std::size_t... Is>(std::index_sequence<Is...>) -> U {
|
||||||
|
U out;
|
||||||
|
((Is == t && (out = does_emit(std::get<Is>(devices_)))) || ...);
|
||||||
|
return out;
|
||||||
|
}(std::index_sequence_for<Devs...>{});
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr std::size_t N = sizeof...(Devs);
|
||||||
|
if constexpr (N == 1) { // round-robin not needed
|
||||||
|
return does_emit(std::get<0>(devices_));
|
||||||
|
} else {
|
||||||
|
static uint8_t rr_ = 0; // round-robin cursor
|
||||||
|
const std::size_t start = rr_;
|
||||||
|
for (std::size_t t = start; t < N; ++t) // [start, N)
|
||||||
|
if (auto out = does_index_emit(t)) {
|
||||||
|
rr_ = (t + 1 == N) ? 0 : t + 1;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
for (std::size_t t = 0; t < start; ++t) // [0, start); t+1 <= start < N
|
||||||
|
if (auto out = does_index_emit(t)) {
|
||||||
|
rr_ = t + 1;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <Party P> void stamp(Frame &out) const {
|
||||||
|
if constexpr (P == Sender)
|
||||||
|
out.controller_addr = address_;
|
||||||
|
else
|
||||||
|
out.peripheral_addr = controller_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void originate(DeviceInterface auto &dev, Frame &out, auto &&fill) {
|
||||||
|
out.owning_device = std::remove_reference_t<decltype(dev)>::id;
|
||||||
|
stamp<Recipient>(out); // default set FIRST; fill() may override
|
||||||
|
fill(dev, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bus &bus;
|
||||||
|
uint16_t controller_ = 0;
|
||||||
|
const uint16_t address_;
|
||||||
|
std::tuple<Devs...> devices_;
|
||||||
|
};
|
||||||
|
} // namespace avclan
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <version>
|
||||||
|
|
||||||
|
#if !defined(__cpp_lib_expected) || __cpp_lib_expected < 202211L
|
||||||
|
#include <tl/expected.hpp>
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
template <class T, class E> using expected = tl::expected<T, E>;
|
||||||
|
template <class E> using unexpected = tl::unexpected<E>;
|
||||||
|
using tl::unexpect;
|
||||||
|
using tl::unexpect_t;
|
||||||
|
} // namespace avclan
|
||||||
|
#else
|
||||||
|
#include <expected>
|
||||||
|
|
||||||
|
namespace avclan {
|
||||||
|
template <class T, class E> using expected = std::expected<T, E>;
|
||||||
|
template <class E> using unexpected = std::unexpected<E>;
|
||||||
|
using std::unexpect;
|
||||||
|
using std::unexpect_t;
|
||||||
|
} // namespace avclan
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
# AVR / ATtiny3216 hardware target (port).
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
# --- Port implementation sources -------------------------------------------
|
||||||
|
target_sources(avclan PRIVATE
|
||||||
|
phy_avr.c
|
||||||
|
media_avr.c
|
||||||
|
cd_timer_avr.c
|
||||||
|
board_avr.c
|
||||||
|
stdio_avr.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(avclan PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
find_program(AVRDUDE avrdude)
|
||||||
|
set(AVR_PROGRAMMER serialupdi CACHE STRING "avrdude programmer hardware")
|
||||||
|
set(AVRDUDE_PORT /dev/ttyUSB0 CACHE STRING "avrdude serial port")
|
||||||
|
set(AVRDUDE_BAUDRATE 230400 CACHE STRING "avrdude baud rate")
|
||||||
|
|
||||||
|
set(AVRDUDE_BASE_OPTIONS
|
||||||
|
-p ${AVR_MCU}
|
||||||
|
-c ${AVR_PROGRAMMER}
|
||||||
|
-b ${AVRDUDE_BAUDRATE})
|
||||||
|
|
||||||
|
# --- Hardware configuration options ----------------------------------------
|
||||||
|
set(FREQSEL 16MHz CACHE STRING "Select the operating frequency")
|
||||||
|
set_property(CACHE FREQSEL PROPERTY STRINGS "20MHz" "16MHz")
|
||||||
|
|
||||||
|
if(FREQSEL MATCHES "20MHz")
|
||||||
|
set(FREQSEL 20000000L)
|
||||||
|
set(AVRDUDE_BASE_OPTIONS ${AVRDUDE_BASE_OPTIONS} -U osccfg:w:0x2:m)
|
||||||
|
else()
|
||||||
|
set(FREQSEL 16000000L)
|
||||||
|
set(AVRDUDE_BASE_OPTIONS ${AVRDUDE_BASE_OPTIONS} -U osccfg:w:0x1:m)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set startup time to 8 ms (0x4)
|
||||||
|
set(AVRDUDE_BASE_OPTIONS ${AVRDUDE_BASE_OPTIONS} -U syscfg1:w:0x4:m)
|
||||||
|
|
||||||
|
option(CLK_PRESCALE "Enable the main clock prescaler")
|
||||||
|
cmake_dependent_option(CLK_PRESCALE_DIV "Prescaler divisor" CLKCTRL_PDIV_2X_gc STRING "CLK_PRESCALE")
|
||||||
|
if(DEFINED CACHE{CLK_PRESCALE_DIV})
|
||||||
|
set_property(CACHE CLK_PRESCALE_DIV PROPERTY STRINGS
|
||||||
|
CLKCTRL_PDIV_2X_gc
|
||||||
|
CLKCTRL_PDIV_4X_gc
|
||||||
|
CLKCTRL_PDIV_8X_gc
|
||||||
|
CLKCTRL_PDIV_16X_gc
|
||||||
|
CLKCTRL_PDIV_32X_gc
|
||||||
|
CLKCTRL_PDIV_64X_gc
|
||||||
|
CLKCTRL_PDIV_6X_gc
|
||||||
|
CLKCTRL_PDIV_10X_gc
|
||||||
|
CLKCTRL_PDIV_12X_gc
|
||||||
|
CLKCTRL_PDIV_24X_gc
|
||||||
|
CLKCTRL_PDIV_48X_gc
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(CLK_PRESCALE_DIV CLKCTRL_PDIV_2X_gc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(TCB_CLKSEL "TCB_CLKSEL_CLKDIV2_gc" CACHE STRING "Choose the clock for TCB")
|
||||||
|
set_property(CACHE TCB_CLKSEL PROPERTY STRINGS
|
||||||
|
TCB_CLKSEL_CLKDIV1_gc
|
||||||
|
TCB_CLKSEL_CLKDIV2_gc
|
||||||
|
TCB_CLKSEL_CLKTCA_gc
|
||||||
|
)
|
||||||
|
|
||||||
|
set(USART_RXMODE "NORMAL" CACHE STRING "USART at normal or double speed operation")
|
||||||
|
set_property(CACHE USART_RXMODE PROPERTY STRINGS
|
||||||
|
NORMAL
|
||||||
|
DOUBLE_SPEED
|
||||||
|
)
|
||||||
|
|
||||||
|
# Measured wall-clock duration (ms) of one nominal 32768-tick RTC period, used
|
||||||
|
# to calibrate out the internal OSCULP32K's tolerance for the status-update
|
||||||
|
# tick. 1000 = no correction; set per-board in CMakeUserPresets.json.
|
||||||
|
set(RTC_STATUS_PERIOD_MS 1000 CACHE STRING "Measured ms per nominal RTC status period (1000 = no correction)")
|
||||||
|
|
||||||
|
# --- Firmware configuration options ----------------------------------------
|
||||||
|
set(AVCLAN_FRAME_POOL_N 24 CACHE STRING "Pool allocator capacity for avclan::Frame (must be <= incoming/outgoing queue size)")
|
||||||
|
|
||||||
|
try_compile(LIBC_VERSION_TEST
|
||||||
|
SOURCES "${CMAKE_SOURCE_DIR}/cmake/libc-version-test.cpp"
|
||||||
|
COMPILE_DEFINITIONS -mmcu=${AVR_MCU}
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
avr_libstdcpp
|
||||||
|
GIT_REPOSITORY https://github.com/modm-io/avr-libstdcpp.git
|
||||||
|
GIT_TAG 5354296040a2289c911062daa82336762231e897
|
||||||
|
SYSTEM
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(avr_libstdcpp)
|
||||||
|
add_library(libstdcpp STATIC ${avr_libstdcpp_SOURCE_DIR}/src/new_handler.cc)
|
||||||
|
target_include_directories(libstdcpp
|
||||||
|
PUBLIC ${avr_libstdcpp_SOURCE_DIR}/include)
|
||||||
|
# Let --gc-sections drop the unused set/get_new_handler functions.
|
||||||
|
target_compile_options(libstdcpp PRIVATE -ffunction-sections -fdata-sections)
|
||||||
|
target_link_libraries(avclan PUBLIC libstdcpp)
|
||||||
|
|
||||||
|
if(NOT LIBC_VERSION_TEST)
|
||||||
|
FetchContent_Declare(
|
||||||
|
attiny_atpack
|
||||||
|
URL http://packs.download.atmel.com/Atmel.ATtiny_DFP.2.0.368.atpack
|
||||||
|
URL_HASH SHA512=ee16a8ebecb57bd998a9cd4373368e3d45982cbbc3825e18d1dcac58215db6b9d907ad1ba2020cba9187fed7ba8c6f255a4fa1214e40c7a17ab2d18474f4d079
|
||||||
|
DOWNLOAD_NAME Atmel.ATtiny_DFP.2.0.368.atpack.zip
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(attiny_atpack)
|
||||||
|
try_compile(LIBC_VERSION_TEST
|
||||||
|
SOURCES "${CMAKE_SOURCE_DIR}/cmake/libc-version-test.cpp"
|
||||||
|
COMPILE_DEFINITIONS
|
||||||
|
-B "${attiny_atpack_SOURCE_DIR}/gcc/dev/${AVR_MCU}"
|
||||||
|
-isystem "${attiny_atpack_SOURCE_DIR}/include"
|
||||||
|
-mmcu=${AVR_MCU}
|
||||||
|
)
|
||||||
|
if(NOT LIBC_VERSION_TEST)
|
||||||
|
message(FATAL_ERROR "Insufficient AVR-LIBC/Microchip pack for chosen MCU '${AVR_MCU}'")
|
||||||
|
else()
|
||||||
|
# PUBLIC on the library so its compile inherits the device headers and
|
||||||
|
# the requirement propagates to mockingboard via linking.
|
||||||
|
target_include_directories(avclan SYSTEM
|
||||||
|
PUBLIC "${attiny_atpack_SOURCE_DIR}/include")
|
||||||
|
target_link_options(mockingboard PUBLIC
|
||||||
|
-B "${attiny_atpack_SOURCE_DIR}/gcc/dev/${AVR_MCU}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# --- Vendored serial driver (jnk0le AVR-UART-lib), adapted for avrxmega3 -----
|
||||||
|
# usart_config.h set to use the reserved-ISR-register optimization, so r2/r3/r4
|
||||||
|
# must be held off-limits in every TU that shares the MCU.
|
||||||
|
set(JNK0LE_UART_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/jnk0le-AVR-UART-lib)
|
||||||
|
add_library(jnk0le_uart STATIC ${JNK0LE_UART_DIR}/usart.c)
|
||||||
|
target_include_directories(jnk0le_uart SYSTEM PUBLIC ${JNK0LE_UART_DIR})
|
||||||
|
target_compile_definitions(jnk0le_uart
|
||||||
|
PUBLIC $<$<STREQUAL:${USART_RXMODE},DOUBLE_SPEED>:USE_DOUBLE_SPEED>
|
||||||
|
PRIVATE F_CPU=${FREQSEL}
|
||||||
|
)
|
||||||
|
target_compile_options(jnk0le_uart PUBLIC
|
||||||
|
-ffixed-r2 -ffixed-r3 -ffixed-r4) # reserved ISR scratch (SREG=r4, Z=r2:r3)
|
||||||
|
target_link_libraries(avclan PUBLIC jnk0le_uart)
|
||||||
|
|
||||||
|
# --- Compile definitions / options -----------------------------------------
|
||||||
|
target_compile_definitions(avclan PUBLIC
|
||||||
|
FREQSEL=${FREQSEL}
|
||||||
|
CLK_PRESCALE=$<IF:$<BOOL:${CLK_PRESCALE}>,0x01,0x00>
|
||||||
|
CLK_PRESCALE_DIV=${CLK_PRESCALE_DIV}
|
||||||
|
__CLK_PRESCALE_DIV=__${CLK_PRESCALE_DIV}
|
||||||
|
TCB_CLKSEL=${TCB_CLKSEL}
|
||||||
|
RTC_STATUS_PERIOD_MS=${RTC_STATUS_PERIOD_MS}
|
||||||
|
AVCLAN_FRAME_POOL_N=${AVCLAN_FRAME_POOL_N}
|
||||||
|
)
|
||||||
|
target_compile_options(avclan PUBLIC
|
||||||
|
--param=min-pagesize=0
|
||||||
|
-ffunction-sections
|
||||||
|
-fdata-sections
|
||||||
|
)
|
||||||
|
|
||||||
|
# --- Flashing --------------------------------------------------------------
|
||||||
|
add_custom_target(flash
|
||||||
|
${AVRDUDE} ${AVRDUDE_BASE_OPTIONS} ${AVRDUDE_OPTIONS}
|
||||||
|
-U flash:w:$<TARGET_FILE:mockingboard>:e
|
||||||
|
-P ${AVRDUDE_PORT}
|
||||||
|
DEPENDS mockingboard
|
||||||
|
COMMENT "Flashing mockingboard to ${AVR_MCU} using ${AVR_PROGRAMMER}"
|
||||||
|
VERBATIM USES_TERMINAL
|
||||||
|
)
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
// ATtiny3216 board bring-up: main-clock prescaler + GPIO config for pins not
|
||||||
|
// owned by a peripheral's own init.
|
||||||
|
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/xmega.h> // _PROTECTED_WRITE
|
||||||
|
|
||||||
|
#include "hal/board.h"
|
||||||
|
|
||||||
|
void board_init(void) {
|
||||||
|
// Main clock prescale (CLK_PRESCALE / CLK_PRESCALE_DIV come from the build).
|
||||||
|
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, (CLK_PRESCALE | CLK_PRESCALE_DIV));
|
||||||
|
|
||||||
|
// Set pins PC2-3, PB0,3-5 as inputs
|
||||||
|
PORTC.DIRCLR = (PIN2_bm | // Unconnected
|
||||||
|
PIN3_bm); // CTS
|
||||||
|
PORTB.DIRCLR = (PIN0_bm | // Unconnected
|
||||||
|
PIN3_bm | // IGN_SENSE
|
||||||
|
PIN4_bm | // Unused, but connected to WOC (PC0)
|
||||||
|
PIN5_bm); // Unused, but connected to WOD (PC1)
|
||||||
|
|
||||||
|
// Enable pull-up resistor and disable input buffer (reduces any EM caused
|
||||||
|
// pin toggling and saves power) for unused and unconnected pins
|
||||||
|
PORTC.PIN2CTRL = PORT_PULLUPEN_bm | PORT_ISC_INPUT_DISABLE_gc;
|
||||||
|
PORTB.PIN0CTRL = PORT_PULLUPEN_bm | PORT_ISC_INPUT_DISABLE_gc;
|
||||||
|
|
||||||
|
// TODO: Remove once IGN_SENSE hardware is fixed
|
||||||
|
PORTB.DIRSET = PIN3_bm;
|
||||||
|
PORTB.OUTSET = PIN3_bm;
|
||||||
|
|
||||||
|
// Output only pins: PA3-5, PB1-2,4-5; PC0-1
|
||||||
|
// TODO: TxD (PA1), RTS (PA3) is output only, test if RxD needs the input
|
||||||
|
// buffer or if the UART peripheral bypasses it
|
||||||
|
PORTA.PIN3CTRL = PORT_ISC_INPUT_DISABLE_gc; // RTS
|
||||||
|
PORTA.PIN4CTRL = PORT_ISC_INPUT_DISABLE_gc; // WOA
|
||||||
|
PORTA.PIN5CTRL = PORT_ISC_INPUT_DISABLE_gc; // WOB
|
||||||
|
PORTB.PIN1CTRL = PORT_ISC_INPUT_DISABLE_gc; // MIC_CONTROL
|
||||||
|
PORTB.PIN4CTRL = PORT_ISC_INPUT_DISABLE_gc; // non-driving WOC
|
||||||
|
PORTB.PIN5CTRL = PORT_ISC_INPUT_DISABLE_gc; // non-driving WOD
|
||||||
|
PORTC.PIN0CTRL = PORT_ISC_INPUT_DISABLE_gc; // WOC
|
||||||
|
PORTC.PIN1CTRL = PORT_ISC_INPUT_DISABLE_gc; // WOD
|
||||||
|
}
|
||||||
|
|
||||||
|
void board_enable_interrupts(void) { sei(); }
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <util/atomic.h>
|
||||||
|
|
||||||
|
#include "hal/cd_timer.h"
|
||||||
|
|
||||||
|
// Measured wall-clock duration (in ms) of one nominal 32768-tick RTC period,
|
||||||
|
// used to calibrate out the internal OSCULP32K's error. The RTC runs from
|
||||||
|
// OSCULP32K, which is only spec'd to +/-3% and has no user calibration
|
||||||
|
// register, so a nominal 32768-count period does not land on exactly 1 s.
|
||||||
|
// Override per-board via the CMake cache (see CMakeUserPresets.json).
|
||||||
|
#ifndef RTC_STATUS_PERIOD_MS
|
||||||
|
#define RTC_STATUS_PERIOD_MS 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// RTC overflow period (in 32.768 kHz ticks) for the ~1 Hz status-update tick.
|
||||||
|
// ticks = round(32768 * 1000 / RTC_STATUS_PERIOD_MS); the RTC overflows after
|
||||||
|
// PER+1 ticks, so PER = ticks - 1.
|
||||||
|
static constexpr uint16_t rtc_status_per =
|
||||||
|
(uint16_t)(32768UL * 1000UL / RTC_STATUS_PERIOD_MS) - 1U;
|
||||||
|
|
||||||
|
static void* changer = nullptr;
|
||||||
|
static void (*increment)(void *) = nullptr;
|
||||||
|
static bool (*isplaying)(void *) = nullptr;
|
||||||
|
|
||||||
|
void cdtimer_init(void *ptr, void (inc)(void *), bool (isplay)(void *)) {
|
||||||
|
// Setup RTC as a ~1 sec periodic timer via the normal counter's overflow.
|
||||||
|
// Use the RTC directly (not PIT) to tune the status report interval closer to
|
||||||
|
// 1 sec (internal osc may be slightly off)
|
||||||
|
loop_until_bit_is_clear(RTC_STATUS, RTC_CTRLABUSY_bp);
|
||||||
|
RTC.CLKSEL = RTC_CLKSEL_INT32K_gc;
|
||||||
|
loop_until_bit_is_clear(RTC_STATUS, RTC_PERBUSY_bp);
|
||||||
|
RTC.PER = rtc_status_per;
|
||||||
|
RTC.INTCTRL = 0;
|
||||||
|
loop_until_bit_is_clear(RTC_STATUS, RTC_CTRLABUSY_bp);
|
||||||
|
RTC.CTRLA = RTC_PRESCALER_DIV1_gc | RTC_RTCEN_bm;
|
||||||
|
|
||||||
|
changer = ptr;
|
||||||
|
increment = inc;
|
||||||
|
isplaying = isplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cdtimer_reset() {
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
loop_until_bit_is_clear(RTC_STATUS, RTC_CNTBUSY_bp);
|
||||||
|
RTC.CNT = 0;
|
||||||
|
RTC.INTFLAGS = RTC_OVF_bm; // Clear interrupt flag just in case
|
||||||
|
RTC.INTCTRL |= RTC_OVF_bm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cdtimer_restore() {
|
||||||
|
if (isplaying(changer))
|
||||||
|
RTC.INTCTRL |= RTC_OVF_bm;
|
||||||
|
}
|
||||||
|
void cdtimer_disable() { RTC.INTCTRL &= ~RTC_OVF_bm; }
|
||||||
|
|
||||||
|
// Set once per overflow; consumed by the app via cdtimer_pending().
|
||||||
|
volatile bool cdtimer_pending_flag = false;
|
||||||
|
|
||||||
|
// Periodic interrupt with a ~1 sec period; only enabled while playing.
|
||||||
|
ISR(RTC_CNT_vect) {
|
||||||
|
increment(changer);
|
||||||
|
cdtimer_pending_flag = true;
|
||||||
|
RTC.INTFLAGS = RTC_OVF_bm;
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <util/atomic.h>
|
||||||
|
|
||||||
|
#include "media_avr.h" // media_sync_during_mask (used by the bus guard)
|
||||||
|
#include "hal/media.h"
|
||||||
|
|
||||||
|
// F_CPU defined in timing_avr.h; the mic tick constants below are derived from
|
||||||
|
// it (this hardware generation's TCA0/PB1 button-press implementation).
|
||||||
|
#include "timing_avr.h"
|
||||||
|
|
||||||
|
// pending WO1 toggles (even); signed to avoid underflows from a stray OVF
|
||||||
|
static volatile int8_t mic_ntoggles = 0;
|
||||||
|
|
||||||
|
// Target pulse length is ~40-150ms, with interval between pulses of
|
||||||
|
// ~100-200ms
|
||||||
|
// TCA0 period (CMP0/TOP) in ticks at F_CPU with the CLKSEL=DIV1024 prescaler.
|
||||||
|
// A press phase is ~100 ms; the final LOW phase is stretched to
|
||||||
|
// mic_refractory_period (~333 ms) so consecutive presses stay distinct
|
||||||
|
static constexpr uint16_t mic_press_ticks = (uint16_t)((F_CPU / 1024UL) / 10UL);
|
||||||
|
static constexpr uint16_t mic_refractory_period =
|
||||||
|
(uint16_t)((F_CPU / 1024UL) / 3UL);
|
||||||
|
|
||||||
|
// the longest AVCLAN frame duration is ~15ms
|
||||||
|
static constexpr uint16_t close_thresh =
|
||||||
|
(uint16_t)(mic_press_ticks * 15UL / 100UL);
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
// Toggle PB1 and return its new level.
|
||||||
|
bool media_mic_toggle() {
|
||||||
|
// Take manual control of PB1 (CMP1EN gives TCA0 control of WO1/PB1 level)
|
||||||
|
TCA0.SINGLE.CTRLB &= ~TCA_SINGLE_CMP1EN_bm;
|
||||||
|
VPORTB.OUT ^= PIN1_bm;
|
||||||
|
return (VPORTB.OUT & PIN1_bm) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool media_busy() { return mic_ntoggles != 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Begin a press waveform of `nphases` × 100 ms level segments.
|
||||||
|
// - ~Immediately toggles high, alternates each phase (1 = single HIGH press, 3
|
||||||
|
// = skip H/L/H, etc).
|
||||||
|
// - Halting the timer freezes WO1 at its last level; must run even number of
|
||||||
|
// phases to ensure we return to low
|
||||||
|
static void mic_pulse(uint8_t nphases) {
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
if (mic_ntoggles) // Skip if already pulsing
|
||||||
|
return;
|
||||||
|
|
||||||
|
// must be even to return to idle-low
|
||||||
|
mic_ntoggles = (nphases & 0x01) ? nphases + 1 : nphases;
|
||||||
|
TCA0.SINGLE.CTRLB |=
|
||||||
|
TCA_SINGLE_CMP1EN_bm; // Reassert TCA control of WO1/PB1
|
||||||
|
TCA0.SINGLE.CTRLC = 0; // Reset WO1 level just in case
|
||||||
|
TCA0.SINGLE.CNT = 0;
|
||||||
|
TCA0.SINGLE.CMP0 = // TOP
|
||||||
|
mic_press_ticks; // always restore default ~100 ms period
|
||||||
|
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm; // clear any stale flag
|
||||||
|
TCA0.SINGLE.INTCTRL |= TCA_SINGLE_OVF_bm;
|
||||||
|
TCA0.SINGLE.CTRLA |= TCA_SINGLE_ENABLE_bm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OVF ISR body function:
|
||||||
|
// - counts phases
|
||||||
|
// - stretches the final LOW phase as a refractory period, to keep separate
|
||||||
|
// pulse trains distinct
|
||||||
|
// - stops the timer after the last phase
|
||||||
|
static inline void mic_timer_isr_body(bool is_early) {
|
||||||
|
if (--mic_ntoggles == 1) {
|
||||||
|
// Stretch final phase to a ~333 ms idle-low so back-to-back presses stay
|
||||||
|
// distinct
|
||||||
|
// Invariant: mic_refractory_period > mic_press_ticks, so counter can never
|
||||||
|
// silently wrap
|
||||||
|
TCA0.SINGLE.CMP0 = mic_refractory_period;
|
||||||
|
} else if (mic_ntoggles <= 0) {
|
||||||
|
TCA0.SINGLE.CTRLA &= ~TCA_SINGLE_ENABLE_bm;
|
||||||
|
TCA0.SINGLE.CTRLC = 0; // Timer must be disabled before (re)setting
|
||||||
|
// CTRLC/WO1 level (§20.5.3)
|
||||||
|
mic_ntoggles = 0; // clamp to avoid perma-lockout in mic_pulse
|
||||||
|
}
|
||||||
|
if (is_early)
|
||||||
|
TCA0.SINGLE.CNT = 0;
|
||||||
|
|
||||||
|
// OVF FLAG must be cleared via write. MUST BE PERFORMED LAST.
|
||||||
|
// This function is called in two cases:
|
||||||
|
// - ISR, triggered by actual OVF: OVF FLAG is set and needs clearing
|
||||||
|
// - stopEvent, running ISR body ~early: OVF flag may be set while in
|
||||||
|
// ATOMIC_BLOCK (either in stopEvent, or earlier in this function body).
|
||||||
|
// Clear OVF FLAG as a precaution to prevent erroneous ISR runs
|
||||||
|
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm;
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(TCA0_OVF_vect) { mic_timer_isr_body(false); }
|
||||||
|
|
||||||
|
// Emulate a transport-control button press on the source device. Each action
|
||||||
|
// maps to a press-train of a given length on MIC_CONTROL.
|
||||||
|
void media_action(enum MediaAction action) {
|
||||||
|
switch (action) {
|
||||||
|
case Play:
|
||||||
|
case Pause:
|
||||||
|
case Play_Pause: mic_pulse(1); break; // single press
|
||||||
|
case Skip_Forward:
|
||||||
|
case Track_Next: mic_pulse(3); break; // double-press
|
||||||
|
case Skip_Backward:
|
||||||
|
case Track_Prev: mic_pulse(5); break; // triple-press
|
||||||
|
case Repeat:
|
||||||
|
case Repeat_Single:
|
||||||
|
case Shuffle:
|
||||||
|
case Volume_Up:
|
||||||
|
case Volume_Down:
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pre-emptively "overflow" and run the OVF ISR body early if a press is in
|
||||||
|
// progress and likely to overflow within the masked window. This maintains:
|
||||||
|
// - a rough absolute time for the pulse train
|
||||||
|
// - peripheral WO1 toggles and mic_ntoggles kept in sync
|
||||||
|
// - maximum frame duration is ~15ms, "early" OVF remains within acceptable
|
||||||
|
// ranges for either high/low pulses
|
||||||
|
// Caller (phy_guard_enter) guarantees interrupts are disabled.
|
||||||
|
void media_sync_during_guard() {
|
||||||
|
if (mic_ntoggles && TCA0.SINGLE.CNT >= (TCA0.SINGLE.CMP0 - close_thresh))
|
||||||
|
mic_timer_isr_body(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void media_init() {
|
||||||
|
// PB1 needs to be set as an output for TCA0 to set the level
|
||||||
|
PORTB.DIRSET = PIN1_bm;
|
||||||
|
|
||||||
|
// Experimentally, a press should be ~100ms; multiple presses can be separated
|
||||||
|
// by the same ~100ms (but separate pulse trains need more separation to
|
||||||
|
// remain distinct)
|
||||||
|
TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1024_gc;
|
||||||
|
|
||||||
|
// In frequency (FRQ) mode, channel N compare match triggers "UPDATE"
|
||||||
|
// When CMPnEN is set, TCA0 has control of the output level for the channel's
|
||||||
|
// pin, and UPDATE toggles the level
|
||||||
|
// Channel 1 controls WO1, which is mapped to PB1
|
||||||
|
TCA0.SINGLE.CTRLB = TCA_SINGLE_WGMODE_FRQ_gc | TCA_SINGLE_CMP1EN_bm;
|
||||||
|
TCA0.SINGLE.CTRLC = 0; // Preset WO1 level low just to be sure
|
||||||
|
mic_ntoggles = 0;
|
||||||
|
|
||||||
|
// toggle WO1 ~immediately after each period start; should go low => high
|
||||||
|
TCA0.SINGLE.CMP1 = 2;
|
||||||
|
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm; // Clear OVF flag just in case
|
||||||
|
TCA0.SINGLE.INTCTRL = 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
// AVR-internal media-driver hooks, shared between media_avr.c and the bus
|
||||||
|
// transaction guard (phy_avr.c's phy_guard_enter). Not part of the public
|
||||||
|
// mediacontrol.h interface.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Keep the TCA0 press waveform roughly in sync while a bus transaction has
|
||||||
|
// masked interrupts (runs the OVF ISR body early if an overflow is imminent).
|
||||||
|
// MUST be called with interrupts disabled (from within phy_guard_enter's
|
||||||
|
// ATOMIC_BLOCK).
|
||||||
|
void media_sync_during_guard();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,495 @@
|
|||||||
|
// copyright (C) 2006 Marcin Slonicki <marcin@softservice.com.pl>
|
||||||
|
// copyright (C) 2007 Louis Frigon
|
||||||
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/sfr_defs.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <util/atomic.h>
|
||||||
|
|
||||||
|
#include "hal/cd_timer.h" // statustimer_enable/disable (guard)
|
||||||
|
#include "hal/phy.h"
|
||||||
|
#include "media_avr.h" // media_sync_during_mask (guard)
|
||||||
|
|
||||||
|
// F_CPU + TICK_US (timing.h) defined here; F_CPU potentially needed by
|
||||||
|
// avr-libc.
|
||||||
|
#include "timing_avr.h"
|
||||||
|
|
||||||
|
// USART0 TX ring indices owned by the jnk0le lib; the guard consults them to
|
||||||
|
// decide whether to resume the TX drain (DRE interrupt) on leave.
|
||||||
|
extern volatile uint8_t tx0_Head, tx0_Tail;
|
||||||
|
|
||||||
|
// Mask/unmask the USART interrupts during bit-banged AVC-LAN framing. TX is
|
||||||
|
// interrupt-driven, so the DRE (data-register-empty) interrupt is gated
|
||||||
|
// alongside RX; on re-enable, resume the TX drain only if bytes are still
|
||||||
|
// queued (enabling DREIE on an empty ring would transmit garbage).
|
||||||
|
static void console_set_irqs(bool enable) {
|
||||||
|
if (enable) {
|
||||||
|
USART0.CTRLA |= USART_RXCIE_bm;
|
||||||
|
if (tx0_Head != tx0_Tail)
|
||||||
|
USART0.CTRLA |= USART_DREIE_bm;
|
||||||
|
} else {
|
||||||
|
USART0.CTRLA &= ~(USART_RXCIE_bm | USART_DREIE_bm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name difference between avr-libc and Microchip pack
|
||||||
|
#if defined(EVSYS_ASYNCCH00_bm)
|
||||||
|
#define EVSYS_ASYNCCH0_0_bm EVSYS_ASYNCCH00_bm
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// AVC LAN bus on AC2 (PA6/7): PA6 AINP0 (+), PA7 AINN1 (-)
|
||||||
|
#define BUS_IS_IDLE (bit_is_clear(AC2_STATUS, AC_STATE_bp))
|
||||||
|
|
||||||
|
#define READING_BYTE GPIOR1
|
||||||
|
#define READING_NBITS GPIOR2
|
||||||
|
#define READING_PARITY GPIOR3
|
||||||
|
|
||||||
|
#define TCB_CNTMODE TCB_CNTMODE_PW_gc
|
||||||
|
|
||||||
|
static volatile uint16_t pulsewidth;
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
static volatile uint8_t pulse_count = 0;
|
||||||
|
static volatile uint16_t period = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
static inline void AVCLAN_setBusIdle() {
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"cbi %[vporta_out], 4; \n\t"
|
||||||
|
"sbi %[vportc_out], 0; \n\t"
|
||||||
|
::[vporta_out] "I"(_SFR_IO_ADDR(VPORTA_OUT)),
|
||||||
|
[vportc_out] "I"(_SFR_IO_ADDR(VPORTC_OUT)));
|
||||||
|
}
|
||||||
|
static inline void AVCLAN_setBusDriven() {
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"sbi %[vporta_out], 4; \n\t"
|
||||||
|
"cbi %[vportc_out], 0; \n\t"
|
||||||
|
::[vporta_out] "I"(_SFR_IO_ADDR(VPORTA_OUT)),
|
||||||
|
[vportc_out] "I"(_SFR_IO_ADDR(VPORTC_OUT)));
|
||||||
|
}
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
// Returns true if device TX is muted on the AVCLAN bus (both drive pins are
|
||||||
|
// configured as inputs).
|
||||||
|
bool phy_is_muted() {
|
||||||
|
return (((VPORTA_DIR & PIN4_bm) | (VPORTA_DIR & PIN0_bm)) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// True when the bus is being driven (i.e. not idle/floating).
|
||||||
|
bool phy_active() { return !BUS_IS_IDLE; }
|
||||||
|
|
||||||
|
// Mute device TX on AVCLAN bus
|
||||||
|
void phy_mute(bool mute) {
|
||||||
|
if (mute) {
|
||||||
|
// clang-format off
|
||||||
|
__asm__ __volatile__("cbi %[vporta_dir], 4; \n\t" // set as INPUT (output values ignored)
|
||||||
|
"cbi %[vportc_dir], 0; \n\t" // set as INPUT (output values ignored)
|
||||||
|
::
|
||||||
|
[vporta_dir] "I"(_SFR_IO_ADDR(VPORTA_DIR)),
|
||||||
|
[vportc_dir] "I"(_SFR_IO_ADDR(VPORTC_DIR)));
|
||||||
|
// clang-format on
|
||||||
|
} else {
|
||||||
|
// clang-format off
|
||||||
|
__asm__ __volatile__("sbi %[vporta_dir], 4; \n\t"
|
||||||
|
"sbi %[vportc_dir], 0; \n\t"
|
||||||
|
::
|
||||||
|
[vporta_dir] "I"(_SFR_IO_ADDR(VPORTA_DIR)),
|
||||||
|
[vportc_dir] "I"(_SFR_IO_ADDR(VPORTC_DIR)));
|
||||||
|
// clang-format on
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set AVC bus to `val` (logical 1 or 0) for `period` ticks of TCB1
|
||||||
|
static void set_AVC_logic_for(uint8_t val, uint16_t period) {
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
if (val) {
|
||||||
|
AVCLAN_setBusIdle(); // idle bus is logical 1
|
||||||
|
} else {
|
||||||
|
AVCLAN_setBusDriven();
|
||||||
|
}
|
||||||
|
while (TCB1.CNT <= period) {};
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void phy_send_bit(Bit bit) {
|
||||||
|
uint16_t zero_length, one_length;
|
||||||
|
switch (bit) {
|
||||||
|
case bit_zero:
|
||||||
|
zero_length = AVCLAN_BIT0_LOGIC_0;
|
||||||
|
one_length = AVCLAN_BIT0_LOGIC_1;
|
||||||
|
break;
|
||||||
|
case bit_one:
|
||||||
|
zero_length = AVCLAN_BIT1_LOGIC_0;
|
||||||
|
one_length = AVCLAN_BIT1_LOGIC_1;
|
||||||
|
break;
|
||||||
|
case bit_start:
|
||||||
|
zero_length = AVCLAN_STARTBIT_LOGIC_0;
|
||||||
|
one_length = AVCLAN_STARTBIT_LOGIC_1;
|
||||||
|
break;
|
||||||
|
default: __builtin_unreachable();
|
||||||
|
}
|
||||||
|
set_AVC_logic_for(0, zero_length);
|
||||||
|
set_AVC_logic_for(1, one_length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void phy_send_ack() {
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
|
||||||
|
// Wait for controller to begin ACK bit
|
||||||
|
while (BUS_IS_IDLE) {
|
||||||
|
// Wait for approx the length of a bit; any longer and something has clearly
|
||||||
|
// gone wrong
|
||||||
|
if (TCB1.CNT >= AVCLAN_BIT_LENGTH_MAX)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
phy_send_bit(bit_zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
Send phy_read_ack() {
|
||||||
|
TCB1.CNT = 0; // Double reset of TCB1.CNT: here
|
||||||
|
set_AVC_logic_for(0, AVCLAN_BIT1_LOGIC_0); // And here (within)
|
||||||
|
AVCLAN_setBusIdle(); // Stop driving bus
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if (!BUS_IS_IDLE && (TCB1.CNT > AVCLAN_READBIT_THRESHOLD))
|
||||||
|
break; // ACK
|
||||||
|
if (TCB1.CNT > AVCLAN_BIT_LENGTH_MAX)
|
||||||
|
return NAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check/wait in case we get here before peripheral finishes ACK bit
|
||||||
|
while (!BUS_IS_IDLE) {
|
||||||
|
if (TCB1.CNT > AVCLAN_BIT_LENGTH_MAX)
|
||||||
|
return NAK;
|
||||||
|
}
|
||||||
|
return (Send)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send `len` bits on the AVCLAN bus; returns the even parity
|
||||||
|
Bit phy_send_bits_u8(const uint8_t *bits, int8_t len) {
|
||||||
|
uint8_t b = *bits;
|
||||||
|
uint8_t parity = 0;
|
||||||
|
int8_t len_mod8 = 8;
|
||||||
|
|
||||||
|
if (len & 0x7) {
|
||||||
|
len_mod8 = (int8_t)(len & 0x7);
|
||||||
|
b <<= (uint8_t)(8 - len_mod8);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
len -= len_mod8;
|
||||||
|
for (; len_mod8 > 0; len_mod8--) {
|
||||||
|
Bit bit = (b & 0x80) != 0;
|
||||||
|
parity += (uint8_t)bit;
|
||||||
|
phy_send_bit(bit);
|
||||||
|
b <<= 1;
|
||||||
|
}
|
||||||
|
len_mod8 = 8;
|
||||||
|
b = *--bits;
|
||||||
|
}
|
||||||
|
return (parity & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send `len` bits on the AVCLAN bus; returns the even parity
|
||||||
|
Bit phy_send_bits_u16(const uint16_t *bits, int8_t len) {
|
||||||
|
return phy_send_bits_u8((const uint8_t *)bits + 1, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bit phy_send_byte(const uint8_t *byte) {
|
||||||
|
uint8_t b = *byte;
|
||||||
|
uint8_t parity = 0;
|
||||||
|
|
||||||
|
for (uint8_t nbits = 8; nbits > 0; nbits--) {
|
||||||
|
Bit bit = (b & 0x80) != 0;
|
||||||
|
parity += (uint8_t)bit;
|
||||||
|
phy_send_bit(bit);
|
||||||
|
b <<= 1;
|
||||||
|
}
|
||||||
|
return (parity & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(TCB0_INT_vect) {
|
||||||
|
// #ifndef NDEBUG
|
||||||
|
// pulse_count++;
|
||||||
|
// // PW mode fires on falling edge; measure period as TCB1 delta between
|
||||||
|
// // consecutive falling edges (equivalent to FRQPW's rising-to-rising).
|
||||||
|
// static uint16_t last_tcb1 = 0;
|
||||||
|
// uint16_t cur_tcb1 = TCB1.CNT;
|
||||||
|
// period = cur_tcb1 - last_tcb1;
|
||||||
|
// last_tcb1 = cur_tcb1;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
READING_BYTE <<= 1;
|
||||||
|
// If the logical `0` pulse was less than the sync + data period threshold,
|
||||||
|
// bit was a 1
|
||||||
|
pulsewidth = TCB0.CCMP;
|
||||||
|
if (pulsewidth < (uint16_t)AVCLAN_READBIT_THRESHOLD) {
|
||||||
|
READING_BYTE++;
|
||||||
|
READING_PARITY++;
|
||||||
|
}
|
||||||
|
READING_NBITS--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read `len` bits on the AVCLAN bus; returns the even parity
|
||||||
|
Bit phy_read_bits_u8(uint8_t *bits, uint8_t len) {
|
||||||
|
uint8_t parity;
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
READING_BYTE = 0;
|
||||||
|
READING_PARITY = 0;
|
||||||
|
READING_NBITS = len;
|
||||||
|
|
||||||
|
NONATOMIC_BLOCK(NONATOMIC_RESTORESTATE) {
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
while (READING_NBITS) {
|
||||||
|
// 200% the duration of `len` bits
|
||||||
|
if (TCB1.CNT > ((uint16_t)AVCLAN_BIT_LENGTH_MAX * 2 * len)) {
|
||||||
|
READING_BYTE = 0;
|
||||||
|
READING_PARITY = 0;
|
||||||
|
break; // Should have finished by now; something's wrong
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
*bits = READING_BYTE;
|
||||||
|
parity = READING_PARITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Bit)(parity & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read `len` bits on the AVCLAN bus; returns the even parity
|
||||||
|
Bit phy_read_bits_u16(uint16_t *bits, int8_t len) {
|
||||||
|
uint8_t parity = 0;
|
||||||
|
if (len > 8) {
|
||||||
|
uint8_t over = len - 8;
|
||||||
|
parity = phy_read_bits_u8((uint8_t *)bits + 1, over);
|
||||||
|
len -= over;
|
||||||
|
}
|
||||||
|
parity += phy_read_bits_u8((uint8_t *)bits + 0, len);
|
||||||
|
|
||||||
|
return (Bit)(parity & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read a byte on the AVCLAN bus
|
||||||
|
Bit phy_read_byte(uint8_t *byte) {
|
||||||
|
uint8_t parity;
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
READING_BYTE = 0;
|
||||||
|
READING_PARITY = 0;
|
||||||
|
READING_NBITS = 8;
|
||||||
|
|
||||||
|
NONATOMIC_BLOCK(NONATOMIC_RESTORESTATE) {
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
while (READING_NBITS) {
|
||||||
|
// 200% the length of a byte
|
||||||
|
if (TCB1.CNT > ((uint16_t)AVCLAN_BIT_LENGTH_MAX * 2 * 8)) {
|
||||||
|
READING_BYTE = 0;
|
||||||
|
READING_PARITY = 0;
|
||||||
|
break; // Should have finished by now; something's wrong
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
*byte = READING_BYTE;
|
||||||
|
parity = READING_PARITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Bit)(parity & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void phy_init() {
|
||||||
|
// Set pin 6 and 7 as input
|
||||||
|
PORTA.DIRCLR = (PIN6_bm | PIN7_bm);
|
||||||
|
// Disable input buffer; recommended when using AC
|
||||||
|
PORTA.PIN6CTRL = PORT_ISC_INPUT_DISABLE_gc;
|
||||||
|
// PA7/AINN1(-) additionally gets a pull-up to help prevent the comparator
|
||||||
|
// latching high (ie false "driven" bus)
|
||||||
|
PORTA.PIN7CTRL = PORT_PULLUPEN_bm | PORT_ISC_INPUT_DISABLE_gc;
|
||||||
|
|
||||||
|
// Analog comparator config
|
||||||
|
AC2.CTRLA = AC_OUTEN_bm | AC_HYSMODE_25mV_gc | AC_ENABLE_bm;
|
||||||
|
|
||||||
|
PORTB.DIRSET = PIN2_bm; // Enable AC2 OUT for LED
|
||||||
|
PORTB.PIN2CTRL = PORT_ISC_INPUT_DISABLE_gc; // Output only
|
||||||
|
|
||||||
|
// Set AC2 to generate events on async channel 0
|
||||||
|
EVSYS.ASYNCCH0 = EVSYS_ASYNCCH0_AC2_OUT_gc;
|
||||||
|
EVSYS.ASYNCUSER0 = EVSYS_ASYNCUSER0_ASYNCCH0_gc; // USER0 is TCB0
|
||||||
|
|
||||||
|
// TCB0 for read bit timing
|
||||||
|
TCB0.CTRLB = TCB_CNTMODE;
|
||||||
|
TCB0.INTCTRL = TCB_CAPT_bm;
|
||||||
|
TCB0.EVCTRL = TCB_CAPTEI_bm;
|
||||||
|
TCB0.CTRLA = TCB_CLKSEL | TCB_ENABLE_bm;
|
||||||
|
|
||||||
|
// TCB1 for send bit timing
|
||||||
|
TCB1.CTRLB = TCB_CNTMODE_INT_gc;
|
||||||
|
TCB1.CCMP = 0xFFFF;
|
||||||
|
TCB1.CTRLA = TCB_CLKSEL | TCB_ENABLE_bm;
|
||||||
|
|
||||||
|
AVCLAN_setBusIdle();
|
||||||
|
|
||||||
|
phy_mute(false); // unmute AVCLAN bus TX
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for and validate an incoming start bit. On an over-long "driven" bus
|
||||||
|
// (AC2 latched high because the bus is actually floating) this kicks PA7 hard
|
||||||
|
// high to unlatch the comparator. The framing layer maps the result to its own
|
||||||
|
// error reporting; no printing happens here.
|
||||||
|
Read phy_read_startbit() {
|
||||||
|
uint16_t startbitlen = TCB1.CNT = 0;
|
||||||
|
|
||||||
|
// Reset the ~atomic `pulsewidth` variable to detect the post-pulse update
|
||||||
|
// from the TCB0_INT_vect ISR
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
if (!BUS_IS_IDLE) // Only reset if bus is actively driven (i.e. current
|
||||||
|
pulsewidth = 0; // value is stale/already been used)
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!BUS_IS_IDLE) {
|
||||||
|
startbitlen = TCB1.CNT;
|
||||||
|
if (startbitlen > (uint16_t)AVCLAN_STARTBIT_LOGIC_0 * 1.2) {
|
||||||
|
Read result = STARTBIT_TOO_LONG;
|
||||||
|
while (!BUS_IS_IDLE) {
|
||||||
|
// If bus is "driven" too long, assume the AC2 is latched (e.g.
|
||||||
|
// because the bus is actually floating). Kick it if so.
|
||||||
|
// This should prevent/resolve a flood of "STARTBIT_TOO_LONG" errors
|
||||||
|
if (TCB1.CNT > (uint16_t)(AVCLAN_STARTBIT_LOGIC_0 * 3)) {
|
||||||
|
result = BAD_STARTBIT;
|
||||||
|
PORTA.OUTSET = PIN7_bm; // preset high before enabling the driver
|
||||||
|
PORTA.DIRSET = PIN7_bm; // drive (-) hard high
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
while (!BUS_IS_IDLE && TCB1.CNT < (uint16_t)AVCLAN_BIT0_LOGIC_1) {
|
||||||
|
// Wait a max of ~6μs until bus is idle
|
||||||
|
}
|
||||||
|
PORTA.DIRCLR = PIN7_bm; // back to high-Z comparator input
|
||||||
|
PORTA.OUTCLR = PIN7_bm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// `pulsewidth` updates once the TCB0_INT_vect ISR runs for this pulse.
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
do {
|
||||||
|
if (TCB1.CNT > (uint16_t)AVCLAN_BIT0_LOGIC_1) // Wait a max of ~6μs for ISR
|
||||||
|
return BAD_STARTBIT; // ISR/other implementation bug; abort
|
||||||
|
|
||||||
|
// Read ~atomically, to prevent torn reads
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { startbitlen = pulsewidth; }
|
||||||
|
} while (startbitlen == 0);
|
||||||
|
|
||||||
|
if (startbitlen < (uint16_t)(AVCLAN_STARTBIT_LOGIC_0 * 0.8)) {
|
||||||
|
// Not a start bit; wait for the message to finish (bus continuously idle
|
||||||
|
// for >1 bit length) before returning, so we only report one error (instead
|
||||||
|
// of e.g. repeated "bad (short) start bit" errors)
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
while (TCB1.CNT < (uint16_t)(AVCLAN_BIT_LENGTH_MAX * 1.2)) {
|
||||||
|
if (!BUS_IS_IDLE)
|
||||||
|
TCB1.CNT = 0; // Reset counter after each bit pulse
|
||||||
|
}
|
||||||
|
// A pulse no wider than a normal bit means we merely tuned in mid-frame and
|
||||||
|
// this was a data bit; a wider-but-still-sub-start pulse means some other
|
||||||
|
// device emitted a wonky pulse.
|
||||||
|
return (startbitlen < (uint16_t)AVCLAN_BIT_LENGTH_MAX) ? STARTBIT_MISSED
|
||||||
|
: STARTBIT_MALFORMED;
|
||||||
|
}
|
||||||
|
if (startbitlen > (uint16_t)(AVCLAN_STARTBIT_LOGIC_0 * 1.2))
|
||||||
|
return STARTBIT_TOO_LONG;
|
||||||
|
return (Read)0; // that was a start bit
|
||||||
|
}
|
||||||
|
|
||||||
|
// Acquire the bus and emit a start bit. Returns false if another device is
|
||||||
|
// already driving the bus (we can't yet do proper CSMA/CD).
|
||||||
|
Send phy_send_startbit() {
|
||||||
|
// wait for free line
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
while (BUS_IS_IDLE) {
|
||||||
|
// Wait for 120% of a bit length
|
||||||
|
if (TCB1.CNT >= (uint16_t)(AVCLAN_BIT_LENGTH_MAX * 2))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of first loop could be due to bus being driven
|
||||||
|
TCB1.CNT = 0;
|
||||||
|
if (!BUS_IS_IDLE) {
|
||||||
|
// Some other device started sending
|
||||||
|
// Can't yet simultaneously send and receive to do proper CSMA/CD
|
||||||
|
|
||||||
|
// Beginnings of CSMA/CD
|
||||||
|
// do {
|
||||||
|
// if (TCB1.CNT >= (uint16_t)(AVCLAN_STARTBIT_LOGIC_0 * 1.2))
|
||||||
|
// return false; // Something's hinky; nothing is longer than start bit
|
||||||
|
// } while (!BUS_IS_IDLE);
|
||||||
|
// if (TCB1.CNT <= (uint16_t)(AVCLAN_STARTBIT_LOGIC_0 * 0.8))
|
||||||
|
// return false; // Shouldn't be possible
|
||||||
|
// set_AVC_logic_for(1, AVCLAN_STARTBIT_LOGIC_1); // wait for end of start
|
||||||
|
return BUSY;
|
||||||
|
}
|
||||||
|
phy_send_bit(bit_start);
|
||||||
|
return (Send)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disable non-read related interrupts (USART RX, RTC status tick, mic timer)
|
||||||
|
during AVCLAN bus transactions so framing isn't disturbed. TCB0 must remain
|
||||||
|
enabled. */
|
||||||
|
void phy_guard_enter() {
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
cdtimer_disable();
|
||||||
|
console_set_irqs(false);
|
||||||
|
media_sync_during_guard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-enable serial and periodic interrupts after a bus transaction.
|
||||||
|
void phy_guard_leave() {
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
cdtimer_restore(); // Reenable status interrupt if currently playing
|
||||||
|
console_set_irqs(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(NDEBUG) && defined(MEASURE_BUS)
|
||||||
|
// Only used immediately below
|
||||||
|
#define XSTR(x) #x
|
||||||
|
#define STR(x) XSTR(x)
|
||||||
|
|
||||||
|
static uint16_t pulses[100];
|
||||||
|
static uint16_t periods[100];
|
||||||
|
|
||||||
|
void phy_measure() {
|
||||||
|
phy_guard_enter();
|
||||||
|
|
||||||
|
uint8_t tmp = 0;
|
||||||
|
|
||||||
|
puts("Timing config: F_CPU=" STR(F_CPU) ", TCB_CLKSEL=" STR(TCB_CLKSEL));
|
||||||
|
puts("Sampling bit (pulse-width and period) timing...");
|
||||||
|
|
||||||
|
for (uint8_t n = 0; n < 100; n++) {
|
||||||
|
while (pulse_count == tmp) {}
|
||||||
|
pulses[n] = pulsewidth;
|
||||||
|
periods[n] = period;
|
||||||
|
tmp = pulse_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
puts("Pulses:");
|
||||||
|
for (uint8_t i = 0; i < 100; i++) {
|
||||||
|
printf("%04X\n", pulses[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
puts("Periods:");
|
||||||
|
for (uint8_t i = 0; i < 100; i++) {
|
||||||
|
printf("%04X\n", periods[i]);
|
||||||
|
}
|
||||||
|
puts("\nDone.");
|
||||||
|
|
||||||
|
phy_guard_leave();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (C) 2026 Allen Hill <allenofthehills@gmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "hal/stdio.h"
|
||||||
|
#include "timing_avr.h" // IWYU pragma: export
|
||||||
|
#include "usart.h" // jnk0le AVR-UART-lib
|
||||||
|
|
||||||
|
// Raw stdout backend: emit the byte verbatim, no '\n' -> "\r\n" translation
|
||||||
|
// (unlike the lib's uart_putchar). Keeps binary frame payloads intact.
|
||||||
|
static int stdio_putchar(char data, FILE *stream) {
|
||||||
|
(void)stream;
|
||||||
|
uart0_putc(data);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-blocking stdin backend: next received byte, or _FDEV_EOF when the RX ring
|
||||||
|
// is empty (uart0_getData() returns a negative value when there is no data).
|
||||||
|
static int stdio_getchar(FILE *stream) {
|
||||||
|
(void)stream;
|
||||||
|
int16_t c = uart0_getData();
|
||||||
|
return c < 0 ? _FDEV_EOF : c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// One raw RW stream for the stdio UART: verbatim byte output, non-blocking
|
||||||
|
// input.
|
||||||
|
static FILE stdio_stream =
|
||||||
|
FDEV_SETUP_STREAM(stdio_putchar, stdio_getchar, _FDEV_SETUP_RW);
|
||||||
|
|
||||||
|
void stdio_init(void) {
|
||||||
|
// The lib's uart0_init configures the USART registers/baud but not the pins;
|
||||||
|
// keep the ATtiny3216 pin-mux the old driver did.
|
||||||
|
PORTMUX.CTRLB = PORTMUX_USART0_ALTERNATE_gc; // TxD/RxD on PA1/PA2
|
||||||
|
PORTA.DIRSET = PIN1_bm; // TxD output
|
||||||
|
PORTA.DIRCLR = PIN2_bm; // RxD input
|
||||||
|
|
||||||
|
#ifdef USE_DOUBLE_SPEED
|
||||||
|
uart0_init(DOUBLE_BAUD_CALC(1200000));
|
||||||
|
#else
|
||||||
|
uart0_init(BAUD_CALC(1200000));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
stdout = stdin = &stdio_stream; // printf/fputs/fwrite + non-blocking getchar
|
||||||
|
}
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
#ifndef _TIMING_HPP_
|
// Copyright (C) 2015 Allen Hill <allenofthehills@gmail.com>
|
||||||
#define _TIMING_HPP_
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// AVR ATtiny3216 timing parameters. Derives F_CPU (needed by avr-libc, e.g.
|
||||||
|
// util/delay.h) and the bus-timer (TCB) tick period from the CMake-provided
|
||||||
|
// FREQSEL / CLK_PRESCALE / TCB_CLKSEL, then hands the generic timing.h a
|
||||||
|
// TICK_US (microseconds per TCB tick) so the physical bit-phase durations
|
||||||
|
// resolve to TCB-tick counts. TICK_US == TCB_TICK / 1000, so every derived
|
||||||
|
// constant is numerically identical to the previous F_CPU/TCB_CLKSEL
|
||||||
|
// formulation.
|
||||||
|
|
||||||
#define __CLKCTRL_PDIV_2X_gc 2
|
#define __CLKCTRL_PDIV_2X_gc 2
|
||||||
#define __CLKCTRL_PDIV_4X_gc 4
|
#define __CLKCTRL_PDIV_4X_gc 4
|
||||||
@@ -21,6 +31,7 @@
|
|||||||
#define CYCLE_MUL 1
|
#define CYCLE_MUL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// CPU_CYCLE / TCB_TICK are in nanoseconds.
|
||||||
#if FREQSEL == 20000000L
|
#if FREQSEL == 20000000L
|
||||||
#define CPU_CYCLE (50 * CYCLE_MUL)
|
#define CPU_CYCLE (50 * CYCLE_MUL)
|
||||||
#elif FREQSEL == 16000000L
|
#elif FREQSEL == 16000000L
|
||||||
@@ -49,18 +60,7 @@
|
|||||||
#error "Not implemented"
|
#error "Not implemented"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Measured at ±0.02 μs @ F_CPU=20MHz, TCB_CLKSEL=TCB_CLKSEL_CLKDIV1_gc
|
// TCB_TICK is nanoseconds/tick; the generic timing.h wants microseconds/tick.
|
||||||
#define AVCLAN_STARTBIT_LOGIC_0 (169e3 / TCB_TICK)
|
#define TICK_US (TCB_TICK / 1000.0)
|
||||||
#define AVCLAN_STARTBIT_LOGIC_1 (20.6e3 / TCB_TICK)
|
|
||||||
|
|
||||||
#define AVCLAN_BIT1_LOGIC_0 (19.7e3 / TCB_TICK)
|
#include "timing.h"
|
||||||
#define AVCLAN_BIT1_LOGIC_1 (18.1e3 / TCB_TICK)
|
|
||||||
|
|
||||||
#define AVCLAN_BIT0_LOGIC_0 (32.85e3 / TCB_TICK)
|
|
||||||
#define AVCLAN_BIT0_LOGIC_1 (6.2e3 / TCB_TICK)
|
|
||||||
|
|
||||||
#define AVCLAN_READBIT_THRESHOLD (26e3 / TCB_TICK)
|
|
||||||
|
|
||||||
#define AVCLAN_BIT_LENGTH_MAX (39.1e3 / TCB_TICK)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user