Compare commits

..

327 Commits

Author SHA1 Message Date
InsanityAutomation b788ce25f5 Update Configuration_adv.h 2024-01-09 11:10:48 -05:00
InsanityAutomation 1a9a5b82a8 AddTwinNebula 2024-01-09 09:33:38 -05:00
InsanityAutomation cb9f103421 Merge branch 'bugfix-2.1.x' into LulzbotTestBase 2024-01-09 09:03:28 -05:00
InsanityAutomation 9479cd9ce7 Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x 2024-01-09 09:00:33 -05:00
InsanityAutomation c7de99b141 Update Configuration_adv.h 2024-01-06 19:36:23 -05:00
InsanityAutomation 9ad55840bb Update SanityCheck.h 2024-01-06 18:41:49 -05:00
InsanityAutomation 81011a71b1 Merge branch 'bugfix-2.1.x' into LulzbotTestBase 2024-01-06 18:41:43 -05:00
InsanityAutomation 832e1ca0e7 Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x 2024-01-01 14:03:46 -05:00
InsanityAutomation 2cc52318e3 Merge branch 'bugfix-2.1.x' into LulzbotTestBase 2022-11-30 15:28:39 -05:00
Scott Lahteine d602fb9421 use the conditional 2022-10-20 09:09:56 -04:00
InsanityAutomation 8c1e4b5250 Update Configuration_adv.h 2022-10-18 17:52:28 -04:00
InsanityAutomation d2a5d2d220 Fix FTDUI Status Screen Timeout 2022-10-18 17:52:20 -04:00
InsanityAutomation 9ff3500dda Merge branch 'bugfix-2.1.x' into LulzbotTestBase 2022-10-18 17:21:43 -04:00
InsanityAutomation 30e5554171 Update Configuration_adv.h 2022-08-08 10:43:32 -04:00
InsanityAutomation 190204e6b8 Merge branch 'FixArduinoDUEServos' into LulzbotTestBase 2022-06-21 10:13:56 -04:00
Jason Smith 9d4aff6eab Fix DUE timer behavior when disabling servos 2022-06-12 14:39:54 -07:00
InsanityAutomation d74ecde544 Merge branch 'FixArduinoDUEServos' into LulzbotTestBase 2022-06-11 12:20:50 -04:00
Scott Lahteine ad4cf3e332 pick best clock for prescaler 2022-06-10 22:22:40 -05:00
Scott Lahteine 701ab0db8e define HAL_TIMER_PRESCALER 2022-06-10 21:09:25 -05:00
Scott Lahteine b3f2f44124 set inactive servos LOW 2022-06-10 20:28:03 -05:00
Scott Lahteine a03ee01cee match samd51 to others 2022-06-10 20:28:03 -05:00
Scott Lahteine 9bb87da816 apply SERVO_TIMER_PRESCALER to intervals 2022-06-10 19:52:03 -05:00
Scott Lahteine 5fbb7cbe6a ws 2022-06-10 19:06:30 -05:00
InsanityAutomation 8af96b8cdd Update Servo.cpp 2022-06-09 15:48:08 -04:00
Scott Lahteine 5cdc4527d3 Merge branch 'bugfix-2.1.x' into pr/24305 2022-06-09 00:52:57 -05:00
Scott Lahteine 0206af6c07 fix servo index check, add comments 2022-06-09 00:23:09 -05:00
InsanityAutomation fb5dd40949 Revise timer to MCK/2
Co-Authored-By: sjasonsmith <20053467+sjasonsmith@users.noreply.github.com>
2022-06-08 22:24:25 -04:00
InsanityAutomation 9c1366ed99 Archim2 USB Hang Fix 2022-06-08 19:43:34 -04:00
InsanityAutomation e7c505d415 Merge branch 'bugfix-2.1.x' into LulzbotTestBase 2022-06-08 17:38:26 -04:00
InsanityAutomation e304aa9da7 Revise timer to MCK/2 2022-06-08 17:38:04 -04:00
Scott Lahteine c1775c9005 Remove MOVE_SERVO, DETACH_SERVO 2022-06-07 22:29:17 -05:00
Scott Lahteine dbd9321380 use simple fix 2022-06-07 22:28:44 -05:00
Scott Lahteine 7f6622e6ac test this if nothing else works 2022-06-07 19:31:29 -05:00
Scott Lahteine 04ffe9493b Try adjusting finISR also ?? 2022-06-07 19:31:29 -05:00
Scott Lahteine 6c39286626 Try Servo::detach adjustment ?? 2022-06-07 19:31:29 -05:00
Scott Lahteine 86b9e7ee13 servo cleanup 2022-06-07 19:31:29 -05:00
Scott Lahteine 6566031ec6 keep check for good SERVO_INDEX 2022-06-07 17:09:28 -05:00
InsanityAutomation e7a6c77d74 Resolve DUE Servo pulse issue 2022-06-07 09:14:26 -04:00
InsanityAutomation 2436e2463c Resolve DUE Servo pulse issue 2022-06-07 09:11:41 -04:00
InsanityAutomation 9fffe26c20 Allow configurable dwell for servo move on Switching Nozzle 2022-06-07 09:11:08 -04:00
InsanityAutomation 3ab1c95ab3 Update Configuration.h 2022-05-29 18:42:03 -04:00
InsanityAutomation 7f32519aa9 Use raw positions for G34 probing to honor M206 offsets 2022-05-29 18:36:14 -04:00
InsanityAutomation ff91016e81 Config improvements 2022-05-29 17:23:13 -04:00
InsanityAutomation 4615345773 Import Marcios EMI Filtering 2022-05-29 15:33:29 -04:00
InsanityAutomation 25ff9813c6 fix upstream warnings 2022-05-22 13:53:09 -04:00
InsanityAutomation 8ba8ae85c4 minor tweaks 2022-05-22 13:52:46 -04:00
InsanityAutomation dc1cd03897 Additional merge conflicts not flagged by rebase 2022-05-22 13:39:26 -04:00
InsanityAutomation 304ca54aba Merge branch 'bugfix-2.0.x' into LulzbotTestBase 2022-05-22 13:34:16 -04:00
InsanityAutomation e175f3f729 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2022-05-22 13:04:47 -04:00
InsanityAutomation 641fc9c833 Merge branch 'LulzbotTestBase' of https://github.com/InsanityAutomation/Marlin into LulzbotTestBase 2022-05-22 13:04:29 -04:00
Roxy-3D 6e2597593a Allow BTT Octopus boards to use ST-Link for programing and debugging 2022-05-13 17:48:59 -05:00
Roxy-3D c29a949a13 Update stm32f4.ini
Allow Platform-IO to upload to the Octopus boards directly with an ST-Link attached.
2022-05-13 17:29:50 -05:00
Marcio Teixeira 26268313c4 Remove tags from non-clickable text. 2021-08-06 20:22:29 -04:00
Marcio Teixeira da8412db6a Additional tweaks for FTDI Eve spinner dialog box 2021-08-06 20:22:04 -04:00
InsanityAutomation 9bf6c900c4 A few fixes 2021-08-06 20:21:05 -04:00
InsanityAutomation aa6e7b0300 Update preflight-checks.py 2021-08-05 22:18:48 -04:00
InsanityAutomation 0663c5a372 Merge branch 'bugfix-2.0.x' into LulzbotTestBase 2021-08-02 11:08:17 -04:00
InsanityAutomation ad42498dfb Merge branch 'bugfix-2.0.x' into LulzbotTestBase 2021-06-05 13:07:08 -04:00
InsanityAutomation 662d03896b Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-06-05 12:51:39 -04:00
InsanityAutomation 8b09d27cd9 Custom User Menus confirm and hide when printing 2021-03-12 16:15:03 -05:00
InsanityAutomation d7c8cf3a9e Update Configuration_adv.h 2021-02-08 11:15:49 -05:00
InsanityAutomation c9ae761066 Merge branch 'LulzbotTestBase' of https://github.com/InsanityAutomation/Marlin into LulzbotTestBase 2021-01-03 12:46:00 -05:00
InsanityAutomation 7bed426de3 Update G12 for Taz Pro 2021-01-03 12:41:19 -05:00
InsanityAutomation 048de70ee6 Fix mesh screen include 2021-01-03 12:27:05 -05:00
InsanityAutomation 6049f226bc Merge branch 'bugfix-2.0.x' into LulzbotTestBase 2021-01-03 12:26:36 -05:00
InsanityAutomation c02083677a Fixes after rebase 2020-11-15 14:05:26 -05:00
InsanityAutomation 64ed7aff53 Merge branch 'bugfix-2.0.x' into LulzbotTestBase 2020-11-13 19:26:18 -05:00
thinkyhead a694291420 [cron] Bump distribution date (2020-10-20) 2020-10-20 00:15:55 +00:00
Scott Lahteine 0216e032be Host prompt followup 2020-10-19 04:34:14 -05:00
Scott Lahteine 2d8aa0cea1 Tweak a host prompt call 2020-10-19 04:25:48 -05:00
InsanityAutomation d1eb100806 Update G28.cpp 2020-10-16 09:30:41 -04:00
InsanityAutomation 1d3c53ae2f Update G34_M422.cpp 2020-10-12 09:07:45 -04:00
InsanityAutomation 97d5da4c11 Update platformio.ini 2020-10-12 09:07:45 -04:00
InsanityAutomation 359e0641c4 set config version 2020-10-12 09:07:45 -04:00
InsanityAutomation 2c4e4edade Tweak env 2020-10-12 09:07:45 -04:00
InsanityAutomation c6ae6c53a8 Update G29.cpp 2020-10-12 09:07:45 -04:00
InsanityAutomation c596e9f3f0 Fix z-min mechanical gantry alignment 2020-10-12 09:07:45 -04:00
InsanityAutomation 37ebee1cef Merge compatability fixes 2020-10-12 09:07:45 -04:00
InsanityAutomation 76cbaeeb2e Update Configuration_adv.h 2020-10-12 09:07:45 -04:00
InsanityAutomation 79b8ad13f1 Tweaks for MiniV2 broken endstop and gantry calibration position 2020-10-12 09:07:45 -04:00
InsanityAutomation d0a8bc29be Update Configuration_adv.h 2020-10-12 09:07:45 -04:00
InsanityAutomation 10901d9092 Make thermal timing more forgiving, at least until PID can be better tuned for BMG-M 2020-10-12 09:07:45 -04:00
InsanityAutomation dddc232294 Update Configuration_adv.h 2020-10-12 09:07:45 -04:00
InsanityAutomation 1419f2637e Adjust PID and currents on tool menu 2020-10-12 09:07:45 -04:00
InsanityAutomation 91b08d2deb Nozzle as proble home offset application to probe points 2020-10-12 09:07:45 -04:00
InsanityAutomation 2f3af1c9da Allow M206 offsets to apply to z safe home move 2020-10-12 09:07:45 -04:00
InsanityAutomation 2d6a5201cf Batch 1 2020-10-12 09:07:44 -04:00
InsanityAutomation a390a348d0 Enable Post G28 by default as its usually necessary 2020-10-12 09:07:44 -04:00
InsanityAutomation b3a732b43a Update Configuration_adv.h 2020-10-12 09:07:44 -04:00
Scott Lahteine bb6d74383e Provide MSG_ITERATION 2020-10-12 09:07:44 -04:00
Scott Lahteine 9e8b2121dd reorder 2020-10-12 09:07:44 -04:00
Scott Lahteine af91b4d29f Stepper current refactor 2020-10-12 09:07:44 -04:00
Scott Lahteine 609325a8b4 Various fixes, cleanup 2020-10-12 09:07:44 -04:00
InsanityAutomation 3bd861bf19 DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-12 09:07:44 -04:00
InsanityAutomation ed3de53587 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-12 09:07:44 -04:00
InsanityAutomation 82eddcd6e7 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-12 09:07:44 -04:00
InsanityAutomation 3929349c1b Fix z-min mechanical gantry alignment 2020-10-12 09:07:44 -04:00
InsanityAutomation e095f94f9f Merge compatability fixes 2020-10-12 09:07:44 -04:00
InsanityAutomation 9127ec6bd7 Update Configuration_adv.h 2020-10-12 09:07:40 -04:00
InsanityAutomation 7a9d26d1a0 Tweaks for MiniV2 broken endstop and gantry calibration position 2020-10-12 09:07:40 -04:00
InsanityAutomation af0b517e8f Update Configuration_adv.h 2020-10-12 09:07:40 -04:00
InsanityAutomation aeb062b33e Bring over pro tft fixes from main branch 2020-10-12 09:07:40 -04:00
InsanityAutomation 15fe76dd6a Make thermal timing more forgiving, at least until PID can be better tuned for BMG-M 2020-10-12 09:07:40 -04:00
InsanityAutomation 7265db1b36 Update Configuration_adv.h 2020-10-12 09:07:39 -04:00
InsanityAutomation c5104c1d2b Adjust PID and currents on tool menu 2020-10-12 09:07:39 -04:00
InsanityAutomation 8b91d1d255 Nozzle as proble home offset application to probe points 2020-10-12 09:07:39 -04:00
InsanityAutomation 9518cb0f2e Allow M206 offsets to apply to z safe home move 2020-10-12 09:07:18 -04:00
InsanityAutomation c2bd4928a5 Batch 1 2020-10-12 09:06:42 -04:00
InsanityAutomation 7120df3b85 Update G34_M422.cpp 2020-10-12 09:06:39 -04:00
InsanityAutomation f25156971b Revert "Merge branch 'Reimplement-Prusa-M915-into-G34' of https://github.com/InsanityAutomation/Marlin into Reimplement-Prusa-M915-into-G34"
This reverts commit 491cfc6ae0, reversing
changes made to d42b24369f.
2020-10-12 09:06:39 -04:00
Scott Lahteine 650ca3baa6 Move test 2020-10-12 09:06:36 -04:00
Scott Lahteine 3ceb4a5c46 Add a CI test 2020-10-12 09:06:30 -04:00
Scott Lahteine 8511d9e781 Update Configuration_adv.h 2020-10-12 09:06:30 -04:00
InsanityAutomation 7aa6d3ef09 Enable Post G28 by default as its usually necessary 2020-10-12 09:06:30 -04:00
InsanityAutomation f7fdbb4eb3 Update Configuration_adv.h 2020-10-12 09:06:25 -04:00
InsanityAutomation 7d0cd9ccf5 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-12 09:05:22 -04:00
InsanityAutomation ead8d29316 Enable Post G28 by default as its usually necessary 2020-10-12 09:05:15 -04:00
InsanityAutomation 58a6d42db6 Update Configuration_adv.h 2020-10-12 09:05:12 -04:00
InsanityAutomation 50833c9836 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-12 09:03:49 -04:00
InsanityAutomation 5d704b8494 Fix rebase issues 2020-10-12 09:03:17 -04:00
Scott Lahteine 3621a0a3f6 Update G34_M422.cpp 2020-10-12 09:03:17 -04:00
Scott Lahteine 10b9e5ca34 Move test 2020-10-12 09:03:17 -04:00
Scott Lahteine bcef7ad91b ibid 2020-10-12 09:03:17 -04:00
Scott Lahteine 1666980b5b Fix wrapper on G34_M422.cpp 2020-10-12 09:03:17 -04:00
Scott Lahteine 58a6d1b8d4 Add a CI test 2020-10-12 09:03:17 -04:00
Scott Lahteine 2151f4c50b Use MOTOR_CURRENT_COUNT 2020-10-12 09:03:17 -04:00
Scott Lahteine ee7e532761 Update G34_M422.cpp 2020-10-12 09:03:17 -04:00
Scott Lahteine 4a7665a1e9 Update Configuration_adv.h 2020-10-12 09:03:17 -04:00
InsanityAutomation 1e4d50b6e8 Update Configuration_adv.h 2020-10-12 09:03:17 -04:00
InsanityAutomation 3ae543dd30 Fix compile errors 2020-10-12 09:03:17 -04:00
Scott Lahteine 041959f903 Clean up G34/M422 2020-10-12 09:03:17 -04:00
Scott Lahteine df922ed7c8 Stepper current refactor 2020-10-12 09:03:17 -04:00
Scott Lahteine 41534e78f8 Various fixes, cleanup 2020-10-12 09:03:17 -04:00
InsanityAutomation fabdb6a51e DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-12 09:03:16 -04:00
InsanityAutomation fac1a75596 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-12 09:03:16 -04:00
InsanityAutomation bd5ded15e7 Enable Post G28 by default as its usually necessary 2020-10-12 09:03:16 -04:00
InsanityAutomation 530e807bcd Prevent min move from going into overflow sending Z to 65k 2020-10-12 09:03:16 -04:00
InsanityAutomation 251a0268c4 Update Configuration_adv.h 2020-10-12 09:03:16 -04:00
InsanityAutomation 4fdded0e2d Fix compile errors 2020-10-12 09:03:16 -04:00
Scott Lahteine f4e26c785f …and… 2020-10-12 09:03:16 -04:00
Scott Lahteine 9100ed15fa Fix sprintf_P call 2020-10-12 09:03:16 -04:00
Scott Lahteine dc82db35d4 helpful patch 2020-10-12 09:03:16 -04:00
Scott Lahteine 610fb6fd35 Clean up G34/M422 2020-10-12 09:03:16 -04:00
Scott Lahteine 594882f7a9 Provide MSG_ITERATION 2020-10-12 09:03:16 -04:00
Scott Lahteine 4e160fea16 reorder 2020-10-12 09:03:16 -04:00
Scott Lahteine 99d5ad3b09 Stepper current refactor 2020-10-12 09:03:16 -04:00
Scott Lahteine a9f6080931 Various fixes, cleanup 2020-10-12 09:03:16 -04:00
InsanityAutomation 1b0301c89f Add missed lines from working branch 2020-10-12 09:03:16 -04:00
InsanityAutomation 94798e4465 Update G34_M422.cpp 2020-10-12 09:03:16 -04:00
InsanityAutomation 65b59a6646 DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-12 09:03:15 -04:00
InsanityAutomation 09f5b5d00a Sanity Checks, gcode calls 2020-10-12 09:03:15 -04:00
InsanityAutomation 3487cbad21 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-12 09:03:15 -04:00
InsanityAutomation da8e07b697 Merge branch 'LulzbotTestBase' of https://github.com/InsanityAutomation/Marlin into LulzbotTestBase 2020-10-11 17:00:24 -04:00
InsanityAutomation 402a13a980 Update G34_M422.cpp 2020-10-11 11:48:45 -04:00
InsanityAutomation 56f7a03a5c Update platformio.ini 2020-10-11 11:32:20 -04:00
InsanityAutomation 3113388293 set config version 2020-10-11 10:06:50 -04:00
InsanityAutomation eecfc0479a Tweak env 2020-10-11 10:06:50 -04:00
InsanityAutomation 9984643e4c Update G29.cpp 2020-10-11 10:06:50 -04:00
InsanityAutomation 58114b32ba Fix z-min mechanical gantry alignment 2020-10-11 10:06:50 -04:00
InsanityAutomation 50a6fb637f Merge compatability fixes 2020-10-11 10:06:50 -04:00
InsanityAutomation d71b12cd8b Update Configuration_adv.h 2020-10-11 10:06:50 -04:00
InsanityAutomation 42842f71e0 Tweaks for MiniV2 broken endstop and gantry calibration position 2020-10-11 10:06:49 -04:00
InsanityAutomation 5213de4eaa Update Configuration_adv.h 2020-10-11 10:06:49 -04:00
InsanityAutomation 602c9fffe0 Make thermal timing more forgiving, at least until PID can be better tuned for BMG-M 2020-10-11 10:06:49 -04:00
InsanityAutomation 4d73906008 Update Configuration_adv.h 2020-10-11 10:06:49 -04:00
InsanityAutomation 0da50d80ef Adjust PID and currents on tool menu 2020-10-11 10:06:49 -04:00
InsanityAutomation f0bbc163c6 Nozzle as proble home offset application to probe points 2020-10-11 10:06:49 -04:00
InsanityAutomation 78aec86650 Allow M206 offsets to apply to z safe home move 2020-10-11 10:06:42 -04:00
InsanityAutomation 6bd2a602ca Batch 1 2020-10-11 10:06:42 -04:00
InsanityAutomation 6b923de48d Enable Post G28 by default as its usually necessary 2020-10-11 10:06:38 -04:00
InsanityAutomation a645efd189 Update Configuration_adv.h 2020-10-11 10:06:35 -04:00
Scott Lahteine a717a3eacb Provide MSG_ITERATION 2020-10-11 10:06:24 -04:00
Scott Lahteine da03b84eff reorder 2020-10-11 10:06:20 -04:00
Scott Lahteine aa6d23c7cb Stepper current refactor 2020-10-11 10:06:20 -04:00
Scott Lahteine 2a1826f1ed Various fixes, cleanup 2020-10-11 10:06:16 -04:00
InsanityAutomation 8e79ea09e4 DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-11 10:06:07 -04:00
InsanityAutomation e29dbb946e Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-11 10:06:00 -04:00
InsanityAutomation b1f8fa881d Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-11 10:05:50 -04:00
InsanityAutomation c2a2d04b50 Update G29.cpp 2020-10-11 10:05:43 -04:00
InsanityAutomation 84d0a5ebd1 Fix z-min mechanical gantry alignment 2020-10-11 10:05:43 -04:00
InsanityAutomation 6ed5c22d7c Merge compatability fixes 2020-10-11 10:05:39 -04:00
InsanityAutomation 07246fdc30 Update Configuration_adv.h 2020-10-11 10:05:35 -04:00
InsanityAutomation 14899ca3f7 Tweaks for MiniV2 broken endstop and gantry calibration position 2020-10-11 10:05:35 -04:00
InsanityAutomation 2d0972d35d Update Configuration_adv.h 2020-10-11 10:05:35 -04:00
InsanityAutomation c43828b2e3 Bring over pro tft fixes from main branch 2020-10-11 10:05:34 -04:00
InsanityAutomation bc13685c46 Make thermal timing more forgiving, at least until PID can be better tuned for BMG-M 2020-10-11 10:05:26 -04:00
InsanityAutomation 14d374dc2b Update Configuration_adv.h 2020-10-11 10:05:26 -04:00
InsanityAutomation 5dc45f2ceb Adjust PID and currents on tool menu 2020-10-11 10:05:26 -04:00
InsanityAutomation 8ed81063a2 Nozzle as proble home offset application to probe points 2020-10-11 10:05:26 -04:00
InsanityAutomation cb92d78a46 Allow M206 offsets to apply to z safe home move 2020-10-11 10:05:21 -04:00
InsanityAutomation d94a20e63a Batch 1 2020-10-11 10:05:10 -04:00
InsanityAutomation b2ff518c27 Update G29.cpp 2020-10-11 09:55:14 -04:00
Scott Lahteine 4c1d5e8fcf Update G29.cpp 2020-10-11 09:55:14 -04:00
Scott Lahteine e13d6ba012 safe_homing_xy is defined in motion.h 2020-10-11 09:55:14 -04:00
InsanityAutomation ec08edd240 Update G28.cpp 2020-10-11 09:55:13 -04:00
InsanityAutomation 1c890a9da0 Apply home offsets to probing and Z Safe Homing 2020-10-11 09:55:13 -04:00
InsanityAutomation e070ce987f Update G34_M422.cpp 2020-10-11 09:51:37 -04:00
InsanityAutomation 45b75301a8 Revert "Merge branch 'Reimplement-Prusa-M915-into-G34' of https://github.com/InsanityAutomation/Marlin into Reimplement-Prusa-M915-into-G34"
This reverts commit 491cfc6ae0, reversing
changes made to d42b24369f.
2020-10-11 09:45:39 -04:00
InsanityAutomation 491cfc6ae0 Merge branch 'Reimplement-Prusa-M915-into-G34' of https://github.com/InsanityAutomation/Marlin into Reimplement-Prusa-M915-into-G34 2020-10-11 09:44:41 -04:00
InsanityAutomation d42b24369f Fix rebase issues 2020-10-11 09:43:57 -04:00
Scott Lahteine 8280cfef43 Update G34_M422.cpp 2020-10-10 14:24:29 -04:00
Scott Lahteine 785da0db6c Move test 2020-10-10 14:24:29 -04:00
Scott Lahteine eaad3c451c ibid 2020-10-10 14:24:29 -04:00
Scott Lahteine fd751bd3fe Fix wrapper on G34_M422.cpp 2020-10-10 14:24:14 -04:00
Scott Lahteine 0785d312f7 Add a CI test 2020-10-10 14:24:14 -04:00
Scott Lahteine 5dc96c7324 Use MOTOR_CURRENT_COUNT 2020-10-10 14:24:13 -04:00
Scott Lahteine 2532ef1049 Update G34_M422.cpp 2020-10-10 14:24:13 -04:00
Scott Lahteine dd2d4df3dc Update Configuration_adv.h 2020-10-10 14:24:13 -04:00
InsanityAutomation a583d8998f Update Configuration_adv.h 2020-10-10 14:24:13 -04:00
InsanityAutomation 953cf6f7d6 Fix compile errors 2020-10-10 14:23:11 -04:00
Scott Lahteine fcd4fa4ab7 Clean up G34/M422 2020-10-10 14:22:41 -04:00
Scott Lahteine 123a2b28fc Stepper current refactor 2020-10-10 14:21:57 -04:00
Scott Lahteine 28261437f8 Various fixes, cleanup 2020-10-10 14:20:38 -04:00
InsanityAutomation c0a48e4fe2 DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-10 14:19:08 -04:00
InsanityAutomation 5b2353a2ab Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-10 14:16:11 -04:00
InsanityAutomation cafd4ff6a6 Enable Post G28 by default as its usually necessary 2020-10-10 14:13:52 -04:00
InsanityAutomation f98aff039c Prevent min move from going into overflow sending Z to 65k 2020-10-10 14:13:52 -04:00
InsanityAutomation 5e93e09c1a Update Configuration_adv.h 2020-10-10 14:13:52 -04:00
InsanityAutomation ca5c5fdd40 Fix compile errors 2020-10-10 14:13:52 -04:00
Scott Lahteine 71c1b8ca6d …and… 2020-10-10 14:13:52 -04:00
Scott Lahteine e5c2fbd6ac Fix sprintf_P call 2020-10-10 14:13:52 -04:00
Scott Lahteine 3618b9c7be helpful patch 2020-10-10 14:13:52 -04:00
Scott Lahteine 7ab7cfc96d Clean up G34/M422 2020-10-10 14:13:52 -04:00
Scott Lahteine 92db4f2d84 Provide MSG_ITERATION 2020-10-10 14:13:52 -04:00
Scott Lahteine e2ce5865c9 reorder 2020-10-10 14:13:52 -04:00
Scott Lahteine 6815edf8d6 Stepper current refactor 2020-10-10 14:13:52 -04:00
Scott Lahteine f8ff1c8d6a Various fixes, cleanup 2020-10-10 14:13:51 -04:00
InsanityAutomation 6ab5745875 Add missed lines from working branch 2020-10-10 14:13:51 -04:00
InsanityAutomation 8bb6a9b44a Update G34_M422.cpp 2020-10-10 14:13:51 -04:00
InsanityAutomation 52ec2a266f DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-10 14:13:51 -04:00
InsanityAutomation 33f6219f06 Sanity Checks, gcode calls 2020-10-10 14:13:51 -04:00
InsanityAutomation dd6153f317 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-10 14:13:51 -04:00
InsanityAutomation 05af0cbb55 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-10-10 13:57:26 -04:00
Scott Lahteine ff39019034 Update G34_M422.cpp 2020-10-10 12:40:08 -05:00
Scott Lahteine a5eefa9ffa Move test 2020-10-10 12:36:35 -05:00
Scott Lahteine 109e8f88ce ibid 2020-10-10 12:34:08 -05:00
Scott Lahteine 00413994dd Fix wrapper on G34_M422.cpp 2020-10-10 12:32:19 -05:00
Scott Lahteine 8e39965b2d Add a CI test 2020-10-10 12:31:17 -05:00
Scott Lahteine 87f6e91f51 Use MOTOR_CURRENT_COUNT 2020-10-10 12:27:46 -05:00
Scott Lahteine 0cb0df6bee Update G34_M422.cpp 2020-10-10 12:17:07 -05:00
Scott Lahteine 80e2ab6ed6 Update Configuration_adv.h 2020-10-10 12:12:36 -05:00
InsanityAutomation e406791b6f set config version 2020-10-04 12:44:43 -04:00
InsanityAutomation 438eb8ebb3 Tweak env 2020-10-04 12:39:08 -04:00
InsanityAutomation 206b5ab014 Update G29.cpp 2020-10-04 12:39:08 -04:00
InsanityAutomation 2ab7fa652c Fix z-min mechanical gantry alignment 2020-10-04 12:39:08 -04:00
InsanityAutomation 87d1df38de Merge compatability fixes 2020-10-04 12:39:08 -04:00
InsanityAutomation c392cb6d9d Update Configuration_adv.h 2020-10-04 12:39:08 -04:00
InsanityAutomation 7ae0805095 Tweaks for MiniV2 broken endstop and gantry calibration position 2020-10-04 12:39:08 -04:00
InsanityAutomation a2f86e84a4 Update Configuration_adv.h 2020-10-04 12:39:08 -04:00
InsanityAutomation b8a2160f82 Bring over pro tft fixes from main branch 2020-10-04 12:39:07 -04:00
InsanityAutomation 99d49108c1 Make thermal timing more forgiving, at least until PID can be better tuned for BMG-M 2020-10-04 12:39:07 -04:00
InsanityAutomation e6671b3065 Update Configuration_adv.h 2020-10-04 12:39:07 -04:00
InsanityAutomation df82a0e497 Adjust PID and currents on tool menu 2020-10-04 12:39:07 -04:00
InsanityAutomation 1832269181 Nozzle as proble home offset application to probe points 2020-10-04 12:39:07 -04:00
InsanityAutomation 8341f282ee Allow M206 offsets to apply to z safe home move 2020-10-04 12:39:07 -04:00
InsanityAutomation 4fdf747445 Batch 1 2020-10-04 12:39:07 -04:00
InsanityAutomation 61b6a0ea9f Enable Post G28 by default as its usually necessary 2020-10-04 12:38:55 -04:00
InsanityAutomation 5006ca07be Prevent min move from going into overflow sending Z to 65k 2020-10-04 12:38:55 -04:00
InsanityAutomation 8579af67a2 Update Configuration_adv.h 2020-10-04 12:38:54 -04:00
InsanityAutomation 8f49610d3a Fix compile errors 2020-10-04 12:38:46 -04:00
Scott Lahteine 8fd08ba1f8 …and… 2020-10-04 12:38:46 -04:00
Scott Lahteine c0c4f77c36 Fix sprintf_P call 2020-10-04 12:38:46 -04:00
Scott Lahteine b6cbad224b helpful patch 2020-10-04 12:38:46 -04:00
Scott Lahteine c765c7484c Clean up G34/M422 2020-10-04 12:38:46 -04:00
Scott Lahteine 3242d3dca2 Provide MSG_ITERATION 2020-10-04 12:38:46 -04:00
Scott Lahteine 58f774e98d reorder 2020-10-04 12:38:46 -04:00
Scott Lahteine 79ff336b2b Stepper current refactor 2020-10-04 12:38:45 -04:00
Scott Lahteine 0d367432e6 Various fixes, cleanup 2020-10-04 12:38:39 -04:00
InsanityAutomation 959919bcfe Add missed lines from working branch 2020-10-04 12:38:30 -04:00
InsanityAutomation 4f7289e022 Update G34_M422.cpp 2020-10-04 12:38:30 -04:00
InsanityAutomation af8be03165 DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-04 12:38:30 -04:00
InsanityAutomation 88ce2c94f8 Sanity Checks, gcode calls 2020-10-04 12:36:59 -04:00
InsanityAutomation 0a52d5c032 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-04 12:36:24 -04:00
InsanityAutomation 38286d9805 Enable Post G28 by default as its usually necessary 2020-10-04 12:35:54 -04:00
InsanityAutomation 0ece75536c Prevent min move from going into overflow sending Z to 65k 2020-10-04 12:35:54 -04:00
InsanityAutomation 4b377bb032 Update Configuration_adv.h 2020-10-04 12:35:54 -04:00
InsanityAutomation 0392a56193 Fix compile errors 2020-10-04 12:35:54 -04:00
Scott Lahteine 58654b3664 …and… 2020-10-04 12:35:53 -04:00
Scott Lahteine 8b324e08d9 Fix sprintf_P call 2020-10-04 12:35:53 -04:00
Scott Lahteine 1bf3881adc helpful patch 2020-10-04 12:35:53 -04:00
Scott Lahteine e2c1ca3bca Clean up G34/M422 2020-10-04 12:35:53 -04:00
Scott Lahteine 234b15a12c Provide MSG_ITERATION 2020-10-04 12:35:53 -04:00
Scott Lahteine 80a0c3b028 reorder 2020-10-04 12:35:53 -04:00
Scott Lahteine e73644f3fe Stepper current refactor 2020-10-04 12:35:53 -04:00
Scott Lahteine 9a6d6a4405 Various fixes, cleanup 2020-10-04 12:35:52 -04:00
InsanityAutomation 777abb71b5 Add missed lines from working branch 2020-10-04 12:35:52 -04:00
InsanityAutomation ac4ffdb4e5 Update G34_M422.cpp 2020-10-04 12:35:52 -04:00
InsanityAutomation 691a297b6a DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-10-04 12:35:52 -04:00
InsanityAutomation bec97532ee Sanity Checks, gcode calls 2020-10-04 12:35:52 -04:00
InsanityAutomation 406cd0cc83 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-10-04 12:35:52 -04:00
Victor Oliveira 62af625be4 STM32F1Minor SPI fixes, systick_callback for HAL compatibility (#19565) 2020-10-01 20:52:42 -05:00
InsanityAutomation 26917ebf96 Merge branch 'Reimplement-Prusa-M915-into-G34' of https://github.com/InsanityAutomation/Marlin into Reimplement-Prusa-M915-into-G34 2020-09-23 18:53:45 -04:00
InsanityAutomation 3d8bfb036d Enable Post G28 by default as its usually necessary 2020-09-23 18:50:54 -04:00
InsanityAutomation a0f0af5da8 Prevent min move from going into overflow sending Z to 65k 2020-09-23 18:50:54 -04:00
InsanityAutomation 27c99f74ad Update Configuration_adv.h 2020-09-23 18:50:54 -04:00
InsanityAutomation 050cef7b48 Fix compile errors 2020-09-23 18:50:54 -04:00
Scott Lahteine 5d74ace99f …and… 2020-09-23 18:50:54 -04:00
Scott Lahteine 3130fd9532 Fix sprintf_P call 2020-09-23 18:50:54 -04:00
Scott Lahteine f0c531abb6 helpful patch 2020-09-23 18:50:53 -04:00
Scott Lahteine ce2874b732 Clean up G34/M422 2020-09-23 18:50:53 -04:00
Scott Lahteine a55cef1165 Provide MSG_ITERATION 2020-09-23 18:50:53 -04:00
Scott Lahteine 682b0b440d reorder 2020-09-23 18:50:53 -04:00
Scott Lahteine 7025912957 Stepper current refactor 2020-09-23 18:50:53 -04:00
Scott Lahteine bb6b23891c Various fixes, cleanup 2020-09-23 18:50:52 -04:00
InsanityAutomation 1b211947b8 Add missed lines from working branch 2020-09-23 18:50:52 -04:00
InsanityAutomation ea15d3edab Update G34_M422.cpp 2020-09-23 18:50:52 -04:00
InsanityAutomation 47c6f8a98b DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-09-23 18:50:52 -04:00
InsanityAutomation ccb2c3bb85 Sanity Checks, gcode calls 2020-09-23 18:50:52 -04:00
InsanityAutomation e74b9776e5 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-09-23 18:50:52 -04:00
InsanityAutomation e61bbe1499 Enable Post G28 by default as its usually necessary 2020-09-19 00:27:23 -04:00
InsanityAutomation ffd7062e21 Prevent min move from going into overflow sending Z to 65k 2020-09-19 00:14:10 -04:00
InsanityAutomation 7255ca0bc6 Update Configuration_adv.h 2020-09-19 00:02:06 -04:00
InsanityAutomation f7c56bc5e4 Fix compile errors 2020-09-17 11:16:01 -04:00
InsanityAutomation e4c973487b Merge branch 'bugfix-2.0.x' into Reimplement-Prusa-M915-into-G34 2020-09-17 10:40:14 -04:00
Scott Lahteine d4ab268bbf …and… 2020-09-16 16:38:01 -04:00
Scott Lahteine b4dbf606b7 Fix sprintf_P call 2020-09-16 16:38:01 -04:00
Scott Lahteine f6a1d772c2 helpful patch 2020-09-16 16:38:00 -04:00
Scott Lahteine ae208fa92f Clean up G34/M422 2020-09-16 16:38:00 -04:00
Scott Lahteine f11d496899 Provide MSG_ITERATION 2020-09-16 16:38:00 -04:00
Scott Lahteine a3d0fe53cf reorder 2020-09-16 16:38:00 -04:00
Scott Lahteine 395d11b06f Stepper current refactor 2020-09-16 16:38:00 -04:00
Scott Lahteine e79b328103 Various fixes, cleanup 2020-09-16 16:37:59 -04:00
InsanityAutomation 1c19d9a86a Add missed lines from working branch 2020-09-16 16:37:59 -04:00
InsanityAutomation 6043f88b35 Update G34_M422.cpp 2020-09-16 16:37:59 -04:00
InsanityAutomation 2087e6fbcf DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested 2020-09-16 16:37:59 -04:00
InsanityAutomation c67086bdba Sanity Checks, gcode calls 2020-09-16 16:37:59 -04:00
InsanityAutomation 24e6dbcf48 Add New G34 mode for current adjustable drivers
TODO : Sanity checks, Finish DAC mode, Test on Rambo
2020-09-16 16:37:58 -04:00
878 changed files with 21101 additions and 30642 deletions
+40
View File
@@ -0,0 +1,40 @@
#
# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app
#
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 60
# Skip issues and pull requests created before a given timestamp. Timestamp must
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
skipCreatedBefore: false
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
exemptLabels: [ 'no-locking' ]
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
# Assign `resolved` as the reason for locking. Set to `false` to disable
setLockReason: true
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings just for `issues` or `pulls`
# issues:
# exemptLabels:
# - help-wanted
# lockLabel: outdated
# pulls:
# daysUntilLock: 30
# Repository to extend settings from
# _extends: repo
+2 -2
View File
@@ -19,7 +19,7 @@ jobs:
steps:
- name: Check out bugfix-2.0.x
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
ref: bugfix-2.0.x
@@ -39,7 +39,7 @@ jobs:
exit 0
- name: Check out bugfix-2.1.x
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
ref: bugfix-2.1.x
-73
View File
@@ -1,73 +0,0 @@
#
# ci-unit-tests.yml
# Build and execute unit tests to catch functional issues in code
#
name: CI - Unit Tests
on:
pull_request:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths-ignore:
- config/**
- data/**
- docs/**
- '**/*.md'
push:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths-ignore:
- config/**
- data/**
- docs/**
- '**/*.md'
jobs:
# This runs all unit tests as a single job. While it should be possible to break this up into
# multiple jobs, they currently run quickly and finish long before the compilation tests.
run_unit_tests:
name: Unit Test
# These tests will only be able to run on the bugfix-2.1.x branch, until the next release
# pulls them into additional branches.
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
steps:
- name: Check out the PR
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Select Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- name: Install PlatformIO
run: |
pip install -U platformio
pio upgrade --dev
pio pkg update --global
- name: Run All Unit Tests
run: |
make unit-test-all-local
-51
View File
@@ -1,51 +0,0 @@
#
# ci-validate-pins.yml
# Validate that all of the pins files are unchanged by pinsformat.py
#
name: CI - Validate Pins Files
on:
pull_request:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths:
- 'Marlin/src/pins/*/**'
push:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths:
- 'Marlin/src/pins/*/**'
jobs:
validate_pins_files:
name: Validate Pins Files
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
steps:
- name: Check out the PR
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Select Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- name: Validate all pins files
run: |
make validate-pins -j
+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
- "Needs: Work"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Remove Labels
uses: actions-ecosystem/action-remove-labels@v1
with:
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
- uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: |
+6 -6
View File
@@ -17,15 +17,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
- uses: dessant/lock-threads@v2
with:
github-token: ${{ github.token }}
process-only: 'issues'
issue-inactive-days: '60'
exclude-issue-created-before: ''
exclude-any-issue-labels: 'no-locking'
add-issue-labels: ''
issue-comment: >
issue-lock-inactive-days: '60'
issue-exclude-created-before: ''
issue-exclude-labels: 'no-locking'
issue-lock-labels: ''
issue-lock-comment: >
This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
@@ -1,9 +1,9 @@
#
# ci-build-tests.yml
# test-builds.yml
# Do test builds to catch compile errors
#
name: CI - Build Tests
name: CI
on:
pull_request:
@@ -14,8 +14,6 @@ on:
- config/**
- data/**
- docs/**
- test/**
- Marlin/tests/**
- '**/*.md'
push:
branches:
@@ -25,13 +23,11 @@ on:
- config/**
- data/**
- docs/**
- test/**
- Marlin/tests/**
- '**/*.md'
jobs:
test_builds:
name: Build Test
name: Run All Tests
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
@@ -156,7 +152,7 @@ jobs:
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -164,13 +160,13 @@ jobs:
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Select Python 3.9
uses: actions/setup-python@v5
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
+20 -55
View File
@@ -2,23 +2,16 @@ SCRIPTS_DIR := buildroot/share/scripts
CONTAINER_RT_BIN := docker
CONTAINER_RT_OPTS := --rm -v $(PWD):/code -v platformio-cache:/root/.platformio
CONTAINER_IMAGE := marlin-dev
UNIT_TEST_CONFIG ?= default
help:
@echo "Tasks for local development:"
@echo "make marlin : Build marlin for the configured board"
@echo "make format-pins -j : Reformat all pins files (-j for parallel execution)"
@echo "make validate-pins -j : Validate all pins files, fails if any require reformatting"
@echo "make tests-single-ci : Run a single test from inside the CI"
@echo "make tests-single-local : Run a single test locally"
@echo "make tests-single-local-docker : Run a single test locally, using docker"
@echo "make tests-all-local : Run all tests locally"
@echo "make tests-all-local-docker : Run all tests locally, using docker"
@echo "make unit-test-single-local : Run unit tests for a single config locally"
@echo "make unit-test-single-local-docker : Run unit tests for a single config locally, using docker"
@echo "make unit-test-all-local : Run all code tests locally"
@echo "make unit-test-all-local-docker : Run all code tests locally, using docker"
@echo "make setup-local-docker : Setup local docker using buildx"
@echo "* format-pins: Reformat all pins files"
@echo "* tests-single-ci: Run a single test from inside the CI"
@echo "* tests-single-local: Run a single test locally"
@echo "* tests-single-local-docker: Run a single test locally, using docker"
@echo "* tests-all-local: Run all tests locally"
@echo "* tests-all-local-docker: Run all tests locally, using docker"
@echo "* setup-local-docker: Build the local docker image"
@echo ""
@echo "Options for testing:"
@echo " TEST_TARGET Set when running tests-single-*, to select the"
@@ -28,77 +21,49 @@ help:
@echo " run on GitHub CI"
@echo " ONLY_TEST Limit tests to only those that contain this, or"
@echo " the index of the test (1-based)"
@echo " UNIT_TEST_CONFIG Set the name of the config from the test folder, without"
@echo " the leading number. Default is 'default'". Used with the
@echo " unit-test-single-* tasks"
@echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value"
@echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
marlin:
./buildroot/bin/mftest -a
.PHONY: marlin
.PHONY: help
tests-single-ci:
export GIT_RESET_HARD=true
$(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) PLATFORMIO_BUILD_FLAGS=-DGITHUB_ACTION
.PHONY: tests-single-ci
tests-single-local:
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
.PHONY: tests-single-local
tests-single-local-docker:
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
.PHONY: tests-single-local-docker
tests-all-local:
@python -c "import yaml" 2>/dev/null || (echo 'pyyaml module is not installed. Install it with "python -m pip install pyyaml"' && exit 1)
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
&& for TEST_TARGET in $$(python $(SCRIPTS_DIR)/get_test_targets.py) ; do \
if [ "$$TEST_TARGET" = "linux_native" ] && [ "$$(uname)" = "Darwin" ]; then \
echo "Skipping tests for $$TEST_TARGET on macOS" ; \
continue ; \
fi ; \
echo "Running tests for $$TEST_TARGET" ; \
run_tests . $$TEST_TARGET || exit 1 ; \
sleep 5; \
done
&& for TEST_TARGET in $$($(SCRIPTS_DIR)/get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
.PHONY: tests-all-local
tests-all-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
unit-test-single-local:
platformio run -t marlin_$(UNIT_TEST_CONFIG) -e linux_native_test
unit-test-single-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-single-local UNIT_TEST_CONFIG=$(UNIT_TEST_CONFIG)
unit-test-all-local:
platformio run -t test-marlin -e linux_native_test
unit-test-all-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-all-local
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
.PHONY: tests-all-local-docker
setup-local-docker:
$(CONTAINER_RT_BIN) buildx build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
.PHONY: setup-local-docker
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
.PHONY: $(PINS) format-pins validate-pins
.PHONY: $(PINS)
$(PINS): %:
@echo "Formatting $@"
@python $(SCRIPTS_DIR)/pinsformat.py $< $@
@echo "Formatting $@" && node buildroot/share/scripts/pinsformat.js $@
format-pins: $(PINS)
validate-pins: format-pins
@echo "Validating pins files"
@git diff --exit-code || (git status && echo "\nError: Pins files are not formatted correctly. Run \"make format-pins\" to fix.\n" && exit 1)
+507 -248
View File
File diff suppressed because it is too large Load Diff
+418 -247
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
Marlin Firmware
(c) 2011-2024 MarlinFirmware
(c) 2011-2023 MarlinFirmware
Portions of Marlin are (c) by their respective authors.
All code complies with GPLv2 and/or GPLv3
+1 -1
View File
@@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2024-05-24"
//#define STRING_DISTRIBUTION_DATE "2024-01-09"
/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
+103
View File
@@ -0,0 +1,103 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Custom Bitmap for splashscreen
*
* You may use one of the following tools to generate the C++ bitmap array from
* a black and white image:
*
* - http://www.marlinfw.org/tools/u8glib/converter.html
* - http://www.digole.com/tools/PicturetoC_Hex_converter.php
*/
#include <avr/pgmspace.h>
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
#define CUSTOM_BOOTSCREEN_BMPWIDTH 60
#define CUSTOM_BOOTSCREEN_BMPHEIGHT 64
const unsigned char custom_start_bmp[574] PROGMEM = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x12, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x23, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x4c, 0x80, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x5e, 0x80, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x92, 0x40, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0xa1, 0x40, 0x0, 0x0, 0x0,
0x0, 0x0, 0x1, 0x21, 0x20, 0x0, 0x0, 0x0,
0x0, 0x0, 0x2, 0x7f, 0x90, 0x0, 0x0, 0x0,
0x0, 0x0, 0x2, 0x0, 0x10, 0x0, 0x0, 0x0,
0x0, 0x0, 0x7, 0xff, 0xf8, 0x0, 0x0, 0x0,
0x0, 0x0, 0x4, 0x0, 0x8, 0x0, 0x0, 0x0,
0x0, 0x0, 0x8, 0x0, 0x4, 0x0, 0x0, 0x0,
0x0, 0x0, 0x8, 0x0, 0x6, 0x0, 0x0, 0x0,
0x0, 0x0, 0x10, 0x0, 0x2, 0x0, 0x0, 0x0,
0x0, 0x0, 0x30, 0x1e, 0x1, 0x0, 0x0, 0x0,
0x0, 0x0, 0x20, 0x7f, 0x81, 0x0, 0x0, 0x0,
0x0, 0x0, 0x41, 0xff, 0xe0, 0x80, 0x0, 0x0,
0x0, 0x0, 0x43, 0xfc, 0xf0, 0x80, 0x0, 0x0,
0x0, 0x0, 0x87, 0x3b, 0x78, 0x40, 0x0, 0x0,
0x0, 0x1, 0x8e, 0xdb, 0xfc, 0x60, 0x0, 0x0,
0x0, 0x1, 0xf, 0xeb, 0xcc, 0x20, 0x0, 0x0,
0x0, 0x2, 0x1f, 0xed, 0xb6, 0x10, 0x0, 0x0,
0x0, 0x2, 0x1f, 0xde, 0xb6, 0x10, 0x0, 0x0,
0x0, 0x4, 0x39, 0xcd, 0x7f, 0x8, 0x0, 0x0,
0x0, 0x4, 0x36, 0xe0, 0xff, 0x8, 0x0, 0x0,
0x0, 0x8, 0x7e, 0xc0, 0xbb, 0x84, 0x0, 0x0,
0x0, 0x18, 0x7f, 0x0, 0x5d, 0x86, 0x0, 0x0,
0x0, 0x10, 0x7f, 0xc0, 0xed, 0x82, 0x0, 0x0,
0x0, 0x20, 0x3c, 0xc0, 0x73, 0x1, 0x0, 0x0,
0x0, 0x20, 0x3b, 0x33, 0x7f, 0x1, 0x0, 0x0,
0x0, 0x70, 0x1b, 0xe7, 0x7e, 0x3, 0x80, 0x0,
0x0, 0xc8, 0x1d, 0xee, 0xde, 0x4, 0xc0, 0x0,
0x0, 0x88, 0xf, 0xde, 0xdc, 0x4, 0x40, 0x0,
0x1, 0x24, 0xf, 0xdf, 0x3c, 0x9, 0x20, 0x0,
0x1, 0x26, 0x7, 0xdb, 0xf8, 0x19, 0x20, 0x0,
0x2, 0x72, 0x3, 0xe7, 0xf0, 0x13, 0x90, 0x0,
0x2, 0x51, 0x1, 0xff, 0xe0, 0x22, 0x90, 0x0,
0x4, 0x89, 0x0, 0x7f, 0x80, 0x24, 0x48, 0x0,
0x9, 0x4, 0x80, 0x1e, 0x0, 0x48, 0x24, 0x0,
0xb, 0xfe, 0x40, 0x0, 0x0, 0xdf, 0xf4, 0x0,
0x10, 0x0, 0x40, 0x0, 0x0, 0x80, 0x2, 0x0,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x10, 0x22, 0x10, 0x3c, 0x3c, 0xe, 0x1f, 0x0,
0x10, 0x22, 0x10, 0x4, 0x22, 0x11, 0x4, 0x0,
0x10, 0x22, 0x10, 0x8, 0x22, 0x11, 0x4, 0x0,
0x10, 0x22, 0x10, 0x8, 0x3c, 0x11, 0x4, 0x0,
0x10, 0x22, 0x10, 0x10, 0x22, 0x11, 0x4, 0x0,
0x10, 0x22, 0x10, 0x20, 0x22, 0x11, 0x4, 0x0,
0x1e, 0x1c, 0x1e, 0x3c, 0x3c, 0xe, 0x4, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
};
-6
View File
@@ -81,12 +81,6 @@ void MarlinHAL::init() {
#if HAS_SERVO_3
OUT_WRITE(SERVO3_PIN, LOW);
#endif
#if HAS_SERVO_4
OUT_WRITE(SERVO4_PIN, LOW);
#endif
#if HAS_SERVO_5
OUT_WRITE(SERVO5_PIN, LOW);
#endif
init_pwm_timers(); // Init user timers to default frequency - 1000HZ
+2
View File
@@ -119,6 +119,7 @@ void spiBegin() {
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
}
/** begin spi transaction */
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
// Based on Arduino SPI library
@@ -174,6 +175,7 @@ void spiBegin() {
SPSR = clockDiv | 0x01;
}
#else // SOFTWARE_SPI || FORCE_SOFT_SPI
// ------------------------
+1
View File
@@ -63,6 +63,7 @@
static volatile int8_t Channel[_Nbr_16timers]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
/************ static functions common to all instances ***********************/
static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) {
+3 -3
View File
@@ -35,14 +35,14 @@
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v);
@@ -61,7 +61,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
+1
View File
@@ -91,6 +91,7 @@ void endstop_ISR() { endstops.update(); }
#endif
// Install Pin change interrupt for a pin. Can be called multiple times.
void pciSetup(const int8_t pin) {
if (digitalPinHasPCICR(pin)) {
@@ -679,6 +679,7 @@
#define PF7_PWM 0
#define PF7_DDR DDRF
/**
* Some of the pin mapping functions of the Teensduino extension to the Arduino IDE
* do not function the same as the other Arduino extensions.
@@ -1,22 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
+3
View File
@@ -163,6 +163,7 @@ bool pwm_status(uint8_t pin) {
SERIAL_ECHO_SP(2);
} // pwm_status
const volatile uint8_t* const PWM_other[][3] PROGMEM = {
{ &TCCR0A, &TCCR0B, &TIMSK0 },
{ &TCCR1A, &TCCR1B, &TIMSK1 },
@@ -180,6 +181,7 @@ const volatile uint8_t* const PWM_other[][3] PROGMEM = {
#endif
};
const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
#ifdef TIMER0A
@@ -215,6 +217,7 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
#endif
};
#define TCCR_A(T) pgm_read_word(&PWM_other[T][0])
#define TCCR_B(T) pgm_read_word(&PWM_other[T][1])
#define TIMSK(T) pgm_read_word(&PWM_other[T][2])
@@ -120,6 +120,7 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) {
U8G_ATOMIC_END();
}
#if ENABLED(FYSETC_MINI_12864)
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
#else
+1 -1
View File
@@ -42,7 +42,7 @@
// Public functions
// ------------------------
#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI)
#if ANY(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI)
// ------------------------
// Software SPI
+1
View File
@@ -474,6 +474,7 @@ void MarlinSerial<Cfg>::flushTX() {
}
}
// If not using the USB port as serial port
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
+3 -3
View File
@@ -958,14 +958,14 @@ static void ee_Init() {
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { ee_Init(); return true; }
bool PersistentStore::access_finish() { ee_Flush(); return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value;
if (v != ee_Read(uint32_t(p))) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
ee_Write(uint32_t(p), v);
@@ -984,7 +984,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t c = ee_Read(uint32_t(REAL_EEPROM_ADDR(pos)));
uint8_t c = ee_Read(uint32_t(pos));
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
+3 -3
View File
@@ -36,14 +36,14 @@
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v);
@@ -62,7 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
+1 -1
View File
@@ -61,7 +61,7 @@
#else
#define G2_PWM_Z 0
#endif
#if HAS_MOTOR_CURRENT_PWM_E
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
#define G2_PWM_E 1
#else
#define G2_PWM_E 0
+1
View File
@@ -49,6 +49,7 @@ extern volatile uint32_t *SODR_A, *SODR_B, *CODR_A, *CODR_B;
#define PWM_MAP_INIT_ROW(IO,ZZ) { ZZ == 'A' ? SODR_A : SODR_B, ZZ == 'A' ? CODR_A : CODR_B, 1 << _PIN(IO) }
#define PWM_MAP_INIT { PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_X_PIN, 'B'), \
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Y_PIN, 'B'), \
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Z_PIN, 'B'), \
+1
View File
@@ -168,6 +168,7 @@ const G2_PinDescription G2_g_APinDescription[] = {
{ PIOB, PIO_PB21, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 52
{ PIOB, PIO_PB14, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 53
// 54 .. 65 - Analog pins
// ----------------------
{ PIOA, PIO_PA16X1_AD7, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NOT_ON_PWM, NOT_ON_TIMER }, // AD0
@@ -1,22 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
+2 -2
View File
@@ -72,10 +72,10 @@
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
#if ENABLED(TMC_USE_SW_SPI)
#if DISABLED(SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
#endif
#elif ENABLED(SOFTWARE_SPI)
#elif ENABLED(DUE_SOFTWARE_SPI)
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
#endif
#endif
+1 -1
View File
@@ -48,7 +48,7 @@
#define SD_MOSI_PIN 75
#else
// defaults
#define SOFTWARE_SPI
#define DUE_SOFTWARE_SPI
#ifndef SD_SCK_PIN
#define SD_SCK_PIN 52
#endif
+11
View File
@@ -142,6 +142,7 @@
*/
#define COMPILER_PACK_RESET() COMPILER_PRAGMA(pack())
/**
* \brief Set aligned boundary.
*/
@@ -282,6 +283,7 @@ typedef double F64; //!< 64-bit floating-point number.
typedef uint32_t iram_size_t;
//! @}
/*! \name Status Types
*/
//! @{
@@ -289,6 +291,7 @@ typedef bool Status_bool_t; //!< Boolean status.
typedef U8 Status_t; //!< 8-bit-coded status.
//! @}
/*! \name Aliasing Aggregate Types
*/
//! @{
@@ -459,6 +462,7 @@ typedef struct
#endif
//! @}
#ifndef __ASSEMBLY__ // not for assembling.
//! \name Optimization Control
@@ -577,6 +581,7 @@ typedef struct
//! @}
/*! \name Zero-Bit Counting
*
* Under GCC, __builtin_clz and __builtin_ctz behave like macros when
@@ -687,6 +692,7 @@ typedef struct
//! @}
/*! \name Bit Reversing
*/
//! @{
@@ -726,6 +732,7 @@ typedef struct
//! @}
/*! \name Alignment
*/
//! @{
@@ -791,6 +798,7 @@ typedef struct
*/
#define Long_call(addr) ((*(void (*)(void))(addr))())
/*! \name MCU Endianism Handling
* ARM is MCU little endianism.
*/
@@ -860,6 +868,7 @@ typedef struct
#define CPU_TO_BE32(x) swap32(x)
//! @}
/*! \name Endianism Conversion
*
* The same considerations as for clz and ctz apply here but GCC's
@@ -946,6 +955,7 @@ typedef struct
//! @}
/*! \name Target Abstraction
*/
//! @{
@@ -987,6 +997,7 @@ typedef U8 Byte; //!< 8-bit unsigned integer.
#endif // #ifndef __ASSEMBLY__
#ifdef __ICCARM__
#define SHORTENUM __packed
#elif defined(__GNUC__)
+2
View File
@@ -81,6 +81,7 @@
#define LUN_0_NAME "\"SD/MMC Card\""
//! @}
/*! \name Actions Associated with Memory Accesses
*
* Write here the action to associate with each memory access.
@@ -111,4 +112,5 @@
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
//! @}
#endif // _CONF_ACCESS_H_
+1
View File
@@ -96,4 +96,5 @@
// - UPLL frequency: 480MHz
// - USB clock: 480 / 1 = 480MHz
#endif /* CONF_CLOCK_H_INCLUDED */
+4
View File
@@ -88,6 +88,7 @@
#endif
//@}
/**
* USB Device Callbacks definitions (Optional)
* @{
@@ -149,6 +150,7 @@
//@}
/**
* USB Interface Configuration
* @{
@@ -208,6 +210,7 @@
//@}
//@}
/**
* Configuration of MSC interface
* @{
@@ -242,6 +245,7 @@
//@}
/**
* Description of Composite Device
* @{
+28
View File
@@ -68,6 +68,7 @@
#endif
#include "ctrl_access.h"
//_____ D E F I N I T I O N S ______________________________________________
#ifdef FREERTOS_USED
@@ -111,6 +112,7 @@ static xSemaphoreHandle ctrl_access_semphr = NULL;
#endif // FREERTOS_USED
#if MAX_LUN
/*! \brief Initializes an entry of the LUN descriptor table.
@@ -240,14 +242,17 @@ static const struct
#endif
#if GLOBAL_WR_PROTECT == true
bool g_wr_protect;
#endif
/*! \name Control Interface
*/
//! @{
#ifdef FREERTOS_USED
bool ctrl_access_init(void)
@@ -265,6 +270,7 @@ bool ctrl_access_init(void)
return true;
}
/*! \brief Locks accesses to LUNs.
*
* \return \c true if the access was successfully locked, else \c false.
@@ -282,6 +288,7 @@ static bool ctrl_access_lock(void)
#endif // FREERTOS_USED
U8 get_nb_lun(void)
{
#if MEM_USB == ENABLE
@@ -302,11 +309,13 @@ U8 get_nb_lun(void)
#endif
}
U8 get_cur_lun(void)
{
return LUN_ID_0;
}
Ctrl_status mem_test_unit_ready(U8 lun)
{
Ctrl_status status;
@@ -328,6 +337,7 @@ Ctrl_status mem_test_unit_ready(U8 lun)
return status;
}
Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
{
Ctrl_status status;
@@ -349,6 +359,7 @@ Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
return status;
}
U8 mem_sector_size(U8 lun)
{
U8 sector_size;
@@ -370,6 +381,7 @@ U8 mem_sector_size(U8 lun)
return sector_size;
}
bool mem_unload(U8 lun, bool unload)
{
bool unloaded;
@@ -421,6 +433,7 @@ bool mem_wr_protect(U8 lun)
return wr_protect;
}
bool mem_removal(U8 lun)
{
bool removal;
@@ -445,6 +458,7 @@ bool mem_removal(U8 lun)
return removal;
}
const char *mem_name(U8 lun)
{
#if MAX_LUN==0
@@ -461,14 +475,17 @@ const char *mem_name(U8 lun)
#endif
}
//! @}
#if ACCESS_USB == true
/*! \name MEM <-> USB Interface
*/
//! @{
Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
{
Ctrl_status status;
@@ -488,6 +505,7 @@ Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
return status;
}
Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
{
Ctrl_status status;
@@ -507,16 +525,19 @@ Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
return status;
}
//! @}
#endif // ACCESS_USB == true
#if ACCESS_MEM_TO_RAM == true
/*! \name MEM <-> RAM Interface
*/
//! @{
Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
{
Ctrl_status status;
@@ -543,6 +564,7 @@ Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
return status;
}
Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
{
Ctrl_status status;
@@ -569,16 +591,19 @@ Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
return status;
}
//! @}
#endif // ACCESS_MEM_TO_RAM == true
#if ACCESS_STREAM == true
/*! \name Streaming MEM <-> MEM Interface
*/
//! @{
#if ACCESS_MEM_TO_MEM == true
#include "fat.h"
@@ -600,18 +625,21 @@ Ctrl_status stream_mem_to_mem(U8 src_lun, U32 src_addr, U8 dest_lun, U32 dest_ad
#endif // ACCESS_MEM_TO_MEM == true
Ctrl_status stream_state(U8 id)
{
UNUSED(id);
return CTRL_GOOD;
}
U16 stream_stop(U8 id)
{
UNUSED(id);
return 0;
}
//! @}
#endif // ACCESS_STREAM
+9
View File
@@ -56,6 +56,7 @@
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _CTRL_ACCESS_H_
#define _CTRL_ACCESS_H_
@@ -88,6 +89,7 @@ typedef enum
CTRL_BUSY = FAIL + 2 //!< Memory not initialized or changed.
} Ctrl_status;
// FYI: Each Logical Unit Number (LUN) corresponds to a memory.
// Check LUN defines.
@@ -134,6 +136,7 @@ typedef enum
#define LUN_ID_USB (MAX_LUN) //!< First dynamic LUN (USB host mass storage).
//! @}
// Include LUN header files.
#if LUN_0 == ENABLE
#include LUN_0_INCLUDE
@@ -163,11 +166,13 @@ typedef enum
#include LUN_USB_INCLUDE
#endif
// Check the configuration of write protection in conf_access.h.
#ifndef GLOBAL_WR_PROTECT
#error GLOBAL_WR_PROTECT must be defined as true or false in conf_access.h
#endif
#if GLOBAL_WR_PROTECT == true
//! Write protect.
@@ -175,6 +180,7 @@ extern bool g_wr_protect;
#endif
/*! \name Control Interface
*/
//! @{
@@ -273,6 +279,7 @@ extern const char *mem_name(U8 lun);
//! @}
#if ACCESS_USB == true
/*! \name MEM <-> USB Interface
@@ -303,6 +310,7 @@ extern Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector);
#endif // ACCESS_USB == true
#if ACCESS_MEM_TO_RAM == true
/*! \name MEM <-> RAM Interface
@@ -333,6 +341,7 @@ extern Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram);
#endif // ACCESS_MEM_TO_RAM == true
#if ACCESS_STREAM == true
/*! \name Streaming MEM <-> MEM Interface
+1
View File
@@ -57,6 +57,7 @@
#include "preprocessor.h"
//! Maximal number of repetitions supported by MREPEAT.
#define MREPEAT_LIMIT 256
+2
View File
@@ -128,6 +128,7 @@ static inline void osc_enable(uint32_t ul_id) {
pmc_switch_sclk_to_32kxtal(PMC_OSC_BYPASS);
break;
case OSC_MAINCK_4M_RC:
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz);
break;
@@ -140,6 +141,7 @@ static inline void osc_enable(uint32_t ul_id) {
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz);
break;
case OSC_MAINCK_XTAL:
pmc_switch_mainck_to_xtal(PMC_OSC_XTAL/*,
pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US,
+1
View File
@@ -51,4 +51,5 @@
#include "stringz.h"
#include "mrepeat.h"
#endif // _PREPROCESSOR_H_
+1
View File
@@ -86,6 +86,7 @@ enum scsi_sbc_mode {
SCSI_MS_MODE_CACHING = 0x08, //!< Caching mode page
};
//! \name SBC-2 Device-Specific Parameter
//@{
#define SCSI_MS_SBC_WP 0x80 //!< Write Protected
+16 -14
View File
@@ -18,32 +18,32 @@ extern "C" {
void sd_mmc_spi_mem_init() {
}
inline bool media_ready() {
return IS_SD_INSERTED() && !IS_SD_PRINTING() && !IS_SD_FILE_OPEN() && card.isMounted();
}
bool sd_mmc_spi_unload(bool) { return true; }
bool sd_mmc_spi_wr_protect() { return false; }
bool sd_mmc_spi_removal() { return !media_ready(); }
Ctrl_status sd_mmc_spi_test_unit_ready() {
#ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT;
#endif
if (!media_ready()) return CTRL_NO_PRESENT;
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
return CTRL_GOOD;
}
// NOTE: This function is defined as returning the address of the last block
// in the card, which is cardSize() - 1
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (!media_ready()) return CTRL_NO_PRESENT;
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
*nb_sector = card.diskIODriver()->cardSize() - 1;
return CTRL_GOOD;
}
bool sd_mmc_spi_unload(bool) { return true; }
bool sd_mmc_spi_wr_protect() { return false; }
bool sd_mmc_spi_removal() {
return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted());
}
#if ACCESS_USB == true
/**
* \name MEM <-> USB Interface
@@ -61,7 +61,8 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT;
#endif
if (!media_ready()) return CTRL_NO_PRESENT;
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC
{
@@ -100,7 +101,8 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT;
#endif
if (!media_ready()) return CTRL_NO_PRESENT;
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC
{
+13 -8
View File
@@ -45,6 +45,7 @@
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _SD_MMC_SPI_MEM_H_
#define _SD_MMC_SPI_MEM_H_
@@ -62,19 +63,22 @@
#error sd_mmc_spi_mem.h is #included although SD_MMC_SPI_MEM is disabled
#endif
#include "ctrl_access.h"
//_____ D E F I N I T I O N S ______________________________________________
#define SD_MMC_REMOVED 0
#define SD_MMC_INSERTED 1
#define SD_MMC_REMOVING 2
//---- CONTROL FUNCTIONS ----
//!
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
//!/
void sd_mmc_spi_mem_init();
extern void sd_mmc_spi_mem_init(void);
//!
//! @brief This function tests the state of the SD_MMC memory and sends it to the Host.
@@ -87,7 +91,7 @@ void sd_mmc_spi_mem_init();
//! Media not present -> CTRL_NO_PRESENT
//! Media has changed -> CTRL_BUSY
//!/
Ctrl_status sd_mmc_spi_test_unit_ready();
extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
//!
//! @brief This function gives the address of the last valid sector.
@@ -98,7 +102,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready();
//! Media ready -> CTRL_GOOD
//! Media not present -> CTRL_NO_PRESENT
//!/
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
/*! \brief Unload/Load the SD/MMC card selected
*
@@ -109,7 +113,7 @@ Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
*
* \return \c true if unload/load done success.
*/
bool sd_mmc_spi_unload(bool unload);
extern bool sd_mmc_spi_unload(bool unload);
//!
//! @brief This function returns the write protected status of the memory.
@@ -120,14 +124,15 @@ bool sd_mmc_spi_unload(bool unload);
//!
//! @return false -> the memory is not write-protected (always)
//!/
bool sd_mmc_spi_wr_protect();
extern bool sd_mmc_spi_wr_protect(void);
//!
//! @brief This function tells if the memory has been removed or not.
//!
//! @return false -> The memory isn't removed
//!
bool sd_mmc_spi_removal();
extern bool sd_mmc_spi_removal(void);
//---- ACCESS DATA FUNCTIONS ----
@@ -147,7 +152,7 @@ bool sd_mmc_spi_removal();
//! It is ready -> CTRL_GOOD
//! A error occur -> CTRL_FAIL
//!
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
//! This function initializes the SD/MMC memory for a write operation
//!
@@ -161,7 +166,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
//! It is ready -> CTRL_GOOD
//! An error occurs -> CTRL_FAIL
//!
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector);
extern Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector);
#endif // #if ACCESS_USB == true
+1
View File
@@ -212,6 +212,7 @@ extern "C" {
#define CONFIG_USBCLK_DIV
#endif
extern void sysclk_enable_usb(void);
extern void sysclk_disable_usb(void);
+1
View File
@@ -83,6 +83,7 @@ static usb_iface_desc_t UDC_DESC_STORAGE *udc_ptr_iface;
//! @}
//! \name Internal structure to store the USB device main strings
//! @{
+2
View File
@@ -685,4 +685,6 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void);
} \endcode
*/
#endif // _UDC_H_
+1
View File
@@ -213,6 +213,7 @@ void udd_send_remotewakeup(void);
*/
void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size );
/**
* \name Endpoint Management
*
+10
View File
@@ -457,6 +457,7 @@ void udi_cdc_data_sof_notify(void)
#endif
}
// ------------------------
//------- Internal routines to control serial line
@@ -519,6 +520,7 @@ static void udi_cdc_ctrl_state_change(uint8_t port, bool b_set, le16_t bit_mask)
udi_cdc_ctrl_state_notify(port, ep_comm);
}
static void udi_cdc_ctrl_state_notify(uint8_t port, udd_ep_id_t ep)
{
#if UDI_CDC_PORT_NB == 1 // To optimize code
@@ -540,6 +542,7 @@ static void udi_cdc_ctrl_state_notify(uint8_t port, udd_ep_id_t ep)
}
}
static void udi_cdc_serial_state_msg_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
{
uint8_t port;
@@ -575,9 +578,11 @@ static void udi_cdc_serial_state_msg_sent(udd_ep_status_t status, iram_size_t n,
udi_cdc_ctrl_state_notify(port, ep);
}
// ------------------------
//------- Internal routines to process data transfer
static bool udi_cdc_rx_start(uint8_t port)
{
irqflags_t flags;
@@ -627,6 +632,7 @@ static bool udi_cdc_rx_start(uint8_t port)
udi_cdc_data_received);
}
static void udi_cdc_data_received(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
{
uint8_t buf_sel_trans;
@@ -662,6 +668,7 @@ static void udi_cdc_data_received(udd_ep_status_t status, iram_size_t n, udd_ep_
udi_cdc_rx_start(port);
}
static void udi_cdc_data_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
{
uint8_t port;
@@ -693,6 +700,7 @@ static void udi_cdc_data_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t
udi_cdc_tx_send(port);
}
static void udi_cdc_tx_send(uint8_t port)
{
irqflags_t flags;
@@ -772,9 +780,11 @@ static void udi_cdc_tx_send(uint8_t port)
udi_cdc_data_sent);
}
// ------------------------
//------- Application interface
//------- Application interface
void udi_cdc_ctrl_signal_dcd(bool b_set)
+2
View File
@@ -106,6 +106,7 @@ typedef struct {
usb_ep_desc_t ep_notify;
} udi_cdc_comm_desc_t;
/**
* \brief Data Class interface descriptor
*
@@ -120,6 +121,7 @@ typedef struct {
usb_ep_desc_t ep_out;
} udi_cdc_data_desc_t;
//! CDC communication endpoints size for all speeds
#define UDI_CDC_COMM_EP_SIZE 64
//! CDC data endpoints size for FS speed (8B, 16B, 32B, 64B)
+1
View File
@@ -109,6 +109,7 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {
.bNumConfigurations = 1
};
#ifdef USB_DEVICE_HS_SUPPORT
//! USB Device Qualifier Descriptor for HS
COMPILER_WORD_ALIGNED
@@ -93,6 +93,7 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {
.bNumConfigurations = 1
};
#ifdef USB_DEVICE_HS_SUPPORT
//! USB Device Qualifier Descriptor for HS
COMPILER_WORD_ALIGNED
@@ -146,6 +147,7 @@ UDC_DESC_STORAGE udc_desc_t udc_desc_hs = {
};
#endif
/**
* \name UDC structures which contains all USB Device definitions
*/
+6
View File
@@ -86,6 +86,7 @@ UDC_DESC_STORAGE udi_api_t udi_api_msc = {
};
//@}
/**
* \ingroup udi_msc_group
* \defgroup udi_msc_group_internal Implementation of UDI MSC
@@ -136,6 +137,7 @@ volatile bool udi_msc_b_reset_trans = true;
//@}
/**
* \name Internal routines
*/
@@ -188,6 +190,7 @@ static void udi_msc_cbw_received(udd_ep_status_t status,
static bool udi_msc_cbw_validate(uint32_t alloc_len, uint8_t dir_flag);
//@}
/**
* \name Routines to process small data packet
*/
@@ -214,6 +217,7 @@ static void udi_msc_data_sent(udd_ep_status_t status, iram_size_t nb_sent,
udd_ep_id_t ep);
//@}
/**
* \name Routines to process CSW packet
*/
@@ -246,6 +250,7 @@ static void udi_msc_csw_sent(udd_ep_status_t status, iram_size_t nb_sent,
udd_ep_id_t ep);
//@}
/**
* \name Routines manage sense data
*/
@@ -302,6 +307,7 @@ static void udi_msc_sense_fail_cdb_invalid(void);
static void udi_msc_sense_command_invalid(void);
//@}
/**
* \name Routines manage SCSI Commands
*/
@@ -293,6 +293,7 @@ do { \
# endif
#endif
/**
* \name Power management routine.
*/
@@ -309,6 +310,7 @@ static bool udd_b_idle;
//! State of sleep manager
static bool udd_b_sleep_initialized = false;
/*! \brief Authorize or not the CPU powerdown mode
*
* \param b_enable true to authorize idle mode
@@ -336,6 +338,7 @@ static void udd_sleep_mode(bool b_idle)
//@}
/**
* \name Control endpoint low level management routine.
*
@@ -407,6 +410,7 @@ static void udd_ctrl_send_zlp_out(void);
//! \brief Call callback associated to setup request
static void udd_ctrl_endofrequest(void);
/**
* \brief Main interrupt routine for control endpoint
*
@@ -418,6 +422,7 @@ static bool udd_ctrl_interrupt(void);
//@}
/**
* \name Management of bulk/interrupt/isochronous endpoints
*
@@ -455,6 +460,7 @@ typedef struct {
uint8_t stall_requested:1;
} udd_ep_job_t;
//! Array to register a job on bulk/interrupt/isochronous endpoint
static udd_ep_job_t udd_ep_job[USB_DEVICE_MAX_EP];
@@ -516,6 +522,7 @@ static bool udd_ep_interrupt(void);
#endif // (0!=USB_DEVICE_MAX_EP)
//@}
// ------------------------
//--- INTERNAL ROUTINES TO MANAGED GLOBAL EVENTS
@@ -664,11 +671,13 @@ udd_interrupt_sof_end:
return;
}
bool udd_include_vbus_monitoring(void)
{
return true;
}
void udd_enable(void)
{
irqflags_t flags;
@@ -755,6 +764,7 @@ void udd_enable(void)
cpu_irq_restore(flags);
}
void udd_disable(void)
{
irqflags_t flags;
@@ -856,6 +866,7 @@ void udd_attach(void)
cpu_irq_restore(flags);
}
void udd_detach(void)
{
otg_unfreeze_clock();
@@ -872,6 +883,7 @@ void udd_detach(void)
udd_sleep_mode(false);
}
bool udd_is_high_speed(void)
{
#ifdef USB_DEVICE_HS_SUPPORT
@@ -881,6 +893,7 @@ bool udd_is_high_speed(void)
#endif
}
void udd_set_address(uint8_t address)
{
udd_disable_address();
@@ -888,11 +901,13 @@ void udd_set_address(uint8_t address)
udd_enable_address();
}
uint8_t udd_getaddress(void)
{
return udd_get_configured_address();
}
uint16_t udd_get_frame_number(void)
{
return udd_frame_number();
@@ -915,12 +930,14 @@ void udd_send_remotewakeup(void)
}
}
void udd_set_setup_payload(uint8_t *payload, uint16_t payload_size)
{
udd_g_ctrlreq.payload = payload;
udd_g_ctrlreq.payload_size = payload_size;
}
#if (0 != USB_DEVICE_MAX_EP)
bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
uint16_t MaxEndpointSize)
@@ -1044,6 +1061,7 @@ bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
return true;
}
void udd_ep_free(udd_ep_id_t ep)
{
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
@@ -1056,12 +1074,14 @@ void udd_ep_free(udd_ep_id_t ep)
udd_ep_job[ep_index - 1].stall_requested = false;
}
bool udd_ep_is_halted(udd_ep_id_t ep)
{
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
return Is_udd_endpoint_stall_requested(ep_index);
}
bool udd_ep_set_halt(udd_ep_id_t ep)
{
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
@@ -1102,6 +1122,7 @@ bool udd_ep_set_halt(udd_ep_id_t ep)
return true;
}
bool udd_ep_clear_halt(udd_ep_id_t ep)
{
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
@@ -1142,6 +1163,7 @@ bool udd_ep_clear_halt(udd_ep_id_t ep)
return true;
}
bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
uint8_t * buf, iram_size_t buf_size,
udd_callback_trans_t callback)
@@ -1208,6 +1230,7 @@ bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
#endif
}
void udd_ep_abort(udd_ep_id_t ep)
{
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
@@ -1236,6 +1259,7 @@ void udd_ep_abort(udd_ep_id_t ep)
udd_ep_abort_job(ep);
}
bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
udd_callback_halt_cleared_t callback)
{
@@ -1270,6 +1294,7 @@ bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
}
#endif // (0 != USB_DEVICE_MAX_EP)
#ifdef USB_DEVICE_HS_SUPPORT
void udd_test_mode_j(void)
@@ -1278,17 +1303,20 @@ void udd_test_mode_j(void)
udd_enable_hs_test_mode_j();
}
void udd_test_mode_k(void)
{
udd_enable_hs_test_mode();
udd_enable_hs_test_mode_k();
}
void udd_test_mode_se0_nak(void)
{
udd_enable_hs_test_mode();
}
void udd_test_mode_packet(void)
{
uint8_t i;
@@ -1332,6 +1360,8 @@ void udd_test_mode_packet(void)
}
#endif // USB_DEVICE_HS_SUPPORT
// ------------------------
//--- INTERNAL ROUTINES TO MANAGED THE CONTROL ENDPOINT
@@ -1381,6 +1411,7 @@ static void udd_ctrl_init(void)
udd_ep_control_state = UDD_EPCTRL_SETUP;
}
static void udd_ctrl_setup_received(void)
{
irqflags_t flags;
@@ -1442,6 +1473,7 @@ static void udd_ctrl_setup_received(void)
}
}
static void udd_ctrl_in_sent(void)
{
static bool b_shortpacket = false;
@@ -1525,6 +1557,7 @@ static void udd_ctrl_in_sent(void)
cpu_irq_restore(flags);
}
static void udd_ctrl_out_received(void)
{
irqflags_t flags;
@@ -1615,6 +1648,7 @@ static void udd_ctrl_out_received(void)
cpu_irq_restore(flags);
}
static void udd_ctrl_underflow(void)
{
if (Is_udd_out_received(0))
@@ -1631,6 +1665,7 @@ static void udd_ctrl_underflow(void)
}
}
static void udd_ctrl_overflow(void)
{
if (Is_udd_in_send(0))
@@ -1646,6 +1681,7 @@ static void udd_ctrl_overflow(void)
}
}
static void udd_ctrl_stall_data(void)
{
// Stall all packets on IN & OUT control endpoint
@@ -1653,6 +1689,7 @@ static void udd_ctrl_stall_data(void)
udd_enable_stall_handshake(0);
}
static void udd_ctrl_send_zlp_in(void)
{
irqflags_t flags;
@@ -1670,6 +1707,7 @@ static void udd_ctrl_send_zlp_in(void)
cpu_irq_restore(flags);
}
static void udd_ctrl_send_zlp_out(void)
{
irqflags_t flags;
@@ -1685,6 +1723,7 @@ static void udd_ctrl_send_zlp_out(void)
cpu_irq_restore(flags);
}
static void udd_ctrl_endofrequest(void)
{
// If a callback is registered then call it
@@ -1693,6 +1732,7 @@ static void udd_ctrl_endofrequest(void)
}
}
static bool udd_ctrl_interrupt(void)
{
@@ -1743,6 +1783,7 @@ static bool udd_ctrl_interrupt(void)
return false;
}
// ------------------------
//--- INTERNAL ROUTINES TO MANAGED THE BULK/INTERRUPT/ISOCHRONOUS ENDPOINTS
@@ -1757,6 +1798,7 @@ static void udd_ep_job_table_reset(void)
}
}
static void udd_ep_job_table_kill(void)
{
uint8_t i;
@@ -1767,6 +1809,7 @@ static void udd_ep_job_table_kill(void)
}
}
static void udd_ep_abort_job(udd_ep_id_t ep)
{
ep &= USB_EP_ADDR_MASK;
@@ -1775,6 +1818,7 @@ static void udd_ep_abort_job(udd_ep_id_t ep)
udd_ep_finish_job(&udd_ep_job[ep - 1], true, ep);
}
static void udd_ep_finish_job(udd_ep_job_t * ptr_job, bool b_abort, uint8_t ep_num)
{
if (ptr_job->busy == false) {
@@ -1845,6 +1889,7 @@ static void udd_ep_trans_done(udd_ep_id_t ep)
udd_dma_ctrl |= UOTGHS_DEVDMACONTROL_END_BUFFIT |
UOTGHS_DEVDMACONTROL_CHANN_ENB;
// Disable IRQs to have a short sequence
// between read of EOT_STA and DMA enable
flags = cpu_irq_save();
@@ -129,6 +129,7 @@ extern "C" {
#define Is_udd_vbus_transition() (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_VBUSTI))
//! @}
//! @name UOTGHS device attach control
//! These macros manage the UOTGHS Device attach.
//! @{
@@ -140,6 +141,7 @@ extern "C" {
#define Is_udd_detached() (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
//! @}
//! @name UOTGHS device bus events control
//! These macros manage the UOTGHS Device bus events.
//! @{
@@ -244,6 +246,7 @@ extern "C" {
#define udd_get_configured_address() (Rd_bitfield(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_UADD_Msk))
//! @}
//! @name UOTGHS Device endpoint drivers
//! These macros manage the common features of the endpoints.
//! @{
@@ -327,6 +330,7 @@ extern "C" {
#define udd_data_toggle(ep) (Rd_bitfield(UOTGHS_ARRAY(UOTGHS_DEVEPTISR[0], ep), UOTGHS_DEVEPTISR_DTSEQ_Msk))
//! @}
//! @name UOTGHS Device control endpoint
//! These macros control the endpoints.
//! @{
@@ -526,6 +530,7 @@ extern "C" {
//! Tests if IN sending interrupt is enabled
#define Is_udd_in_send_interrupt_enabled(ep) (Tst_bits(UOTGHS_ARRAY(UOTGHS_DEVEPTIMR[0], ep), UOTGHS_DEVEPTIMR_TXINE))
//! Get 64-, 32-, 16- or 8-bit access to FIFO data register of selected endpoint.
//! @param ep Endpoint of which to access FIFO data register
//! @param scale Data scale in bits: 64, 32, 16 or 8
@@ -647,6 +652,7 @@ typedef struct {
//! @}
//! @}
/// @cond 0
/**INDENT-OFF**/
#ifdef __cplusplus
+2
View File
@@ -53,6 +53,7 @@
extern "C" {
#endif
//! \ingroup usb_group
//! \defgroup otg_group UOTGHS OTG Driver
//! UOTGHS low-level driver for OTG features
@@ -73,6 +74,7 @@ bool otg_dual_enable(void);
*/
void otg_dual_disable(void);
//! @name UOTGHS OTG ID pin management
//! The ID pin come from the USB OTG connector (A and B receptable) and
//! allows to select the USB mode host or device.
+4
View File
@@ -374,6 +374,7 @@ typedef struct {
uint8_t bNumDeviceCaps;
} usb_dev_bos_desc_t;
/**
* \brief USB Device Capabilities - USB 2.0 Extension Descriptor structure
*
@@ -410,6 +411,7 @@ typedef struct {
uint8_t iFunction; //!< Index of string descriptor
} usb_association_desc_t;
/**
* \brief Standard USB configuration descriptor structure
*/
@@ -424,6 +426,7 @@ typedef struct {
uint8_t bMaxPower;
} usb_conf_desc_t;
#define USB_CONFIG_ATTR_MUST_SET (1 << 7) //!< Must always be set
#define USB_CONFIG_ATTR_BUS_POWERED (0 << 6) //!< Bus-powered
#define USB_CONFIG_ATTR_SELF_POWERED (1 << 6) //!< Self-powered
@@ -472,6 +475,7 @@ typedef struct {
uint8_t bInterval;
} usb_ep_desc_t;
/**
* \brief A standard USB string descriptor structure
*/
@@ -168,6 +168,7 @@ COMPILER_PACK_SET(1)
//! \name USB CDC Descriptors
//@{
//! CDC Header Functional Descriptor
typedef struct {
uint8_t bFunctionLength;
@@ -202,6 +203,7 @@ typedef struct {
uint8_t bSlaveInterface0;
} usb_cdc_union_desc_t;
//! \name USB CDC Call Management Capabilities
//@{
//! Device handles call management itself
@@ -276,6 +278,7 @@ typedef struct {
//@}
//@}
//! \name USB CDC notification message
//@{
@@ -47,6 +47,7 @@
#ifndef _USB_PROTOCOL_MSC_H_
#define _USB_PROTOCOL_MSC_H_
/**
* \ingroup usb_protocol_group
* \defgroup usb_msc_protocol USB Mass Storage Class (MSC) protocol definitions
@@ -88,6 +89,7 @@
#define MSC_PROTOCOL_BULK 0x50 //!< Bulk-only
//@}
/**
* \brief MSC USB requests (bRequest)
*/
@@ -96,6 +98,7 @@ enum usb_reqid_msc {
USB_REQ_MSC_GET_MAX_LUN = 0xFE //!< Get Max LUN
};
COMPILER_PACK_SET(1)
/**
@@ -119,6 +122,7 @@ struct usb_msc_cbw {
#define USB_CBW_LEN_MASK 0x1F //!< Valid bits in bCBWCBLength
//@}
/**
* \name A Command Status Wrapper (CSW).
*/
+3 -7
View File
@@ -31,28 +31,24 @@
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { return EEPROM.begin(MARLIN_EEPROM_SIZE); }
bool PersistentStore::access_finish() { EEPROM.end(); return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
for (size_t i = 0; i < size; i++) {
const int p = REAL_EEPROM_ADDR(pos);
EEPROM.write(p, value[i]);
EEPROM.write(pos++, value[i]);
crc16(crc, &value[i], 1);
++pos;
}
return false;
}
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
for (size_t i = 0; i < size; i++) {
const int p = REAL_EEPROM_ADDR(pos);
uint8_t c = EEPROM.read(p);
uint8_t c = EEPROM.read(pos++);
if (writing) value[i] = c;
crc16(crc, &c, 1);
++pos;
}
return false;
}
@@ -1,22 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
+1 -20
View File
@@ -142,31 +142,12 @@
// ADC
//
#define HAL_ADC_VREF_MV 3300
#define HAL_ADC_RESOLUTION 12
#define HAL_ADC_RESOLUTION 10
#define GET_PIN_MAP_PIN(index) index
#define GET_PIN_MAP_INDEX(pin) pin
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
//
// Debug port disable
// JTMS / SWDIO = PA13
// JTCK / SWCLK = PA14
// JTDI = PA15
// JTDO = PB3
// NJTRST = PB4
//
#define DBG_SWCLK _BV(0)
#define DBG_SWDIO _BV(1)
#define DBG_TDO _BV(2)
#define DBG_TDI _BV(3)
#define DBG_TRST _BV(4)
#define DBG_ALL (DBG_SWCLK | DBG_SWDIO | DBG_TDO | DBG_TDI | DBG_TRST)
#define JTAGSWD_RESET() PORT_DebugPortSetting(DBG_ALL, Enable);
#define JTAG_DISABLE() PORT_DebugPortSetting(DBG_TDO | DBG_TDI | DBG_TRST, Disable);
#define JTAGSWD_DISABLE() PORT_DebugPortSetting(DBG_ALL, Disable);
//
// MarlinHAL implementation
//
+2 -33
View File
@@ -123,11 +123,6 @@ void MarlinHAL::init() {
// Register min serial
TERN_(POSTMORTEM_DEBUGGING, install_min_serial());
// warn if low memory after init
if (freeMemory() < 1024) {
SERIAL_WARN_MSG("HAL: low memory after init!\n");
}
}
void MarlinHAL::init_board() {}
@@ -152,31 +147,7 @@ void MarlinHAL::delay_ms(const int ms) {
delay(ms);
}
void MarlinHAL::idletask() {
#if ENABLED(MARLIN_DEV_MODE)
// check & print serial RX errors
MSerialT *serials[] = { &MSerial1, &MSerial2 };
for (int serial = 0; serial < 2; serial++) {
usart_receive_error_t err = serials[serial]->getReceiveError();
if (err != usart_receive_error_t::None) {
// "Warning: MSerial[n] RX [Framing|Parity|Overrun] Error"
SERIAL_WARN_START();
SERIAL_ECHOPGM(" MSerial");
SERIAL_ECHO(serial + 1);
SERIAL_ECHOPGM(" RX ");
switch(err) {
case usart_receive_error_t::FramingError: SERIAL_ECHOPGM("Framing"); break;
case usart_receive_error_t::ParityError: SERIAL_ECHOPGM("Parity"); break;
case usart_receive_error_t::OverrunError: SERIAL_ECHOPGM("Overrun"); break;
case usart_receive_error_t::RxDataDropped: SERIAL_ECHOPGM("DataDropped"); break;
default: break;
}
SERIAL_ECHOPGM(" Error");
SERIAL_EOL();
}
}
#endif
}
void MarlinHAL::idletask() {}
uint8_t MarlinHAL::get_reset_source() {
// Query reset cause from RMU
@@ -232,9 +203,7 @@ int MarlinHAL::freeMemory() {
return &top - _sbrk(0);
}
void MarlinHAL::adc_init() {
analogReadResolution(HAL_ADC_RESOLUTION);
}
void MarlinHAL::adc_init() {}
void MarlinHAL::adc_enable(const pin_t pin) {
#if TEMP_SENSOR_SOC
+4 -24
View File
@@ -27,7 +27,7 @@
/**
* Not every MarlinSerial instance should handle emergency parsing, as
* it would not make sense to parse G-Code from TMC responses
* it would not make sense to parse GCode from TMC responses
*/
constexpr bool serial_handles_emergency(int port) {
return false
@@ -46,34 +46,14 @@ constexpr bool serial_handles_emergency(int port) {
//
// Define serial ports
//
// serial port where RX and TX use IRQs
#define DEFINE_IRQ_SERIAL_MARLIN(name, n) \
#define DEFINE_HWSERIAL_MARLIN(name, n) \
MSerialT name(serial_handles_emergency(n), \
&USART##n##_config, \
BOARD_USART##n##_TX_PIN, \
BOARD_USART##n##_RX_PIN);
// serial port where RX uses DMA and TX uses IRQs
// all serial ports use DMA1
// since there are 4 USARTs and 4 DMA channels, we can use the USART number as the DMA channel
#define DEFINE_DMA_SERIAL_MARLIN(name, n) \
MSerialT name(serial_handles_emergency(n), \
&USART##n##_config, \
BOARD_USART##n##_TX_PIN, \
BOARD_USART##n##_RX_PIN, \
M4_DMA1, \
((en_dma_channel_t)(n - 1))); // map USART1 to DMA channel 0, USART2 to DMA channel 1, etc.
#define DEFINE_SERIAL_MARLIN(name, n) TERN(SERIAL_DMA, DEFINE_DMA_SERIAL_MARLIN(name, n), DEFINE_IRQ_SERIAL_MARLIN(name, n))
DEFINE_SERIAL_MARLIN(MSerial1, 1);
DEFINE_SERIAL_MARLIN(MSerial2, 2);
// TODO: remove this warning when SERIAL_DMA has been tested some more
#if ENABLED(SERIAL_DMA)
#warning "SERIAL_DMA may be unstable on HC32F460."
#endif
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
//
// Serial port assertions
+8 -38
View File
@@ -25,42 +25,17 @@
#include <drivers/usart/Usart.h>
// Optionally set uart IRQ priority to reduce overflow errors
//#define UART_RX_IRQ_PRIO 1
//#define UART_TX_IRQ_PRIO 1
//#define UART_RX_DMA_IRQ_PRIO 1
// #define UART_IRQ_PRIO 1
struct MarlinSerial : public Usart {
MarlinSerial(
struct usart_config_t *usart_device,
gpio_pin_t tx_pin,
gpio_pin_t rx_pin
#if ENABLED(SERIAL_DMA)
, M4_DMA_TypeDef *dma_unit = nullptr,
en_dma_channel_t rx_dma_channel = DmaCh0
#endif
) : Usart(usart_device, tx_pin, rx_pin) {
#if ENABLED(SERIAL_DMA)
if (dma_unit != nullptr) {
enableRxDma(dma_unit, rx_dma_channel);
}
#endif
}
MarlinSerial(struct usart_config_t *usart_device, gpio_pin_t tx_pin, gpio_pin_t rx_pin) : Usart(usart_device, tx_pin, rx_pin) {}
#if defined(UART_RX_IRQ_PRIO) || defined(UART_TX_IRQ_PRIO) || defined(UART_RX_DMA_IRQ_PRIO)
#ifdef UART_IRQ_PRIO
void setPriority() {
#if defined(UART_RX_IRQ_PRIO)
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_RX_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_RX_IRQ_PRIO);
#endif
#if defined(UART_TX_IRQ_PRIO)
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_TX_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_TX_IRQ_PRIO);
#endif
#if defined(UART_RX_DMA_IRQ_PRIO) && ENABLED(SERIAL_DMA)
NVIC_SetPriority(c_dev()->dma.rx.rx_data_available_dma_btc.interrupt_number, UART_RX_DMA_IRQ_PRIO);
#endif
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_IRQ_PRIO);
}
void begin(uint32_t baud) {
@@ -72,12 +47,7 @@ struct MarlinSerial : public Usart {
Usart::begin(baud, config);
setPriority();
}
void begin(uint32_t baud, const stc_usart_uart_init_t *config, const bool rxNoiseFilter = true) {
Usart::begin(baud, config, rxNoiseFilter);
setPriority();
}
#endif // UART_RX_IRQ_PRIO || UART_TX_IRQ_PRIO || UART_RX_DMA_IRQ_PRIO
#endif
};
typedef Serial1Class<MarlinSerial> MSerialT;
-75
View File
@@ -1,75 +0,0 @@
/**
* app_config.h is included by the hc32f460 arduino build script for every source file.
* it is used to configure the arduino core (and ddl) automatically according
* to the settings in Configuration.h and Configuration_adv.h.
*/
#pragma once
#ifndef _HC32_APP_CONFIG_H_
#define _HC32_APP_CONFIG_H_
#include "../../inc/MarlinConfigPre.h"
//
// dev mode
//
#if ENABLED(MARLIN_DEV_MODE)
#define __DEBUG 1
#define __CORE_DEBUG 1
#endif
//
// Fault Handlers and Panic
//
#if ENABLED(POSTMORTEM_DEBUGGING)
// disable arduino core fault handler, as we define our own
#define CORE_DISABLE_FAULT_HANDLER 1
#endif
// force-enable panic handler so that we can use our custom one (in MinSerial)
#define PANIC_ENABLE 1
// use short filenames in ddl debug and core panic output
#define __DEBUG_SHORT_FILENAMES 1
#define __PANIC_SHORT_FILENAMES 1
// omit panic messages in core panic output
#define __OMIT_PANIC_MESSAGE 1
//
// Usart
//
// disable serial globals (Serial1, Serial2, ...), as we define our own
#define DISABLE_SERIAL_GLOBALS 1
// increase the size of the Usart buffers (both RX and TX)
// NOTE:
// the heap usage will increase by (SERIAL_BUFFER_SIZE - 64) * "number of serial ports used"
// if running out of heap, the system may become unstable
//#define SERIAL_BUFFER_SIZE 256
// enable support for Usart Clock Divider / Oversampling auto config
#define USART_AUTO_CLKDIV_OS_CONFIG 1
// enable USART_RX_DMA_SUPPORT core option when SERIAL_DMA is enabled
#if ENABLED(SERIAL_DMA)
#define USART_RX_DMA_SUPPORT 1
#endif
//
// Misc.
//
// redirect printf to host serial
#define REDIRECT_PRINTF_TO_SERIAL 1
// F_CPU must be known at compile time, but on HC32F460 it's not.
// Thus we assume HCLK to be 200MHz, as that's what is configured in
// 'core_hook_sysclock_init' in 'sysclock.cpp'.
// If you face issues with this assumption, please double-check with the values
// printed by 'MarlinHAL::HAL_clock_frequencies_dump'.
// see also: HAL_TIMER_RATE in timers.h
#define F_CPU 200000000 // 200MHz HCLK
#endif // _HC32_APP_CONFIG_H_
+11 -5
View File
@@ -37,7 +37,7 @@
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() {
eeprom_init();
@@ -49,7 +49,7 @@ bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
while (size--) {
uint8_t v = *value;
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
uint8_t *const p = (uint8_t *const)pos;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
@@ -70,10 +70,16 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
return false;
}
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size,
uint16_t *crc, const bool writing /*=true*/) {
do {
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
if (writing) *value = c;
uint8_t *const p = (uint8_t *const)pos;
uint8_t c = eeprom_read_byte(p);
if (writing)
{
*value = c;
}
crc16(crc, &c, 1);
pos++;
value++;
+5 -2
View File
@@ -38,7 +38,9 @@
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() {
return MARLIN_EEPROM_SIZE;
}
#define _ALIGN(x) __attribute__((aligned(x)))
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
@@ -83,10 +85,11 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing /*=true*/) {
for (size_t i = 0; i < size; i++) {
const uint8_t c = HAL_eeprom_data[pos + i];
uint8_t c = HAL_eeprom_data[pos + i];
if (writing) value[i] = c;
crc16(crc, &c, 1);
}
pos += size;
return false;
}
+6 -4
View File
@@ -35,7 +35,7 @@
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_finish() { return true; }
@@ -56,7 +56,7 @@ bool PersistentStore::access_start() {
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
while (size--) {
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
uint8_t *const p = (uint8_t *const)pos;
uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
@@ -77,8 +77,10 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
do {
const uint8_t c = eeprom_read_byte((uint8_t *)REAL_EEPROM_ADDR(pos));
if (writing && value) *value = c;
uint8_t c = eeprom_read_byte((uint8_t *)pos);
if (writing && value) {
*value = c;
}
crc16(crc, &c, 1);
pos++;
+1 -19
View File
@@ -40,15 +40,9 @@ void endstopIRQHandler() {
CHECK(X_MAX);
CHECK(X_MIN);
CHECK(X2_MAX);
CHECK(X2_MIN);
CHECK(Y_MAX);
CHECK(Y_MIN);
CHECK(Y2_MAX);
CHECK(Y2_MIN);
CHECK(Z_MAX);
CHECK(Z_MIN);
@@ -58,9 +52,6 @@ void endstopIRQHandler() {
CHECK(Z3_MAX);
CHECK(Z3_MIN);
CHECK(Z4_MAX);
CHECK(Z4_MIN);
CHECK(Z_MIN_PROBE);
// Update endstops
@@ -78,15 +69,9 @@ void setup_endstop_interrupts() {
SETUP(X_MAX);
SETUP(X_MIN);
SETUP(X2_MAX);
SETUP(X2_MIN);
SETUP(Y_MAX);
SETUP(Y_MIN);
SETUP(Y2_MAX);
SETUP(Y2_MIN);
SETUP(Z_MAX);
SETUP(Z_MIN);
@@ -96,9 +81,6 @@ void setup_endstop_interrupts() {
SETUP(Z3_MAX);
SETUP(Z3_MIN);
SETUP(Z4_MAX);
SETUP(Z4_MIN);
SETUP(Z_MIN_PROBE);
#undef SETUP
@@ -106,7 +88,7 @@ void setup_endstop_interrupts() {
// Ensure 1 - 10 IRQs are registered
// Disable some endstops if you encounter this error
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_X2_MAX, USE_X2_MIN, USE_Y_MAX, USE_Y_MIN, USE_Y2_MAX, USE_Y2_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z4_MAX, USE_Z4_MIN, USE_Z_MIN_PROBE)
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_Y_MAX, USE_Y_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z_MIN_PROBE)
#if ENDSTOPS_INTERRUPTS_COUNT > 10
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
@@ -1,22 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
+4 -31
View File
@@ -20,20 +20,6 @@
*
*/
#pragma once
#include <core_util.h>
#if !defined(ARDUINO_CORE_VERSION_INT) || !defined(GET_VERSION_INT)
// version macros were introduced in arduino core version 1.1.0
// below that version, we polyfill them
#define GET_VERSION_INT(major, minor, patch) ((major * 100000) + (minor * 1000) + patch)
#define ARDUINO_CORE_VERSION_INT GET_VERSION_INT(1, 0, 0)
#endif
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
// because we use app_config.h introduced in arduino core version 1.1.0, the
// HAL is not compatible with older versions
#error "The HC32 HAL is not compatible with Arduino Core versions < 1.1.0. Consider updating the Arduino Core."
#endif
#ifndef BOARD_XTAL_FREQUENCY
#error "BOARD_XTAL_FREQUENCY is required for HC32F460."
@@ -72,9 +58,11 @@
#endif
#if TEMP_SENSOR_SOC
#ifndef TEMP_SOC_PIN
#if !defined(TEMP_SOC_PIN)
#error "TEMP_SOC_PIN must be defined to use TEMP_SENSOR_SOC."
#elif IS_GPIO_PIN(TEMP_SOC_PIN)
#endif
#if defined(TEMP_SOC_PIN) && IS_GPIO_PIN(TEMP_SOC_PIN)
#error "TEMP_SOC_PIN must not be a valid GPIO pin to avoid conflicts."
#endif
#endif
@@ -88,18 +76,3 @@
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
#endif
#endif
#if ENABLED(SERIAL_DMA)
#if !defined(USART_RX_DMA_SUPPORT)
#error "SERIAL_DMA requires USART_RX_DMA_SUPPORT to be enabled in the arduino core."
#endif
// USART_RX_DMA_SUPPORT does not implement core_hook_usart_rx_irq, which is required for the emergency parser
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not supported with SERIAL_DMA. Please disable either SERIAL_DMA or EMERGENCY_PARSER."
#endif
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
#error "SERIAL_DMA is not supported with arduino core version < 1.1.0."
#endif
#endif
+1 -1
View File
@@ -23,7 +23,7 @@
#ifdef ARDUINO_ARCH_HC32
#ifdef REDIRECT_PRINTF_TO_SERIAL
#ifndef __GNUC__
#if !defined(__GNUC__)
#error "only GCC is supported"
#endif
+17 -26
View File
@@ -54,7 +54,7 @@
fn \
}
stc_sd_handle_t *handle = nullptr;
stc_sd_handle_t *handle;
bool SDIO_Init() {
// Configure SDIO pins
@@ -66,45 +66,36 @@ bool SDIO_Init() {
GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio);
GPIO_SetFunc(BOARD_SDIO_DET, Func_Sdio);
// If a handle is already initialized, free it before creating a new one
// otherwise, we will leak memory, which will eventually crash the system
if (handle != nullptr) {
delete handle->pstcDmaInitCfg;
delete handle->pstcCardInitCfg;
delete handle;
handle = nullptr;
}
// Create DMA configuration
stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t;
dmaConf->DMAx = SDIO_DMA_PERIPHERAL;
dmaConf->enDmaCh = SDIO_DMA_CHANNEL;
// Create card configuration
// This should be a fairly safe configuration for most cards
stc_sdcard_init_t *cardConf = new stc_sdcard_init_t;
cardConf->enBusWidth = SdiocBusWidth4Bit;
cardConf->enClkFreq = SdiocClk400K;
cardConf->enSpeedMode = SdiocNormalSpeedMode;
cardConf->pstcInitCfg = nullptr;
// Create handle in DMA mode
handle = new stc_sd_handle_t;
handle->SDIOCx = SDIO_PERIPHERAL;
handle->enDevMode = SdCardDmaMode;
handle->pstcDmaInitCfg = dmaConf;
//handle->pstcCardInitCfg = cardConf; // assigned in SDCARD_Init
// Create card configuration
// This should be a fairly safe configuration for most cards
stc_sdcard_init_t cardConf = {
.enBusWidth = SdiocBusWidth4Bit,
.enClkFreq = SdiocClk400K,
.enSpeedMode = SdiocNormalSpeedMode,
//.pstcInitCfg = NULL,
};
// Initialize sd card
en_result_t rc = SDCARD_Init(handle, cardConf);
en_result_t rc = SDCARD_Init(handle, &cardConf);
if (rc != Ok) printf("SDIO_Init() error (rc=%u)\n", rc);
return rc == Ok;
}
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
CORE_ASSERT(dst != nullptr, "SDIO_ReadBlock dst is NULL", return false);
CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(dst != NULL, "SDIO_ReadBlock dst is NULL");
WITH_RETRY(SDIO_READ_RETRIES, {
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
@@ -116,8 +107,8 @@ bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
}
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
CORE_ASSERT(src != nullptr, "SDIO_WriteBlock src is NULL", return false);
CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(src != NULL, "SDIO_WriteBlock src is NULL");
WITH_RETRY(SDIO_WRITE_RETRIES, {
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
@@ -129,12 +120,12 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
}
bool SDIO_IsReady() {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
CORE_ASSERT(handle != NULL, "SDIO not initialized");
return bool(handle->stcCardStatus.READY_FOR_DATA);
}
uint32_t SDIO_GetCardSize() {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return 0);
CORE_ASSERT(handle != NULL, "SDIO not initialized");
// Multiply number of blocks with block size to get size in bytes
const uint64_t cardSizeBytes = uint64_t(handle->stcSdCardInfo.u32LogBlockNbr) * uint64_t(handle->stcSdCardInfo.u32LogBlockSize);
+9 -24
View File
@@ -96,44 +96,29 @@ void core_hook_sysclock_init() {
#endif
#endif
// sysclk is now configured according to F_CPU (i.e., 200MHz PLL output)
constexpr uint32_t sysclock = F_CPU;
// Setup clock divisors for sysclk = 200 MHz
// Setup clock divisors for sysclk = 200 MHz:
// Note: PCLK1 is used for step+temp timers, and need to be kept at 50 MHz (until there is a better solution)
constexpr stc_clk_sysclk_cfg_t sysClkConf = {
stc_clk_sysclk_cfg_t sysClkConf = {
.enHclkDiv = ClkSysclkDiv1, // HCLK = 200 MHz (CPU)
.enExclkDiv = ClkSysclkDiv2, // EXCLK = 100 MHz (SDIO)
.enPclk0Div = ClkSysclkDiv2, // PCLK0 = 100 MHz (Timer6 (not used))
.enPclk0Div = ClkSysclkDiv1, // PCLK0 = 200 MHz (Timer6 (not used))
.enPclk1Div = ClkSysclkDiv4, // PCLK1 = 50 MHz (USART, SPI, I2S, Timer0 (step+temp), TimerA (Servo))
.enPclk2Div = ClkSysclkDiv8, // PCLK2 = 25 MHz (ADC)
.enPclk3Div = ClkSysclkDiv8, // PCLK3 = 25 MHz (I2C, WDT)
.enPclk2Div = ClkSysclkDiv4, // PCLK2 = 50 MHz (ADC)
.enPclk3Div = ClkSysclkDiv4, // PCLK3 = 50 MHz (I2C, WDT)
.enPclk4Div = ClkSysclkDiv2, // PCLK4 = 100 MHz (ADC ctl)
};
#if ARDUINO_CORE_VERSION_INT >= GET_VERSION_INT(1, 2, 0)
assert_system_clocks_valid<
sysclock,
sysClkConf.enHclkDiv,
sysClkConf.enPclk0Div,
sysClkConf.enPclk1Div,
sysClkConf.enPclk2Div,
sysClkConf.enPclk3Div,
sysClkConf.enPclk4Div,
sysClkConf.enExclkDiv
>();
#endif
sysclock_set_clock_dividers(&sysClkConf);
// Set power mode
power_mode_update_pre(sysclock);
#define POWER_MODE_SYSTEM_CLOCK 200000000 // 200 MHz
power_mode_update_pre(POWER_MODE_SYSTEM_CLOCK);
// Switch to MPLL as sysclk source
CLK_SetSysClkSource(CLKSysSrcMPLL);
// Set power mode
power_mode_update_post(sysclock);
power_mode_update_post(POWER_MODE_SYSTEM_CLOCK);
#undef POWER_MODE_SYSTEM_CLOCK
}
#endif // ARDUINO_ARCH_HC32
+27 -31
View File
@@ -38,48 +38,44 @@ extern Timer0 step_timer;
// Timer Configurations
//
/**
* HAL_TIMER_RATE must be known at compile time since it's used to calculate
* STEPPER_TIMER_RATE, which is used in 'constexpr' calculations.
* On the HC32F460 the timer rate depends on PCLK1, which is derived from the
* system clock configured at runtime. As a workaround, we use the existing
* assumption of a 200MHz clock, defining F_CPU as 200000000, then configure PCLK1
* as F_CPU with a divider of 4 in 'sysclock.cpp::core_hook_sysclock_init'.
*
* If you face issues with this assumption, please double-check with the values
* printed by 'MarlinHAL::HAL_clock_frequencies_dump'.
*
* TODO: If the 'constexpr' requirement is ever lifted, use TIMER0_BASE_FREQUENCY instead
*/
#define HAL_TIMER_RATE (F_CPU / 4) // i.e., 50MHz
//#define HAL_TIMER_RATE TIMER0_BASE_FREQUENCY
// TODO: some calculations (step irq min_step_rate) require the timer rate to be known at compile time
// this is not possible with the HC32F460, as the timer rate depends on PCLK1
// as a workaround, PCLK1 = 50MHz is assumed (check with clock dump in MarlinHAL::init())
#define HAL_TIMER_RATE 50000000 // 50MHz
// #define HAL_TIMER_RATE TIMER0_BASE_FREQUENCY
// TODO: CYCLES_PER_MICROSECOND seems to be used by Marlin to calculate the number of cycles per microsecond in the timer ISRs
// by default, it uses F_CPU, but since that is not known at compile time for HC32, we overwrite it here
#undef CYCLES_PER_MICROSECOND
#define CYCLES_PER_MICROSECOND (HAL_TIMER_RATE / 1000000UL)
// Temperature timer
#define TEMP_TIMER_NUM (&temp_timer)
#define TEMP_TIMER_PRIORITY DDL_IRQ_PRIORITY_02
#define TEMP_TIMER_PRESCALE 16UL // 12.5MHz
#define TEMP_TIMER_RATE 1000 // 1kHz
#define TEMP_TIMER_FREQUENCY TEMP_TIMER_RATE // 1kHz also
#define TEMP_TIMER_NUM (&temp_timer)
#define TEMP_TIMER_PRIORITY DDL_IRQ_PRIORITY_02
#define TEMP_TIMER_PRESCALE 16ul
#define TEMP_TIMER_RATE 1000 // 1kHz
#define TEMP_TIMER_FREQUENCY TEMP_TIMER_RATE // Alias for Marlin
// Stepper timer
#define STEP_TIMER_NUM (&step_timer)
#define STEP_TIMER_PRIORITY DDL_IRQ_PRIORITY_00 // Top priority, nothing else uses it
#define STEPPER_TIMER_PRESCALE 16UL // 12.5MHz
#define STEP_TIMER_NUM (&step_timer)
#define STEP_TIMER_PRIORITY DDL_IRQ_PRIORITY_01
#define STEPPER_TIMER_PRESCALE 16ul
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // 50MHz / 16 = 3.125MHz
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000UL) // Integer 3
// TODO: STEPPER_TIMER_RATE seems to work fine like this, but requires further testing...
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // 50MHz / 16 = 3.125MHz
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000)
// Pulse timer (== stepper timer)
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
//
// Channel aliases
//
#define MF_TIMER_TEMP TEMP_TIMER_NUM
#define MF_TIMER_STEP STEP_TIMER_NUM
#define MF_TIMER_PULSE PULSE_TIMER_NUM
#define MF_TIMER_TEMP TEMP_TIMER_NUM
#define MF_TIMER_STEP STEP_TIMER_NUM
#define MF_TIMER_PULSE PULSE_TIMER_NUM
//
// HAL functions
+1 -1
View File
@@ -35,7 +35,7 @@
uint8_t buffer[MARLIN_EEPROM_SIZE];
char filename[] = "eeprom.dat";
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF;
+1 -4
View File
@@ -37,10 +37,7 @@ Timer::Timer() {
}
Timer::~Timer() {
if (timerid != 0) {
timer_delete(timerid);
timerid = 0;
}
timer_delete(timerid);
}
void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) {
@@ -1,22 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
-2
View File
@@ -21,7 +21,6 @@
*/
#ifdef __PLAT_LINUX__
#ifndef UNIT_TEST
//#define GPIO_LOGGING // Full GPIO and Positional Logging
@@ -136,5 +135,4 @@ int main() {
read_serial.join();
}
#endif // UNIT_TEST
#endif // __PLAT_LINUX__
+1
View File
@@ -60,6 +60,7 @@
#define INVALID_SERVO 255 // flag indicating an invalid servo index
// Types
typedef struct {
+3
View File
@@ -21,6 +21,9 @@
*/
#pragma once
#include "../../core/macros.h"
#include "../../inc/MarlinConfigPre.h"
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
// needed due to the speed and mode required for communicating with each device being different.
-6
View File
@@ -111,12 +111,6 @@ void MarlinHAL::init() {
#if HAS_SERVO_3
INIT_SERVO(3);
#endif
#if HAS_SERVO_4
INIT_SERVO(4);
#endif
#if HAS_SERVO_5
INIT_SERVO(5);
#endif
//debug_frmwrk_init();
//_DBG("\n\nDebug running\n");
+3 -5
View File
@@ -61,7 +61,7 @@ static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false;
static int current_slot = 0;
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() {
uint32_t first_nblank_loc, first_nblank_val;
@@ -112,8 +112,7 @@ bool PersistentStore::access_finish() {
}
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
const int p = REAL_EEPROM_ADDR(pos);
for (size_t i = 0; i < size; i++) ram_eeprom[p + i] = value[i];
for (size_t i = 0; i < size; i++) ram_eeprom[pos + i] = value[i];
eeprom_dirty = true;
crc16(crc, value, size);
pos += size;
@@ -121,9 +120,8 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
}
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
const int p = REAL_EEPROM_ADDR(pos);
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[p + i];
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
crc16(crc, buff, size);
pos += size;
return false; // return true for any error
+1 -1
View File
@@ -49,7 +49,7 @@ bool eeprom_file_open = false;
#define MARLIN_EEPROM_SIZE size_t(0x1000) // 4KiB of Emulated EEPROM
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF;
+3 -3
View File
@@ -36,7 +36,7 @@
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x8000 // 32K
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }
@@ -45,7 +45,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
uint16_t written = 0;
while (size--) {
uint8_t v = *value;
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
@@ -64,7 +64,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
// Read from external EEPROM
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
@@ -1,22 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
+3 -1
View File
@@ -21,7 +21,9 @@
*/
#pragma once
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
#include "../../core/macros.h"
#if ALL(HAS_MEDIA, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
// needed due to the speed and mode required for communicating with each device being different.
// This requirement can be removed if the SPI access to these devices is updated to use
@@ -8,12 +8,14 @@ DriverVer =04/14/2008, 5.1.2600.5512
[Manufacturer]
%PROVIDER%=DeviceList,ntamd64
[DeviceList]
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
[DeviceList.ntamd64]
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
[LPC1768USB]
include=mdmcpq.inf
CopyFiles=FakeModemCopyFileSection
@@ -26,8 +28,9 @@ AddService=usbser, 0x00000002, LowerFilter_Service_Inst
[SerialPropPageAddReg]
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[Strings]
PROVIDER = "marlinfw.org"
DRIVER.SVC = "Marlin USB Driver"
DESCRIPTION= "Marlin USB Serial"
COMPOSITE = "Marlin USB VCOM"
COMPOSITE = "Marlin USB VCOM"
-125
View File
@@ -1,125 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC4078
#include "../../inc/MarlinConfig.h"
#include "../shared/Delay.h"
#include "../../../gcode/parser.h"
DefaultSerial1 USBSerial(false, MCDCSerial0);
uint32_t MarlinHAL::adc_result = 0;
// U8glib required functions
extern "C" {
void u8g_xMicroDelay(uint16_t val) { DELAY_US(val); }
void u8g_MicroDelay() { u8g_xMicroDelay(1); }
void u8g_10MicroDelay() { u8g_xMicroDelay(10); }
void u8g_Delay(uint16_t val) { delay(val); }
}
// return free heap space
int freeMemory() {
char stack_end;
void *heap_start = malloc(sizeof(uint32_t));
if (heap_start == 0) return 0;
uint32_t result = (uint32_t)&stack_end - (uint32_t)heap_start;
free(heap_start);
return result;
}
void MarlinHAL::reboot() { MCUCore::nvic_system_reset(); }
uint8_t MarlinHAL::get_reset_source() {
#if ENABLED(USE_WATCHDOG)
if (watchdog_timed_out()) return RST_WATCHDOG;
#endif
return RST_POWER_ON;
}
void MarlinHAL::clear_reset_source() { watchdog_clear_timeout_flag(); }
void flashFirmware(const int16_t) {
delay(500); // Give OS time to disconnect
//USB_Connect(false); // USB clear connection
delay(1000); // Give OS time to notice
hal.reboot();
}
#if ENABLED(USE_WATCHDOG)
#define WDT_TIMEOUT TERN(WATCHDOG_DURATION_8S, 8.0f, 4.0f) // 4 or 8 second timeout
void MarlinHAL::watchdog_init() {
#if ENABLED(WATCHDOG_RESET_MANUAL)
// We enable the watchdog timer, but only for the interrupt.
// Configure WDT to only trigger an interrupt
// Disable WDT interrupt (just in case, to avoid triggering it!)
NVIC_DisableIRQ(WDT_IRQn);
// We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
__DSB();
__ISB();
// WDT defaults to trigger an interrupt
// Configure and enable WDT interrupt.
NVIC_ClearPendingIRQ(WDT_IRQn);
NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups
NVIC_EnableIRQ(WDT_IRQn);
#else
MCUI::watchdog_set_timeout_triggers_reset();
#endif
MCUI::watchdog_set_timeout_in_seconds(WDT_TIMEOUT);
MCUI::watchdog_enable();
}
void MarlinHAL::watchdog_refresh() {
MCUI::watchdog_feed();
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
static millis_t next_flash = millis();
if (ELAPSED(millis(), next_flash)) {
next_flash = millis() + 200;
TOGGLE(LED_PIN); // heartbeat indicator
}
#endif
}
// Timeout state
bool MarlinHAL::watchdog_timed_out() { return MCUI::watchdog_has_triggered(); }
void MarlinHAL::watchdog_clear_timeout_flag() { MCUI::watchdog_clear_timeout_flag(); }
#endif // USE_WATCHDOG
// For M42/M43, scan command line for pin code
// return index into pin map array if found and the pin is valid.
// return dval if not found or not a valid pin.
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100;
const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? ((port << 5) | pin) : -2;
return ind > -1 ? ind : dval;
}
#endif // TARGET_LPC4078
-276
View File
@@ -1,276 +0,0 @@
/**
* Marlin 3D Printer Firmware
*
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* HAL_LPC1768/HAL.h
* Hardware Abstraction Layer for NXP LPC1768
*/
#define CPU_32_BIT
#include <stdint.h>
#include <stdarg.h>
#include <algorithm>
#include "../shared/Marduino.h"
#include "../shared/Delay.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio.h"
#include "MarlinSerial.h"
#include <mcu_interface.h>
// ------------------------
// Serial ports
// ------------------------
typedef ForwardSerial1Class< decltype(MCDCSerial0) > DefaultSerial1;
extern DefaultSerial1 USBSerial;
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
#if SERIAL_PORT == -1
#define MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1
#define MYSERIAL2 USBSerial
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 USBSerial
#elif WITHIN(SERIAL_PORT_3, 0, 3)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif
#ifdef MMU2_SERIAL_PORT
#if MMU2_SERIAL_PORT == -1
#define MMU2_SERIAL USBSerial
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else
#error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif
#ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1
#define LCD_SERIAL USBSerial
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.available()
#endif
#endif
//
// Interrupts
//
#define CRITICAL_SECTION_START() const bool irqon = !MCUCore::primask(); MCUCore::nvic_interrupts_disable()
#define CRITICAL_SECTION_END() if (irqon) MCUCore::nvic_interrupts_enable()
#define cli() noInterrupts()
#define sei() interrupts()
//
// ADC
//
#define ADC_MEDIAN_FILTER_SIZE (23) // Higher values increase step delay (phase shift),
// (ADC_MEDIAN_FILTER_SIZE + 1) / 2 sample step delay (12 samples @ 500Hz: 24ms phase shift)
// Memory usage per ADC channel (bytes): (6 * ADC_MEDIAN_FILTER_SIZE) + 16
// 8 * ((6 * 23) + 16 ) = 1232 Bytes for 8 channels
#define ADC_LOWPASS_K_VALUE (2) // Higher values increase rise time
// Rise time sample delays for 100% signal convergence on full range step
// (1 : 13, 2 : 32, 3 : 67, 4 : 139, 5 : 281, 6 : 565, 7 : 1135, 8 : 2273)
// K = 6, 565 samples, 500Hz sample rate, 1.13s convergence on full range step
// Memory usage per ADC channel (bytes): 4 (32 Bytes for 8 channels)
#define HAL_ADC_VREF 3.3 // ADC voltage reference
#define HAL_ADC_RESOLUTION 12 // 15 bit maximum, raw temperature is stored as int16_t
#define HAL_ADC_FILTERED // Disable oversampling done in Marlin as ADC values already filtered in HAL
//
// Pin Mapping for M42, M43, M226
//
// Test whether the pin is valid
constexpr bool VALID_PIN(const pin_t pin) {
return MCUI::pin_is_valid(pin);
}
// Get the analog index for a digital pin
constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t pin) {
return (MCUI::pin_is_valid(pin) && MCUI::pin_has_adc(pin)) ? pin : -1;
}
//
// Misc. Functions
//
#ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) (p)
#endif
// Return the index of a pin number
constexpr int16_t GET_PIN_MAP_INDEX(const pin_t pin) {
return MCUI::pin_index(pin);
}
// Get the pin number at the given index
constexpr pin_t GET_PIN_MAP_PIN(const int16_t index) {
return MCUI::pin_index(index);
}
// Parse a G-code word into a pin index
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
// P0.6 thru P0.9 are for the onboard SD card
#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09,
// ------------------------
// Defines
// ------------------------
void flashFirmware(const int16_t);
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
// Default graphical display delays
#define CPU_ST7920_DELAY_1 600
#define CPU_ST7920_DELAY_2 750
#define CPU_ST7920_DELAY_3 750
// ------------------------
// Free Memory Accessor
// ------------------------
#pragma GCC diagnostic push
#if GCC_VERSION <= 50000
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
int freeMemory();
#pragma GCC diagnostic pop
// ------------------------
// MarlinHAL Class
// ------------------------
class MarlinHAL {
public:
// Earliest possible init, before setup()
MarlinHAL() {}
static void init(); // Called early in setup()
static void init_board() {} // Called less early in setup()
static void reboot(); // Restart the firmware from 0x0
// Interrupts
static bool isr_state() { return MCUCore::primask(); }
static void isr_on() { MCUCore::nvic_interrupts_enable(); }
static void isr_off() { MCUCore::nvic_interrupts_disable(); }
static void delay_ms(const int ms) { DELAY_US(ms * 1000); }
// Watchdog
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {});
static bool watchdog_timed_out() IF_DISABLED(USE_WATCHDOG, { return false; });
static void watchdog_clear_timeout_flag() IF_DISABLED(USE_WATCHDOG, {});
// Tasks, called from idle()
static void idletask();
// Reset
static uint8_t get_reset_source();
static void clear_reset_source();
// Free SRAM
static int freeMemory() { return ::freeMemory(); }
//
// ADC Methods
//
using FilteredADC = MCUI::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
// Called by Temperature::init once at startup
static void adc_init() {
// Turn on and initialise ADC in burst mode
MCUI::adc_hardware.init();
MCUI::adc_hardware.burst_start();
}
// Called by Temperature::init for each sensor at startup
static void adc_enable(const pin_t pin) {
FilteredADC::enable_channel(pin);
}
// Begin ADC sampling on the given pin. Called from Temperature::isr!
static uint32_t adc_result;
static void adc_start(const pin_t pin) {
adc_result = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits
}
// Is the ADC ready for reading?
static bool adc_ready() { return true; }
// The current value of the ADC register
static uint16_t adc_value() { return uint16_t(adc_result); }
/**
* Set the PWM duty cycle for the pin to the given value.
* Optionally invert the duty cycle [default = false]
* Optionally change the scale of the provided value to enable finer PWM duty control [default = 255]
*/
static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
/**
* Set the frequency of the timer corresponding to the provided pin
* All Hardware PWM pins will run at the same frequency and
* All Software PWM pins will run at the same frequency
*/
static void set_pwm_frequency(const pin_t pin, const uint16_t f_desired);
};
-354
View File
@@ -1,354 +0,0 @@
// /**
// * Marlin 3D Printer Firmware
// * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
// *
// * Based on Sprinter and grbl.
// * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
// * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see <https://www.gnu.org/licenses/>.
// *
// */
// /**
// * Software SPI functions originally from Arduino Sd2Card Library
// * Copyright (c) 2009 by William Greiman
// */
// /**
// * For TARGET_LPC4078
// */
// /**
// * Hardware SPI and Software SPI implementations are included in this file.
// * The hardware SPI runs faster and has higher throughput but is not compatible
// * with some LCD interfaces/adapters.
// *
// * Control of the slave select pin(s) is handled by the calling routines.
// *
// * Some of the LCD interfaces/adapters result in the LCD SPI and the SD card
// * SPI sharing pins. The SCK, MOSI & MISO pins can NOT be set/cleared with
// * WRITE nor digitalWrite when the hardware SPI module within the LPC17xx is
// * active. If any of these pins are shared then the software SPI must be used.
// *
// * A more sophisticated hardware SPI can be found at the following link.
// * This implementation has not been fully debugged.
// * https://github.com/MarlinFirmware/Marlin/tree/071c7a78f27078fd4aee9a3ef365fcf5e143531e
// */
#ifdef TARGET_LPC4078
#include "../../inc/MarlinConfig.h"
#include <SPI.h>
// Hardware SPI and SPIClass
#include "../shared/HAL_SPI.h"
#define LPC_SOFTWARE_SPI
// ------------------------
// Public functions
// ------------------------
#if ENABLED(LPC_SOFTWARE_SPI)
#include "SoftwareSPI.h"
// Software SPI
static uint8_t SPI_speed = SPI_FULL_SPEED;
static uint8_t spiTransfer(uint8_t b) {
return swSpiTransfer(b, SPI_speed, SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN);
}
void spiBegin() {
swSpiBegin(SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN);
}
void spiInit(uint8_t spiRate) {
SPI_speed = swSpiInit(spiRate, SD_SCK_PIN, SD_MOSI_PIN);
}
uint8_t spiRec() { return spiTransfer(0xFF); }
void spiRead(uint8_t*buf, uint16_t nbyte) {
for (int i = 0; i < nbyte; i++)
buf[i] = spiTransfer(0xFF);
}
void spiSend(uint8_t b) { (void)spiTransfer(b); }
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
(void)spiTransfer(buf[i]);
}
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);
}
#else
#ifdef SD_SPI_SPEED
#define INIT_SPI_SPEED SD_SPI_SPEED
#else
#define INIT_SPI_SPEED SPI_FULL_SPEED
#endif
void spiBegin() { spiInit(INIT_SPI_SPEED); } // Set up SCK, MOSI & MISO pins for SSP0
void spiInit(uint8_t spiRate) {
#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN
SPI.setModule(1);
#elif SD_MISO_PIN == BOARD_SPI2_MISO_PIN
SPI.setModule(2);
#endif
SPI.setDataSize(DATA_SIZE_8BIT);
SPI.setDataMode(SPI_MODE0);
SPI.setClock(SPISettings::spiRate2Clock(spiRate));
SPI.begin();
}
static uint8_t doio(uint8_t b) {
return SPI.transfer(b & 0x00FF) & 0x00FF;
}
void spiSend(uint8_t b) { doio(b); }
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]);
}
void spiSend(uint32_t chan, byte b) {}
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {}
// Read single byte from SPI
uint8_t spiRec() { return doio(0xFF); }
uint8_t spiRec(uint32_t chan) { return 0; }
// Read from SPI into buffer
void spiRead(uint8_t *buf, uint16_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) buf[i] = doio(0xFF);
}
uint8_t spiTransfer(uint8_t b) { return doio(b); }
// Write from buffer to SPI
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);
}
// Begin SPI transaction, set clock, bit order, data mode
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
// TODO: Implement this method
}
#endif // LPC_SOFTWARE_SPI
// /**
// * @brief Wait until TXE (tx empty) flag is set and BSY (busy) flag unset.
// */
static inline void waitSpiTxEnd(void *spi_d) {
#warning unimplemented
// while (SSP_GetStatus(spi_d, SSP_STAT_TXFIFO_EMPTY) == RESET) { /* nada */ } // wait until TXE=1
// while (SSP_GetStatus(spi_d, SSP_STAT_BUSY) == SET) { /* nada */ } // wait until BSY=0
}
// // Retain the pin init state of the SPI, to avoid init more than once,
// // even if more instances of SPIClass exist
static bool spiInitialised[BOARD_NR_SPI] = { false };
SPIClass::SPIClass(uint8_t device) {
// // Init things specific to each SPI device
// // clock divider setup is a bit of hack, and needs to be improved at a later date.
#if BOARD_NR_SPI >= 1
_settings[0].device_id = 0;
_settings[0].m_config.pin_miso = BOARD_SPI1_MISO_PIN;
_settings[0].m_config.pin_mosi = BOARD_SPI1_MOSI_PIN;
_settings[0].m_config.pin_sck = BOARD_SPI1_SCK_PIN;
_settings[0].m_config.pin_ssel = BOARD_SPI1_NSS_PIN;
// _settings[0].dataMode = SPI_MODE0;
// _settings[0].dataSize = DATA_SIZE_8BIT;
// _settings[0].clock = SPI_CLOCK_MAX;
// //_settings[0].clockDivider = determine_baud_rate(_settings[0].spi_d, _settings[0].clock);
#endif
#if BOARD_NR_SPI >= 2
_settings[1].device_id = 2;
_settings[1].m_config.pin_miso = BOARD_SPI2_MISO_PIN;
_settings[1].m_config.pin_mosi = BOARD_SPI2_MOSI_PIN;
_settings[1].m_config.pin_sck = BOARD_SPI2_SCK_PIN;
_settings[1].m_config.pin_ssel = BOARD_SPI2_NSS_PIN;
// _settings[1].dataMode = SPI_MODE0;
// _settings[1].dataSize = DATA_SIZE_8BIT;
// _settings[1].clock = SPI_CLOCK_MAX;
// //_settings[1].clockDivider = determine_baud_rate(_settings[1].spi_d, _settings[1].clock);
#endif
setModule(device);
// // Init the GPDMA controller
// // TODO: call once in the constructor? or each time?
// GPDMA_Init();
}
SPIClass::SPIClass(pin_t mosi, pin_t miso, pin_t sclk, pin_t ssel) {
#if BOARD_NR_SPI >= 1
if (mosi == BOARD_SPI1_MOSI_PIN) SPIClass(1);
#endif
#if BOARD_NR_SPI >= 2
if (mosi == BOARD_SPI2_MOSI_PIN) SPIClass(2);
#endif
}
void SPIClass::begin() {
// // Init the SPI pins in the first begin call
if ((_currentSetting->device_id == 0 && spiInitialised[0] == false) ||
(_currentSetting->device_id == 1 && spiInitialised[1] == false) ||
(_currentSetting->device_id == 2 && spiInitialised[2] == false)) {
MCUI::SSP::init(_currentSetting->device_id, _currentSetting->m_config);
spiInitialised[_currentSetting->device_id] = true;
}
updateSettings();
}
void SPIClass::beginTransaction(const SPISettings &cfg) {
setBitOrder(cfg.bitOrder);
setDataMode(cfg.dataMode);
setDataSize(cfg.dataSize);
//setClockDivider(determine_baud_rate(_currentSetting->spi_d, settings.clock));
begin();
}
uint8_t SPIClass::transfer(const uint16_t b) {
uint16_t rx_word = 0;
// clear rx fifo
while(MCUI::SSP::read(_currentSetting->device_id, &rx_word) == 1);
MCUI::SSP::write(_currentSetting->device_id, b);
while(MCUI::SSP::read(_currentSetting->device_id, &rx_word) != 1);
return rx_word;
}
uint16_t SPIClass::transfer16(const uint16_t data) {
return (transfer((data >> 8) & 0xFF) << 8) | (transfer(data & 0xFF) & 0xFF);
}
void SPIClass::end() {
// // Neither is needed for Marlin
// //SSP_Cmd(_currentSetting->spi_d, DISABLE);
// //SSP_DeInit(_currentSetting->spi_d);
}
void SPIClass::send(uint8_t data) {
MCUI::SSP::write(_currentSetting->device_id, data);
}
void SPIClass::dmaSend(void *buf, uint16_t length, bool minc) {
// //TODO: LPC dma can only write 0xFFF bytes at once.
// GPDMA_Channel_CFG_Type GPDMACfg;
// /* Configure GPDMA channel 0 -------------------------------------------------------------*/
// /* DMA Channel 0 */
// GPDMACfg.ChannelNum = 0;
// // Source memory
// GPDMACfg.SrcMemAddr = (uint32_t)buf;
// // Destination memory - Not used
// GPDMACfg.DstMemAddr = 0;
// // Transfer size
// GPDMACfg.TransferSize = length;
// // Transfer width
// GPDMACfg.TransferWidth = (_currentSetting->dataSize == DATA_SIZE_16BIT) ? GPDMA_WIDTH_HALFWORD : GPDMA_WIDTH_BYTE;
// // Transfer type
// GPDMACfg.TransferType = GPDMA_TRANSFERTYPE_M2P;
// // Source connection - unused
// GPDMACfg.SrcConn = 0;
// // Destination connection
// GPDMACfg.DstConn = (_currentSetting->spi_d == LPC_SSP0) ? GPDMA_CONN_SSP0_Tx : GPDMA_CONN_SSP1_Tx;
// GPDMACfg.DMALLI = 0;
// // Enable dma on SPI
// SSP_DMACmd(_currentSetting->spi_d, SSP_DMA_TX, ENABLE);
// // Only increase memory if minc is true
// GPDMACfg.MemoryIncrease = (minc ? GPDMA_DMACCxControl_SI : 0);
// // Setup channel with given parameter
// GPDMA_Setup(&GPDMACfg);
// // Enable DMA
// GPDMA_ChannelCmd(0, ENABLE);
// // Wait for data transfer
// while (!GPDMA_IntGetStatus(GPDMA_STAT_RAWINTTC, 0) && !GPDMA_IntGetStatus(GPDMA_STAT_RAWINTERR, 0)) { }
// // Clear err and int
// GPDMA_ClearIntPending (GPDMA_STATCLR_INTTC, 0);
// GPDMA_ClearIntPending (GPDMA_STATCLR_INTERR, 0);
// // Disable DMA
// GPDMA_ChannelCmd(0, DISABLE);
// waitSpiTxEnd(_currentSetting->spi_d);
// SSP_DMACmd(_currentSetting->spi_d, SSP_DMA_TX, DISABLE);
}
uint16_t SPIClass::read() {
uint16_t rx_word = 0;
MCUI::SSP::read(_currentSetting->device_id, &rx_word);
return rx_word;
}
void SPIClass::read(uint8_t *buf, uint32_t len) {
uint16_t rx_word = 0;
// clear rx fifo
while(MCUI::SSP::read(_currentSetting->device_id, &rx_word) == 1);
for (uint16_t i = 0; i < len; i++) {
MCUI::SSP::write(_currentSetting->device_id, 0xFF);
while(MCUI::SSP::read(_currentSetting->device_id, &rx_word) != 1);
buf[i] = rx_word;
}
}
void SPIClass::setClock(uint32_t clock) { _currentSetting->clock = clock; }
void SPIClass::setModule(uint8_t device) { _currentSetting = &_settings[device - 1]; } // SPI channels are called 1, 2, and 3 but the array is zero-indexed
void SPIClass::setBitOrder(uint8_t bitOrder) { _currentSetting->bitOrder = bitOrder; }
void SPIClass::setDataMode(uint8_t dataMode) { _currentSetting->dataMode = dataMode; }
void SPIClass::setDataSize(uint32_t dataSize) { _currentSetting->dataSize = dataSize; }
// /**
// * Set up/tear down
// */
void SPIClass::updateSettings() { }
SPIClass SPI(1);
#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN
SPIClass SPI(1);
#elif SD_MISO_PIN == BOARD_SPI2_MISO_PIN
SPIClass SPI(2);
#endif
#endif // TARGET_LPC4078
-45
View File
@@ -1,45 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <SPI.h>
/**
* Marlin currently requires 3 SPI classes:
*
* SPIClass:
* This class is normally provided by frameworks and has a semi-default interface.
* This is needed because some libraries reference it globally.
*
* SPISettings:
* Container for SPI configs for SPIClass. As above, libraries may reference it globally.
*
* These two classes are often provided by frameworks so we cannot extend them to add
* useful methods for Marlin.
*
* MarlinSPI:
* Provides the default SPIClass interface plus some Marlin goodies such as a simplified
* interface for SPI DMA transfer.
*
*/
using MarlinSPI = SPIClass;
-78
View File
@@ -1,78 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC4078
#include "MarlinSerial.h"
#include "../../inc/MarlinConfig.h"
MarlinCDCSerial MCDCSerial0;
#define MarlinSerial(ID) \
MarlinSerial _MSerial##ID(ID); \
MSerialT MSerial##ID(true, _MSerial##ID)
#if USING_HW_SERIAL0
MarlinSerial(0);
#endif
#if USING_HW_SERIAL1
MarlinSerial(1);
#endif
#if USING_HW_SERIAL2
MarlinSerial(2);
#endif
#if USING_HW_SERIAL3
MarlinSerial(3);
#endif
#if ENABLED(EMERGENCY_PARSER)
bool MarlinSerial::recv_callback(const char c) {
// Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
if (false) {}
#if USING_HW_SERIAL0
else if (this == &_MSerial0) emergency_parser.update(MSerial0.emergency_state, c);
#endif
#if USING_HW_SERIAL1
else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);
#endif
#if USING_HW_SERIAL2
else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c);
#endif
#if USING_HW_SERIAL3
else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c);
#endif
return true;
}
#include "../../feature/e_parser.h"
EmergencyParser::State emergency_state;
bool CDC_RecvCallback(const char c) {
emergency_parser.update(emergency_state, c);
return true;
}
#endif
#endif // TARGET_LPC4078
-108
View File
@@ -1,108 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <mcu_interface.h>
#include <interface/uart.h>
#include <driver/usb_cdc.h>
#include <UART.h>
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(EMERGENCY_PARSER)
#include "../../feature/e_parser.h"
#endif
#include "../../core/serial_hook.h"
#ifndef SERIAL_PORT
#define SERIAL_PORT 0
#endif
#ifndef RX_BUFFER_SIZE
#define RX_BUFFER_SIZE 128
#endif
#ifndef TX_BUFFER_SIZE
#define TX_BUFFER_SIZE 32
#endif
class MarlinCDCSerial : public HardwareSerial {
public:
MarlinCDCSerial() {}
void begin(unsigned long baudrate) override {}
void begin(unsigned long baudrate, uint16_t config) override { }
void end() override { }
int available() override {
return MCUI::CDCSerial0::available();
}
int peek() override { char c = 0; return MCUI::CDCSerial0::peek((uint8_t*)&c)? c : -1; }
int read() override { char c = 0; return MCUI::CDCSerial0::read((uint8_t*)&c, 1)? c : -1; }
void flush() override {};
size_t write(uint8_t c) override { return write(&c, 1); }
size_t write(const uint8_t *buffer, size_t size) override { return MCUI::CDCSerial0::connected() ? MCUI::CDCSerial0::write(buffer, size) : 0; }
using Print::write;
operator bool() override { return true; }
};
extern MarlinCDCSerial MCDCSerial0;
class MarlinSerial : public HardwareSerial {
public:
MarlinSerial(const uint32_t uart_id) : uart_device(uart_id) {}
void begin(unsigned long baudrate) override {
uart_device.configure_pins(P0_02, P0_03);
uart_device.init({ .baud = baudrate });
#if ENABLED(EMERGENCY_PARSER)
uart_device.set_rx_callback([this](char rx_value){ return this->recv_callback(rx_value); } );
#endif
}
void begin(unsigned long baudrate, uint16_t config) override {
begin(baudrate);
}
void end() override { }
int available() override {
return uart_device.rx_available();
}
int peek() override { char c = 0; return uart_device.peek(&c)? c : -1; }
int read() override { char c = 0; return uart_device.read(&c)? c : -1; }
void flush() override {};
size_t write(uint8_t c) override { return write(&c, 1); }
size_t write(const uint8_t *buffer, size_t size) override { return uart_device.write((const char *)buffer, size); }
using Print::write; // pull in write(str) and write(buf, size) from Print
operator bool() override { return true; }
bool recv_callback(char value);
private:
MCUI::BufferedUARTC uart_device;
};
// On LPC176x framework, HardwareSerial does not implement the same interface as Arduino's Serial, so overloads
// of 'available' and 'read' method are not used in this multiple inheritance scenario.
// Instead, use a ForwardSerial here that adapts the interface.
typedef ForwardSerial1Class<MarlinSerial> MSerialT;
extern MSerialT MSerial0;
extern MSerialT MSerial1;
extern MSerialT MSerial2;
extern MSerialT MSerial3;
// Consequently, we can't use a RuntimeSerial either. The workaround would be to use
// a RuntimeSerial<ForwardSerial<MarlinSerial>> type here. Ignore for now until it's actually required.
#if ENABLED(SERIAL_RUNTIME_HOOK)
#error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x."
#endif
-51
View File
@@ -1,51 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC4078
#include "../../inc/MarlinConfig.h"
#include "HAL.h"
#if ENABLED(POSTMORTEM_DEBUGGING)
#include "../shared/MinSerial.h"
#include <debug_frmwrk.h>
static void TX(char c) { _DBC(c); }
void install_min_serial() { HAL_min_serial_out = &TX; }
#if DISABLED(DYNAMIC_VECTORTABLE)
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"))) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) NMI_Handler();
}
#endif
#endif // POSTMORTEM_DEBUGGING
#endif // TARGET_LPC4078
-69
View File
@@ -1,69 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
* Copyright (c) 2009 Michael Margolis. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
/**
* Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
*
* The only modification was to update/delete macros to match the LPC176x.
*/
#include <Servo.h>
class libServo: public Servo {
public:
void move(const int value) {
constexpr uint16_t servo_delay[] = SERVO_DELAY;
static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
if (attach(servo_info[servoIndex].Pin.nbr) >= 0) { // try to reattach
write(value);
safe_delay(servo_delay[servoIndex]); // delay to allow servo to reach position
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
}
}
};
class libServo;
typedef libServo hal_servo_t;
-47
View File
@@ -1,47 +0,0 @@
#ifdef TARGET_LPC4078
#include <Arduino.h>
#include "SoftwareSPI.h"
#include <mcu_interface.h>
uint8_t swSpiTransfer(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin) {
for (uint8_t i = 0; i < 8; i++) {
if (spi_speed == 0) {
MCUI::gpio_set(mosi_pin, !!(b & 0x80));
MCUI::gpio_set(sck_pin, HIGH);
b <<= 1;
if (miso_pin >= 0 && MCUI::gpio_get(miso_pin)) b |= 1;
MCUI::gpio_set(sck_pin, LOW);
}
else {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
for (uint8_t j = 0; j < spi_speed; j++)
MCUI::gpio_set(mosi_pin, state);
for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
MCUI::gpio_set(sck_pin, HIGH);
b <<= 1;
if (miso_pin >= 0 && MCUI::gpio_get(miso_pin)) b |= 1;
for (uint8_t j = 0; j < spi_speed; j++)
MCUI::gpio_set(sck_pin, LOW);
}
}
return b;
}
void swSpiBegin(const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin) {
pinMode(sck_pin, OUTPUT);
if (MCUI::pin_is_valid(miso_pin)) pinMode(miso_pin, INPUT);
pinMode(mosi_pin, OUTPUT);
}
uint8_t swSpiInit(const uint8_t spiRate, const pin_t sck_pin, const pin_t mosi_pin) {
MCUI::gpio_set(mosi_pin, HIGH);
MCUI::gpio_set(sck_pin, LOW);
return (SystemCoreClock == 120000000 ? 44 : 38) / std::pow(2, 6 - std::min(spiRate, (uint8_t)6));
}
#endif // TARGET_LPC4078
-5
View File
@@ -1,5 +0,0 @@
#include <mcu_interface.h>
uint8_t swSpiTransfer(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin);
void swSpiBegin(const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin);
uint8_t swSpiInit(const uint8_t spiRate, const pin_t sck_pin, const pin_t mosi_pin);

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