254 Commits
Author SHA1 Message Date
gab-k 91e10e16b6 Update PCB render workflow 2025-01-05 11:57:06 +01:00
gab-k 332275ec07 Update PCB render workflow 2025-01-05 11:55:59 +01:00
gab-k a2b1233c4e Update README; Update Getting Started page; Move panic() on FLASH_SAFE_EXECUTE_CORE_INIT_FAILURE to core1; Implement k_ff feed forward factor via CV_47; 2025-01-05 11:43:29 +01:00
gab-k 93455218e8 Update workflows 2025-01-04 17:50:38 +01:00
gab-k cc48cca779 Update documentation doxygen comments 2025-01-04 17:44:35 +01:00
gab-k 185c703bc0 Update Sphinx documentation 2025-01-04 14:35:04 +01:00
gab-k 5a00f5af2c remove fab_outputs.yml moving fabrication output generation to prerelease.yml and release.yml 2025-01-03 15:47:59 +01:00
gab-k a2f30d0654 Update fab_outputs.yml wf 2025-01-03 14:49:36 +01:00
gab-k 87e4aff24f Replaced solder bridge with tactile button; Fixed Footprint Rotation in position file; Fixed .gitignore for production outputs 2025-01-03 11:02:30 +01:00
gab-k 8c34f55877 Update fab_outputs.yml 2025-01-02 20:13:30 +01:00
gab-k e215212025 Update fab_outputs.yml 2025-01-02 20:06:54 +01:00
gab-k 86df810a49 Update fab_outputs.yml 2025-01-02 20:02:20 +01:00
gab-k 0d0c182ba4 Update fab_outputs wf 2025-01-02 19:29:39 +01:00
gab-k 1c7b833c63 Update fab_outputs wf 2025-01-02 19:18:12 +01:00
gab-k 2442853c45 Update fab_outputs wf 2025-01-02 19:06:20 +01:00
gab-k 0b71d556f8 Update fab_outputs wf 2025-01-02 19:03:05 +01:00
gab-k a3d63f2d53 Update fab_outputs wf 2025-01-02 19:01:43 +01:00
gab-k 73e88a86bb Update fab_outputs wf 2025-01-02 18:59:01 +01:00
gab-k de77d8465f Update fab_outputs wf 2025-01-02 18:54:39 +01:00
gab-k e4d352fe0e Update fab_outputs wf 2025-01-02 18:52:12 +01:00
gab-k 20736ad7f0 Update fab_outputs wf 2025-01-02 18:50:23 +01:00
gab-k 8fdce91e64 Update fab_outputs wf 2025-01-02 18:47:26 +01:00
gab-k 7ab22c439d Update fab_outputs wf 2025-01-02 18:46:12 +01:00
gab-k 501d9470f3 Update fab_outputs wf 2025-01-02 18:45:22 +01:00
gab-k 509466c61a Update fab_outputs wf 2025-01-02 18:39:50 +01:00
gab-k 7befd2cdaf Update fab_outputs wf 2025-01-02 18:36:15 +01:00
gab-k 0ceb24a79f Update fab_outputs wf 2025-01-02 18:31:01 +01:00
gab-k 56c7b394dd Update fab_outputs wf 2025-01-02 18:27:41 +01:00
gab-k 454889162b Add fab outputs workflow 2025-01-02 18:24:08 +01:00
gab-k ed98553e49 Update release/prerelease workflow 2025-01-02 17:40:55 +01:00
gab-k 11b9a62142 Update workflows 2025-01-02 17:33:26 +01:00
gab-k 5752f277e2 Update workflows 2025-01-02 17:14:53 +01:00
gab-k 5e72e8538b Update build_sw.yml 2025-01-02 17:02:19 +01:00
gab-k d333dffdb4 Update build_sw.yml 2025-01-02 16:57:17 +01:00
gab-k 82ce5e24aa Update build_sw.yml 2025-01-02 16:54:29 +01:00
gab-k f2b944b6c9 Update build_sw.yml 2025-01-02 16:50:58 +01:00
gab-k 390dd32671 Update Workflows and Cmakelists.txt 2025-01-02 16:48:54 +01:00
gab-k 1d08f5a88f Update release.yml and prerelease.yml 2025-01-02 11:02:49 +01:00
gab-k 4096171fb4 Update release.yml and prerelease.yml 2025-01-02 10:55:43 +01:00
gab-k a93617de60 Update workflow files 2025-01-02 10:37:18 +01:00
Gabriel Koppenstein 738575263f Update docs.yml 2025-01-02 10:14:07 +01:00
Gabriel Koppenstein 50290e059d Update build_sw.yml 2025-01-02 10:02:22 +01:00
gab-k d0e7406627 Update build_sw.yml 2025-01-02 09:54:07 +01:00
gab-k be49c1b43f Update build_sw.yml 2025-01-02 09:46:38 +01:00
gab-k 21bee73f01 Update docs and build/release action 2025-01-02 09:20:46 +01:00
Gabriel Koppenstein ad888dd4a0 Update build_sw.yml 2025-01-02 08:27:07 +01:00
Gabriel Koppenstein 17c67b5ba8 Update build_sw.yml 2025-01-02 08:22:27 +01:00
Gabriel Koppenstein a573e36d2f Update build_sw.yml 2025-01-02 08:18:41 +01:00
Gabriel Koppenstein 7ab3f74cba Update build_sw.yml 2025-01-02 07:53:27 +01:00
Gabriel Koppenstein a7531be0e6 Update build_sw.yml 2025-01-02 07:50:08 +01:00
Gabriel Koppenstein 91eb160833 Update and rename cmake-single-platform.yml to build_sw.yml 2025-01-02 07:47:08 +01:00
gab-k d17660f018 Update docs 2025-01-01 22:25:25 +01:00
gab-k e648e5dfa2 Remove true expression used for debugging 2024-12-31 11:31:38 +01:00
gab-k 0368a22ce7 Removed images as they are automatically deployed to gh-pages branch 2024-12-31 11:07:21 +01:00
gab-k 7e1c079e10 Merge branch 'dev' of https://github.com/gab-k/RP2040-Decoder into dev 2024-12-31 08:01:44 +01:00
gab-k f1961fa5bd Change C18 to be 0603 - 25V and rotate on PCB for easier soldering; Small logging changes; Speed step enums are actually used now for better clarity; Introduced cv_setup_check_done and flash_safe_execute_core_init_done flags for coordinating the two cores better; Incremented version no. CV_7 to 2; 2024-12-31 07:55:14 +01:00
Gabriel Koppenstein 521c8e6b7b Update pcb_render.yml
Fix wrong folder due to new subfolder for revisions
2024-12-30 08:18:04 +01:00
gab-k 0462d3f6b7 Put both HW revisions into subfolders of KiCad folder 2024-12-30 08:12:51 +01:00
gab-k 97b92fd9d8 Update CMake configuration, move post-build program size check to seperate post_build.cmake script 2024-12-30 08:04:30 +01:00
gab-k d970170795 - Updated CMakeLists.txt and board config .h files
- Refactored core0.c to most functions are now static functions.
- Introduced new structures (`dcc_packet_t` and `dcc_ring_buffer_t`) for DCC packet data handling and packet detection.
- DCC pin interrupt now only does packet detection and no evaluation, evaluation is now done inside the main loop.
- Refactor message evaluation logic.
- Implemented hard fault handler, now rebooting when hardfault is encountered.
- Optimized initialization sequence in main().
- Controller and speed helper functions now run outside the timer interrupts, instead flags are set, which are checked inside the core1 main loop.
- Added enumeration for speed steps to improve readability. (However they are yet to be used)
- Added various documentation comments.
- Added various LOG() messages.
- Added python script for generating speed_step typedef definition.
2024-12-29 17:06:50 +01:00
gab-k acdbf3cffe Update Docs; Add 3D-Models for flash and Motor driver; Update Readme; Check program code for exceeding size in CMakeLists.txt; Moved measure() function to core1.c/core1.h; Added direction enum typedef; Update Control Loop Block Diagram; 2024-12-25 21:47:52 +01:00
gab-k 7d2c80574a Update documentation and docs folder structure; Add abs() function using bit operators; Remove LED pin definition from legacy board definition as it does not have an LED; Implement watchdog timer; Add and modify various comments for documentation purposes 2024-12-23 22:03:41 +01:00
gab-k f8b99de801 Expanded on stdio logging functionality, also configuration of logging is now entirely in CMakeLists.txt for convenience, also warns now for logging configurations that make no sense; Clarification in CV table comment; Moved pin definitions into board definition files; two_std_dev() now works mostly with integers; Added function for resetting all CVs saved in flash; Added various LOG() messages; 2024-12-22 21:48:41 +01:00
gab-k 7b1d5ed152 Moved all software related files to Software folder; Now using flash safe execution functions of pico_flash (pico SDK) lib; Added error handling; Added RP2040-Decoder-board.h definition; Adapted CMakeLists.txt for use with vscode pi pico extension; 2024-12-22 11:39:03 +01:00
Gabriel Koppenstein e8a8ac6d98 Update docs.yml 2024-11-27 23:15:51 +01:00
Gabriel Koppenstein bce1405a60 Update docs.yml 2024-11-27 23:12:54 +01:00
Gabriel Koppenstein fa3791c781 Update docs.yml 2024-11-27 23:09:41 +01:00
Gabriel Koppenstein a0d775f081 Update docs.yml 2024-11-27 23:03:08 +01:00
Gabriel Koppenstein ab2a7e17ea Update docs.yml 2024-11-27 23:01:36 +01:00
Gabriel Koppenstein 5b25cd2f7a Update docs.yml 2024-11-27 22:57:43 +01:00
Gabriel Koppenstein 6863502e22 Update docs.yml 2024-11-27 22:55:15 +01:00
gab-k 01bac1ba00 update docs workflow 2024-11-27 22:50:02 +01:00
gab-k 5ca892610e update workflow 2024-11-27 22:44:08 +01:00
gab-k fb165f6e08 Modify docs.yml 2024-11-27 22:35:00 +01:00
gab-k 251d71e73f update docs workflow 2024-11-27 22:33:06 +01:00
gab-k c0f61511ce Update docs 2024-11-27 21:59:54 +01:00
gab-k 72bd29ddbc Update documentation system with doxygen/breathe/sphinx 2024-11-27 11:33:22 +01:00
Gabriel Koppenstein fad8b68e01 Update pcb_render.yml 2024-11-26 17:29:59 +01:00
Gabriel Koppenstein 12b45b9da3 Update doxygen-gh-pages.yml 2024-11-26 17:27:19 +01:00
Gabriel Koppenstein 3f7f092b2c Update doxygen-gh-pages.yml 2024-11-26 17:21:48 +01:00
Gabriel Koppenstein cf79990b51 Update pcb_render.yml 2024-11-26 17:08:41 +01:00
Gabriel Koppenstein 70846f5336 Update pcb_render.yml 2024-11-26 16:52:09 +01:00
Gabriel Koppenstein babe18c758 Update pcb_render.yml 2024-11-26 16:46:23 +01:00
Gabriel Koppenstein d05bd6ef33 Update pcb_render.yml 2024-11-26 16:41:11 +01:00
Gabriel Koppenstein b7a5aa8960 Update pcb_render.yml 2024-11-26 16:31:24 +01:00
Gabriel Koppenstein 5c3525c82e Update pcb_render.yml 2024-11-26 16:23:46 +01:00
Gabriel Koppenstein 304e7f3faa Update pcb_render.yml 2024-11-26 16:14:55 +01:00
Gabriel Koppenstein 8b37c6ead4 Update pcb_render.yml 2024-11-26 16:03:33 +01:00
Gabriel Koppenstein a099ef67ed Update pcb_render.yml 2024-11-26 15:58:43 +01:00
Gabriel Koppenstein 0c225ee7f0 Update pcb_render.yml 2024-11-26 15:46:01 +01:00
Gabriel Koppenstein f8fcd77449 Update pcb_render.yml 2024-11-26 15:27:15 +01:00
Gabriel Koppenstein cb6669992f Update pcb_render.yml 2024-11-26 15:11:52 +01:00
Gabriel Koppenstein c65afef54f Update pcb_render.yml 2024-11-26 15:08:04 +01:00
github-actions d862355199 Add rendered PCB images 2024-11-26 14:02:56 +00:00
gab-k 7779207858 fix file extension and pcb path 2024-11-26 15:01:44 +01:00
Gabriel Koppenstein 0736054a49 Update pcb_render.yaml 2024-11-26 14:58:20 +01:00
gab-k b765f80048 Update action workflows 2024-11-26 14:54:02 +01:00
Gabriel Koppenstein cc81e4ed4c Update render-pcbdraw.yml 2024-11-25 23:37:38 +01:00
Gabriel Koppenstein 5d82d0c3f7 Update render-pcbdraw.yml 2024-11-25 23:15:11 +01:00
Gabriel Koppenstein 42d6fe3ef6 Update render-pcbdraw.yml 2024-11-25 23:11:19 +01:00
Gabriel Koppenstein 6d04cfb8b3 Update render-pcbdraw.yml 2024-11-25 23:07:53 +01:00
Gabriel Koppenstein a83f53d3d8 Update render-pcbdraw.yml 2024-11-25 23:03:36 +01:00
Gabriel Koppenstein fc8653ad74 Update render-pcbdraw.yml 2024-11-25 22:54:33 +01:00
Gabriel Koppenstein c6ee7b2564 Create render-pcbdraw.yml 2024-11-25 22:47:03 +01:00
gab-k 0380b398fc modify gitignore 2024-11-25 22:41:54 +01:00
gab-k 201d521be8 add auto generate .svg python scripts 2024-11-25 20:52:21 +01:00
gab-k dc53d98fda Moving some components on the schematic 2024-11-25 20:46:09 +01:00
gab-k a9c3c60b81 Changed 'LCSC Part Number' Field to 'LCSC Part #' 2024-11-24 23:23:50 +01:00
gab-k 78187ec19f Add LCSC Part numbers 2024-11-24 22:59:27 +01:00
gab-k 9240e5b1a7 New 4-Layer Board with USB; Update gitignore; Change Speed Table Comment; 2024-11-24 19:45:49 +01:00
gab-k d417235df5 remove measure_base_pwm; add comments 2024-01-09 21:30:32 +01:00
gab-k c1564feb4b Mostly renaming, remove control_parameter_t.output, add control_parameter_t.startup.level, ... 2024-01-06 22:56:31 +01:00
gab-k f3ffb73b62 Copy code from flash to ram in order to not use XIP allowing writing to flash memory while both cores are running;
Motor control now operates with two states/modes;
Extended Default CV Range to 1024 - refers to NMRA/RCN standards
2024-01-05 00:37:21 +01:00
gab-k 577bc5dd5c Merge branch 'main' into dev 2024-01-03 12:05:45 +01:00
gab-k 9b8906f476 Replace '≙' with '=' 2024-01-03 09:44:56 +01:00
gab-k baf9ea6081 Update .gitignore 2024-01-02 22:15:45 +01:00
Gabriel Koppenstein 1810541e48 Update Doxyfile 2024-01-02 18:40:23 +01:00
Gabriel Koppenstein b5b5de89dd Update doxygen-gh-pages.yml 2024-01-02 18:39:38 +01:00
Gabriel Koppenstein 3ef7fb99c7 Update doxygen-gh-pages.yml 2024-01-02 18:30:19 +01:00
Gabriel Koppenstein 461f65c88d Update doxygen-gh-pages.yml 2024-01-02 18:14:56 +01:00
gk6394s 7f870bcf71 Merge remote-tracking branch 'origin/main' 2024-01-02 17:07:35 +01:00
gk6394s 38ec9bf60d Change Doxyfile paths to relative paths 2024-01-02 17:07:18 +01:00
Gabriel Koppenstein f529859eff Create doxygen-gh-pages.yml
Create doxygen docs and deploy them
2024-01-02 16:33:38 +01:00
gk6394s e0c0424f87 Refactor Motor PWM init and ADC init; Added doxygen documentation for some functions; Changed some settings in Doxyfile 2024-01-02 16:10:00 +01:00
gk6394s 8fb10e212e Simplify get_speed_step_table_index_of_speed_step(); Removed unnecessary parameter from adjust_pwm_level function; Removed some redundant else statements and redundant "== true" from some expressions; Fixed reset_message_check() function; Added const to some function parameters and local variables; 2024-01-02 12:56:25 +01:00
gab-k 9ee13b67e7 Merge local branch 'changes' into main. 2024-01-01 22:01:17 +01:00
gab-k df9b0ba633 Reformatting and renaming some functions; replaced get_direction() with get_direction_of_speed_step() in order to simplify handling of direction; additional explanation comment in CV.h; add doxygen config file; 2024-01-01 19:21:47 +01:00
r3drock df009a5430 Update cmake-single-platform.yml 2023-12-31 21:21:25 +00:00
r3drock 0ca6f2ca13 Update cmake-single-platform.yml 2023-12-31 21:20:04 +00:00
r3drock 3f27046838 Create cmake-single-platform.yml 2023-12-31 21:18:26 +00:00
r3drock 5f0b51b043 Merge pull request #21 from gab-k/const
make more variables const
2023-12-31 21:13:17 +00:00
r3drock 02e1fdf156 make more variables const 2023-12-31 22:12:07 +01:00
r3drock 5ae65b301d Merge pull request #20 from gab-k/warnings
remove some warnings
2023-12-31 20:23:51 +00:00
r3drock 78123663ce remove some warnings 2023-12-31 21:20:51 +01:00
gab-k d7f4621b96 Completly remove .idea files and update .gitignore accordingly 2023-12-30 17:48:24 +01:00
gab-k 3364793a6f Completly remove .idea files and update .gitignore accordingly 2023-12-30 17:46:43 +01:00
gab-k 6df051019d Modified .gitignore 2023-12-30 16:09:45 +01:00
gab-k 9cf7301af7 Update .gitignore 2023-12-30 16:01:01 +01:00
gab-k 5ec8f953b4 Merge branch 'main' into dev 2023-12-30 15:37:54 +01:00
gab-k 52ec79105d Revert changes to LOG macro 2023-12-30 15:37:38 +01:00
gab-k 4b125c3488 Merge branch 'main' into dev 2023-12-30 15:25:10 +01:00
gab-k 12e54994a8 PCB routing 2023-12-30 15:23:39 +01:00
gab-k c8b75ee71f Fix missing Bitmask in F0-F4 function evaluation, Handle NULL-pointer in get_direction(), CMakelists.txt disable optimizing, Upload CLion config 2023-12-26 18:59:58 +01:00
Gabriel Koppenstein 27d68d3d24 Merge pull request #19 from gab-k/refactorlogging
always append a new line to log
2023-12-23 18:13:34 +01:00
r3drock 626e20fa5f add more lines 2023-12-23 18:07:08 +01:00
r3drock 992d6ae800 always append a new line to log 2023-12-23 17:58:42 +01:00
gab-k 721e5d5a65 PCB Routing 2023-12-20 18:35:24 +01:00
gab-k f28e594051 USB PCB routing, minor changes to schematic 2023-12-14 21:41:58 +01:00
gab-k 4c1be24278 added pcb constraints, changed designators, updated footprints and 3d-models, created board outline 2023-12-05 23:27:29 +01:00
gab-k 1ce384943e Changes to schematic, Created PCB 2023-12-04 21:00:05 +01:00
gab-k 07b792ac13 created USB and non-USB folders; added USB schematic 2023-12-04 19:54:08 +01:00
gab-k f0a23c208e corrected .gitignore 2023-12-04 19:18:19 +01:00
gab-k 570401489b fixed wrong parameter in measure() function call 2023-10-15 14:46:59 +02:00
Gabriel Koppenstein 10fbcb5815 Merge pull request #10 from questor/main
- Printf debugging with different logging levels, disabled by default
- Disabled UART, USB by default
2023-07-15 11:27:28 +02:00
questor/Inter 562258e433 remove ALL logging if not enabled 2023-05-27 22:41:52 +02:00
questor/Inter 36f20a8ca3 some more comments 2023-05-27 22:04:56 +02:00
questor/Inter 8877e4862d disable logging by default, added comments how to enable it and what are the consequences 2023-05-12 21:05:48 +02:00
questor/Inter 995dca15c8 more debug printfs, disabled function usage of gpio0/1, disabled usb interface to save some 25kb in the firmware image 2023-05-08 22:50:19 +02:00
questor/Inter 23b69d6823 more debug output 2023-04-27 23:07:19 +02:00
questor a0408c28ed some refactoring 2023-04-27 15:53:59 +02:00
Gabriel Koppenstein a57295817e Merge pull request #2 from WolfgangGitHub/main
Fix writing CV_1 - The default case was missing - Thank you Wolfgang
2023-01-11 22:28:15 +01:00
Wolfgang 3a3dbb4b63 fix writing CV_1 - the default case was missing 2023-01-08 22:07:59 -05:00
Gabriel Koppenstein 39056097d9 Update README.md 2022-08-11 23:25:32 +02:00
1nct 8f1f5cf915 - added/changed files for documentation
- added comment regarding CV array addresses
2022-08-06 13:54:26 +02:00
1nct 15a46b9dee - added files for documentation
- fixed undesired behaviour for direction change while decelerating
- adjusted default value for CV_54 & CV_55
2022-08-06 11:01:29 +02:00
1nct 0219963dd7 - Minor changes to variable names, comments & formatting
- Removed obsolete parameter previously used in program_mode
- Added correction constant regarding base pwm measurement
- Revised GPIO definitions (shared.h)
2022-08-03 19:19:14 +02:00
1nct bae6fff659 - Added GPIO svg 2022-08-02 20:51:29 +02:00
1nct 1cb5ddbae0 - Added long address svg
- Direction is now preserved on packet timeout
- Address > 127 can no longer be written to flash as it is not valid
2022-08-02 15:02:45 +02:00
1nct 64561d622b - Updated svg files (transparent bg) 2022-08-02 00:24:58 +02:00
1nct c8eece795f - Added and updated svg files used in docs
- minor change in speed_table calculation
2022-08-01 21:28:06 +02:00
1nct fd017ea685 - added shared.c file containing functions that can be accessed from both cores
- revised CV programming especially writing
- Core 1 is only started when valid package with correct address is received
- Extended addresses are now correctly verified and implemented
- Base PWM measurement is now done on core0 and checked for automatically in cv_setup_check()
- Moved Motor PWM, GPIO, ADC to core0
- Implemented inverted direction mode (CV_29) according to DCC-Standards
- Limited feed-forward parameters y_2 to max_output/y_1
- k_p gain slopes are now calculated on initialization
- k_p gain parameters are also in pid parameter struct now
- Revised init_pid()
- Implemented Packet timeout check (CV_11)
- 16Bit and 32Bit CVs now always have the highest bytes as the lowest array index to accommodate get_XXbit_CV() functions
2022-08-01 17:20:05 +02:00
1nct f09c4ff136 - Reduced amount of global variables. Many variables are now initialized in main() and core1_entry() respectively and then passed as pointer.
- Updates in speed steps are passed via multicore fifo.
- Pointer to direction variable is also passed from core1 to core0 via multicore fifo
- PID parameter struct definition moved to core1.h
- Implemented variable Proportional gain function
- Implemented function to determine base pwm level
- Minor changes regarding variable names
- Added more comments to roughly describe functionality of functions
2022-07-28 14:33:48 +02:00
1nct 15f67f6c8c Change to Pin assignements in shared.h 2022-07-18 13:33:42 +02:00
Gabriel Koppenstein 1d687b1fd9 Add files via upload 2022-05-27 14:57:08 +02:00
unknown 9e68c5b3ec AUX GPIO are now 24-27, ADC GPIO are now 28 and 29 DCC_IN is now 21 - Board Revision is now "0.3" - Omitted Rev. in Kicad filenames 2022-05-02 20:39:42 +02:00
1nct ad570fba35 - remove m_pwm_offset_adjustment;
- offset now adjusted in pid_control loop;
- pid sampling time depends on speed step;
- speed table implemented & and init function;
2022-03-12 10:23:51 +01:00
1nct 330d42a17e - changes to ADC offset adjustment; - changes to output set function; - cv_setup_check() now waits for core1 to launch also after programming 2022-03-06 01:03:17 +01:00
1nct 65250846f9 - improved PIN_MASK definitions; -implemented adc offset adjustment; - implemented startup checks for: factory flash setting, adc offset adjustment, motor offset adjustment; - implemented adc_offset CVs; - implemented CV_65 as indication for flash factory condition; -fixed core0.h 2022-03-05 14:46:48 +01:00
1nct a6fa9ef249 -updated readme, -modified F0-F31 handling, - implemented pwm for F0-F31 2022-03-05 01:41:40 +01:00
1nct 4f5283521d readme update & docs/png update (PCB Front png) 2022-03-02 09:12:17 +01:00
1nct 47d1543109 -updated docs/png 2022-03-02 08:53:32 +01:00
1nct efa3622e80 -updated docs/png -slight change to f.silkscreen 2022-03-02 08:49:10 +01:00
1nct 9f9b7f74d5 updated svg 2022-03-01 22:02:48 +01:00
1nct 3a8e075f97 small changes to schematic and update to docs/svg 2022-03-01 18:27:33 +01:00
1nct 5211e3f40f small changes to B.Silkscreen and B.Fab 2022-03-01 10:03:46 +01:00
1nct a31b3061fc Finished Board 2022-03-01 00:19:48 +01:00
1nct 2cad01370c - implemented linear approximation for pwm duty cycle offset (feed forward)
- changed pid params and variables in measure() from float to integers
- implemented Motor PWM Frequency CV
- improved acknowledge() function ( 3ms forward / 3ms reverse )
- moved automatic offset setup to speed step evaluation
- removed zener diode correction
- some minor changes regarding naming of constants
2022-02-23 02:15:12 +01:00
1nct cdb68b84da added startup offset to establish a baseline duty cycle at which the motor starts to spin 2022-02-20 11:32:03 +01:00
1nct 1334f9c540 -Added Multiplier to lengthen XOSC startup delay 2022-02-17 00:28:44 +01:00
1nct 4d073dd7f7 - Changes to sorting in measure() function
- Changes to Zener Voltage Correction /  measure now returns value in volts
- Changes to Motor control
- Resistor values changed
- Created BOM
2022-02-16 10:45:30 +01:00
1nct 57af1b67a4 removed 47k resistor 2022-02-07 23:41:35 +01:00
GabrielKoppenstein c6790c6653 Slight changes to schematic & progress on PCB design 2022-02-01 02:00:59 +01:00
GabrielKoppenstein 9d53676da3 Deleted unnecessary Files (KiCad) 2022-01-31 12:19:19 +01:00
GabrielKoppenstein ce0b3b4d18 -changes to gitignore regarding KiCad files
-changes to svg Files & Schematic ( Missing Net (GPIO) @ Input Stage)
2022-01-31 12:12:02 +01:00
GabrielKoppenstein dbe7cf42d1 PCB & svg 2022-01-31 01:42:13 +01:00
GabrielKoppenstein 63fdbed912 PCB and Schematic 2022-01-30 01:37:36 +01:00
GabrielKoppenstein 4fd00bf930 git commit -a 2022-01-29 12:12:46 +01:00
GabrielKoppenstein 08459e2ea8 Changed directories 2022-01-29 11:52:00 +01:00
Gabriel Koppenstein 4c660dd7b6 Rename Block_Diagram.svg to svg/Block_Diagram.svg 2022-01-27 23:15:29 +01:00
Gabriel Koppenstein 10da5e1fb7 Rename Motor_Driver.svg to svg/Motor_Driver.svg 2022-01-27 23:15:06 +01:00
Gabriel Koppenstein f63230a576 Rename Input.svg to svg/Input.svg 2022-01-27 23:14:38 +01:00
Gabriel Koppenstein e6b559248a Rename Auxillary.svg to svg/Auxillary.svg 2022-01-27 23:13:44 +01:00
Gabriel Koppenstein ee4627bf6d Add files via upload 2022-01-27 23:12:42 +01:00
Gabriel Koppenstein 9120c912a7 Update Block_Diagram.svg 2022-01-27 19:49:38 +01:00
Gabriel Koppenstein 684350d6f1 Update Block_Diagram.svg 2022-01-27 18:47:54 +01:00
Gabriel Koppenstein 251556a959 Update Block_Diagram.svg 2022-01-27 18:00:33 +01:00
Gabriel Koppenstein 4323fcb9a9 Update Block_Diagram.svg 2022-01-27 17:43:44 +01:00
Gabriel Koppenstein e0875b8796 Add files via upload 2022-01-27 17:08:02 +01:00
1nct 69f5b63d53 Merge remote-tracking branch 'origin/main' 2022-01-27 01:09:27 +01:00
1nct 594f693b9f - Correction for Zener Diode Voltage
- Changes to Header Files
2022-01-27 01:09:06 +01:00
Gabriel Koppenstein 48bda9d25f Update README.md 2022-01-27 00:25:36 +01:00
1nct ebdc57e90a - divided decoder.c in core0.c & core1.c
- improvements on set_outputs()
2022-01-09 11:30:32 +01:00
GabrielKoppenstein f81cf7fb0b - renamed multicore.c to decoder.c and header files respectively
- several changes to pid_control and speed_helper
- measurements are now being "filtered" (x smallest and y biggest values will be discarded to counteract noisy measurements)
- irq priority for core1 adjusted (pid_control irq now has highest priority)
2022-01-06 20:34:44 +01:00
GabrielKoppenstein 6070af4b10 Deprecated files, not needed anymore 2022-01-04 21:47:38 +01:00
GabrielKoppenstein 54e4c3661d mainly changes in ACK, CV read/write, they should be reliable now (Core1 shutdown during read & write Acknowledge due to conflict of PWM functions) 2022-01-04 21:35:27 +01:00
GabrielKoppenstein a642642285 Merge remote-tracking branch 'origin/main' 2022-01-03 02:33:59 +01:00
GabrielKoppenstein 81c99ce227 fixed acknowledge bit/byte read routine, many small fixes and improvements 2022-01-03 02:33:35 +01:00
GabrielKoppenstein a84ff9d175 Update README.md 2021-11-15 21:16:48 +01:00
GabrielKoppenstein 89e33e2135 Update README.md 2021-11-15 21:16:22 +01:00
GabrielKoppenstein 8c5bbf6348 Update README.md 2021-11-14 14:26:27 +01:00
GabrielKoppenstein fc2ce032f9 Update README.md 2021-11-14 14:23:52 +01:00
GabrielKoppenstein f7d241030d Update README.md 2021-11-14 14:19:41 +01:00
GabrielKoppenstein 681cbb943a Update README.md 2021-11-14 14:17:27 +01:00
GabrielKoppenstein ba8f0d1c89 Update README.md 2021-11-14 14:12:43 +01:00
GabrielKoppenstein b3deb8ebd4 Update README.md 2021-11-14 14:10:54 +01:00
GabrielKoppenstein 5bdd8e7d3c Add files via upload 2021-11-14 14:09:22 +01:00
GabrielKoppenstein 62b9bf9715 Update README.md 2021-11-13 21:49:12 +01:00
GabrielKoppenstein b59fb0d60b Update README.md 2021-11-13 21:47:17 +01:00
GabrielKoppenstein 0fe4a335ba Update README.md 2021-11-13 21:46:10 +01:00
GabrielKoppenstein 532ecc3030 Update LICENSE 2021-11-13 21:45:23 +01:00
GabrielKoppenstein a08bb9d4f9 Create LICENSE 2021-11-13 21:29:03 +01:00
GabrielKoppenstein 5f505c7585 Create README.md 2021-11-13 20:57:38 +01:00
GabrielKoppenstein 66f4eea593 . 2021-10-09 23:18:30 +02:00
GabrielKoppenstein af105ebc45 changed init_speed_helper function & implemented a function to calculate end_v_emf_target 2021-09-30 19:10:46 +02:00
GabrielKoppenstein d6ecb8e2b2 implemented repeating timers for pid_control and speed_helper + some minor changes. 2021-09-30 01:36:53 +02:00
GabrielKoppenstein 5a045b5fcf Implemented Basic Programming features, changed speed control (speed_helper function with timed interrupt) 2021-09-28 00:06:31 +02:00
GabrielKoppenstein df9a1848e4 Updated CV_ARRAY, added save to Flash function, changed various small things 2021-09-24 12:56:28 +02:00
GabrielKoppenstein 072f380b1d Removede FIFO Irq, Addded function for measuring and controlling motor speed 2021-09-22 17:04:16 +02:00
GabrielKoppenstein fc639b765e Removede FIFO Irq, Addded function for measuring and controlling motor speed 2021-09-19 10:17:45 +02:00
GabrielKoppenstein 1994f194ae Not many changes, mainly backup... 2021-09-16 00:02:39 +02:00
GabrielKoppenstein 705ddcfde7 PWM-Period adjustable, Vmin Vmax implemented, fixed alarm_callback, fixed FIFO IRQ 2021-09-03 23:12:18 +02:00
GabrielKoppenstein 0bb1ce71f9 Multicore IRQ + Timer for speed control 2021-09-03 00:10:32 +02:00
GabrielKoppenstein 0860162c4f Motor-PWM, code formatting 2021-09-01 00:24:50 +02:00
GabrielKoppenstein 2d50676a5e Idle Package, Broadcast Package, small improvements 2021-08-30 00:31:01 +02:00
GabrielKoppenstein 710692f40d unnecessary functions removed & improved names 2021-08-28 23:17:20 +02:00
GabrielKoppenstein dfbf100be2 functions supported 2021-08-28 15:04:08 +02:00
GabrielKoppenstein e3111cfe73 Function Matrix & Output Set function 2021-08-27 20:12:45 +02:00
GabrielKoppenstein 47101afbf8 function evaluation & CV & ... 2021-08-27 18:00:16 +02:00
GabrielKoppenstein 7e487f38cf error detection + address & command evaluation 2021-08-25 17:28:37 +02:00
nct d4cbf5c401 array änderungen + neuer automat 2021-08-24 15:16:10 +02:00
nct 8f3030c35e Revert "fix"
This reverts commit 1e874c5749.
2021-08-23 21:00:10 +02:00
nct 642ea3ddfb SIZE angepasst 2021-08-22 22:52:31 +02:00
Philipp Koppenstein 1e874c5749 fix 2021-08-22 22:31:37 +02:00
Philipp Koppenstein d116e0a2ac basispaket erkennen 2021-08-22 22:19:49 +02:00
186 changed files with 79917 additions and 12594 deletions

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
name: Build Software
on:
push:
branches:
- dev # Trigger on push to 'dev' branch
- main # Trigger on push to 'main' branch
paths:
- '.github/workflows/build_sw.yml' # Trigger if this workflow file changes
- 'Software/**' # Trigger if any file in the 'Software' directory changes
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install build packages
run: sudo apt-get update && sudo apt-get install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi g++ libstdc++-arm-none-eabi-newlib build-essential
- name: Get SDK and add PICO_SDK_PATH
run: git clone https://github.com/raspberrypi/pico-sdk.git && echo "PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk" >> $GITHUB_ENV
- name: Init submodules to get tinyUSB stack
run: ls && cd pico-sdk && git submodule update --init && cd ..
- name: Configure and run CMake for Hardware Rev 0.3
run: cmake -B ${{github.workspace}}/Software/build-Rev-0_3 -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=RP2040-Decoder-board-Rev-0_3
- name: Build for Hardware Rev 0.3
run: cmake --build ${{github.workspace}}/Software/build-Rev-0_3 --config ${{env.BUILD_TYPE}}
- name: Configure and run CMake for Hardware Rev 1.0
run: cmake -B ${{github.workspace}}/Software/build-Rev-1_0 -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=RP2040-Decoder-board-Rev-1_0
- name: Build for Hardware Rev 1.0
run: cmake --build ${{github.workspace}}/Software/build-Rev-1_0 --config ${{env.BUILD_TYPE}}
+77
View File
@@ -0,0 +1,77 @@
name: Generate documentation doxygen/breathe/sphinx and deploy on gh-pages/gh-pages-dev
on:
push:
branches:
- dev # Trigger on push to 'dev' branch
- main # Trigger on push to 'main' branch
paths:
- '.github/workflows/docs.yml' # Trigger if this workflow file changes
- 'Software/**' # Trigger if any file in the 'Software' directory changes
- 'docs/**' # Trigger if any file in the 'docs' directory changes
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Doxygen build
uses: mattnotmitt/doxygen-action@v1.9.5
with:
# Path to Doxyfile
doxyfile-path: './Doxyfile'
working-directory: 'docs/doxygen'
- name: Sphinx build
uses: ammaraskar/sphinx-action@0.4
with:
docs-folder: "docs/sphinx/"
- name: Upload sphinx files as artifact
uses: actions/upload-artifact@v4
with:
name: sphinx_files
path: docs/sphinx/build
deploy-main:
if: github.ref == 'refs/heads/main' # Only deploy on 'main' branch
runs-on: ubuntu-latest
needs: build
steps:
- name: Download sphinx files artifact
uses: actions/download-artifact@v4
with:
name: sphinx_files
path: docs/sphinx
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./html
publish_branch: gh-pages
destination_dir: docs/sphinx/build
deploy-dev:
if: github.ref == 'refs/heads/dev' # Only deploy on 'dev' branch
runs-on: ubuntu-latest
needs: build
steps:
- name: Download doxygen files artifact
uses: actions/download-artifact@v4
with:
name: sphinx_files
path: docs/sphinx
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/sphinx
publish_branch: gh-pages-dev # Specify the target branch (gh-pages-dev in this case)
destination_dir: sphinx
+111
View File
@@ -0,0 +1,111 @@
name: Render PCB images and rotating mp4
on:
push:
branches:
- dev # Trigger on push to 'dev' branch
- main # Trigger on push to 'main' branch
paths:
- '.github/workflows/pcb_render.yml' # Trigger if this workflow file changes
- 'KiCad/**' # Trigger if any file in the 'KiCad' directory changes
jobs:
render-images:
name: render-images
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Render PCB image and .mp4 (Rev 1.0)
uses: linalinn/kicad-render@main
with:
pcb_file: KiCad/Rev_1_0/RP2040-Decoder.kicad_pcb
output_path: ${{ github.workspace }}/images_rev_1_0
animation: mp4
- name: Render PCB image and .mp4 (Rev 0.3)
uses: linalinn/kicad-render@main
with:
pcb_file: KiCad/Rev_0_3/RP2040-Decoder.kicad_pcb
output_path: ${{ github.workspace }}/images_rev_0_3
animation: mp4
- name: Upload images and mp4 as artifact (Rev 1.0)
uses: actions/upload-artifact@v4
with:
name: pcb-images_rev_1_0
path: images_rev_1_0/
- name: Upload images and mp4 as artifact (Rev 0.3)
uses: actions/upload-artifact@v4
with:
name: pcb-images_rev_0_3
path: images_rev_0_3/
deploy-pages-main:
if: github.ref == 'refs/heads/main' # Only deploy on 'main' branch
runs-on: ubuntu-latest
needs: render-images
steps:
- name: Download pcb-images_rev_1_0 artifact
uses: actions/download-artifact@v4
with:
name: pcb-images_rev_1_0
path: images_rev_1_0/
- name: Download pcb-images_rev_0_3 artifact
uses: actions/download-artifact@v4
with:
name: pcb-images_rev_0_3
path: images_rev_0_3/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./images_rev_1_0
publish_branch: gh-pages # Specify the target branch (gh-pages in this case)
destination_dir: img_rev_1_0
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./images_rev_0_3
publish_branch: gh-pages # Specify the target branch (gh-pages in this case)
destination_dir: img_rev_0_3
deploy-pages-dev:
if: github.ref == 'refs/heads/dev' # Only deploy on 'dev' branch
runs-on: ubuntu-latest
needs: render-images
steps:
- name: Download pcb-images_rev_1_0 artifact
uses: actions/download-artifact@v4
with:
name: pcb-images_rev_1_0
path: images_rev_1_0/
- name: Download pcb-images_rev_0_3 artifact
uses: actions/download-artifact@v4
with:
name: pcb-images_rev_0_3
path: images_rev_0_3/
- name: Deploy Rev 1.0
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./images_rev_1_0
publish_branch: gh-pages-dev # Specify the target branch (gh-pages-dev in this case)
destination_dir: img_rev_1_0
- name: Deploy Rev 0.3
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./images_rev_0_3
publish_branch: gh-pages-dev # Specify the target branch (gh-pages-dev in this case)
destination_dir: img_rev_0_3
+131
View File
@@ -0,0 +1,131 @@
name: Build Software and create prerelease on tag
on:
push:
tags:
- "v[0-9]+.[0-9]+-PRERELEASE" # Trigger on PRERELEASE version tag push
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
jobs:
build_sw:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install build packages
run: sudo apt-get update && sudo apt-get install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi g++ libstdc++-arm-none-eabi-newlib build-essential
- name: Get SDK and add PICO_SDK_PATH
run: git clone https://github.com/raspberrypi/pico-sdk.git && echo "PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk" >> $GITHUB_ENV
- name: Init submodules to get tinyUSB stack
run: ls && cd pico-sdk && git submodule update --init && cd ..
- name: Configure and run CMake for Hardware Rev 0.3
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/Software/build-Rev-0_3 -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=RP2040-Decoder-board-Rev-0_3
- name: Build for Hardware Rev 0.3
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/Software/build-Rev-0_3 --config ${{env.BUILD_TYPE}}
- name: Configure and run CMake for Hardware Rev 1.0
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/Software/build-Rev-1_0 -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=RP2040-Decoder-board-Rev-1_0
- name: Build for Hardware Rev 1.0
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/Software/build-Rev-1_0 --config ${{env.BUILD_TYPE}}
- name: Upload build files as artifact Rev 0.3
uses: actions/upload-artifact@v4
with:
name: build_files_Rev-0_3
path: ${{github.workspace}}/Software/build-Rev-0_3
- name: Upload build files as artifact Rev 1.0
uses: actions/upload-artifact@v4
with:
name: build_files_Rev-1_0
path: ${{github.workspace}}/Software/build-Rev-1_0
generate-fabrication-files:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install KiCad
run: |
sudo add-apt-repository --yes ppa:kicad/kicad-8.0-releases
sudo apt update
sudo apt install --install-recommends kicad
- name: Clone Fabrication Toolkit
run: |
git clone https://github.com/bennymeg/Fabrication-Toolkit.git
- name: Run fab toolkit CLI
run: |
cd Fabrication-Toolkit
python3 -m plugins.cli -p ../KiCad/Rev_1_0/RP2040-Decoder.kicad_pcb --autoTranslate --autoFill
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: fab_outputs_rev_1_0
path: ./KiCad/Rev_1_0/production
prerelease:
runs-on: ubuntu-latest
needs: [build_sw, generate-fabrication-files]
steps:
- name: install zip package
run: sudo apt-get install zip
- name: Download fabrication outputs artifact
uses: actions/download-artifact@v4
with:
name: fab_outputs_rev_1_0
path: fab_outputs_rev_1_0
- name: Download build files artifact for Rev 0.3
uses: actions/download-artifact@v4
with:
name: build_files_Rev-0_3
path: build_files_Rev-0_3
- name: Download build files artifact for Rev 1.0
uses: actions/download-artifact@v4
with:
name: build_files_Rev-1_0
path: build_files_Rev-1_0
- name: ls
run: ls
- name: Zip fabrication outputs
run: zip -r FABRICATION_OUTPUTS-REV-1_0.zip fab_outputs_rev_1_0
- name: Zip Rev 0.3 build files
run: zip -r SW_BUILD-REV-0_3.zip build_files_Rev-0_3
- name: Zip Rev 1.0 build files
run: zip -r SW_BUILD-REV-1_0.zip build_files_Rev-1_0
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
files: |
SW_BUILD-REV-0_3.zip
SW_BUILD-REV-1_0.zip
FABRICATION_OUTPUTS-REV-1_0.zip
+131
View File
@@ -0,0 +1,131 @@
name: Build Software and create release on tag
on:
push:
tags:
- "v[0-9]+.[0-9]+-RELEASE" # Trigger on RELEASE version tag push
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
jobs:
build_sw:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install build packages
run: sudo apt-get update && sudo apt-get install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi g++ libstdc++-arm-none-eabi-newlib build-essential
- name: Get SDK and add PICO_SDK_PATH
run: git clone https://github.com/raspberrypi/pico-sdk.git && echo "PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk" >> $GITHUB_ENV
- name: Init submodules to get tinyUSB stack
run: ls && cd pico-sdk && git submodule update --init && cd ..
- name: Configure and run CMake for Hardware Rev 0.3
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/Software/build-Rev-0_3 -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=RP2040-Decoder-board-Rev-0_3
- name: Build for Hardware Rev 0.3
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/Software/build-Rev-0_3 --config ${{env.BUILD_TYPE}}
- name: Configure and run CMake for Hardware Rev 1.0
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/Software/build-Rev-1_0 -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=RP2040-Decoder-board-Rev-1_0
- name: Build for Hardware Rev 1.0
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/Software/build-Rev-1_0 --config ${{env.BUILD_TYPE}}
- name: Upload build files as artifact Rev 0.3
uses: actions/upload-artifact@v4
with:
name: build_files_Rev-0_3
path: ${{github.workspace}}/Software/build-Rev-0_3
- name: Upload build files as artifact Rev 1.0
uses: actions/upload-artifact@v4
with:
name: build_files_Rev-1_0
path: ${{github.workspace}}/Software/build-Rev-1_0
generate-fabrication-files:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install KiCad
run: |
sudo add-apt-repository --yes ppa:kicad/kicad-8.0-releases
sudo apt update
sudo apt install --install-recommends kicad
- name: Clone Fabrication Toolkit
run: |
git clone https://github.com/bennymeg/Fabrication-Toolkit.git
- name: Run fab toolkit CLI
run: |
cd Fabrication-Toolkit
python3 -m plugins.cli -p ../KiCad/Rev_1_0/RP2040-Decoder.kicad_pcb --autoTranslate --autoFill
cd ..
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: fab_outputs_rev_1_0
path: ./KiCad/Rev_1_0/production
release:
runs-on: ubuntu-latest
needs: [build_sw, generate-fabrication-files]
steps:
- name: install zip package
run: sudo apt-get install zip
- name: Download fabrication outputs artifact
uses: actions/download-artifact@v4
with:
name: fab_outputs_rev_1_0
path: fab_outputs_rev_1_0
- name: Download build files artifact for Rev 0.3
uses: actions/download-artifact@v4
with:
name: build_files_Rev-0_3
path: build_files_Rev-0_3
- name: Download build files artifact for Rev 1.0
uses: actions/download-artifact@v4
with:
name: build_files_Rev-1_0
path: build_files_Rev-1_0
- name: ls
run: ls
- name: Zip fabrication outputs
run: zip -r FABRICATION_OUTPUTS-REV-1_0.zip fab_outputs_rev_1_0
- name: Zip Rev 0.3 build files
run: zip -r SW_BUILD-REV-0_3.zip build_files_Rev-0_3
- name: Zip Rev 1.0 build files
run: zip -r SW_BUILD-REV-1_0.zip build_files_Rev-1_0
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
SW_BUILD-REV-0_3.zip
SW_BUILD-REV-1_0.zip
FABRICATION_OUTPUTS-REV-1_0.zip
+35
View File
@@ -0,0 +1,35 @@
# IDE Configurations
.vscode
.idea
# Doxygen generated files
docs/doxygen/build
# Sphinx generated files
docs/sphinx/build
# Build folders
build
cmake-build-debug
cmake-build-release
# KiCad ignored files
KiCad/RP2040-Decoder-backups
KiCad/*.bak
KiCad/fp-info-cache
KiCad/_autosave-*
KiCad/*.kicad_prl
KiCad/*/RP2040-Decoder-backups
KiCad/*/*.bak
KiCad/*/fp-info-cache
KiCad/*/_autosave-*
KiCad/*/*.kicad_prl
KiCad/*.kicad_sch-bak
KiCad/*.kicad_pcb-bak
KiCad/*.kicad_pcb.lck
KiCad/*/production
KiCad/*/fabrication-toolkit-options.json
KiCad/*/output
# Temporary files
scripts/temp
View File
Whitespace-only changes.
+34
View File
@@ -0,0 +1,34 @@
(footprint "C_0603_1608Metric" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 621D1E9C)
(descr "Capacitor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator")
(tags "capacitor")
(attr smd)
(fp_text reference "REF**" (at 0 -1.43) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp d8b50c90-0233-4120-8eb7-fd37553c1dae)
)
(fp_text value "C_0603_1608Metric" (at 0 1.43) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 4e5feb93-e33a-49c0-b9c5-ae5884f54838)
)
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
(effects (font (size 0.4 0.4) (thickness 0.06)))
(tstamp 579d7eba-875c-4a83-94cf-9a0ffb7d4ec6)
)
(fp_line (start -1.48 0.73) (end -1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp 40f7c129-7117-4932-921f-63d9649a8e3c))
(fp_line (start 1.48 -0.73) (end 1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp 4cdf0691-68d0-4b9c-a08d-e458d11a6264))
(fp_line (start -1.48 -0.73) (end 1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp bc329fd9-c699-40fd-809e-176f9fd0c1d5))
(fp_line (start 1.48 0.73) (end -1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp c885676b-37fb-4c12-bfd6-27ae9c8dfd4f))
(fp_line (start -0.8 -0.4) (end 0.8 -0.4) (layer "F.Fab") (width 0.1) (tstamp 06122ef5-5764-4a31-a1df-58f084862b1c))
(fp_line (start 0.8 -0.4) (end 0.8 0.4) (layer "F.Fab") (width 0.1) (tstamp 1d2a7865-4bae-407b-82ca-a2578f9efb73))
(fp_line (start 0.8 0.4) (end -0.8 0.4) (layer "F.Fab") (width 0.1) (tstamp 3fe6a869-68b8-4f26-8354-3cc1c9697594))
(fp_line (start -0.8 0.4) (end -0.8 -0.4) (layer "F.Fab") (width 0.1) (tstamp 864e65e5-cec8-4833-ae53-dec6136866be))
(pad "1" smd roundrect (at -0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 251ae9f1-97b4-42c7-a502-27edca1e9c60))
(pad "2" smd roundrect (at 0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b3136c2f-02b9-49e1-a069-45a3c84854a1))
(model "${KICAD6_3DMODEL_DIR}/Capacitor_SMD.3dshapes/C_0603_1608Metric.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
@@ -0,0 +1,101 @@
(footprint "QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 61F5394A)
(descr "QFN, 56 Pin (http://www.cypress.com/file/416486/download#page=40), generated with kicad-footprint-generator ipc_noLead_generator.py")
(tags "QFN NoLead")
(attr smd)
(fp_text reference "REF**" (at 0 -4.82) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 1cb41492-bb93-4790-ad58-0f20773d1f59)
)
(fp_text value "QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm" (at 0 4.82) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp b083abe2-0457-4996-a931-50814a9c1d4b)
)
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 7602d57d-0ec6-45eb-9694-c6ae1a760741)
)
(fp_line (start 3.61 -3.61) (end 3.61 -2.96) (layer "F.SilkS") (width 0.12) (tstamp 143843d9-5b2b-4149-9a31-87496276e62e))
(fp_line (start 2.96 -3.61) (end 3.61 -3.61) (layer "F.SilkS") (width 0.12) (tstamp 1ce4caf8-c8bb-4fee-96d4-66c6c11818f1))
(fp_line (start -3.61 3.61) (end -3.61 2.96) (layer "F.SilkS") (width 0.12) (tstamp 28e3cecb-5b2d-440e-975c-84c54fd48764))
(fp_line (start -2.96 3.61) (end -3.61 3.61) (layer "F.SilkS") (width 0.12) (tstamp 33148282-40c9-4cda-b710-b4676c401c9e))
(fp_line (start -2.96 -3.61) (end -3.61 -3.61) (layer "F.SilkS") (width 0.12) (tstamp 63b300c0-d2bd-467a-a60a-7afd101321d8))
(fp_line (start 2.96 3.61) (end 3.61 3.61) (layer "F.SilkS") (width 0.12) (tstamp 75376d1a-b1cd-48ca-bb23-11e604649e2c))
(fp_line (start 3.61 3.61) (end 3.61 2.96) (layer "F.SilkS") (width 0.12) (tstamp ae450cc7-7def-4688-a990-071728b5d6c1))
(fp_line (start 4.12 4.12) (end 4.12 -4.12) (layer "F.CrtYd") (width 0.05) (tstamp 24d84152-bd16-42f0-b31c-da5c0075c0a9))
(fp_line (start -4.12 4.12) (end 4.12 4.12) (layer "F.CrtYd") (width 0.05) (tstamp 4a43d0e8-6681-4990-bf2a-d86962571c6c))
(fp_line (start 4.12 -4.12) (end -4.12 -4.12) (layer "F.CrtYd") (width 0.05) (tstamp cceb0992-d7b0-445b-8d5b-32d0d8fb8730))
(fp_line (start -4.12 -4.12) (end -4.12 4.12) (layer "F.CrtYd") (width 0.05) (tstamp f00de455-d6a3-446a-aed3-4d3f2a1d79a7))
(fp_line (start -3.5 -2.5) (end -2.5 -3.5) (layer "F.Fab") (width 0.1) (tstamp 6dd7f30c-e337-4ce2-8c91-e9492994a612))
(fp_line (start 3.5 3.5) (end -3.5 3.5) (layer "F.Fab") (width 0.1) (tstamp 9478caeb-b727-455b-93f6-4a7ba6bf88ff))
(fp_line (start -2.5 -3.5) (end 3.5 -3.5) (layer "F.Fab") (width 0.1) (tstamp 964fef0c-28c1-487d-979d-e51467c515ad))
(fp_line (start 3.5 -3.5) (end 3.5 3.5) (layer "F.Fab") (width 0.1) (tstamp e31d6a06-a105-4ec5-90bf-40066b0d8ad4))
(fp_line (start -3.5 3.5) (end -3.5 -2.5) (layer "F.Fab") (width 0.1) (tstamp fd3e7550-b460-4c66-9cde-67bd2357b67b))
(pad "" smd roundrect (at 0.7 -0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp 14d0da6f-9850-487b-bd20-464b22ec06c3))
(pad "" smd roundrect (at 0.7 0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp 429b569e-2ded-491e-b5a3-5fd6415c5df9))
(pad "" smd roundrect (at -0.7 0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp 7d0b040a-02c1-46cc-86f8-9545b08e89b9))
(pad "" smd roundrect (at -0.7 -0.7) (size 1.13 1.13) (layers "F.Paste") (roundrect_rratio 0.221239) (tstamp f7d7c5a0-f2af-4f33-92e7-dc77c486f00c))
(pad "1" smd roundrect (at -3.4375 -2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c7b2dfb2-c297-4775-bd8d-089f60c7f5c8))
(pad "2" smd roundrect (at -3.4375 -2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 96efaa14-69c7-43f1-99ef-d01236e1a38c))
(pad "3" smd roundrect (at -3.4375 -1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 887a9c86-b2af-497c-a44d-ba6d3b6eee34))
(pad "4" smd roundrect (at -3.4375 -1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a4c866ab-a81b-4914-a82c-4af5068226be))
(pad "5" smd roundrect (at -3.4375 -1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 319c4bb4-77f6-475b-a1e8-482e167b57ca))
(pad "6" smd roundrect (at -3.4375 -0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 44343f1b-3511-4672-8759-abd5eef10cae))
(pad "7" smd roundrect (at -3.4375 -0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 67f19c8d-8979-4413-b403-af166a4bcc58))
(pad "8" smd roundrect (at -3.4375 0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8e4d7d65-0971-4417-a795-e7ff376ffc5d))
(pad "9" smd roundrect (at -3.4375 0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 7e33e4ab-fed5-4093-8dc7-44ccc10980e1))
(pad "10" smd roundrect (at -3.4375 1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5e1c2358-e06a-4178-a65d-3bf67a4ad21c))
(pad "11" smd roundrect (at -3.4375 1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 6804eff7-f37b-4022-9c54-d351dccc84eb))
(pad "12" smd roundrect (at -3.4375 1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5e8d90bc-2fe1-4989-a471-1cceb269bd73))
(pad "13" smd roundrect (at -3.4375 2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0da88f34-3793-44c0-8143-7f0dea1a4314))
(pad "14" smd roundrect (at -3.4375 2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 09963381-f1a7-4c31-9958-ca5cb9dc7851))
(pad "15" smd roundrect (at -2.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp dba53c32-257a-4c9c-aea8-082fff066384))
(pad "16" smd roundrect (at -2.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a3a33519-a8d7-4b84-be08-51a5335fe175))
(pad "17" smd roundrect (at -1.8 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f17a8568-d5be-4c65-a695-e83f5cdf9445))
(pad "18" smd roundrect (at -1.4 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5cdf8853-e1e4-4897-89a7-7b632a6efa32))
(pad "19" smd roundrect (at -1 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d0d3c6ef-4125-4dc5-b5ad-5da5a2561954))
(pad "20" smd roundrect (at -0.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 16009885-a147-43ed-872a-45cc04729c13))
(pad "21" smd roundrect (at -0.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 3ad23e03-d2b3-45b0-96b4-e49fcc75a345))
(pad "22" smd roundrect (at 0.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a990de91-5995-4cff-94bb-31570e219c84))
(pad "23" smd roundrect (at 0.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 254019b0-e277-429d-a55f-a9d08453afdf))
(pad "24" smd roundrect (at 1 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 15c23a20-506a-4d56-9a2a-d884b9d6198c))
(pad "25" smd roundrect (at 1.4 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0be7c0f3-fc66-4a46-98fd-a6fddd642a97))
(pad "26" smd roundrect (at 1.8 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e55551c2-9727-4f82-8965-442f2de0297a))
(pad "27" smd roundrect (at 2.2 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 10390f88-05f9-4e11-a7da-0544f9016d20))
(pad "28" smd roundrect (at 2.6 3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c0ab3a28-2ebf-44f5-9999-a96d24c577ef))
(pad "29" smd roundrect (at 3.4375 2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5549a141-bd37-4941-bf43-9377fe64f8b8))
(pad "30" smd roundrect (at 3.4375 2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ddce157f-e5cf-4d3a-9d41-9b248cb3ff94))
(pad "31" smd roundrect (at 3.4375 1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 9c2ce4c2-4359-4c69-b300-98ae259e675f))
(pad "32" smd roundrect (at 3.4375 1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ebe8908f-cbd0-4002-aa82-aec841dec7a0))
(pad "33" smd roundrect (at 3.4375 1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 807695a7-b8c4-48b1-895b-48a01f30d2ff))
(pad "34" smd roundrect (at 3.4375 0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d9d74ddf-dbf5-42e7-b795-43c2a39794c3))
(pad "35" smd roundrect (at 3.4375 0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 25f7a118-ae51-4579-b07d-4055183275f0))
(pad "36" smd roundrect (at 3.4375 -0.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 28d5738d-b02a-45dc-b853-c32eacab6460))
(pad "37" smd roundrect (at 3.4375 -0.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f945430f-d0c0-45b7-9474-d4928893c459))
(pad "38" smd roundrect (at 3.4375 -1) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 9343fc0a-33d3-4c32-83e4-d4375dedea11))
(pad "39" smd roundrect (at 3.4375 -1.4) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1018c1f0-8364-4603-9eb7-871c47a0edd9))
(pad "40" smd roundrect (at 3.4375 -1.8) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 57d9ae23-160d-46fc-8542-0761f66cbb54))
(pad "41" smd roundrect (at 3.4375 -2.2) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e768590b-fd92-4808-8b5c-c538a5d71353))
(pad "42" smd roundrect (at 3.4375 -2.6) (size 0.875 0.2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 36330616-c7ee-47cb-a9a2-2c08f9379b75))
(pad "43" smd roundrect (at 2.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f8d40dea-ce23-49a3-959a-4c9beb32562e))
(pad "44" smd roundrect (at 2.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1a44131e-010d-4427-99b4-adce439b4f96))
(pad "45" smd roundrect (at 1.8 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5d93abe2-4532-4ea6-9697-91c5148b5895))
(pad "46" smd roundrect (at 1.4 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ccd0074a-1ef0-4248-9305-14c53f69babc))
(pad "47" smd roundrect (at 1 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 645e2e12-0daf-40c6-a7dd-ca600e9603e8))
(pad "48" smd roundrect (at 0.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 83e08de6-7ccd-4d47-9971-4da79778fa87))
(pad "49" smd roundrect (at 0.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e0b56605-8256-4030-b90e-875ee0e71a8d))
(pad "50" smd roundrect (at -0.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 08f03e47-fe87-40d7-900f-6d6289046a31))
(pad "51" smd roundrect (at -0.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 838fcb00-5128-4f30-9cee-70ba20819dc6))
(pad "52" smd roundrect (at -1 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 688210ff-9853-432c-a726-b0b425cde226))
(pad "53" smd roundrect (at -1.4 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 247657c3-72e1-4b9b-a4c3-eadc80c2ec1a))
(pad "54" smd roundrect (at -1.8 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d2bb7984-ebbb-4e51-b516-a37fe7852441))
(pad "55" smd roundrect (at -2.2 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0e4964e6-9cba-4f92-89e6-e4cbbd69b948))
(pad "56" smd roundrect (at -2.6 -3.4375) (size 0.2 0.875) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ab8fa6cb-13a9-4f3f-b0ca-4d49ee4c0849))
(pad "57" smd rect (at 0 0) (size 3.2 3.2) (layers "F.Cu" "F.Mask") (tstamp e9c5dcde-1025-4724-ab6b-fa143326a9b2))
(model "${KICAD6_3DMODEL_DIR}/Package_DFN_QFN.3dshapes/QFN-56-1EP_7x7mm_P0.4mm_EP5.6x5.6mm.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
File diff suppressed because it is too large. Load diff
+604
View File
@@ -0,0 +1,604 @@
{
"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.0,
"height": 2.0,
"width": 2.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": {
"45_degree_only": false,
"min_clearance": 0.19999999999999998
}
},
"diff_pair_dimensions": [
{
"gap": 0.0,
"via_gap": 0.0,
"width": 0.0
}
],
"drc_exclusions": [],
"meta": {
"version": 2
},
"rule_severities": {
"annular_width": "error",
"clearance": "error",
"connection_width": "warning",
"copper_edge_clearance": "error",
"copper_sliver": "warning",
"courtyards_overlap": "warning",
"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": "error",
"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": "warning",
"malformed_courtyard": "error",
"microvia_drill_out_of_range": "error",
"missing_courtyard": "ignore",
"missing_footprint": "warning",
"net_conflict": "warning",
"npth_inside_courtyard": "ignore",
"padstack": "error",
"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": {
"allow_blind_buried_vias": false,
"allow_microvias": false,
"max_error": 0.005,
"min_clearance": 0.127,
"min_connection": 0.0,
"min_copper_edge_clearance": 0.19999999999999998,
"min_hole_clearance": 0.19999999999999998,
"min_hole_to_hole": 0.254,
"min_microvia_diameter": 0.19999999999999998,
"min_microvia_drill": 0.09999999999999999,
"min_resolved_spokes": 2,
"min_silk_clearance": 0.0,
"min_text_height": 0.7999999999999999,
"min_text_thickness": 0.08,
"min_through_hole_diameter": 0.19999999999999998,
"min_track_width": 0.127,
"min_via_annular_width": 0.13,
"min_via_diameter": 0.39999999999999997,
"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": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"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": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"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": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"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.127,
0.2,
0.25,
0.4,
0.5,
0.6,
0.75,
0.8
],
"via_dimensions": [
{
"diameter": 0.0,
"drill": 0.0
},
{
"diameter": 0.56,
"drill": 0.3
},
{
"diameter": 0.6,
"drill": 0.3
},
{
"diameter": 0.75,
"drill": 0.375
},
{
"diameter": 0.8,
"drill": 0.4
}
],
"zones_allow_external_fillets": false,
"zones_use_no_outline": true
},
"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_label_syntax": "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": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"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": "RP2040-Decoder.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": "",
"plot": "",
"pos_files": "",
"specctra_dsn": "",
"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": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.25,
"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": 0.0,
"text_offset_ratio": 0.08
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "/home/gab/Documents/",
"spice_adjust_passive_values": false,
"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": [
[
"11d18738-0f49-4d63-b61c-22a93efd5959",
""
]
],
"text_variables": {}
}
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
+34
View File
@@ -0,0 +1,34 @@
(footprint "R_0603_1608Metric" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 621D1EDA)
(descr "Resistor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator")
(tags "resistor")
(attr smd)
(fp_text reference "REF**" (at 0 -1.43) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 6df974b4-b819-4abf-a570-cfac24b90f22)
)
(fp_text value "R_0603_1608Metric" (at 0 1.43) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 43a2d3f9-8880-4891-bb65-e1f1adf1c2a5)
)
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
(effects (font (size 0.4 0.4) (thickness 0.06)))
(tstamp 2dfd6efa-e1ab-4e55-ab2b-7f9e70f33afa)
)
(fp_line (start -1.48 -0.73) (end 1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp 24e272be-4051-4b9b-9127-1c7f22532469))
(fp_line (start 1.48 -0.73) (end 1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp 2bbe1e5e-3213-443e-930c-a0ae97a345e1))
(fp_line (start -1.48 0.73) (end -1.48 -0.73) (layer "F.CrtYd") (width 0.05) (tstamp 39fddbf8-ad85-4516-95fc-b7f57b1b5476))
(fp_line (start 1.48 0.73) (end -1.48 0.73) (layer "F.CrtYd") (width 0.05) (tstamp dc275714-5365-4c02-a2fb-5cbd77201d52))
(fp_line (start 0.8 -0.4125) (end 0.8 0.4125) (layer "F.Fab") (width 0.1) (tstamp 0746adbb-419c-491f-ae91-c14351e88a28))
(fp_line (start -0.8 -0.4125) (end 0.8 -0.4125) (layer "F.Fab") (width 0.1) (tstamp 30e382fb-e120-4499-bc15-156f98cd93e8))
(fp_line (start 0.8 0.4125) (end -0.8 0.4125) (layer "F.Fab") (width 0.1) (tstamp 9ddd7cd8-091d-447c-bc2a-eed5612caf40))
(fp_line (start -0.8 0.4125) (end -0.8 -0.4125) (layer "F.Fab") (width 0.1) (tstamp d04dd1a4-2178-41f5-9bb7-ad470915f47a))
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 958f80d5-b7aa-4100-9f8f-c88ef419994d))
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp dbf61a86-b574-45d2-ba89-95e1ee8fabb2))
(model "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
@@ -0,0 +1,57 @@
(footprint "SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 621D2936)
(descr "SOIC, 8 Pin (http://www.allegromicro.com/~/media/Files/Datasheets/A4950-Datasheet.ashx#page=8), generated with kicad-footprint-generator ipc_gullwing_generator.py")
(tags "SOIC SO")
(attr smd)
(fp_text reference "REF**" (at -0.2 -4.3) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 0d0f734b-55d5-4594-866a-ce6819cf8228)
)
(fp_text value "SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias" (at 0 3.4) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 22956637-17bd-4c2e-acb6-b78772616ce1)
)
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
(effects (font (size 0.98 0.98) (thickness 0.15)))
(tstamp 114d50fb-c631-48ec-b90f-efb4be58d6c8)
)
(fp_line (start 1.55 2.56) (end 3.4 2.56) (layer "F.SilkS") (width 0.12) (tstamp 4215d5a7-1062-44a9-96e2-c894457eb6a9))
(fp_line (start -1.55 -2.56) (end -3.4 -2.56) (layer "F.SilkS") (width 0.12) (tstamp 5e1b6593-5e9b-46a9-b77d-e8857a7019a7))
(fp_line (start -1.55 2.56) (end -3.4 2.56) (layer "F.SilkS") (width 0.12) (tstamp d2f4f71b-dad4-477c-9332-cfa0b1762c3c))
(fp_line (start 1.55 -2.56) (end 3.4 -2.56) (layer "F.SilkS") (width 0.12) (tstamp d8ebe137-f5d5-4c2e-b1be-05e2e860bfc2))
(fp_line (start 3.7 2.7) (end 3.7 -2.7) (layer "F.CrtYd") (width 0.05) (tstamp 03434c57-aec9-4997-bdac-bd6bc0877cdd))
(fp_line (start -3.7 -2.7) (end -3.7 2.7) (layer "F.CrtYd") (width 0.05) (tstamp 3b0dc4e4-bdc2-4b50-aa3f-9e14820b2751))
(fp_line (start -3.7 2.7) (end 3.7 2.7) (layer "F.CrtYd") (width 0.05) (tstamp 839afce9-2060-4cb0-b78e-caadc6bdbef9))
(fp_line (start 3.7 -2.7) (end -3.7 -2.7) (layer "F.CrtYd") (width 0.05) (tstamp e48a8fea-d898-4d03-99fa-28f365900862))
(fp_line (start -1.95 -1.475) (end -0.975 -2.45) (layer "F.Fab") (width 0.1) (tstamp 27208f4d-f461-4f50-a941-8886d9234066))
(fp_line (start -0.975 -2.45) (end 1.95 -2.45) (layer "F.Fab") (width 0.1) (tstamp 2c3326d8-8f3d-40cb-a7dd-fa99c40b6598))
(fp_line (start 1.95 -2.45) (end 1.95 2.45) (layer "F.Fab") (width 0.1) (tstamp 5c93c3a4-8b42-477a-892d-3a4116ce4a83))
(fp_line (start -1.95 2.45) (end -1.95 -1.475) (layer "F.Fab") (width 0.1) (tstamp 7b8850b8-629b-406b-a955-153bdfac67a7))
(fp_line (start 1.95 2.45) (end -1.95 2.45) (layer "F.Fab") (width 0.1) (tstamp d594cbf2-5861-4bce-8ea6-54b69faa1bde))
(pad "" smd roundrect (at -0.6 0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 02654062-e307-48a2-a672-ab6985eb502c))
(pad "" smd roundrect (at -0.6 -0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 0eda8a60-9156-494c-b248-9f23876b9c97))
(pad "" smd roundrect (at 0.6 0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 275e7eda-80dc-4dae-8d5a-d69839ef7060))
(pad "" smd roundrect (at 0.6 -0.825) (size 1.01 1.38) (layers "F.Paste") (roundrect_rratio 0.247525) (tstamp 2ff99c2d-e844-44d0-bfc9-4f54f1b985ca))
(pad "1" smd roundrect (at -2.475 -1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8dcf9965-4b38-4f4e-969f-578bcad555e9))
(pad "2" smd roundrect (at -2.475 -0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 425dcc81-ccb1-492a-ac99-b0bf1be89e2d))
(pad "3" smd roundrect (at -2.475 0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 56d4d9c4-0452-47df-88a8-5979c8feb2db))
(pad "4" smd roundrect (at -2.475 1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 53106e3f-8345-4981-a96d-68820362ebea))
(pad "5" smd roundrect (at 2.475 1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ef1eddff-7709-4257-916a-36fa2baed22e))
(pad "6" smd roundrect (at 2.475 0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b401095e-aca0-4b4a-8e85-319099d7598c))
(pad "7" smd roundrect (at 2.475 -0.635) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 4ab1bb28-4236-42fc-aa5d-09e01f4abe45))
(pad "8" smd roundrect (at 2.475 -1.905) (size 1.95 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 61ad49d1-2f42-4f33-afdd-01be938e7e56))
(pad "9" thru_hole circle (at 0.7 -1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp 1327a571-9408-4f2e-b3bb-b550b6d3a0be))
(pad "9" thru_hole circle (at 0.7 0) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp 38ad4bee-e334-45b6-98b3-91580c43f314))
(pad "9" smd rect (at 0 0) (size 2.41 3.3) (layers "F.Cu" "F.Mask") (tstamp 492dc4b9-8891-40fa-9726-31f4ba6ae3a0))
(pad "9" smd rect (at 0 0) (size 1.9 2.9) (layers "B.Cu") (tstamp a267eaa8-2c1c-4f35-9bdd-c1551668d64b))
(pad "9" thru_hole circle (at 0.7 1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp c6fc29d8-1848-4d54-9ceb-e114b4dd89d9))
(pad "9" thru_hole circle (at -0.7 0) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp d63c1844-7ca4-4d96-92d7-088888b2e2e0))
(pad "9" thru_hole circle (at -0.7 1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp dac580e0-d592-40c4-a6a3-32f4156ddde6))
(pad "9" thru_hole circle (at -0.7 -1.2) (size 0.5 0.5) (drill 0.2) (layers *.Cu) (tstamp e44650f7-3103-408b-ac51-7088faf35d1a))
(model "${KICAD6_3DMODEL_DIR}/Package_SO.3dshapes/SOIC-8_3.9x4.9mm_P1.27mm.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
@@ -0,0 +1,50 @@
(footprint "SOIC-8_5.23x5.23mm_P1.27mm" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 621CE813)
(descr "SOIC, 8 Pin (http://www.winbond.com/resource-files/w25q32jv%20revg%2003272018%20plus.pdf#page=68), generated with kicad-footprint-generator ipc_gullwing_generator.py")
(tags "SOIC SO")
(attr smd)
(fp_text reference "REF**" (at 0 -3.56) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 892c99ea-5410-4a65-9ee4-bdc09fdc90ee)
)
(fp_text value "SOIC-8_5.23x5.23mm_P1.27mm" (at 0 3.56) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp c04ec0d1-7f0d-4019-91be-a6614badf406)
)
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 77985a68-90d4-4d27-872a-c400b51090e9)
)
(fp_line (start -2.725 2.725) (end -2.725 2.465) (layer "F.SilkS") (width 0.12) (tstamp 00138a61-23f0-45f3-9f28-2bbd8494a1fc))
(fp_line (start -2.725 -2.465) (end -4.4 -2.465) (layer "F.SilkS") (width 0.12) (tstamp 0ad895a6-0c83-484a-8b80-3635647eb60a))
(fp_line (start 0 -2.725) (end -2.725 -2.725) (layer "F.SilkS") (width 0.12) (tstamp 0ef6c909-3192-40ee-a6d7-49ae09a79a2d))
(fp_line (start -2.725 -2.725) (end -2.725 -2.465) (layer "F.SilkS") (width 0.12) (tstamp 1faa07e6-bd78-437e-b4e2-cd00c2b8018d))
(fp_line (start 2.725 2.725) (end 2.725 2.465) (layer "F.SilkS") (width 0.12) (tstamp 3a26b0fd-8ddd-4bb6-8f59-5d8caaf547d2))
(fp_line (start 0 2.725) (end 2.725 2.725) (layer "F.SilkS") (width 0.12) (tstamp 599161f8-efef-47ec-8f3f-69142e759f9f))
(fp_line (start 0 2.725) (end -2.725 2.725) (layer "F.SilkS") (width 0.12) (tstamp 7563e6d6-e180-4d92-9939-ff14aba164c5))
(fp_line (start 2.725 -2.725) (end 2.725 -2.465) (layer "F.SilkS") (width 0.12) (tstamp bd45a508-6e93-4f9b-948f-0868d234cca2))
(fp_line (start 0 -2.725) (end 2.725 -2.725) (layer "F.SilkS") (width 0.12) (tstamp e0b94375-2281-4987-b4d4-78e8e535972c))
(fp_line (start 4.65 -2.86) (end -4.65 -2.86) (layer "F.CrtYd") (width 0.05) (tstamp 15719beb-6925-433d-810a-8c40136a730d))
(fp_line (start 4.65 2.86) (end 4.65 -2.86) (layer "F.CrtYd") (width 0.05) (tstamp 343b8478-4e57-4c34-a00f-f6c76028fbb0))
(fp_line (start -4.65 2.86) (end 4.65 2.86) (layer "F.CrtYd") (width 0.05) (tstamp 48c8ef75-8bc0-4249-b6fc-f564812177b5))
(fp_line (start -4.65 -2.86) (end -4.65 2.86) (layer "F.CrtYd") (width 0.05) (tstamp d364a3b0-54fd-4659-8dce-a730d0a819b4))
(fp_line (start -2.615 2.615) (end -2.615 -1.615) (layer "F.Fab") (width 0.1) (tstamp 02b4b413-8363-4d1b-994e-188513d8ddc7))
(fp_line (start 2.615 -2.615) (end 2.615 2.615) (layer "F.Fab") (width 0.1) (tstamp 0de79bc8-6e35-4f27-a959-67075a5c995d))
(fp_line (start -1.615 -2.615) (end 2.615 -2.615) (layer "F.Fab") (width 0.1) (tstamp 6d79fd42-415e-413e-9d9a-317a78780624))
(fp_line (start -2.615 -1.615) (end -1.615 -2.615) (layer "F.Fab") (width 0.1) (tstamp a9e3aef9-f101-4095-bdca-1439a0a3a462))
(fp_line (start 2.615 2.615) (end -2.615 2.615) (layer "F.Fab") (width 0.1) (tstamp f6066510-5931-4b5c-bd2e-aa73c2658e09))
(pad "1" smd roundrect (at -3.6 -1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 27b69982-b2ed-4600-967a-124075f92a47))
(pad "2" smd roundrect (at -3.6 -0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 6d25bce9-3e60-4ced-b5a9-08751e8b6fc4))
(pad "3" smd roundrect (at -3.6 0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 20c0617b-b9fa-402b-acac-3d6d0fd080c9))
(pad "4" smd roundrect (at -3.6 1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f866660d-6ba6-48d1-8140-3aea9f62e041))
(pad "5" smd roundrect (at 3.6 1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 84c5eefd-df9f-4bf1-ada6-d7c8e324cafa))
(pad "6" smd roundrect (at 3.6 0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8cae02d5-3e1a-460e-ab20-8d0d15978bd7))
(pad "7" smd roundrect (at 3.6 -0.635) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp bfac6452-2417-4786-863e-60ca15ff175c))
(pad "8" smd roundrect (at 3.6 -1.905) (size 1.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp de3c0f07-7b33-4a21-a1da-0aaa6ffb3b32))
(model "${KICAD6_3DMODEL_DIR}/Package_SO.3dshapes/SOIC-8_5.275x5.275mm_P1.27mm.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
+3
View File
@@ -0,0 +1,3 @@
(fp_lib_table
(lib (name "RP2040-Decoder_Additional_Footprints")(type "KiCad")(uri "${KIPRJMOD}")(options "")(descr ""))
)
+3
View File
@@ -0,0 +1,3 @@
(sym_lib_table
(lib (name "RP2040-Decoder_Additional_Symbols")(type "KiCad")(uri "${KIPRJMOD}/RP2040-Decoder_Additional_Symbols.kicad_sym")(options "")(descr ""))
)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+705
View File
@@ -0,0 +1,705 @@
{
"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": 0.5,
"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": {
"45_degree_only": false,
"min_clearance": 0.2
}
},
"diff_pair_dimensions": [
{
"gap": 0.0,
"via_gap": 0.0,
"width": 0.0
}
],
"drc_exclusions": [],
"meta": {
"version": 2
},
"rule_severities": {
"annular_width": "error",
"clearance": "error",
"connection_width": "warning",
"copper_edge_clearance": "error",
"copper_sliver": "warning",
"courtyards_overlap": "warning",
"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": "error",
"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": "warning",
"malformed_courtyard": "error",
"microvia_drill_out_of_range": "error",
"missing_courtyard": "ignore",
"missing_footprint": "warning",
"net_conflict": "warning",
"npth_inside_courtyard": "ignore",
"padstack": "error",
"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": {
"allow_blind_buried_vias": false,
"allow_microvias": false,
"max_error": 0.005,
"min_clearance": 0.1,
"min_connection": 0.0,
"min_copper_edge_clearance": 0.2,
"min_hole_clearance": 0.19,
"min_hole_to_hole": 0.254,
"min_microvia_diameter": 0.2,
"min_microvia_drill": 0.1,
"min_resolved_spokes": 2,
"min_silk_clearance": 0.0,
"min_text_height": 0.8,
"min_text_thickness": 0.08,
"min_through_hole_diameter": 0.2,
"min_track_width": 0.1,
"min_via_annular_width": 0.05,
"min_via_diameter": 0.4,
"solder_mask_clearance": 0.0,
"solder_mask_min_width": 0.0,
"solder_mask_to_copper_clearance": 0.005,
"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": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_round_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_rect_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_on_pad_in_zone": false,
"td_target_name": "td_track_end",
"td_width_to_size_filter_ratio": 0.9
}
],
"track_widths": [
0.0,
0.127,
0.2,
0.25,
0.4,
0.5,
0.6,
0.75,
0.8
],
"tuning_pattern_settings": {
"diff_pair_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 1.0
},
"diff_pair_skew_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
},
"single_track_defaults": {
"corner_radius_percentage": 80,
"corner_style": 1,
"max_amplitude": 1.0,
"min_amplitude": 0.2,
"single_sided": false,
"spacing": 0.6
}
},
"via_dimensions": [
{
"diameter": 0.0,
"drill": 0.0
},
{
"diameter": 0.4,
"drill": 0.3
},
{
"diameter": 0.45,
"drill": 0.3
},
{
"diameter": 0.6,
"drill": 0.3
},
{
"diameter": 0.75,
"drill": 0.375
},
{
"diameter": 0.8,
"drill": 0.4
}
],
"zones_allow_external_fillets": false,
"zones_use_no_outline": true
},
"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_label_syntax": "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": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"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": "RP2040-Decoder.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": {
"+3V3": "rgb(255, 8, 12)",
"GND": "rgb(250, 0, 255)"
},
"netclass_assignments": null,
"netclass_patterns": []
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"plot": "output/",
"pos_files": "output/",
"specctra_dsn": "",
"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
},
{
"group_by": false,
"label": "#",
"name": "${ITEM_NUMBER}",
"show": false
},
{
"group_by": false,
"label": "Comment",
"name": "Comment",
"show": false
},
{
"group_by": false,
"label": "Frequency",
"name": "Frequency",
"show": false
},
{
"group_by": false,
"label": "Tolerance",
"name": "Tolerance",
"show": false
},
{
"group_by": false,
"label": "Voltage",
"name": "Voltage",
"show": false
},
{
"group_by": false,
"label": "Description",
"name": "Description",
"show": false
},
{
"group_by": false,
"label": "GPIO_PIN",
"name": "GPIO_PIN",
"show": false
},
{
"group_by": false,
"label": "Alternative Part",
"name": "Alternative Part",
"show": true
},
{
"group_by": false,
"label": "LCSC Part #",
"name": "LCSC Part #",
"show": true
},
{
"group_by": false,
"label": "FT Rotation Offset",
"name": "FT Rotation Offset",
"show": true
}
],
"filter_string": "",
"group_symbols": true,
"name": "",
"sort_asc": true,
"sort_field": "Reference"
},
"connection_grid_size": 50.0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.25,
"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": 0.0,
"text_offset_ratio": 0.08
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "/home/gab/Documents/",
"spice_adjust_passive_values": false,
"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": [
[
"11d18738-0f49-4d63-b61c-22a93efd5959",
"Root"
]
],
"text_variables": {}
}
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,363 @@
(footprint "SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias"
(version 20240108)
(generator "pcbnew")
(generator_version "8.0")
(layer "F.Cu")
(descr "SOIC, 8 Pin (http://www.allegromicro.com/~/media/Files/Datasheets/A4950-Datasheet.ashx#page=8), generated with kicad-footprint-generator ipc_gullwing_generator.py")
(tags "SOIC SO")
(property "Reference" "REF**"
(at -0.2 -4.3 0)
(layer "F.SilkS")
(uuid "0d0f734b-55d5-4594-866a-ce6819cf8228")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(property "Value" "SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias"
(at 0 3.4 0)
(layer "F.Fab")
(uuid "22956637-17bd-4c2e-acb6-b78772616ce1")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "eab511bc-cc50-48a3-8b5e-cf001a34725a")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(property "Datasheet" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "e79328cd-44bc-4aab-96c5-6030b6195730")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(property "Description" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "e794e907-2974-4aa5-b0e8-8009bf377504")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(attr smd)
(fp_line
(start -1.55 -2.56)
(end -3.4 -2.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "5e1b6593-5e9b-46a9-b77d-e8857a7019a7")
)
(fp_line
(start -1.55 2.56)
(end -3.4 2.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "d2f4f71b-dad4-477c-9332-cfa0b1762c3c")
)
(fp_line
(start 1.55 -2.56)
(end 3.4 -2.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "d8ebe137-f5d5-4c2e-b1be-05e2e860bfc2")
)
(fp_line
(start 1.55 2.56)
(end 3.4 2.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "4215d5a7-1062-44a9-96e2-c894457eb6a9")
)
(fp_line
(start -3.7 -2.7)
(end -3.7 2.7)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "3b0dc4e4-bdc2-4b50-aa3f-9e14820b2751")
)
(fp_line
(start -3.7 2.7)
(end 3.7 2.7)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "839afce9-2060-4cb0-b78e-caadc6bdbef9")
)
(fp_line
(start 3.7 -2.7)
(end -3.7 -2.7)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "e48a8fea-d898-4d03-99fa-28f365900862")
)
(fp_line
(start 3.7 2.7)
(end 3.7 -2.7)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "03434c57-aec9-4997-bdac-bd6bc0877cdd")
)
(fp_line
(start -1.95 -1.475)
(end -0.975 -2.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "27208f4d-f461-4f50-a941-8886d9234066")
)
(fp_line
(start -1.95 2.45)
(end -1.95 -1.475)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "7b8850b8-629b-406b-a955-153bdfac67a7")
)
(fp_line
(start -0.975 -2.45)
(end 1.95 -2.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "2c3326d8-8f3d-40cb-a7dd-fa99c40b6598")
)
(fp_line
(start 1.95 -2.45)
(end 1.95 2.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "5c93c3a4-8b42-477a-892d-3a4116ce4a83")
)
(fp_line
(start 1.95 2.45)
(end -1.95 2.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "d594cbf2-5861-4bce-8ea6-54b69faa1bde")
)
(fp_text user "${REFERENCE}"
(at 0 0 0)
(layer "F.Fab")
(uuid "114d50fb-c631-48ec-b90f-efb4be58d6c8")
(effects
(font
(size 0.98 0.98)
(thickness 0.15)
)
)
)
(pad "" smd roundrect
(at -0.6 -0.825)
(size 1.01 1.38)
(layers "F.Paste")
(roundrect_rratio 0.247525)
(uuid "0eda8a60-9156-494c-b248-9f23876b9c97")
)
(pad "" smd roundrect
(at -0.6 0.825)
(size 1.01 1.38)
(layers "F.Paste")
(roundrect_rratio 0.247525)
(uuid "02654062-e307-48a2-a672-ab6985eb502c")
)
(pad "" smd roundrect
(at 0.6 -0.825)
(size 1.01 1.38)
(layers "F.Paste")
(roundrect_rratio 0.247525)
(uuid "2ff99c2d-e844-44d0-bfc9-4f54f1b985ca")
)
(pad "" smd roundrect
(at 0.6 0.825)
(size 1.01 1.38)
(layers "F.Paste")
(roundrect_rratio 0.247525)
(uuid "275e7eda-80dc-4dae-8d5a-d69839ef7060")
)
(pad "1" smd roundrect
(at -2.475 -1.905)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "8dcf9965-4b38-4f4e-969f-578bcad555e9")
)
(pad "2" smd roundrect
(at -2.475 -0.635)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "425dcc81-ccb1-492a-ac99-b0bf1be89e2d")
)
(pad "3" smd roundrect
(at -2.475 0.635)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "56d4d9c4-0452-47df-88a8-5979c8feb2db")
)
(pad "4" smd roundrect
(at -2.475 1.905)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "53106e3f-8345-4981-a96d-68820362ebea")
)
(pad "5" smd roundrect
(at 2.475 1.905)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "ef1eddff-7709-4257-916a-36fa2baed22e")
)
(pad "6" smd roundrect
(at 2.475 0.635)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "b401095e-aca0-4b4a-8e85-319099d7598c")
)
(pad "7" smd roundrect
(at 2.475 -0.635)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "4ab1bb28-4236-42fc-aa5d-09e01f4abe45")
)
(pad "8" smd roundrect
(at 2.475 -1.905)
(size 1.95 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "61ad49d1-2f42-4f33-afdd-01be938e7e56")
)
(pad "9" thru_hole circle
(at -0.7 -1.2)
(size 0.5 0.5)
(drill 0.2)
(layers "*.Cu")
(remove_unused_layers no)
(uuid "e44650f7-3103-408b-ac51-7088faf35d1a")
)
(pad "9" thru_hole circle
(at -0.7 0)
(size 0.5 0.5)
(drill 0.2)
(layers "*.Cu")
(remove_unused_layers no)
(uuid "d63c1844-7ca4-4d96-92d7-088888b2e2e0")
)
(pad "9" thru_hole circle
(at -0.7 1.2)
(size 0.5 0.5)
(drill 0.2)
(layers "*.Cu")
(remove_unused_layers no)
(uuid "dac580e0-d592-40c4-a6a3-32f4156ddde6")
)
(pad "9" smd rect
(at 0 0)
(size 1.9 2.9)
(layers "B.Cu")
(uuid "a267eaa8-2c1c-4f35-9bdd-c1551668d64b")
)
(pad "9" smd rect
(at 0 0)
(size 2.41 3.3)
(layers "F.Cu" "F.Mask")
(uuid "492dc4b9-8891-40fa-9726-31f4ba6ae3a0")
)
(pad "9" thru_hole circle
(at 0.7 -1.2)
(size 0.5 0.5)
(drill 0.2)
(layers "*.Cu")
(remove_unused_layers no)
(uuid "1327a571-9408-4f2e-b3bb-b550b6d3a0be")
)
(pad "9" thru_hole circle
(at 0.7 0)
(size 0.5 0.5)
(drill 0.2)
(layers "*.Cu")
(remove_unused_layers no)
(uuid "38ad4bee-e334-45b6-98b3-91580c43f314")
)
(pad "9" thru_hole circle
(at 0.7 1.2)
(size 0.5 0.5)
(drill 0.2)
(layers "*.Cu")
(remove_unused_layers no)
(uuid "c6fc29d8-1848-4d54-9ceb-e114b4dd89d9")
)
(model "${KICAD8_3DMODEL_DIR}/Package_SO.3dshapes/SOIC-8_3.9x4.9mm_P1.27mm.wrl"
(offset
(xyz 0 0 0)
)
(scale
(xyz 1 1 1)
)
(rotate
(xyz 0 0 0)
)
)
)
@@ -0,0 +1,325 @@
(footprint "SOIC-8_5.23x5.23mm_P1.27mm"
(version 20240108)
(generator "pcbnew")
(generator_version "8.0")
(layer "F.Cu")
(descr "SOIC, 8 Pin (http://www.winbond.com/resource-files/w25q32jv%20revg%2003272018%20plus.pdf#page=68), generated with kicad-footprint-generator ipc_gullwing_generator.py")
(tags "SOIC SO")
(property "Reference" "REF**"
(at 0 -3.56 0)
(layer "F.SilkS")
(uuid "892c99ea-5410-4a65-9ee4-bdc09fdc90ee")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(property "Value" "SOIC-8_5.23x5.23mm_P1.27mm"
(at 0 3.56 0)
(layer "F.Fab")
(uuid "c04ec0d1-7f0d-4019-91be-a6614badf406")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "923f8285-757f-444c-b89a-cc7fe1233c67")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(property "Datasheet" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "a0de60f8-d40b-48e6-89a5-4fe2362b0757")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(property "Description" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "da4bc971-83cf-41f4-9d7f-5dab7b7dde0f")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(attr smd)
(fp_line
(start -2.725 -2.725)
(end -2.725 -2.465)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "1faa07e6-bd78-437e-b4e2-cd00c2b8018d")
)
(fp_line
(start -2.725 -2.465)
(end -4.4 -2.465)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "0ad895a6-0c83-484a-8b80-3635647eb60a")
)
(fp_line
(start -2.725 2.725)
(end -2.725 2.465)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "00138a61-23f0-45f3-9f28-2bbd8494a1fc")
)
(fp_line
(start 0 -2.725)
(end -2.725 -2.725)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "0ef6c909-3192-40ee-a6d7-49ae09a79a2d")
)
(fp_line
(start 0 -2.725)
(end 2.725 -2.725)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "e0b94375-2281-4987-b4d4-78e8e535972c")
)
(fp_line
(start 0 2.725)
(end -2.725 2.725)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "7563e6d6-e180-4d92-9939-ff14aba164c5")
)
(fp_line
(start 0 2.725)
(end 2.725 2.725)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "599161f8-efef-47ec-8f3f-69142e759f9f")
)
(fp_line
(start 2.725 -2.725)
(end 2.725 -2.465)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "bd45a508-6e93-4f9b-948f-0868d234cca2")
)
(fp_line
(start 2.725 2.725)
(end 2.725 2.465)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "3a26b0fd-8ddd-4bb6-8f59-5d8caaf547d2")
)
(fp_line
(start -4.65 -2.86)
(end -4.65 2.86)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "d364a3b0-54fd-4659-8dce-a730d0a819b4")
)
(fp_line
(start -4.65 2.86)
(end 4.65 2.86)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "48c8ef75-8bc0-4249-b6fc-f564812177b5")
)
(fp_line
(start 4.65 -2.86)
(end -4.65 -2.86)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "15719beb-6925-433d-810a-8c40136a730d")
)
(fp_line
(start 4.65 2.86)
(end 4.65 -2.86)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "343b8478-4e57-4c34-a00f-f6c76028fbb0")
)
(fp_line
(start -2.615 -1.615)
(end -1.615 -2.615)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "a9e3aef9-f101-4095-bdca-1439a0a3a462")
)
(fp_line
(start -2.615 2.615)
(end -2.615 -1.615)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "02b4b413-8363-4d1b-994e-188513d8ddc7")
)
(fp_line
(start -1.615 -2.615)
(end 2.615 -2.615)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "6d79fd42-415e-413e-9d9a-317a78780624")
)
(fp_line
(start 2.615 -2.615)
(end 2.615 2.615)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "0de79bc8-6e35-4f27-a959-67075a5c995d")
)
(fp_line
(start 2.615 2.615)
(end -2.615 2.615)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "f6066510-5931-4b5c-bd2e-aa73c2658e09")
)
(fp_text user "${REFERENCE}"
(at 0 0 0)
(layer "F.Fab")
(uuid "77985a68-90d4-4d27-872a-c400b51090e9")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(pad "1" smd roundrect
(at -3.6 -1.905)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "27b69982-b2ed-4600-967a-124075f92a47")
)
(pad "2" smd roundrect
(at -3.6 -0.635)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "6d25bce9-3e60-4ced-b5a9-08751e8b6fc4")
)
(pad "3" smd roundrect
(at -3.6 0.635)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "20c0617b-b9fa-402b-acac-3d6d0fd080c9")
)
(pad "4" smd roundrect
(at -3.6 1.905)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "f866660d-6ba6-48d1-8140-3aea9f62e041")
)
(pad "5" smd roundrect
(at 3.6 1.905)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "84c5eefd-df9f-4bf1-ada6-d7c8e324cafa")
)
(pad "6" smd roundrect
(at 3.6 0.635)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "8cae02d5-3e1a-460e-ab20-8d0d15978bd7")
)
(pad "7" smd roundrect
(at 3.6 -0.635)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "bfac6452-2417-4786-863e-60ca15ff175c")
)
(pad "8" smd roundrect
(at 3.6 -1.905)
(size 1.6 0.6)
(layers "F.Cu" "F.Paste" "F.Mask")
(roundrect_rratio 0.25)
(uuid "de3c0f07-7b33-4a21-a1da-0aaa6ffb3b32")
)
(model "${KICAD8_3DMODEL_DIR}/Package_SO.3dshapes/SOIC-8_5.275x5.275mm_P1.27mm.wrl"
(offset
(xyz 0 0 0)
)
(scale
(xyz 1 1 1)
)
(rotate
(xyz 0 0 0)
)
)
)
@@ -0,0 +1,318 @@
(footprint "SW_Push_1P1T_NO_Vertical_Wuerth_434133025816"
(version 20240108)
(generator "pcbnew")
(generator_version "8.0")
(layer "F.Cu")
(descr "https://katalog.we-online.com/em/datasheet/434133025816.pdf")
(tags "tactile switch Wurth Wuerth")
(property "Reference" "REF**"
(at 0.15 -2.6 0)
(layer "F.SilkS")
(uuid "a9f4af6c-1a4d-4c2a-921d-287f9a6460cc")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(property "Value" "SW_Push_1P1T_NO_Vertical_Wuerth_434133025816"
(at 0 2.55 0)
(layer "F.Fab")
(uuid "bead97d6-e2d9-43ba-b967-78fdffae901d")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(property "Footprint" ""
(at 0 0 0)
(unlocked yes)
(layer "F.Fab")
(hide yes)
(uuid "d8494eb8-283a-4665-be40-c5bc370c0fe3")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(property "Datasheet" ""
(at 0 0 0)
(unlocked yes)
(layer "F.Fab")
(hide yes)
(uuid "4cfc36c1-5358-449f-bda2-6d0d839548a3")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(property "Description" ""
(at 0 0 0)
(unlocked yes)
(layer "F.Fab")
(hide yes)
(uuid "c37b62f2-dbc1-4d71-9e15-e319984b877d")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(attr smd)
(fp_line
(start -2.2 0.05)
(end -2.2 -0.05)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "ceb53bab-ddc7-4ff9-b2de-e83d8572f116")
)
(fp_line
(start -2.2 1.75)
(end 2.2 1.75)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "12c526c3-32a4-470b-93bb-dbf407333418")
)
(fp_line
(start 2.2 -1.75)
(end -2.2 -1.75)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "7dd9260b-55dd-42a6-90ec-094dcfaff6b2")
)
(fp_line
(start 2.2 0.05)
(end 2.2 -0.05)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "da0e3716-2c9e-4ac5-b2c3-d6a1a5098034")
)
(fp_line
(start -2.85 -1.85)
(end 2.85 -1.85)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "a0fd66f8-9e74-45e4-a67a-1218e3422a82")
)
(fp_line
(start -2.85 1.85)
(end -2.85 -1.85)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "fe2c281c-c2c3-4958-9d44-5cad75d0b194")
)
(fp_line
(start 2.85 -1.85)
(end 2.85 1.85)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "c70dcf49-d773-4e5f-a235-6b0699407a03")
)
(fp_line
(start 2.85 1.85)
(end -2.85 1.85)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "cab4cd64-574a-4a52-932e-d254f66e002b")
)
(fp_line
(start -2.1 -1.6)
(end 2.1 -1.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "5bae3724-7d31-49dc-84c5-aa6f63fc9c26")
)
(fp_line
(start -2.1 -1.1)
(end -1.6 -1.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "3a178eda-7cc8-40cf-8c89-7cb4dc8a7a0a")
)
(fp_line
(start -2.1 1.1)
(end -1.6 1.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "50203e2b-6fd4-4cea-87d2-703f09c0e45a")
)
(fp_line
(start -2.1 1.6)
(end -2.1 -1.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "f575139d-3730-409a-93b8-0ed720da29e8")
)
(fp_line
(start -0.9 -1.1)
(end 0.8 -1.1)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "f02dddc1-1070-4d43-b76b-5d313c254800")
)
(fp_line
(start 0.8 1.1)
(end -0.9 1.1)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "74306571-f6d4-4374-a16b-77c5c2982723")
)
(fp_line
(start 1.6 -1.6)
(end 2.1 -1.1)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "c6ea45e9-1b0b-4390-9f54-e519b3eb83e1")
)
(fp_line
(start 1.6 1.6)
(end 2.1 1.1)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "a743549d-ee13-4212-9744-42ed8529ed3a")
)
(fp_line
(start 2.1 -1.6)
(end 2.1 1.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "8803e8b9-0976-49b1-bd25-78f6f796f285")
)
(fp_line
(start 2.1 1.6)
(end -2.1 1.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "25af75f2-944c-4139-a67f-1b5e9791fa6c")
)
(fp_arc
(start -0.9 1.099999)
(mid -1.460147 0)
(end -0.9 -1.099999)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "abfb9586-4ac0-4ba1-a499-bd184116803d")
)
(fp_arc
(start 0.8 -1.099999)
(mid 1.40384 0)
(end 0.799999 1.099999)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "b77730ba-7e92-4243-9e30-d378944aba33")
)
(fp_text user "${REFERENCE}"
(at 0.05 0 0)
(layer "F.Fab")
(uuid "682222be-9c4e-4642-ab4b-85af8d4f11f3")
(effects
(font
(size 1 1)
(thickness 0.15)
)
)
)
(pad "1" smd rect
(at -2.075 -1.075)
(size 1.05 0.65)
(layers "F.Cu" "F.Paste" "F.Mask")
(uuid "cbe7fb4a-7a24-4701-91b1-bb5498e198db")
)
(pad "1" smd rect
(at 2.075 -1.075)
(size 1.05 0.65)
(layers "F.Cu" "F.Paste" "F.Mask")
(uuid "f83bd855-34b5-443b-83cd-22c5a803e55d")
)
(pad "2" smd rect
(at -2.075 1.075)
(size 1.05 0.65)
(layers "F.Cu" "F.Paste" "F.Mask")
(uuid "65e74ebe-b92b-42ae-8e79-6e76f3539250")
)
(pad "2" smd rect
(at 2.05 1.075)
(size 1.05 0.65)
(layers "F.Cu" "F.Paste" "F.Mask")
(uuid "cc3e09e2-232b-4826-aa79-e19bc91e38da")
)
(model "${KIPRJMOD}/434133025816.stp"
(offset
(xyz 0 0 0)
)
(scale
(xyz 1 1 1)
)
(rotate
(xyz -90 0 -90)
)
)
)
+3
View File
@@ -0,0 +1,3 @@
(fp_lib_table
(lib (name "RP2040-Decoder_Additional_Footprints")(type "KiCad")(uri "${KIPRJMOD}")(options "")(descr ""))
)
+3
View File
@@ -0,0 +1,3 @@
(sym_lib_table
(lib (name "RP2040-Decoder_Additional_Symbols")(type "KiCad")(uri "${KIPRJMOD}/RP2040-Decoder_Additional_Symbols.kicad_sym")(options "")(descr ""))
)
+227
View File
@@ -0,0 +1,227 @@
Software License:
MIT License
Copyright (c) 2021 Gabriel Koppenstein
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
Hardware License:
CERN Open Hardware Licence Version 2 - Permissive
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: this licence, CERN-OHL-P
(permissive); and two reciprocal licences: CERN-OHL-W (weakly
reciprocal) and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-P is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-P.
1.2 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.3 'Covered Source' means Source that is explicitly made available
under this Licence.
1.4 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.5 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.6 'Notice' means copyright, acknowledgement and trademark notices,
references to the location of any Notices, modification notices
(subsection 3.3(b)) and all notices that refer to this Licence
and to the disclaimer of warranties that are included in the
Covered Source.
1.7 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.8 'Licensor' means a person who creates Source or modifies Covered
Source and subsequently Conveys the resulting Covered Source
under the terms and conditions of this Licence. A person may be
a Licensee and a Licensor at the same time.
1.9 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2; and
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it.
3.4 You may Convey Covered Source or modified Covered Source under
licence terms which differ from the terms of this Licence
provided that You:
a) comply at all times with subsection 3.3; and
b) provide a copy of this Licence to anyone to whom You
Convey Covered Source or modified Covered Source.
4 Making and Conveying Products
You may Make Products, and/or Convey them, provided that You ensure
that the recipient of the Product has access to any Notices applicable
to the Product.
5 DISCLAIMER AND LIABILITY
5.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
5.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
6 Patents
6.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in this section 6, or where terminated by the Licensor
for cause) patent licence to Make, have Made, use, offer to
sell, sell, import, and otherwise transfer the Covered Source
and Products, where such licence applies only to those patent
claims licensable by such Licensor that are necessarily
infringed by exercising rights under the Covered Source as
Conveyed by that Licensor.
6.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
7 General
7.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
7.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
7.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
7.4 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.
+45
View File
@@ -0,0 +1,45 @@
RP2040-Decoder
===============
This Project is a DIY DCC Decoder for model railroad locomotives which aims to be cost effective.
Features
--------
- DCC digital signal decoding
- Motor load/speed control
- 4 Outputs switched by transistors with configurable optional PWM
- 6 additional GPIO for lighter loads or custom applications
- Programmable on programming track
- CV Function Mapping
- Board size of 25x20 mm
- Pre-compiled software available and flashable via USB using your regular file explorer
- Debugging via Serial Wire Debug or optional logging via stdio and UART/USB serial port
Getting Started
------------
The ["Getting Started"](https://github.com/gab-k/RP2040-Decoder/wiki/Getting-started) page provides an overview of the steps required to use the decoder as well as brief instructions for all the necessary steps.
License
-------
- Software - MIT license
- Hardware - CERN Open Hardware Licence Version 2 - Permissive
- [LICENSE](https://github.com/gab-k/RP2040-Decoder/blob/main/LICENSE)
------------
Further details about the project can be found here: [RP2040-Decoder Wiki](https://github.com/gab-k/RP2040-Decoder/wiki)
Note: The decoder is still in early development, there might (will) be bugs as its not tested that much yet.
So suggestions on how to improve things and bug reports are always much appreciated.
The wiki is also work in progress and will be updated to be as comprehensive as possible.
------------
<div style="display: flex; justify-content: space-between; align-items: center;">
<img src="https://raw.githubusercontent.com/gab-k/RP2040-Decoder/refs/heads/gh-pages-dev/img/top.png" alt="Image 1" style="width: 50%;"/>
<img src="https://raw.githubusercontent.com/gab-k/RP2040-Decoder/refs/heads/gh-pages-dev/img/bottom.png" alt="Image 2" style="width: 50%;"/>
</div>
+1
View File
@@ -0,0 +1 @@
build
+141
View File
@@ -0,0 +1,141 @@
# Generated Cmake Pico project file
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Initialise pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
if(WIN32)
set(USERHOME $ENV{USERPROFILE})
else()
set(USERHOME $ENV{HOME})
endif()
set(sdkVersion 2.1.0)
set(toolchainVersion 13_3_Rel1)
set(picotoolVersion 2.1.0)
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
if (EXISTS ${picoVscode})
include(${picoVscode})
endif()
# ====================================================================================
set(PICO_BOARD_HEADER_DIRS ${CMAKE_SOURCE_DIR})
# Board type selection:
#
# Please select RP2040-Decoder-board-Rev-1_0 for Rev >= 1.0 or RP2040-Decoder-board-Rev-0_3 for Rev <= 0.3
# running cmake with -DPICO_BOARD=RP2040-Decoder-board-Rev-X_Y explicitly from command line overrides this setting
set(PICO_BOARD RP2040-Decoder-board-Rev-1_0 CACHE STRING "Board type")
# Pull in Raspberry Pi Pico SDK (must be before project)
include(pico_sdk_import.cmake)
project(RP2040-Decoder C CXX ASM)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()
# Manual compiler options, these generally override configuration set by CMAKE_BUILD_TYPE
add_compile_options(-Wall
# -O0 # Overrides optimization flags specified by CMAKE_BUILD_TYPE
# -g3 # Overrides debug flags specified by CMAKE_BUILD_TYPE
-Wno-format # unsigned int = uint32_t using gcc so don't warn about format
-Wno-unused-function # Some defined functions used for debugging are never called or not used when logging is disabled
)
# Add executable
add_executable( RP2040-Decoder
core0.c
core0.h
core1.c
core1.h
shared.c
shared.h )
pico_set_program_name(RP2040-Decoder "RP2040-Decoder")
# Build type
message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message("PICO_DEOPTIMIZED_DEBUG: ${PICO_DEOPTIMIZED_DEBUG}")
if(NOT CMAKE_BUILD_TYPE)
message(WARNING "CMAKE_BUILD_TYPE is not set. Defaulting to 'Release'")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif()
# Logging configuration:
#
# LOGLEVEL>0 enables logging messages via stdio, this can be done either via USB or alternatively,
# directly with the UART TX/RX pins (see pin definition in RP2040-Decoder-board.h).
#
# In order to use stdio via USB please set STDIO_USB_ENABLED to 1 below
# In order to use stdio via UART TX/RX pins please set STDIO_UART_ENABLED to 1 below
#
# Additional Notes:
# - When logging is disabled (LOGLEVEL 0), all logging functions will be completely excluded during compilation.
# - Be cautious: Logging can alter timing behavior. For example, the PID controller is time critical,
# limit the frequency of log outputs—such as logging only every 100th iteration.
# - Note that with UART logging enabled, PICO_DEFAULT_UART_TX_PIN and PICO_DEFAULT_UART_RX_PIN are disabled for decoder functions.
# These pins are used for UART communication. Disabling is done automatically in RP2040-Decoder-board.h or RP2040-Decoder-board-legacy.h respectively.
set(LOGLEVEL 0)
# Additionally, the LOG_WAIT parameter can be configured to make the controller wait for user input via stdio before continuing.
# This is useful for ensuring that all stdio logging outputs are captured.
# If disabled, there may not be enough time to connect the serial terminal before most of the logging has already been completed.
set(LOG_WAIT 0)
# Modify the below lines to enable/disable output over UART and/or USB
set(STDIO_USB_ENABLED 0)
set(STDIO_UART_ENABLED 0)
# Leave those two unmodified
pico_enable_stdio_uart(RP2040-Decoder ${STDIO_UART_ENABLED})
pico_enable_stdio_usb(RP2040-Decoder ${STDIO_USB_ENABLED})
# Add a preprocessor definition which defines whether UART is used or not.
# This is done to make the C-Code know whether pins used for UART need to be reserved and restricted from setting them as PWM/GPIO.
target_compile_definitions( RP2040-Decoder PRIVATE
LOGLEVEL=${LOGLEVEL}
LOG_WAIT=${LOG_WAIT}
STDIO_UART_ENABLED=${STDIO_UART_ENABLED}
STDIO_USB_ENABLED=${STDIO_USB_ENABLED}
)
# Warn when logging is enabled (LOGLEVEL>0) and neither stdio is enabled
if (LOGLEVEL GREATER 0 AND (STDIO_USB_ENABLED EQUAL 0 AND STDIO_UART_ENABLED EQUAL 0))
message(WARNING "\nWARNING: Logging (LOGLEVEL>0) enabled with both STDIO_USB_ENABLED and STDIO_UART_ENABLED disabled!")
endif()
if (LOGLEVEL EQUAL 0 AND LOG_WAIT EQUAL 1)
message(WARNING "\nWARNING: LOG_WAIT enabled with Logging disabled (LOGLEVEL==0)!")
endif()
# Add the standard library to the build
target_link_libraries( RP2040-Decoder
pico_stdlib
pico_multicore
pico_flash
hardware_pwm
hardware_adc
hardware_flash
hardware_watchdog
hardware_exception )
# Add the standard include files to the build
target_include_directories(RP2040-Decoder PRIVATE ${CMAKE_CURRENT_LIST_DIR})
# create map/bin/hex file etc.
pico_add_extra_outputs(RP2040-Decoder)
# Program size check
#
# Check for program size exceeding limits as CVs are stored at the end of flash, the program could theoretically overwrite this.
# In practice the program size is usually does not exceed about 100KiB, the actual size is printed by CMake from arm-none-eabi-size.
# Extract the directory of the C compiler and construct the path to the 'arm-none-eabi-size' tool
get_filename_component(C_COMPILER_DIR ${CMAKE_C_COMPILER} DIRECTORY)
set(SIZE_TOOL ${C_COMPILER_DIR}/arm-none-eabi-size)
set(BOARD_HEADER "${CMAKE_SOURCE_DIR}/${PICO_BOARD}.h")
set(ELF_FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.elf")
add_custom_command(TARGET RP2040-Decoder POST_BUILD
COMMAND ${CMAKE_COMMAND}
-D BOARD_HEADER=${BOARD_HEADER}
-D SIZE_TOOL=${SIZE_TOOL}
-D ELF_FILE=${ELF_FILE}
-P ${CMAKE_SOURCE_DIR}/post_build.cmake
)
+1135
View File
File diff suppressed because it is too large. Load diff
+91
View File
@@ -0,0 +1,91 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// Modified version of "boards/pico.h" for using the RP2040-Decoder board
// NOTE: THIS IS FOR THE "LEGACY" Version without a USB-C Connector
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_RP2040_DECODER_H
#define _BOARDS_RP2040_DECODER_H
// For board detection
#define RP2040_DECODER
// In case the xosc takes longer to stabilize than usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
// --- FLASH ---
// Flash size is 8 MiB for W25Q64JVSSIQ if you decide to use another capacity flash IC change the size to the corresponding value
// 8MiB = (8 * 1024 * 1024) bytes = 8388608 bytes
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES 8388608
#endif
// Offset from base address used for saving CV_ARRAY_FLASH - in this case one sector size from the end of flash
#define FLASH_TARGET_OFFSET (PICO_FLASH_SIZE_BYTES-FLASH_SECTOR_SIZE)
// For some reason the clock divider of 4 is necessary, otherwise the controller occasionally hard faults
// Another workaround could be to run code from RAM but this seems to work fine
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 4
#endif
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 1
#endif
// Other pins
// GPIO used for DCC-Signal, Motor PWM or ADC
#define DCC_INPUT_PIN 21u
#define MOTOR_FWD_PIN 23u
#define MOTOR_REV_PIN 22u
#define FWD_V_EMF_ADC_PIN 28u
#define REV_V_EMF_ADC_PIN 29u
#define FWD_V_EMF_ADC_CHANNEL (FWD_V_EMF_ADC_PIN-26u)
#define REV_V_EMF_ADC_CHANNEL (REV_V_EMF_ADC_PIN-26u)
#if LOGLEVEL != 0
// GPIO used directly (GPIO 2-5 incl.) as outputs or to switch auxiliary output transistors (GPIO 24-27 incl.)
#define GPIO_OUTPUT_PIN_MASK ((1u<<24) | (1u<<25) | (1u<<26) | (1u<<27) | (1u<<5) | (1u<<4) | (1u<<3) | (1u<<2))
#else
// GPIO used directly (GPIO 0-5 incl.) as outputs or to switch auxiliary output transistors (GPIO 24-27 incl.)
#define GPIO_OUTPUT_PIN_MASK ((1u<<24) | (1u<<25) | (1u<<26) | (1u<<27) | (1u<<5) | (1u<<4) | (1u<<3) | (1u<<2) | (1u<<1) | (1u<<0))
#endif
// GPIO pin mask to prevent setting illegal GPIOs (ADC, Motor, DCC Input Pin)
// When logging to stdio using UART is enabled do NOT use PICO_DEFAULT_UART_TX_PIN and PICO_DEFAULT_UART_RX_PIN as GPIO/PWM outputs
#if (LOGLEVEL != 0) && (STDIO_UART_ENABLED != 0)
#define GPIO_ILLEGAL_MASK ((1u<<DCC_INPUT_PIN) | (1u<<MOTOR_FWD_PIN) | (1u<<MOTOR_REV_PIN) | (1u<<FWD_V_EMF_ADC_PIN) | (1u<<REV_V_EMF_ADC_PIN) | (1u<<PICO_DEFAULT_UART_TX_PIN) | (1u<<PICO_DEFAULT_UART_RX_PIN))
#else
#define GPIO_ILLEGAL_MASK ((1u<<DCC_INPUT_PIN) | (1u<<MOTOR_FWD_PIN) | (1u<<MOTOR_REV_PIN) | (1u<<FWD_V_EMF_ADC_PIN) | (1u<<REV_V_EMF_ADC_PIN))
#endif
// GPIO pin mask with allowed outputs (AUX & GPIO (configured as outputs))
#define GPIO_ALLOWED_OUTPUTS (GPIO_OUTPUT_PIN_MASK) & ~(GPIO_ILLEGAL_MASK)
#endif
+96
View File
@@ -0,0 +1,96 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// Modified version of "boards/pico.h" for using the RP2040-Decoder board
// pico_cmake_set PICO_PLATFORM=rp2040
#ifndef _BOARDS_RP2040_DECODER_H
#define _BOARDS_RP2040_DECODER_H
// For board detection
#define RP2040_DECODER
// In case the xosc takes longer to stabilize than usual
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif
// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
// --- LED ---
#ifndef RP2040_DECODER_DEFAULT_LED_PIN
#define RP2040_DECODER_DEFAULT_LED_PIN 12
#endif
// --- FLASH ---
// Flash size is 8 MiB for W25Q64JVSSIQ if you decide to use another capacity flash IC change the size to the corresponding value
// 8MiB = (8 * 1024 * 1024) bytes = 8388608 bytes
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES 8388608
#endif
// Offset from base address used for saving CV_ARRAY_FLASH - in this case one sector size from the end of flash
#define FLASH_TARGET_OFFSET (PICO_FLASH_SIZE_BYTES-FLASH_SECTOR_SIZE)
// For some reason the clock divider of 4 is necessary, otherwise the controller occasionally hard faults
// Another workaround could be to run code from RAM but this seems to work fine
#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 4
#endif
#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 1
#endif
// Other pins
// GPIO used for DCC-Signal, Motor PWM or ADC
#define DCC_INPUT_PIN 21u
#define MOTOR_FWD_PIN 23u
#define MOTOR_REV_PIN 22u
#define FWD_V_EMF_ADC_PIN 29u
#define REV_V_EMF_ADC_PIN 28u
#define FWD_V_EMF_ADC_CHANNEL (FWD_V_EMF_ADC_PIN-26u)
#define REV_V_EMF_ADC_CHANNEL (REV_V_EMF_ADC_PIN-26u)
#if LOGLEVEL != 0
// GPIO used directly (GPIO 2-5 incl.) as outputs or to switch auxiliary output transistors (GPIO 24-27 incl.)
#define GPIO_OUTPUT_PIN_MASK ((1u<<24) | (1u<<25) | (1u<<26) | (1u<<27) | (1u<<5) | (1u<<4) | (1u<<3) | (1u<<2))
#else
// GPIO used directly (GPIO 0-5 incl.) as outputs or to switch auxiliary output transistors (GPIO 24-27 incl.)
#define GPIO_OUTPUT_PIN_MASK ((1u<<24) | (1u<<25) | (1u<<26) | (1u<<27) | (1u<<5) | (1u<<4) | (1u<<3) | (1u<<2) | (1u<<1) | (1u<<0))
#endif
// GPIO pin mask to prevent setting illegal GPIOs (ADC, Motor, DCC Input Pin)
// When logging to stdio using UART is enabled do NOT use PICO_DEFAULT_UART_TX_PIN and PICO_DEFAULT_UART_RX_PIN as GPIO/PWM outputs
#if (LOGLEVEL != 0) && (STDIO_UART_ENABLED != 0)
#define GPIO_ILLEGAL_MASK ((1u<<DCC_INPUT_PIN) | (1u<<MOTOR_FWD_PIN) | (1u<<MOTOR_REV_PIN) | (1u<<FWD_V_EMF_ADC_PIN) | (1u<<REV_V_EMF_ADC_PIN) | (1u<<PICO_DEFAULT_UART_TX_PIN) | (1u<<PICO_DEFAULT_UART_RX_PIN))
#else
#define GPIO_ILLEGAL_MASK ((1u<<DCC_INPUT_PIN) | (1u<<MOTOR_FWD_PIN) | (1u<<MOTOR_REV_PIN) | (1u<<FWD_V_EMF_ADC_PIN) | (1u<<REV_V_EMF_ADC_PIN))
#endif
// GPIO pin mask with allowed outputs (AUX & GPIO (configured as outputs))
#define GPIO_ALLOWED_OUTPUTS (GPIO_OUTPUT_PIN_MASK) & ~(GPIO_ILLEGAL_MASK)
#endif
+818
View File
@@ -0,0 +1,818 @@
//////////////////////////
// RP2040-Decoder //
// Gabriel Koppenstein //
// core0.c //
//////////////////////////
#include "core0.h"
// Define pointer to CV array stored in flash memory, FLASH_TARGET_OFFSET is defined in CMakeLists.txt and depending on flash size,
// it gets stored in the highest address flash sector possible, to avoid interference with the program code.
// CMakelists.txt also checks for program code exceeding past the last sector. Just have to make sure the correct flash size is set in CMakeLists.txt
const uint8_t *CV_ARRAY_FLASH = (const uint8_t *) (XIP_BASE + FLASH_TARGET_OFFSET);
// level_table is used to store pwm levels for any output using PWM
uint16_t level_table[sizeof(uint32_t)*8] = {0};
// Volatile due to modification in gpio interrupt context
volatile absolute_time_t falling_edge_time, rising_edge_time;
// Input bit buffer for DCC signal
uint64_t input_bit_buffer = 0;
dcc_ring_buffer_t dcc_r_buf = {0};
static void increment_ring_buffer_idx(size_t * idx, uint8_t ring_buffer_length) {
// Takes index variable as a pointer and increments it by 1. When index reaches the end of the ring buffer, it wraps around.
// The wrap around value is the length of the ring buffer.
*idx = (*idx + 1) % ring_buffer_length;
}
static size_t get_flash_size() {
// Function to read the flash size of the chip, used for debugging/testing purposes
// Prepare TX and RX buffers for reading the JEDEC ID
uint8_t tx_buf[4] = { FLASH_CMD_READ_JEDEC_ID, 0, 0, 0 }; // Send the 0x9F command
uint8_t rx_buf[4] = { 0, 0, 0, 0 }; // RX buffer for the response
size_t buf_size = sizeof(tx_buf);
void * params[] = {tx_buf, rx_buf, &buf_size};
int ret_val = flash_safe_execute(call_flash_do_cmd, params, FLASH_TIMEOUT_IN_MS);
if (ret_val != PICO_OK){
set_error(FLASH_SIZE_READBACK_FAILURE);
return 0;
}
// The third byte of the response (rxbuf[3]) contains the log2 size (e.g., 0x18 for 16 MB)
if (rx_buf[3] == 0) {
set_error(FLASH_SIZE_READBACK_FAILURE);
return 0;
}
// Calculate the actual size (2^size_code bytes)
size_t flash_size = (1u<<rx_buf[3]);
// Return the flash size in bytes
return flash_size;
}
void hardfault_handler(void) {
// Custom HardFault handler
// Log hardfault
LOG(1, "HARDFAULT @ core%u!\n", get_core_num());
LOG(1, "Rebooting...\n")
// Hardfault can't be recovered, trigger the watchdog to reset the system
watchdog_reboot(0, 0, 1);
}
static void trigger_hardfault(void) {
// Force a hardfault, used for debugging/testing purposes
__asm volatile("UDF #0"); // Undefined instruction
}
static void call_flash_range_erase(void *param) {
// This function will be called when it's safe to call flash_range_erase
// Always erases one sector, see FLASH_SECTOR_SIZE
// Flash can only be erased in sectors, which effectively sets all bits to 1
// Flash can than be programmed by setting bits to 0
// Extract the parameters
uint32_t offset = ((uintptr_t*)param)[0];
uint32_t byte_count = ((uintptr_t*)param)[1];
// Check for offset alignment (Must be aligned to a 4096-byte flash sector)
// Check byte count (Must be a multiple of 4096 bytes (one sector))
if ((offset % FLASH_SECTOR_SIZE != 0) || (byte_count % FLASH_SECTOR_SIZE !=0)) {
set_error(FLASH_SAFE_EXECUTE_PROGRAM_FAILURE);
return;
}
flash_range_erase(offset, byte_count);
}
static void call_flash_range_program(void *param) {
// This function will be called when it's safe to call flash_range_program
// Extract the parameters
uint32_t offset = ((uintptr_t*)param)[0];
uint32_t byte_count = ((uintptr_t*)param)[1];
const uint8_t *data = (const uint8_t *)((uintptr_t*)param)[2];
// Check for offset alignment (Must be aligned to a 256-byte flash page)
// Check byte count (Must be a multiple of 256 bytes (one page))
if ((offset % FLASH_PAGE_SIZE != 0) || (byte_count % FLASH_PAGE_SIZE != 0)) {
set_error(FLASH_SAFE_EXECUTE_PROGRAM_FAILURE);
return;
}
flash_range_program(offset, data, byte_count);
}
static void call_flash_do_cmd(void *param) {
// This function will be called when it's safe to call flash_do_cmd
// Cast void pointer to void pointer array
void **params = (void **)param;
// Extract the parameters
uint8_t * tx_buf = (uint8_t *)params[0];
uint8_t * rx_buf = (uint8_t *)params[1];
uint8_t * size_ptr = (uint8_t *)params[2];
flash_do_cmd(tx_buf, rx_buf, *size_ptr);
}
unsigned int absolute_val(int x) {
// Extract the sign bit
int mask = x >> (sizeof(x) * 8 - 1);
return (x + mask) ^ mask;
}
static uint16_t two_std_dev(const uint16_t arr[], const uint32_t length) {
// Calculate arithmetic average
uint64_t sum = 0;
for (uint32_t i = 0; i < length; ++i) {
sum += arr[i];
}
const uint64_t x_avg = sum / length;
// Calculate sample variance and sampled standard deviation
sum = 0;
for (uint32_t i = 0; i < length; ++i) {
sum += (arr[i] - x_avg) * (arr[i] - x_avg);
}
const uint16_t variance = sum / (length-1);
const uint16_t std_dev = (uint16_t) sqrtf((float) variance);
// Sum every element that is within two times the sampled standard deviation and compute new average
sum = 0;
uint32_t counter = 0;
for (uint32_t i = 0; i < length; ++i) {
const uint32_t diff = absolute_val(arr[i] - x_avg);
if ( diff <= 2*std_dev ){
sum += arr[i];
counter++;
}
}
return sum / counter;
}
static void adc_offset_adjustment(uint32_t const n) {
// Measures constant adc offset and programs the offset into flash
LOG(1, "ADC offset adjustment with %u iterations...\n", n);
uint16_t offsets_fwd[n];
uint16_t offsets_rev[n];
// Set PWM level to 0 just to be sure
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
busy_wait_ms(1000);
// Measure n times in (reverse direction)
LOG(1, "Measuring ADC offset in reverse direction (input channel: %u)...\n", REV_V_EMF_ADC_CHANNEL);
adc_select_input(REV_V_EMF_ADC_CHANNEL);
adc_run(true);
for (uint32_t i = 0; i < n; i++) {
offsets_rev[i] = adc_fifo_get_blocking();
}
adc_run(false);
adc_fifo_drain();
LOG(1, "Done measuring in reverse direction...\n");
busy_wait_ms(1000);
// Measure n times in (forward direction)
LOG(1, "Measuring ADC offset in forward direction (input channel: %u)...\n", FWD_V_EMF_ADC_CHANNEL);
adc_select_input(FWD_V_EMF_ADC_CHANNEL);
adc_run(true);
for (uint32_t i = 0; i < n; i++) {
offsets_fwd[i] = adc_fifo_get_blocking();
}
adc_run(false);
adc_fifo_drain();
LOG(1, "Done measuring in forward direction...\n");
// Find overall average discarding outliers in measurement
const uint16_t offset_avg_fwd = two_std_dev(offsets_fwd, n);
const uint16_t offset_avg_rev = two_std_dev(offsets_rev, n);
const uint16_t overall_avg_offset = (offset_avg_fwd + offset_avg_rev) / 2;
LOG(1, "New ADC Offset value CV_172 = %u\n", overall_avg_offset);
// Create temporary array -> change CV 172 in temp array -> erase flash -> write temp array to flash
uint8_t CV_ARRAY_TEMP[CV_ARRAY_SIZE];
memcpy(CV_ARRAY_TEMP, CV_ARRAY_FLASH, sizeof(CV_ARRAY_TEMP));
CV_ARRAY_TEMP[171] = overall_avg_offset;
uintptr_t params_erase[] = {FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE};
int ret_val = flash_safe_execute(call_flash_range_erase, params_erase, FLASH_TIMEOUT_IN_MS);
if (ret_val != PICO_OK){
set_error(FLASH_SAFE_EXECUTE_ERASE_FAILURE);
return;
}
uintptr_t params_program[] = {FLASH_TARGET_OFFSET, sizeof(CV_ARRAY_TEMP), (uintptr_t)CV_ARRAY_TEMP};
ret_val = flash_safe_execute(call_flash_range_program, params_program, FLASH_TIMEOUT_IN_MS);
if(ret_val != PICO_OK){
set_error(FLASH_SAFE_EXECUTE_PROGRAM_FAILURE);
return;
}
}
static void acknowledge() {
// Acknowledge a CV rd/wr instruction by pulsing the motor in both directions
const uint16_t max_lvl = _125M / (CV_ARRAY_FLASH[8] * 100 + 10000);
pwm_set_gpio_level(MOTOR_FWD_PIN, max_lvl);
busy_wait_ms(3);
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
pwm_set_gpio_level(MOTOR_REV_PIN, max_lvl);
busy_wait_ms(3);
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
}
static void verify_cv_bit(uint16_t const cv_address, const bool bit_val, uint8_t const bit_pos) {
// Check for matching bit, when found call acknowledge()
const uint8_t mask = 0b00000001;
const bool res = ((CV_ARRAY_FLASH[cv_address] >> bit_pos) & mask) == bit_val;
if (res) {
acknowledge();
}
}
static void verify_cv_byte(uint16_t const cv_address, uint8_t const cv_data) {
// Check for matching byte, when found call acknowledge()
if (CV_ARRAY_FLASH[cv_address] == cv_data) acknowledge();
}
static void write_cv_byte(uint16_t cv_address, uint8_t cv_data) {
// Write the specified CV byte to flash
uint8_t CV_ARRAY_TEMP[CV_ARRAY_SIZE];
memcpy(CV_ARRAY_TEMP, CV_ARRAY_FLASH, sizeof(CV_ARRAY_TEMP));
CV_ARRAY_TEMP[cv_address] = cv_data;
// First erase necessary amount of blocks in flash and then rewrite to flash
uintptr_t params_erase[] = {FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE};
int ret_val = flash_safe_execute(call_flash_range_erase, params_erase, FLASH_TIMEOUT_IN_MS);
if (ret_val != PICO_OK){
set_error(FLASH_SAFE_EXECUTE_ERASE_FAILURE);
return;
}
uintptr_t params_program[] = { FLASH_TARGET_OFFSET, sizeof(CV_ARRAY_TEMP), (uintptr_t)CV_ARRAY_TEMP};
ret_val = flash_safe_execute(call_flash_range_program, params_program, FLASH_TIMEOUT_IN_MS);
if(ret_val != PICO_OK){
set_error(FLASH_SAFE_EXECUTE_PROGRAM_FAILURE);
return;
}
acknowledge();
}
static void reset_cv_array_to_default(){
// Reset all CVs to default (CV_ARRAY_DEFAULT)
uintptr_t params_erase[] = {FLASH_TARGET_OFFSET, FLASH_SECTOR_SIZE};
int ret_val = flash_safe_execute(call_flash_range_erase, params_erase, FLASH_TIMEOUT_IN_MS);
if (ret_val != PICO_OK){
set_error(FLASH_SAFE_EXECUTE_ERASE_FAILURE);
return;
}
uintptr_t params_program[] = {FLASH_TARGET_OFFSET, sizeof(CV_ARRAY_DEFAULT), (uintptr_t)CV_ARRAY_DEFAULT};
ret_val = flash_safe_execute(call_flash_range_program, params_program, FLASH_TIMEOUT_IN_MS);
if(ret_val != PICO_OK){
set_error(FLASH_SAFE_EXECUTE_PROGRAM_FAILURE);
return;
}
}
static void write_cv_handler(uint16_t const cv_index, uint8_t const cv_data) {
// There are some exceptions to writing CVs - e.g. writing to a read only CV is not valid - this gets handled here
switch (cv_index) {
case 0: //CV_1
// CV_1 => Value = 0 is not allowed
if (cv_data == 0 || cv_data > 127) {
break;
}
else {
write_cv_byte(cv_index, cv_data);
}
break;
case 6: //CV_7
// Read only (CV_7 - Version no.)
// ADC offset Adjustment is triggered when setting CV_7 = 7
if (cv_data == 7) {
LOG(1, "Triggered ADC offset adjustment via CV_7 = 7\n");
adc_offset_adjustment(ADC_CALIBRATION_ITERATIONS);
}
break;
case 7: //CV_8
// Read only (CV_8 - Manufacturer ID)
// Reset all CVs to default (CV_ARRAY_DEFAULT) when setting CV_8 = 8)
if (cv_data == 8) {
LOG(1, "reset of flash triggered via CV_8 = 8\n");
reset_cv_array_to_default();
}
break;
case 16: // CV_17
// CV_17 must have a value between 11000000->(192dec) and 11100111->(231dec) inclusive
// CV_17 == 192 && CV_18 == 0 -> Address = 0 is also not valid and therefore shall not be set
if ((cv_data < 192 || cv_data > 231) || (CV_ARRAY_FLASH[17] == 0 && cv_data == 192)) {
break;
}
write_cv_byte(cv_index, cv_data);
break;
case 17: // CV_18
if(CV_ARRAY_FLASH[16] == 192 && cv_data == 0){
break;
}
write_cv_byte(cv_index, cv_data);
break;
case 30: // CV_31 & CV_32 Index isn't implemented and shall not be set
break;
case 31: // CV_31 & CV_32 Index isn't implemented and shall not be set
break;
default: // Regular CV write is carried out
write_cv_byte(cv_index, cv_data);
}
}
static void program_mode(size_t const number_of_bytes, const uint8_t *const byte_array) {
//First check for valid programming command ("address" 112-127)
if (byte_array[number_of_bytes - 1] < 128 && byte_array[number_of_bytes - 1] > 111) {
const uint8_t instruction_type_mask = 0b00001100;
const uint8_t instruction_type = instruction_type_mask & byte_array[number_of_bytes - 1];
const uint8_t cv_address_ms_bits_mask = 0b00000011;
const uint16_t cv_address_ms_bits = cv_address_ms_bits_mask & byte_array[number_of_bytes - 1];
const uint16_t cv_address = byte_array[number_of_bytes - 2] + (cv_address_ms_bits << 8);
if (instruction_type == 0b000001000) {
// Verify CV bit instruction
const uint8_t bit_pos_mask = 0b00000111;
const uint8_t bit_pos = bit_pos_mask & byte_array[number_of_bytes - 3];
const uint8_t bit_val_mask = 0b00000001;
const uint8_t bit_val_uint = (byte_array[number_of_bytes - 3] >> 3) & bit_val_mask;
const bool bit_val = bit_val_uint;
verify_cv_bit(cv_address, bit_val, bit_pos);
}
else if (instruction_type == 0b000000100) {
// Verify CV byte instruction
const uint8_t cv_data = byte_array[number_of_bytes - 3];
verify_cv_byte(cv_address, cv_data);
}
else if (instruction_type == 0b000001100) {
// Write CV byte instruction
const uint8_t cv_data = byte_array[number_of_bytes - 3];
write_cv_handler(cv_address, cv_data);
}
busy_wait_ms(5);
}
}
static void set_outputs(uint32_t const functions_to_set_bitmask) {
// Get outputs with pwm enabled and preset outputs_to_set_PWM variable with resulting GPIO Bitmask
const uint32_t PWM_enabled_outputs = get_32bit_CV(111);
uint32_t outputs_to_set_PWM = PWM_enabled_outputs;
// Get enabled output configuration corresponding to set functions and direction
uint32_t outputs_to_set = 0;
uint32_t temp_mask = 1;
for (uint8_t i = 0; i < 32; i++) {
if (temp_mask & functions_to_set_bitmask) {
const direction_t dir = get_direction_of_speed_step(speed_step_target);
outputs_to_set |= get_32bit_CV(i * 8 + 260 - 4 * dir);
}
temp_mask <<= 1;
}
outputs_to_set_PWM &= outputs_to_set; // Outputs with PWM to be enabled
outputs_to_set &= ~outputs_to_set_PWM; // Outputs without PWM to be enabled
// Set regular outputs without PWM, preventing illegal GPIO by masking with GPIO_ALLOWED_OUTPUTS
gpio_put_masked(GPIO_ALLOWED_OUTPUTS, outputs_to_set);
// Set PWM enabled outputs to desired level
temp_mask = 1;
for (uint8_t i = 0; i < 32; ++i) {
if (temp_mask & outputs_to_set_PWM) {
pwm_set_gpio_level(i, level_table[i]);
pwm_gpio_to_channel(i);
pwm_gpio_to_slice_num(i);
}
else if (temp_mask & PWM_enabled_outputs) {
pwm_set_gpio_level(i, 0);
}
temp_mask <<= 1;
}
}
static void update_active_functions(uint32_t new_function_bitmask, const uint8_t clr_bit_ind, bool const direction_change) {
// Update functions F0 - F31 when function command is received or in case of direction change
static uint32_t active_functions;
static uint32_t prev_active_func;
// Outputs depend on direction, therefore on direction change outputs need to be set for the other direction.
if (direction_change) {
// In case of a direction change every output needs to be set according to configuration for the other direction
set_outputs(active_functions);
}
else {
// In case of a change in active functions only the function group corresponding to the instruction is considered for updating the outputs
// First, check for changes
new_function_bitmask &= ~(clr_bit_arr[clr_bit_ind]); // Clear every bit except bits corresponding to group of functions
active_functions &= clr_bit_arr[clr_bit_ind]; // Clear bits corresponding to group of functions
active_functions |= new_function_bitmask; // Write bits corresponding to group of functions
const uint32_t changes = active_functions ^ prev_active_func; // Checks for changes from previous state
// When there is changes, set outputs accordingly
if (changes) {
set_outputs(active_functions);
}
// Update previously active function variable
prev_active_func = active_functions;
}
}
static bool error_detection(size_t const number_of_bytes, const uint8_t *const byte_array) {
// Bitwise XOR for all Bytes -> when result is: "0b00000000" error check is passed.
uint8_t xor_byte = 0;
for (int i = 0; i < number_of_bytes; i++) {
xor_byte = xor_byte ^ byte_array[i];
}
return (0 == xor_byte);
}
static bool is_long_address(size_t const number_of_bytes, const uint8_t *const byte_array) {
// Check for long address. Function returns true for long address, false for short address.
if ((byte_array[number_of_bytes - 1] >> 6) == 0b00000011) {
return true;
}
return false;
}
static bool address_evaluation(size_t const number_of_bytes, const uint8_t *const byte_array) {
// First checks for idle message and then evaluates address included in byte_array[] which contains the received DCC message
// Check for idle message
if (byte_array[number_of_bytes - 1] == 255) {
return false;
}
// Long/extended address decoder configuration (CV_29 Bit5)
const bool CV_29_bit5 = (CV_ARRAY_FLASH[28] & 0b00100000) >> 5;
uint16_t read_address;
// Check if decoder is configured to receive long/extended address (CV_29 Bit5 set)
if (CV_29_bit5) {
// Check DCC message for long address format
if (is_long_address(number_of_bytes, byte_array)) {
// DCC message received has long address format
// start of transmission -> address_byte_1 -> address_byte_0 -> ... -> end of transmission
const uint16_t address_byte_1 = (byte_array[number_of_bytes - 1]) - 192; // Remove long address identifier bits
const uint16_t address_byte_0 = (byte_array[number_of_bytes - 2]);
read_address = (address_byte_1 << 8) + address_byte_0;
const uint16_t long_address = get_16bit_CV(16) & 0x3FFF; // &Mask to remove long address identifier bits
return (long_address == read_address);
}
else {
// DCC message received does not have long address format
return false;
}
}
else {
// Else decoder is configured to receive short address (CV_29 Bit5 not set)
// Short address message:
// start of transmission -> address_byte_0 -> ... -> end of transmission
read_address = byte_array[number_of_bytes - 1];
return CV_ARRAY_FLASH[0] == read_address;
}
}
static void instruction_evaluation(size_t const number_of_bytes, const uint8_t *const byte_array) {
// Evaluate the type of instruction
// start of transmission -> ... -> command_byte_n -> ... -> command_byte_0 -> ... -> end of transmission
// The position of command bytes depend on whether the address is long or not
uint8_t command_byte_start_index;
if (is_long_address(number_of_bytes, byte_array)) {
command_byte_start_index = number_of_bytes - 3;
}
else {
command_byte_start_index = number_of_bytes - 2;
}
const uint8_t command_byte_n = byte_array[command_byte_start_index];
if (command_byte_n == 0b00111111) {
// 0011-1111 (128 Speed Step Control) - 2 Byte length
speed_step_target_prev = speed_step_target;
speed_step_target = byte_array[command_byte_start_index - 1];
// Check for direction change
const bool direction_changed = get_direction_of_speed_step(speed_step_target) !=
get_direction_of_speed_step(speed_step_target_prev);
// In case of a direction change, functions need to be updated because functions depend on direction
if (direction_changed) {
update_active_functions(0, 0, true);
}
}
else if (command_byte_n >> 6 == 0b00000010) {
// 10XX-XXXX (Function Group Instruction)
switch (command_byte_n >> 4) {
case 0b00001011: // F5-F8
update_active_functions((command_byte_n << 5), 1, false);
break;
case 0b00001010: // F9-F12
update_active_functions((command_byte_n << 9), 2, false);
break;
default: // F0-F4
update_active_functions((((command_byte_n & 0b00001111) << 1) + ((command_byte_n & 0b00010000) >> 4)), 0, false);
break;
}
}
else if (command_byte_n >> 5 == 0b00000110) {
// Feature Expansion Instruction 110X-XXXX
switch (command_byte_n) {
case 0b11011110: // F13-F20
update_active_functions((byte_array[command_byte_start_index - 1] << 13), 3, false);
break;
case 0b11011111: // F21-F28
update_active_functions((byte_array[command_byte_start_index - 1] << 21), 4, false);
break;
case 0b11011000: // F29-F31
update_active_functions((byte_array[command_byte_start_index - 1] << 29), 5, false);
break;
default:
break;
}
}
}
static bool reset_message_check(size_t const number_of_bytes, const uint8_t *const byte_array) {
// Check for reset message - When reset message is found, stop the motor and disable all functions.
if (byte_array[number_of_bytes - 1] == 0b00000000 && byte_array[number_of_bytes - 2] == 0b00000000) {
const direction_t dir = get_direction_of_speed_step(speed_step_target);
// Set previous speed step target to current speed step target
speed_step_target_prev = speed_step_target;
// Set speed step target to emergency stop speed step ( 1 for Reverse direction / 129 for forward direction)
// for details see get_direction_of_speed_step() comment in "shared.h"
if(dir == DIRECTION_FORWARD) speed_step_target = SPEED_STEP_FORWARD_EMERGENCY_STOP;
else if(dir == DIRECTION_REVERSE) speed_step_target = SPEED_STEP_REVERSE_EMERGENCY_STOP;
update_active_functions(0,0,0); // Disables all functions
return true;
}
return false;
}
static size_t detect_dcc_packet() {
// Checks for valid package - looking for correct preamble using bitmasks
// returns number of bytes if valid bit-pattern is found. Otherwise INVALID_PACKAGE is returned.
// INVALID_PACKAGE is defined in core0.h as SIZE_MAX (maximum value of size_t)
size_t number_of_bytes = INVALID_PACKAGE;
const uint64_t masked_message_3_bytes = input_bit_buffer & MESSAGE_MASK_3_BYTES;
if (masked_message_3_bytes == MESSAGE_3_BYTES) number_of_bytes = 3;
const uint64_t masked_message_4_bytes = input_bit_buffer & MESSAGE_MASK_4_BYTES;
if (masked_message_4_bytes == MESSAGE_4_BYTES) number_of_bytes = 4;
const uint64_t masked_message_5_bytes = input_bit_buffer & MESSAGE_MASK_5_BYTES;
if (masked_message_5_bytes == MESSAGE_5_BYTES) number_of_bytes = 5;
return number_of_bytes;
}
static void bits_to_dcc_packet_data(dcc_packet_t * packet) {
// Writes data in input_bit_buffer to dcc_packet_t struct instance
//start of transmission -> byte_n(address byte) -> ... -> byte_0(error detection byte) -> end of transmission
for (uint8_t i = 0; i < packet->length; i++) {
packet->data[i] = input_bit_buffer >> (i * 9 + 1);
}
}
static void evaluate_packet(dcc_packet_t * packet) {
// DCC packet evaluation
static bool reset_message_flag;
// Check for errors
if (error_detection(packet->length, packet->data)) {
// Check for matching address
if (address_evaluation(packet->length, packet->data)) {
reset_message_flag = false;
instruction_evaluation(packet->length, packet->data);
}
else if (reset_message_flag) {
// When previous packet was a reset message -> enter program mode
program_mode(packet->length, packet->data);
}
else {
// Check for reset message and set flag when reset message is received
reset_message_flag = reset_message_check(packet->length, packet->data);
}
}
}
static void gpio_irq_cb(uint gpio, uint32_t events) {
absolute_time_t start_time = get_absolute_time();
// Check for rising edge on DCC input pin
if ((events & GPIO_IRQ_EDGE_RISE) && (gpio == DCC_INPUT_PIN)) {
track_signal_rise(gpio, events);
}
// Check for falling edge on DCC input pin
else if ((events & GPIO_IRQ_EDGE_FALL) && (gpio == DCC_INPUT_PIN)) {
track_signal_fall(gpio, events);
}
absolute_time_t end_time = get_absolute_time();
if (absolute_time_diff_us(start_time, end_time) > 20) {
LOG(1, "Time gpio_irq_cb: %lld us\n", absolute_time_diff_us(start_time, end_time));
}
}
static void track_signal_rise() {
// DCC-Signal pin rising edge. Write current time to rising_edge_time
rising_edge_time = get_absolute_time();
}
static void track_signal_fall() {
// DCC-Signal pin falling edge. Write current time to falling_edge_time
falling_edge_time = get_absolute_time();
// Time difference is equal to the time the signal was in a logical high state
const int64_t time_logical_high = absolute_time_diff_us(rising_edge_time, falling_edge_time);
// When logical high was longer than 87us write 0 bit into buffer otherwise 1
bool bit;
if (time_logical_high > 87) bit = 0;
else bit = 1;
input_bit_buffer <<= 1;
input_bit_buffer |= bit;
// Check if input buffer contains a valid dcc packet
// number_of_bytes contains the length of the packet when detected, otherwise -1
dcc_r_buf.packets[dcc_r_buf.wr_idx].length = detect_dcc_packet();
if (dcc_r_buf.packets[dcc_r_buf.wr_idx].length != INVALID_PACKAGE) {
// Write data into ring buffer containing dcc_packet_t struct instances
bits_to_dcc_packet_data(&dcc_r_buf.packets[dcc_r_buf.wr_idx]);
// Increment write index of ring buffer
increment_ring_buffer_idx(&dcc_r_buf.wr_idx, RING_BUFFER_PACKETS);
}
}
static void init_outputs() {
LOG(1, "Initializing Outputs...\n");
gpio_init_mask(GPIO_ALLOWED_OUTPUTS);
gpio_set_dir_out_masked(GPIO_ALLOWED_OUTPUTS); // Note: This might also disable UART on GPIO0 & GPIO1
const uint32_t PWM_enabled_outputs = get_32bit_CV(111) & GPIO_ALLOWED_OUTPUTS;
uint32_t mask = 1;
for (uint8_t i = 0; i < sizeof(uint32_t)*8; ++i) {
if (PWM_enabled_outputs & mask) {
const uint32_t slice = pwm_gpio_to_slice_num(i);
const uint32_t channel = pwm_gpio_to_channel(i); // Channel A = "0"; Channel B = "1"
const uint16_t wrap = get_16bit_CV(115 + 7 * slice);
const uint16_t level = get_16bit_CV(118 + 7 * slice + 2 * channel);
const uint8_t clock_divider = CV_ARRAY_FLASH[117 + 7 * slice] + 1;
gpio_set_function(i, GPIO_FUNC_PWM);
pwm_set_wrap(slice, wrap);
pwm_set_gpio_level(i, 0);
level_table[i] = level;
pwm_set_clkdiv_int_frac(slice, clock_divider, 0);
pwm_set_enabled(slice, true);
LOG(1, "Set GPIO pin: %u as PWM output; PWM slice: %u; PWM channel: %u; Duty cycle: %f; Clock divider: %u\n", i, slice, channel, (float) level/wrap, clock_divider);
}
mask <<= 1;
}
}
static void cv_setup_check() {
LOG(1, "Checking CV array for factory state of flash or missing ADC offset setup...\n");
// Check for flash factory setting and set CV_FLASH_ARRAY to default values when factory condition ("0xFF") is found.
if (CV_ARRAY_FLASH[64] == 0xFF) {
LOG(1, "Detected flash memory factory condidition (CV_65 == %u), resetting all CVs to default values...\n", CV_ARRAY_FLASH[64]);
reset_cv_array_to_default();
}
// Check for existing ADC offset setup
if (CV_ARRAY_FLASH[171] == 0xFF) {
LOG(1, "Detected ADC offset factory condidition (CV_172 == %u), running offset adjustment measurement function...\n", CV_ARRAY_FLASH[171]);
adc_offset_adjustment(ADC_CALIBRATION_ITERATIONS);
}
LOG(1, "CV check done! Setting wait_for_cv_setup_check flag to false!\n");
cv_setup_check_done = true;
}
static void init_motor_pwm(uint8_t const gpio) {
// Motor PWM initialization
LOG(2, "Initializing Motor PWM on GPIO pin: %u...\n", gpio);
// Set GPIO pin to PWM functionality
gpio_set_function(gpio, GPIO_FUNC_PWM);
// Set wrap counter value saved in CV
const uint16_t wrap_counter = (_125M / (CV_ARRAY_FLASH[8] * 100 + 10000)) - 1;
const uint32_t slice_num = pwm_gpio_to_slice_num(gpio);
pwm_set_clkdiv_int_frac(slice_num, CV_ARRAY_FLASH[173], 0);
pwm_set_wrap(slice_num, wrap_counter);
// Set initial level to 0
pwm_set_gpio_level(gpio, 0);
// Enable PWM
pwm_set_enabled(slice_num, true);
LOG(2, "Initialized motor PWM on pin: %u; wrap_counter %u; clkdiv %d;\n", gpio, wrap_counter, CV_ARRAY_FLASH[173]);
}
static void init_adc() {
LOG(1, "Initializing ADC...\n")
// Initialize ADC
adc_init();
// Set ADC GPIO pins to ADC functionality
adc_gpio_init(FWD_V_EMF_ADC_PIN);
adc_gpio_init(REV_V_EMF_ADC_PIN);
// Configure ADC FIFO
adc_fifo_setup(true, false, 0, false, false);
LOG(1, "ADC initialization done!\n")
}
static void init_digital_input() {
LOG(1, "Initializing DCC input pin...\n");
gpio_init(DCC_INPUT_PIN);
gpio_set_dir(DCC_INPUT_PIN, GPIO_IN);
gpio_pull_up(DCC_INPUT_PIN);
LOG(1, "DCC input pin initialization done!\n");
}
static void wait_for_stdio_input() {
while (true) {
//watchdog_update();
// Send a message to the user asking them to acknowledge it by sending a reply
LOG(1, "Send any character to continue.\n");
// Wait for a character
int received_char = getchar_timeout_us(1e6);
if ((received_char != PICO_ERROR_TIMEOUT) && (received_char > 0)) {
// If a character is received, exit the function
LOG(1, "Character '%c' received. Continuing...\n", (char)received_char);
return;
}
// If no character is received, retry...
}
}
int main() {
exception_set_exclusive_handler(HARDFAULT_EXCEPTION, hardfault_handler);
#ifdef RP2040_DECODER_DEFAULT_LED_PIN
// Initialize LED GPIO pin
gpio_init(RP2040_DECODER_DEFAULT_LED_PIN);
gpio_set_dir(RP2040_DECODER_DEFAULT_LED_PIN, GPIO_OUT);
// Blink LED once for 200ms to indicate startup
gpio_put(RP2040_DECODER_DEFAULT_LED_PIN, 1);
busy_wait_ms(200);
gpio_put(RP2040_DECODER_DEFAULT_LED_PIN, 0);
busy_wait_ms(200);
#endif
// Initialize stdio when enabled
#if (STDIO_UART_ENABLED || STDIO_USB_ENABLED)
if(stdio_init_all() != true){
set_error(STDIO_INIT_FAILURE);
}
// When LOG_WAIT == 1 and LOGLEVEL > 0 wait for user input before continuing. User input can be any character.
#if (LOGLEVEL > 0 && LOG_WAIT == 1)
wait_for_stdio_input();
printf("%u", STDIO_UART_ENABLED);
#endif
#endif
LOG(1, "core0 Initialization...\n");
// Check for reboot by watchdog and set error when true
if (watchdog_caused_reboot()) {
LOG(1, "Reboot by watchdog detected!\n");
set_error(REBOOT_BY_WATCHDOG);
}
// Initialize Motor PWM pins
init_motor_pwm(MOTOR_FWD_PIN);
init_motor_pwm(MOTOR_REV_PIN);
// Initialize outputs
init_outputs();
// Initialize ADC
init_adc();
// Initialize digital inputs and track signal irq
init_digital_input();
LOG(1, "core0 initialization done!\n");
// Launch core1
multicore_launch_core1(core1_entry);
// Wait for core1 to call flash_safe_execute_core_init() and set the flash_safe_execute_core_init_done flag
LOG(1, "Waiting for flash_safe_execute_core_init_done flag...\n");
while (!flash_safe_execute_core_init_done) {
watchdog_update();
}
// Check CV array for factory state of flash or missing ADC offset setup
cv_setup_check();
// Register GPIO IRQ callback
gpio_set_irq_callback(gpio_irq_cb);
// Enable IRQ
gpio_set_irq_enabled(DCC_INPUT_PIN, GPIO_IRQ_EDGE_RISE | GPIO_IRQ_EDGE_FALL, true);
irq_set_enabled(IO_IRQ_BANK0, true);
// Enable the watchdog, requiring the watchdog to be updated every WATCHDOG_TIMER_IN_MS milliseconds or the chip will reboot
// second arg is pause on debug which means the watchdog will pause when stepping through code
// Watchdog is updated by core0 and core1 whenever there is time and hopefully soon enough to prevent a reboot.
watchdog_enable(WATCHDOG_TIMER_IN_MS, 1);
// Endless loop
while (true) {
// Check for new messages in ring buffer
if (dcc_r_buf.wr_idx != dcc_r_buf.rd_idx) {
absolute_time_t start_time = get_absolute_time();
evaluate_packet(&dcc_r_buf.packets[dcc_r_buf.rd_idx]);
increment_ring_buffer_idx(&dcc_r_buf.rd_idx, RING_BUFFER_PACKETS);
absolute_time_t end_time = get_absolute_time();
if (absolute_time_diff_us(start_time, end_time) > 40) {
LOG(1, "Time to evaluate message: %lld us\n", absolute_time_diff_us(start_time, end_time));
}
}
else {
watchdog_update();
}
}
}
+426
View File
@@ -0,0 +1,426 @@
/*!
*
* \file core0.h
* Used exclusively by core0
*
*/
#pragma once
#include "shared.h"
#include "CV.h"
/**
* @def MESSAGE_3_BYTES
* @brief Comparison bitmask for detecting 3 byte long DCC messages/packets
*/
#define MESSAGE_3_BYTES 0b11111111110000000000000000000000000001
/**
* @def MESSAGE_MASK_3_BYTES
* @brief Bitmask for detecting 3 byte long DCC messages/packets, input_bit_buffer is bitwise ANDed with the mask
*/
#define MESSAGE_MASK_3_BYTES 0b11111111111000000001000000001000000001
/**
* @def MESSAGE_4_BYTES
* @brief Comparison bitmask for detecting 4 byte long DCC messages/packets
*/
#define MESSAGE_4_BYTES 0b11111111110000000000000000000000000000000000001
/**
* @def MESSAGE_MASK_4_BYTES
* @brief Bitmask for detecting 4 byte long DCC messages/packets, input_bit_buffer is bitwise ANDed with the mask
*/
#define MESSAGE_MASK_4_BYTES 0b11111111111000000001000000001000000001000000001
/**
* @def MESSAGE_5_BYTES
* @brief Comparison bitmask for detecting 5 byte long DCC messages/packets
*/
#define MESSAGE_5_BYTES 0b11111111110000000000000000000000000000000000000000000001
/**
* @def MESSAGE_MASK_5_BYTES
* @brief Bitmask for detecting 5 byte long DCC messages/packets, input_bit_buffer is bitwise ANDed with the mask
*/
#define MESSAGE_MASK_5_BYTES 0b11111111111000000001000000001000000001000000001000000001
/**
* @def INVALID_PACKAGE
* @brief Return value of detect_dcc_packet() when the packet is invalid, meaning no packet was detected
*/
#define INVALID_PACKAGE SIZE_MAX
/**
* @def RING_BUFFER_PACKETS
* @brief First dimension of dcc ring buffer array - meaning RING_BUFFER_PACKETS can be retained inside the buffer
*/
#define RING_BUFFER_PACKETS 8
/**
* @def RING_BUFFER_BYTES
* @brief Secoond dimension of dcc ring buffer array - meaning each packet can have a maximum size of RING_BUFFER_BYTES
*/
#define RING_BUFFER_BYTES 5
/**
* @def FLASH_CMD_READ_JEDEC_ID
* @brief Constant value of 0x9F used as a JEDEC ID read command for reading the JEDEC ID of a winbond flash memory chip
*/
#define FLASH_CMD_READ_JEDEC_ID 0x9F
/**
* @def FLASH_TIMEOUT_IN_MS
* @brief Timeout value for flash access
*/
#define FLASH_TIMEOUT_IN_MS 500
/**
* @def ADC_CALIBRATION_ITERATIONS
* @brief Iterations for measuring adc offset
*/
#define ADC_CALIBRATION_ITERATIONS 8192
/**
* @def WATCHDOG_TIMER_IN_MS
* @brief Watchdog timer setting, watchdog update needs to be called every WATCHDOG_TIMER_IN_MS milliseconds, otherwise decoder resets itself.
*/
#define WATCHDOG_TIMER_IN_MS 5000
/*!
* \brief Bitmasks used for clearing bits corresponding to function blocks
*
* [0] = F0-F4
* [1] = F5-F8
* [2] = F9-F12
* [3] = F13-F20
* [4] = F21-F28
* [5] = F29-F31
*
*/
const uint32_t clr_bit_arr[6] = {
0b11111111111111111111111111100000, // Clear Bits 0-4 (F0-F4)
0b11111111111111111111111000011111, // Clear Bits 5-8 (F5-F8)
0b11111111111111111110000111111111, // Clear Bits 9-12 (F9-F12)
0b11111111111000000001111111111111, // Clear Bits 13-20 (F13-F20)
0b11100000000111111111111111111111, // Clear Bits 21-28 (F21-F28)
0b00011111111111111111111111111111, // Clear Bits 29-31 (F29-F31)
};
/**
* @brief Structure representing a DCC packet.
*
* This structure is used to store the data and length of a DCC packet.
*
* @typedef dcc_packet_t
* @struct dcc_packet_t
*
* @param data An array of bytes representing the DCC packet data.
* @param length The length of the DCC packet data.
*/
typedef struct dcc_packet_t {
/*! An array of bytes representing the DCC packet data. */
uint8_t data[RING_BUFFER_BYTES];
/*! The length of the DCC packet data. */
size_t length;
}dcc_packet_t;
/**
* @brief Structure representing a ring buffer for DCC packets.
*
* This structure is used to manage a ring buffer that stores DCC packets.
* It contains an array of packets and indices for writing and reading.
*
* @typedef dcc_ring_buffer_t
* @struct dcc_ring_buffer_t
*/
typedef struct dcc_ring_buffer_t {
/*! Array of DCC packets stored in the ring buffer. */
dcc_packet_t packets[RING_BUFFER_PACKETS];
/*! Index for the next write operation in the ring buffer. */
size_t wr_idx;
/*! Index for the next read operation in the ring buffer. */
size_t rd_idx;
} dcc_ring_buffer_t;
/**
* @brief Increment the index of a ring buffer.
*
* This function increments the provided index of a ring buffer, wrapping around
* to zero if the end of the buffer is reached.
*
* @param idx Pointer to the index to be incremented.
* @param ring_buffer_length The length of the ring buffer.
*/
static void increment_ring_buffer_idx(size_t * idx, uint8_t ring_buffer_length);
/*!
* \brief Function for erasing a sector of flash memory.
*
* This function erases a specified range of flash memory sectors.
*
* \param param Pointer to parameters.
* - First parameter: Offset into flash, in bytes. Must be aligned to a 4096-byte flash sector.
* - Second parameter: Number of bytes to be erased. Must be a multiple of 4096 bytes (one sector).
*/
static void call_flash_range_erase(void *param);
/*!
* \brief Function for programming a range of flash memory
*
* This function programs a specified range of flash memory with the provided data.
*
* \param param Pointer to parameters
* - First parameter: The Flash address of the first byte to be programmed. Must be aligned to a 256-byte flash page.
* - Second parameter: The number of bytes to program. Must be a multiple of 256 bytes (one page).
* - Third parameter: Pointer to the data to program into flash.
*/
static void call_flash_range_program(void *param);
/*!
* \brief Function for executing a flash command via QSPI
*
* \param param Pointer to parameters
* First parameter is the pointer to a byte buffer which will be transmitted to the flash
* Second parameter is the pointer to a byte buffer where data received from the flash will be written.
* Third parameter is the length in bytes of any of the two buffers (same size).
*/
static void call_flash_do_cmd(void *param);
/*!
* \brief Function for calculating the absolute value of an integer.
*
* This function takes an integer as input and returns its absolute value.
*
* \param x The input integer whose absolute value is to be calculated.
* \return The absolute value of the input integer.
*/
static unsigned int absolute_val(int x);
/*!
* \brief Computes the average of values in an array that deviate less than twice the standard deviation from the original average.
*
* This function calculates the average of the elements in the input array that are within two standard deviations of the mean of the array.
*
* \param arr The input array of values.
* \param length The number of elements in the input array.
* \return The average value of the elements that deviate less than twice the standard deviation from the original average.
*/
static uint16_t two_std_dev(const uint16_t arr[], uint32_t length);
/*!
* \brief Measures ADC offset and saves the offset value to flash memory.
*
* This function performs a series of ADC measurements to determine the offset
* and then stores this offset value in the flash memory for future use.
*
* \param n The number of measurements to be performed to calculate the offset.
*/
static void adc_offset_adjustment(uint32_t n);
/*!
* \brief Function for acknowledging a CV write or CV verify instruction
*
* Acknowledgement works by creating a spike in current consumption, normally realized by running the motor in alternating directions.
* This current increase is detected by the command station.
*
* \note Refers to NMRA S-9.2.3 Section D and RCN-216 Section 3
*/
static void acknowledge();
/*!
* \brief Function for verifying a single bit of a CV
* \param cv_address CV Address
* \param bit_val Value of bit to be verified
* \param bit_pos Position of bit to be verified
*/
static void verify_cv_bit(uint16_t cv_address, bool bit_val, uint8_t bit_pos);
/*!
* \brief Function for verifying a CV byte
*
* This function verifies the byte of a Configuration Variable (CV) at the specified address.
*
* \param cv_address The address of the CV to be verified.
* \param cv_data The byte value to be verified against the CV.
*/
static void verify_cv_byte(uint16_t cv_address, uint8_t cv_data);
/*!
* \brief Writes a byte to a Configuration Variable (CV).
*
* This function writes a byte of data to a specified CV address.
*
* \param cv_address The address of the CV to write to.
* \param cv_data The data byte to write to the CV.
*/
static void write_cv_byte(uint16_t cv_address, uint8_t cv_data);
/*!
* \brief This function sets all the CV values stored in flash back to their default settings (CV_ARRAY_DEFAULT).
*/
static void reset_cv_array_to_default();
/*!
* \brief CV Programming mode function
*
* This function is used to enter programming mode in order to write CV values to persistent flash memory or verify/read bits/bytes from flash memory.
*
* Procedure:
* 1. Checks for a valid programming command.
* 2. Evaluates the type of programming instruction (Write byte / Verify byte / Verify bit) and runs the corresponding function. See verify_cv_byte(), verify_cv_bit() and write_cv_byte().
*
* @param number_of_bytes The number of bytes in the array.
* @param byte_array A pointer to the byte array.
*
* @note Refer to NMRA Standard 9.2.3 ("Service Mode Programming") or RCN-216 for more details.
*/
static void program_mode(size_t number_of_bytes, const uint8_t *const byte_array);
/*!
* \brief Set outputs according to function mapping in CV257 to CV512
*
* This function maps the functions and direction to the mapped outputs configured in CV257 to CV512.
* Also enables PWM when enabled according to CV112 to CV115.
*
* \param functions_to_set_bitmask Function bitmask F0 is bit0, F1 is bit1, ...
*/
static void set_outputs(uint32_t functions_to_set_bitmask);
/**
* @brief Update functions F0 - F31 when function command is received or in case of direction change.
*
* This function updates the active functions based on the provided bitmask. It can also clear a specific bit
* and handle changes in direction.
*
* @param new_function_bitmask New function bitmask representing the state of functions F0 - F31.
* @param clr_bit_ind Index of the bit to be cleared in the bitmask.
* @param direction_change Flag indicating if there is a change in direction.
*/
static void update_active_functions(uint32_t new_function_bitmask, uint8_t clr_bit_ind, bool direction_change);
/**
* @brief Detect errors in the byte array using exor of all bytes.
*
* Exor of all bytes is expected to be "0b00000000".
*
* @param number_of_bytes Number of bytes in the array.
* @param byte_array Pointer to the byte array.
* @return true if no error is detected, false otherwise.
*/
static bool error_detection(size_t number_of_bytes, const uint8_t *byte_array);
/**
* @brief Check if the address is a long address.
*
* @param number_of_bytes Number of bytes in the array.
* @param byte_array Pointer to the byte array.
* @return true if it is a long address, false otherwise.
*/
static bool is_long_address(size_t number_of_bytes, const uint8_t byte_array[]);
/**
* @brief Evaluate the address of the message.
*
* @param number_of_bytes Number of bytes in the array.
* @param byte_array Pointer to the byte array.
* @return true if the address is correct, false otherwise.
*/
static bool address_evaluation(size_t number_of_bytes, const uint8_t byte_array[]);
/**
* @brief Evaluate the instruction of the message.
*
* @param number_of_bytes Number of bytes in the array.
* @param byte_array Pointer to the byte array.
*/
static void instruction_evaluation(size_t number_of_bytes, const uint8_t byte_array[]);
/**
* @brief Check for reset message - When reset message is found, stop the motor and disable all functions.
*
* @return Number of bytes if valid reset message bit-pattern is found. Otherwise -1 is returned.
*/
static bool reset_message_check(size_t number_of_bytes, const uint8_t *const byte_array);
/**
* @brief Verify DCC message
*
* Procedure:
* 1. Check for valid preamble using bitmasks
* 2. Return number of bytes if valid bit-pattern is found. Otherwise -1 is returned.
*
* \return Number of bytes if valid bit-pattern is found. Otherwise return -1.
*/
static size_t detect_dcc_packet();
/**
* @brief Convert sequence of bits to byte array
*
* For each byte in the byte array, shift the input bit buffer by 9 bits and save the result in the byte array.
* Bytes are ordered as follows:
* Start of transmission -> byte_n(address byte) -> ... -> byte_0(error detection byte) -> end of transmission
*
* \param packet Pointer to dcc packet struct which contains data and length of packet.
*/
static void bits_to_dcc_packet_data(dcc_packet_t * packet);
/**
* @brief Main message evaluation function
*
* Procedure:
* 1. Check if input buffer contains a valid DCC message
* 2. Split data into array of bytes
* 3. Check for errors
* 4. Check for matching address
* 5. Check for reset message and set flag when reset message is received
*
*/
static void evaluate_packet();
/*!
* \brief Track signal rising edge interrupt callback function
*
* Saves timer counter value using get_absolute_time(), then disables rising edge IRQ and enables falling edge IRQ.
*
*/
static void track_signal_rise();
/*!
* \brief Track signal falling edge interrupt callback function
*
* Saves timer counter value using get_absolute_time(), then calculates time difference between rising and falling edge.
* When the time difference is greater than 87us, this bit is interpreted as a logical 0. Otherwise, it is interpreted as a logical 1.
* Refers to NMRA S-9.1 and RCN-210 standards
* Puts the latest bit value into 64 bit unsigned integer "buffer", then checks if the buffer contains a valid DCC packet.
* When a valid packet is found, it is written into the ring buffer, and the write index gets incremented.
*
*/
static void track_signal_fall();
/*!
* \brief Output initialization function
*
* Initializes all allowed GPIO outputs as outputs <br>
* Sets PWM functionality for GPIOs configured as PWM pins CV_112 - CV_115 (see CV.h for reference) <br>
* PWM frequency and clock divider are configured according to CV_116 - CV_171 (see CV.h for reference) <br>
*/
static void init_outputs();
/*!
* \brief Checks various CV values in order to detect factory condition or pending calibrations
*
* Procedure:
* 1. Check for flash memory factory condition when found write default values specified in CV.h to flash memory
* 2. Check for existing ADC offset setup when not found write 7 to read-only CV_7 in order to trigger a ADC offset measurement/calibration
* 3. Check for base PWM configuration/calibration, run calibration when none is found
*/
static void cv_setup_check();
/*!
* \brief Function initializes motor PWM for pin specified in CMakeLists.txt
* \param gpio GPIO pin
*/
static void init_motor_pwm(uint8_t gpio);
/*!
* \brief Initializes ADC
*
* Function initializes ADC, corresponding GPIO pins specified in CMakeLists.txt, also configures ADC FIFO.
*/
static void init_adc();
+393
View File
@@ -0,0 +1,393 @@
//////////////////////////
// RP2040-Decoder //
// Gabriel Koppenstein //
// core1.c //
//////////////////////////
#include "core1.h"
struct repeating_timer pid_control_timer, speed_helper_timer;
bool controller_flag, speed_helper_flag = false;
// Measures Back-EMF voltage (proportional to the rotational speed of the motor) on GPIO 28 and GPIO 29 respectively (depending on direction)
float measure(uint8_t total_iterations,
uint8_t measurement_delay_us,
uint8_t l_side_arr_cutoff,
uint8_t r_side_arr_cutoff,
direction_t direction){
uint32_t sum = 0;
uint16_t adc_val[total_iterations];
int32_t j = 0;
uint16_t key;
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
if (direction == DIRECTION_FORWARD) {
adc_select_input(FWD_V_EMF_ADC_CHANNEL);
} else if(direction == DIRECTION_REVERSE) {
adc_select_input(REV_V_EMF_ADC_CHANNEL);
} else{
set_error(INVALID_DIRECTION);
}
busy_wait_us(measurement_delay_us);
adc_run(true);
for (int32_t i = 0; i < total_iterations; ++i) {
//Take adc value out of fifo when available, then do one step of insertion sort.
adc_val[i] = adc_fifo_get_blocking();
key = adc_val[i];
j = i - 1;
while (j >= 0 && adc_val[j] > key) {
adc_val[j + 1] = adc_val[j];
j--;
}
adc_val[j + 1] = key;
}
adc_run(false);
//adc_fifo_drain();
//discard x entries beginning from the lowest entry of the array (counting up); x = msr.l_side_arr_cutoff
//discard y entries beginning from the highest index of the array (counting down); y = msr.r_side_arr_cutoff
for (int32_t i = l_side_arr_cutoff; i < total_iterations - r_side_arr_cutoff ; ++i) {
sum += adc_val[i];
}
float res = (float)sum / (float)( total_iterations - (l_side_arr_cutoff + r_side_arr_cutoff) );
// return true to keep the repeating timer active
return res;
}
// Get speed_step_table_index depending on speed_step
uint8_t get_speed_step_table_index_of_speed_step(uint8_t speed_step) {
// Clear direction information in bit7
speed_step = speed_step & 0b01111111;
// Check for Stop or Emergency Stop speed step
if (speed_step == 0 || speed_step == 1) {
return 0;
}
// In any other case i.e. speed steps 1 to 126:
return speed_step-1;
}
// This function gets called every x milliseconds where x is CV_175.
// The purpose of this function is to implement a time delay in acceleration or deceleration
void speed_helper(controller_parameter_t * ctrl_par) {
// ctrl_par->setpoint only gets adjusted when the speed_helper_counter is equal to the accel_rate/decel_rate
// -> Time for 1 Speed Step := (speed_helper timer delay)*(accel_rate) or CV_175*CV_3 or CV_175*CV_4
const uint8_t accel_rate = CV_ARRAY_FLASH[2];
const uint8_t decel_rate = CV_ARRAY_FLASH[3];
static uint8_t speed_helper_counter;
static uint8_t speed_table_index;
// Get speed_step_table_end_index corresponding to current speed_step_target
const uint8_t speed_step_table_end_index = get_speed_step_table_index_of_speed_step(speed_step_target);
const bool direction_changed = get_direction_of_speed_step(speed_step_target) !=
get_direction_of_speed_step(speed_step_target_prev);
if (speed_step_target == SPEED_STEP_FORWARD_EMERGENCY_STOP || speed_step_target == SPEED_STEP_REVERSE_EMERGENCY_STOP) {
// Emergency Stop
speed_table_index = 0;
speed_helper_counter = 0;
ctrl_par->setpoint = ctrl_par->speed_table[speed_table_index];
}
else if (speed_step_table_end_index > speed_table_index && speed_helper_counter == accel_rate) {
// Acceleration
if (!accel_rate) speed_table_index = speed_step_table_end_index; // directly accelerate to end target speed
else speed_table_index++;
ctrl_par->setpoint = ctrl_par->speed_table[speed_table_index];
speed_helper_counter = 0;
}
else if (speed_step_table_end_index < speed_table_index && speed_helper_counter == decel_rate) {
// Deceleration
if (!decel_rate) speed_table_index = speed_step_table_end_index; // directly decelerate to end target speed
else speed_table_index--;
ctrl_par->setpoint = ctrl_par->speed_table[speed_table_index];
speed_helper_counter = 0;
}
else if (direction_changed) {
// Change of direction while decelerating -> jump to most recent speed_step without delay (other direction)
speed_table_index = speed_step_table_end_index;
ctrl_par->setpoint = ctrl_par->speed_table[speed_table_index];
speed_helper_counter = 0;
}
else if (speed_step_table_end_index != speed_table_index) {
// Acceleration/Deceleration "scheduled"
speed_helper_counter++;
}
else {
// Target reached -> Reset Counter
speed_helper_counter = 0;
}
}
// Helper function to adjust pwm level/duty cycle.
void adjust_pwm_level(const uint16_t level) {
direction_t dir = get_direction_of_speed_step(speed_step_target);
if (dir == DIRECTION_FORWARD) {
// Forward
pwm_set_gpio_level(MOTOR_REV_PIN, 0);
pwm_set_gpio_level(MOTOR_FWD_PIN, level);
}
else if (dir == DIRECTION_REVERSE){
// Reverse
pwm_set_gpio_level(MOTOR_FWD_PIN, 0);
pwm_set_gpio_level(MOTOR_REV_PIN, level);
}
}
// Returns proportional gain value corresponding to current setpoint
float get_kp(const controller_parameter_t *const ctrl_par) {
const float sp = (float) ctrl_par->setpoint;
if (sp < ctrl_par->pid.k_p_x_1) {
return ctrl_par->pid.k_p_m_1 * sp + ctrl_par->pid.k_p_y_0;
}
return ctrl_par->pid.k_p_m_2 * (sp - ctrl_par->pid.k_p_x_1) + ctrl_par->pid.k_p_y_1;
}
uint16_t get_initial_level(controller_parameter_t *const ctrl_par){
uint32_t sum = 0;
uint32_t i = 0;
while (i < BASE_PWM_ARR_LEN) {
if (ctrl_par->startup.base_pwm_arr[i] > 0) {
sum += ctrl_par->startup.base_pwm_arr[i];
i++;
}
else {
break;
}
}
return ((sum / i)*2)/3;
}
// Controller - Startup mode
void controller_startup_mode(controller_parameter_t *const ctrl_par) {
if(ctrl_par->startup.level == 0) {
ctrl_par->startup.level = get_initial_level(ctrl_par);
}
if (ctrl_par->measurement_corrected < 7.5f){
const uint16_t max_level = _125M / (CV_ARRAY_FLASH[8] * 100 + 10000);
adjust_pwm_level(ctrl_par->startup.level);
ctrl_par->startup.level += max_level / 250;
if (ctrl_par->startup.level > max_level) {
// Try again with half value...
ctrl_par->startup.level = get_initial_level(ctrl_par)/2;
}
}
else {
// Save level value in array
ctrl_par->startup.base_pwm_arr[ctrl_par->startup.base_pwm_arr_i] = ctrl_par->startup.level;
// Update index
ctrl_par->startup.base_pwm_arr_i = (ctrl_par->startup.base_pwm_arr_i+1)%BASE_PWM_ARR_LEN;
// Set ramp_up_mode flag to true
ctrl_par->mode = PID_MODE;
// Multiply with k_ff constant and set as current feed forward value
ctrl_par->feed_fwd = ctrl_par->startup.k_ff * (float)ctrl_par->startup.level;
}
}
// Controller - PID control mode
void controller_pid_mode(controller_parameter_t *const ctrl_par) {
ctrl_par->pid.k_p = get_kp(ctrl_par);
// Proportional part, integral part and derivative part (including digital low-pass-filter with time constant tau)
float p = ctrl_par->pid.k_p * ctrl_par->pid.e;
float i = ctrl_par->pid.ci_0 * (ctrl_par->pid.e + ctrl_par->pid.e_prev) + ctrl_par->pid.i_prev;
float d = ctrl_par->pid.cd_0 * (ctrl_par->measurement - ctrl_par->measurement_prev) + ctrl_par->pid.cd_1 * ctrl_par->pid.d_prev;
// Check for limits on the integral part
if (i > ctrl_par->pid.int_lim_max) {
i = ctrl_par->pid.int_lim_max;
}
else if (i < ctrl_par->pid.int_lim_min) {
i = ctrl_par->pid.int_lim_min;
}
// Sum feed forward + all controller terms (p+i+d). Limit Output from 0% to 100% duty cycle
float output_f = ctrl_par->feed_fwd + p + i + d;
if (output_f < 0) {
output_f = 0.0f;
}
else if (output_f > ctrl_par->pid.max_output) {
output_f = ctrl_par->pid.max_output;
}
if (LOGLEVEL >= 1) {
static int counter = 0;
counter++;
if (counter > 200) {
LOG(1, "ctrl_par error(%f) output(%f)\n", ctrl_par->pid.e, output_f);
counter = 0;
}
}
// Set PWM Level and discard results in adc fifo
//adjust_pwm_level((uint16_t) roundf(output_f));
adjust_pwm_level((uint16_t) output_f);
// Save previous error, integrator, differentiator values
ctrl_par->pid.e_prev = ctrl_par->pid.e;
ctrl_par->pid.i_prev = i;
ctrl_par->pid.d_prev = d;
}
// General controller function gets called every x milliseconds where x is CV_49 i.e. sampling time (pid->t)
void controller_general(controller_parameter_t * ctrl_par) {
// Change in direction -> reset previous derivative, error and integral parts and pwm_base_done
const bool direction_changed = get_direction_of_speed_step(speed_step_target) !=
get_direction_of_speed_step(speed_step_target_prev);
// When setpoint == 0 there is nothing to control -> set output to 0, reset values and return
if (!ctrl_par->setpoint || direction_changed) {
ctrl_par->pid.d_prev = 0.0f;
ctrl_par->pid.i_prev = 0.0f;
ctrl_par->pid.e_prev = 0.0f;
ctrl_par->mode = STARTUP_MODE;
ctrl_par->startup.level = 0;
adjust_pwm_level(0);
return;
}
// Measure BEMF voltage and compute error
ctrl_par->measurement = measure(ctrl_par->msr_total_iterations,
ctrl_par->msr_delay_in_us,
ctrl_par->l_side_arr_cutoff,
ctrl_par->r_side_arr_cutoff,
get_direction_of_speed_step(speed_step_target));
ctrl_par->measurement_corrected = ctrl_par->measurement - ctrl_par->adc_offset;
ctrl_par->pid.e = (float) ctrl_par->setpoint - ctrl_par->measurement_corrected;
switch (ctrl_par->mode){
case STARTUP_MODE:
controller_startup_mode(ctrl_par);
break;
case PID_MODE:
controller_pid_mode(ctrl_par);
break;
}
adc_fifo_drain();
// Save measurement value
ctrl_par->measurement_prev = ctrl_par->measurement;
}
// PID controller and measurement parameter, and speed_table initialization
void init_controller(controller_parameter_t *const ctrl_par) {
LOG(1, "Motor controller initialization...\n")
// General controller variables
ctrl_par->mode = STARTUP_MODE;
ctrl_par->measurement = 0.0f;
ctrl_par->measurement_prev = 0.0f;
ctrl_par->measurement_corrected = 0.0f;
ctrl_par->setpoint = 0;
ctrl_par->feed_fwd = 0;
// Startup controller variables
ctrl_par->startup.level = 0;
ctrl_par->startup.base_pwm_arr_i = 0;
ctrl_par->startup.k_ff = (float) CV_ARRAY_FLASH[46]/255;
for (int i = 0; i < BASE_PWM_ARR_LEN; ++i) {
ctrl_par->startup.base_pwm_arr[i] = 0;
}
// Measurement variables initialization
ctrl_par->adc_offset = (float) CV_ARRAY_FLASH[171];
ctrl_par->msr_total_iterations = CV_ARRAY_FLASH[60];
ctrl_par->msr_delay_in_us = CV_ARRAY_FLASH[61];
ctrl_par->l_side_arr_cutoff = CV_ARRAY_FLASH[62];
ctrl_par->r_side_arr_cutoff = CV_ARRAY_FLASH[63];
// Speed table initialization
// Calculate speed setpoint table according to V_min, V_max and V_mid CVs
const double v_min = (double) CV_ARRAY_FLASH[1];
const double v_mid = (double) CV_ARRAY_FLASH[5] * 16;
const double v_max = (double) CV_ARRAY_FLASH[4] * 16;
const double delta_x = 63;
const double m_1 = (v_mid - v_min) / delta_x;
const double m_2 = (v_max - v_mid) / delta_x;
ctrl_par->speed_table[0] = 0;
for (uint8_t i = 1; i < 64; ++i) {
ctrl_par->speed_table[i] = (uint16_t) lround(m_1 * (i - 1) + v_min);
}
for (uint8_t i = 64; i < 127; ++i) {
ctrl_par->speed_table[i] = (uint16_t) lround(m_2 * (i - 63) + v_mid);
}
// PID Controller initialization
ctrl_par->pid.k_i = (float) CV_ARRAY_FLASH[49] / 10;
ctrl_par->pid.k_d = (float) CV_ARRAY_FLASH[50] / 10000;
ctrl_par->pid.tau = (float) CV_ARRAY_FLASH[47] / 1000;
ctrl_par->pid.t = (float) CV_ARRAY_FLASH[48] / 1000;
ctrl_par->pid.ci_0 = (ctrl_par->pid.k_i * ctrl_par->pid.t) / 2;
ctrl_par->pid.cd_0 = -(2 * ctrl_par->pid.k_d) / (2 * ctrl_par->pid.tau + ctrl_par->pid.t);
ctrl_par->pid.cd_1 = (2 * ctrl_par->pid.tau - ctrl_par->pid.t) / (2 * ctrl_par->pid.tau + ctrl_par->pid.t);
ctrl_par->pid.int_lim_max = 10 * (float) CV_ARRAY_FLASH[51];
ctrl_par->pid.int_lim_min = -10 * (float) CV_ARRAY_FLASH[52];
ctrl_par->pid.max_output = (float) (_125M / (CV_ARRAY_FLASH[8] * 100 + 10000));
ctrl_par->pid.e_prev = 0.0f;
ctrl_par->pid.i_prev = 0.0f;
ctrl_par->pid.d_prev = 0.0f;
ctrl_par->pid.k_p_x_1_shift = (float) CV_ARRAY_FLASH[59] / 255.0f;
ctrl_par->pid.k_p_x_1 = (float) ctrl_par->speed_table[126] * ctrl_par->pid.k_p_x_1_shift;
ctrl_par->pid.k_p_x_2 = (float) ctrl_par->speed_table[126] * (1.0f - ctrl_par->pid.k_p_x_1_shift);
ctrl_par->pid.k_p_y_0 = (float) get_16bit_CV(53) / 100.0f;
ctrl_par->pid.k_p_y_1 = (float) get_16bit_CV(55) / 100.0f;
ctrl_par->pid.k_p_y_2 = (float) get_16bit_CV(57) / 100.0f;
ctrl_par->pid.k_p_m_1 = (ctrl_par->pid.k_p_y_1 - ctrl_par->pid.k_p_y_0) / ctrl_par->pid.k_p_x_1;
ctrl_par->pid.k_p_m_2 = (ctrl_par->pid.k_p_y_2 - ctrl_par->pid.k_p_y_1) / ctrl_par->pid.k_p_x_2;
LOG(1, "Motor controller initialization done!\n")
}
bool controller_timer_callback(__unused struct repeating_timer *t) {
controller_flag = true;
return true;
}
bool speed_helper_timer_callback(__unused struct repeating_timer *t) {
speed_helper_flag = true;
return true;
}
void core1_entry() {
LOG(1, "core1 Initialization...\n");
flash_safe_execute_core_init_done = flash_safe_execute_core_init();
if (flash_safe_execute_core_init_done != true){
set_error(FLASH_SAFE_EXECUTE_CORE_INIT_FAILURE);
panic("Error calling flash_safe_execute_core_init() on core1!");
return;
}
// Wait for core0 to finish CV check (see cv_setup_check)
LOG(1, "Waiting for CV check flag...\n");
while(!cv_setup_check_done){
watchdog_update(); // Update watchdog while waiting on core0
}
controller_parameter_t control_parameter;
controller_parameter_t *ctrl_par = &control_parameter;
init_controller(ctrl_par);
struct repeating_timer timer_controller, timer_speed_helper;
add_repeating_timer_ms(-CV_ARRAY_FLASH[48], controller_timer_callback, NULL, &timer_controller);
add_repeating_timer_ms(-CV_ARRAY_FLASH[174], speed_helper_timer_callback, NULL, &timer_speed_helper);
LOG(1, "core1 initialization done!\n");
// Endless loop
while (true) {
if (controller_flag) {
controller_general(ctrl_par);
controller_flag = false;
}
else if (speed_helper_flag) {
speed_helper(ctrl_par);
speed_helper_flag = false;
}
else {
watchdog_update();
}
}
}
+211
View File
@@ -0,0 +1,211 @@
/*!
*
* \file core1.h
* Used exclusively by core1
*
*/
#pragma once
#include "shared.h"
/**
* @def BASE_PWM_ARR_LEN
* @brief The length of the base PWM array.
*
* This macro defines the length of the base PWM ring buffer array.
*/
#define BASE_PWM_ARR_LEN 16
/**
* @brief Enumeration for controller operating modes.
*
* Defines the two controller operating modes.
*
* @enum controller_mode_t
*/
typedef enum {
STARTUP_MODE, /**< Controller startup mode state */
PID_MODE, /**< Controller pid mode state */
} controller_mode_t;
/**
* @brief Structure for startup controller parameters and variables.
*
* This structure defines the parameters and variables used in the startup
* controller, including the latest PWM level, base pwm level ring buffer array and the respective ring buffer index.
*
* @typedef startup_parameters_t
* @struct startup_parameters_t
*/
typedef struct startup_parameters_t {
uint16_t level; /**< Latest level */
uint16_t base_pwm_arr[BASE_PWM_ARR_LEN]; /**< base pwm ring buffer array */
uint16_t base_pwm_arr_i; /**< base pwm ring buffer array index */
float k_ff; /**< Feed forward factor */
}startup_parameters_t;
/**
* @brief Structure for PID controller parameters and variables.
*
* This structure defines the parameters and variables used in the PID
* controller, including gains, error tracking, integrator limits, ...
*
* @typedef pid_parameters_t
* @struct pid_parameters_t
*/
typedef struct pid_parameters_t{
// PID Controller variables
float k_i; /**< Integral gain */
float k_d; /**< Derivative gain */
float t; /**< Sampling time */
float tau; /**< Low-pass-filter time constant */
float ci_0; /**< (k_i*t)/2 */
float cd_0; /**< (k_d*2)/(2*tau+t) */
float cd_1; /**< (2*tau-t)/(2*tau+t) */
float int_lim_max; /**< max limit for integrator */
float int_lim_min; /**< min limit for integrator */
float max_output; /**< max possible pwm output value */
float k_p; /**< Proportional gain */
float e; /**< Error */
float e_prev; /**< Previous Error */
float i_prev; /**< Previous Integral Value */
float d_prev; /**< Previous Derivative Value */
// Variable gain variables - See gain scheduling documentation for more details
float k_p_x_1_shift; /**< Effectively defines where x1 is shifted from 0% of max setpoint to 100% of max setpoint */
float k_p_x_1; /**< x1 */
float k_p_x_2; /**< x2 */
float k_p_y_0; /**< y0 = KP @ x0 */
float k_p_y_1; /**< y1 = KP @ x1 */
float k_p_y_2; /**< y2 = KP @ x2 */
float k_p_m_1; /**< slope from (x0, y0) to (x1, y1) */
float k_p_m_2; /**< slope from (x1, y1) to (x2, y2) */
} pid_parameters_t;
/**
* @brief Structure for various controller parameters.
*
* This structure defines the highest level general controller parameters, including
* General settings (setpoint, mode), startup controller settings struct, PID controller struct, and measurement data.
*
* @typedef controller_parameter_t
* @struct controller_parameter_t
*/
typedef struct controller_parameter_t{
// General controller parameters
controller_mode_t mode; /**< Current controller mode */
float feed_fwd; /**< Current feed forward value set by startup controller */
uint32_t setpoint; /**< Current setpoint */
uint16_t speed_table[127]; /**< Array with setpoint values corresponding to every speed step */
// Startup controller parameters
startup_parameters_t startup; /**< Struct for startup controller specific variables */
// PID controller parameters
pid_parameters_t pid; /**< Struct for PID controller specific variables */
// Measurement variables
float measurement; /**< Latest measurement value */
float measurement_prev; /**< Previous measurement value */
float measurement_corrected; /**< Corrected measurement value (measurement - adc_offset = measurement_corrected) */
float adc_offset; /**< ADC offset value */
uint8_t msr_delay_in_us; /**< Delay before V_EMF is measured */
uint8_t msr_total_iterations; /**< Amount of samples */
uint8_t l_side_arr_cutoff; /**< Discarded outlier samples (left side) */
uint8_t r_side_arr_cutoff; /**< Discarded outlier samples (right side) */
} controller_parameter_t;
/**
* @brief Measures Back-EMF voltage (proportional to the rotational speed of the motor) on GPIO 28 and GPIO 29 respectively (depending on direction).
*
* This function performs multiple ADC measurements, sorts the results using insertion sort, and calculates the average of the middle values,
* discarding a specified number of the lowest and highest values.
*
* @param total_iterations The total number of ADC measurements to perform.
* @param measurement_delay_us The delay in microseconds between the switch-off of the motor PWM and the measurement.
* @param l_side_arr_cutoff The number of lowest ADC values to discard.
* @param r_side_arr_cutoff The number of highest ADC values to discard.
* @param direction The direction of the motor.
* @return The average of the middle ADC values after discarding the specified number of lowest and highest values.
*/
float measure(uint8_t total_iterations,
uint8_t measurement_delay_us,
uint8_t l_side_arr_cutoff,
uint8_t r_side_arr_cutoff,
direction_t direction);
/**
* @brief Get the speed step table index based on the speed step value.
*
* @param speed_step The speed step value.
* @return The index in the speed step table.
*/
uint8_t get_speed_step_table_index_of_speed_step(uint8_t speed_step);
/**
* @brief Repeating timer callback function called every x milliseconds to implement a time delay in acceleration or deceleration.
*
* x is CV_175
*
* @param ctrl_par Pointer to the controller parameter structure.
*/
void speed_helper(controller_parameter_t * ctrl_par);
/**
* @brief Function to adjust the PWM level/duty cycle.
*
* @param level The new PWM level.
*/
void adjust_pwm_level(uint16_t level);
/**
* @brief Function to calculate and return the proportional gain based on the speed step.
*
* This is done in order to make kp dependent on the speed step (gain scheduling).
*
* @param ctrl_par Pointer to the controller parameter structure.
* @return The proportional gain.
*/
float get_kp(const controller_parameter_t *ctrl_par);
/**
* @brief Calculate and return the initial PWM level.
*
* Calculation is done by taking the last 16 initial levels (when available) and calculating the average.
* The average is the multiplied by a factor of 2/3.
*
* @param ctrl_par Pointer to the controller parameter structure.
* @return The initial PWM level.
*/
uint16_t get_initial_level(controller_parameter_t * ctrl_par);
/**
* @brief Controller function for startup mode.
*
* This is called inside the controller_general() function when the controller mode is set to STARTUP_MODE.
*
* @param ctrl_par Pointer to the controller parameter structure.
*/
void controller_startup_mode(controller_parameter_t * ctrl_par);
/**
* @brief Controller function for PID mode.
*
* This is called inside the controller_general() function when the controller mode is set to PID_MODE.
*
* @param ctrl_par Pointer to the controller parameter structure.
*/
void controller_pid_mode(controller_parameter_t *const ctrl_par);
/**
* @brief General controller function called every x milliseconds.
*
* @param ctrl_par Pointer to the controller parameter structure.
*/
void controller_general(controller_parameter_t * ctrl_par);
/**
* @brief Initialize controller variables, measurement parameters, and speed table.
*
* @param ctrl_par Pointer to the controller parameter structure.
*/
void init_controller(controller_parameter_t * ctrl_par);
+84
View File
@@ -0,0 +1,84 @@
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
endif ()
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
endif()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
)
endif ()
if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else ()
message(FATAL_ERROR
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
)
endif ()
endif ()
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PICO_SDK_PATH})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
endif ()
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
endif ()
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
include(${PICO_SDK_INIT_CMAKE_FILE})
+65
View File
@@ -0,0 +1,65 @@
# Check if the required arguments are provided
if(NOT DEFINED BOARD_HEADER)
message(FATAL_ERROR "BOARD_HEADER argument is missing")
else()
message(STATUS "BOARD_HEADER: ${BOARD_HEADER}")
endif()
if(NOT DEFINED SIZE_TOOL)
message(FATAL_ERROR "SIZE_TOOL argument is missing")
else()
message(STATUS "SIZE_TOOL: ${SIZE_TOOL}")
endif()
if(NOT DEFINED ELF_FILE)
message(FATAL_ERROR "ELF_FILE argument is missing")
else()
message(STATUS "ELF_FILE: ${ELF_FILE}")
endif()
# Post build checks
# Run the size tool and read the output
execute_process(
COMMAND ${SIZE_TOOL} "${ELF_FILE}"
OUTPUT_VARIABLE SIZE_OUTPUT
RESULT_VARIABLE SIZE_RESULT
)
if(SIZE_RESULT)
message(FATAL_ERROR "Failed to run arm-none-eabi-size on ${ELF_FILE}")
else()
# Print the content of SIZE_OUTPUT
message(STATUS "arm-none-eabi-size output:\n${SIZE_OUTPUT}")
endif()
# Use regex to match all numbers
string(REGEX MATCHALL "[0-9]+" MATCHED_VALUES "${SIZE_OUTPUT}")
# Get third element from list of matches, this corresponds with dec table value in "size_output.txt"
list(GET MATCHED_VALUES 3 PROGRAM_SIZE_DEC)
# Check for success of program size extraction from "size_output.txt"
if(PROGRAM_SIZE_DEC)
message(STATUS "PROGRAM_SIZE_DEC: ${PROGRAM_SIZE_DEC} bytes")
else()
message(FATAL_ERROR "Could not extract program size from size_output.txt")
endif()
# Path to the header file that defines PICO_FLASH_SIZE_BYTES
set(FLASH_CONFIG_HEADER ${BOARD_HEADER})
# Read the contents of the header file into a variable
file(READ ${FLASH_CONFIG_HEADER} HEADER_CONTENT)
# Extract the value of PICO_FLASH_SIZE_BYTES using a regular expression
string(REGEX MATCHALL "#define PICO_FLASH_SIZE_BYTES [0-9]+" MACRO_MATCH "${HEADER_CONTENT}")
string(REGEX MATCHALL "[0-9]+" PICO_FLASH_SIZE_BYTES "${MACRO_MATCH}")
# Check for success of PICO_FLASH_SIZE_BYTES extraction from board header file
if(PICO_FLASH_SIZE_BYTES)
message(STATUS "PICO_FLASH_SIZE_BYTES: ${PICO_FLASH_SIZE_BYTES} bytes")
else()
message(FATAL_ERROR "Failed to find PICO_FLASH_SIZE_BYTES in the header file.")
endif()
# Sector size is always 4096 bytes
set(FLASH_SECTOR_SIZE 4096)
message(STATUS "FLASH_SECTOR_SIZE: ${FLASH_SECTOR_SIZE} bytes")
# Subtract flash sector size from flash size
math(EXPR FLASH_TARGET_OFFSET "${PICO_FLASH_SIZE_BYTES} - ${FLASH_SECTOR_SIZE}")
message(STATUS "FLASH_TARGET_OFFSET: ${FLASH_TARGET_OFFSET} bytes")
if(PROGRAM_SIZE_DEC GREATER FLASH_TARGET_OFFSET)
message(FATAL_ERROR "Program size exceeds allowed flash size. Flash sector containing the CVs would be overwritten! Please reduce the size of the program.")
endif()
+66
View File
@@ -0,0 +1,66 @@
//////////////////////////
// RP2040-Decoder //
// Gabriel Koppenstein //
// shared.c //
//////////////////////////
#include "shared.h"
// TODO: Implement getter and setter functions for speed steps, checking validity of speed step values.
speed_step_t speed_step_target = SPEED_STEP_REVERSE_STOP;
speed_step_t speed_step_target_prev = SPEED_STEP_REVERSE_STOP;
bool cv_setup_check_done = false;
bool flash_safe_execute_core_init_done = false;
error_t error_state = 0;
// Functions in shared.c are accessed by both cores
// retrieve 4Bytes from CV_ARRAY_FLASH at once and return 32-Bit value
uint32_t get_32bit_CV (uint16_t CV_start_index){
uint8_t byte_3 = CV_ARRAY_FLASH[CV_start_index];
uint8_t byte_2 = CV_ARRAY_FLASH[CV_start_index+1];
uint8_t byte_1 = CV_ARRAY_FLASH[CV_start_index+2];
uint8_t byte_0 = CV_ARRAY_FLASH[CV_start_index+3];
return (byte_0) + (byte_1<<8) + (byte_2<<16) + (byte_3<<24);
}
// retrieve 2Bytes from CV_ARRAY_FLASH at once and return 16-Bit value
uint16_t get_16bit_CV (uint16_t CV_start_index){
uint8_t byte_1 = CV_ARRAY_FLASH[CV_start_index];
uint8_t byte_0 = CV_ARRAY_FLASH[CV_start_index+1];
return (byte_0) + (byte_1<<8);
}
direction_t get_direction_of_speed_step(speed_step_t speed_step){
// Bit 7 is the direction bit.
// Shift by 7 bits to move bit7 into bit0 position and return direction.
return speed_step >> 7;
}
void set_error(error_t err){
error_state |= err;
#ifdef RP2040_DECODER_DEFAULT_LED_PIN
gpio_put(RP2040_DECODER_DEFAULT_LED_PIN, true);
#endif
}
void clear_error(error_t err){
error_state &= (~err);
if (error_state == 0){
#ifdef RP2040_DECODER_DEFAULT_LED_PIN
gpio_put(RP2040_DECODER_DEFAULT_LED_PIN, false);
#endif
}
}
void clear_all_errors(){
error_state = 0;
#ifdef RP2040_DECODER_DEFAULT_LED_PIN
gpio_put(RP2040_DECODER_DEFAULT_LED_PIN, false);
#endif
}
error_t get_error_state(){
return error_state;
}
+480
View File
@@ -0,0 +1,480 @@
/*!
*
* \file shared.h
* Used by both cores
*
*/
#pragma once
#include "string.h"
#include "pico/float.h"
#include "pico/stdlib.h"
#include "pico/multicore.h"
#include "pico/printf.h"
#include "pico/flash.h"
#include "hardware/pwm.h"
#include "hardware/adc.h"
#include "hardware/flash.h"
#include "hardware/gpio.h"
#include "hardware/watchdog.h"
#include "hardware/exception.h"
/**
* @brief Logs a message with a specified log level.
*
* This macro logs a message if the specified log level is less than or equal to the global LOGLEVEL.
* The log message includes the core number and the time since boot in milliseconds.
*
* @param level The log level of the message.
* @param ... The format string and arguments for the log message.
*/
#define LOG(level, ...) { \
if (level <= LOGLEVEL) { \
printf("[core%u @ %u ms] ", get_core_num(), to_ms_since_boot(get_absolute_time())); \
printf(__VA_ARGS__); \
} \
}
/**
* @def _125M
* @brief Constant value representing 125 million (125 x 10^6).
*/
#define _125M 125000000
/**
* @enum error_t
* @brief Enumeration of error codes used in the system.
*
* This enumeration defines various error codes that can be encountered
* during the execution of the program. Each error code is represented
* as a bit flag, allowing multiple errors to be combined using bitwise
* operations.
*
*/
typedef enum {
FLASH_SAFE_EXECUTE_CORE_INIT_FAILURE = (1<<0), /**< Indicates a failure during the initialization of the flash safe execute mode. */
FLASH_SAFE_EXECUTE_ERASE_FAILURE = (1<<1), /**< Indicates a failure during the erase operation in flash safe execute mode. */
FLASH_SAFE_EXECUTE_PROGRAM_FAILURE = (1<<2), /**< Indicates a failure during the program operation in flash safe execute mode. */
FLASH_SIZE_READBACK_FAILURE = (1<<3), /**< Indicates a failure in reading back the flash size. */
STDIO_INIT_FAILURE = (1<<4), /**< Indicates a failure during the initialization of stdio. */
REBOOT_BY_WATCHDOG = (1<<5), /**< Indicates that the system rebooted due to the watchdog timer. */
INVALID_DIRECTION = (1<<6), /**< Indicates an invalid direction was specified. */
} error_t;
/**
* @enum direction_t
* @brief Enumeration for motor direction.
*
*/
typedef enum {
DIRECTION_FORWARD = 1, /**< Represents the forward direction */
DIRECTION_REVERSE = 0, /**< Represents the reverse direction. */
} direction_t;
/**
* @brief Enum to define all speed steps.
*
*/
typedef enum {
SPEED_STEP_REVERSE_STOP = 0x00, /**< 00000000bin 000dec */
SPEED_STEP_REVERSE_EMERGENCY_STOP = 0x01, /**< 00000001bin 001dec */
SPEED_STEP_REVERSE_001 = 0x02, /**< 00000010bin 002dec */
SPEED_STEP_REVERSE_002 = 0x03, /**< 00000011bin 003dec */
SPEED_STEP_REVERSE_003 = 0x04, /**< 00000100bin 004dec */
SPEED_STEP_REVERSE_004 = 0x05, /**< 00000101bin 005dec */
SPEED_STEP_REVERSE_005 = 0x06, /**< 00000110bin 006dec */
SPEED_STEP_REVERSE_006 = 0x07, /**< 00000111bin 007dec */
SPEED_STEP_REVERSE_007 = 0x08, /**< 00001000bin 008dec */
SPEED_STEP_REVERSE_008 = 0x09, /**< 00001001bin 009dec */
SPEED_STEP_REVERSE_009 = 0x0A, /**< 00001010bin 010dec */
SPEED_STEP_REVERSE_010 = 0x0B, /**< 00001011bin 011dec */
SPEED_STEP_REVERSE_011 = 0x0C, /**< 00001100bin 012dec */
SPEED_STEP_REVERSE_012 = 0x0D, /**< 00001101bin 013dec */
SPEED_STEP_REVERSE_013 = 0x0E, /**< 00001110bin 014dec */
SPEED_STEP_REVERSE_014 = 0x0F, /**< 00001111bin 015dec */
SPEED_STEP_REVERSE_015 = 0x10, /**< 00010000bin 016dec */
SPEED_STEP_REVERSE_016 = 0x11, /**< 00010001bin 017dec */
SPEED_STEP_REVERSE_017 = 0x12, /**< 00010010bin 018dec */
SPEED_STEP_REVERSE_018 = 0x13, /**< 00010011bin 019dec */
SPEED_STEP_REVERSE_019 = 0x14, /**< 00010100bin 020dec */
SPEED_STEP_REVERSE_020 = 0x15, /**< 00010101bin 021dec */
SPEED_STEP_REVERSE_021 = 0x16, /**< 00010110bin 022dec */
SPEED_STEP_REVERSE_022 = 0x17, /**< 00010111bin 023dec */
SPEED_STEP_REVERSE_023 = 0x18, /**< 00011000bin 024dec */
SPEED_STEP_REVERSE_024 = 0x19, /**< 00011001bin 025dec */
SPEED_STEP_REVERSE_025 = 0x1A, /**< 00011010bin 026dec */
SPEED_STEP_REVERSE_026 = 0x1B, /**< 00011011bin 027dec */
SPEED_STEP_REVERSE_027 = 0x1C, /**< 00011100bin 028dec */
SPEED_STEP_REVERSE_028 = 0x1D, /**< 00011101bin 029dec */
SPEED_STEP_REVERSE_029 = 0x1E, /**< 00011110bin 030dec */
SPEED_STEP_REVERSE_030 = 0x1F, /**< 00011111bin 031dec */
SPEED_STEP_REVERSE_031 = 0x20, /**< 00100000bin 032dec */
SPEED_STEP_REVERSE_032 = 0x21, /**< 00100001bin 033dec */
SPEED_STEP_REVERSE_033 = 0x22, /**< 00100010bin 034dec */
SPEED_STEP_REVERSE_034 = 0x23, /**< 00100011bin 035dec */
SPEED_STEP_REVERSE_035 = 0x24, /**< 00100100bin 036dec */
SPEED_STEP_REVERSE_036 = 0x25, /**< 00100101bin 037dec */
SPEED_STEP_REVERSE_037 = 0x26, /**< 00100110bin 038dec */
SPEED_STEP_REVERSE_038 = 0x27, /**< 00100111bin 039dec */
SPEED_STEP_REVERSE_039 = 0x28, /**< 00101000bin 040dec */
SPEED_STEP_REVERSE_040 = 0x29, /**< 00101001bin 041dec */
SPEED_STEP_REVERSE_041 = 0x2A, /**< 00101010bin 042dec */
SPEED_STEP_REVERSE_042 = 0x2B, /**< 00101011bin 043dec */
SPEED_STEP_REVERSE_043 = 0x2C, /**< 00101100bin 044dec */
SPEED_STEP_REVERSE_044 = 0x2D, /**< 00101101bin 045dec */
SPEED_STEP_REVERSE_045 = 0x2E, /**< 00101110bin 046dec */
SPEED_STEP_REVERSE_046 = 0x2F, /**< 00101111bin 047dec */
SPEED_STEP_REVERSE_047 = 0x30, /**< 00110000bin 048dec */
SPEED_STEP_REVERSE_048 = 0x31, /**< 00110001bin 049dec */
SPEED_STEP_REVERSE_049 = 0x32, /**< 00110010bin 050dec */
SPEED_STEP_REVERSE_050 = 0x33, /**< 00110011bin 051dec */
SPEED_STEP_REVERSE_051 = 0x34, /**< 00110100bin 052dec */
SPEED_STEP_REVERSE_052 = 0x35, /**< 00110101bin 053dec */
SPEED_STEP_REVERSE_053 = 0x36, /**< 00110110bin 054dec */
SPEED_STEP_REVERSE_054 = 0x37, /**< 00110111bin 055dec */
SPEED_STEP_REVERSE_055 = 0x38, /**< 00111000bin 056dec */
SPEED_STEP_REVERSE_056 = 0x39, /**< 00111001bin 057dec */
SPEED_STEP_REVERSE_057 = 0x3A, /**< 00111010bin 058dec */
SPEED_STEP_REVERSE_058 = 0x3B, /**< 00111011bin 059dec */
SPEED_STEP_REVERSE_059 = 0x3C, /**< 00111100bin 060dec */
SPEED_STEP_REVERSE_060 = 0x3D, /**< 00111101bin 061dec */
SPEED_STEP_REVERSE_061 = 0x3E, /**< 00111110bin 062dec */
SPEED_STEP_REVERSE_062 = 0x3F, /**< 00111111bin 063dec */
SPEED_STEP_REVERSE_063 = 0x40, /**< 01000000bin 064dec */
SPEED_STEP_REVERSE_064 = 0x41, /**< 01000001bin 065dec */
SPEED_STEP_REVERSE_065 = 0x42, /**< 01000010bin 066dec */
SPEED_STEP_REVERSE_066 = 0x43, /**< 01000011bin 067dec */
SPEED_STEP_REVERSE_067 = 0x44, /**< 01000100bin 068dec */
SPEED_STEP_REVERSE_068 = 0x45, /**< 01000101bin 069dec */
SPEED_STEP_REVERSE_069 = 0x46, /**< 01000110bin 070dec */
SPEED_STEP_REVERSE_070 = 0x47, /**< 01000111bin 071dec */
SPEED_STEP_REVERSE_071 = 0x48, /**< 01001000bin 072dec */
SPEED_STEP_REVERSE_072 = 0x49, /**< 01001001bin 073dec */
SPEED_STEP_REVERSE_073 = 0x4A, /**< 01001010bin 074dec */
SPEED_STEP_REVERSE_074 = 0x4B, /**< 01001011bin 075dec */
SPEED_STEP_REVERSE_075 = 0x4C, /**< 01001100bin 076dec */
SPEED_STEP_REVERSE_076 = 0x4D, /**< 01001101bin 077dec */
SPEED_STEP_REVERSE_077 = 0x4E, /**< 01001110bin 078dec */
SPEED_STEP_REVERSE_078 = 0x4F, /**< 01001111bin 079dec */
SPEED_STEP_REVERSE_079 = 0x50, /**< 01010000bin 080dec */
SPEED_STEP_REVERSE_080 = 0x51, /**< 01010001bin 081dec */
SPEED_STEP_REVERSE_081 = 0x52, /**< 01010010bin 082dec */
SPEED_STEP_REVERSE_082 = 0x53, /**< 01010011bin 083dec */
SPEED_STEP_REVERSE_083 = 0x54, /**< 01010100bin 084dec */
SPEED_STEP_REVERSE_084 = 0x55, /**< 01010101bin 085dec */
SPEED_STEP_REVERSE_085 = 0x56, /**< 01010110bin 086dec */
SPEED_STEP_REVERSE_086 = 0x57, /**< 01010111bin 087dec */
SPEED_STEP_REVERSE_087 = 0x58, /**< 01011000bin 088dec */
SPEED_STEP_REVERSE_088 = 0x59, /**< 01011001bin 089dec */
SPEED_STEP_REVERSE_089 = 0x5A, /**< 01011010bin 090dec */
SPEED_STEP_REVERSE_090 = 0x5B, /**< 01011011bin 091dec */
SPEED_STEP_REVERSE_091 = 0x5C, /**< 01011100bin 092dec */
SPEED_STEP_REVERSE_092 = 0x5D, /**< 01011101bin 093dec */
SPEED_STEP_REVERSE_093 = 0x5E, /**< 01011110bin 094dec */
SPEED_STEP_REVERSE_094 = 0x5F, /**< 01011111bin 095dec */
SPEED_STEP_REVERSE_095 = 0x60, /**< 01100000bin 096dec */
SPEED_STEP_REVERSE_096 = 0x61, /**< 01100001bin 097dec */
SPEED_STEP_REVERSE_097 = 0x62, /**< 01100010bin 098dec */
SPEED_STEP_REVERSE_098 = 0x63, /**< 01100011bin 099dec */
SPEED_STEP_REVERSE_099 = 0x64, /**< 01100100bin 100dec */
SPEED_STEP_REVERSE_100 = 0x65, /**< 01100101bin 101dec */
SPEED_STEP_REVERSE_101 = 0x66, /**< 01100110bin 102dec */
SPEED_STEP_REVERSE_102 = 0x67, /**< 01100111bin 103dec */
SPEED_STEP_REVERSE_103 = 0x68, /**< 01101000bin 104dec */
SPEED_STEP_REVERSE_104 = 0x69, /**< 01101001bin 105dec */
SPEED_STEP_REVERSE_105 = 0x6A, /**< 01101010bin 106dec */
SPEED_STEP_REVERSE_106 = 0x6B, /**< 01101011bin 107dec */
SPEED_STEP_REVERSE_107 = 0x6C, /**< 01101100bin 108dec */
SPEED_STEP_REVERSE_108 = 0x6D, /**< 01101101bin 109dec */
SPEED_STEP_REVERSE_109 = 0x6E, /**< 01101110bin 110dec */
SPEED_STEP_REVERSE_110 = 0x6F, /**< 01101111bin 111dec */
SPEED_STEP_REVERSE_111 = 0x70, /**< 01110000bin 112dec */
SPEED_STEP_REVERSE_112 = 0x71, /**< 01110001bin 113dec */
SPEED_STEP_REVERSE_113 = 0x72, /**< 01110010bin 114dec */
SPEED_STEP_REVERSE_114 = 0x73, /**< 01110011bin 115dec */
SPEED_STEP_REVERSE_115 = 0x74, /**< 01110100bin 116dec */
SPEED_STEP_REVERSE_116 = 0x75, /**< 01110101bin 117dec */
SPEED_STEP_REVERSE_117 = 0x76, /**< 01110110bin 118dec */
SPEED_STEP_REVERSE_118 = 0x77, /**< 01110111bin 119dec */
SPEED_STEP_REVERSE_119 = 0x78, /**< 01111000bin 120dec */
SPEED_STEP_REVERSE_120 = 0x79, /**< 01111001bin 121dec */
SPEED_STEP_REVERSE_121 = 0x7A, /**< 01111010bin 122dec */
SPEED_STEP_REVERSE_122 = 0x7B, /**< 01111011bin 123dec */
SPEED_STEP_REVERSE_123 = 0x7C, /**< 01111100bin 124dec */
SPEED_STEP_REVERSE_124 = 0x7D, /**< 01111101bin 125dec */
SPEED_STEP_REVERSE_125 = 0x7E, /**< 01111110bin 126dec */
SPEED_STEP_REVERSE_126 = 0x7F, /**< 01111111bin 127dec */
SPEED_STEP_FORWARD_STOP = 0x80, /**< 10000000bin 128dec */
SPEED_STEP_FORWARD_EMERGENCY_STOP = 0x81, /**< 10000001bin 129dec */
SPEED_STEP_FORWARD_001 = 0x82, /**< 10000010bin 130dec */
SPEED_STEP_FORWARD_002 = 0x83, /**< 10000011bin 131dec */
SPEED_STEP_FORWARD_003 = 0x84, /**< 10000100bin 132dec */
SPEED_STEP_FORWARD_004 = 0x85, /**< 10000101bin 133dec */
SPEED_STEP_FORWARD_005 = 0x86, /**< 10000110bin 134dec */
SPEED_STEP_FORWARD_006 = 0x87, /**< 10000111bin 135dec */
SPEED_STEP_FORWARD_007 = 0x88, /**< 10001000bin 136dec */
SPEED_STEP_FORWARD_008 = 0x89, /**< 10001001bin 137dec */
SPEED_STEP_FORWARD_009 = 0x8A, /**< 10001010bin 138dec */
SPEED_STEP_FORWARD_010 = 0x8B, /**< 10001011bin 139dec */
SPEED_STEP_FORWARD_011 = 0x8C, /**< 10001100bin 140dec */
SPEED_STEP_FORWARD_012 = 0x8D, /**< 10001101bin 141dec */
SPEED_STEP_FORWARD_013 = 0x8E, /**< 10001110bin 142dec */
SPEED_STEP_FORWARD_014 = 0x8F, /**< 10001111bin 143dec */
SPEED_STEP_FORWARD_015 = 0x90, /**< 10010000bin 144dec */
SPEED_STEP_FORWARD_016 = 0x91, /**< 10010001bin 145dec */
SPEED_STEP_FORWARD_017 = 0x92, /**< 10010010bin 146dec */
SPEED_STEP_FORWARD_018 = 0x93, /**< 10010011bin 147dec */
SPEED_STEP_FORWARD_019 = 0x94, /**< 10010100bin 148dec */
SPEED_STEP_FORWARD_020 = 0x95, /**< 10010101bin 149dec */
SPEED_STEP_FORWARD_021 = 0x96, /**< 10010110bin 150dec */
SPEED_STEP_FORWARD_022 = 0x97, /**< 10010111bin 151dec */
SPEED_STEP_FORWARD_023 = 0x98, /**< 10011000bin 152dec */
SPEED_STEP_FORWARD_024 = 0x99, /**< 10011001bin 153dec */
SPEED_STEP_FORWARD_025 = 0x9A, /**< 10011010bin 154dec */
SPEED_STEP_FORWARD_026 = 0x9B, /**< 10011011bin 155dec */
SPEED_STEP_FORWARD_027 = 0x9C, /**< 10011100bin 156dec */
SPEED_STEP_FORWARD_028 = 0x9D, /**< 10011101bin 157dec */
SPEED_STEP_FORWARD_029 = 0x9E, /**< 10011110bin 158dec */
SPEED_STEP_FORWARD_030 = 0x9F, /**< 10011111bin 159dec */
SPEED_STEP_FORWARD_031 = 0xA0, /**< 10100000bin 160dec */
SPEED_STEP_FORWARD_032 = 0xA1, /**< 10100001bin 161dec */
SPEED_STEP_FORWARD_033 = 0xA2, /**< 10100010bin 162dec */
SPEED_STEP_FORWARD_034 = 0xA3, /**< 10100011bin 163dec */
SPEED_STEP_FORWARD_035 = 0xA4, /**< 10100100bin 164dec */
SPEED_STEP_FORWARD_036 = 0xA5, /**< 10100101bin 165dec */
SPEED_STEP_FORWARD_037 = 0xA6, /**< 10100110bin 166dec */
SPEED_STEP_FORWARD_038 = 0xA7, /**< 10100111bin 167dec */
SPEED_STEP_FORWARD_039 = 0xA8, /**< 10101000bin 168dec */
SPEED_STEP_FORWARD_040 = 0xA9, /**< 10101001bin 169dec */
SPEED_STEP_FORWARD_041 = 0xAA, /**< 10101010bin 170dec */
SPEED_STEP_FORWARD_042 = 0xAB, /**< 10101011bin 171dec */
SPEED_STEP_FORWARD_043 = 0xAC, /**< 10101100bin 172dec */
SPEED_STEP_FORWARD_044 = 0xAD, /**< 10101101bin 173dec */
SPEED_STEP_FORWARD_045 = 0xAE, /**< 10101110bin 174dec */
SPEED_STEP_FORWARD_046 = 0xAF, /**< 10101111bin 175dec */
SPEED_STEP_FORWARD_047 = 0xB0, /**< 10110000bin 176dec */
SPEED_STEP_FORWARD_048 = 0xB1, /**< 10110001bin 177dec */
SPEED_STEP_FORWARD_049 = 0xB2, /**< 10110010bin 178dec */
SPEED_STEP_FORWARD_050 = 0xB3, /**< 10110011bin 179dec */
SPEED_STEP_FORWARD_051 = 0xB4, /**< 10110100bin 180dec */
SPEED_STEP_FORWARD_052 = 0xB5, /**< 10110101bin 181dec */
SPEED_STEP_FORWARD_053 = 0xB6, /**< 10110110bin 182dec */
SPEED_STEP_FORWARD_054 = 0xB7, /**< 10110111bin 183dec */
SPEED_STEP_FORWARD_055 = 0xB8, /**< 10111000bin 184dec */
SPEED_STEP_FORWARD_056 = 0xB9, /**< 10111001bin 185dec */
SPEED_STEP_FORWARD_057 = 0xBA, /**< 10111010bin 186dec */
SPEED_STEP_FORWARD_058 = 0xBB, /**< 10111011bin 187dec */
SPEED_STEP_FORWARD_059 = 0xBC, /**< 10111100bin 188dec */
SPEED_STEP_FORWARD_060 = 0xBD, /**< 10111101bin 189dec */
SPEED_STEP_FORWARD_061 = 0xBE, /**< 10111110bin 190dec */
SPEED_STEP_FORWARD_062 = 0xBF, /**< 10111111bin 191dec */
SPEED_STEP_FORWARD_063 = 0xC0, /**< 11000000bin 192dec */
SPEED_STEP_FORWARD_064 = 0xC1, /**< 11000001bin 193dec */
SPEED_STEP_FORWARD_065 = 0xC2, /**< 11000010bin 194dec */
SPEED_STEP_FORWARD_066 = 0xC3, /**< 11000011bin 195dec */
SPEED_STEP_FORWARD_067 = 0xC4, /**< 11000100bin 196dec */
SPEED_STEP_FORWARD_068 = 0xC5, /**< 11000101bin 197dec */
SPEED_STEP_FORWARD_069 = 0xC6, /**< 11000110bin 198dec */
SPEED_STEP_FORWARD_070 = 0xC7, /**< 11000111bin 199dec */
SPEED_STEP_FORWARD_071 = 0xC8, /**< 11001000bin 200dec */
SPEED_STEP_FORWARD_072 = 0xC9, /**< 11001001bin 201dec */
SPEED_STEP_FORWARD_073 = 0xCA, /**< 11001010bin 202dec */
SPEED_STEP_FORWARD_074 = 0xCB, /**< 11001011bin 203dec */
SPEED_STEP_FORWARD_075 = 0xCC, /**< 11001100bin 204dec */
SPEED_STEP_FORWARD_076 = 0xCD, /**< 11001101bin 205dec */
SPEED_STEP_FORWARD_077 = 0xCE, /**< 11001110bin 206dec */
SPEED_STEP_FORWARD_078 = 0xCF, /**< 11001111bin 207dec */
SPEED_STEP_FORWARD_079 = 0xD0, /**< 11010000bin 208dec */
SPEED_STEP_FORWARD_080 = 0xD1, /**< 11010001bin 209dec */
SPEED_STEP_FORWARD_081 = 0xD2, /**< 11010010bin 210dec */
SPEED_STEP_FORWARD_082 = 0xD3, /**< 11010011bin 211dec */
SPEED_STEP_FORWARD_083 = 0xD4, /**< 11010100bin 212dec */
SPEED_STEP_FORWARD_084 = 0xD5, /**< 11010101bin 213dec */
SPEED_STEP_FORWARD_085 = 0xD6, /**< 11010110bin 214dec */
SPEED_STEP_FORWARD_086 = 0xD7, /**< 11010111bin 215dec */
SPEED_STEP_FORWARD_087 = 0xD8, /**< 11011000bin 216dec */
SPEED_STEP_FORWARD_088 = 0xD9, /**< 11011001bin 217dec */
SPEED_STEP_FORWARD_089 = 0xDA, /**< 11011010bin 218dec */
SPEED_STEP_FORWARD_090 = 0xDB, /**< 11011011bin 219dec */
SPEED_STEP_FORWARD_091 = 0xDC, /**< 11011100bin 220dec */
SPEED_STEP_FORWARD_092 = 0xDD, /**< 11011101bin 221dec */
SPEED_STEP_FORWARD_093 = 0xDE, /**< 11011110bin 222dec */
SPEED_STEP_FORWARD_094 = 0xDF, /**< 11011111bin 223dec */
SPEED_STEP_FORWARD_095 = 0xE0, /**< 11100000bin 224dec */
SPEED_STEP_FORWARD_096 = 0xE1, /**< 11100001bin 225dec */
SPEED_STEP_FORWARD_097 = 0xE2, /**< 11100010bin 226dec */
SPEED_STEP_FORWARD_098 = 0xE3, /**< 11100011bin 227dec */
SPEED_STEP_FORWARD_099 = 0xE4, /**< 11100100bin 228dec */
SPEED_STEP_FORWARD_100 = 0xE5, /**< 11100101bin 229dec */
SPEED_STEP_FORWARD_101 = 0xE6, /**< 11100110bin 230dec */
SPEED_STEP_FORWARD_102 = 0xE7, /**< 11100111bin 231dec */
SPEED_STEP_FORWARD_103 = 0xE8, /**< 11101000bin 232dec */
SPEED_STEP_FORWARD_104 = 0xE9, /**< 11101001bin 233dec */
SPEED_STEP_FORWARD_105 = 0xEA, /**< 11101010bin 234dec */
SPEED_STEP_FORWARD_106 = 0xEB, /**< 11101011bin 235dec */
SPEED_STEP_FORWARD_107 = 0xEC, /**< 11101100bin 236dec */
SPEED_STEP_FORWARD_108 = 0xED, /**< 11101101bin 237dec */
SPEED_STEP_FORWARD_109 = 0xEE, /**< 11101110bin 238dec */
SPEED_STEP_FORWARD_110 = 0xEF, /**< 11101111bin 239dec */
SPEED_STEP_FORWARD_111 = 0xF0, /**< 11110000bin 240dec */
SPEED_STEP_FORWARD_112 = 0xF1, /**< 11110001bin 241dec */
SPEED_STEP_FORWARD_113 = 0xF2, /**< 11110010bin 242dec */
SPEED_STEP_FORWARD_114 = 0xF3, /**< 11110011bin 243dec */
SPEED_STEP_FORWARD_115 = 0xF4, /**< 11110100bin 244dec */
SPEED_STEP_FORWARD_116 = 0xF5, /**< 11110101bin 245dec */
SPEED_STEP_FORWARD_117 = 0xF6, /**< 11110110bin 246dec */
SPEED_STEP_FORWARD_118 = 0xF7, /**< 11110111bin 247dec */
SPEED_STEP_FORWARD_119 = 0xF8, /**< 11111000bin 248dec */
SPEED_STEP_FORWARD_120 = 0xF9, /**< 11111001bin 249dec */
SPEED_STEP_FORWARD_121 = 0xFA, /**< 11111010bin 250dec */
SPEED_STEP_FORWARD_122 = 0xFB, /**< 11111011bin 251dec */
SPEED_STEP_FORWARD_123 = 0xFC, /**< 11111100bin 252dec */
SPEED_STEP_FORWARD_124 = 0xFD, /**< 11111101bin 253dec */
SPEED_STEP_FORWARD_125 = 0xFE, /**< 11111110bin 254dec */
SPEED_STEP_FORWARD_126 = 0xFF, /**< 11111111bin 255dec */
} speed_step_t;
/**
* @brief Pointer to the uint8_t array in flash which stores the CVs.
*/
extern const uint8_t *CV_ARRAY_FLASH;
/**
* @brief Target speed step for the decoder.
*
* This external variable represents the desired speed step that the decoder
* should aim to achieve.
*/
extern speed_step_t speed_step_target;
/**
* @brief Previous target speed step.
*
* This variable holds the previous target speed step value for the decoder.
* It is used to keep track of the last speed step that was set.
*/
extern speed_step_t speed_step_target_prev;
/**
* @brief Indicates whether the CV setup check has been completed.
*
* This flag is used to track the status of the CV setup check.
* When the check is done, this variable should is set to true by core 0.
*/
extern bool cv_setup_check_done;
/**
* @brief Indicates whether the core initialization for safe flash execution is complete.
*
* This flag is used to signal the completion of the flash safe execute core initialization.
* When the initialization is done this variable is set to true by core 1.
*/
extern bool flash_safe_execute_core_init_done;
/**
* @brief Global variable to hold the current error state.
*
* This variable is used to track the error state.
*/
extern error_t error_state;
/**
* @brief Entry point for the second core (core 1).
*
* This function is the entry point for the second core, basically the main() of core1.
*/
void core1_entry();
/**
* @brief Retrieves a 32-bit Configuration Variable (CV) starting from the specified index.
*
* This function reads and returns a 32-bit CV value from the given starting index.
*
* @param CV_start_index The starting index of the 32-bit CV to be retrieved.
* @return The 32-bit CV value.
*/
uint32_t get_32bit_CV (uint16_t CV_start_index);
/**
* @brief Retrieves a 16-bit Configuration Variable (CV) value starting from the specified index.
*
* This function reads and returns a 16-bit CV value from the given starting index.
*
* @param CV_start_index The starting index of the 16-bit CV to be retrieved.
* @return The 16-bit CV value starting from the specified index.
*/
uint16_t get_16bit_CV (uint16_t CV_start_index);
/*!
* @brief Calculates the direction based on a speed step byte.
*
* This function calculates the direction of movement based on the value of
* the `speed_step` byte. It refers to the "128 Speed Control" standard as outlined
* in NMRA Standard 9.2.1 section 2.3.2.1 or RCN-212 section 2.2.2.
*
* The following speed steps are defined:
*
* | DEC | BIN | DIRECTION | DEFINITION |
* |-----|-----------|-----------|----------------------|
* | 000 | 0000 0000 | Reverse | STOP |
* | 001 | 0000 0001 | Reverse | EMERGENCY STOP |
* | 002 | 0000 0010 | Reverse | Speed step 001 |
* | 003 | 0000 0011 | Reverse | Speed step 002 |
* | 004 | 0000 0100 | Reverse | Speed step 003 |
* | ... | .... .... | Reverse | ... |
* | 126 | 0111 1110 | Reverse | Speed step 125 |
* | 127 | 0111 1111 | Reverse | Speed step 126 |
* | 128 | 1000 0000 | Forward | STOP |
* | 129 | 1000 0001 | Forward | EMERGENCY STOP |
* | 130 | 1000 0010 | Forward | Speed step 001 |
* | 131 | 1000 0011 | Forward | Speed step 002 |
* | 132 | 1000 0100 | Forward | Speed step 003 |
* | ... | .... .... | Forward | ... |
* | 254 | 1111 1110 | Forward | Speed step 125 |
* | 255 | 1111 1111 | Forward | Speed step 126 |
*
* also see @ref speed_step_t for available steps.
*
* @param speed_step The speed step byte.
* @return `DIRECTION_FORWARD` for forward direction, `DIRECTION_REVERSE` for reverse direction.
*/
direction_t get_direction_of_speed_step(speed_step_t speed_step);
/**
* @brief Sets a specific error.
*
* This function sets a specific error to the error_state variable.
*
* @param err The error code to set.
*/
void set_error(error_t err);
/**
* @brief Clears the specified error.
*
* This function resets the error state for the given error code.
*
* @param err The error code to be cleared.
*/
void clear_error(error_t err);
/**
* @brief Clears all error flags or statuses in the system.
*
* Clears error_state variable
*/
void clear_all_errors();
/**
* @brief Retrieves the current error state.
*
* This function returns the current error state of the system.
*
* @return error_t The current error state.
*/
error_t get_error_state();
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 794 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

