Compare commits
332 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d4fb0cf39 | |||
| 81e4698097 | |||
| 95f81d2565 | |||
| 9c922f0eab | |||
| 35a03d66e5 | |||
| a4a0887fa7 | |||
| e7c9cf3e1d | |||
| 6710616a09 | |||
| 2064c83c66 | |||
| 2e97ad1f4b | |||
| 4f85f88ae3 | |||
| 181a57ae9b | |||
| 3ee1248cf2 | |||
| 68c3916d46 | |||
| e3bbacd8b9 | |||
| f915371248 | |||
| dbf0f5faec | |||
| ea848aa891 | |||
| 5157849c60 | |||
| ca31f9789e | |||
| 78d3cf1de1 | |||
| 521e7eafce | |||
| 2d78a80cf6 | |||
| cb963669db | |||
| 5f32698da5 | |||
| 1845056014 | |||
| 0b8ec2aa74 | |||
| 578bdd4b20 | |||
| 6b6865d068 | |||
| 6c018eb770 | |||
| 5561bafbe6 | |||
| 75eee04972 | |||
| ee1d1faa52 | |||
| dbd3e10959 | |||
| fde330af5a | |||
| e8d953257e | |||
| cc86e9ecce | |||
| 5a6db519d6 | |||
| 98d09e5304 | |||
| d87a0ea7f7 | |||
| 0e2bd069d4 | |||
| feca9a33d5 | |||
| eec1aec071 | |||
| a97d1088f0 | |||
| a7317de3b4 | |||
| 06762db050 | |||
| 4f3ebea3a6 | |||
| fa88e0f054 | |||
| 2fd7c2b865 | |||
| ef0bd975cf | |||
| bdc14ddbd7 | |||
| 383e6f4646 | |||
| e37415c95b | |||
| a33112a4c0 | |||
| 7e8007f024 | |||
| f320c2a455 | |||
| 6eedeaedaf | |||
| 6b5e19cfc4 | |||
| 3dc437add4 | |||
| 5f96dffb9b | |||
| 6423b8031d | |||
| bbdad79ce5 | |||
| a2daee8f7a | |||
| 909e3ad116 | |||
| 556616c4f0 | |||
| 46e426ce96 | |||
| f5f6c37c17 | |||
| 08fe8a3076 | |||
| dabcea991f | |||
| 4a5bd47b6a | |||
| e5742a98df | |||
| 774cecc3b4 | |||
| 83b7e32ec4 | |||
| a22155bd96 | |||
| 1da947f548 | |||
| 70332b271b | |||
| a3960dfa53 | |||
| 4296ddb92c | |||
| 6be8ed2956 | |||
| 1f0c4d809a | |||
| bab1917311 | |||
| 49348716f5 | |||
| eb781afe7b | |||
| 39f53c3f8c | |||
| b5307aaaad | |||
| f5cf667c95 | |||
| 737095f852 | |||
| f56952c9e6 | |||
| ca5a7be5e8 | |||
| 582c5a36d7 | |||
| a8058729cc | |||
| a2f024ffe3 | |||
| e1d65cc5e0 | |||
| 75cda8d191 | |||
| af8dcc6ee8 | |||
| 2270bf41d7 | |||
| 489ef6e5e1 | |||
| cecc745844 | |||
| 5366362e47 | |||
| a1ecea60fd | |||
| 882421a03e | |||
| a36f72e886 | |||
| 247e989377 | |||
| 91ae676b9b | |||
| a955e06259 | |||
| 31683ce35b | |||
| d773570cd6 | |||
| 556da2b3fc | |||
| 9e19a6efe1 | |||
| f433b2c433 | |||
| bc0d7d7140 | |||
| 24f8831021 | |||
| 9a8fb80eed | |||
| ca12459b9c | |||
| e1ab911c35 | |||
| 58d4494365 | |||
| d502e5beaa | |||
| b4a95db7da | |||
| 02ba6f9f3a | |||
| dba0010607 | |||
| 90667f6114 | |||
| d6961b2626 | |||
| 07ebb8171f | |||
| 245db73929 | |||
| 9342dae8f0 | |||
| 1f84f50fd8 | |||
| 3326c749f8 | |||
| 0269106066 | |||
| 95d38a8e54 | |||
| dca6afc26e | |||
| 19684f23bc | |||
| 52a561399e | |||
| 0683e8a9a3 | |||
| 1bb4a042e2 | |||
| d10861e478 | |||
| cf7c86d581 | |||
| d99e150097 | |||
| 9e88eb6100 | |||
| 71d9a3e1df | |||
| 6575dcc803 | |||
| 2715e5ba1b | |||
| 9a570b23a3 | |||
| 1b091ecb87 | |||
| a75a5f8b2a | |||
| 80dd02fbdb | |||
| e6755450df | |||
| 9215bf791b | |||
| 311bfc99f3 | |||
| a3434de2e6 | |||
| 2bf56b00d4 | |||
| c31d9e717b | |||
| d9d7820b0d | |||
| 9343247e07 | |||
| 351a1a1332 | |||
| 7e9868d762 | |||
| d1cf817660 | |||
| c91771a51e | |||
| a337a43bfd | |||
| 77f93e0b8c | |||
| 7dc7195696 | |||
| 56773bd80e | |||
| 1dec9831d3 | |||
| 390f1f7c69 | |||
| d30fcb8fff | |||
| 17dfe8edc9 | |||
| 7b6b6e1c3e | |||
| 60f2837a98 | |||
| ef5fb390ec | |||
| 87e94f4563 | |||
| 017a9032f1 | |||
| 466282f322 | |||
| 17594298e1 | |||
| 0b9f487ab9 | |||
| d3e1a92b84 | |||
| cd357b0278 | |||
| d0d229e380 | |||
| eb897e65a1 | |||
| 825ebfd5fe | |||
| 3ee3964bec | |||
| aecfb257e9 | |||
| 896a6a93af | |||
| 075f96d2bf | |||
| 05896551f1 | |||
| ea6a891038 | |||
| 983aee5718 | |||
| c913020dc2 | |||
| a50490b11f | |||
| 4b01c901bc | |||
| c1be36bc66 | |||
| e0222d3e01 | |||
| c0264ae787 | |||
| 3a2c50c199 | |||
| 3b4adac579 | |||
| d36b3fbf9d | |||
| bca40e07e3 | |||
| 9a1c993719 | |||
| 1eff7796d5 | |||
| 504219817c | |||
| 4f2b7271bd | |||
| ec6f9dd5c8 | |||
| e6cda9932b | |||
| b9cfbaa8d4 | |||
| 3fd175af8e | |||
| a9e72b2a2c | |||
| ecde3a3158 | |||
| c8d51c2723 | |||
| d609bb4671 | |||
| 982b425792 | |||
| 9e879a5b1f | |||
| 9974327d33 | |||
| 4eba643ae1 | |||
| 8d7be79108 | |||
| 76b5688304 | |||
| 1e8fbb7bbb | |||
| 20c6a6233b | |||
| 1d295f7983 | |||
| 669814d0d4 | |||
| 4aa48beb37 | |||
| 371fb5a256 | |||
| 0829a511f0 | |||
| a3c78c4510 | |||
| a3211253a0 | |||
| 2c8e7bd5a5 | |||
| 005d6879d9 | |||
| 3dd22349a9 | |||
| e61a84a717 | |||
| d8e73d3036 | |||
| b12340b1d5 | |||
| ec46a59539 | |||
| 5003681414 | |||
| d9396929aa | |||
| 1dee4d92c6 | |||
| 9364cbb4b5 | |||
| 755b661c2d | |||
| 7f4792e47c | |||
| e6837b2b8d | |||
| 9e21330d7a | |||
| c476e62a6f | |||
| 4c5d7831c1 | |||
| 9a5cfb3f26 | |||
| 5a87bea762 | |||
| d62f45bdc1 | |||
| 5c77117e4b | |||
| 4504446e2e | |||
| 8f8e1323da | |||
| e882457e42 | |||
| 1696a06950 | |||
| f9d5ee04b4 | |||
| 85f60cc71a | |||
| ef04680cc5 | |||
| 1c6cfc3ffe | |||
| 0266e7fe53 | |||
| 610ea0a9d3 | |||
| 70d942a184 | |||
| 5639237e2b | |||
| 541bd26cd7 | |||
| 7a4d601f4d | |||
| bf8675b44a | |||
| ebea672240 | |||
| ce8535f01c | |||
| 0ba4cd2b3b | |||
| afc2dd6cab | |||
| 5768b42c39 | |||
| ee8630c282 | |||
| 01094ea6aa | |||
| 6c1fd1f69c | |||
| 4f65466161 | |||
| 9b3119393f | |||
| 8594e9462c | |||
| 16acb57b22 | |||
| 04c8a3138e | |||
| 38560378fc | |||
| ffbf4a6a90 | |||
| a215bc2ca3 | |||
| cbc674ff99 | |||
| 97546bf55b | |||
| ed1391ee5d | |||
| 7fbd9ec5f4 | |||
| 63989023b8 | |||
| e668d5afd7 | |||
| a2228276bb | |||
| 3ef192e7c7 | |||
| 5fea79fd07 | |||
| 18e65f5eb4 | |||
| 5ed6bf65ba | |||
| d79bcef802 | |||
| f1a53407e7 | |||
| 4309e6ab76 | |||
| 0c3d1cf566 | |||
| aa7d571486 | |||
| 604d3e8fad | |||
| 22fc07d72b | |||
| dd3b5a10a0 | |||
| 416f94f03a | |||
| 204de723f1 | |||
| 80cd89d8f7 | |||
| 624226c91d | |||
| 3adf73a2cd | |||
| eb7b207e4c | |||
| d7e45367af | |||
| 388c7018c4 | |||
| da96607b65 | |||
| fb49645b32 | |||
| 7d751a20b1 | |||
| 9f7d5bbc86 | |||
| 0df25b1008 | |||
| cef623b7d2 | |||
| 12434e78e4 | |||
| 2200607989 | |||
| c31381183b | |||
| 76dce41580 | |||
| 1f1ca34ea6 | |||
| 8d4ab15748 | |||
| 745577693d | |||
| 3019af1c93 | |||
| 8916e6f826 | |||
| b2fd631d82 | |||
| cadef64418 | |||
| ab3497161a | |||
| 46f370ae3c | |||
| 0f43ac79f6 | |||
| ef92b6c369 | |||
| f44f9eb9f8 | |||
| 854f3315af | |||
| 1d46e67de2 | |||
| 85ded0b9bd | |||
| cb291e8d00 | |||
| 25caae1e8c | |||
| 12d7995a18 | |||
| 320b7a9ac3 | |||
| a533e9e637 | |||
| f6ecdae972 |
@@ -1,40 +0,0 @@
|
|||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out bugfix-2.0.x
|
- name: Check out bugfix-2.0.x
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: bugfix-2.0.x
|
ref: bugfix-2.0.x
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
- name: Check out bugfix-2.1.x
|
- name: Check out bugfix-2.1.x
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: bugfix-2.1.x
|
ref: bugfix-2.1.x
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# test-builds.yml
|
# ci-build-tests.yml
|
||||||
# Do test builds to catch compile errors
|
# Do test builds to catch compile errors
|
||||||
#
|
#
|
||||||
|
|
||||||
name: CI
|
name: CI - Build Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -14,6 +14,8 @@ on:
|
|||||||
- config/**
|
- config/**
|
||||||
- data/**
|
- data/**
|
||||||
- docs/**
|
- docs/**
|
||||||
|
- test/**
|
||||||
|
- Marlin/tests/**
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -23,11 +25,13 @@ on:
|
|||||||
- config/**
|
- config/**
|
||||||
- data/**
|
- data/**
|
||||||
- docs/**
|
- docs/**
|
||||||
|
- test/**
|
||||||
|
- Marlin/tests/**
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_builds:
|
test_builds:
|
||||||
name: Run All Tests
|
name: Build Test
|
||||||
if: github.repository == 'MarlinFirmware/Marlin'
|
if: github.repository == 'MarlinFirmware/Marlin'
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -152,7 +156,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Cache pip
|
- name: Cache pip
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
@@ -160,13 +164,13 @@ jobs:
|
|||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Cache PlatformIO
|
- name: Cache PlatformIO
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.platformio
|
path: ~/.platformio
|
||||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||||
|
|
||||||
- name: Select Python 3.9
|
- name: Select Python 3.9
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.9'
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#
|
||||||
|
# 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
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#
|
||||||
|
# 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
|
||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
- "Needs: Work"
|
- "Needs: Work"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Remove Labels
|
- name: Remove Labels
|
||||||
uses: actions-ecosystem/action-remove-labels@v1
|
uses: actions-ecosystem/action-remove-labels@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v8
|
- uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: |
|
stale-issue-message: |
|
||||||
|
|||||||
@@ -17,15 +17,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: dessant/lock-threads@v2
|
- uses: dessant/lock-threads@v5
|
||||||
with:
|
with:
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
process-only: 'issues'
|
process-only: 'issues'
|
||||||
issue-lock-inactive-days: '60'
|
issue-inactive-days: '60'
|
||||||
issue-exclude-created-before: ''
|
exclude-issue-created-before: ''
|
||||||
issue-exclude-labels: 'no-locking'
|
exclude-any-issue-labels: 'no-locking'
|
||||||
issue-lock-labels: ''
|
add-issue-labels: ''
|
||||||
issue-lock-comment: >
|
issue-comment: >
|
||||||
This issue has been automatically locked since there
|
This issue has been automatically locked since there
|
||||||
has not been any recent activity after it was closed.
|
has not been any recent activity after it was closed.
|
||||||
Please open a new issue for related bugs.
|
Please open a new issue for related bugs.
|
||||||
|
|||||||
@@ -2,16 +2,23 @@ SCRIPTS_DIR := buildroot/share/scripts
|
|||||||
CONTAINER_RT_BIN := docker
|
CONTAINER_RT_BIN := docker
|
||||||
CONTAINER_RT_OPTS := --rm -v $(PWD):/code -v platformio-cache:/root/.platformio
|
CONTAINER_RT_OPTS := --rm -v $(PWD):/code -v platformio-cache:/root/.platformio
|
||||||
CONTAINER_IMAGE := marlin-dev
|
CONTAINER_IMAGE := marlin-dev
|
||||||
|
UNIT_TEST_CONFIG ?= default
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Tasks for local development:"
|
@echo "Tasks for local development:"
|
||||||
@echo "* format-pins: Reformat all pins files"
|
@echo "make marlin : Build marlin for the configured board"
|
||||||
@echo "* tests-single-ci: Run a single test from inside the CI"
|
@echo "make format-pins -j : Reformat all pins files (-j for parallel execution)"
|
||||||
@echo "* tests-single-local: Run a single test locally"
|
@echo "make validate-pins -j : Validate all pins files, fails if any require reformatting"
|
||||||
@echo "* tests-single-local-docker: Run a single test locally, using docker"
|
@echo "make tests-single-ci : Run a single test from inside the CI"
|
||||||
@echo "* tests-all-local: Run all tests locally"
|
@echo "make tests-single-local : Run a single test locally"
|
||||||
@echo "* tests-all-local-docker: Run all tests locally, using docker"
|
@echo "make tests-single-local-docker : Run a single test locally, using docker"
|
||||||
@echo "* setup-local-docker: Build the local docker image"
|
@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 ""
|
@echo ""
|
||||||
@echo "Options for testing:"
|
@echo "Options for testing:"
|
||||||
@echo " TEST_TARGET Set when running tests-single-*, to select the"
|
@echo " TEST_TARGET Set when running tests-single-*, to select the"
|
||||||
@@ -21,49 +28,77 @@ help:
|
|||||||
@echo " run on GitHub CI"
|
@echo " run on GitHub CI"
|
||||||
@echo " ONLY_TEST Limit tests to only those that contain this, or"
|
@echo " ONLY_TEST Limit tests to only those that contain this, or"
|
||||||
@echo " the index of the test (1-based)"
|
@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 " 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 " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
|
||||||
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
|
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
|
||||||
.PHONY: help
|
|
||||||
|
marlin:
|
||||||
|
./buildroot/bin/mftest -a
|
||||||
|
.PHONY: marlin
|
||||||
|
|
||||||
tests-single-ci:
|
tests-single-ci:
|
||||||
export GIT_RESET_HARD=true
|
export GIT_RESET_HARD=true
|
||||||
$(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) PLATFORMIO_BUILD_FLAGS=-DGITHUB_ACTION
|
$(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) PLATFORMIO_BUILD_FLAGS=-DGITHUB_ACTION
|
||||||
.PHONY: tests-single-ci
|
|
||||||
|
|
||||||
tests-single-local:
|
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
|
@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 PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
||||||
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
||||||
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
|
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
|
||||||
.PHONY: tests-single-local
|
|
||||||
|
|
||||||
tests-single-local-docker:
|
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 ! 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
|
@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:
|
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 PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
||||||
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
||||||
&& for TEST_TARGET in $$($(SCRIPTS_DIR)/get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
|
&& for TEST_TARGET in $$(python $(SCRIPTS_DIR)/get_test_targets.py) ; do \
|
||||||
.PHONY: tests-all-local
|
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
|
||||||
|
|
||||||
tests-all-local-docker:
|
tests-all-local-docker:
|
||||||
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; 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-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
|
$(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
|
|
||||||
|
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
|
||||||
|
|
||||||
setup-local-docker:
|
setup-local-docker:
|
||||||
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
|
$(CONTAINER_RT_BIN) buildx build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
|
||||||
.PHONY: setup-local-docker
|
|
||||||
|
|
||||||
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
|
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
|
||||||
|
|
||||||
.PHONY: $(PINS)
|
.PHONY: $(PINS) format-pins validate-pins
|
||||||
|
|
||||||
$(PINS): %:
|
$(PINS): %:
|
||||||
@echo "Formatting $@" && node buildroot/share/scripts/pinsformat.js $@
|
@echo "Formatting $@"
|
||||||
|
@python $(SCRIPTS_DIR)/pinsformat.py $< $@
|
||||||
|
|
||||||
format-pins: $(PINS)
|
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)
|
||||||
|
|||||||
+45
-29
@@ -135,9 +135,9 @@
|
|||||||
* Options: A4988, A5984, DRV8825, LV8729, TB6560, TB6600, TMC2100,
|
* Options: A4988, A5984, DRV8825, LV8729, TB6560, TB6600, TMC2100,
|
||||||
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
||||||
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
|
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
|
||||||
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
|
* TMC2660, TMC2660_STANDALONE, TMC5130, TMC5130_STANDALONE,
|
||||||
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
* TMC5160, TMC5160_STANDALONE
|
||||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||||
*/
|
*/
|
||||||
#define X_DRIVER_TYPE A4988
|
#define X_DRIVER_TYPE A4988
|
||||||
#define Y_DRIVER_TYPE A4988
|
#define Y_DRIVER_TYPE A4988
|
||||||
@@ -401,9 +401,18 @@
|
|||||||
//#define PS_OFF_SOUND // Beep 1s when power off
|
//#define PS_OFF_SOUND // Beep 1s when power off
|
||||||
#define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box
|
#define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box
|
||||||
|
|
||||||
//#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
|
//#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
|
||||||
//#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
|
//#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
|
||||||
//#define LED_POWEROFF_TIMEOUT 10000 // (ms) Turn off LEDs after power-off, with this amount of delay
|
//#define LED_POWEROFF_TIMEOUT 10000 // (ms) Turn off LEDs after power-off, with this amount of delay
|
||||||
|
|
||||||
|
//#define PSU_OFF_REDUNDANT // Second pin for redundant power control
|
||||||
|
//#define PSU_OFF_REDUNDANT_INVERTED // Redundant pin state is the inverse of PSU_ACTIVE_STATE
|
||||||
|
|
||||||
|
//#define PS_ON1_PIN 6 // Redundant pin required to enable power in combination with PS_ON_PIN
|
||||||
|
|
||||||
|
//#define PS_ON_EDM_PIN 8 // External Device Monitoring pins for external power control relay feedback. Fault on mismatch.
|
||||||
|
//#define PS_ON1_EDM_PIN 9
|
||||||
|
#define PS_EDM_RESPONSE 250 // (ms) Time to allow for relay action
|
||||||
|
|
||||||
//#define POWER_OFF_TIMER // Enable M81 D<seconds> to power off after a delay
|
//#define POWER_OFF_TIMER // Enable M81 D<seconds> to power off after a delay
|
||||||
//#define POWER_OFF_WAIT_FOR_COOLDOWN // Enable M81 S to power off only after cooldown
|
//#define POWER_OFF_WAIT_FOR_COOLDOWN // Enable M81 S to power off only after cooldown
|
||||||
@@ -663,7 +672,7 @@
|
|||||||
* MPCTEMP : Predictive Model temperature control. (~1.8K without auto-tune)
|
* MPCTEMP : Predictive Model temperature control. (~1.8K without auto-tune)
|
||||||
*/
|
*/
|
||||||
#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning
|
#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning
|
||||||
//#define MPCTEMP // ** EXPERIMENTAL ** See https://marlinfw.org/docs/features/model_predictive_control.html
|
//#define MPCTEMP // See https://marlinfw.org/docs/features/model_predictive_control.html
|
||||||
|
|
||||||
#define PID_MAX 255 // Limit hotend current while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
|
#define PID_MAX 255 // Limit hotend current while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
|
||||||
#define PID_K1 0.95 // Smoothing factor within any PID loop
|
#define PID_K1 0.95 // Smoothing factor within any PID loop
|
||||||
@@ -1006,9 +1015,6 @@
|
|||||||
// Radius around the center where the arm cannot reach
|
// Radius around the center where the arm cannot reach
|
||||||
#define MIDDLE_DEAD_ZONE_R 0 // (mm)
|
#define MIDDLE_DEAD_ZONE_R 0 // (mm)
|
||||||
|
|
||||||
#define THETA_HOMING_OFFSET 0 // Calculated from Calibration Guide and M360 / M114. See https://www.morgan3dp.com/morgan-calibration-guide/
|
|
||||||
#define PSI_HOMING_OFFSET 0 // Calculated from Calibration Guide and M364 / M114. See https://www.morgan3dp.com/morgan-calibration-guide/
|
|
||||||
|
|
||||||
#elif ENABLED(MP_SCARA)
|
#elif ENABLED(MP_SCARA)
|
||||||
|
|
||||||
#define SCARA_OFFSET_THETA1 12 // degrees
|
#define SCARA_OFFSET_THETA1 12 // degrees
|
||||||
@@ -1027,23 +1033,19 @@
|
|||||||
#define DEFAULT_SEGMENTS_PER_SECOND 200
|
#define DEFAULT_SEGMENTS_PER_SECOND 200
|
||||||
|
|
||||||
// Length of inner and outer support arms. Measure arm lengths precisely.
|
// Length of inner and outer support arms. Measure arm lengths precisely.
|
||||||
#define TPARA_LINKAGE_1 120 // (mm)
|
#define TPARA_LINKAGE_1 120 // (mm)
|
||||||
#define TPARA_LINKAGE_2 120 // (mm)
|
#define TPARA_LINKAGE_2 120 // (mm)
|
||||||
|
|
||||||
// SCARA tower offset (position of Tower relative to bed zero position)
|
// TPARA tower offset (position of Tower relative to bed zero position)
|
||||||
// This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
|
// This needs to be reasonably accurate as it defines the printbed position in the TPARA space.
|
||||||
#define TPARA_OFFSET_X 0 // (mm)
|
#define TPARA_OFFSET_X 0 // (mm)
|
||||||
#define TPARA_OFFSET_Y 0 // (mm)
|
#define TPARA_OFFSET_Y 0 // (mm)
|
||||||
#define TPARA_OFFSET_Z 0 // (mm)
|
#define TPARA_OFFSET_Z 0 // (mm)
|
||||||
|
|
||||||
#define FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly
|
#define FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly
|
||||||
|
|
||||||
// Radius around the center where the arm cannot reach
|
// Radius around the center where the arm cannot reach
|
||||||
#define MIDDLE_DEAD_ZONE_R 0 // (mm)
|
#define MIDDLE_DEAD_ZONE_R 0 // (mm)
|
||||||
|
|
||||||
// Calculated from Calibration Guide and M360 / M114. See https://www.morgan3dp.com/morgan-calibration-guide/
|
|
||||||
#define THETA_HOMING_OFFSET 0
|
|
||||||
#define PSI_HOMING_OFFSET 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @section polar
|
// @section polar
|
||||||
@@ -1231,11 +1233,16 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Axis Steps Per Unit (linear=steps/mm, rotational=steps/°)
|
* Default Axis Steps Per Unit (linear=steps/mm, rotational=steps/°)
|
||||||
* Override with M92
|
* Override with M92 (when enabled below)
|
||||||
* X, Y, Z [, I [, J [, K...]]], E0 [, E1[, E2...]]
|
* X, Y, Z [, I [, J [, K...]]], E0 [, E1[, E2...]]
|
||||||
*/
|
*/
|
||||||
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 }
|
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable support for M92. Disable to save at least ~530 bytes of flash.
|
||||||
|
*/
|
||||||
|
#define EDITABLE_STEPS_PER_UNIT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Max Feed Rate (linear=mm/s, rotational=°/s)
|
* Default Max Feed Rate (linear=mm/s, rotational=°/s)
|
||||||
* Override with M203
|
* Override with M203
|
||||||
@@ -1286,6 +1293,7 @@
|
|||||||
#define DEFAULT_XJERK 10.0
|
#define DEFAULT_XJERK 10.0
|
||||||
#define DEFAULT_YJERK 10.0
|
#define DEFAULT_YJERK 10.0
|
||||||
#define DEFAULT_ZJERK 0.3
|
#define DEFAULT_ZJERK 0.3
|
||||||
|
#define DEFAULT_EJERK 5.0
|
||||||
//#define DEFAULT_IJERK 0.3
|
//#define DEFAULT_IJERK 0.3
|
||||||
//#define DEFAULT_JJERK 0.3
|
//#define DEFAULT_JJERK 0.3
|
||||||
//#define DEFAULT_KJERK 0.3
|
//#define DEFAULT_KJERK 0.3
|
||||||
@@ -1301,8 +1309,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_EJERK 5.0 // May be used by Linear Advance
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Junction Deviation Factor
|
* Junction Deviation Factor
|
||||||
*
|
*
|
||||||
@@ -1442,6 +1448,17 @@
|
|||||||
//#define BD_SENSOR_PROBE_NO_STOP // Probe bed without stopping at each probe point
|
//#define BD_SENSOR_PROBE_NO_STOP // Probe bed without stopping at each probe point
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BIQU MicroProbe
|
||||||
|
*
|
||||||
|
* A lightweight, solenoid-driven probe.
|
||||||
|
* For information about this sensor https://github.com/bigtreetech/MicroProbe
|
||||||
|
*
|
||||||
|
* Also requires: PROBE_ENABLE_DISABLE
|
||||||
|
*/
|
||||||
|
//#define BIQU_MICROPROBE_V1 // Triggers HIGH
|
||||||
|
//#define BIQU_MICROPROBE_V2 // Triggers LOW
|
||||||
|
|
||||||
// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN)
|
// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN)
|
||||||
//#define SOLENOID_PROBE
|
//#define SOLENOID_PROBE
|
||||||
|
|
||||||
@@ -2201,7 +2218,7 @@
|
|||||||
#if ENABLED(LCD_BED_TRAMMING)
|
#if ENABLED(LCD_BED_TRAMMING)
|
||||||
#define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
|
#define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
|
||||||
#define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at tramming points
|
#define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at tramming points
|
||||||
#define BED_TRAMMING_Z_HOP 4.0 // (mm) Z height of nozzle between tramming points
|
#define BED_TRAMMING_Z_HOP 4.0 // (mm) Z raise between tramming points
|
||||||
//#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner
|
//#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner
|
||||||
//#define BED_TRAMMING_USE_PROBE
|
//#define BED_TRAMMING_USE_PROBE
|
||||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||||
@@ -2619,9 +2636,9 @@
|
|||||||
#define DISPLAY_CHARSET_HD44780 JAPANESE
|
#define DISPLAY_CHARSET_HD44780 JAPANESE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info Screen Style (0:Classic, 1:Průša)
|
* Info Screen Style (0:Classic, 1:Průša, 2:CNC)
|
||||||
*
|
*
|
||||||
* :[0:'Classic', 1:'Průša']
|
* :[0:'Classic', 1:'Průša', 2:'CNC']
|
||||||
*/
|
*/
|
||||||
#define LCD_INFO_SCREEN_STYLE 0
|
#define LCD_INFO_SCREEN_STYLE 0
|
||||||
|
|
||||||
@@ -3022,7 +3039,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Factory display for Creality CR-10 / CR-7 / Ender-3
|
// Factory display for Creality CR-10 / CR-7 / Ender-3
|
||||||
// https://www.aliexpress.com/item/32833148327.html
|
// https://marlinfw.org/docs/hardware/controllers.html#cr10_stockdisplay
|
||||||
//
|
//
|
||||||
// Connect to EXP1 on RAMPS and compatible boards.
|
// Connect to EXP1 on RAMPS and compatible boards.
|
||||||
//
|
//
|
||||||
@@ -3399,7 +3416,6 @@
|
|||||||
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
|
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
|
||||||
|
|
||||||
//#define DISABLE_ENCODER // Disable the click encoder, if any
|
//#define DISABLE_ENCODER // Disable the click encoder, if any
|
||||||
//#define TOUCH_IDLE_SLEEP_MINS 5 // (minutes) Display Sleep after a period of inactivity. Set with M255 S.
|
|
||||||
|
|
||||||
#define TOUCH_SCREEN_CALIBRATION
|
#define TOUCH_SCREEN_CALIBRATION
|
||||||
|
|
||||||
|
|||||||
+58
-54
@@ -459,7 +459,7 @@
|
|||||||
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0
|
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed)
|
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power-loss due to cooling = Kf * (fan_speed)
|
||||||
#define DEFAULT_Kf 10 // A constant value added to the PID-tuner
|
#define DEFAULT_Kf 10 // A constant value added to the PID-tuner
|
||||||
#define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING
|
#define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING
|
||||||
#endif
|
#endif
|
||||||
@@ -1185,33 +1185,32 @@
|
|||||||
* Zero Vibration (ZV) Input Shaping for X and/or Y movements.
|
* Zero Vibration (ZV) Input Shaping for X and/or Y movements.
|
||||||
*
|
*
|
||||||
* This option uses a lot of SRAM for the step buffer. The buffer size is
|
* This option uses a lot of SRAM for the step buffer. The buffer size is
|
||||||
* calculated automatically from SHAPING_FREQ_[XY], DEFAULT_AXIS_STEPS_PER_UNIT,
|
* calculated automatically from SHAPING_FREQ_[XYZ], DEFAULT_AXIS_STEPS_PER_UNIT,
|
||||||
* DEFAULT_MAX_FEEDRATE and ADAPTIVE_STEP_SMOOTHING. The default calculation can
|
* DEFAULT_MAX_FEEDRATE and ADAPTIVE_STEP_SMOOTHING. The default calculation can
|
||||||
* be overridden by setting SHAPING_MIN_FREQ and/or SHAPING_MAX_FEEDRATE.
|
* be overridden by setting SHAPING_MIN_FREQ and/or SHAPING_MAX_FEEDRATE.
|
||||||
* The higher the frequency and the lower the feedrate, the smaller the buffer.
|
* The higher the frequency and the lower the feedrate, the smaller the buffer.
|
||||||
* If the buffer is too small at runtime, input shaping will have reduced
|
* If the buffer is too small at runtime, input shaping will have reduced
|
||||||
* effectiveness during high speed movements.
|
* effectiveness during high speed movements.
|
||||||
*
|
*
|
||||||
* Tune with M593 D<factor> F<frequency>:
|
* Tune with M593 D<factor> F<frequency>
|
||||||
*
|
|
||||||
* D<factor> Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes.
|
|
||||||
* F<frequency> Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes.
|
|
||||||
* T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet)
|
|
||||||
* X<1> Set the given parameters only for the X axis.
|
|
||||||
* Y<1> Set the given parameters only for the Y axis.
|
|
||||||
*/
|
*/
|
||||||
//#define INPUT_SHAPING_X
|
//#define INPUT_SHAPING_X
|
||||||
//#define INPUT_SHAPING_Y
|
//#define INPUT_SHAPING_Y
|
||||||
#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y)
|
//#define INPUT_SHAPING_Z
|
||||||
|
#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y, INPUT_SHAPING_Z)
|
||||||
#if ENABLED(INPUT_SHAPING_X)
|
#if ENABLED(INPUT_SHAPING_X)
|
||||||
#define SHAPING_FREQ_X 40 // (Hz) The default dominant resonant frequency on the X axis.
|
#define SHAPING_FREQ_X 40.0 // (Hz) The default dominant resonant frequency on the X axis.
|
||||||
#define SHAPING_ZETA_X 0.15f // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping).
|
#define SHAPING_ZETA_X 0.15 // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping).
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(INPUT_SHAPING_Y)
|
#if ENABLED(INPUT_SHAPING_Y)
|
||||||
#define SHAPING_FREQ_Y 40 // (Hz) The default dominant resonant frequency on the Y axis.
|
#define SHAPING_FREQ_Y 40.0 // (Hz) The default dominant resonant frequency on the Y axis.
|
||||||
#define SHAPING_ZETA_Y 0.15f // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping).
|
#define SHAPING_ZETA_Y 0.15 // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping).
|
||||||
#endif
|
#endif
|
||||||
//#define SHAPING_MIN_FREQ 20 // By default the minimum of the shaping frequencies. Override to affect SRAM usage.
|
#if ENABLED(INPUT_SHAPING_Z)
|
||||||
|
#define SHAPING_FREQ_Z 40.0 // (Hz) The default dominant resonant frequency on the Z axis.
|
||||||
|
#define SHAPING_ZETA_Z 0.15 // Damping ratio of the Z axis (range: 0.0 = no damping to 1.0 = critical damping).
|
||||||
|
#endif
|
||||||
|
//#define SHAPING_MIN_FREQ 20.0 // (Hz) By default the minimum of the shaping frequencies. Override to affect SRAM usage.
|
||||||
//#define SHAPING_MAX_STEPRATE 10000 // By default the maximum total step rate of the shaped axes. Override to affect SRAM usage.
|
//#define SHAPING_MAX_STEPRATE 10000 // By default the maximum total step rate of the shaped axes. Override to affect SRAM usage.
|
||||||
//#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters.
|
//#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters.
|
||||||
#endif
|
#endif
|
||||||
@@ -1270,11 +1269,11 @@
|
|||||||
* XY Frequency limit
|
* XY Frequency limit
|
||||||
* Reduce resonance by limiting the frequency of small zigzag infill moves.
|
* Reduce resonance by limiting the frequency of small zigzag infill moves.
|
||||||
* See https://hydraraptor.blogspot.com/2010/12/frequency-limit.html
|
* See https://hydraraptor.blogspot.com/2010/12/frequency-limit.html
|
||||||
* Use M201 F<freq> G<min%> to change limits at runtime.
|
* Use M201 F<freq> S<min%> to change limits at runtime.
|
||||||
*/
|
*/
|
||||||
//#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F<hertz>.
|
//#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F<hertz>.
|
||||||
#ifdef XY_FREQUENCY_LIMIT
|
#ifdef XY_FREQUENCY_LIMIT
|
||||||
#define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 G<min%>.
|
#define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 S<min%>.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1474,6 +1473,7 @@
|
|||||||
#if IS_ULTIPANEL
|
#if IS_ULTIPANEL
|
||||||
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
||||||
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
||||||
|
//#define ULTIPANEL_FLOWPERCENT // Encoder sets the flow percentage on the Status Screen
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1539,6 +1539,7 @@
|
|||||||
* Axis moves <= 1/2 the axis length and Extruder moves <= EXTRUDE_MAXLENGTH
|
* Axis moves <= 1/2 the axis length and Extruder moves <= EXTRUDE_MAXLENGTH
|
||||||
* will be shown in the move submenus.
|
* will be shown in the move submenus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MANUAL_MOVE_DISTANCE_MM 10, 1.0, 0.1 // (mm)
|
#define MANUAL_MOVE_DISTANCE_MM 10, 1.0, 0.1 // (mm)
|
||||||
//#define MANUAL_MOVE_DISTANCE_MM 100, 50, 10, 1.0, 0.1 // (mm)
|
//#define MANUAL_MOVE_DISTANCE_MM 100, 50, 10, 1.0, 0.1 // (mm)
|
||||||
//#define MANUAL_MOVE_DISTANCE_MM 500, 100, 50, 10, 1.0, 0.1 // (mm)
|
//#define MANUAL_MOVE_DISTANCE_MM 500, 100, 50, 10, 1.0, 0.1 // (mm)
|
||||||
@@ -1582,7 +1583,7 @@
|
|||||||
#if HAS_MARLINUI_U8GLIB
|
#if HAS_MARLINUI_U8GLIB
|
||||||
//#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash.
|
//#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash.
|
||||||
#endif
|
#endif
|
||||||
#if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE)
|
#if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, HAS_MARLINUI_HD44780)
|
||||||
//#define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup.
|
//#define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1743,19 +1744,25 @@
|
|||||||
*/
|
*/
|
||||||
//#define POWER_LOSS_RECOVERY
|
//#define POWER_LOSS_RECOVERY
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
|
#define PLR_ENABLED_DEFAULT false // Power-Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
|
||||||
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
|
//#define PLR_BED_THRESHOLD BED_MAXTEMP // (°C) Skip user confirmation at or above this bed temperature (0 to disable)
|
||||||
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
|
|
||||||
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
|
//#define POWER_LOSS_PIN 44 // Pin to detect power-loss. Set to -1 to disable default pin on boards without module, or comment to use board default.
|
||||||
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
|
//#define POWER_LOSS_STATE HIGH // State of pin indicating power-loss
|
||||||
//#define POWER_LOSS_PULLUP // Set pullup / pulldown as appropriate for your sensor
|
//#define POWER_LOSS_PULLUP // Set pullup / pulldown as appropriate for your sensor
|
||||||
//#define POWER_LOSS_PULLDOWN
|
//#define POWER_LOSS_PULLDOWN
|
||||||
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
|
|
||||||
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.
|
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power-loss with UPS)
|
||||||
|
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
|
||||||
|
|
||||||
// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
|
// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
|
||||||
// especially with "vase mode" printing. Set too high and vases cannot be continued.
|
// especially with "vase mode" printing. Set too high and vases cannot be continued.
|
||||||
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data
|
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data
|
||||||
|
|
||||||
|
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power-loss
|
||||||
|
#if ENABLED(BACKUP_POWER_SUPPLY)
|
||||||
|
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail
|
||||||
|
#endif
|
||||||
|
|
||||||
// Enable if Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
|
// Enable if Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
|
||||||
//#define POWER_LOSS_RECOVER_ZHOME
|
//#define POWER_LOSS_RECOVER_ZHOME
|
||||||
@@ -1962,17 +1969,6 @@
|
|||||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||||
//#define USE_SMALL_INFOFONT
|
//#define USE_SMALL_INFOFONT
|
||||||
|
|
||||||
/**
|
|
||||||
* Graphical Display Sleep
|
|
||||||
*
|
|
||||||
* The U8G library provides sleep / wake functions for SH1106, SSD1306,
|
|
||||||
* SSD1309, and some other DOGM displays.
|
|
||||||
* Enable this option to save energy and prevent OLED pixel burn-in.
|
|
||||||
* Adds the menu item Configuration > LCD Timeout (m) to set a wait period
|
|
||||||
* from 0 (disabled) to 99 minutes.
|
|
||||||
*/
|
|
||||||
//#define DISPLAY_SLEEP_MINUTES 2 // (minutes) Timeout before turning off the screen. Set with M255 S.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ST7920-based LCDs can emulate a 16 x 4 character display using
|
* ST7920-based LCDs can emulate a 16 x 4 character display using
|
||||||
* the ST7920 character-generator for very fast screen updates.
|
* the ST7920 character-generator for very fast screen updates.
|
||||||
@@ -2221,13 +2217,20 @@
|
|||||||
//#define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan
|
//#define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
/**
|
||||||
// LCD Backlight Timeout
|
* Display Sleep
|
||||||
// Requires a display with a controllable backlight
|
* Enable this option to save energy and prevent OLED pixel burn-in.
|
||||||
//
|
*/
|
||||||
|
//#define DISPLAY_SLEEP_MINUTES 2 // (minutes) Timeout before turning off the screen
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LCD Backlight Timeout
|
||||||
|
* Requires a display with a controllable backlight
|
||||||
|
*/
|
||||||
//#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight
|
//#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight
|
||||||
|
|
||||||
#if defined(DISPLAY_SLEEP_MINUTES) || defined(LCD_BACKLIGHT_TIMEOUT_MINS)
|
#if defined(DISPLAY_SLEEP_MINUTES) || defined(LCD_BACKLIGHT_TIMEOUT_MINS)
|
||||||
#define EDITABLE_DISPLAY_TIMEOUT // Edit timeout with M255 S<minutes> and a menu item
|
#define EDITABLE_DISPLAY_TIMEOUT // Edit sleep / backlight timeout with M255 S<minutes> and a menu item
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2318,7 +2321,6 @@
|
|||||||
#endif
|
#endif
|
||||||
//#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L.
|
//#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L.
|
||||||
//#define LA_DEBUG // Print debug information to serial during operation. Disable for production use.
|
//#define LA_DEBUG // Print debug information to serial during operation. Disable for production use.
|
||||||
//#define ALLOW_LOW_EJERK // Allow a DEFAULT_EJERK value of <10. Recommended for direct drive hotends.
|
|
||||||
//#define EXPERIMENTAL_I2S_LA // Allow I2S_STEPPER_STREAM to be used with LA. Performance degrades as the LA step rate reaches ~20kHz.
|
//#define EXPERIMENTAL_I2S_LA // Allow I2S_STEPPER_STREAM to be used with LA. Performance degrades as the LA step rate reaches ~20kHz.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2695,7 +2697,7 @@
|
|||||||
* This feature is EXPERIMENTAL so use with caution and test thoroughly.
|
* This feature is EXPERIMENTAL so use with caution and test thoroughly.
|
||||||
* Enable this option to receive data on the serial ports via the onboard DMA
|
* Enable this option to receive data on the serial ports via the onboard DMA
|
||||||
* controller for more stable and reliable high-speed serial communication.
|
* controller for more stable and reliable high-speed serial communication.
|
||||||
* Only some STM32 MCUs are currently supported.
|
* Support is currently limited to some STM32 MCUs and all HC32 MCUs.
|
||||||
* Note: This has no effect on emulated USB serial ports.
|
* Note: This has no effect on emulated USB serial ports.
|
||||||
*/
|
*/
|
||||||
//#define SERIAL_DMA
|
//#define SERIAL_DMA
|
||||||
@@ -2950,15 +2952,12 @@
|
|||||||
* Some boards have simple jumper connections! See your board's documentation.
|
* Some boards have simple jumper connections! See your board's documentation.
|
||||||
* - These drivers can also be used with Hardware Serial.
|
* - These drivers can also be used with Hardware Serial.
|
||||||
*
|
*
|
||||||
* The TMC26XStepper library is required for TMC26X stepper drivers.
|
|
||||||
* https://github.com/MarlinFirmware/TMC26XStepper
|
|
||||||
*
|
|
||||||
* The TMCStepper library is required for other TMC stepper drivers.
|
* The TMCStepper library is required for other TMC stepper drivers.
|
||||||
* https://github.com/teemuatlut/TMCStepper
|
* https://github.com/teemuatlut/TMCStepper
|
||||||
*
|
*
|
||||||
* @section tmc/config
|
* @section tmc/config
|
||||||
*/
|
*/
|
||||||
#if HAS_TRINAMIC_CONFIG || HAS_TMC26X
|
#if HAS_TRINAMIC_CONFIG
|
||||||
|
|
||||||
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
|
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
|
||||||
|
|
||||||
@@ -2972,7 +2971,7 @@
|
|||||||
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
|
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
|
||||||
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
|
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
|
||||||
#define X_MICROSTEPS 16 // 0..256
|
#define X_MICROSTEPS 16 // 0..256
|
||||||
#define X_RSENSE 0.11 // Multiplied x1000 for TMC26X
|
#define X_RSENSE 0.11
|
||||||
#define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
|
#define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
|
||||||
//#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis
|
//#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis
|
||||||
//#define X_HOLD_MULTIPLIER 0.5 // Enable to override 'HOLD_MULTIPLIER' for the X axis
|
//#define X_HOLD_MULTIPLIER 0.5 // Enable to override 'HOLD_MULTIPLIER' for the X axis
|
||||||
@@ -3465,7 +3464,7 @@
|
|||||||
*/
|
*/
|
||||||
#define TMC_ADV() { }
|
#define TMC_ADV() { }
|
||||||
|
|
||||||
#endif // HAS_TRINAMIC_CONFIG || HAS_TMC26X
|
#endif // HAS_TRINAMIC_CONFIG
|
||||||
|
|
||||||
// @section i2cbus
|
// @section i2cbus
|
||||||
|
|
||||||
@@ -3558,7 +3557,7 @@
|
|||||||
* Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and
|
* Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and
|
||||||
* to set spindle speed, spindle direction, and laser power.
|
* to set spindle speed, spindle direction, and laser power.
|
||||||
*
|
*
|
||||||
* SuperPid is a router/spindle speed controller used in the CNC milling community.
|
* SuperPID is a router/spindle speed controller used in the CNC milling community.
|
||||||
* Marlin can be used to turn the spindle on and off. It can also be used to set
|
* Marlin can be used to turn the spindle on and off. It can also be used to set
|
||||||
* the spindle speed from 5,000 to 30,000 RPM.
|
* the spindle speed from 5,000 to 30,000 RPM.
|
||||||
*
|
*
|
||||||
@@ -4261,7 +4260,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Instant freeze / unfreeze functionality
|
* Instant freeze / unfreeze functionality
|
||||||
* Potentially useful for emergency stop that allows being resumed.
|
* Potentially useful for rapid stop that allows being resumed. Halts stepper movement.
|
||||||
|
* Note this does NOT pause spindles, lasers, fans, heaters or any other auxiliary device.
|
||||||
* @section interface
|
* @section interface
|
||||||
*/
|
*/
|
||||||
//#define FREEZE_FEATURE
|
//#define FREEZE_FEATURE
|
||||||
@@ -4308,6 +4308,7 @@
|
|||||||
// See class CodeProfiler.
|
// See class CodeProfiler.
|
||||||
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row.
|
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row.
|
||||||
//#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed.
|
//#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed.
|
||||||
|
//#define MAX7219_REINIT_ON_POWERUP // Re-initialize MAX7129 when power supply turns on
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4341,7 +4342,7 @@
|
|||||||
* Extras for an ESP32-based motherboard with WIFISUPPORT
|
* Extras for an ESP32-based motherboard with WIFISUPPORT
|
||||||
* These options don't apply to add-on WiFi modules based on ESP32 WiFi101.
|
* These options don't apply to add-on WiFi modules based on ESP32 WiFi101.
|
||||||
*/
|
*/
|
||||||
#if ENABLED(WIFISUPPORT)
|
#if ANY(WIFISUPPORT, ESP3D_WIFISUPPORT)
|
||||||
//#define WEBSUPPORT // Start a webserver (which may include auto-discovery) using SPIFFS
|
//#define WEBSUPPORT // Start a webserver (which may include auto-discovery) using SPIFFS
|
||||||
//#define OTASUPPORT // Support over-the-air firmware updates
|
//#define OTASUPPORT // Support over-the-air firmware updates
|
||||||
//#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host
|
//#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host
|
||||||
@@ -4524,3 +4525,6 @@
|
|||||||
|
|
||||||
// Report uncleaned reset reason from register r2 instead of MCUSR. Supported by Optiboot on AVR.
|
// Report uncleaned reset reason from register r2 instead of MCUSR. Supported by Optiboot on AVR.
|
||||||
//#define OPTIBOOT_RESET_REASON
|
//#define OPTIBOOT_RESET_REASON
|
||||||
|
|
||||||
|
// Shrink the build for smaller boards by sacrificing some serial feedback
|
||||||
|
//#define MARLIN_SMALL_BUILD
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Marlin Firmware
|
Marlin Firmware
|
||||||
|
|
||||||
(c) 2011-2023 MarlinFirmware
|
(c) 2011-2024 MarlinFirmware
|
||||||
Portions of Marlin are (c) by their respective authors.
|
Portions of Marlin are (c) by their respective authors.
|
||||||
All code complies with GPLv2 and/or GPLv3
|
All code complies with GPLv2 and/or GPLv3
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@
|
|||||||
* here we define this default string as the date where the latest release
|
* here we define this default string as the date where the latest release
|
||||||
* version was tagged.
|
* version was tagged.
|
||||||
*/
|
*/
|
||||||
//#define STRING_DISTRIBUTION_DATE "2024-01-09"
|
//#define STRING_DISTRIBUTION_DATE "2024-05-29"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||||
|
|||||||
@@ -81,6 +81,12 @@ void MarlinHAL::init() {
|
|||||||
#if HAS_SERVO_3
|
#if HAS_SERVO_3
|
||||||
OUT_WRITE(SERVO3_PIN, LOW);
|
OUT_WRITE(SERVO3_PIN, LOW);
|
||||||
#endif
|
#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
|
init_pwm_timers(); // Init user timers to default frequency - 1000HZ
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ typedef Servo hal_servo_t;
|
|||||||
#error "LCD_SERIAL_PORT must be from 0 to 3."
|
#error "LCD_SERIAL_PORT must be from 0 to 3."
|
||||||
#endif
|
#endif
|
||||||
#define LCD_SERIAL lcdSerial
|
#define LCD_SERIAL lcdSerial
|
||||||
#if HAS_DGUS_LCD
|
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ void spiBegin() {
|
|||||||
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** begin spi transaction */
|
/** begin spi transaction */
|
||||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
||||||
// Based on Arduino SPI library
|
// Based on Arduino SPI library
|
||||||
@@ -175,7 +174,6 @@ void spiBegin() {
|
|||||||
SPSR = clockDiv | 0x01;
|
SPSR = clockDiv | 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#else // SOFTWARE_SPI || FORCE_SOFT_SPI
|
#else // SOFTWARE_SPI || FORCE_SOFT_SPI
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
|
|||||||
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
|
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
|
||||||
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
|
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
|
||||||
|
|
||||||
#if HAS_DGUS_LCD
|
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
||||||
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
||||||
|
|||||||
@@ -205,7 +205,7 @@
|
|||||||
static ring_buffer_pos_t available();
|
static ring_buffer_pos_t available();
|
||||||
static void write(const uint8_t c);
|
static void write(const uint8_t c);
|
||||||
static void flushTX();
|
static void flushTX();
|
||||||
#if HAS_DGUS_LCD
|
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||||
static ring_buffer_pos_t get_tx_buffer_free();
|
static ring_buffer_pos_t get_tx_buffer_free();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@
|
|||||||
|
|
||||||
static volatile int8_t Channel[_Nbr_16timers]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
|
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 functions common to all instances ***********************/
|
||||||
|
|
||||||
static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) {
|
static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) {
|
||||||
|
|||||||
@@ -35,14 +35,14 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
bool PersistentStore::access_start() { return true; }
|
bool PersistentStore::access_start() { return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t * const p = (uint8_t * const)pos;
|
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
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);
|
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*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ void endstop_ISR() { endstops.update(); }
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Install Pin change interrupt for a pin. Can be called multiple times.
|
// Install Pin change interrupt for a pin. Can be called multiple times.
|
||||||
void pciSetup(const int8_t pin) {
|
void pciSetup(const int8_t pin) {
|
||||||
if (digitalPinHasPCICR(pin)) {
|
if (digitalPinHasPCICR(pin)) {
|
||||||
|
|||||||
@@ -679,7 +679,6 @@
|
|||||||
#define PF7_PWM 0
|
#define PF7_PWM 0
|
||||||
#define PF7_DDR DDRF
|
#define PF7_DDR DDRF
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some of the pin mapping functions of the Teensduino extension to the Arduino IDE
|
* Some of the pin mapping functions of the Teensduino extension to the Arduino IDE
|
||||||
* do not function the same as the other Arduino extensions.
|
* do not function the same as the other Arduino extensions.
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -163,7 +163,6 @@ bool pwm_status(uint8_t pin) {
|
|||||||
SERIAL_ECHO_SP(2);
|
SERIAL_ECHO_SP(2);
|
||||||
} // pwm_status
|
} // pwm_status
|
||||||
|
|
||||||
|
|
||||||
const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
||||||
{ &TCCR0A, &TCCR0B, &TIMSK0 },
|
{ &TCCR0A, &TCCR0B, &TIMSK0 },
|
||||||
{ &TCCR1A, &TCCR1B, &TIMSK1 },
|
{ &TCCR1A, &TCCR1B, &TIMSK1 },
|
||||||
@@ -181,7 +180,6 @@ const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
||||||
|
|
||||||
#ifdef TIMER0A
|
#ifdef TIMER0A
|
||||||
@@ -217,7 +215,6 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define TCCR_A(T) pgm_read_word(&PWM_other[T][0])
|
#define TCCR_A(T) pgm_read_word(&PWM_other[T][0])
|
||||||
#define TCCR_B(T) pgm_read_word(&PWM_other[T][1])
|
#define TCCR_B(T) pgm_read_word(&PWM_other[T][1])
|
||||||
#define TIMSK(T) pgm_read_word(&PWM_other[T][2])
|
#define TIMSK(T) pgm_read_word(&PWM_other[T][2])
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) {
|
|||||||
U8G_ATOMIC_END();
|
U8G_ATOMIC_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if ENABLED(FYSETC_MINI_12864)
|
#if ENABLED(FYSETC_MINI_12864)
|
||||||
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
|
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
// Public functions
|
// Public functions
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#if ANY(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI)
|
#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI)
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Software SPI
|
// Software SPI
|
||||||
|
|||||||
@@ -474,7 +474,6 @@ void MarlinSerial<Cfg>::flushTX() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If not using the USB port as serial port
|
// If not using the USB port as serial port
|
||||||
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
|
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
|
||||||
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
|
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
|
||||||
|
|||||||
@@ -958,14 +958,14 @@ static void ee_Init() {
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
bool PersistentStore::access_start() { ee_Init(); return true; }
|
bool PersistentStore::access_start() { ee_Init(); return true; }
|
||||||
bool PersistentStore::access_finish() { ee_Flush(); 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) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t * const p = (uint8_t * const)pos;
|
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
||||||
uint8_t v = *value;
|
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!
|
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);
|
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*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = ee_Read(uint32_t(pos));
|
uint8_t c = ee_Read(uint32_t(REAL_EEPROM_ADDR(pos)));
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -36,14 +36,14 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t * const p = (uint8_t * const)pos;
|
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
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);
|
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*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
#else
|
#else
|
||||||
#define G2_PWM_Z 0
|
#define G2_PWM_Z 0
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
#if HAS_MOTOR_CURRENT_PWM_E
|
||||||
#define G2_PWM_E 1
|
#define G2_PWM_E 1
|
||||||
#else
|
#else
|
||||||
#define G2_PWM_E 0
|
#define G2_PWM_E 0
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ 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_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'), \
|
#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_Y_PIN, 'B'), \
|
||||||
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Z_PIN, 'B'), \
|
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Z_PIN, 'B'), \
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ 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_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
|
{ 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
|
// 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
|
{ PIOA, PIO_PA16X1_AD7, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NOT_ON_PWM, NOT_ON_TIMER }, // AD0
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -72,10 +72,10 @@
|
|||||||
|
|
||||||
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
|
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
|
||||||
#if ENABLED(TMC_USE_SW_SPI)
|
#if ENABLED(TMC_USE_SW_SPI)
|
||||||
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
|
#if DISABLED(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."
|
#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
|
#endif
|
||||||
#elif ENABLED(DUE_SOFTWARE_SPI)
|
#elif ENABLED(SOFTWARE_SPI)
|
||||||
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#define SD_MOSI_PIN 75
|
#define SD_MOSI_PIN 75
|
||||||
#else
|
#else
|
||||||
// defaults
|
// defaults
|
||||||
#define DUE_SOFTWARE_SPI
|
#define SOFTWARE_SPI
|
||||||
#ifndef SD_SCK_PIN
|
#ifndef SD_SCK_PIN
|
||||||
#define SD_SCK_PIN 52
|
#define SD_SCK_PIN 52
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -142,7 +142,6 @@
|
|||||||
*/
|
*/
|
||||||
#define COMPILER_PACK_RESET() COMPILER_PRAGMA(pack())
|
#define COMPILER_PACK_RESET() COMPILER_PRAGMA(pack())
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set aligned boundary.
|
* \brief Set aligned boundary.
|
||||||
*/
|
*/
|
||||||
@@ -283,7 +282,6 @@ typedef double F64; //!< 64-bit floating-point number.
|
|||||||
typedef uint32_t iram_size_t;
|
typedef uint32_t iram_size_t;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Status Types
|
/*! \name Status Types
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -291,7 +289,6 @@ typedef bool Status_bool_t; //!< Boolean status.
|
|||||||
typedef U8 Status_t; //!< 8-bit-coded status.
|
typedef U8 Status_t; //!< 8-bit-coded status.
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Aliasing Aggregate Types
|
/*! \name Aliasing Aggregate Types
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -462,7 +459,6 @@ typedef struct
|
|||||||
#endif
|
#endif
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__ // not for assembling.
|
#ifndef __ASSEMBLY__ // not for assembling.
|
||||||
|
|
||||||
//! \name Optimization Control
|
//! \name Optimization Control
|
||||||
@@ -581,7 +577,6 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Zero-Bit Counting
|
/*! \name Zero-Bit Counting
|
||||||
*
|
*
|
||||||
* Under GCC, __builtin_clz and __builtin_ctz behave like macros when
|
* Under GCC, __builtin_clz and __builtin_ctz behave like macros when
|
||||||
@@ -692,7 +687,6 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Bit Reversing
|
/*! \name Bit Reversing
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -732,7 +726,6 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Alignment
|
/*! \name Alignment
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -798,7 +791,6 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
#define Long_call(addr) ((*(void (*)(void))(addr))())
|
#define Long_call(addr) ((*(void (*)(void))(addr))())
|
||||||
|
|
||||||
|
|
||||||
/*! \name MCU Endianism Handling
|
/*! \name MCU Endianism Handling
|
||||||
* ARM is MCU little endianism.
|
* ARM is MCU little endianism.
|
||||||
*/
|
*/
|
||||||
@@ -868,7 +860,6 @@ typedef struct
|
|||||||
#define CPU_TO_BE32(x) swap32(x)
|
#define CPU_TO_BE32(x) swap32(x)
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Endianism Conversion
|
/*! \name Endianism Conversion
|
||||||
*
|
*
|
||||||
* The same considerations as for clz and ctz apply here but GCC's
|
* The same considerations as for clz and ctz apply here but GCC's
|
||||||
@@ -955,7 +946,6 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Target Abstraction
|
/*! \name Target Abstraction
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -997,7 +987,6 @@ typedef U8 Byte; //!< 8-bit unsigned integer.
|
|||||||
|
|
||||||
#endif // #ifndef __ASSEMBLY__
|
#endif // #ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
|
||||||
#ifdef __ICCARM__
|
#ifdef __ICCARM__
|
||||||
#define SHORTENUM __packed
|
#define SHORTENUM __packed
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|||||||
@@ -81,7 +81,6 @@
|
|||||||
#define LUN_0_NAME "\"SD/MMC Card\""
|
#define LUN_0_NAME "\"SD/MMC Card\""
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Actions Associated with Memory Accesses
|
/*! \name Actions Associated with Memory Accesses
|
||||||
*
|
*
|
||||||
* Write here the action to associate with each memory access.
|
* Write here the action to associate with each memory access.
|
||||||
@@ -112,5 +111,4 @@
|
|||||||
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
|
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#endif // _CONF_ACCESS_H_
|
#endif // _CONF_ACCESS_H_
|
||||||
|
|||||||
@@ -96,5 +96,4 @@
|
|||||||
// - UPLL frequency: 480MHz
|
// - UPLL frequency: 480MHz
|
||||||
// - USB clock: 480 / 1 = 480MHz
|
// - USB clock: 480 / 1 = 480MHz
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONF_CLOCK_H_INCLUDED */
|
#endif /* CONF_CLOCK_H_INCLUDED */
|
||||||
|
|||||||
@@ -88,7 +88,6 @@
|
|||||||
#endif
|
#endif
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* USB Device Callbacks definitions (Optional)
|
* USB Device Callbacks definitions (Optional)
|
||||||
* @{
|
* @{
|
||||||
@@ -150,7 +149,6 @@
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* USB Interface Configuration
|
* USB Interface Configuration
|
||||||
* @{
|
* @{
|
||||||
@@ -210,7 +208,6 @@
|
|||||||
//@}
|
//@}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration of MSC interface
|
* Configuration of MSC interface
|
||||||
* @{
|
* @{
|
||||||
@@ -245,7 +242,6 @@
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of Composite Device
|
* Description of Composite Device
|
||||||
* @{
|
* @{
|
||||||
|
|||||||
@@ -68,7 +68,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "ctrl_access.h"
|
#include "ctrl_access.h"
|
||||||
|
|
||||||
|
|
||||||
//_____ D E F I N I T I O N S ______________________________________________
|
//_____ D E F I N I T I O N S ______________________________________________
|
||||||
|
|
||||||
#ifdef FREERTOS_USED
|
#ifdef FREERTOS_USED
|
||||||
@@ -112,7 +111,6 @@ static xSemaphoreHandle ctrl_access_semphr = NULL;
|
|||||||
|
|
||||||
#endif // FREERTOS_USED
|
#endif // FREERTOS_USED
|
||||||
|
|
||||||
|
|
||||||
#if MAX_LUN
|
#if MAX_LUN
|
||||||
|
|
||||||
/*! \brief Initializes an entry of the LUN descriptor table.
|
/*! \brief Initializes an entry of the LUN descriptor table.
|
||||||
@@ -242,17 +240,14 @@ static const struct
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if GLOBAL_WR_PROTECT == true
|
#if GLOBAL_WR_PROTECT == true
|
||||||
bool g_wr_protect;
|
bool g_wr_protect;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*! \name Control Interface
|
/*! \name Control Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
#ifdef FREERTOS_USED
|
#ifdef FREERTOS_USED
|
||||||
|
|
||||||
bool ctrl_access_init(void)
|
bool ctrl_access_init(void)
|
||||||
@@ -270,7 +265,6 @@ bool ctrl_access_init(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Locks accesses to LUNs.
|
/*! \brief Locks accesses to LUNs.
|
||||||
*
|
*
|
||||||
* \return \c true if the access was successfully locked, else \c false.
|
* \return \c true if the access was successfully locked, else \c false.
|
||||||
@@ -288,7 +282,6 @@ static bool ctrl_access_lock(void)
|
|||||||
|
|
||||||
#endif // FREERTOS_USED
|
#endif // FREERTOS_USED
|
||||||
|
|
||||||
|
|
||||||
U8 get_nb_lun(void)
|
U8 get_nb_lun(void)
|
||||||
{
|
{
|
||||||
#if MEM_USB == ENABLE
|
#if MEM_USB == ENABLE
|
||||||
@@ -309,13 +302,11 @@ U8 get_nb_lun(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
U8 get_cur_lun(void)
|
U8 get_cur_lun(void)
|
||||||
{
|
{
|
||||||
return LUN_ID_0;
|
return LUN_ID_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status mem_test_unit_ready(U8 lun)
|
Ctrl_status mem_test_unit_ready(U8 lun)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -337,7 +328,6 @@ Ctrl_status mem_test_unit_ready(U8 lun)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
|
Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -359,7 +349,6 @@ Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
U8 mem_sector_size(U8 lun)
|
U8 mem_sector_size(U8 lun)
|
||||||
{
|
{
|
||||||
U8 sector_size;
|
U8 sector_size;
|
||||||
@@ -381,7 +370,6 @@ U8 mem_sector_size(U8 lun)
|
|||||||
return sector_size;
|
return sector_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool mem_unload(U8 lun, bool unload)
|
bool mem_unload(U8 lun, bool unload)
|
||||||
{
|
{
|
||||||
bool unloaded;
|
bool unloaded;
|
||||||
@@ -433,7 +421,6 @@ bool mem_wr_protect(U8 lun)
|
|||||||
return wr_protect;
|
return wr_protect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool mem_removal(U8 lun)
|
bool mem_removal(U8 lun)
|
||||||
{
|
{
|
||||||
bool removal;
|
bool removal;
|
||||||
@@ -458,7 +445,6 @@ bool mem_removal(U8 lun)
|
|||||||
return removal;
|
return removal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *mem_name(U8 lun)
|
const char *mem_name(U8 lun)
|
||||||
{
|
{
|
||||||
#if MAX_LUN==0
|
#if MAX_LUN==0
|
||||||
@@ -475,17 +461,14 @@ const char *mem_name(U8 lun)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_USB == true
|
#if ACCESS_USB == true
|
||||||
|
|
||||||
/*! \name MEM <-> USB Interface
|
/*! \name MEM <-> USB Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
|
Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -505,7 +488,6 @@ Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
|
Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -525,19 +507,16 @@ Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
#endif // ACCESS_USB == true
|
#endif // ACCESS_USB == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_MEM_TO_RAM == true
|
#if ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
/*! \name MEM <-> RAM Interface
|
/*! \name MEM <-> RAM Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
|
Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -564,7 +543,6 @@ Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
|
Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -591,19 +569,16 @@ Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
#endif // ACCESS_MEM_TO_RAM == true
|
#endif // ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_STREAM == true
|
#if ACCESS_STREAM == true
|
||||||
|
|
||||||
/*! \name Streaming MEM <-> MEM Interface
|
/*! \name Streaming MEM <-> MEM Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_MEM_TO_MEM == true
|
#if ACCESS_MEM_TO_MEM == true
|
||||||
|
|
||||||
#include "fat.h"
|
#include "fat.h"
|
||||||
@@ -625,21 +600,18 @@ Ctrl_status stream_mem_to_mem(U8 src_lun, U32 src_addr, U8 dest_lun, U32 dest_ad
|
|||||||
|
|
||||||
#endif // ACCESS_MEM_TO_MEM == true
|
#endif // ACCESS_MEM_TO_MEM == true
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status stream_state(U8 id)
|
Ctrl_status stream_state(U8 id)
|
||||||
{
|
{
|
||||||
UNUSED(id);
|
UNUSED(id);
|
||||||
return CTRL_GOOD;
|
return CTRL_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
U16 stream_stop(U8 id)
|
U16 stream_stop(U8 id)
|
||||||
{
|
{
|
||||||
UNUSED(id);
|
UNUSED(id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
#endif // ACCESS_STREAM
|
#endif // ACCESS_STREAM
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _CTRL_ACCESS_H_
|
#ifndef _CTRL_ACCESS_H_
|
||||||
#define _CTRL_ACCESS_H_
|
#define _CTRL_ACCESS_H_
|
||||||
|
|
||||||
@@ -89,7 +88,6 @@ typedef enum
|
|||||||
CTRL_BUSY = FAIL + 2 //!< Memory not initialized or changed.
|
CTRL_BUSY = FAIL + 2 //!< Memory not initialized or changed.
|
||||||
} Ctrl_status;
|
} Ctrl_status;
|
||||||
|
|
||||||
|
|
||||||
// FYI: Each Logical Unit Number (LUN) corresponds to a memory.
|
// FYI: Each Logical Unit Number (LUN) corresponds to a memory.
|
||||||
|
|
||||||
// Check LUN defines.
|
// Check LUN defines.
|
||||||
@@ -136,7 +134,6 @@ typedef enum
|
|||||||
#define LUN_ID_USB (MAX_LUN) //!< First dynamic LUN (USB host mass storage).
|
#define LUN_ID_USB (MAX_LUN) //!< First dynamic LUN (USB host mass storage).
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
// Include LUN header files.
|
// Include LUN header files.
|
||||||
#if LUN_0 == ENABLE
|
#if LUN_0 == ENABLE
|
||||||
#include LUN_0_INCLUDE
|
#include LUN_0_INCLUDE
|
||||||
@@ -166,13 +163,11 @@ typedef enum
|
|||||||
#include LUN_USB_INCLUDE
|
#include LUN_USB_INCLUDE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Check the configuration of write protection in conf_access.h.
|
// Check the configuration of write protection in conf_access.h.
|
||||||
#ifndef GLOBAL_WR_PROTECT
|
#ifndef GLOBAL_WR_PROTECT
|
||||||
#error GLOBAL_WR_PROTECT must be defined as true or false in conf_access.h
|
#error GLOBAL_WR_PROTECT must be defined as true or false in conf_access.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if GLOBAL_WR_PROTECT == true
|
#if GLOBAL_WR_PROTECT == true
|
||||||
|
|
||||||
//! Write protect.
|
//! Write protect.
|
||||||
@@ -180,7 +175,6 @@ extern bool g_wr_protect;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*! \name Control Interface
|
/*! \name Control Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -279,7 +273,6 @@ extern const char *mem_name(U8 lun);
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_USB == true
|
#if ACCESS_USB == true
|
||||||
|
|
||||||
/*! \name MEM <-> USB Interface
|
/*! \name MEM <-> USB Interface
|
||||||
@@ -310,7 +303,6 @@ extern Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector);
|
|||||||
|
|
||||||
#endif // ACCESS_USB == true
|
#endif // ACCESS_USB == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_MEM_TO_RAM == true
|
#if ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
/*! \name MEM <-> RAM Interface
|
/*! \name MEM <-> RAM Interface
|
||||||
@@ -341,7 +333,6 @@ extern Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram);
|
|||||||
|
|
||||||
#endif // ACCESS_MEM_TO_RAM == true
|
#endif // ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_STREAM == true
|
#if ACCESS_STREAM == true
|
||||||
|
|
||||||
/*! \name Streaming MEM <-> MEM Interface
|
/*! \name Streaming MEM <-> MEM Interface
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
|
|
||||||
#include "preprocessor.h"
|
#include "preprocessor.h"
|
||||||
|
|
||||||
|
|
||||||
//! Maximal number of repetitions supported by MREPEAT.
|
//! Maximal number of repetitions supported by MREPEAT.
|
||||||
#define MREPEAT_LIMIT 256
|
#define MREPEAT_LIMIT 256
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ static inline void osc_enable(uint32_t ul_id) {
|
|||||||
pmc_switch_sclk_to_32kxtal(PMC_OSC_BYPASS);
|
pmc_switch_sclk_to_32kxtal(PMC_OSC_BYPASS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case OSC_MAINCK_4M_RC:
|
case OSC_MAINCK_4M_RC:
|
||||||
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz);
|
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz);
|
||||||
break;
|
break;
|
||||||
@@ -141,7 +140,6 @@ static inline void osc_enable(uint32_t ul_id) {
|
|||||||
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz);
|
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case OSC_MAINCK_XTAL:
|
case OSC_MAINCK_XTAL:
|
||||||
pmc_switch_mainck_to_xtal(PMC_OSC_XTAL/*,
|
pmc_switch_mainck_to_xtal(PMC_OSC_XTAL/*,
|
||||||
pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US,
|
pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US,
|
||||||
|
|||||||
@@ -51,5 +51,4 @@
|
|||||||
#include "stringz.h"
|
#include "stringz.h"
|
||||||
#include "mrepeat.h"
|
#include "mrepeat.h"
|
||||||
|
|
||||||
|
|
||||||
#endif // _PREPROCESSOR_H_
|
#endif // _PREPROCESSOR_H_
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ enum scsi_sbc_mode {
|
|||||||
SCSI_MS_MODE_CACHING = 0x08, //!< Caching mode page
|
SCSI_MS_MODE_CACHING = 0x08, //!< Caching mode page
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//! \name SBC-2 Device-Specific Parameter
|
//! \name SBC-2 Device-Specific Parameter
|
||||||
//@{
|
//@{
|
||||||
#define SCSI_MS_SBC_WP 0x80 //!< Write Protected
|
#define SCSI_MS_SBC_WP 0x80 //!< Write Protected
|
||||||
|
|||||||
@@ -18,30 +18,30 @@ extern "C" {
|
|||||||
void sd_mmc_spi_mem_init() {
|
void sd_mmc_spi_mem_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ctrl_status sd_mmc_spi_test_unit_ready() {
|
inline bool media_ready() {
|
||||||
#ifdef DISABLE_DUE_SD_MMC
|
return IS_SD_INSERTED() && !IS_SD_PRINTING() && !IS_SD_FILE_OPEN() && card.isMounted();
|
||||||
return CTRL_NO_PRESENT;
|
|
||||||
#endif
|
|
||||||
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 (!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_unload(bool) { return true; }
|
||||||
|
|
||||||
bool sd_mmc_spi_wr_protect() { return false; }
|
bool sd_mmc_spi_wr_protect() { return false; }
|
||||||
|
|
||||||
bool sd_mmc_spi_removal() {
|
bool sd_mmc_spi_removal() { return !media_ready(); }
|
||||||
return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted());
|
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
*nb_sector = card.diskIODriver()->cardSize() - 1;
|
||||||
|
return CTRL_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ACCESS_USB == true
|
#if ACCESS_USB == true
|
||||||
@@ -61,8 +61,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
|||||||
#ifdef DISABLE_DUE_SD_MMC
|
#ifdef DISABLE_DUE_SD_MMC
|
||||||
return CTRL_NO_PRESENT;
|
return CTRL_NO_PRESENT;
|
||||||
#endif
|
#endif
|
||||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
if (!media_ready()) return CTRL_NO_PRESENT;
|
||||||
return CTRL_NO_PRESENT;
|
|
||||||
|
|
||||||
#ifdef DEBUG_MMC
|
#ifdef DEBUG_MMC
|
||||||
{
|
{
|
||||||
@@ -101,8 +100,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
|||||||
#ifdef DISABLE_DUE_SD_MMC
|
#ifdef DISABLE_DUE_SD_MMC
|
||||||
return CTRL_NO_PRESENT;
|
return CTRL_NO_PRESENT;
|
||||||
#endif
|
#endif
|
||||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
if (!media_ready()) return CTRL_NO_PRESENT;
|
||||||
return CTRL_NO_PRESENT;
|
|
||||||
|
|
||||||
#ifdef DEBUG_MMC
|
#ifdef DEBUG_MMC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _SD_MMC_SPI_MEM_H_
|
#ifndef _SD_MMC_SPI_MEM_H_
|
||||||
#define _SD_MMC_SPI_MEM_H_
|
#define _SD_MMC_SPI_MEM_H_
|
||||||
|
|
||||||
@@ -63,22 +62,19 @@
|
|||||||
#error sd_mmc_spi_mem.h is #included although SD_MMC_SPI_MEM is disabled
|
#error sd_mmc_spi_mem.h is #included although SD_MMC_SPI_MEM is disabled
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "ctrl_access.h"
|
#include "ctrl_access.h"
|
||||||
|
|
||||||
|
|
||||||
//_____ D E F I N I T I O N S ______________________________________________
|
//_____ D E F I N I T I O N S ______________________________________________
|
||||||
|
|
||||||
#define SD_MMC_REMOVED 0
|
#define SD_MMC_REMOVED 0
|
||||||
#define SD_MMC_INSERTED 1
|
#define SD_MMC_INSERTED 1
|
||||||
#define SD_MMC_REMOVING 2
|
#define SD_MMC_REMOVING 2
|
||||||
|
|
||||||
|
|
||||||
//---- CONTROL FUNCTIONS ----
|
//---- CONTROL FUNCTIONS ----
|
||||||
//!
|
//!
|
||||||
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
|
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
|
||||||
//!/
|
//!/
|
||||||
extern void sd_mmc_spi_mem_init(void);
|
void sd_mmc_spi_mem_init();
|
||||||
|
|
||||||
//!
|
//!
|
||||||
//! @brief This function tests the state of the SD_MMC memory and sends it to the Host.
|
//! @brief This function tests the state of the SD_MMC memory and sends it to the Host.
|
||||||
@@ -91,7 +87,7 @@ extern void sd_mmc_spi_mem_init(void);
|
|||||||
//! Media not present -> CTRL_NO_PRESENT
|
//! Media not present -> CTRL_NO_PRESENT
|
||||||
//! Media has changed -> CTRL_BUSY
|
//! Media has changed -> CTRL_BUSY
|
||||||
//!/
|
//!/
|
||||||
extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
|
Ctrl_status sd_mmc_spi_test_unit_ready();
|
||||||
|
|
||||||
//!
|
//!
|
||||||
//! @brief This function gives the address of the last valid sector.
|
//! @brief This function gives the address of the last valid sector.
|
||||||
@@ -102,7 +98,7 @@ extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
|
|||||||
//! Media ready -> CTRL_GOOD
|
//! Media ready -> CTRL_GOOD
|
||||||
//! Media not present -> CTRL_NO_PRESENT
|
//! Media not present -> CTRL_NO_PRESENT
|
||||||
//!/
|
//!/
|
||||||
extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
|
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
|
||||||
|
|
||||||
/*! \brief Unload/Load the SD/MMC card selected
|
/*! \brief Unload/Load the SD/MMC card selected
|
||||||
*
|
*
|
||||||
@@ -113,7 +109,7 @@ extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
|
|||||||
*
|
*
|
||||||
* \return \c true if unload/load done success.
|
* \return \c true if unload/load done success.
|
||||||
*/
|
*/
|
||||||
extern bool sd_mmc_spi_unload(bool unload);
|
bool sd_mmc_spi_unload(bool unload);
|
||||||
|
|
||||||
//!
|
//!
|
||||||
//! @brief This function returns the write protected status of the memory.
|
//! @brief This function returns the write protected status of the memory.
|
||||||
@@ -124,15 +120,14 @@ extern bool sd_mmc_spi_unload(bool unload);
|
|||||||
//!
|
//!
|
||||||
//! @return false -> the memory is not write-protected (always)
|
//! @return false -> the memory is not write-protected (always)
|
||||||
//!/
|
//!/
|
||||||
extern bool sd_mmc_spi_wr_protect(void);
|
bool sd_mmc_spi_wr_protect();
|
||||||
|
|
||||||
//!
|
//!
|
||||||
//! @brief This function tells if the memory has been removed or not.
|
//! @brief This function tells if the memory has been removed or not.
|
||||||
//!
|
//!
|
||||||
//! @return false -> The memory isn't removed
|
//! @return false -> The memory isn't removed
|
||||||
//!
|
//!
|
||||||
extern bool sd_mmc_spi_removal(void);
|
bool sd_mmc_spi_removal();
|
||||||
|
|
||||||
|
|
||||||
//---- ACCESS DATA FUNCTIONS ----
|
//---- ACCESS DATA FUNCTIONS ----
|
||||||
|
|
||||||
@@ -152,7 +147,7 @@ extern bool sd_mmc_spi_removal(void);
|
|||||||
//! It is ready -> CTRL_GOOD
|
//! It is ready -> CTRL_GOOD
|
||||||
//! A error occur -> CTRL_FAIL
|
//! A error occur -> CTRL_FAIL
|
||||||
//!
|
//!
|
||||||
extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
|
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
|
//! This function initializes the SD/MMC memory for a write operation
|
||||||
//!
|
//!
|
||||||
@@ -166,7 +161,7 @@ extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
|
|||||||
//! It is ready -> CTRL_GOOD
|
//! It is ready -> CTRL_GOOD
|
||||||
//! An error occurs -> CTRL_FAIL
|
//! An error occurs -> CTRL_FAIL
|
||||||
//!
|
//!
|
||||||
extern Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector);
|
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector);
|
||||||
|
|
||||||
#endif // #if ACCESS_USB == true
|
#endif // #if ACCESS_USB == true
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ extern "C" {
|
|||||||
#define CONFIG_USBCLK_DIV
|
#define CONFIG_USBCLK_DIV
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern void sysclk_enable_usb(void);
|
extern void sysclk_enable_usb(void);
|
||||||
extern void sysclk_disable_usb(void);
|
extern void sysclk_disable_usb(void);
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ static usb_iface_desc_t UDC_DESC_STORAGE *udc_ptr_iface;
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! \name Internal structure to store the USB device main strings
|
//! \name Internal structure to store the USB device main strings
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|||||||
@@ -685,6 +685,4 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void);
|
|||||||
} \endcode
|
} \endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _UDC_H_
|
#endif // _UDC_H_
|
||||||
|
|||||||
@@ -213,7 +213,6 @@ void udd_send_remotewakeup(void);
|
|||||||
*/
|
*/
|
||||||
void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size );
|
void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Endpoint Management
|
* \name Endpoint Management
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -457,7 +457,6 @@ void udi_cdc_data_sof_notify(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//------- Internal routines to control serial line
|
//------- Internal routines to control serial line
|
||||||
|
|
||||||
@@ -520,7 +519,6 @@ 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);
|
udi_cdc_ctrl_state_notify(port, ep_comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_ctrl_state_notify(uint8_t port, udd_ep_id_t ep)
|
static void udi_cdc_ctrl_state_notify(uint8_t port, udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
#if UDI_CDC_PORT_NB == 1 // To optimize code
|
#if UDI_CDC_PORT_NB == 1 // To optimize code
|
||||||
@@ -542,7 +540,6 @@ 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)
|
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;
|
uint8_t port;
|
||||||
@@ -578,11 +575,9 @@ static void udi_cdc_serial_state_msg_sent(udd_ep_status_t status, iram_size_t n,
|
|||||||
udi_cdc_ctrl_state_notify(port, ep);
|
udi_cdc_ctrl_state_notify(port, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//------- Internal routines to process data transfer
|
//------- Internal routines to process data transfer
|
||||||
|
|
||||||
|
|
||||||
static bool udi_cdc_rx_start(uint8_t port)
|
static bool udi_cdc_rx_start(uint8_t port)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -632,7 +627,6 @@ static bool udi_cdc_rx_start(uint8_t port)
|
|||||||
udi_cdc_data_received);
|
udi_cdc_data_received);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_data_received(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
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;
|
uint8_t buf_sel_trans;
|
||||||
@@ -668,7 +662,6 @@ static void udi_cdc_data_received(udd_ep_status_t status, iram_size_t n, udd_ep_
|
|||||||
udi_cdc_rx_start(port);
|
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)
|
static void udi_cdc_data_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t port;
|
uint8_t port;
|
||||||
@@ -700,7 +693,6 @@ static void udi_cdc_data_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t
|
|||||||
udi_cdc_tx_send(port);
|
udi_cdc_tx_send(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_tx_send(uint8_t port)
|
static void udi_cdc_tx_send(uint8_t port)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -780,11 +772,9 @@ static void udi_cdc_tx_send(uint8_t port)
|
|||||||
udi_cdc_data_sent);
|
udi_cdc_data_sent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//------- Application interface
|
//------- Application interface
|
||||||
|
|
||||||
|
|
||||||
//------- Application interface
|
//------- Application interface
|
||||||
|
|
||||||
void udi_cdc_ctrl_signal_dcd(bool b_set)
|
void udi_cdc_ctrl_signal_dcd(bool b_set)
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ typedef struct {
|
|||||||
usb_ep_desc_t ep_notify;
|
usb_ep_desc_t ep_notify;
|
||||||
} udi_cdc_comm_desc_t;
|
} udi_cdc_comm_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Data Class interface descriptor
|
* \brief Data Class interface descriptor
|
||||||
*
|
*
|
||||||
@@ -121,7 +120,6 @@ typedef struct {
|
|||||||
usb_ep_desc_t ep_out;
|
usb_ep_desc_t ep_out;
|
||||||
} udi_cdc_data_desc_t;
|
} udi_cdc_data_desc_t;
|
||||||
|
|
||||||
|
|
||||||
//! CDC communication endpoints size for all speeds
|
//! CDC communication endpoints size for all speeds
|
||||||
#define UDI_CDC_COMM_EP_SIZE 64
|
#define UDI_CDC_COMM_EP_SIZE 64
|
||||||
//! CDC data endpoints size for FS speed (8B, 16B, 32B, 64B)
|
//! CDC data endpoints size for FS speed (8B, 16B, 32B, 64B)
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {
|
|||||||
.bNumConfigurations = 1
|
.bNumConfigurations = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
//! USB Device Qualifier Descriptor for HS
|
//! USB Device Qualifier Descriptor for HS
|
||||||
COMPILER_WORD_ALIGNED
|
COMPILER_WORD_ALIGNED
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {
|
|||||||
.bNumConfigurations = 1
|
.bNumConfigurations = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
//! USB Device Qualifier Descriptor for HS
|
//! USB Device Qualifier Descriptor for HS
|
||||||
COMPILER_WORD_ALIGNED
|
COMPILER_WORD_ALIGNED
|
||||||
@@ -147,7 +146,6 @@ UDC_DESC_STORAGE udc_desc_t udc_desc_hs = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name UDC structures which contains all USB Device definitions
|
* \name UDC structures which contains all USB Device definitions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ UDC_DESC_STORAGE udi_api_t udi_api_msc = {
|
|||||||
};
|
};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup udi_msc_group
|
* \ingroup udi_msc_group
|
||||||
* \defgroup udi_msc_group_internal Implementation of UDI MSC
|
* \defgroup udi_msc_group_internal Implementation of UDI MSC
|
||||||
@@ -137,7 +136,6 @@ volatile bool udi_msc_b_reset_trans = true;
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Internal routines
|
* \name Internal routines
|
||||||
*/
|
*/
|
||||||
@@ -190,7 +188,6 @@ 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);
|
static bool udi_msc_cbw_validate(uint32_t alloc_len, uint8_t dir_flag);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines to process small data packet
|
* \name Routines to process small data packet
|
||||||
*/
|
*/
|
||||||
@@ -217,7 +214,6 @@ static void udi_msc_data_sent(udd_ep_status_t status, iram_size_t nb_sent,
|
|||||||
udd_ep_id_t ep);
|
udd_ep_id_t ep);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines to process CSW packet
|
* \name Routines to process CSW packet
|
||||||
*/
|
*/
|
||||||
@@ -250,7 +246,6 @@ static void udi_msc_csw_sent(udd_ep_status_t status, iram_size_t nb_sent,
|
|||||||
udd_ep_id_t ep);
|
udd_ep_id_t ep);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines manage sense data
|
* \name Routines manage sense data
|
||||||
*/
|
*/
|
||||||
@@ -307,7 +302,6 @@ static void udi_msc_sense_fail_cdb_invalid(void);
|
|||||||
static void udi_msc_sense_command_invalid(void);
|
static void udi_msc_sense_command_invalid(void);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines manage SCSI Commands
|
* \name Routines manage SCSI Commands
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -293,7 +293,6 @@ do { \
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Power management routine.
|
* \name Power management routine.
|
||||||
*/
|
*/
|
||||||
@@ -310,7 +309,6 @@ static bool udd_b_idle;
|
|||||||
//! State of sleep manager
|
//! State of sleep manager
|
||||||
static bool udd_b_sleep_initialized = false;
|
static bool udd_b_sleep_initialized = false;
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Authorize or not the CPU powerdown mode
|
/*! \brief Authorize or not the CPU powerdown mode
|
||||||
*
|
*
|
||||||
* \param b_enable true to authorize idle mode
|
* \param b_enable true to authorize idle mode
|
||||||
@@ -338,7 +336,6 @@ static void udd_sleep_mode(bool b_idle)
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Control endpoint low level management routine.
|
* \name Control endpoint low level management routine.
|
||||||
*
|
*
|
||||||
@@ -410,7 +407,6 @@ static void udd_ctrl_send_zlp_out(void);
|
|||||||
//! \brief Call callback associated to setup request
|
//! \brief Call callback associated to setup request
|
||||||
static void udd_ctrl_endofrequest(void);
|
static void udd_ctrl_endofrequest(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Main interrupt routine for control endpoint
|
* \brief Main interrupt routine for control endpoint
|
||||||
*
|
*
|
||||||
@@ -422,7 +418,6 @@ static bool udd_ctrl_interrupt(void);
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Management of bulk/interrupt/isochronous endpoints
|
* \name Management of bulk/interrupt/isochronous endpoints
|
||||||
*
|
*
|
||||||
@@ -460,7 +455,6 @@ typedef struct {
|
|||||||
uint8_t stall_requested:1;
|
uint8_t stall_requested:1;
|
||||||
} udd_ep_job_t;
|
} udd_ep_job_t;
|
||||||
|
|
||||||
|
|
||||||
//! Array to register a job on bulk/interrupt/isochronous endpoint
|
//! Array to register a job on bulk/interrupt/isochronous endpoint
|
||||||
static udd_ep_job_t udd_ep_job[USB_DEVICE_MAX_EP];
|
static udd_ep_job_t udd_ep_job[USB_DEVICE_MAX_EP];
|
||||||
|
|
||||||
@@ -522,7 +516,6 @@ static bool udd_ep_interrupt(void);
|
|||||||
#endif // (0!=USB_DEVICE_MAX_EP)
|
#endif // (0!=USB_DEVICE_MAX_EP)
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//--- INTERNAL ROUTINES TO MANAGED GLOBAL EVENTS
|
//--- INTERNAL ROUTINES TO MANAGED GLOBAL EVENTS
|
||||||
|
|
||||||
@@ -671,13 +664,11 @@ udd_interrupt_sof_end:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_include_vbus_monitoring(void)
|
bool udd_include_vbus_monitoring(void)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_enable(void)
|
void udd_enable(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -764,7 +755,6 @@ void udd_enable(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_disable(void)
|
void udd_disable(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -866,7 +856,6 @@ void udd_attach(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_detach(void)
|
void udd_detach(void)
|
||||||
{
|
{
|
||||||
otg_unfreeze_clock();
|
otg_unfreeze_clock();
|
||||||
@@ -883,7 +872,6 @@ void udd_detach(void)
|
|||||||
udd_sleep_mode(false);
|
udd_sleep_mode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_is_high_speed(void)
|
bool udd_is_high_speed(void)
|
||||||
{
|
{
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
@@ -893,7 +881,6 @@ bool udd_is_high_speed(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_set_address(uint8_t address)
|
void udd_set_address(uint8_t address)
|
||||||
{
|
{
|
||||||
udd_disable_address();
|
udd_disable_address();
|
||||||
@@ -901,13 +888,11 @@ void udd_set_address(uint8_t address)
|
|||||||
udd_enable_address();
|
udd_enable_address();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t udd_getaddress(void)
|
uint8_t udd_getaddress(void)
|
||||||
{
|
{
|
||||||
return udd_get_configured_address();
|
return udd_get_configured_address();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t udd_get_frame_number(void)
|
uint16_t udd_get_frame_number(void)
|
||||||
{
|
{
|
||||||
return udd_frame_number();
|
return udd_frame_number();
|
||||||
@@ -930,14 +915,12 @@ void udd_send_remotewakeup(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_set_setup_payload(uint8_t *payload, uint16_t payload_size)
|
void udd_set_setup_payload(uint8_t *payload, uint16_t payload_size)
|
||||||
{
|
{
|
||||||
udd_g_ctrlreq.payload = payload;
|
udd_g_ctrlreq.payload = payload;
|
||||||
udd_g_ctrlreq.payload_size = payload_size;
|
udd_g_ctrlreq.payload_size = payload_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (0 != USB_DEVICE_MAX_EP)
|
#if (0 != USB_DEVICE_MAX_EP)
|
||||||
bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
|
bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
|
||||||
uint16_t MaxEndpointSize)
|
uint16_t MaxEndpointSize)
|
||||||
@@ -1061,7 +1044,6 @@ bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_ep_free(udd_ep_id_t ep)
|
void udd_ep_free(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1074,14 +1056,12 @@ void udd_ep_free(udd_ep_id_t ep)
|
|||||||
udd_ep_job[ep_index - 1].stall_requested = false;
|
udd_ep_job[ep_index - 1].stall_requested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_is_halted(udd_ep_id_t ep)
|
bool udd_ep_is_halted(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
return Is_udd_endpoint_stall_requested(ep_index);
|
return Is_udd_endpoint_stall_requested(ep_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_set_halt(udd_ep_id_t ep)
|
bool udd_ep_set_halt(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1122,7 +1102,6 @@ bool udd_ep_set_halt(udd_ep_id_t ep)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_clear_halt(udd_ep_id_t ep)
|
bool udd_ep_clear_halt(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1163,7 +1142,6 @@ bool udd_ep_clear_halt(udd_ep_id_t ep)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
|
bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
|
||||||
uint8_t * buf, iram_size_t buf_size,
|
uint8_t * buf, iram_size_t buf_size,
|
||||||
udd_callback_trans_t callback)
|
udd_callback_trans_t callback)
|
||||||
@@ -1230,7 +1208,6 @@ bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_ep_abort(udd_ep_id_t ep)
|
void udd_ep_abort(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1259,7 +1236,6 @@ void udd_ep_abort(udd_ep_id_t ep)
|
|||||||
udd_ep_abort_job(ep);
|
udd_ep_abort_job(ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
|
bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
|
||||||
udd_callback_halt_cleared_t callback)
|
udd_callback_halt_cleared_t callback)
|
||||||
{
|
{
|
||||||
@@ -1294,7 +1270,6 @@ bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
|
|||||||
}
|
}
|
||||||
#endif // (0 != USB_DEVICE_MAX_EP)
|
#endif // (0 != USB_DEVICE_MAX_EP)
|
||||||
|
|
||||||
|
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
|
|
||||||
void udd_test_mode_j(void)
|
void udd_test_mode_j(void)
|
||||||
@@ -1303,20 +1278,17 @@ void udd_test_mode_j(void)
|
|||||||
udd_enable_hs_test_mode_j();
|
udd_enable_hs_test_mode_j();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_test_mode_k(void)
|
void udd_test_mode_k(void)
|
||||||
{
|
{
|
||||||
udd_enable_hs_test_mode();
|
udd_enable_hs_test_mode();
|
||||||
udd_enable_hs_test_mode_k();
|
udd_enable_hs_test_mode_k();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_test_mode_se0_nak(void)
|
void udd_test_mode_se0_nak(void)
|
||||||
{
|
{
|
||||||
udd_enable_hs_test_mode();
|
udd_enable_hs_test_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_test_mode_packet(void)
|
void udd_test_mode_packet(void)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
@@ -1360,8 +1332,6 @@ void udd_test_mode_packet(void)
|
|||||||
}
|
}
|
||||||
#endif // USB_DEVICE_HS_SUPPORT
|
#endif // USB_DEVICE_HS_SUPPORT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//--- INTERNAL ROUTINES TO MANAGED THE CONTROL ENDPOINT
|
//--- INTERNAL ROUTINES TO MANAGED THE CONTROL ENDPOINT
|
||||||
|
|
||||||
@@ -1411,7 +1381,6 @@ static void udd_ctrl_init(void)
|
|||||||
udd_ep_control_state = UDD_EPCTRL_SETUP;
|
udd_ep_control_state = UDD_EPCTRL_SETUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_setup_received(void)
|
static void udd_ctrl_setup_received(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1473,7 +1442,6 @@ static void udd_ctrl_setup_received(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_in_sent(void)
|
static void udd_ctrl_in_sent(void)
|
||||||
{
|
{
|
||||||
static bool b_shortpacket = false;
|
static bool b_shortpacket = false;
|
||||||
@@ -1557,7 +1525,6 @@ static void udd_ctrl_in_sent(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_out_received(void)
|
static void udd_ctrl_out_received(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1648,7 +1615,6 @@ static void udd_ctrl_out_received(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_underflow(void)
|
static void udd_ctrl_underflow(void)
|
||||||
{
|
{
|
||||||
if (Is_udd_out_received(0))
|
if (Is_udd_out_received(0))
|
||||||
@@ -1665,7 +1631,6 @@ static void udd_ctrl_underflow(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_overflow(void)
|
static void udd_ctrl_overflow(void)
|
||||||
{
|
{
|
||||||
if (Is_udd_in_send(0))
|
if (Is_udd_in_send(0))
|
||||||
@@ -1681,7 +1646,6 @@ static void udd_ctrl_overflow(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_stall_data(void)
|
static void udd_ctrl_stall_data(void)
|
||||||
{
|
{
|
||||||
// Stall all packets on IN & OUT control endpoint
|
// Stall all packets on IN & OUT control endpoint
|
||||||
@@ -1689,7 +1653,6 @@ static void udd_ctrl_stall_data(void)
|
|||||||
udd_enable_stall_handshake(0);
|
udd_enable_stall_handshake(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_send_zlp_in(void)
|
static void udd_ctrl_send_zlp_in(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1707,7 +1670,6 @@ static void udd_ctrl_send_zlp_in(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_send_zlp_out(void)
|
static void udd_ctrl_send_zlp_out(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1723,7 +1685,6 @@ static void udd_ctrl_send_zlp_out(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_endofrequest(void)
|
static void udd_ctrl_endofrequest(void)
|
||||||
{
|
{
|
||||||
// If a callback is registered then call it
|
// If a callback is registered then call it
|
||||||
@@ -1732,7 +1693,6 @@ static void udd_ctrl_endofrequest(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool udd_ctrl_interrupt(void)
|
static bool udd_ctrl_interrupt(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1783,7 +1743,6 @@ static bool udd_ctrl_interrupt(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//--- INTERNAL ROUTINES TO MANAGED THE BULK/INTERRUPT/ISOCHRONOUS ENDPOINTS
|
//--- INTERNAL ROUTINES TO MANAGED THE BULK/INTERRUPT/ISOCHRONOUS ENDPOINTS
|
||||||
|
|
||||||
@@ -1798,7 +1757,6 @@ static void udd_ep_job_table_reset(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ep_job_table_kill(void)
|
static void udd_ep_job_table_kill(void)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
@@ -1809,7 +1767,6 @@ static void udd_ep_job_table_kill(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ep_abort_job(udd_ep_id_t ep)
|
static void udd_ep_abort_job(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
ep &= USB_EP_ADDR_MASK;
|
ep &= USB_EP_ADDR_MASK;
|
||||||
@@ -1818,7 +1775,6 @@ static void udd_ep_abort_job(udd_ep_id_t ep)
|
|||||||
udd_ep_finish_job(&udd_ep_job[ep - 1], true, 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)
|
static void udd_ep_finish_job(udd_ep_job_t * ptr_job, bool b_abort, uint8_t ep_num)
|
||||||
{
|
{
|
||||||
if (ptr_job->busy == false) {
|
if (ptr_job->busy == false) {
|
||||||
@@ -1889,7 +1845,6 @@ static void udd_ep_trans_done(udd_ep_id_t ep)
|
|||||||
udd_dma_ctrl |= UOTGHS_DEVDMACONTROL_END_BUFFIT |
|
udd_dma_ctrl |= UOTGHS_DEVDMACONTROL_END_BUFFIT |
|
||||||
UOTGHS_DEVDMACONTROL_CHANN_ENB;
|
UOTGHS_DEVDMACONTROL_CHANN_ENB;
|
||||||
|
|
||||||
|
|
||||||
// Disable IRQs to have a short sequence
|
// Disable IRQs to have a short sequence
|
||||||
// between read of EOT_STA and DMA enable
|
// between read of EOT_STA and DMA enable
|
||||||
flags = cpu_irq_save();
|
flags = cpu_irq_save();
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ extern "C" {
|
|||||||
#define Is_udd_vbus_transition() (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_VBUSTI))
|
#define Is_udd_vbus_transition() (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_VBUSTI))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS device attach control
|
//! @name UOTGHS device attach control
|
||||||
//! These macros manage the UOTGHS Device attach.
|
//! These macros manage the UOTGHS Device attach.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -141,7 +140,6 @@ extern "C" {
|
|||||||
#define Is_udd_detached() (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
|
#define Is_udd_detached() (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS device bus events control
|
//! @name UOTGHS device bus events control
|
||||||
//! These macros manage the UOTGHS Device bus events.
|
//! These macros manage the UOTGHS Device bus events.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -246,7 +244,6 @@ extern "C" {
|
|||||||
#define udd_get_configured_address() (Rd_bitfield(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_UADD_Msk))
|
#define udd_get_configured_address() (Rd_bitfield(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_UADD_Msk))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS Device endpoint drivers
|
//! @name UOTGHS Device endpoint drivers
|
||||||
//! These macros manage the common features of the endpoints.
|
//! These macros manage the common features of the endpoints.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -330,7 +327,6 @@ extern "C" {
|
|||||||
#define udd_data_toggle(ep) (Rd_bitfield(UOTGHS_ARRAY(UOTGHS_DEVEPTISR[0], ep), UOTGHS_DEVEPTISR_DTSEQ_Msk))
|
#define udd_data_toggle(ep) (Rd_bitfield(UOTGHS_ARRAY(UOTGHS_DEVEPTISR[0], ep), UOTGHS_DEVEPTISR_DTSEQ_Msk))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS Device control endpoint
|
//! @name UOTGHS Device control endpoint
|
||||||
//! These macros control the endpoints.
|
//! These macros control the endpoints.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -530,7 +526,6 @@ extern "C" {
|
|||||||
//! Tests if IN sending interrupt is enabled
|
//! 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))
|
#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.
|
//! 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 ep Endpoint of which to access FIFO data register
|
||||||
//! @param scale Data scale in bits: 64, 32, 16 or 8
|
//! @param scale Data scale in bits: 64, 32, 16 or 8
|
||||||
@@ -652,7 +647,6 @@ typedef struct {
|
|||||||
//! @}
|
//! @}
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/// @cond 0
|
/// @cond 0
|
||||||
/**INDENT-OFF**/
|
/**INDENT-OFF**/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//! \ingroup usb_group
|
//! \ingroup usb_group
|
||||||
//! \defgroup otg_group UOTGHS OTG Driver
|
//! \defgroup otg_group UOTGHS OTG Driver
|
||||||
//! UOTGHS low-level driver for OTG features
|
//! UOTGHS low-level driver for OTG features
|
||||||
@@ -74,7 +73,6 @@ bool otg_dual_enable(void);
|
|||||||
*/
|
*/
|
||||||
void otg_dual_disable(void);
|
void otg_dual_disable(void);
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS OTG ID pin management
|
//! @name UOTGHS OTG ID pin management
|
||||||
//! The ID pin come from the USB OTG connector (A and B receptable) and
|
//! The ID pin come from the USB OTG connector (A and B receptable) and
|
||||||
//! allows to select the USB mode host or device.
|
//! allows to select the USB mode host or device.
|
||||||
|
|||||||
@@ -374,7 +374,6 @@ typedef struct {
|
|||||||
uint8_t bNumDeviceCaps;
|
uint8_t bNumDeviceCaps;
|
||||||
} usb_dev_bos_desc_t;
|
} usb_dev_bos_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief USB Device Capabilities - USB 2.0 Extension Descriptor structure
|
* \brief USB Device Capabilities - USB 2.0 Extension Descriptor structure
|
||||||
*
|
*
|
||||||
@@ -411,7 +410,6 @@ typedef struct {
|
|||||||
uint8_t iFunction; //!< Index of string descriptor
|
uint8_t iFunction; //!< Index of string descriptor
|
||||||
} usb_association_desc_t;
|
} usb_association_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Standard USB configuration descriptor structure
|
* \brief Standard USB configuration descriptor structure
|
||||||
*/
|
*/
|
||||||
@@ -426,7 +424,6 @@ typedef struct {
|
|||||||
uint8_t bMaxPower;
|
uint8_t bMaxPower;
|
||||||
} usb_conf_desc_t;
|
} usb_conf_desc_t;
|
||||||
|
|
||||||
|
|
||||||
#define USB_CONFIG_ATTR_MUST_SET (1 << 7) //!< Must always be set
|
#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_BUS_POWERED (0 << 6) //!< Bus-powered
|
||||||
#define USB_CONFIG_ATTR_SELF_POWERED (1 << 6) //!< Self-powered
|
#define USB_CONFIG_ATTR_SELF_POWERED (1 << 6) //!< Self-powered
|
||||||
@@ -475,7 +472,6 @@ typedef struct {
|
|||||||
uint8_t bInterval;
|
uint8_t bInterval;
|
||||||
} usb_ep_desc_t;
|
} usb_ep_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A standard USB string descriptor structure
|
* \brief A standard USB string descriptor structure
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ COMPILER_PACK_SET(1)
|
|||||||
//! \name USB CDC Descriptors
|
//! \name USB CDC Descriptors
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
|
||||||
//! CDC Header Functional Descriptor
|
//! CDC Header Functional Descriptor
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t bFunctionLength;
|
uint8_t bFunctionLength;
|
||||||
@@ -203,7 +202,6 @@ typedef struct {
|
|||||||
uint8_t bSlaveInterface0;
|
uint8_t bSlaveInterface0;
|
||||||
} usb_cdc_union_desc_t;
|
} usb_cdc_union_desc_t;
|
||||||
|
|
||||||
|
|
||||||
//! \name USB CDC Call Management Capabilities
|
//! \name USB CDC Call Management Capabilities
|
||||||
//@{
|
//@{
|
||||||
//! Device handles call management itself
|
//! Device handles call management itself
|
||||||
@@ -278,7 +276,6 @@ typedef struct {
|
|||||||
//@}
|
//@}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
//! \name USB CDC notification message
|
//! \name USB CDC notification message
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
#ifndef _USB_PROTOCOL_MSC_H_
|
#ifndef _USB_PROTOCOL_MSC_H_
|
||||||
#define _USB_PROTOCOL_MSC_H_
|
#define _USB_PROTOCOL_MSC_H_
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup usb_protocol_group
|
* \ingroup usb_protocol_group
|
||||||
* \defgroup usb_msc_protocol USB Mass Storage Class (MSC) protocol definitions
|
* \defgroup usb_msc_protocol USB Mass Storage Class (MSC) protocol definitions
|
||||||
@@ -89,7 +88,6 @@
|
|||||||
#define MSC_PROTOCOL_BULK 0x50 //!< Bulk-only
|
#define MSC_PROTOCOL_BULK 0x50 //!< Bulk-only
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief MSC USB requests (bRequest)
|
* \brief MSC USB requests (bRequest)
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +96,6 @@ enum usb_reqid_msc {
|
|||||||
USB_REQ_MSC_GET_MAX_LUN = 0xFE //!< Get Max LUN
|
USB_REQ_MSC_GET_MAX_LUN = 0xFE //!< Get Max LUN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
COMPILER_PACK_SET(1)
|
COMPILER_PACK_SET(1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +119,6 @@ struct usb_msc_cbw {
|
|||||||
#define USB_CBW_LEN_MASK 0x1F //!< Valid bits in bCBWCBLength
|
#define USB_CBW_LEN_MASK 0x1F //!< Valid bits in bCBWCBLength
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name A Command Status Wrapper (CSW).
|
* \name A Command Status Wrapper (CSW).
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,24 +31,28 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { return EEPROM.begin(MARLIN_EEPROM_SIZE); }
|
bool PersistentStore::access_start() { return EEPROM.begin(MARLIN_EEPROM_SIZE); }
|
||||||
bool PersistentStore::access_finish() { EEPROM.end(); return true; }
|
bool PersistentStore::access_finish() { EEPROM.end(); return true; }
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
EEPROM.write(pos++, value[i]);
|
const int p = REAL_EEPROM_ADDR(pos);
|
||||||
|
EEPROM.write(p, value[i]);
|
||||||
crc16(crc, &value[i], 1);
|
crc16(crc, &value[i], 1);
|
||||||
|
++pos;
|
||||||
}
|
}
|
||||||
return false;
|
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*/) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
uint8_t c = EEPROM.read(pos++);
|
const int p = REAL_EEPROM_ADDR(pos);
|
||||||
|
uint8_t c = EEPROM.read(p);
|
||||||
if (writing) value[i] = c;
|
if (writing) value[i] = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
|
++pos;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -142,12 +142,31 @@
|
|||||||
// ADC
|
// ADC
|
||||||
//
|
//
|
||||||
#define HAL_ADC_VREF_MV 3300
|
#define HAL_ADC_VREF_MV 3300
|
||||||
#define HAL_ADC_RESOLUTION 10
|
#define HAL_ADC_RESOLUTION 12
|
||||||
|
|
||||||
#define GET_PIN_MAP_PIN(index) index
|
#define GET_PIN_MAP_PIN(index) index
|
||||||
#define GET_PIN_MAP_INDEX(pin) pin
|
#define GET_PIN_MAP_INDEX(pin) pin
|
||||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
#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
|
// MarlinHAL implementation
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -123,6 +123,11 @@ void MarlinHAL::init() {
|
|||||||
|
|
||||||
// Register min serial
|
// Register min serial
|
||||||
TERN_(POSTMORTEM_DEBUGGING, install_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() {}
|
void MarlinHAL::init_board() {}
|
||||||
@@ -147,7 +152,31 @@ void MarlinHAL::delay_ms(const int ms) {
|
|||||||
delay(ms);
|
delay(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinHAL::idletask() {}
|
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
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t MarlinHAL::get_reset_source() {
|
uint8_t MarlinHAL::get_reset_source() {
|
||||||
// Query reset cause from RMU
|
// Query reset cause from RMU
|
||||||
@@ -203,7 +232,9 @@ int MarlinHAL::freeMemory() {
|
|||||||
return &top - _sbrk(0);
|
return &top - _sbrk(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinHAL::adc_init() {}
|
void MarlinHAL::adc_init() {
|
||||||
|
analogReadResolution(HAL_ADC_RESOLUTION);
|
||||||
|
}
|
||||||
|
|
||||||
void MarlinHAL::adc_enable(const pin_t pin) {
|
void MarlinHAL::adc_enable(const pin_t pin) {
|
||||||
#if TEMP_SENSOR_SOC
|
#if TEMP_SENSOR_SOC
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Not every MarlinSerial instance should handle emergency parsing, as
|
* Not every MarlinSerial instance should handle emergency parsing, as
|
||||||
* it would not make sense to parse GCode from TMC responses
|
* it would not make sense to parse G-Code from TMC responses
|
||||||
*/
|
*/
|
||||||
constexpr bool serial_handles_emergency(int port) {
|
constexpr bool serial_handles_emergency(int port) {
|
||||||
return false
|
return false
|
||||||
@@ -46,14 +46,34 @@ constexpr bool serial_handles_emergency(int port) {
|
|||||||
//
|
//
|
||||||
// Define serial ports
|
// Define serial ports
|
||||||
//
|
//
|
||||||
#define DEFINE_HWSERIAL_MARLIN(name, n) \
|
|
||||||
|
// serial port where RX and TX use IRQs
|
||||||
|
#define DEFINE_IRQ_SERIAL_MARLIN(name, n) \
|
||||||
MSerialT name(serial_handles_emergency(n), \
|
MSerialT name(serial_handles_emergency(n), \
|
||||||
&USART##n##_config, \
|
&USART##n##_config, \
|
||||||
BOARD_USART##n##_TX_PIN, \
|
BOARD_USART##n##_TX_PIN, \
|
||||||
BOARD_USART##n##_RX_PIN);
|
BOARD_USART##n##_RX_PIN);
|
||||||
|
|
||||||
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
|
// serial port where RX uses DMA and TX uses IRQs
|
||||||
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
|
// 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
|
||||||
|
|
||||||
//
|
//
|
||||||
// Serial port assertions
|
// Serial port assertions
|
||||||
|
|||||||
@@ -25,17 +25,42 @@
|
|||||||
#include <drivers/usart/Usart.h>
|
#include <drivers/usart/Usart.h>
|
||||||
|
|
||||||
// Optionally set uart IRQ priority to reduce overflow errors
|
// Optionally set uart IRQ priority to reduce overflow errors
|
||||||
// #define UART_IRQ_PRIO 1
|
//#define UART_RX_IRQ_PRIO 1
|
||||||
|
//#define UART_TX_IRQ_PRIO 1
|
||||||
|
//#define UART_RX_DMA_IRQ_PRIO 1
|
||||||
|
|
||||||
struct MarlinSerial : public Usart {
|
struct MarlinSerial : public Usart {
|
||||||
MarlinSerial(struct usart_config_t *usart_device, gpio_pin_t tx_pin, gpio_pin_t rx_pin) : Usart(usart_device, tx_pin, rx_pin) {}
|
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
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef UART_IRQ_PRIO
|
#if defined(UART_RX_IRQ_PRIO) || defined(UART_TX_IRQ_PRIO) || defined(UART_RX_DMA_IRQ_PRIO)
|
||||||
void setPriority() {
|
void setPriority() {
|
||||||
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_IRQ_PRIO);
|
#if defined(UART_RX_IRQ_PRIO)
|
||||||
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_IRQ_PRIO);
|
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_RX_IRQ_PRIO);
|
||||||
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_IRQ_PRIO);
|
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_RX_IRQ_PRIO);
|
||||||
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_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
|
||||||
}
|
}
|
||||||
|
|
||||||
void begin(uint32_t baud) {
|
void begin(uint32_t baud) {
|
||||||
@@ -47,7 +72,12 @@ struct MarlinSerial : public Usart {
|
|||||||
Usart::begin(baud, config);
|
Usart::begin(baud, config);
|
||||||
setPriority();
|
setPriority();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Serial1Class<MarlinSerial> MSerialT;
|
typedef Serial1Class<MarlinSerial> MSerialT;
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* 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_
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
eeprom_init();
|
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) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
uint8_t *const p = (uint8_t *const)pos;
|
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
||||||
|
|
||||||
// EEPROM has only ~100,000 write cycles,
|
// EEPROM has only ~100,000 write cycles,
|
||||||
// so only write bytes that have changed!
|
// so only write bytes that have changed!
|
||||||
@@ -70,16 +70,10 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size,
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
||||||
uint16_t *crc, const bool writing /*=true*/) {
|
|
||||||
do {
|
do {
|
||||||
uint8_t *const p = (uint8_t *const)pos;
|
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
||||||
uint8_t c = eeprom_read_byte(p);
|
if (writing) *value = c;
|
||||||
if (writing)
|
|
||||||
{
|
|
||||||
*value = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
value++;
|
value++;
|
||||||
|
|||||||
@@ -38,9 +38,7 @@
|
|||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t PersistentStore::capacity() {
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
return MARLIN_EEPROM_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _ALIGN(x) __attribute__((aligned(x)))
|
#define _ALIGN(x) __attribute__((aligned(x)))
|
||||||
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
|
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
|
||||||
@@ -85,11 +83,10 @@ 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*/) {
|
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++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
uint8_t c = HAL_eeprom_data[pos + i];
|
const uint8_t c = HAL_eeprom_data[pos + i];
|
||||||
if (writing) value[i] = c;
|
if (writing) value[i] = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos += size;
|
pos += size;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_finish() { return true; }
|
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) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t *const p = (uint8_t *const)pos;
|
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
// EEPROM has only ~100,000 write cycles,
|
// EEPROM has only ~100,000 write cycles,
|
||||||
// so only write bytes that have changed!
|
// so only write bytes that have changed!
|
||||||
@@ -77,10 +77,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*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = eeprom_read_byte((uint8_t *)pos);
|
const uint8_t c = eeprom_read_byte((uint8_t *)REAL_EEPROM_ADDR(pos));
|
||||||
if (writing && value) {
|
if (writing && value) *value = c;
|
||||||
*value = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -40,9 +40,15 @@ void endstopIRQHandler() {
|
|||||||
CHECK(X_MAX);
|
CHECK(X_MAX);
|
||||||
CHECK(X_MIN);
|
CHECK(X_MIN);
|
||||||
|
|
||||||
|
CHECK(X2_MAX);
|
||||||
|
CHECK(X2_MIN);
|
||||||
|
|
||||||
CHECK(Y_MAX);
|
CHECK(Y_MAX);
|
||||||
CHECK(Y_MIN);
|
CHECK(Y_MIN);
|
||||||
|
|
||||||
|
CHECK(Y2_MAX);
|
||||||
|
CHECK(Y2_MIN);
|
||||||
|
|
||||||
CHECK(Z_MAX);
|
CHECK(Z_MAX);
|
||||||
CHECK(Z_MIN);
|
CHECK(Z_MIN);
|
||||||
|
|
||||||
@@ -52,6 +58,9 @@ void endstopIRQHandler() {
|
|||||||
CHECK(Z3_MAX);
|
CHECK(Z3_MAX);
|
||||||
CHECK(Z3_MIN);
|
CHECK(Z3_MIN);
|
||||||
|
|
||||||
|
CHECK(Z4_MAX);
|
||||||
|
CHECK(Z4_MIN);
|
||||||
|
|
||||||
CHECK(Z_MIN_PROBE);
|
CHECK(Z_MIN_PROBE);
|
||||||
|
|
||||||
// Update endstops
|
// Update endstops
|
||||||
@@ -69,9 +78,15 @@ void setup_endstop_interrupts() {
|
|||||||
SETUP(X_MAX);
|
SETUP(X_MAX);
|
||||||
SETUP(X_MIN);
|
SETUP(X_MIN);
|
||||||
|
|
||||||
|
SETUP(X2_MAX);
|
||||||
|
SETUP(X2_MIN);
|
||||||
|
|
||||||
SETUP(Y_MAX);
|
SETUP(Y_MAX);
|
||||||
SETUP(Y_MIN);
|
SETUP(Y_MIN);
|
||||||
|
|
||||||
|
SETUP(Y2_MAX);
|
||||||
|
SETUP(Y2_MIN);
|
||||||
|
|
||||||
SETUP(Z_MAX);
|
SETUP(Z_MAX);
|
||||||
SETUP(Z_MIN);
|
SETUP(Z_MIN);
|
||||||
|
|
||||||
@@ -81,6 +96,9 @@ void setup_endstop_interrupts() {
|
|||||||
SETUP(Z3_MAX);
|
SETUP(Z3_MAX);
|
||||||
SETUP(Z3_MIN);
|
SETUP(Z3_MIN);
|
||||||
|
|
||||||
|
SETUP(Z4_MAX);
|
||||||
|
SETUP(Z4_MIN);
|
||||||
|
|
||||||
SETUP(Z_MIN_PROBE);
|
SETUP(Z_MIN_PROBE);
|
||||||
|
|
||||||
#undef SETUP
|
#undef SETUP
|
||||||
@@ -88,7 +106,7 @@ void setup_endstop_interrupts() {
|
|||||||
|
|
||||||
// Ensure 1 - 10 IRQs are registered
|
// Ensure 1 - 10 IRQs are registered
|
||||||
// Disable some endstops if you encounter this error
|
// Disable some endstops if you encounter this error
|
||||||
#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)
|
#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)
|
||||||
#if ENDSTOPS_INTERRUPTS_COUNT > 10
|
#if ENDSTOPS_INTERRUPTS_COUNT > 10
|
||||||
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
|
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
|
||||||
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
|
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -20,6 +20,20 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#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
|
#ifndef BOARD_XTAL_FREQUENCY
|
||||||
#error "BOARD_XTAL_FREQUENCY is required for HC32F460."
|
#error "BOARD_XTAL_FREQUENCY is required for HC32F460."
|
||||||
@@ -58,11 +72,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TEMP_SENSOR_SOC
|
#if TEMP_SENSOR_SOC
|
||||||
#if !defined(TEMP_SOC_PIN)
|
#ifndef TEMP_SOC_PIN
|
||||||
#error "TEMP_SOC_PIN must be defined to use TEMP_SENSOR_SOC."
|
#error "TEMP_SOC_PIN must be defined to use TEMP_SENSOR_SOC."
|
||||||
#endif
|
#elif IS_GPIO_PIN(TEMP_SOC_PIN)
|
||||||
|
|
||||||
#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."
|
#error "TEMP_SOC_PIN must not be a valid GPIO pin to avoid conflicts."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -76,3 +88,18 @@
|
|||||||
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
|
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
|
||||||
#endif
|
#endif
|
||||||
#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
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#ifdef ARDUINO_ARCH_HC32
|
#ifdef ARDUINO_ARCH_HC32
|
||||||
#ifdef REDIRECT_PRINTF_TO_SERIAL
|
#ifdef REDIRECT_PRINTF_TO_SERIAL
|
||||||
|
|
||||||
#if !defined(__GNUC__)
|
#ifndef __GNUC__
|
||||||
#error "only GCC is supported"
|
#error "only GCC is supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
fn \
|
fn \
|
||||||
}
|
}
|
||||||
|
|
||||||
stc_sd_handle_t *handle;
|
stc_sd_handle_t *handle = nullptr;
|
||||||
|
|
||||||
bool SDIO_Init() {
|
bool SDIO_Init() {
|
||||||
// Configure SDIO pins
|
// Configure SDIO pins
|
||||||
@@ -66,36 +66,45 @@ bool SDIO_Init() {
|
|||||||
GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio);
|
GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio);
|
||||||
GPIO_SetFunc(BOARD_SDIO_DET, 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
|
// Create DMA configuration
|
||||||
stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t;
|
stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t;
|
||||||
dmaConf->DMAx = SDIO_DMA_PERIPHERAL;
|
dmaConf->DMAx = SDIO_DMA_PERIPHERAL;
|
||||||
dmaConf->enDmaCh = SDIO_DMA_CHANNEL;
|
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
|
// Create handle in DMA mode
|
||||||
handle = new stc_sd_handle_t;
|
handle = new stc_sd_handle_t;
|
||||||
handle->SDIOCx = SDIO_PERIPHERAL;
|
handle->SDIOCx = SDIO_PERIPHERAL;
|
||||||
handle->enDevMode = SdCardDmaMode;
|
handle->enDevMode = SdCardDmaMode;
|
||||||
handle->pstcDmaInitCfg = dmaConf;
|
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
|
// 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);
|
if (rc != Ok) printf("SDIO_Init() error (rc=%u)\n", rc);
|
||||||
|
|
||||||
return rc == Ok;
|
return rc == Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
|
||||||
CORE_ASSERT(dst != NULL, "SDIO_ReadBlock dst is NULL");
|
CORE_ASSERT(dst != nullptr, "SDIO_ReadBlock dst is NULL", return false);
|
||||||
|
|
||||||
WITH_RETRY(SDIO_READ_RETRIES, {
|
WITH_RETRY(SDIO_READ_RETRIES, {
|
||||||
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
|
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
|
||||||
@@ -107,8 +116,8 @@ bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
|
||||||
CORE_ASSERT(src != NULL, "SDIO_WriteBlock src is NULL");
|
CORE_ASSERT(src != nullptr, "SDIO_WriteBlock src is NULL", return false);
|
||||||
|
|
||||||
WITH_RETRY(SDIO_WRITE_RETRIES, {
|
WITH_RETRY(SDIO_WRITE_RETRIES, {
|
||||||
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
|
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
|
||||||
@@ -120,12 +129,12 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SDIO_IsReady() {
|
bool SDIO_IsReady() {
|
||||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
|
||||||
return bool(handle->stcCardStatus.READY_FOR_DATA);
|
return bool(handle->stcCardStatus.READY_FOR_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t SDIO_GetCardSize() {
|
uint32_t SDIO_GetCardSize() {
|
||||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return 0);
|
||||||
|
|
||||||
// Multiply number of blocks with block size to get size in bytes
|
// 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);
|
const uint64_t cardSizeBytes = uint64_t(handle->stcSdCardInfo.u32LogBlockNbr) * uint64_t(handle->stcSdCardInfo.u32LogBlockSize);
|
||||||
|
|||||||
@@ -96,29 +96,44 @@ void core_hook_sysclock_init() {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Setup clock divisors for sysclk = 200 MHz:
|
// 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
|
||||||
// Note: PCLK1 is used for step+temp timers, and need to be kept at 50 MHz (until there is a better solution)
|
// Note: PCLK1 is used for step+temp timers, and need to be kept at 50 MHz (until there is a better solution)
|
||||||
stc_clk_sysclk_cfg_t sysClkConf = {
|
constexpr stc_clk_sysclk_cfg_t sysClkConf = {
|
||||||
.enHclkDiv = ClkSysclkDiv1, // HCLK = 200 MHz (CPU)
|
.enHclkDiv = ClkSysclkDiv1, // HCLK = 200 MHz (CPU)
|
||||||
.enExclkDiv = ClkSysclkDiv2, // EXCLK = 100 MHz (SDIO)
|
.enExclkDiv = ClkSysclkDiv2, // EXCLK = 100 MHz (SDIO)
|
||||||
.enPclk0Div = ClkSysclkDiv1, // PCLK0 = 200 MHz (Timer6 (not used))
|
.enPclk0Div = ClkSysclkDiv2, // PCLK0 = 100 MHz (Timer6 (not used))
|
||||||
.enPclk1Div = ClkSysclkDiv4, // PCLK1 = 50 MHz (USART, SPI, I2S, Timer0 (step+temp), TimerA (Servo))
|
.enPclk1Div = ClkSysclkDiv4, // PCLK1 = 50 MHz (USART, SPI, I2S, Timer0 (step+temp), TimerA (Servo))
|
||||||
.enPclk2Div = ClkSysclkDiv4, // PCLK2 = 50 MHz (ADC)
|
.enPclk2Div = ClkSysclkDiv8, // PCLK2 = 25 MHz (ADC)
|
||||||
.enPclk3Div = ClkSysclkDiv4, // PCLK3 = 50 MHz (I2C, WDT)
|
.enPclk3Div = ClkSysclkDiv8, // PCLK3 = 25 MHz (I2C, WDT)
|
||||||
.enPclk4Div = ClkSysclkDiv2, // PCLK4 = 100 MHz (ADC ctl)
|
.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);
|
sysclock_set_clock_dividers(&sysClkConf);
|
||||||
|
|
||||||
// Set power mode
|
// Set power mode
|
||||||
#define POWER_MODE_SYSTEM_CLOCK 200000000 // 200 MHz
|
power_mode_update_pre(sysclock);
|
||||||
power_mode_update_pre(POWER_MODE_SYSTEM_CLOCK);
|
|
||||||
|
|
||||||
// Switch to MPLL as sysclk source
|
// Switch to MPLL as sysclk source
|
||||||
CLK_SetSysClkSource(CLKSysSrcMPLL);
|
CLK_SetSysClkSource(CLKSysSrcMPLL);
|
||||||
|
|
||||||
// Set power mode
|
// Set power mode
|
||||||
power_mode_update_post(POWER_MODE_SYSTEM_CLOCK);
|
power_mode_update_post(sysclock);
|
||||||
#undef POWER_MODE_SYSTEM_CLOCK
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_HC32
|
#endif // ARDUINO_ARCH_HC32
|
||||||
|
|||||||
@@ -38,44 +38,48 @@ extern Timer0 step_timer;
|
|||||||
// Timer Configurations
|
// Timer Configurations
|
||||||
//
|
//
|
||||||
|
|
||||||
// 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
|
* HAL_TIMER_RATE must be known at compile time since it's used to calculate
|
||||||
// as a workaround, PCLK1 = 50MHz is assumed (check with clock dump in MarlinHAL::init())
|
* STEPPER_TIMER_RATE, which is used in 'constexpr' calculations.
|
||||||
#define HAL_TIMER_RATE 50000000 // 50MHz
|
* On the HC32F460 the timer rate depends on PCLK1, which is derived from the
|
||||||
// #define HAL_TIMER_RATE TIMER0_BASE_FREQUENCY
|
* 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
|
||||||
// TODO: CYCLES_PER_MICROSECOND seems to be used by Marlin to calculate the number of cycles per microsecond in the timer ISRs
|
* as F_CPU with a divider of 4 in 'sysclock.cpp::core_hook_sysclock_init'.
|
||||||
// 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
|
* If you face issues with this assumption, please double-check with the values
|
||||||
#define CYCLES_PER_MICROSECOND (HAL_TIMER_RATE / 1000000UL)
|
* 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
|
||||||
|
|
||||||
// Temperature timer
|
// Temperature timer
|
||||||
#define TEMP_TIMER_NUM (&temp_timer)
|
#define TEMP_TIMER_NUM (&temp_timer)
|
||||||
#define TEMP_TIMER_PRIORITY DDL_IRQ_PRIORITY_02
|
#define TEMP_TIMER_PRIORITY DDL_IRQ_PRIORITY_02
|
||||||
#define TEMP_TIMER_PRESCALE 16ul
|
#define TEMP_TIMER_PRESCALE 16UL // 12.5MHz
|
||||||
#define TEMP_TIMER_RATE 1000 // 1kHz
|
#define TEMP_TIMER_RATE 1000 // 1kHz
|
||||||
#define TEMP_TIMER_FREQUENCY TEMP_TIMER_RATE // Alias for Marlin
|
#define TEMP_TIMER_FREQUENCY TEMP_TIMER_RATE // 1kHz also
|
||||||
|
|
||||||
// Stepper timer
|
// Stepper timer
|
||||||
#define STEP_TIMER_NUM (&step_timer)
|
#define STEP_TIMER_NUM (&step_timer)
|
||||||
#define STEP_TIMER_PRIORITY DDL_IRQ_PRIORITY_01
|
#define STEP_TIMER_PRIORITY DDL_IRQ_PRIORITY_00 // Top priority, nothing else uses it
|
||||||
#define STEPPER_TIMER_PRESCALE 16ul
|
#define STEPPER_TIMER_PRESCALE 16UL // 12.5MHz
|
||||||
|
|
||||||
// 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_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // 50MHz / 16 = 3.125MHz
|
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000UL) // Integer 3
|
||||||
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000)
|
|
||||||
|
|
||||||
// Pulse timer (== stepper timer)
|
// Pulse timer (== stepper timer)
|
||||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||||
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
||||||
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
|
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
|
||||||
|
|
||||||
//
|
//
|
||||||
// Channel aliases
|
// Channel aliases
|
||||||
//
|
//
|
||||||
#define MF_TIMER_TEMP TEMP_TIMER_NUM
|
#define MF_TIMER_TEMP TEMP_TIMER_NUM
|
||||||
#define MF_TIMER_STEP STEP_TIMER_NUM
|
#define MF_TIMER_STEP STEP_TIMER_NUM
|
||||||
#define MF_TIMER_PULSE PULSE_TIMER_NUM
|
#define MF_TIMER_PULSE PULSE_TIMER_NUM
|
||||||
|
|
||||||
//
|
//
|
||||||
// HAL functions
|
// HAL functions
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
uint8_t buffer[MARLIN_EEPROM_SIZE];
|
uint8_t buffer[MARLIN_EEPROM_SIZE];
|
||||||
char filename[] = "eeprom.dat";
|
char filename[] = "eeprom.dat";
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
const char eeprom_erase_value = 0xFF;
|
const char eeprom_erase_value = 0xFF;
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ Timer::Timer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Timer::~Timer() {
|
Timer::~Timer() {
|
||||||
timer_delete(timerid);
|
if (timerid != 0) {
|
||||||
|
timer_delete(timerid);
|
||||||
|
timerid = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) {
|
void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) {
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __PLAT_LINUX__
|
#ifdef __PLAT_LINUX__
|
||||||
|
#ifndef UNIT_TEST
|
||||||
|
|
||||||
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
||||||
|
|
||||||
@@ -135,4 +136,5 @@ int main() {
|
|||||||
read_serial.join();
|
read_serial.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // UNIT_TEST
|
||||||
#endif // __PLAT_LINUX__
|
#endif // __PLAT_LINUX__
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
|
|
||||||
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
||||||
|
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#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)
|
#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
|
#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.
|
// needed due to the speed and mode required for communicating with each device being different.
|
||||||
|
|||||||
@@ -111,6 +111,12 @@ void MarlinHAL::init() {
|
|||||||
#if HAS_SERVO_3
|
#if HAS_SERVO_3
|
||||||
INIT_SERVO(3);
|
INIT_SERVO(3);
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_SERVO_4
|
||||||
|
INIT_SERVO(4);
|
||||||
|
#endif
|
||||||
|
#if HAS_SERVO_5
|
||||||
|
INIT_SERVO(5);
|
||||||
|
#endif
|
||||||
|
|
||||||
//debug_frmwrk_init();
|
//debug_frmwrk_init();
|
||||||
//_DBG("\n\nDebug running\n");
|
//_DBG("\n\nDebug running\n");
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
|
|||||||
#else
|
#else
|
||||||
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
|
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
|
||||||
#endif
|
#endif
|
||||||
#if HAS_DGUS_LCD
|
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
|
||||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
|
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
|||||||
static bool eeprom_dirty = false;
|
static bool eeprom_dirty = false;
|
||||||
static int current_slot = 0;
|
static int current_slot = 0;
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
uint32_t first_nblank_loc, first_nblank_val;
|
uint32_t first_nblank_loc, first_nblank_val;
|
||||||
@@ -112,7 +112,8 @@ bool PersistentStore::access_finish() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
for (size_t i = 0; i < size; i++) ram_eeprom[pos + i] = value[i];
|
const int p = REAL_EEPROM_ADDR(pos);
|
||||||
|
for (size_t i = 0; i < size; i++) ram_eeprom[p + i] = value[i];
|
||||||
eeprom_dirty = true;
|
eeprom_dirty = true;
|
||||||
crc16(crc, value, size);
|
crc16(crc, value, size);
|
||||||
pos += size;
|
pos += size;
|
||||||
@@ -120,8 +121,9 @@ 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*/) {
|
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];
|
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[pos + i];
|
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[p + i];
|
||||||
crc16(crc, buff, size);
|
crc16(crc, buff, size);
|
||||||
pos += size;
|
pos += size;
|
||||||
return false; // return true for any error
|
return false; // return true for any error
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ bool eeprom_file_open = false;
|
|||||||
#define MARLIN_EEPROM_SIZE size_t(0x1000) // 4KiB of Emulated EEPROM
|
#define MARLIN_EEPROM_SIZE size_t(0x1000) // 4KiB of Emulated EEPROM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
const char eeprom_erase_value = 0xFF;
|
const char eeprom_erase_value = 0xFF;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x8000 // 32K
|
#define MARLIN_EEPROM_SIZE 0x8000 // 32K
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { 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;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
uint8_t * const p = (uint8_t * const)pos;
|
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
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);
|
eeprom_write_byte(p, v);
|
||||||
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
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*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
// Read from external EEPROM
|
// Read from external EEPROM
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -21,9 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../core/macros.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)
|
||||||
|
|
||||||
#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
|
#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.
|
// 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
|
// This requirement can be removed if the SPI access to these devices is updated to use
|
||||||
|
|||||||
@@ -8,14 +8,12 @@ DriverVer =04/14/2008, 5.1.2600.5512
|
|||||||
[Manufacturer]
|
[Manufacturer]
|
||||||
%PROVIDER%=DeviceList,ntamd64
|
%PROVIDER%=DeviceList,ntamd64
|
||||||
|
|
||||||
|
|
||||||
[DeviceList]
|
[DeviceList]
|
||||||
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
||||||
|
|
||||||
[DeviceList.ntamd64]
|
[DeviceList.ntamd64]
|
||||||
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
||||||
|
|
||||||
|
|
||||||
[LPC1768USB]
|
[LPC1768USB]
|
||||||
include=mdmcpq.inf
|
include=mdmcpq.inf
|
||||||
CopyFiles=FakeModemCopyFileSection
|
CopyFiles=FakeModemCopyFileSection
|
||||||
@@ -28,9 +26,8 @@ AddService=usbser, 0x00000002, LowerFilter_Service_Inst
|
|||||||
[SerialPropPageAddReg]
|
[SerialPropPageAddReg]
|
||||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||||
|
|
||||||
|
|
||||||
[Strings]
|
[Strings]
|
||||||
PROVIDER = "marlinfw.org"
|
PROVIDER = "marlinfw.org"
|
||||||
DRIVER.SVC = "Marlin USB Driver"
|
DRIVER.SVC = "Marlin USB Driver"
|
||||||
DESCRIPTION= "Marlin USB Serial"
|
DESCRIPTION= "Marlin USB Serial"
|
||||||
COMPOSITE = "Marlin USB VCOM"
|
COMPOSITE = "Marlin USB VCOM"
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -61,7 +61,6 @@
|
|||||||
|
|
||||||
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
||||||
|
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#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)
|
#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
|
#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.
|
// needed due to the speed and mode required for communicating with each device being different.
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
* resulted in using about about 25% of the CPU's time.
|
* resulted in using about about 25% of the CPU's time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,8 +40,6 @@
|
|||||||
DefaultSerial3 MSerial2(false, Serial2);
|
DefaultSerial3 MSerial2(false, Serial2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define WDT_CONFIG_PER_7_Val 0x9u
|
#define WDT_CONFIG_PER_7_Val 0x9u
|
||||||
#define WDT_CONFIG_PER_Pos 0
|
#define WDT_CONFIG_PER_Pos 0
|
||||||
#define WDT_CONFIG_PER_7 (WDT_CONFIG_PER_7_Val << WDT_CONFIG_PER_Pos)
|
#define WDT_CONFIG_PER_7 (WDT_CONFIG_PER_7_Val << WDT_CONFIG_PER_Pos)
|
||||||
@@ -165,7 +163,6 @@ void MarlinHAL::adc_init() {
|
|||||||
ADC->REFCTRL.reg = ADC_REFCTRL_REFSEL_INTVCC1;
|
ADC->REFCTRL.reg = ADC_REFCTRL_REFSEL_INTVCC1;
|
||||||
ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_32| ADC_AVGCTRL_ADJRES(4);;
|
ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_32| ADC_AVGCTRL_ADJRES(4);;
|
||||||
|
|
||||||
|
|
||||||
ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV128 |
|
ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV128 |
|
||||||
ADC_CTRLB_RESSEL_16BIT |
|
ADC_CTRLB_RESSEL_16BIT |
|
||||||
ADC_CTRLB_FREERUN;
|
ADC_CTRLB_FREERUN;
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
|
|||||||
extern DefaultSerial2 MSerial0;
|
extern DefaultSerial2 MSerial0;
|
||||||
extern DefaultSerial3 MSerial1;
|
extern DefaultSerial3 MSerial1;
|
||||||
|
|
||||||
|
|
||||||
#define __MSERIAL(X) MSerial##X
|
#define __MSERIAL(X) MSerial##X
|
||||||
#define _MSERIAL(X) __MSERIAL(X)
|
#define _MSERIAL(X) __MSERIAL(X)
|
||||||
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
||||||
|
|||||||
@@ -57,8 +57,6 @@
|
|||||||
: (P == 3 && WITHIN(B, 20, 21)) ? 10 + (B) - 20 \
|
: (P == 3 && WITHIN(B, 20, 21)) ? 10 + (B) - 20 \
|
||||||
: -1)
|
: -1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define A2_AIN 3
|
#define A2_AIN 3
|
||||||
#define A3_AIN 4
|
#define A3_AIN 4
|
||||||
#define A4_AIN 5
|
#define A4_AIN 5
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user