+20
View File
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+35
View File
@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd
+2
View File
@@ -0,0 +1,2 @@
sphinx-rtd-theme>=3.0.2
breathe>=4.35.0
+34
View File
@@ -0,0 +1,34 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'RP2040-Decoder'
copyright = '2024, Gabriel Koppenstein'
author = 'Gabriel Koppenstein'
release = '0.3, 1.0'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ['breathe']
templates_path = ['_templates']
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "sphinx_rtd_theme"
html_static_path = ['_static']
# Breathe Configuration
breathe_projects = {
"RP2040-Decoder": "../../doxygen/build/xml"
}
breathe_default_project = "RP2040-Decoder"
File renamed without changes.
File renamed without changes.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 630 KiB

After

Width:  |  Height:  |  Size: 630 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file with editors other than diagrams.net -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="2037px" height="1191px" viewBox="-0.5 -0.5 2037 1191" content="&lt;mxfile host=&quot;app.diagrams.net&quot; modified=&quot;2022-08-06T10:29:12.145Z&quot; agent=&quot;5.0 (X11)&quot; etag=&quot;IjcCWwMyXrMXf420IuKe&quot; version=&quot;20.2.3&quot; type=&quot;device&quot;&gt;&lt;diagram id=&quot;fYnpBcbPwy3h1yrhEr7x&quot; name=&quot;Page-1&quot;&gt;jLxXr6zKtgb2a+6jJXJ4JIcmNpk3cg5Nhl9vaq5zbF9ZlrylNWfPgoaiatQXRg32/6DccElLMtf6lBf9/yBQfv0Pyv8PgiAUhr2/QMv9rwXGEOhfS7U0+X/a/u8Gp3mK/zT+97S9yYv1f524TVO/NfP/bsymcSyy7X+1Jcsynf/7tHLq//dd56Qq/l8NTpb0/+/WoMm3+l8rhUP/d7tcNFX93zvD0H+OpEnWVcu0j/+53ziNxb8jQ/Lfy/zn1LVO8un8fzShwv+g3DJN279Pw8UVPRjX/47Yv++J/x9H/68uL8W4/f/5gparG+rO13ZnRj47xM1x0v+B/LvKkfT7f4biP53d7v+OzdvvGXxshr9BZI9i2Zp36LQkLXprWputmcb3eDpt2zS8J/TgAPt/DQw39dPyHs+LMtn77f9xBaZvKvDNbZrf1mSd/01t2VzF22f274bMf1uh/7aASyVb8j8o8+9PRJzH6n8QrvFZ83tCH6mamPc/w/FqwaveTxj4U9M5Jnp/czCSPxDDsPqFzl4gf50ozKpMVo946NfYYaEiZHtF8rEkeM+X22SO4bzfMGwZwtKIJpK1pFJmcLEJDpiXF+xwS/4Z1cF3aS9H/B6pcJlQDQUzmUxQuJ1EwZwg4oKi9PPvI+UiVY2K2b7k+ZegwAnUWrXuSLok/u+Up7TKzCwfcEz/19Qs9P8g7L6Ux0hseVY+O9WEb7uaQsRZ/h7i/VzTdP7v7Iw/Qsrq3r/YwOLehhAm7veP4vh3XLzfyWXfD9dB/B2HKVJFKOU/vQUdXuz3DDmoRfmvgVWOmzitC1+03UQPnKrNknybyzB8/p6AeX/SYEKaEj3evooIuBeCr+F8YKHhtCL1IYrkbfuUCPEuQPAt7+eCW7rgSVkFpSrwuzz4spcxcGZ13COdzgs41yCHmvy9n7r3X7lZZb4HB/g23G50cszpCAbIX8EYHr+AVmhxGUGn3ub639OWU3i3JK2UKPyvwTLd7N/zwvv7o0XBnYrgpCgwkIEFg6Erj+3f2c/DP+KjBv2yUAVxZO279t4hLG2qxLwSbeB3St8zrfJswgQMfXm6VPETifRE93/XYKVCFBwt3TzdTPG6/k/HqH3VGnG0qGVrMTc6l/mwxLGfsiwVDyUAE825K0IfbB8jRhLT29OAZ8udpyrN9xo4PHpg1kpLSd8/jSjaxdbWDjItCRIMQlUi+UJfNEog1vGsKXbuxlLWz9GXxwTlXHmE05w8p/bfCGCL8v2NGqXA13EYfLNYM58nw4axlqnadqd0LFvp/FFgGOs2+fd4K6exQhmmTdwZFZs3SCcMPyzATkZkjhhJeHXJCg+jdLMWteaGUGkU1T5FF2h6rzN8xZVAr1rDqTUMGddApp+TSOPO96QYm99yncGwmnyGOE5D9LChfjTC0ofht895mvx+DBYgC578Qh/u52OikKLY3/NonCAJyxK8jDP0fZqwFy3Za27cB7+yotTc7sU9NqKw3ioO1V1+b1SwZDFahZlypRgXcR76fk+3j/uGOEvYYLDR44dsYHDb0X9/YvrHO0rQvwXM10EYJIHraZAvM4wiYYCiZRlRBFiiLBls/8Y5tUpSXLC82K/UcMvBIhO6xJIBRKN2ScIb6+ynWAP5uichTxGMZWs0X8ldHj86ieNkbhPn0sXrSm5divIior+z09cgvkka8ks09cbybyUuxYK/sSFuAQha0P901JZyPf46VIJl8o6KSObzIr2oeqEEBQkBLdAkOpejCelFeoI4XKw0JQvXYtadgJeTDy5DDjB5fFdj9S+ai7ofy/wNpuoQ0ZZIJR/cASPociwLVCpREHvveXJt/cj45F1iQi29VUaybMAlXihh4xCVnY0qSGgjY40YG0HJjzUP5QG7DjIR6gPxP+ovLUUi8MDaSsyrQCxXgbdr5VSaTTlqtlqrwRmdkkoYR8amWDPTvYoMTOFWSsjvwnYrg8cRYJHzuIYlfrE9CWkyyenUIn+pS1GQU8U/KwCxnWwRisoHE+WxjBYk0x3QFvYbaV6kh2MWB5eHeN0WiV4gAPYp/Zq9HSJ4e5gsfnpsKw/P8LhWtx6P+YzmUcCXuqNjkDQIrTCU8AsQPdZddCkeMxklC+17ZZFChllIG0fIpY03TPhmElKiRR7BsR5DdqA6HwnJkAjA/kFBdRkh9ON86Z2Tm16vqfVYQuz5fhMEBC0Wb3A5fus6FEvrZWWItiOAuT8LoreIuFcQDbCPHjx5ZM9l8SXcoP1MHdh4UPELnsSiU2lSSu17Hh9OxDtCdHZG8XM7CHqYh1ZE3UxGfHRExbvu+g3hnAsNJcAM7xpn1chuoBBT0gfMdAXJNOHYNfL4ZQyw03YVwyqbJACherQNy/WnsqJ0EJnGNRxLR2tOuLOpNkjUj6FLctcKwcpKjyTKoeKHXvXms41KxpOHzkCRNZiq1MRweFm+YX13Nozj4/PklBQwGuHsWENJ1Lva2GMV5xJHD8F4b9wfyfVjGy281vttMrfIRRHq287YkgsXcahIiUck6PC8+W0FpVps5U7KJ2FtnLCnvTytdYHEW+T5lbFtDcXDElKAFeE/nAScW5EbgNjdzPE0LQHhHCtY93wtOeyn5OpXHD366MwAYqWxPz2eQnYycmY6VI+0N/ym7SF0/C0IVccAggy6ktGfa3EkRj98BpY94Pnh+S7Xt7wDzqCxUOf/GL8P/0vYdSfTixkedXnRO8R0vHVbMokUzMAXjIn83pkWo6t2TwAcXaeK2FNKcD4NeiUcSPnNsoKfbNM1uVwfdN61cPIplnbW++wIbzlZoatcql6C6wSIBIT5B30xTDLjCqMlpPI0Q31PgxxpECaDEPm0uaQLFs/wZGuThCeDrIv26u5fw0ZdMHZhZNsAQlrpIcyt78uS21LuKkgshUgUjDJNrFTvPyOAQrWSDyOFUNG9vU8FCyuYuTVNZ67uusb/Nyc6KUOmaNzIne53qcH+iZFbUOZ9VjJQyVTDuSuX4TuKKG+ArRYc0kze++iKO9OYRZGyp4W8IZcqYOZXwzVhZ9RAPkXNswhF96VaWBGIjhMUr8pOthNw26WuDE0nLUSekPWmHPXj/NciBRYInGdc+iORVPpSDARbmCr8TGZiSCy3VPTDBiM64u+dwv4lB/95Rcv8yQX5UTbO+nRdRTCc+uDrEJxnrOg/gZ0XkZbJVVRJ/WgRtcAxN+eVBC0/eFirCw9Ir3BPtAyOc9X14CnzID+OLloljNaEvoqjLlhP7o8mNIVNcIueTSsKZNL4biaBhIwEKSvdmVn4QirrRV8+/x6LS06HyWnb6JystfQBE86JwbDIHtjDqTNUkyoOiX5QJfJSx7N5MDs8SWq2+4BAkWSN7dd8QyuLZ1K0W6r3cBxjlEa22x+wlEDzWD23Cx3mRQxCSUBO8k9DduNTpcWJkBWwCsHcTszF8QpHf6YVZgW9DBuDR40RMwIpZGtKEeLfh5t9W/zW3POPziL8qrMQf79xC3K7jggjAqeV8JG1kmP6EsGQkBc3CiPzcZgvMwCRQgAiW9ER40fru+qqM8UGzty2HphsgEuaNlRKyMI/ThXeGbUdpYhXjKTZnBF+q0bE583KtyWdlok78QWtlPScsThA8zLAoQxktMn4JFPYKxiAcHIiAz99AbMhzDhra9TlKUgNBmaeOnFrv6h6Yra7H32CZV+EhUQsQshhJJaZgQLUkHJ9WTdiahWKbEe4oqvD1cEurWDTvxo3obbltGFJUhpHeShDeJZePmczubbz9s37FrWlf7LLtnPvO2TurChipsRfmOL2TZ4hoyG4DxCmtgwGZ3h/YAqTFYEJlIhJfTbtZVyCW9UYBcpfRwzW/GOi+v5YaRKeXySoARBmDsKaBhdnqx5GvD9H7sUMABLeGXOUmZ4+99wpi8HkHetzIAzPrl3TPAtgnfrNUTpQQuiNrjq8gYwHFY9o0EDQ1TCypmnNelhlN4HGVWRalE2wmpw+NeSoVXVxzItAgX9lKbrligu3DE+wKivGr9z3enZ/BAjikMq+d/QcgobaH/c1YjaC6SxxziujMOJoMp9rYujLwLkdc41NZJhBbXnvC7BVs72+Dd7e9tyLrAJMkhJPzqp8rZOMqd6SywWX5iJTsnZh0tXHXdPWfSGfOE4u8UTvoaXER4n791BF80WlKyUyQz/qqcWP4hAHQu408yO4H9YvrN/avQoVb+GK5IeTMS61wu6g+fnjO8VefJp8KDEvJJ8Nq3Ev7RWGt93iS/kD5tMPx26Mqiiunn24O0dhZUkhBrmEd7i/gNOgjpNEJRC6iQ8elrxxIE8qMPelnLeOAod1Htf3sE7RYBSJGDYqpnT2LTCvKal9FpFFG7U51GQ5zgMAfqQcGUhjvn23IWl1uJqO8zVyty0gq4tTy9cCU12wmMp/VdCN4DWvd4k+YqQAK1dZA9f7MvNiEufLURRWyurm5Vqhc9KtqIienvBYpSe+tn28yz9FYH/i1HgFYlEB6j0zjeIwLhvq3zDKhuTE3S/TW8xG+EynaD+1e0aDLhC0ju+qHV1yhgVwQtVgbkLine truncated

After

Width:  |  Height:  |  Size: 521 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 630 KiB

After

Width:  |  Height:  |  Size: 630 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 609 KiB

After

Width:  |  Height:  |  Size: 609 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 630 KiB

After

Width:  |  Height:  |  Size: 630 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 518 KiB

After

Width:  |  Height:  |  Size: 518 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 524 KiB

After

Width:  |  Height:  |  Size: 524 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 6.9 MiB

After

Width:  |  Height:  |  Size: 6.9 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 6.9 MiB

After

Width:  |  Height:  |  Size: 6.9 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 6.9 MiB

After

Width:  |  Height:  |  Size: 6.9 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 6.8 MiB

After

Width:  |  Height:  |  Size: 6.8 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 203 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 171 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

+159
View File
@@ -0,0 +1,159 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg width="1369pt" height="657pt" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1369 657" xmlns="http://www.w3.org/2000/svg">
<title>gl2ps_renderer figure</title>
<desc>
Creator: GL2PS 1.4.2, (C) 1999-2020 C. Geuzaine
For: Octave
CreationDate: Mon Aug 1 18:41:06 2022
</desc>
<defs/>
<polygon points="0,0 1369,0 1369,657 0,657" fill="#ffffff"/>
<g>
<polygon points="0,657 1369,657 1369,0 0,0" shape-rendering="crispEdges" fill="#ffffff"/>
<clipPath id="cp001369657">
<polygon points="0,657 1369,657 1369,0 0,0"/>
</clipPath>
<g clip-path="url(#cp001369657)">
<polygon points="178.09,584.849 1239.78,584.849 1239.78,49.2852 178.09,49.2852" shape-rendering="crispEdges" fill="#ffffff"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,584.849 178.09,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,49.2852 178.09,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="390.427,584.849 390.427,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="390.427,49.2852 390.427,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="602.765,584.849 602.765,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="602.765,49.2852 602.765,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="815.103,584.849 815.103,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="815.103,49.2852 815.103,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1027.44,584.849 1027.44,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1027.44,49.2852 1027.44,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,584.849 1239.78,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,49.2852 1239.78,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(175.09,600.343) rotate(-0,3,-8)">
<tspan y="-0" x="0 " fill="rgb(38,38,38)">0</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(381.427,600.343) rotate(-0,9,-8)">
<tspan y="-0" x="0 6 12 " fill="rgb(38,38,38)">500</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(590.765,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(803.103,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1500</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1015.44,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1227.78,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2500</tspan>
</text>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,584.849 188.704,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,584.849 1229.16,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,477.736 188.704,477.736" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,477.736 1229.16,477.736" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,370.624 188.704,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,370.624 1229.16,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,263.511 188.704,263.511" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,263.511 1229.16,263.511" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,156.398 188.704,156.398" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,156.398 1229.16,156.398" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,49.2852 188.704,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,49.2852 1229.16,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(167.091,588.849) rotate(-0,6,-4)">
<tspan y="-0" x="0 " fill="rgb(38,38,38)">0</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,481.736) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,374.624) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,267.511) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">3000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,160.398) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">4000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,53.285) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">5000</tspan>
</text>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,584.849 1239.78,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,49.2852 1239.78,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,584.849 178.09,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1239.78,584.849 1239.78,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="11" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(703.434,615.343) rotate(-0,5.5,-10)">
<tspan y="-3" x="0 5 " fill="rgb(38,38,38)">sp</tspan>
</text>
<text font-size="11" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(105.591,317.067) rotate(-90,38.5,0)">
<tspan y="-3" x="0 7 17 26 30 36 42 47 53 55 58 62 67 73 " fill="rgb(38,38,38)">PWM-Level (sp)</tspan>
</text>
<polyline stroke="#0071bc" stroke-linecap="butt" points="178.09,370.624 1041.03,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<polyline stroke="#d85218" stroke-linecap="butt" points="178.09,381.335 1041.03,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.09,370.624 181.09,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="178.09,367.624 178.09,373.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,368.502 180.211,372.745" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,372.745 180.211,368.502" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.03,49.2852 1044.03,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1041.03,46.2852 1041.03,52.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,47.1636 1043.15,51.4062" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,51.4062 1043.15,47.1636" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.09,381.335 181.09,381.335" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="178.09,378.335 178.09,384.335" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,379.213 180.211,383.456" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,383.456 180.211,379.213" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.03,49.2852 1044.03,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1041.03,46.2852 1041.03,52.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,47.1636 1043.15,51.4062" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,51.4062 1043.15,47.1636" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="9,7" stroke="#00ff00" stroke-linecap="butt" points="609.56,584.849 609.56,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
</g>
<clipPath id="cp001369657">
<polygon points="0,657 1369,657 1369,0 0,0"/>
</clipPath>
<g clip-path="url(#cp001369657)">
<polygon points="1103.73,159.161 1231.37,159.161 1231.37,57.6943 1103.73,57.6943" shape-rendering="crispEdges" fill="#ffffff"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,159.161 1231.37,159.161" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,57.6943 1231.37,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,159.161 1103.73,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1231.37,159.161 1231.37,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#0071bc" stroke-linecap="butt" points="1107.94,66.3989 1128.96,66.3989" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,70.8989) rotate(-0,-0,-4.5)">
<tspan y="-1" x="0 3 8 11 18 23 26 " fill="rgb(0,0,0)">forward</tspan>
</text>
<polyline stroke="#d85218" stroke-linecap="butt" points="1107.94,79.5186 1128.96,79.5186" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,82.5184) rotate(-0,-0,-3)">
<tspan y="-0" x="0 3 8 12 17 20 24 " fill="rgb(0,0,0)">reverse</tspan>
</text>
<polyline stroke="#ff0000" stroke-linecap="square" points="1115.45,93.1377 1121.45,93.1377" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1118.45,90.1377 1118.45,96.1377" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,91.0166 1120.57,95.2593" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,95.2593 1120.57,91.0166" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,98.1379) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 41 46 " fill="rgb(0,0,0)">x1 | y1 (fwd)</tspan>
</text>
<polyline stroke="#00ff00" stroke-linecap="square" points="1115.45,107.342 1121.45,107.342" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1118.45,104.342 1118.45,110.342" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,105.221 1120.57,109.464" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,109.464 1120.57,105.221" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,112.342) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 41 46 " fill="rgb(0,0,0)">x2 | y2 (fwd)</tspan>
</text>
<polyline stroke="#ff0000" stroke-linecap="square" points="1115.45,121.547 1121.45,121.547" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1118.45,118.547 1118.45,124.547" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,119.426 1120.57,123.668" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,123.668 1120.57,119.426" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,126.547) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 39 43 " fill="rgb(0,0,0)">x1 | y1 (rev)</tspan>
</text>
<polyline stroke="#00ff00" stroke-linecap="square" points="1115.45,135.752 1121.45,135.752" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1118.45,132.752 1118.45,138.752" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,133.63 1120.57,137.873" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,137.873 1120.57,133.63" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,140.752) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 39 43 " fill="rgb(0,0,0)">x2 | y2 (rev)</tspan>
</text>
<polyline stroke-dasharray="9,7" stroke="#00ff00" stroke-linecap="butt" points="1107.94,149.957 1128.96,149.957" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,154.956) rotate(-0,-0,-5)">
<tspan y="-2" x="0 5 10 12 17 21 24 31 36 41 44 46 49 54 57 62 66 71 76 78 83 85 89 " fill="rgb(0,0,0)">adjustment threshold y2</tspan>
</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

+85
View File
@@ -0,0 +1,85 @@
##############################
# #
# #
# -----p2 #
# | | #
# | | <- Crop Window # <- Whole PDF Window
# | | #
# p1----| #
# #
##############################
# Coordinate origin is at bottom left of PDF window
#
# y
# î
# |
# |
# +-----> x
import argparse
from PyPDF2 import PdfReader, PdfWriter
def crop_pdf(input_path, output_path, p1, p2):
"""
Crop a PDF file based on the given bottom-left (p1) and top-right (p2) coordinates.
Parameters:
- input_path (str): Path to the input PDF file.
- output_path (str): Path to save the cropped PDF file.
- p1 (tuple): Bottom-left corner of the crop window (x, y).
- p2 (tuple): Top-right corner of the crop window (x, y).
"""
# Validate coordinates
if p1[0] >= p2[0]:
raise ValueError("Invalid x dimensions: p1[0] must be less than p2[0]")
if p1[1] >= p2[1]:
raise ValueError("Invalid y dimensions: p1[1] must be less than p2[1]")
# Open the input PDF
with open(input_path, "rb") as in_f:
input_pdf = PdfReader(in_f)
output_pdf = PdfWriter()
num_pages = len(input_pdf.pages)
print(f"Document has {num_pages} pages.")
# Loop through all pages
for i in range(num_pages):
page = input_pdf.pages[i]
# Set the cropbox properties for the page
page.cropbox.lower_left = p1 # Bottom-left corner
page.cropbox.upper_right = p2 # Top-right corner
# Debug information about the crop box
print(f"Page {i + 1}:")
print(f" - Cropbox Lower Left: {page.cropbox.lower_left}")
print(f" - Cropbox Upper Right: {page.cropbox.upper_right}")
# Add the modified page to the writer
output_pdf.add_page(page)
# Write the final output
with open(output_path, "wb") as out_f:
output_pdf.write(out_f)
print(f"Cropped PDF saved as {output_path}")
# Add argument parsing to handle command-line inputs
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Crop a PDF file based on coordinates.")
parser.add_argument("input_path", type=str, help="Path to the input PDF file.")
parser.add_argument("output_path", type=str, help="Path to save the cropped PDF file.")
parser.add_argument("p1", type=float, nargs=2, help="Bottom-left corner of the crop window (x, y).")
parser.add_argument("p2", type=float, nargs=2, help="Top-right corner of the crop window (x, y).")
args = parser.parse_args()
# Convert command-line inputs for coordinates
bottom_left = tuple(args.p1)
top_right = tuple(args.p2)
# Call the crop function
try:
crop_pdf(args.input_path, args.output_path, bottom_left, top_right)
except ValueError as e:
print(f"Error: {e}")
+139
View File
@@ -0,0 +1,139 @@
"""
Script for automatically generating .svg files for documentation
How to use:
1. Install Inkscape and add to PATH
2. Install KiCad and add to PATH
3. Install PyPDF2
4. Copy the schematic_theme.json file into the following directory:
Linux: ~.config/kicad/<version>/colors
Windows: %appdata%/kicad/<version>/colors
"""
import subprocess
import os
# Output directory path
svg_dir = "../docs/svg/"
# Temp directory path
temp_dir = "temp/"
# .kicad_sch path/filename
kicad_sch_filename = "../KiCad/RP2040-Decoder.kicad_sch"
# Define crop areas with p1 (bottom-left) and p2 (top-right) points and custom pdf_name
crop_areas = {
"Input Stage": {
"p1": (60, 440), # Bottom-left corner (x1, y1)
"p2": (430, 560), # Top-right corner (x2, y2)
"name": "Input_Stage"
},
"Motor Driver": {
"p1": (600, 125),
"p2": (810, 315),
"name": "Motor_Driver"
},
"Auxillary Outputs": {
"p1": (620, 395),
"p2": (810, 555),
"name": "Aux_Outputs"
},
"Microcontroller": {
"p1": (40, 20),
"p2": (600, 420),
"name": "Microcontroller"
}
}
# 1. Create temp directory
try:
os.mkdir(temp_dir)
print(f"Directory '{temp_dir}' created successfully.")
except FileExistsError:
print(f"Directory '{temp_dir}' already exists.")
except PermissionError:
print(f"Permission denied: Unable to create '{temp_dir}'.")
except Exception as e:
print(f"An error occurred: {e}")
# 2. Export from KiCad with and without drawing sheet
subprocess.run(
["kicad-cli", "sch", "export", "pdf", "--no-background-color", "--exclude-drawing-sheet", "--theme", "schematic_theme",
"--output", temp_dir + "RP2040-Decoder_temp.pdf", kicad_sch_filename],
check=True
)
subprocess.run(
["kicad-cli", "sch", "export", "svg", "--no-background-color", "--theme", "schematic_theme",
"--output", svg_dir, kicad_sch_filename],
check=True
)
# 3. Crop the PDF for each specified crop area
for crop_key, crop_data in crop_areas.items():
p1 = crop_data["p1"] # (x1, y1)
p2 = crop_data["p2"] # (x2, y2)
pdf_path = temp_dir + crop_data["name"] + ".pdf" # Name of the output cropped PDF
subprocess.run(
["python", "crop_pdf.py", temp_dir + "RP2040-Decoder_temp.pdf", pdf_path, str(p1[0]), str(p1[1]), str(p2[0]), str(p2[1])],
check=True
)
print(f"Cropped part {crop_key} saved as {pdf_path}")
# 4. Convert each cropped PDF to SVG using Inkscape
for crop_key, crop_data in crop_areas.items():
svg_path = svg_dir + crop_data["name"] + ".svg"
pdf_path = temp_dir + crop_data["name"] + ".pdf"
subprocess.run(
["inkscape", "--export-type=svg", "--export-filename=" + svg_path, pdf_path],
check=True
)
print(f"Converted {pdf_path} to {svg_path}")
# 5. Set transparency for each SVG
for crop_key, crop_data in crop_areas.items():
svg_path = svg_dir + crop_data["name"] + ".svg"
subprocess.run(
["python", "set_opacity.py", svg_path, svg_path],
check=True
)
print(f"Set transparency for {svg_path}")
# 6. Clean up the temporary PDF files and attempt to delete temp directory
for crop_key, crop_data in crop_areas.items():
pdf_path = temp_dir + crop_data["name"] + ".pdf"
try:
os.remove(pdf_path) # Attempt to delete the cropped PDF
print(f"Deleted temporary file: {pdf_path}")
except FileNotFoundError:
print(f"File not found: {pdf_path}")
except PermissionError:
print(f"Permission denied: Unable to delete '{pdf_path}'.")
except Exception as e:
print(f"An error occurred while deleting '{pdf_path}': {e}")
temp_file = temp_dir + "RP2040-Decoder_temp.pdf"
try:
os.remove(temp_file) # Attempt to delete the final temporary file
print(f"Deleted temporary file: {temp_file}")
except FileNotFoundError:
print(f"File not found: {temp_file}")
except PermissionError:
print(f"Permission denied: Unable to delete '{temp_file}'.")
except Exception as e:
print(f"An error occurred while deleting '{temp_file}': {e}")
try:
os.rmdir(temp_dir)
print(f"Directory '{temp_dir}' deleted successfully.")
except FileNotFoundError:
print(f"Directory '{temp_dir}' does not exist.")
except OSError:
print(f"Directory '{temp_dir}' is not empty or cannot be removed.")
except PermissionError:
print(f"Permission denied: Unable to delete '{temp_dir}'.")
except Exception as e:
print(f"An error occurred: {e}")
+48
View File
@@ -0,0 +1,48 @@
def print_speed_steps():
"""
This script generates and prints speed step definitions for both reverse and forward directions.
Functions:
print_speed_steps(): Generates and prints speed step definitions in hexadecimal and binary formats used in shared.h.
- Reverse speed steps range from 0x00 to 0x7F.
- Forward speed steps range from 0x80 to 0xFF.
* in NMRA Standard 9.2.1 section 2.3.2.1 or RCN-212 section 2.2.2.
*
* The following speed steps are defined:
*
* | DEC | BIN | DIRECTION | DEFINITION |
* |-----|-----------|-----------|----------------------|
* | 000 | 0000 0000 | Reverse | STOP |
* | 001 | 0000 0001 | Reverse | EMERGENCY STOP |
* | 002 | 0000 0010 | Reverse | Speed step 001 |
* | 003 | 0000 0011 | Reverse | Speed step 002 |
* | 004 | 0000 0100 | Reverse | Speed step 003 |
* | ... | .... .... | Reverse | ... |
* | 126 | 0111 1110 | Reverse | Speed step 125 |
* | 127 | 0111 1111 | Reverse | Speed step 126 |
* | 128 | 1000 0000 | Forward | STOP |
* | 129 | 1000 0001 | Forward | EMERGENCY STOP |
* | 130 | 1000 0010 | Forward | Speed step 001 |
* | 131 | 1000 0011 | Forward | Speed step 002 |
* | 132 | 1000 0100 | Forward | Speed step 003 |
* | ... | .... .... | Forward | ... |
* | 254 | 1111 1110 | Forward | Speed step 125 |
* | 255 | 1111 1111 | Forward | Speed step 126 |
"""
# Reverse speed steps
print(f"SPEED_STEP_REVERSE_STOP = 0x{0:02X}, /**< {0:08b}bin {0:03d}dec */")
print(f"SPEED_STEP_REVERSE_EMERGENCY_STOP = 0x{1:02X}, /**< {1:08b}bin {1:03d}dec */")
for i in range(1, 127):
print(f"SPEED_STEP_REVERSE_{i:03d} = 0x{i+1:02X}, /**< {i+1:08b}bin {i+1:03d}dec */")
print("\n\n")
# Forward speed steps
print(f"SPEED_STEP_FORWARD_STOP = 0x{128:02X}, /**< {128:08b}bin {128:03d}dec */")
print(f"SPEED_STEP_FORWARD_EMERGENCY_STOP = 0x{129:02X}, /**< {129:08b}bin {129:03d}dec */")
for i in range(1, 127):
print(f"SPEED_STEP_FORWARD_{i:03d} = 0x{i+129:02X}, /**< {i+129:08b}bin {i+129:03d}dec */")
# Call the function
print_speed_steps()
+220
View File
@@ -0,0 +1,220 @@
{
"3d_viewer": {
"background_bottom": "rgb(102, 102, 128)",
"background_top": "rgb(204, 204, 230)",
"board": "rgba(51, 43, 23, 0.902)",
"copper": "rgb(179, 156, 0)",
"silkscreen_bottom": "rgb(230, 230, 230)",
"silkscreen_top": "rgb(230, 230, 230)",
"soldermask_bottom": "rgba(20, 51, 36, 0.831)",
"soldermask_top": "rgba(20, 51, 36, 0.831)",
"solderpaste": "rgb(128, 128, 128)"
},
"board": {
"anchor": "rgb(255, 38, 226)",
"aux_items": "rgb(255, 255, 255)",
"b_adhes": "rgb(0, 0, 132)",
"b_crtyd": "rgb(38, 233, 255)",
"b_fab": "rgb(88, 93, 132)",
"b_mask": "rgba(2, 255, 238, 0.400)",
"b_paste": "rgba(0, 194, 194, 0.902)",
"b_silks": "rgb(232, 178, 167)",
"background": "rgb(0, 16, 35)",
"cmts_user": "rgb(89, 148, 220)",
"conflicts_shadow": "rgba(255, 0, 5, 0.502)",
"copper": {
"b": "rgb(77, 127, 196)",
"f": "rgb(200, 52, 52)",
"in1": "rgb(127, 200, 127)",
"in10": "rgb(237, 124, 51)",
"in11": "rgb(91, 195, 235)",
"in12": "rgb(247, 111, 142)",
"in13": "rgb(167, 165, 198)",
"in14": "rgb(40, 204, 217)",
"in15": "rgb(232, 178, 167)",
"in16": "rgb(242, 237, 161)",
"in17": "rgb(237, 124, 51)",
"in18": "rgb(91, 195, 235)",
"in19": "rgb(247, 111, 142)",
"in2": "rgb(206, 125, 44)",
"in20": "rgb(167, 165, 198)",
"in21": "rgb(40, 204, 217)",
"in22": "rgb(232, 178, 167)",
"in23": "rgb(242, 237, 161)",
"in24": "rgb(237, 124, 51)",
"in25": "rgb(91, 195, 235)",
"in26": "rgb(247, 111, 142)",
"in27": "rgb(167, 165, 198)",
"in28": "rgb(40, 204, 217)",
"in29": "rgb(232, 178, 167)",
"in3": "rgb(79, 203, 203)",
"in30": "rgb(242, 237, 161)",
"in4": "rgb(219, 98, 139)",
"in5": "rgb(167, 165, 198)",
"in6": "rgb(40, 204, 217)",
"in7": "rgb(232, 178, 167)",
"in8": "rgb(242, 237, 161)",
"in9": "rgb(141, 203, 129)"
},
"cursor": "rgb(255, 255, 255)",
"drc_error": "rgba(215, 91, 107, 0.800)",
"drc_exclusion": "rgba(255, 255, 255, 0.800)",
"drc_warning": "rgba(255, 208, 66, 0.800)",
"dwgs_user": "rgb(194, 194, 194)",
"eco1_user": "rgb(180, 219, 210)",
"eco2_user": "rgb(216, 200, 82)",
"edge_cuts": "rgb(208, 210, 205)",
"f_adhes": "rgb(132, 0, 132)",
"f_crtyd": "rgb(255, 38, 226)",
"f_fab": "rgb(175, 175, 175)",
"f_mask": "rgba(216, 100, 255, 0.400)",
"f_paste": "rgba(180, 160, 154, 0.902)",
"f_silks": "rgb(242, 237, 161)",
"footprint_text_invisible": "rgb(132, 132, 132)",
"grid": "rgb(132, 132, 132)",
"grid_axes": "rgb(194, 194, 194)",
"locked_shadow": "rgba(255, 38, 226, 0.502)",
"margin": "rgb(255, 38, 226)",
"pad_plated_hole": "rgb(194, 194, 0)",
"pad_through_hole": "rgb(227, 183, 46)",
"page_limits": "rgb(132, 132, 132)",
"plated_hole": "rgb(26, 196, 210)",
"ratsnest": "rgba(0, 248, 255, 0.349)",
"user_1": "rgb(194, 194, 194)",
"user_2": "rgb(89, 148, 220)",
"user_3": "rgb(180, 219, 210)",
"user_4": "rgb(216, 200, 82)",
"user_5": "rgb(194, 194, 194)",
"user_6": "rgb(89, 148, 220)",
"user_7": "rgb(180, 219, 210)",
"user_8": "rgb(216, 200, 82)",
"user_9": "rgb(232, 178, 167)",
"via_blind_buried": "rgb(187, 151, 38)",
"via_hole": "rgb(227, 183, 46)",
"via_micro": "rgb(0, 132, 132)",
"via_through": "rgb(236, 236, 236)",
"worksheet": "rgb(200, 114, 171)"
},
"gerbview": {
"axes": "rgb(0, 0, 132)",
"background": "rgb(0, 0, 0)",
"dcodes": "rgb(255, 255, 255)",
"grid": "rgb(132, 132, 132)",
"layers": [
"rgb(200, 52, 52)",
"rgb(127, 200, 127)",
"rgb(206, 125, 44)",
"rgb(79, 203, 203)",
"rgb(219, 98, 139)",
"rgb(167, 165, 198)",
"rgb(40, 204, 217)",
"rgb(232, 178, 167)",
"rgb(242, 237, 161)",
"rgb(141, 203, 129)",
"rgb(237, 124, 51)",
"rgb(91, 195, 235)",
"rgb(247, 111, 142)",
"rgb(77, 127, 196)",
"rgb(200, 52, 52)",
"rgb(127, 200, 127)",
"rgb(206, 125, 44)",
"rgb(79, 203, 203)",
"rgb(219, 98, 139)",
"rgb(167, 165, 198)",
"rgb(40, 204, 217)",
"rgb(232, 178, 167)",
"rgb(242, 237, 161)",
"rgb(141, 203, 129)",
"rgb(237, 124, 51)",
"rgb(91, 195, 235)",
"rgb(247, 111, 142)",
"rgb(77, 127, 196)",
"rgb(200, 52, 52)",
"rgb(127, 200, 127)",
"rgb(206, 125, 44)",
"rgb(79, 203, 203)",
"rgb(219, 98, 139)",
"rgb(167, 165, 198)",
"rgb(40, 204, 217)",
"rgb(232, 178, 167)",
"rgb(242, 237, 161)",
"rgb(141, 203, 129)",
"rgb(237, 124, 51)",
"rgb(91, 195, 235)",
"rgb(247, 111, 142)",
"rgb(77, 127, 196)",
"rgb(200, 52, 52)",
"rgb(127, 200, 127)",
"rgb(206, 125, 44)",
"rgb(79, 203, 203)",
"rgb(219, 98, 139)",
"rgb(167, 165, 198)",
"rgb(40, 204, 217)",
"rgb(232, 178, 167)",
"rgb(242, 237, 161)",
"rgb(141, 203, 129)",
"rgb(237, 124, 51)",
"rgb(91, 195, 235)",
"rgb(247, 111, 142)",
"rgb(77, 127, 196)",
"rgb(200, 52, 52)",
"rgb(127, 200, 127)",
"rgb(206, 125, 44)",
"rgb(79, 203, 203)"
],
"negative_objects": "rgb(132, 132, 132)",
"page_limits": "rgb(132, 132, 132)",
"worksheet": "rgb(0, 0, 132)"
},
"meta": {
"name": "schematic_theme",
"version": 5
},
"schematic": {
"anchor": "rgb(0, 0, 255)",
"aux_items": "rgb(0, 0, 0)",
"background": "rgb(245, 244, 239)",
"brightened": "rgb(255, 0, 255)",
"bus": "rgb(0, 0, 132)",
"bus_junction": "rgb(0, 0, 132)",
"component_body": "rgb(255, 255, 194)",
"component_outline": "rgb(132, 0, 0)",
"cursor": "rgb(15, 15, 15)",
"dnp_marker": "rgba(220, 9, 13, 0.702)",
"erc_error": "rgba(230, 9, 13, 0.800)",
"erc_exclusion": "rgba(94, 194, 194, 0.800)",
"erc_warning": "rgba(209, 146, 0, 0.800)",
"fields": "rgb(132, 0, 132)",
"grid": "rgb(181, 181, 181)",
"grid_axes": "rgb(0, 0, 132)",
"hidden": "rgb(94, 194, 194)",
"hovered": "rgb(0, 0, 255)",
"junction": "rgb(0, 150, 0)",
"label_global": "rgb(132, 0, 0)",
"label_hier": "rgb(114, 86, 0)",
"label_local": "rgb(0, 107, 255)",
"netclass_flag": "rgb(72, 72, 72)",
"no_connect": "rgb(0, 0, 132)",
"note": "rgb(205, 0, 21)",
"note_background": "rgba(0, 0, 0, 0.000)",
"op_currents": "rgb(224, 0, 12)",
"op_voltages": "rgb(132, 0, 50)",
"override_item_colors": false,
"page_limits": "rgb(181, 181, 181)",
"pin": "rgb(132, 0, 0)",
"pin_name": "rgb(0, 100, 100)",
"pin_number": "rgb(169, 0, 0)",
"private_note": "rgb(72, 72, 255)",
"reference": "rgb(0, 100, 100)",
"shadow": "rgba(102, 179, 255, 0.800)",
"sheet": "rgb(132, 0, 0)",
"sheet_background": "rgba(255, 255, 255, 0.000)",
"sheet_fields": "rgb(132, 0, 132)",
"sheet_filename": "rgb(114, 86, 0)",
"sheet_label": "rgb(0, 100, 100)",
"sheet_name": "rgb(0, 100, 100)",
"value": "rgb(0, 100, 100)",
"wire": "rgb(0, 150, 0)",
"worksheet": "rgb(132, 0, 0)"
}
}
+46
View File
@@ -0,0 +1,46 @@
import re
import argparse
def set_opacity(input_file, output_file):
"""
Replace all occurrences of 'fill-opacity:1' with 'fill-opacity:0',
except when preceded by 'fill:#ffffc2'.
:param input_file: Path to the input SVG file.
:param output_file: Path to save the modified SVG file.
"""
try:
# Read the content of the input SVG file
with open(input_file, 'r') as file:
svg_content = file.read()
# Regex to match 'fill-opacity:1' and not preceded by 'fill:#ffffc2'
pattern = r'(?<!fill:#ffffc2;)fill-opacity:1'
modified_content = re.sub(pattern, 'fill-opacity:0', svg_content)
# Save the modified content to the output file
with open(output_file, 'w') as file:
file.write(modified_content)
print(f"Modified SVG saved as: {output_file}")
except Exception as e:
print(f"An error occurred: {e}")
def main():
# Set up the argument parser
parser = argparse.ArgumentParser(
description="Modify SVG files by replacing 'fill-opacity:1' with 'fill-opacity:0', "
"except when preceded by 'fill:#ffffc2'."
)
parser.add_argument('input_file', type=str, help="Path to the input SVG file.")
parser.add_argument('output_file', type=str, help="Path to save the modified SVG file.")
# Parse the arguments
args = parser.parse_args()
# Call the function with the provided file paths
set_opacity(args.input_file, args.output_file)
if __name__ == "__main__":
main()
Binary file not shown.
Loaded 100 of 186 files, more files were not shown because too many files have changed in this diff. Show more