Compare commits

...

125 Commits

Author SHA1 Message Date
Ben V. Brown
72e0c17ebf Merge pull request #1153 from federicodilo/patch-14
Update IT_translation
2022-01-03 18:36:39 +11:00
federicodilo
a1cfbf8f68 Update IT_translation
Fix in Hall sensor sensitivity sentence.
2021-12-29 19:46:10 +01:00
Ben V. Brown
4c29cbabd5 Merge pull request #1149 from Ralim/handle-menu-sizing-better
Handle menu sizing better
2021-12-29 23:31:35 +11:00
Ben V. Brown
9a9a98957d Update Settings.cpp
Set a default sane PD timeout
2021-12-29 23:02:18 +11:00
Ben V. Brown
9961411435 Drop volt symbol as its offscreen 2021-12-29 22:55:07 +11:00
Ben V. Brown
8d84a51dc6 Merge branch 'master' into handle-menu-sizing-better 2021-12-29 22:14:33 +11:00
Ben V. Brown
53eb92c262 Merge pull request #1144 from slycordinator/generic_shellscripts
Generic shellscripts
2021-12-29 17:24:46 +11:00
Ben V. Brown
16db0c7c0b Fix missed limit settings 2021-12-29 17:22:30 +11:00
Ben V. Brown
f945360437 Compensate scrollbar for skipped screens 2021-12-29 17:19:11 +11:00
Ben V. Brown
07b692e330 Recalculate scroll size on value change 2021-12-29 17:16:58 +11:00
Ben V. Brown
6d3a52e32b Extract menu size calc 2021-12-29 17:03:05 +11:00
slycordinator
48b9097c2c update flash_ts100_linux.sh
Change to more generic /bin/sh script

* added support for using on shells that don't have UID variable; uses UID if it's available and calls "id -u" when it's not
* modified quoting as recommended by shellcheck
* changed to not use "$?" to check for failure. Now uses "if ! (command); then (fail condition); fi" for when a command fails
2021-12-27 16:26:54 +09:00
slycordinator
47b0d287bb update buildAll.sh
Doesn't use anything bash-specific so it can be a /bin/sh script
2021-12-27 16:10:55 +09:00
slycordinator
5aa30f2b05 update build.sh
Modified quoting/variables as recommended by shellcheck
2021-12-27 16:07:55 +09:00
slycordinator
6dfab0ae3c update build.sh
Doesn't use anything bash-specific, so can be a /bin/sh script
2021-12-27 16:04:51 +09:00
slycordinator
82fdd74be7 update setup.sh
Doesn't use anything bash-specific, so it can be a /bin/sh script

Added quotes to MDPATH variable, as recommended by shellcheck utility
2021-12-27 16:03:39 +09:00
slycordinator
ccddb1ebdc Update start_dev.sh
Doesn't use anything bash-specific, so it can be /bin/sh
2021-12-27 16:00:56 +09:00
Ben V. Brown
f13b7be3d9 Merge pull request #1138 from discip/patch-1
updated graphics for idle screen & for missing tip
2021-12-27 10:01:33 +11:00
Ben V. Brown
c2a8b432d8 Merge branch 'master' into patch-1 2021-12-27 09:43:13 +11:00
Ben V. Brown
bd19d3549b Merge pull request #1143 from discip/patch-2
Tackling issue #1140
2021-12-27 09:42:43 +11:00
discip
00b8115e7c all three 2021-12-26 23:24:55 +01:00
discip
e2613d2f31 update 2021-12-26 16:59:03 +01:00
discip
f34fb53119 Update gui.cpp 2021-12-26 15:55:11 +01:00
discip
8f32267340 fix_IIa 2021-12-26 15:52:20 +01:00
discip
52a13dae27 fix_II 2021-12-26 15:49:32 +01:00
discip
c2d9631efd Update gui.cpp 2021-12-26 15:42:33 +01:00
discip
30b632fc19 fix 2021-12-26 15:38:05 +01:00
discip
c3406112cd Update gui.cpp 2021-12-26 14:59:10 +01:00
discip
822c3da3ba tackling #1140
https://github.com/Ralim/IronOS/issues/1140
2021-12-26 01:26:26 +01:00
discip
cc3988be24 maybe this time 2021-12-22 03:44:36 +01:00
discip
bf1fc1c157 just preparing 2021-12-22 03:12:31 +01:00
discip
95ccb528e1 updated graphics for idle screen & for missing tip 2021-12-22 00:03:28 +01:00
Ben V. Brown
a0eb5b5d06 Merge pull request #1137 from onxblog/patch-2
Updated translation of the PD section
2021-12-21 08:49:29 +11:00
Alex
7ae7ecbd0b Updated translation of the PD section
Updated translation of the PD section
2021-12-20 16:40:54 +02:00
Ben V. Brown
ca35772db9 Merge pull request #1136 from discip/patch-1
changed POWER_PULSE since 100 would display as 0.0
2021-12-20 11:26:00 +11:00
discip
13bce53249 changed POWER_PULSE since 100 would display as 0.0 2021-12-20 00:57:57 +01:00
Ben V. Brown
4dce812cf9 Merge pull request #1098 from discip/disconnected-tip
Disconnected tip pic in detailed idle screen
2021-12-20 09:28:47 +11:00
Ben V. Brown
5ad124f39d Merge pull request #1117 from Ralim/fix/1116
Address settings bounds checks #1116
Pull in fix for PD PPS
2021-12-19 19:17:24 +11:00
Ben V. Brown
bee384defd Merge branch 'master' into fix/1116 2021-12-19 19:09:17 +11:00
Ben V. Brown
7a654caf2a Handle different calibration offset ranges for MHP30 2021-12-19 11:23:42 +11:00
Ben V. Brown
47929e9ee0 Update PD stack 2021-12-19 10:57:57 +11:00
Ben V. Brown
e33b900cff Rework settings to be min-max inclusive 2021-12-19 10:21:19 +11:00
Ben V. Brown
6d7fc2f689 Update configuration.h 2021-12-15 11:19:35 +11:00
Ben V. Brown
1662a8bbc0 Merge pull request #1134 from playday3008/upd-uk
Update translation_UK.json
2021-12-11 10:04:07 +11:00
PlayDay
b22822f229 Update translation_UK.json
Using this PR #1131

Co-Authored-By: Ihor Bats <batsihor@gmail.com>
2021-12-05 08:26:07 +01:00
Ben V. Brown
509e903800 Merge pull request #1130 from Ralim/dependabot/github_actions/actions/cache-2.1.7
chore(deps): bump actions/cache from 2.1.6 to 2.1.7
2021-11-30 20:50:41 +11:00
dependabot[bot]
128ecb425d chore(deps): bump actions/cache from 2.1.6 to 2.1.7
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.6...v2.1.7)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-29 12:06:12 +00:00
Ben V. Brown
092f195182 Merge pull request #1115 from onxblog/patch-1
New translations
2021-11-29 13:15:59 +11:00
Ben V. Brown
44b849ae24 Merge branch 'master' into patch-1 2021-11-29 11:59:41 +11:00
Ben V. Brown
284de30bb8 Merge pull request #1127 from contactalexliu/patch-translation_ZH_CN-1
Improve Simplified Chinese translations
2021-11-28 23:04:03 +11:00
Ben V. Brown
3fade684d5 Merge pull request #1128 from contactalexliu/patch-custom-multi-lang-combinations-1
Add custom multi-language build options and improve build docs
2021-11-28 14:44:13 +11:00
Ben V. Brown
d5ded11050 Merge branch 'master' into patch-translation_ZH_CN-1 2021-11-28 14:36:16 +11:00
Ben V. Brown
b2357ec8f6 Merge pull request #1129 from alvinhochun/zh-fixes
Some improvements for Traditional Chinese and Cantonese
2021-11-28 12:49:30 +11:00
Alvin Wong
4042e616da Translate more strings for zh-TW and yue-HK
Didn't translate these strings before as I didn't feel there is enough
room to accurately translate them, but now I have a change of heart.
2021-11-27 21:01:52 +08:00
Alvin Wong
d72a207b36 Fix character writing in yue-HK
俗字「辣雞」-> 正字「焫雞」
2021-11-27 20:54:00 +08:00
Alex Liu
e052cd05bb Refine Simplified Chinese translations
Some Simplified Chinese translations were further improved to be more in line with the vernacular.
2021-11-27 04:52:01 -08:00
Alvin Wong
6000fa47f7 Fix typo with zh-TW
錯別字:「鉻鐵」->「烙鐵」
2021-11-27 20:51:36 +08:00
Alex Liu
d5b6ef368a Update build instructions and examples
Updated and clarified how to build IronOS for different models with single or multiple, preset or custom, languages on macOS and Linux.
2021-11-27 04:20:57 -08:00
Alex Liu
8bb26eb39c Enable custom language combinations at build time
Added a parameter to allow custom language combinations to be selected at build time.
2021-11-27 03:38:36 -08:00
Alex Liu
e80610d6fd Improve Simplified Chinese translations
Some Simplified Chinese translations were improved to be more in line with the vernacular.
2021-11-27 03:22:15 -08:00
Ben V. Brown
882bd68036 Merge pull request #1121 from Devnol/master
Add Greek font table and GR translation
2021-11-24 17:46:56 +11:00
Ben V. Brown
7743aee1f5 Merge pull request #1123 from lidacity/master
add new language (Belarussian)
2021-11-24 17:42:44 +11:00
lidacity
a3990adb39 correct Belarussian language
BY -> BE (ISO language code)
2021-11-23 20:09:45 +03:00
Devnol
8d9cbab79e change translation filename to EL
Signed-off-by: Devnol <pgkoutsoumanis@gmail.com>
2021-11-23 16:09:01 +02:00
lidacity
26c95dfad6 дадана беларуская мова
добавлен файл с белорусским языком
2021-11-22 11:52:47 +03:00
Devnol
9e6783c1d5 Make indentation consistent in font_tables.py
Signed-off-by: Devnol <pgkoutsoumanis@gmail.com>
2021-11-20 19:10:59 +02:00
Devnol
ac769c109a Fix some half height glyphs
Signed-off-by: Devnol <pgkoutsoumanis@gmail.com>
2021-11-20 18:58:58 +02:00
Devnol
e0f9809693 Fix issues pointed out by @alvinhochun
Signed-off-by: Devnol <pgkoutsoumanis@gmail.com>
2021-11-20 18:05:06 +02:00
Devnol
63cf8aa437 Add Greek font table and GR translation
Signed-off-by: Devnol <pgkoutsoumanis@gmail.com>
2021-11-20 17:52:26 +02:00
Ben V. Brown
b29c5a9602 Address settings bounds checks 2021-11-19 19:52:14 +11:00
Alex
472b6ceb77 Fix sentence
Fix sentence
2021-11-17 01:42:40 +02:00
Alex
19fb0deb2f New translations
Added new translations
2021-11-17 01:27:13 +02:00
Ben V. Brown
bc7d106c9f Merge pull request #1108 from discip/master
fix for disconnected tip icon in lefty mode
2021-11-06 08:16:02 +11:00
discip
63f777d553 Update Font.h 2021-10-28 20:55:38 +02:00
discip
73bedf3981 Update GUIThread.cpp 2021-10-28 19:48:14 +02:00
discip
6fe01721e7 Update Font.h 2021-10-28 19:47:40 +02:00
Ben V. Brown
d6f059cc43 Merge pull request #1106 from Ralim/ralim/1105
Fix #1105
2021-10-17 11:29:10 +11:00
Ben V. Brown
ca02f7606b Fix #1105 2021-10-17 11:20:03 +11:00
Ben V. Brown
2fcccbc310 Merge pull request #1103 from alvinhochun/alvin/fix-jp-translation
Fix Japanese translation
2021-10-14 09:43:55 +11:00
Alvin Wong
5e2d696260 Revert "Update translation_JA_JP.json"
This reverts commit 20c2b78e38.
2021-10-13 00:06:44 +08:00
Alvin Wong
d60244c0da Remove obsolete msgs from translation_JA_JP.json 2021-10-12 23:53:14 +08:00
discip
d72b27543b Merge branch 'master' into disconnected-tip 2021-10-02 13:30:06 +02:00
Ben V. Brown
d6af4654b3 Fix #1089 2021-10-02 15:03:50 +10:00
Ben V. Brown
3594604efc Fixes for I2C on Pinecil + USB-PD stack (#1099)
* Remove unused includes

* Adding in submodule

* Move fusb functions to the BSP

* Remove old code

* Creating IronOS PD integration wrapper

* Redirect to wrapper

* pd lib updates

* fix Docker build

* Finish linking across

* Cleanup

* Update Makefile

* Update push.yml

* Update push.yml

* PD -> Compensate for different tick rates

* Update codeql-analysis.yml

* Fix PD #define for @Firebie

* Check irq low at start

* Update BSP.h

* Update main.cpp

* Closer delay

* Update OLED.cpp

* Bugfix trying to start QC too early

* Missing fusb shouldnt hang qc

* Update FreeRTOSConfig.h

* Update the GD drivers

* Update Pinecil IRQ setup

* Redirect printf() to uart

* Update Power.cpp

* Adding extras to PD state

* Update USBPD.cpp

* Delay in printf

* Iterate once before delay on start

* Update usb-pd

* master usb-pd now

* Format gd libs

* Update gd32vf103_bkp.c

* Guard with PD timeout

* Remove CodeQL

* Slow for testing, fix runt pulses at start

* Fix runt pulse in read size 1

* Cleaner probing setup

* Testing delay during stop gen in read 1

* Update I2C driver

* Update gd32vf103_i2c.c

* Cleaning up i2c wrapper a little, given up on dma for rx

* Update preRTOS.cpp

* Update Setup.cpp

* Update MOVThread.cpp

* Slow down UART to work with new clock config

* Better ack setup for 2 byte read

* Cleanup POW_PD so cant be lost in #includes

* tipResistance -> TIP_RESISTANCE

* handle NOP race on len==2

* Update configuration.h

* Dont use neg timeout to mask anymore

* Not required for MHP

* Fix up source display Miniware

* Fix race on PD init

* Update POWThread.cpp

* Update formatting

* MHP format

* Update push.yml

* Faster TS80P I2C

* Bugfix for IRQ handlers

* Correctly handle I2C race on PD access

* Fix CI error (unused var) and MHP IRQ

* Test Pinecil alt ADC mode
2021-10-02 14:48:58 +10:00
discip
dfe96c3eca Merge branch 'master' into disconnected-tip 2021-10-01 11:26:49 +02:00
discip
04ad5a3bfc changed idle screen & missing tip (#1097) 2021-10-01 19:23:28 +10:00
discip
994be53ae4 Update GUIThread.cpp 2021-10-01 02:12:18 +02:00
discip
5b684b6c75 changed idle screen & missing tip 2021-10-01 01:22:51 +02:00
discip
5fd16bb673 adjusted max brightness (#1087)
* Delete Development Resources/Images directory

* jpg -> png

* fix value alignment for PD timeout

* Delete 001_TS80.png

* replace TS80 logo

* Update Settings.cpp

* Update gui.cpp

* Update Settings.cpp

* adding missing en dash

* Update translation_EN.json

* Update Settings.cpp

* Update gui.cpp
2021-09-30 21:25:51 +10:00
Ben V. Brown
4f020b8f5b Merge pull request #1096 from HanaO00/patch-2
Update translation_FR.json
2021-09-30 19:15:30 +10:00
HanaO00
77df5e2f0e Update translation_FR.json 2021-09-30 10:02:53 +02:00
Ben V. Brown
07ceb46d84 Merge pull request #1090 from yuk7/patch-1
Improve translation_JA_JP.json
2021-09-29 22:37:11 +10:00
yuk7
20c2b78e38 Update translation_JA_JP.json 2021-09-29 18:57:26 +09:00
federicodilo
2d21c96339 IT translation - second update (#1088)
* Update translation_IT.json

* Update translation_IT.json
2021-09-29 08:50:31 +10:00
discip
66cf63e048 jpg -> png | fixed value alignment for PD timeout (#1086)
* Delete Development Resources/Images directory

* jpg -> png

* fix value alignment for PD timeout

* Delete 001_TS80.png

* replace TS80 logo
2021-09-28 11:40:07 +10:00
discip
fa4b2fbe9b changed power animation (#1082)
As requested https://github.com/Ralim/IronOS/issues/1078#issue-1007487827.
2021-09-27 12:40:11 +10:00
discip
45f5838067 change increment and values of brightness settings (#1083) 2021-09-27 11:35:50 +10:00
Ben V. Brown
f9fa24687f Merge pull request #1076 from Vinigas/master
Added LT translations to new entries.
2021-09-26 23:01:32 +10:00
Vinigas
a320574f50 Added LT translations to new entries. 2021-09-26 15:29:32 +03:00
Ben V. Brown
f507ec59f7 Merge pull request #1075 from HanaO00/patch-1
Update translation_FR.json
2021-09-26 17:17:36 +10:00
HanaO00
168e640676 Update translation_FR.json 2021-09-26 09:10:24 +02:00
Ben V. Brown
6d9692b7f2 Merge pull request #1063 from discip/patch-3
Update DebugMenu.md
2021-09-26 09:11:36 +10:00
Ben V. Brown
26dc6805bd Merge pull request #1074 from Ralim/ralim/named-power-source
Ralim/named power source
2021-09-26 09:11:26 +10:00
Ben V. Brown
e606e7fe03 Merge branch 'master' into patch-3 2021-09-26 08:00:46 +10:00
Ben V. Brown
9964b6ee31 Use new power names 2021-09-26 07:58:33 +10:00
Ben V. Brown
73b6ca28f2 Generate power names 2021-09-26 07:58:19 +10:00
Ben V. Brown
26c1f6e60f Merge pull request #1073 from discip/master
translation_DE & translation_EN update
2021-09-26 07:48:51 +10:00
Ben V. Brown
adc26d0087 Merge branch 'master' into master 2021-09-26 07:43:08 +10:00
Ben V. Brown
bdc8e07273 Merge pull request #1072 from alvinhochun/alvin/translations-zh-update
Update Chinese translations
2021-09-26 07:41:09 +10:00
Ben V. Brown
6f4dc024bd Merge pull request #1071 from OndroNR/patch-2
Update translation_SK.json
2021-09-26 07:40:48 +10:00
Ben V. Brown
f7bddf7d32 Merge pull request #1069 from federicodilo/patch-11
Updates in IT translation
2021-09-26 07:39:34 +10:00
discip
cfbcbaee86 Merge branch 'master' into patch-3 2021-09-25 22:01:41 +02:00
discip
5ada069f30 Update translation_EN.json 2021-09-25 21:49:58 +02:00
discip
4f2c6a58f0 Update translation_DE.json 2021-09-25 21:49:16 +02:00
discip
5c90e359f7 Merge pull request #4 from discip/patch-8
Update translation_EN.json
2021-09-25 21:39:45 +02:00
discip
b3176fcf61 Merge pull request #3 from discip/patch-7
Patch 7
2021-09-25 21:39:09 +02:00
discip
461d1c95b8 Update translation_EN.json 2021-09-25 21:38:09 +02:00
discip
512eff2e74 Update translation_DE.json 2021-09-25 21:34:48 +02:00
federicodilo
f138ac1562 Adjustments 2021-09-25 20:12:53 +02:00
Alvin Wong
4aa9a67f20 Update Chinese translations 2021-09-26 01:01:01 +08:00
Ondrej Galbavy
d4f7c34809 Update translation_SK.json 2021-09-25 17:46:42 +02:00
federicodilo
65f0224cac Update translation_IT.json 2021-09-25 13:02:30 +02:00
Ben V. Brown
d4f5aaf4bc Merge pull request #1067 from gamelaster/patch-1
Update SK translation
2021-09-25 18:46:04 +10:00
Marek Kraus
71a3e021d7 Update translation_SK.json 2021-09-25 10:31:24 +02:00
discip
9d88260016 Update DebugMenu.md 2021-09-25 03:48:25 +02:00
156 changed files with 6416 additions and 8692 deletions

View File

@@ -12,12 +12,14 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: chmod
run: chmod +x setup.sh && chmod +x source/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
- name: Cached compiler source files
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: cache-compilers
with:
@@ -57,12 +59,14 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: chmod
run: chmod +x setup.sh && chmod +x source/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
- name: Cached compiler source files
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: cache-compilers
with:
@@ -97,6 +101,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup
run: sudo apt-get update && sudo apt-get install -y python3 && pip3 install bdflib
@@ -117,12 +123,14 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: chmod
run: chmod +x setup.sh && chmod +x source/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
- name: Cached compiler source files
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: cache-compilers
with:
@@ -133,7 +141,7 @@ jobs:
${{ runner.os }}-
- name: setup
run: ./setup.sh
run: sudo apt-get update && sudo apt-get install -y make clang git python3 python3-pip && python3 -m pip install bdflib black flake8
- name: Check formatting with clang-format
run: cd source && make clean && make check-style

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "source/Core/Drivers/usb-pd"]
path = source/Core/Drivers/usb-pd
url = https://github.com/Ralim/usb-pd.git

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

View File

@@ -6,7 +6,7 @@ WORKDIR /build
RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y ca-certificates
# Install dependencies to build the firmware
RUN apt-get install -y \
make \

View File

@@ -69,9 +69,9 @@ This indicates the accelerometer that is fitted inside the unit.
This indicates the current power source for the iron.
This may change during power up as the sources are negotiated in turn.
- 0 = DC input (dumb)
- 1 = QC input (We used QC2/3 negotiation for current supply)
- 2 = PD input (We used the PD subsystem to negotiate for the current supply)
- **DC** input (dumb)
- **QC** input (We used QC2/3 negotiation for current supply)
- **PD** input (We used the PD subsystem to negotiate for the current supply)
### Max

View File

@@ -1,30 +1,86 @@
# Development
Building this software can be performed two ways, using the STMCubeIDE or using command line tools.
Building this software can be performed two ways: using the STM32CubeIDE or using command line tools.
## STM Cube IDE
## STM32CubeIDE
The easiest way to start working using the STM Cube IDE is to create a new project for the STM32F103RCTx.
Then once this is created remove the auto-generated source code.
Next drag the contents of the `source` folder into the project and choose to link to files.
You will need to update the build settings for include paths & point to the new `.ld` linker file
The easiest way to start working with the STM32CubeIDE is to create a new project for the STM32F103RCTx.
Once this is created, remove the auto-generated source code.
Next, drag the contents of the `source` folder into the project and choose to link to files.
You will need to update the build settings for include paths and point to the new `.ld` linker file.
## Developing with command line tools & building a release
## Command line tools and building a release
In the `source` folder there is a makefile that can be used to build the repository using command line tools.
when running the `make` command, specify which model of the device & the language you would like to use.
In the `source` folder there is a `Makefile` that can be used to build the repository using command line tools.
When running the `make` command, specify which model of the device and the language(s) you would like to use.
`make -j8 lang=EN model=TS80`
### macOS
To build a release instead, run the build.sh script. This will update translations and also build every language for both TS100 and TS80 models.
Use the following steps to set up a build environment for IronOS on the command line (in Terminal).
1. [Follow steps 1 3 here to install the toolchain](https://github.com/glegrain/STM32-with-macOS#0---installing-the-toolchain) needed to compile for STM32 microcontrollers.
2. Install `python`:
```
brew install python
```
3. (Optional) Update `pip` so it doesn't warn you about being out-of-date:
```
python3 -m pip install --upgrade pip
```
4. Change to the `source` directory:
```
cd source
```
5. Create a Python virtual environment for IronOS named `ironos-venv` to keep your Python installation clean:
```
python3 -m venv ironos-venv
```
6. Activate the Python virtual environment:
```
source ironos-venv/bin/activate
```
7. Install the dependencies required to run `make-translation.py`:
```
pip install bdflib
```
8. All done! See some examples below for how you can build your own IronOS.
### Examples
To build a single language Simplified Chinese firmware for the TS80P with 8 simultaneous jobs:
```
make -j8 model=TS80P firmware-ZH_CN
```
To build a European multi-language firmware for the Pinecil with as many simultaneous jobs as there are logical processors on Linux:
```
make -j$(nproc) model=Pinecil firmware-multi_European
```
To build a Cyrillic compressed multi-language firmware for the Pinecil with as many simultaneous jobs as there are logical processors on macOS:
```
make -j$(sysctl -n hw.logicalcpu) model=Pinecil firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian
```
To build a custom multi-language firmware including English and Simplified Chinese for the TS80:
```
make -j8 model=TS80 custom_multi_langs="EN ZH_CN" firmware-multi_Custom
```
To build a custom compressed multi-language firmware including German, Spanish, and French for the TS100 (note if `model` is unspecified, it will default to `TS100`):
```
make -j8 custom_multi_langs="DE ES FR" firmware-multi_compressed_Custom
```
To build a release instead, run the `build.sh` script. This will update translations and also build every language for all device models. For macOS users, replace `make -j$(nproc)` in the script with `make -j$(sysctl -n hw.logicalcpu)` before running.
## Updating languages
To update the language translation files & associated font map, execute the `make_translation.py` code from the translations directory.
To update the language translation files and their associated font maps, execute the `make_translation.py` code from the `Translations` directory.
## Building Pinecil
I highly recommend using the command line tools and using docker to run the compiler.
It's a bit more fussy on setup than the STM tooling and this is by far the easiest way.
If you _need_ an IDE I have used [Nuclei's IDE](https://nucleisys.com/download.php)
And follow same idea as the STM Cube IDE notes above.
I highly recommend using the command line tools and using Docker to run the compiler.
It's a bit more fussy on setup than the STM tooling, and this is by far the easiest way.
If you _need_ an IDE I have used [Nuclei's IDE](https://nucleisys.com/download.php).
Follow the same idea as the STM Cube IDE notes above.

View File

@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh
# TS100 Flasher for Linux by Alex Wigen (https://github.com/awigen)
DIR_TMP="/tmp/ts100"
function usage() {
usage() {
echo
echo "#################"
echo "# TS100 Flasher #"
@@ -18,36 +18,32 @@ function usage() {
}
GAUTOMOUNT=0
function disable_gautomount {
GSETTINGS=$(which gsettings)
if [ $? -ne 0 ]; then
disable_gautomount() {
if ! GSETTINGS=$(which gsettings); then
return 1
fi
gsettings get org.gnome.desktop.media-handling automount | grep true > /dev/null
if [ $? -eq 0 ]; then
if ! gsettings get org.gnome.desktop.media-handling automount | grep true > /dev/null; then
GAUTOMOUNT=1
gsettings set org.gnome.desktop.media-handling automount false
fi
}
function enable_gautomount {
enable_gautomount() {
if [ "$GAUTOMOUNT" -ne 0 ]; then
gsettings set org.gnome.desktop.media-handling automount true
fi
}
function is_attached {
output=$(lsblk -b --raw --output NAME,MODEL | grep 'DFU.*Disk')
if [ $? -ne 0 ]; then
is_attached() {
if ! output=$(lsblk -b --raw --output NAME,MODEL | grep 'DFU.*Disk'); then
return 1
fi
DEVICE=$(echo $output | awk '{print "/dev/"$1}')
DEVICE=$(echo "$output" | awk '{print "/dev/"$1}')
}
instructions="not printed"
function wait_for_ts100 {
is_attached
while [ $? -ne 0 ]; do
wait_for_ts100() {
while ! is_attached; do
if [ "$instructions" = "not printed" ]; then
echo
echo "#####################################################"
@@ -60,29 +56,27 @@ function wait_for_ts100 {
instructions="printed"
fi
sleep 0.1
is_attached
done
}
function mount_ts100 {
mount_ts100() {
mkdir -p "$DIR_TMP"
sudo mount -t msdos -o uid=$UID "$DEVICE" "$DIR_TMP"
if [ $? -ne 0 ]; then
user="${UID:-$(id -u)}"
if ! sudo mount -t msdos -o uid=$user "$DEVICE" "$DIR_TMP"; then
echo "Failed to mount $DEVICE on $DIR_TMP"
exit 1
fi
}
function umount_ts100 {
mountpoint "$DIR_TMP" > /dev/null && sudo umount "$DIR_TMP"
if [ $? -ne 0 ]; then
umount_ts100() {
if ! mountpoint "$DIR_TMP" > /dev/null && sudo umount "$DIR_TMP"; then
echo "Failed to unmount $DIR_TMP"
exit 1
fi
rmdir "$DIR_TMP"
}
function cleanup {
cleanup() {
enable_gautomount
if [ -d "$DIR_TMP" ]; then
umount_ts100
@@ -102,7 +96,7 @@ if [ ! -f "$1" ]; then
exit 1
fi
if [ $(head -c1 "$1") != ":" ] || [ $(tail -n1 "$1" | head -c1) != ":" ]; then
if [ "$(head -c1 "$1")" != ":" ] || [ "$(tail -n1 "$1" | head -c1)" != ":" ]; then
echo "'$1' doesn't look like a valid HEX file. Please provide a HEX file to flash"
usage
exit 1

View File

@@ -308,6 +308,7 @@
<select v-model="fontToAdd">
<!-- <option value="ascii_basic">ascii_basic: ASCII Basic</option> -->
<option value="latin_extended">latin_extended: Latin Extended</option>
<option value="greek">greek: Greek Glyphs</option>
<option value="cyrillic">cyrillic: Cyrillic Glyphs</option>
<option value="cjk">cjk: Chinese/Japanese/Korean</option>
</select>

View File

@@ -326,6 +326,70 @@ def get_font_map_latin_extended() -> Dict[str, bytes]:
return font
def get_font_map_greek() -> Dict[str, bytes]:
font = {
# U+0370..U+03FF Greek and Coptic
"Έ": b"\x06\xFC\xFC\x8C\x8C\x8C\x8C\x8C\x8C\x0C\x0C\x00\x00\x3F\x3F\x31\x31\x31\x31\x31\x31\x30\x30\x00",
"Α": b"\x00\x00\x00\xE0\xFC\x1F\x1F\xFC\xE0\x00\x00\x00\x00\x38\x3F\x07\x06\x06\x06\x06\x07\x3F\x38\x00",
"Β": b"\x00\xFF\xFF\xC3\xC3\xC3\xC3\xE7\xFE\xBC\x00\x00\x00\x3F\x3F\x30\x30\x30\x30\x30\x39\x1F\x0F\x00",
"Γ": b"\x00\xFF\xFF\x03\x03\x03\x03\x03\x03\x03\x03\x00\x00\x3F\x3F\x00\x00\x00\x00\x00\x00\x00\x00\x00",
"Δ": b"\x00\x00\x00\xE0\xFC\x1F\x1F\xFC\xE0\x00\x00\x00\x00\x38\x3F\x37\x30\x30\x30\x30\x37\x3F\x38\x00",
"Ε": b"\x00\xFF\xFF\xC3\xC3\xC3\xC3\xC3\xC3\x03\x03\x00\x00\x3F\x3F\x30\x30\x30\x30\x30\x30\x30\x30\x00",
"Ζ": b"\x00\x03\x03\x03\x03\xC3\xE3\x33\x1F\x0F\x03\x00\x00\x30\x3C\x3E\x33\x31\x30\x30\x30\x30\x30\x00",
"Η": b"\x00\xFF\xFF\xC0\xC0\xC0\xC0\xC0\xC0\xFF\xFF\x00\x00\x3F\x3F\x00\x00\x00\x00\x00\x00\x3F\x3F\x00",
"Θ": b"\x00\xF0\xFC\x0E\xC7\xC3\xC3\xC7\x0E\xFC\xF0\x00\x00\x03\x0F\x1C\x38\x30\x30\x38\x1C\x0F\x03\x00",
"Ι": b"\x00\x00\x00\x03\x03\xFF\xFF\x03\x03\x00\x00\x00\x00\x00\x00\x30\x30\x3F\x3F\x30\x30\x00\x00\x00",
"Κ": b"\x00\xFF\xFF\xC0\xE0\xF0\x38\x1C\x0E\x07\x03\x00\x00\x3F\x3F\x00\x01\x03\x07\x0E\x1C\x38\x30\x00",
"Λ": b"\x00\x00\x00\xE0\xFC\x1F\x1F\xFC\xE0\x00\x00\x00\x00\x38\x3F\x07\x00\x00\x00\x00\x07\x3F\x38\x00",
"Μ": b"\x00\xFF\xFF\x1E\x78\xE0\xE0\x78\x1E\xFF\xFF\x00\x00\x3F\x3F\x00\x00\x01\x01\x00\x00\x3F\x3F\x00",
"Ν": b"\x00\xFF\xFF\x0E\x38\xF0\xC0\x00\x00\xFF\xFF\x00\x00\x3F\x3F\x00\x00\x00\x03\x07\x1C\x3F\x3F\x00",
"Ξ": b"\x00\x03\x03\xC3\xC3\xC3\xC3\xC3\xC3\x03\x03\x00\x00\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x00",
"Ο": b"\x00\xF0\xFC\x0E\x07\x03\x03\x07\x0E\xFC\xF0\x00\x00\x03\x0F\x1C\x38\x30\x30\x38\x1C\x0F\x03\x00",
"Π": b"\x00\xFF\xFF\x03\x03\x03\x03\x03\x03\xFF\xFF\x00\x00\x3F\x3F\x00\x00\x00\x00\x00\x00\x3F\x3F\x00",
"Ρ": b"\x00\xFF\xFF\x83\x83\x83\x83\x83\xC7\xFE\x7C\x00\x00\x3F\x3F\x01\x01\x01\x01\x01\x01\x00\x00\x00",
"Σ": b"\x00\x03\x0F\x1F\x33\xE3\xE3\x03\x03\x03\x03\x00\x00\x30\x3C\x3E\x33\x31\x30\x30\x30\x30\x30\x00",
"Τ": b"\x00\x03\x03\x03\x03\xFF\xFF\x03\x03\x03\x03\x00\x00\x00\x00\x00\x00\x3F\x3F\x00\x00\x00\x00\x00",
"Υ": b"\x00\x03\x0F\x3C\xF0\xC0\xC0\xF0\x3C\x0F\x03\x00\x00\x00\x00\x00\x00\x3F\x3F\x00\x00\x00\x00\x00",
"Φ": b"\x00\xF8\xFC\x0E\x06\xFF\xFF\x06\x0E\xFC\xF8\x00\x00\x03\x07\x0E\x0C\x3F\x3F\x0C\x0E\x07\x03\x00",
"Χ": b"\x00\x03\x0F\x3C\xF0\xC0\xC0\xF0\x3C\x0F\x03\x00\x00\x30\x3C\x0F\x03\x00\x00\x03\x0F\x3C\x30\x00",
"Ψ": b"\x00\x3F\x7F\xE0\xC0\xFF\xFF\xC0\xE0\x7F\x3F\x00\x00\x00\x00\x00\x00\x3F\x3F\x00\x00\x00\x00\x00",
"Ω": b"\x00\xF0\xFC\x0E\x07\x03\x03\x07\x0E\xFC\xF0\x00\x00\x63\x6F\x7C\x70\x00\x00\x70\x7C\x6F\x63\x00",
"ά": b"\x00\x80\xC0\xE0\x60\x6C\x6E\x66\xC0\xE0\xE0\x00\x00\x0F\x1F\x38\x30\x30\x30\x30\x18\x3F\x3F\x20",
"έ": b"\x00\xE0\xF0\x30\x30\x36\x37\x33\x30\x70\x60\x00\x00\x1D\x3F\x33\x33\x33\x33\x33\x33\x38\x18\x00",
"ή": b"\x00\xE0\xE0\xC0\x60\x6C\x6E\xE6\xE0\xC0\x00\x00\x00\x1F\x1F\x00\x00\x00\x00\x00\x7F\x7F\x00\x00",
"ί": b"\x00\x00\x00\xEC\xEE\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x3F\x30\x30\x30\x00\x00\x00\x00",
"α": b"\x00\x80\xC0\xE0\x60\x60\x60\x60\xC0\xE0\xE0\x00\x00\x0F\x1F\x38\x30\x30\x30\x30\x18\x3F\x3F\x20",
"β": b"\x00\x00\xC0\xE0\x30\x10\x10\x30\xE0\xC0\x00\x00\x00\x00\xFF\xFF\x21\x21\x21\x33\x3F\x1E\x00\x00",
"γ": b"\x00\x60\xE0\x80\x00\x00\x00\x00\x80\xE0\x60\x00\x00\x00\x01\x07\x1E\xF8\xF8\x1E\x07\x01\x00\x00",
"δ": b"\x00\x83\xC7\xEF\x7F\x7B\x73\x63\xE3\xC3\x83\x00\x00\x0F\x1F\x38\x30\x30\x30\x30\x38\x1F\x0F\x00",
"ε": b"\x00\xE0\xF0\x30\x30\x30\x30\x30\x30\x70\x60\x00\x00\x1D\x3F\x33\x33\x33\x33\x33\x33\x38\x18\x00",
"ζ": b"\x00\x83\xC3\xE3\x63\x63\x63\x73\x3F\x1F\x00\x00\x00\x0F\x1F\x38\x30\x30\x30\xF0\xE0\x00\x00\x00",
"η": b"\x00\xE0\xE0\xC0\x60\x60\x60\xE0\xE0\xC0\x00\x00\x00\x1F\x1F\x00\x00\x00\x00\x00\x7F\x7F\x00\x00",
"θ": b"\x00\xF0\xF8\x1C\x8C\x8C\x8C\x8C\x1C\xF8\xF0\x00\x00\x0F\x1F\x38\x31\x31\x31\x31\x38\x1F\x0F\x00",
"ι": b"\x00\x00\x00\xE0\xE0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x3F\x30\x30\x30\x00\x00\x00\x00",
"κ": b"\x00\x00\xC0\xC0\x00\x00\x80\xC0\xC0\x00\x00\x00\x00\x00\x3F\x3F\x06\x0F\x1F\x39\x30\x00\x00\x00",
"λ": b"\x00\x00\x00\x00\xC0\xE0\xE0\xC0\x00\x00\x00\x00\x00\x30\x3C\x0F\x03\x00\x00\x03\x0F\x3C\x30\x00",
"μ": b"\x00\xF0\xF0\x00\x00\x00\x00\x00\xF0\xF0\x00\x00\x00\xFF\xFF\x0E\x0C\x0C\x0C\x06\x0F\x0F\x00\x00",
"ν": b"\x00\x60\xE0\x80\x00\x00\x00\x00\x80\xE0\x60\x00\x00\x00\x01\x07\x1E\x38\x38\x1E\x07\x01\x00\x00",
"ξ": b"\x00\x3C\xFE\xE7\xC3\xC3\xC3\xC3\x00\x00\x00\x00\x00\x0F\x1F\x39\x30\x30\xF0\xE0\x00\x00\x00\x00",
"ο": b"\x00\x80\xC0\xE0\x60\x60\x60\x60\xE0\xC0\x80\x00\x00\x0F\x1F\x38\x30\x30\x30\x30\x38\x1F\x0F\x00",
"π": b"\x00\x60\xE0\xE0\x60\x60\x60\xE0\xE0\x60\x00\x00\x00\x00\x3F\x3F\x00\x00\x00\x3F\x3F\x30\x00\x00",
"ρ": b"\x00\xE0\xE0\x60\x60\x60\x60\x60\xE0\xC0\x80\x00\x00\xFF\xFF\x0C\x18\x18\x18\x18\x1C\x0F\x07\x00",
"ς": b"\x00\x80\xC0\xE0\x60\x60\x60\xE0\xC0\x80\x00\x00\x00\x0F\x1F\x38\x30\x30\xF0\xE0\x03\x03\x00\x00",
"σ": b"\x00\x80\xC0\xE0\x60\x60\x60\xE0\xE0\xE0\x60\x00\x00\x0F\x1F\x38\x30\x30\x30\x38\x1F\x0F\x00\x00",
"τ": b"\x00\x60\x60\xE0\xE0\x60\x60\x60\x00\x00\x00\x00\x00\x00\x00\x1F\x3F\x30\x30\x30\x00\x00\x00\x00",
"υ": b"\x00\xE0\xE0\x00\x00\x00\x00\x00\xE0\xE0\x00\x00\x00\x0F\x1F\x38\x30\x30\x30\x38\x1F\x0F\x00\x00",
"φ": b"\x00\xC0\xE0\x70\x30\xF8\xF8\x30\x70\xE0\xC0\x00\x00\x07\x0F\x1C\x18\x7F\x7F\x18\x1C\x0F\x07\x00",
"χ": b"\x00\x70\xF0\xC0\x80\x00\x80\xC0\xF0\x70\x00\x00\x00\x70\x78\x1D\x0F\x07\x0F\x1D\x78\x70\x00\x00",
"ψ": b"\x00\xE0\xE0\x00\x00\xE0\xE0\x00\x00\xE0\xE0\x00\x00\x07\x0F\x1C\x18\x7F\x7F\x18\x1C\x0F\x07\x00",
"ω": b"\x00\xC0\xE0\x00\x00\x00\x00\x00\x00\xE0\xC0\x00\x00\x0F\x1F\x38\x38\x1E\x1E\x38\x38\x1F\x0F\x00",
"ό": b"\x00\x80\xC0\xE0\x60\x6C\x6E\x66\xE0\xC0\x80\x00\x00\x0F\x1F\x38\x30\x30\x30\x30\x38\x1F\x0F\x00",
"ύ": b"\x00\xE0\xE0\x00\x00\x0C\x0E\x06\xE0\xE0\x00\x00\x00\x0F\x1F\x38\x30\x30\x30\x38\x1F\x0F\x00\x00",
"ώ": b"\x00\xC0\xE0\x00\x00\x18\x1C\x0C\x00\xE0\xC0\x00\x00\x0F\x1F\x38\x38\x1E\x1E\x38\x38\x1F\x0F\x00",
}
return font
def get_font_map_cyrillic() -> Dict[str, bytes]:
font = {
# U+0400..U+04FF Cyrillic
@@ -750,6 +814,70 @@ def get_small_font_map_latin_extended() -> Dict[str, bytes]:
return font
def get_small_font_map_greek() -> Dict[str, bytes]:
font = {
# U+0370..U+03FF Greek and Coptic
"Έ": b"\x03\x7F\x49\x49\x49\x41",
"Α": b"\x7e\x09\x09\x09\x7e\x00",
"Β": b"\x7f\x49\x49\x49\x36\x00",
"Γ": b"\x7f\x01\x01\x01\x01\x00",
"Δ": b"\x70\x4C\x43\x4C\x70\x00",
"Ε": b"\x7f\x49\x49\x49\x41\x00",
"Ζ": b"\x61\x51\x49\x45\x43\x00",
"Η": b"\x7f\x08\x08\x08\x7f\x00",
"Θ": b"\x3E\x49\x49\x49\x3E\x00",
"Ι": b"\x00\x41\x7f\x41\x00\x00",
"Κ": b"\x7f\x08\x14\x22\x41\x00",
"Λ": b"\x70\x0C\x03\x0C\x70\x00",
"Μ": b"\x7f\x02\x0c\x02\x7f\x00",
"Ν": b"\x7f\x04\x08\x10\x7f\x00",
"Ξ": b"\x41\x49\x49\x49\x41\x00",
"Ο": b"\x3e\x41\x41\x41\x3e\x00",
"Π": b"\x7F\x01\x01\x01\x7F\x00",
"Ρ": b"\x7f\x09\x09\x09\x06\x00",
"Σ": b"\x63\x55\x49\x41\x41\x00",
"Τ": b"\x01\x01\x7f\x01\x01\x00",
"Υ": b"\x07\x08\x70\x08\x07\x00",
"Φ": b"\x0c\x12\x7f\x12\x0c\x00",
"Χ": b"\x63\x14\x08\x14\x63\x00",
"Ψ": b"\x07\x08\x7F\x08\x07\x00",
"Ω": b"\x5E\x61\x01\x61\x5E\x00",
"ά": b"\x38\x45\x45\x38\x7C\x40",
"έ": b"\x28\x55\x55\x44\x28\x00",
"ή": b"\x04\x79\x05\x04\xF8\x00",
"ί": b"\x04\x3D\x41\x40\x00\x00",
"α": b"\x38\x44\x44\x38\x7C\x40",
"β": b"\x7E\x21\x25\x25\x1A\x00",
"γ": b"\x0C\x10\x60\x10\x0C\x00",
"δ": b"\x30\x4B\x45\x49\x30\x00",
"ε": b"\x28\x54\x54\x44\x28\x00",
"ζ": b"\x00\x31\x49\x45\xC3\x00",
"η": b"\x04\x78\x04\x04\xF8\x00",
"θ": b"\x3E\x49\x49\x49\x3E\x00",
"ι": b"\x04\x3C\x40\x40\x00\x00",
"κ": b"\x00\x7C\x10\x28\x44\x00",
"λ": b"\x70\x0A\x04\x08\x70\x00",
"μ": b"\xFC\x10\x10\x3C\x20\x00",
"ν": b"\x1C\x20\x40\x20\x1C\x00",
"ξ": b"\x36\x49\x49\xC9\x00\x00",
"ο": b"\x38\x44\x44\x44\x38\x00",
"π": b"\x04\x7C\x04\x7C\x44\x00",
"ρ": b"\xF8\x24\x24\x24\x18\x00",
"ς": b"\x38\x44\x44\xC4\x04\x00",
"σ": b"\x38\x44\x44\x44\x3C\x04",
"τ": b"\x04\x3C\x44\x44\x00\x00",
"υ": b"\x3C\x40\x40\x40\x3C\x00",
"φ": b"\x18\x24\x7e\x24\x18\x00",
"χ": b"\x44\x24\x38\x48\x44\x00",
"ψ": b"\x1C\x20\x7C\x20\x1C\x00",
"ω": b"\x38\x44\x30\x44\x38\x00",
"ό": b"\x38\x45\x45\x44\x38\x00",
"ύ": b"\x3C\x41\x41\x40\x3C\x00",
"ώ": b"\x38\x45\x31\x44\x38\x00",
}
return font
def get_small_font_map_cyrillic() -> Dict[str, bytes]:
font = {
# U+0400..U+04FF Cyrillic
@@ -859,6 +987,7 @@ NAME_ASCII_BASIC: Final = "ascii_basic"
NAME_LATIN_EXTENDED: Final = "latin_extended"
NAME_CYRILLIC: Final = "cyrillic"
NAME_CJK: Final = "cjk"
NAME_GREEK: Final = "greek"
def get_font_maps_for_name(
@@ -870,5 +999,7 @@ def get_font_maps_for_name(
return get_font_map_latin_extended(), get_small_font_map_latin_extended()
elif font_name == NAME_CYRILLIC:
return get_font_map_cyrillic(), get_small_font_map_cyrillic()
elif font_name == NAME_GREEK:
return get_font_map_greek(), get_small_font_map_greek()
else:
raise ValueError("Invalid font name")

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,213 @@
{
"languageCode": "BE",
"languageLocalName": "Беларуская",
"fonts": ["ascii_basic", "latin_extended", "cyrillic"],
"messages": {
"SettingsCalibrationDone": "Каліброўка закончана!",
"SettingsCalibrationWarning": "Перад тым, як працягнуць, каліласка, упэўнецеся, што джала мае комнатную тэмпературу!",
"SettingsResetWarning": "Вы ўпэннены, што жадаеце зкінуць налады да першапачатковых значэнняў?",
"UVLOWarningString": "НАПРУГА--",
"UndervoltageString": "Нізкая напруга",
"InputVoltageString": "Сілкаванне В: ",
"WarningTipTempString": "Тэмп. джала: ",
"BadTipString": "ДЖАЛА--",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Чаканне...",
"WarningSimpleString": "ГОРАЧА!",
"WarningAdvancedString": "!!! ГАРАЧАЕ !!!\n!!! ДЖАЛА !!!",
"SleepingTipAdvancedString": "Джала:",
"IdleTipString": "Джала:",
"IdleSetString": " ->",
"TipDisconnectedString": "ДЖАЛА АДЛУЧАНА",
"SolderingAdvancedPowerPrompt": "Сілкаванне: ",
"OffString": "Выкл.",
"YourGainMessage": "Прырост:"
},
"messagesWarn": {
"ResetOKMessage": "Скід OK",
"SettingsResetMessage": ["Налады", "зкінуты!"],
"NoAccelerometerMessage": ["Ня вызначаны", "акселерометр!"],
"NoPowerDeliveryMessage": ["Няма USB-PD IC", "выяўлены!"],
"LockingKeysString": "ЗАМКНУТЫ",
"UnlockingKeysString": "АДЫМКНУТЫ",
"WarningKeysLockedString": "!ЗАМКНУТЫ!",
"WarningThermalRunaway": ["Цеплавы", "Уцякач"]
},
"characters": {
"SettingRightChar": "П",
"SettingLeftChar": "Л",
"SettingAutoChar": "А",
"SettingOffChar": "O",
"SettingSlowChar": "М",
"SettingMediumChar": "С",
"SettingFastChar": "Х",
"SettingStartNoneChar": "В",
"SettingStartSolderingChar": "П",
"SettingStartSleepChar": "Ч",
"SettingStartSleepOffChar": "К",
"SettingSensitivityOff": "А",
"SettingSensitivityLow": "Н",
"SettingSensitivityMedium": "С",
"SettingSensitivityHigh": "В",
"SettingLockDisableChar": "А",
"SettingLockBoostChar": "Т",
"SettingLockFullChar": "П",
"SettingNAChar": "Н/Д"
},
"menuGroups": {
"PowerMenu": {
"text2": ["Налады", "сілкавання"],
"desc": "Крыніца сілкавання і мінімальная напруга на ячэйку"
},
"SolderingMenu": {
"text2": ["Налады", "пайкі"],
"desc": "Налады пайкі"
},
"PowerSavingMenu": {
"text2": ["Рэжымы", "сну"],
"desc": "Налады рэжыму чакання"
},
"UIMenu": {
"text2": ["Налады", "інтэрфейсу"],
"desc": "Карыстальніцкія налады знешняга выгляду"
},
"AdvancedMenu": {
"text2": ["Дадатковыя", "налады"],
"desc": "Дадатковыя налады"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": ["Крыніца", "сілкавання"],
"desc": "Крыніца сілкавання. Усталюе напругу адсечкі. (DC 10В) (S 3,3В на ячэйку, без абмежавання магутнасці)"
},
"SleepTemperature": {
"text2": ["Тэмп.", "чакання"],
"desc": "Тэмпература рэжыму чакання"
},
"SleepTimeout": {
"text2": ["Таймаўт", "чакання"],
"desc": "Час да пераходу ў рэжым чакання (Хвіліны | Секунды)"
},
"ShutdownTimeout": {
"text2": ["Таймаут", "выключэння"],
"desc": "Час да адключэння паяльніка (Хвіліны)"
},
"MotionSensitivity": {
"text2": ["Адчувальнасць", "акселерометра"],
"desc": "Адчувальнасць акселерометра (0=Выкл. | 1=Мін. | ... | 9=Макс.)"
},
"TemperatureUnit": {
"text2": ["Адзінкі", "тэмпературы"],
"desc": "Адзінкі вымярэння тэмпературы (C=Цэльcія | F=Фарэнгейта)"
},
"AdvancedIdle": {
"text2": ["Падрабязны", "рэжым чакання"],
"desc": "Адлюстроўваць дэталёвую инфармацыю паменьшаным шрыфтом на экране чакання"
},
"DisplayRotation": {
"text2": ["Арыентацыя", "экрану"],
"desc": "Арыентацыя экрану (П=Правая рука | Л=Левая рука | А=Аўта)"
},
"BoostTemperature": {
"text2": ["t° турба", "рэжыму"],
"desc": "Тэмпература джала ў турба-рэжыме"
},
"AutoStart": {
"text2": ["Аўта", "старт"],
"desc": "Рэжым, у якім запускаецца паяльнік пры падачы сілкавання (В=Выкл. | П=Пайка | Ч=Чаканне | К=Чаканне пры комн. тэмп.)"
},
"CooldownBlink": {
"text2": ["Мігценне t°", "пры астуджэнні"],
"desc": "Міргаць тэмпературай на экране астуджэння, пакуль джага яшчэ гарачае"
},
"TemperatureCalibration": {
"text2": ["Каліброўка", "тэмпературы"],
"desc": "Каліброўка тэрмадатчыка джала"
},
"SettingsReset": {
"text2": ["Скід", "наладаў"],
"desc": "Скід наладаў да першапачатковых значэнняў"
},
"VoltageCalibration": {
"text2": ["Каліброўка", "напругі"],
"desc": "Каліброўка ўваходнай напругі (падоўжаны націск для выхаду)"
},
"AdvancedSoldering": {
"text2": ["Падрабязны", "экран пайкі"],
"desc": "Паказваць дэталёвую інформацыю на экране пайкі"
},
"ScrollingSpeed": {
"text2": ["Хуткацсь", "тексту"],
"desc": "Хуткасць гартання тэксту (М=марудна | Х=хутка)"
},
"QCMaxVoltage": {
"text2": ["Магутнасць", "сілкавання"],
"desc": "Магутнасць выкарыстоўваемай крыніцы сілкавання"
},
"PDNegTimeout": {
"text2": ["PD", "прыпынак"],
"desc": "Час чакання ўзгаднення PD з крокам 100 мс для сумяшчальнасці з некаторымі зараднымі зараднымі прыладамі QC (0: адключана)"
},
"PowerLimit": {
"text2": ["Межы", "магутнасці"],
"desc": "Максімальная магутнасць, якую можа выкарыстоўваць паяльнік (Ватт)"
},
"ReverseButtonTempChange": {
"text2": ["Інвертаваць", "кнопкі"],
"desc": "Інвертаваць кнопкі вымярэння тэмпературы"
},
"TempChangeShortStep": {
"text2": ["Крок тэмп.", "кар. нац."],
"desc": "Крок вымярэння тэмпературы пры кароткім націску кнопак"
},
"TempChangeLongStep": {
"text2": ["Крок тэмп.", "пад. нац."],
"desc": "Крок вымярэння тэмпературы пры падоўжаным націску кнопак"
},
"PowerPulsePower": {
"text2": ["Сіла імп.", "сілкав. Вт"],
"desc": "Сіла імпульса щтрымливаючага ад сну павербанку ці іншай крыніцы сілкавання"
},
"HallEffSensitivity": {
"text2": ["Эфект Хола", "адчувальнасць"],
"desc": "Узровень адчувальнасці датчыка хола ў рэжыме сну (А=Адключана | Н=Нізкі | С=Сярэдні | В=Высокі)"
},
"LockingMode": {
"text2": ["Дазволіць", "блок. кнопак"],
"desc": "Пры рабоце падоўжаны націск дзьвух кнопак блакуе іх (А=Адключана | Т=Толькі турба | П=Поўная блакіроўка)"
},
"MinVolCell": {
"text2": ["Мін.", "напр."],
"desc": "Мінімальная дазволеная напруга на ячэйку (3S: 3 - 3,7V | 4S: 2,4 - 3,7V)"
},
"AnimLoop": {
"text2": ["Зацыкленая", "анімацыя"],
"desc": "Зацыкленая анімацыя гузікаў у галоўным меню"
},
"AnimSpeed": {
"text2": ["Хуткасць", "анімацыі"],
"desc": "Хуткасць анімацыі гузікаў у галоўным меню (Мілісекунды) (А=Адключана | Н=Нізкі | С=Сярэдні | В=Высокі)"
},
"PowerPulseWait": {
"text2": ["Імпульс магутнасці", "час чакання"],
"desc": "Час чакання перад запускам кожнага імпульсу няспання (x 2.5 с)"
},
"PowerPulseDuration": {
"text2": ["Імпульс магутнасці", "працягласць"],
"desc": "Працягласць імпульсу няспання (x 250 мс)"
},
"LanguageSwitch": {
"text2": ["Мова:", " BY Беларуская"],
"desc": ""
},
"Brightness": {
"text2": ["Экран", "Яркасць"],
"desc": "Адрэгулюйце кантраснасць / яркасць OLED-экрана"
},
"ColourInversion": {
"text2": ["Экран", "Інвертаваць"],
"desc": "Інвертаваць колеры OLED-экрана"
}
}
}

View File

@@ -4,25 +4,19 @@
"fonts": ["ascii_basic", "latin_extended"],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationDone": "Kalibrierung abgeschlossen!",
"SettingsCalibrationWarning": "Vor dem Fortfahren muss die Lötspitze vollständig abgekühlt sein!",
"SettingsResetWarning": "Sicher, dass alle Werte zurückgesetzt werden sollen?",
"UVLOWarningString": "V niedr.",
"UndervoltageString": "Unterspannung",
"InputVoltageString": "V Eingang: ",
"WarningTipTempString": "Temperatur: ",
"BadTipString": "Spitze Defekt",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Ruhemodus...",
"WarningSimpleString": "HEISS!",
"WarningAdvancedString": "! Achtung Heiß !",
"SleepingTipAdvancedString": "Temp:",
"IdleTipString": "Ist:",
"IdleSetString": " Soll:",
"TipDisconnectedString": "Spitze fehlt",
"SolderingAdvancedPowerPrompt": "Leistung: ",
"OffString": "Aus",
"YourGainMessage": "Dein Faktor:"
"OffString": "Aus"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",

View File

@@ -0,0 +1,340 @@
{
"languageCode": "EL",
"languageLocalName": "Greek",
"fonts": [
"ascii_basic",
"greek"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Πριν προχωρήσετε, παρακαλώ σιγουρευτείτε πως η μύτη βρίσκεται σε θερμοκρασία δωματίου!",
"SettingsResetWarning": "Σίγουρα θέλετε επαναφορά αρχικών ρυθμίσεων;",
"UVLOWarningString": "Χαμηλ DC",
"UndervoltageString": "Υπόταση",
"InputVoltageString": "Είσοδος V: ",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Υπνος...",
"SleepingTipAdvancedString": "Μύτη:",
"IdleTipString": "Μύτη:",
"IdleSetString": " Set:",
"TipDisconnectedString": "ΧΩΡΙΣ ΜΥΤΗ",
"SolderingAdvancedPowerPrompt": "Ενέργεια: ",
"OffString": "Απ."
},
"messagesWarn": {
"ResetOKMessage": "Επαν. OK",
"SettingsResetMessage": [
"Κάποιες ρυθμ.",
"άλλαξαν"
],
"NoAccelerometerMessage": [
"Δεν εντοπίστηκε",
"επιταχυνσιόμετρο"
],
"NoPowerDeliveryMessage": [
"Δεν εντοπίστηκε",
"κύκλωμα USB-PD"
],
"LockingKeysString": "ΚΛΕΙΔ.",
"UnlockingKeysString": "ΞΕΚΛΕΙΔ.",
"WarningKeysLockedString": [
"ΚΛΕΙΔΩΜΕΝΑ",
"ΠΛΗΚΤΡΑ!"
],
"WarningThermalRunaway": [
"Θερμική",
"Φυγή"
]
},
"characters": {
"SettingRightChar": "R",
"SettingLeftChar": "L",
"SettingAutoChar": "Α",
"SettingOffChar": "0",
"SettingSlowChar": "Α",
"SettingMediumChar": "Μ",
"SettingFastChar": "Γ",
"SettingStartNoneChar": "0",
"SettingStartSolderingChar": "Κ",
"SettingStartSleepChar": "Ζ",
"SettingStartSleepOffChar": "Υ",
"SettingSensitivityOff": "0",
"SettingSensitivityLow": "Χ",
"SettingSensitivityMedium": "Μ",
"SettingSensitivityHigh": "Υ",
"SettingLockDisableChar": "Α",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "Π",
"SettingNAChar": "Δ/Δ"
},
"menuGroups": {
"PowerMenu": {
"text2": [
"Ρυθμίσεις",
"ενέργειας"
],
"desc": "Ρυθμίσεις ενέργειας"
},
"SolderingMenu": {
"text2": [
"Ρυθμίσεις",
"κόλλησης"
],
"desc": "Ρυθμίσεις κόλλησης"
},
"PowerSavingMenu": {
"text2": [
"Λειτουργία",
"ύπνου"
],
"desc": "Ρυθμίσεις εξοικ. ενέργ."
},
"UIMenu": {
"text2": [
"Διεπαφή",
"χρήστη"
],
"desc": "Ρυθμίσεις διεπαφής χρήστη"
},
"AdvancedMenu": {
"text2": [
"Προηγμένες",
"ρυθμίσεις"
],
"desc": "Προηγμένες ρυθμίσεις"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": [
"Πηγή",
"ενέργειας"
],
"desc": "Πηγή ενέργειας. Oρισμός τάσης απενεργοποίησης. (DC 10V) (S 3.3V ανα κυψέλη, απενεργοποίηση ενεργειακού ορίου)"
},
"SleepTemperature": {
"text2": [
"Θερμοκρ.",
"ύπνου"
],
"desc": "Θερμοκρασία μύτης σε λειτ. ύπνου"
},
"SleepTimeout": {
"text2": [
"Έναρξη",
"ύπνου"
],
"desc": "Χρονικό διάστημα πρίν την ενεργοποίηση λειτουργίας ύπνου (Δ=δευτ. | Λ=λεπτά)"
},
"ShutdownTimeout": {
"text2": [
"Έναρξη",
"απενεργ."
],
"desc": "Χρονικό διάστημα πρίν την απενεργοποίηση του κολλητηριού (Λ=λεπτά)"
},
"MotionSensitivity": {
"text2": [
"Ευαισθησία",
"κίνησης"
],
"desc": "0=off | 1=λιγότερο ευαίσθητο | ... | 9=περισσότερο ευαίσθητο"
},
"TemperatureUnit": {
"text2": [
"Μονάδες",
"θερμοκρασίας"
],
"desc": "C=Κελσίου | F=Φαρενάιτ"
},
"AdvancedIdle": {
"text2": [
"Λεπτομερής",
"οθ. αδράνειας"
],
"desc": "Προβολή λεπτομερών πληροφοριών σε μικρότερη γραμματοσειρά στην οθόνη αδράνειας"
},
"DisplayRotation": {
"text2": [
"Διάταξη",
"οθόνης"
],
"desc": "R=δεξιόχειρες | L=αριστερόχειρες | Α=αυτόματο"
},
"BoostTemperature": {
"text2": [
"Θερμοκ.",
"boost"
],
"desc": "Θερμοκρασία στη \"λειτουργία boost\""
},
"AutoStart": {
"text2": [
"Ζέσταμα",
"κατά την εν."
],
"desc": "0=off | Κ=θερμ. κόλλησης | Z=αναμονή σε θερμοκρασία ύπνου μέχρι την κίνηση | Υ=αναμονή χωρίς ζέσταμα μέχρι την κίνηση"
},
"CooldownBlink": {
"text2": [
"Αναβοσβήσιμο",
"ψύξης"
],
"desc": "Αναβοσβήσιμο της ενδειξης θερμοκρασίας κατά την παύση θέρμανσης όταν η μύτη είναι ακόμα καυτή"
},
"TemperatureCalibration": {
"text2": [
"Βαθμονόμηση",
"θερμοκρασίας;"
],
"desc": "Βαθμονόμηση αρχικής θερμοκρασίας μύτης"
},
"SettingsReset": {
"text2": [
"Επαναφορά",
"εργ. ρυθμίσεων;"
],
"desc": "Επαναφορά στις προεπιλεγμένες ρυθμίσεις"
},
"VoltageCalibration": {
"text2": [
"Βαθμονόμηση",
"τάσης εισόδου;"
],
"desc": "Έναρξη βαθμονόμησης τάσης εισόδου (κράτημα για έξοδο)"
},
"AdvancedSoldering": {
"text2": [
"Λεπτομερής",
"οθ. κόλλησης"
],
"desc": "Προβολή λεπτομερών πληροφοριών σε μικρότερη γραμματοσειρά στην οθόνη κόλλησης"
},
"ScrollingSpeed": {
"text2": [
"Ταχύτητα",
"κύλισης"
],
"desc": "Ταχύτητα κύλισης κειμένου (Α=αργά | Γ=γρήγορα)"
},
"QCMaxVoltage": {
"text2": [
"Τάση",
"QC"
],
"desc": "Μέγιστη τάση QC που να ζητά το κολλητήρι από το τροφοδοτικό"
},
"PDNegTimeout": {
"text2": [
"χρονικό όριο",
"PD"
],
"desc": "Χρονικό όριο διαπραγμάτευσης PD σε βήματα 100ms για συμβατότητα με κάποιους φορτιστές QC"
},
"PowerLimit": {
"text2": [
"Ενεργειακό",
"όριο"
],
"desc": "Μέγιστη ενέργεια που μπορεί να χρησιμοποιεί το κολλητήρι (W=watt)"
},
"ReverseButtonTempChange": {
"text2": [
"Αντιστροφή",
"πλήκτρων + -"
],
"desc": "Αντιστροφή διάταξης πλήκτρων στη ρύθμιση θερμοκρασίας"
},
"TempChangeShortStep": {
"text2": [
"Αλλαγή θερμοκ.",
"στιγμιαίο"
],
"desc": "Βήμα αλλαγής θερμοκρασίας σε στιγμιαίο πάτημα πλήκτρου"
},
"TempChangeLongStep": {
"text2": [
"Αλλαγή θερμοκ.",
"παρατεταμένο"
],
"desc": "Βήμα αλλαγής θερμοκρασίας σε παρατεταμένο πάτημα πλήκτρου"
},
"PowerPulsePower": {
"text2": [
"Παλμός",
"ενέργειας"
],
"desc": "Ένταση ενέργειας παλμού διατήρησης λειτουργίας (watt)"
},
"HallEffSensitivity": {
"text2": [
"Ευαισθ. αισθ. ",
"φαιν. Hall"
],
"desc": "Ευαισθησία του αισθητήρα φαινομένου Hall για εντοπισμό αδράνειας (0=off | Χ=χαμηλή | Μ=μέτρια | Υ=υψηλή)"
},
"LockingMode": {
"text2": [
"Κλείδωμα",
"πλήκτρων"
],
"desc": "Κατά την κόλληση, κρατήστε και τα δύο πλήκτρα για κλείδωμα (A=απενεργοποίηση | B=μόνο λειτ. boost | Π=πλήρες κλείδωμα)"
},
"MinVolCell": {
"text2": [
"Ελάχιστη",
"τάση"
],
"desc": "Ελάχιστη επιτρεπτή τάση ανα κυψέλη (3 σε σειρά: 3 - 3.7V | 4-6 σε σειρά: 2.4 - 3.7V)"
},
"AnimLoop": {
"text2": [
"Επανάληψη",
"κιν. εικονιδ."
],
"desc": "Επανάληψη κίνησης εικονιδίων στο αρχικό μενού"
},
"AnimSpeed": {
"text2": [
"Ταχύτητα",
"κιν. εικονιδ."
],
"desc": "Ρυθμός κίνησης εικονιδίων στο μενού (0=off | Α=αργός | Μ=μέτριος | Γ=γρήγορος"
},
"PowerPulseWait": {
"text2": [
"Καθυστέρηση",
"παλμού ενέργ."
],
"desc": "Καθυστέρηση πριν την ενεργοποίση παλμού διατήρησης λειτουργίας (x 2.5s)"
},
"PowerPulseDuration": {
"text2": [
"Διάρκεια",
"παλμού ενέργ."
],
"desc": "Διάρκεια παλμού διατήρησης ενέργειας (x 250ms)"
},
"LanguageSwitch": {
"text2": [
"Γλώσσα",
" GR Ελληνικά"
],
"desc": "Τρέχουσα γλώσσα λογισμικού"
},
"Brightness": {
"text2": [
"Αντίθεση",
"οθόνης"
],
"desc": "Ρύθμιση φωτεινότητας οθόνης OLED"
},
"ColourInversion": {
"text2": [
"Αντιστροφή",
"χρωμάτων"
],
"desc": "Αντιστροφή χρωμάτων οθόνης OLED"
}
}
}

View File

@@ -4,25 +4,19 @@
"fonts": ["ascii_basic"],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationDone": "Calibration done!",
"SettingsCalibrationWarning": "Please ensure the tip is at room temperature, before continuing!",
"SettingsCalibrationWarning": "Please ensure the tip is at room temperature, before proceeding!",
"SettingsResetWarning": "Sure you want to restore default settings?",
"UVLOWarningString": "DC LOW",
"UndervoltageString": "Undervoltage",
"InputVoltageString": "Input V: ",
"WarningTipTempString": "Tip temp: ",
"BadTipString": "BAD TIP",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Sleeping...",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "!!! HOT TIP !!!",
"SleepingTipAdvancedString": "Tip:",
"IdleTipString": "Tip:",
"IdleSetString": " Set:",
"TipDisconnectedString": "NO TIP",
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "Off",
"YourGainMessage": "Your gain:"
"OffString": "Off"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
@@ -156,15 +150,15 @@
},
"ReverseButtonTempChange": {
"text2": ["Reverse", "+ - keys"],
"desc": "Reverse assignment of temperature adjustment buttons"
"desc": "Reverse assignment of buttons for temperature adjustment"
},
"TempChangeShortStep": {
"text2": ["Temp change", "short"],
"desc": "Temperature change increment on short button press"
"desc": "Temperature-change-increment on short button press"
},
"TempChangeLongStep": {
"text2": ["Temp change", "long"],
"desc": "Temperature change increment on long button press"
"desc": "Temperature-change-increment on long button press"
},
"PowerPulsePower": {
"text2": ["Power", "pulse"],
@@ -192,7 +186,7 @@
},
"PowerPulseWait": {
"text2": ["Power pulse", "delay"],
"desc": "Delay before keep-awake pulse is triggered (x 2.5s)"
"desc": "Delay before keep-awake-pulse is triggered (x 2.5s)"
},
"PowerPulseDuration": {
"text2": ["Power pulse", "duration"],

View File

@@ -25,13 +25,13 @@
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": ["Réglages", "réinit. !"],
"SettingsResetMessage": ["Réglages", "réinitialisés !"],
"NoAccelerometerMessage": ["Accéléromètre", "non détecté !"],
"NoPowerDeliveryMessage": ["USB-PD", "non détecté !"],
"LockingKeysString": "VERROUIL",
"UnlockingKeysString": "DEVERROU",
"WarningKeysLockedString": "! VERR. !",
"WarningThermalRunaway": ["Thermal", "Runaway"]
"WarningThermalRunaway": ["Emballement", "thermique"]
},
"characters": {
"SettingRightChar": "D",
@@ -142,12 +142,12 @@
"desc": "Vitesse de défilement du texte (R=rapide | L=lent)"
},
"QCMaxVoltage": {
"text2": ["Tension", "max. QC"],
"text2": ["Tension", "QC"],
"desc": "Tension maximale désirée avec une alimentation QC"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
"text2": ["Délai", "expiration PD"],
"desc": "Délai de la negociation PD par étapes de 100ms pour la compatiblité avec certains chargeurs QC (0: désactivé)"
},
"PowerLimit": {
"text2": ["Limite de", "puissance"],
@@ -202,12 +202,12 @@
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
"text2": ["Luminosité", "de l'écran"],
"desc": "Ajuster le contraste/luminosité de l'écran OLED"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
"text2": ["Inverser", "les couleurs"],
"desc": "Inverser les couleurs de l'écran OLED"
}
}
}

View File

@@ -1,213 +1,336 @@
{
"languageCode": "IT",
"languageLocalName": "Italiano",
"fonts": ["ascii_basic", "latin_extended"],
"messages": {
"SettingsCalibrationDone": "Calibrazione effettuata",
"SettingsCalibrationWarning": "Assicurati che la punta si trovi a temperatura ambiente prima di continuare!",
"SettingsResetWarning": "Ripristinare le impostazioni iniziali?",
"UVLOWarningString": "DC BASSA",
"UndervoltageString": "DC INSUFFICIENTE",
"InputVoltageString": "V ingresso:",
"WarningTipTempString": "Temp punta:",
"BadTipString": "PUNTA KO",
"SleepingSimpleString": "Zzz ",
"SleepingAdvancedString": "Riposo",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "PUNTA CALDA!",
"SleepingTipAdvancedString": "Punta:",
"IdleTipString": "T punta:",
"IdleSetString": "/",
"TipDisconnectedString": "PUNTA ASSENTE",
"SolderingAdvancedPowerPrompt": "Potenz:",
"OffString": "OFF",
"YourGainMessage": "Guad.: "
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": ["Impostazioni", "ripristinate"],
"NoAccelerometerMessage": ["Accelerometro", "non rilevato"],
"NoPowerDeliveryMessage": ["USB-PD non", "disponibile"],
"LockingKeysString": "Blocc.",
"UnlockingKeysString": "Sblocc.",
"WarningKeysLockedString": "BLOCCATO",
"WarningThermalRunaway": ["Thermal", "Runaway"]
},
"characters": {
"SettingRightChar": "D",
"SettingLeftChar": "S",
"SettingAutoChar": "A",
"SettingOffChar": "O",
"SettingSlowChar": "L",
"SettingMediumChar": "M",
"SettingFastChar": "V",
"SettingStartNoneChar": "D",
"SettingStartSolderingChar": "S",
"SettingStartSleepChar": "R",
"SettingStartSleepOffChar": "A",
"SettingSensitivityOff": "O",
"SettingSensitivityLow": "B",
"SettingSensitivityMedium": "M",
"SettingSensitivityHigh": "A",
"SettingLockDisableChar": "D",
"SettingLockBoostChar": "T",
"SettingLockFullChar": "C",
"SettingNAChar": "NA"
},
"menuGroups": {
"PowerMenu": {
"text2": ["Opzioni", "alimentaz"],
"desc": "Menù d'impostazioni per l'alimentazione"
},
"SolderingMenu": {
"text2": ["Opzioni", "saldatura"],
"desc": "Menù d'impostazioni della modalità Saldatura"
},
"PowerSavingMenu": {
"text2": ["Risparmio", "energetico"],
"desc": "Menù d'impostazioni per il risparmio energetico"
},
"UIMenu": {
"text2": ["Interfaccia", "utente"],
"desc": "Menù d'impostazioni dell'interfaccia utente"
},
"AdvancedMenu": {
"text2": ["Opzioni", "avanzate"],
"desc": "Menù d'impostazioni avanzate"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": ["Sorgente", "alimentaz"],
"desc": "Imposta una tensione minima di alimentazione attraverso la selezione di una sorgente [DC: 10 V; 3S/4S/5S/6S: 3,3 V per cella]"
},
"SleepTemperature": {
"text2": ["Temp", "riposo"],
"desc": "Imposta la temperatura da mantenere in modalità Riposo [°C/°F]"
},
"SleepTimeout": {
"text2": ["Timer", "riposo"],
"desc": "Imposta il timer per entrare in modalità Riposo [minuti/secondi]"
},
"ShutdownTimeout": {
"text2": ["Timer", "spegnimento"],
"desc": "Imposta il timer per lo spegnimento [minuti]"
},
"MotionSensitivity": {
"text2": ["Sensibilità", "al movimento"],
"desc": "Imposta la sensibilità al movimento per uscire dalla modalità Riposo [0: nessuna; 1: minima; 9: massima]"
},
"TemperatureUnit": {
"text2": ["Unità di", "temperatura"],
"desc": "Scegli l'unità di misura per la temperatura [C: grado Celsius; F: grado Farenheit]"
},
"AdvancedIdle": {
"text2": ["Interfaccia", "testuale"],
"desc": "Mostra informazioni dettagliate all'interno della schermata principale"
},
"DisplayRotation": {
"text2": ["Orientamento", "display"],
"desc": "Imposta l'orientamento del display [D: mano destra; S: mano sinistra; A: automatico]"
},
"BoostTemperature": {
"text2": ["Temp", "Turbo"],
"desc": "Imposta la temperatura della funzione Turbo [°C/°F]"
},
"AutoStart": {
"text2": ["Avvio", "automatico"],
"desc": "Attiva automaticamente il saldatore quando viene alimentato [D: disattiva; S: saldatura; R: riposo; A: temperatura ambiente]"
},
"CooldownBlink": {
"text2": ["Avviso", "punta calda"],
"desc": "Evidenzia il valore di temperatura durante il raffreddamento se la punta è ancora calda"
},
"TemperatureCalibration": {
"text2": ["Calibrazione", "temperatura"],
"desc": "Calibra le rilevazioni di temperatura"
},
"SettingsReset": {
"text2": ["Ripristino", "impostazioni"],
"desc": "Ripristina tutte le impostazioni"
},
"VoltageCalibration": {
"text2": ["Calibrazione", "tensione"],
"desc": "Calibra la tensione in ingresso; regola con entrambi i tasti, tieni premuto il tasto superiore per uscire"
},
"AdvancedSoldering": {
"text2": ["Dettagli", "saldatura"],
"desc": "Mostra informazioni dettagliate durante la modalità Saldatura"
},
"ScrollingSpeed": {
"text2": ["Velocità", "testo"],
"desc": "Imposta la velocità di scorrimento del testo [L: lenta; V: veloce]"
},
"QCMaxVoltage": {
"text2": ["Voltaggio", "QC"],
"desc": "Imposta il massimo voltaggio negoziabile con un alimentatore Quick Charge"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
},
"PowerLimit": {
"text2": ["Limite", "potenza"],
"desc": "Imposta il valore di potenza massima erogabile al saldatore [watt]"
},
"ReverseButtonTempChange": {
"text2": ["Inversione", "tasti"],
"desc": "Inverti i tasti per aumentare o diminuire la temperatura della punta"
},
"TempChangeShortStep": {
"text2": ["Temp passo", "breve"],
"desc": "Imposta il \"passo\" dei valori di temperatura per una breve pressione dei tasti"
},
"TempChangeLongStep": {
"text2": ["Temp passo", "lungo"],
"desc": "Imposta il \"passo\" dei valori di temperatura per una lunga pressione dei tasti"
},
"PowerPulsePower": {
"text2": ["Potenza", "impulso"],
"desc": "Regola la potenza di un \"impulso sveglia\" atto a prevenire lo standby eventuale dell'alimentatore [watt]"
},
"HallEffSensitivity": {
"text2": ["Effetto", "Hall"],
"desc": "Regola la sensibilità alla rilevazione di supporti metallici per entrare in modalità Riposo [O: OFF; B: bassa; M: media; A: alta]"
},
"LockingMode": {
"text2": ["Blocco", "tasti"],
"desc": "Blocca i tasti durante la modalità Saldatura; tieni premuto entrambi per bloccare o sbloccare [D: disattiva; T: consenti Turbo; C: blocco completo]"
},
"MinVolCell": {
"text2": ["Tensione", "min celle"],
"desc": "Modifica la tensione di minima carica delle celle di una batteria Li-Po [3S: 3,0-3,7 V; 4S/5S/6S: 2,4-3,7 V]"
},
"AnimLoop": {
"text2": ["Ciclo", "animazioni"],
"desc": "Abilita la riproduzione ciclica delle animazioni del menù principale"
},
"AnimSpeed": {
"text2": ["Velocità", "animazioni"],
"desc": "Imposta la velocità di riproduzione delle animazioni del menù principale [O: OFF; L: lenta; M: media; V: veloce]"
},
"PowerPulseWait": {
"text2": ["Distanza", "impulsi"],
"desc": "Imposta il tempo che deve intercorrere tra due \"impulsi sveglia\" [multipli di 2,5 s]"
},
"PowerPulseDuration": {
"text2": ["Durata", "impulso"],
"desc": "Regola la durata dell'«impulso sveglia» [multipli di 250 ms]"
},
"LanguageSwitch": {
"text2": ["Lingua:", " IT Italiano"],
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
}
}
"languageCode": "IT",
"languageLocalName": "Italiano",
"fonts": [
"ascii_basic",
"latin_extended"
],
"messages": {
"SettingsCalibrationWarning": "Assicurarsi che la punta si trovi a temperatura ambiente prima di continuare!",
"SettingsResetWarning": "Ripristinare le impostazioni iniziali?",
"UVLOWarningString": "DC BASSA",
"UndervoltageString": "DC INSUFFICIENTE",
"InputVoltageString": "V in:",
"SleepingSimpleString": "Zzz ",
"SleepingAdvancedString": "Riposo",
"SleepingTipAdvancedString": "Punta:",
"IdleTipString": "T punta:",
"IdleSetString": "/",
"TipDisconnectedString": "PUNTA ASSENTE",
"SolderingAdvancedPowerPrompt": "Potenz:",
"OffString": "OFF"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": [
"Impostazioni",
"ripristinate"
],
"NoAccelerometerMessage": [
"Accelerometro",
"non rilevato"
],
"NoPowerDeliveryMessage": [
"USB PD",
"non rilevato"
],
"LockingKeysString": "Blocc.",
"UnlockingKeysString": "Sblocc.",
"WarningKeysLockedString": "BLOCCATO",
"WarningThermalRunaway": [
"Temperatura",
"fuori controllo"
]
},
"characters": {
"SettingRightChar": "D",
"SettingLeftChar": "S",
"SettingAutoChar": "A",
"SettingOffChar": "O",
"SettingSlowChar": "L",
"SettingMediumChar": "M",
"SettingFastChar": "V",
"SettingStartNoneChar": "D",
"SettingStartSolderingChar": "S",
"SettingStartSleepChar": "R",
"SettingStartSleepOffChar": "A",
"SettingSensitivityOff": "O",
"SettingSensitivityLow": "B",
"SettingSensitivityMedium": "M",
"SettingSensitivityHigh": "A",
"SettingLockDisableChar": "D",
"SettingLockBoostChar": "T",
"SettingLockFullChar": "C",
"SettingNAChar": " NA"
},
"menuGroups": {
"PowerMenu": {
"text2": [
"Opzioni",
"alimentaz"
],
"desc": "Menù d'impostazioni per l'alimentazione"
},
"SolderingMenu": {
"text2": [
"Opzioni",
"saldatura"
],
"desc": "Menù d'impostazioni della modalità Saldatura"
},
"PowerSavingMenu": {
"text2": [
"Risparmio",
"energetico"
],
"desc": "Menù d'impostazioni per il risparmio energetico"
},
"UIMenu": {
"text2": [
"Interfaccia",
"utente"
],
"desc": "Menù d'impostazioni dell'interfaccia utente"
},
"AdvancedMenu": {
"text2": [
"Opzioni",
"avanzate"
],
"desc": "Menù d'impostazioni avanzate"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": [
"Sorgente",
"alimentaz"
],
"desc": "Imposta una tensione minima di alimentazione attraverso la selezione di una sorgente [DC: 10 V; 3S/4S/5S/6S: 3,3 V per cella]"
},
"SleepTemperature": {
"text2": [
"Temp",
"riposo"
],
"desc": "Imposta la temperatura da mantenere in modalità Riposo [°C/°F]"
},
"SleepTimeout": {
"text2": [
"Timer",
"riposo"
],
"desc": "Imposta il timer per entrare in modalità Riposo [minuti/secondi]"
},
"ShutdownTimeout": {
"text2": [
"Timer",
"spegnimento"
],
"desc": "Imposta il timer per lo spegnimento [minuti]"
},
"MotionSensitivity": {
"text2": [
"Sensibilità",
"al movimento"
],
"desc": "Imposta la sensibilità al movimento per uscire dalla modalità Riposo [0: nessuna; 1: minima; 9: massima]"
},
"TemperatureUnit": {
"text2": [
"Unità di",
"temperatura"
],
"desc": "Scegli l'unità di misura per la temperatura [C: grado Celsius; F: grado Farenheit]"
},
"AdvancedIdle": {
"text2": [
"Interfaccia",
"testuale"
],
"desc": "Mostra informazioni dettagliate all'interno della schermata principale"
},
"DisplayRotation": {
"text2": [
"Orientamento",
"schermo"
],
"desc": "Imposta l'orientamento dello schermo [D: mano destra; S: mano sinistra; A: automatico]"
},
"BoostTemperature": {
"text2": [
"Temp",
"Turbo"
],
"desc": "Imposta la temperatura della funzione Turbo [°C/°F]"
},
"AutoStart": {
"text2": [
"Avvio",
"automatico"
],
"desc": "Attiva automaticamente il saldatore quando viene alimentato [D: disattiva; S: saldatura; R: riposo; A: temperatura ambiente]"
},
"CooldownBlink": {
"text2": [
"Avviso",
"punta calda"
],
"desc": "Evidenzia il valore di temperatura durante il raffreddamento se la punta è ancora calda"
},
"TemperatureCalibration": {
"text2": [
"Calibrazione",
"temperatura"
],
"desc": "Calibra le rilevazioni di temperatura"
},
"SettingsReset": {
"text2": [
"Ripristino",
"impostazioni"
],
"desc": "Ripristina le impostazioni allo stato iniziale"
},
"VoltageCalibration": {
"text2": [
"Calibrazione",
"tensione"
],
"desc": "Calibra la tensione in ingresso; regola con entrambi i tasti, tieni premuto il tasto superiore per uscire"
},
"AdvancedSoldering": {
"text2": [
"Dettagli",
"saldatura"
],
"desc": "Mostra informazioni dettagliate durante la modalità Saldatura"
},
"ScrollingSpeed": {
"text2": [
"Velocità",
"testo"
],
"desc": "Imposta la velocità di scorrimento del testo [L: lenta; V: veloce]"
},
"QCMaxVoltage": {
"text2": [
"Voltaggio",
"QC"
],
"desc": "Imposta il massimo voltaggio negoziabile con un alimentatore Quick Charge [volt]"
},
"PDNegTimeout": {
"text2": [
"Abilitazione",
"USB PD"
],
"desc": "Regola il massimo tempo utile per la negoziazione del protocollo USB Power Delivery con alimentatori compatibili [0: disattiva; multipli di 100 ms]"
},
"PowerLimit": {
"text2": [
"Limite",
"potenza"
],
"desc": "Imposta il valore di potenza massima erogabile al saldatore [watt]"
},
"ReverseButtonTempChange": {
"text2": [
"Inversione",
"tasti"
],
"desc": "Inverti i tasti per aumentare o diminuire la temperatura della punta"
},
"TempChangeShortStep": {
"text2": [
"Temp passo",
"breve"
],
"desc": "Imposta il passo dei valori di temperatura per una breve pressione dei tasti"
},
"TempChangeLongStep": {
"text2": [
"Temp passo",
"lungo"
],
"desc": "Imposta il passo dei valori di temperatura per una lunga pressione dei tasti"
},
"PowerPulsePower": {
"text2": [
"Potenza",
"impulso"
],
"desc": "Regola la potenza di un \"impulso sveglia\" atto a prevenire lo standby eventuale dell'alimentatore [watt]"
},
"HallEffSensitivity": {
"text2": [
"Sensore",
"Hall"
],
"desc": "Regola la sensibilità del sensore ad effetto Hall per entrare in modalità Riposo [O: OFF; B: bassa; M: media; A: alta]"
},
"LockingMode": {
"text2": [
"Blocco",
"tasti"
],
"desc": "Blocca i tasti durante la modalità Saldatura; tieni premuto entrambi per bloccare o sbloccare [D: disattiva; T: consenti Turbo; C: blocco completo]"
},
"MinVolCell": {
"text2": [
"Tensione",
"min celle"
],
"desc": "Modifica la tensione di minima carica delle celle di una batteria Li-Po [3S: 3,0-3,7 V; 4S/5S/6S: 2,4-3,7 V]"
},
"AnimLoop": {
"text2": [
"Ciclo",
"animazioni"
],
"desc": "Abilita la riproduzione ciclica delle animazioni del menù principale"
},
"AnimSpeed": {
"text2": [
"Velocità",
"animazioni"
],
"desc": "Imposta la velocità di riproduzione delle animazioni del menù principale [O: OFF; L: lenta; M: media; V: veloce]"
},
"PowerPulseWait": {
"text2": [
"Distanza",
"impulsi"
],
"desc": "Imposta il tempo che deve intercorrere tra due \"impulsi sveglia\" [multipli di 2,5 s]"
},
"PowerPulseDuration": {
"text2": [
"Durata",
"impulso"
],
"desc": "Regola la durata dell'«impulso sveglia» [multipli di 250 ms]"
},
"LanguageSwitch": {
"text2": [
"Lingua:",
" IT Italiano"
],
"desc": "Imposta la lingua del dispositivo"
},
"Brightness": {
"text2": [
"Luminosità",
"schermo"
],
"desc": "Regola la luminosità dello schermo [1: minimo; 10: massimo]"
},
"ColourInversion": {
"text2": [
"Inverti",
"colori"
],
"desc": "Inverti i colori dello schermo"
}
}
}

View File

@@ -4,25 +4,19 @@
"fonts": ["ascii_basic", "cjk"],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationDone": "校正完了",
"SettingsCalibrationWarning": "続行する前に、コテ先が室温と同じになっていることを確認してください",
"SettingsResetWarning": "設定をリセットしますか?",
"UVLOWarningString": "電圧が低すぎます",
"UndervoltageString": "Undervoltage",
"InputVoltageString": "Input V: ",
"WarningTipTempString": "Tip temp: ",
"BadTipString": "BAD TIP",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Sleeping...",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "!!! HOT TIP !!!",
"SleepingTipAdvancedString": "Tip:",
"IdleTipString": "Tip:",
"IdleSetString": " Set:",
"TipDisconnectedString": "NO TIP",
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "オフ",
"YourGainMessage": "Your gain:"
"OffString": "オフ"
},
"messagesWarn": {
"ResetOKMessage": "リセットOK",

View File

@@ -31,7 +31,7 @@
"LockingKeysString": " UŽRAKIN",
"UnlockingKeysString": "ATRAKIN",
"WarningKeysLockedString": "!UŽRAK!",
"WarningThermalRunaway": ["Thermal", "Runaway"]
"WarningThermalRunaway": ["Perkaitimo", "pavojus"]
},
"characters": {
"SettingRightChar": "D",
@@ -202,12 +202,12 @@
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
"text2": ["Ekrano", "šviesumas"],
"desc": "Nustato OLED ekrano kontrastą/šviesumą."
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
"text2": ["Ekrano", "invertavimas"],
"desc": "Invertuoja OLED ekrano spalvas."
}
}
}

View File

@@ -146,8 +146,8 @@
"desc": "Мощность используемого источника питания"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
"text2": ["PD", "тайм-аут"],
"desc": "Power Delivery тайм-аут согласования с шагом 100 мс для совместимости с некоторыми быстрыми зарядными QC (0: отключено)"
},
"PowerLimit": {
"text2": ["Предел", "мощности"],
@@ -190,24 +190,24 @@
"desc": "Скорость анимации иконок в главном меню (Милисекунды) (О=Отключено | Н=Низкий | С=Средний | В=Высокий)"
},
"PowerPulseWait": {
"text2": ["Power pulse", "wait time"],
"desc": "Time to wait before triggering every keep-awake pulse (x 2,5с)"
"text2": ["Пауза имп.", "питания с"],
"desc": "Пауза между импульсами удерживающими источник питания от сна (x 2,5с)"
},
"PowerPulseDuration": {
"text2": ["Power pulse", "duration"],
"desc": "Keep-awake-pulse duration (x 250мс)"
"text2": ["Длина имп.", "питания мс"],
"desc": "Длина импульса удерживающего от сна источник питания (x 250мс)"
},
"LanguageSwitch": {
"text2": ["Язык:", " RU Русский"],
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
"text2": ["Яркость", "экрана"],
"desc": "Настройки контраста/яркости OLED экрана"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
"text2": ["Инверт", "экрана"],
"desc": "Инвертировать цвета на OLED экране"
}
}
}

View File

@@ -1,213 +1,336 @@
{
"languageCode": "SK",
"languageLocalName": "Slovenčina",
"fonts": ["ascii_basic", "latin_extended"],
"messages": {
"SettingsCalibrationDone": "Kalibrácia hotová!",
"SettingsCalibrationWarning": "Najprv sa prosím uistite, že hrot má izbovú teplotu!",
"SettingsResetWarning": "Naozaj chcete obnovit továrenské nastavenia?",
"UVLOWarningString": "Nízke U!",
"UndervoltageString": "Nízke napätie",
"InputVoltageString": "Vstupné U: ",
"WarningTipTempString": "Tep. hrotu: ",
"BadTipString": "ZLÝ HROT",
"SleepingSimpleString": "Chrr",
"SleepingAdvancedString": "Pokojový režim..",
"WarningSimpleString": "PÁLI",
"WarningAdvancedString": "HROT JE HORÚCI !",
"SleepingTipAdvancedString": "Hrot:",
"IdleTipString": "Hrot:",
"IdleSetString": "Cieľ:",
"TipDisconnectedString": "HROT ODPOJENÝ",
"SolderingAdvancedPowerPrompt": "Výkon: ",
"OffString": "Vyp",
"YourGainMessage": "Zisk:"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": ["Tov. nas. obnov.", ""],
"NoAccelerometerMessage": ["Bez pohyb. senz.", ""],
"NoPowerDeliveryMessage": ["Chýba čip USB-PD", ""],
"LockingKeysString": "ZABLOK.",
"UnlockingKeysString": "ODBLOK.",
"WarningKeysLockedString": "!ZABLOK!",
"WarningThermalRunaway": ["Thermal", "Runaway"]
},
"characters": {
"SettingRightChar": "P",
"SettingLeftChar": "L",
"SettingAutoChar": "A",
"SettingOffChar": "Z",
"SettingSlowChar": "P",
"SettingMediumChar": "M",
"SettingFastChar": "R",
"SettingStartNoneChar": "V",
"SettingStartSolderingChar": "Z",
"SettingStartSleepChar": "S",
"SettingStartSleepOffChar": "I",
"SettingSensitivityOff": "Z",
"SettingSensitivityLow": "N",
"SettingSensitivityMedium": "S",
"SettingSensitivityHigh": "V",
"SettingLockDisableChar": "Z",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "P",
"SettingNAChar": "N/A"
},
"menuGroups": {
"PowerMenu": {
"text2": ["Power", "settings"],
"desc": "Power settings"
},
"SolderingMenu": {
"text2": ["Nastavenie", "spájkovania"],
"desc": "Nastavenie spájkovania"
},
"PowerSavingMenu": {
"text2": ["Úsporný", "režim"],
"desc": "Nastavenia režimov úspory energie"
},
"UIMenu": {
"text2": ["Nastavenie", "zobrazenia"],
"desc": "Nastavenie zobrazenia"
},
"AdvancedMenu": {
"text2": ["Pokročilé", "nastavenia"],
"desc": "Pokročilé nastavenia"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": ["Zdroj", "napätia"],
"desc": "Zdroj napätia. Nastavenie napätia pre vypnutie (cutoff) (DC=10V | nS=n*3.3V pre LiIon články)"
},
"SleepTemperature": {
"text2": ["Pokojová", "teplota"],
"desc": "Pokojová teplota (v nastavených jednotkách)"
},
"SleepTimeout": {
"text2": ["Pokojový", "režim po"],
"desc": "Pokojový režim po (S=sekundách | M=minútach)"
},
"ShutdownTimeout": {
"text2": ["Vypnutie", "po"],
"desc": "Čas na vypnutie (minúty)"
},
"MotionSensitivity": {
"text2": ["Citlivosť", "pohybu"],
"desc": "Citlivosť detekcie pohybu (0=Vyp | 1=Min | ... | 9=Max)"
},
"TemperatureUnit": {
"text2": ["Jednotka", "teploty"],
"desc": "Jednotky merania teploty (C=stupne Celzia | F=stupne Fahrenheita)"
},
"AdvancedIdle": {
"text2": ["Detaily v", "pokoj. režime"],
"desc": "Zobraziť detailné informácie v pokojovom režime (T=Zap | F=Vyp)"
},
"DisplayRotation": {
"text2": ["Orientácia", "displeja"],
"desc": "Orientácia displeja (P=Pravák | L=Ľavák | A=Auto)"
},
"BoostTemperature": {
"text2": ["Boost", "teplota"],
"desc": "Cieľová teplota pre prudký náhrev (v nastavených jednotkách)"
},
"AutoStart": {
"text2": ["Automatické", "spustenie"],
"desc": "Pri štarte spustiť režim spájkovania (V=Vyp | Z=Spájkovanie | S=Spanok | I=Spanok izbová teplota)"
},
"CooldownBlink": {
"text2": ["Blikanie pri", "chladnutí"],
"desc": "Blikanie ukazovateľa teploty počas chladnutia hrotu"
},
"TemperatureCalibration": {
"text2": ["Kalibrácia", "teploty"],
"desc": "Kalibrácia posunu teploty hrotu"
},
"SettingsReset": {
"text2": ["Obnovenie", "nastavení"],
"desc": "Obnovenie nastavení na pôvodné hodnoty"
},
"VoltageCalibration": {
"text2": ["Kalibrácia", "nap. napätia"],
"desc": "Kalibrácia napájacieho napätia. Krátke stlačenie mení nastavenie, dlhé stlačenie pre návrat"
},
"AdvancedSoldering": {
"text2": ["Detaily počas", "spájkovania"],
"desc": "Zobrazenie detailov počas spájkovania"
},
"ScrollingSpeed": {
"text2": ["Rýchlosť", "skrolovania"],
"desc": "Rýchlosť pohybu tohto textu"
},
"QCMaxVoltage": {
"text2": ["Obmedzenie", "výkonu"],
"desc": "Obmedzenie výkonu podľa použitého zdroja"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
},
"PowerLimit": {
"text2": ["Obmedzenie", "výkonu"],
"desc": "Obmedzenie výkonu podľa použitého zdroja (watt)"
},
"ReverseButtonTempChange": {
"text2": ["Otočenie", "tlačidiel +/-"],
"desc": "Prehodenie tlačidiel na nastavovanie teploty"
},
"TempChangeShortStep": {
"text2": ["Malý krok", "teploty"],
"desc": "Zmena teploty pri krátkom stlačení tlačidla"
},
"TempChangeLongStep": {
"text2": ["Veľký krok", "teploty"],
"desc": "Zmena teploty pri držaní tlačidla"
},
"PowerPulsePower": {
"text2": ["Intenzita", "impulzu"],
"desc": "Impulz udržujúci napájací zdroj zapnutý (power banky) (watt)"
},
"HallEffSensitivity": {
"text2": ["Citliv.", "Hall"],
"desc": "Citlivosť Halloveho senzora pre detekciu spánku (Z=Zakázať | N=Nízka | S=Stredná | V=Vysoká)"
},
"LockingMode": {
"text2": ["Povoliť zámok", "tlačidiel"],
"desc": "Zamknutie tlačidiel - dlhé stlačenie oboch naraz počas spájkovania (Z=Zakázať | B=Okrem boost | P=Plné zamknutie)"
},
"MinVolCell": {
"text2": ["Minimum", "voltage"],
"desc": "Minimum allowed voltage per cell (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
},
"AnimLoop": {
"text2": ["Anim.", "loop"],
"desc": "Loop icon animations in root menu"
},
"AnimSpeed": {
"text2": ["Anim.", "speed"],
"desc": "Speed of icon animations in menu (O=off | L=low | M=medium | H=high)"
},
"PowerPulseWait": {
"text2": ["Power pulse", "wait time"],
"desc": "Time to wait before triggering every keep-awake pulse (x 2.5s)"
},
"PowerPulseDuration": {
"text2": ["Power pulse", "duration"],
"desc": "Keep-awake-pulse duration (x 250ms)"
},
"LanguageSwitch": {
"text2": ["Jazyk:", " SK Slovenčina"],
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
}
}
"languageCode": "SK",
"languageLocalName": "Slovenčina",
"fonts": [
"ascii_basic",
"latin_extended"
],
"messages": {
"SettingsCalibrationWarning": "Najprv sa prosím uistite, že hrot má izbovú teplotu!",
"SettingsResetWarning": "Naozaj chcete obnoviť továrenské nastavenia?",
"UVLOWarningString": "Nízke U!",
"UndervoltageString": "Nízke napätie",
"InputVoltageString": "Vstupné U: ",
"SleepingSimpleString": "Chrr",
"SleepingAdvancedString": "Pokojový režim..",
"SleepingTipAdvancedString": "Hrot:",
"IdleTipString": "Hrot:",
"IdleSetString": "Cieľ:",
"TipDisconnectedString": "HROT ODPOJENÝ",
"SolderingAdvancedPowerPrompt": "Výkon: ",
"OffString": "Vyp"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": [
"Nastavenia",
"resetované"
],
"NoAccelerometerMessage": [
"Bez pohybového",
"senzora!"
],
"NoPowerDeliveryMessage": [
"Chýba čip",
"USB-PD!"
],
"LockingKeysString": "ZABLOK.",
"UnlockingKeysString": "ODBLOK.",
"WarningKeysLockedString": "!ZABLOK!",
"WarningThermalRunaway": [
"Únik",
"Tepla"
]
},
"characters": {
"SettingRightChar": "P",
"SettingLeftChar": "L",
"SettingAutoChar": "A",
"SettingOffChar": "Z",
"SettingSlowChar": "P",
"SettingMediumChar": "S",
"SettingFastChar": "R",
"SettingStartNoneChar": "V",
"SettingStartSolderingChar": "Z",
"SettingStartSleepChar": "S",
"SettingStartSleepOffChar": "I",
"SettingSensitivityOff": "Z",
"SettingSensitivityLow": "N",
"SettingSensitivityMedium": "S",
"SettingSensitivityHigh": "V",
"SettingLockDisableChar": "Z",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "P",
"SettingNAChar": "N/A"
},
"menuGroups": {
"PowerMenu": {
"text2": [
"Nastavenie",
"výkonu"
],
"desc": "Nastavenie výkonu"
},
"SolderingMenu": {
"text2": [
"Nastavenie",
"spájkovania"
],
"desc": "Nastavenie spájkovania"
},
"PowerSavingMenu": {
"text2": [
"Úsporný",
"režim"
],
"desc": "Nastavenia režimov úspory energie"
},
"UIMenu": {
"text2": [
"Nastavenie",
"zobrazenia"
],
"desc": "Nastavenie zobrazenia"
},
"AdvancedMenu": {
"text2": [
"Pokročilé",
"nastavenia"
],
"desc": "Pokročilé nastavenia"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": [
"Zdroj",
"napätia"
],
"desc": "Zdroj napätia. Nastavenie napätia pre vypnutie (cutoff) (DC=10V | nS=n*3.3V pre LiIon články)"
},
"SleepTemperature": {
"text2": [
"Pokojová",
"teplota"
],
"desc": "Pokojová teplota (v nastavených jednotkách)"
},
"SleepTimeout": {
"text2": [
"Pokojový",
"režim po"
],
"desc": "Pokojový režim po (S=sekundách | M=minútach)"
},
"ShutdownTimeout": {
"text2": [
"Vypnutie",
"po"
],
"desc": "Čas na vypnutie (minúty)"
},
"MotionSensitivity": {
"text2": [
"Citlivosť",
"pohybu"
],
"desc": "Citlivosť detekcie pohybu (0=Vyp | 1=Min | ... | 9=Max)"
},
"TemperatureUnit": {
"text2": [
"Jednotka",
"teploty"
],
"desc": "Jednotky merania teploty (C=stupne Celzia | F=stupne Fahrenheita)"
},
"AdvancedIdle": {
"text2": [
"Detaily v",
"pokoj. režime"
],
"desc": "Zobraziť detailné informácie v pokojovom režime (T=Zap | F=Vyp)"
},
"DisplayRotation": {
"text2": [
"Orientácia",
"displeja"
],
"desc": "Orientácia displeja (P=Pravák | L=Ľavák | A=Auto)"
},
"BoostTemperature": {
"text2": [
"Boost",
"teplota"
],
"desc": "Cieľová teplota pre prudký náhrev (v nastavených jednotkách)"
},
"AutoStart": {
"text2": [
"Automatické",
"spustenie"
],
"desc": "Pri štarte spustiť režim spájkovania (V=Vyp | Z=Spájkovanie | S=Spanok | I=Spanok izbová teplota)"
},
"CooldownBlink": {
"text2": [
"Blikanie pri",
"chladnutí"
],
"desc": "Blikanie ukazovateľa teploty počas chladnutia hrotu"
},
"TemperatureCalibration": {
"text2": [
"Kalibrácia",
"teploty"
],
"desc": "Kalibrácia posunu teploty hrotu"
},
"SettingsReset": {
"text2": [
"Obnovenie",
"nastavení"
],
"desc": "Obnovenie nastavení na pôvodné hodnoty"
},
"VoltageCalibration": {
"text2": [
"Kalibrácia",
"nap. napätia"
],
"desc": "Kalibrácia napájacieho napätia. Krátke stlačenie mení nastavenie, dlhé stlačenie pre návrat"
},
"AdvancedSoldering": {
"text2": [
"Detaily počas",
"spájkovania"
],
"desc": "Zobrazenie detailov počas spájkovania"
},
"ScrollingSpeed": {
"text2": [
"Rýchlosť",
"skrolovania"
],
"desc": "Rýchlosť pohybu tohto textu"
},
"QCMaxVoltage": {
"text2": [
"Obmedzenie QC",
"napätia"
],
"desc": "Maximálne QC napätie ktoré si má systém vyžiadať"
},
"PDNegTimeout": {
"text2": [
"Čas vypršania",
"Power Delivery"
],
"desc": "Čas vyjednávania Power Delivery v 100ms krokoch pre kompatibilitu s niektorými QC nabíjačkami (0: vypnuté)"
},
"PowerLimit": {
"text2": [
"Obmedzenie",
"výkonu"
],
"desc": "Obmedzenie výkonu podľa použitého zdroja (watt)"
},
"ReverseButtonTempChange": {
"text2": [
"Otočenie",
"tlačidiel +/-"
],
"desc": "Prehodenie tlačidiel na nastavovanie teploty"
},
"TempChangeShortStep": {
"text2": [
"Malý krok",
"teploty"
],
"desc": "Zmena teploty pri krátkom stlačení tlačidla"
},
"TempChangeLongStep": {
"text2": [
"Veľký krok",
"teploty"
],
"desc": "Zmena teploty pri držaní tlačidla"
},
"PowerPulsePower": {
"text2": [
"Intenzita",
"impulzu"
],
"desc": "Impulz udržujúci napájací zdroj zapnutý (power banky) (watt)"
},
"HallEffSensitivity": {
"text2": [
"Citliv.",
"Hall"
],
"desc": "Citlivosť Hallovho senzora pre detekciu spánku (Z=Zakázať | N=Nízka | S=Stredná | V=Vysoká)"
},
"LockingMode": {
"text2": [
"Povoliť zámok",
"tlačidiel"
],
"desc": "Zamknutie tlačidiel - dlhé stlačenie oboch naraz počas spájkovania (Z=Zakázať | B=Okrem boost | P=Plné zamknutie)"
},
"MinVolCell": {
"text2": [
"Minimálne",
"napätie"
],
"desc": "Minimálne napätie povolené na jeden článok (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
},
"AnimLoop": {
"text2": [
"Opakovanie",
"animácií"
],
"desc": "Opakovanie animácií ikoniek v hlavnom menu"
},
"AnimSpeed": {
"text2": [
"Rýchlosť",
"animácií"
],
"desc": "Rýchlosť animácií ikoniek v menu (O=off | P=pomaly | S=stredne | R=rýchlo)"
},
"PowerPulseWait": {
"text2": [
"Interval",
"impulzu"
],
"desc": "Interval medzi impulzami udržujúcimi napájací zdroj zapnutý (x 2.5s)"
},
"PowerPulseDuration": {
"text2": [
"Dĺžka impulzu",
""
],
"desc": "Dĺžka impulzu udržujúci napájací zdroj zapnutý (x 250ms)"
},
"LanguageSwitch": {
"text2": [
"Jazyk:",
" SK Slovenčina"
],
"desc": "Aktuálny jazyk"
},
"Brightness": {
"text2": [
"Jas",
"obrazovky"
],
"desc": "Mení jas/kontrast OLED displeja"
},
"ColourInversion": {
"text2": [
"Invertovať",
"obrazovku"
],
"desc": "Invertovať farby OLED displeja"
}
}
}

View File

@@ -202,12 +202,12 @@
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
"text2": ["Яскравість", "екрану"],
"desc": "Налаштування контрасту/яскравості OLED екрану"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
"text2": ["Інверт", "екрану"],
"desc": "Налаштування контрасту/яскравості OLED екрану"
}
}
}

View File

@@ -4,35 +4,29 @@
"fonts": ["ascii_basic", "cjk"],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationDone": "校正完成",
"SettingsCalibrationWarning": "開始温度校正之前,請先確定辣雞咀係處於室温!",
"SettingsCalibrationWarning": "開始温度校正之前,請先確定焫雞咀係處於室温",
"SettingsResetWarning": "你係咪確定要將全部設定重設到預設值?",
"UVLOWarningString": "電壓過低",
"UndervoltageString": "Undervoltage",
"InputVoltageString": "Input V: ",
"WarningTipTempString": "Tip temp: ",
"BadTipString": "BAD TIP",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Sleeping...",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "!!! HOT TIP !!!",
"SleepingTipAdvancedString": "Tip:",
"IdleTipString": "Tip:",
"IdleSetString": " Set:",
"TipDisconnectedString": "NO TIP",
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "關",
"YourGainMessage": "Your gain:"
"OffString": "關"
},
"messagesWarn": {
"ResetOKMessage": "已重設!",
"SettingsResetMessage": "設定已被重設!",
"NoAccelerometerMessage": ["No accelerometer", "detected!"],
"NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"],
"NoAccelerometerMessage": "未能偵測加速度計",
"NoPowerDeliveryMessage": "未能偵測PD晶片",
"LockingKeysString": "已鎖定",
"UnlockingKeysString": "已解除鎖定",
"WarningKeysLockedString": "!撳掣鎖定!",
"WarningThermalRunaway": ["Thermal", "Runaway"]
"WarningThermalRunaway": "加熱失控"
},
"characters": {
"SettingRightChar": "右",
@@ -84,7 +78,7 @@
},
"SleepTemperature": {
"text2": "待機温度",
"desc": "喺待機模式時嘅雞咀温度"
"desc": "喺待機模式時嘅雞咀温度"
},
"SleepTimeout": {
"text2": "待機延時",
@@ -120,11 +114,11 @@
},
"CooldownBlink": {
"text2": "降温時閃爍",
"desc": "停止加熱之後,當雞咀仲係熱嗰陣閃爍畫面"
"desc": "停止加熱之後,當雞咀仲係熱嗰陣閃爍畫面"
},
"TemperatureCalibration": {
"text2": "温度校正?",
"desc": "開始校正雞咀温度位移"
"desc": "開始校正雞咀温度位移"
},
"SettingsReset": {
"text2": "全部重設?",
@@ -147,12 +141,12 @@
"desc": "使用QC電源時請求嘅最高目標電壓"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
"text2": "PD逾時",
"desc": "設定USB PD協定交涉嘅逾時時限為兼容某啲QC電源而設 <x100ms亳秒>"
},
"PowerLimit": {
"text2": "功率限制",
"desc": "限制雞可用嘅最大功率 <W=watt>"
"desc": "限制雞可用嘅最大功率 <W=watt>"
},
"ReverseButtonTempChange": {
"text2": "反轉加減掣",
@@ -203,12 +197,12 @@
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
"text2": "熒幕亮度",
"desc": "設定OLED熒幕嘅亮度"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
"text2": "熒幕反轉色",
"desc": "反轉OLED熒幕嘅黑白色"
}
}
}

View File

@@ -4,35 +4,29 @@
"fonts": ["ascii_basic", "cjk"],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationDone": "校正完成",
"SettingsCalibrationWarning": "开始温度校正前,请先确定铬铁头正处于室温!",
"SettingsResetWarning": "你是否确定要将全部设置重置为默认值?",
"SettingsCalibrationWarning": "开始温度校正前,请先确定烙铁头正处于室温",
"SettingsResetWarning": "你是否确定要将全部设定重置为默认值?",
"UVLOWarningString": "电压过低",
"UndervoltageString": "Undervoltage",
"InputVoltageString": "Input V: ",
"WarningTipTempString": "Tip temp: ",
"BadTipString": "BAD TIP",
"InputVoltageString": "VIN: ",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Sleeping...",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "!!! HOT TIP !!!",
"SleepingTipAdvancedString": "Tip:",
"IdleTipString": "Tip:",
"IdleSetString": " Set:",
"TipDisconnectedString": "NO TIP",
"SleepingAdvancedString": "Zzzz...",
"SleepingTipAdvancedString": "--->",
"IdleTipString": "--->",
"IdleSetString": " /",
"TipDisconnectedString": "<-X-",
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "关",
"YourGainMessage": "Your gain:"
"OffString": "关"
},
"messagesWarn": {
"ResetOKMessage": "已重置!",
"SettingsResetMessage": "设已被重置!",
"NoAccelerometerMessage": ["No accelerometer", "detected!"],
"NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"],
"SettingsResetMessage": "设已被重置!",
"NoAccelerometerMessage": "未检测到加速度计",
"NoPowerDeliveryMessage": "未检测到PD电路",
"LockingKeysString": "已锁定",
"UnlockingKeysString": "已解除锁定",
"UnlockingKeysString": "已解",
"WarningKeysLockedString": "!按键锁定!",
"WarningThermalRunaway": ["Thermal", "Runaway"]
"WarningThermalRunaway": "加热失控"
},
"characters": {
"SettingRightChar": "右",
@@ -69,146 +63,146 @@
"desc": "自动待机省电设置"
},
"UIMenu": {
"text2": "使用者介面",
"desc": "使用者介面设置"
"text2": "用户界面",
"desc": "用户界面设置"
},
"AdvancedMenu": {
"text2": "进阶设置",
"desc": "进阶设置"
"text2": "高级设置",
"desc": "高级设置"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": "电源",
"desc": "输入电源;设置自动停机电压 <DC 10V> <S 锂电池,以每颗3.3V计算;此设置会禁用功率限制>"
"text2": "下限电压",
"desc": "设置自动停机电压 <DC=10V | S=(串)每节锂电池3.3V;此设置会禁用功率限制>"
},
"SleepTemperature": {
"text2": "待机温度",
"desc": "待机模式时的铁头温度"
"desc": "待机模式时的铁头温度"
},
"SleepTimeout": {
"text2": "待机时",
"desc": "自动进入待机模式前的闲置等候时间 <S=秒 | M=分钟>"
"text2": "待机时",
"desc": "自动进入待机模式前的等候时间 <S=秒 | M=分钟>"
},
"ShutdownTimeout": {
"text2": "自动关机",
"desc": "自动关机前的闲置等候时间 <M=分钟>"
"desc": "自动关机前的等候时间 <M=分钟>"
},
"MotionSensitivity": {
"text2": "动作灵敏度",
"desc": "0=禁用 | 1=最低灵敏度 | ... | 9=最高灵敏度"
},
"TemperatureUnit": {
"text2": "温",
"text2": "温度单位",
"desc": "C=摄氏 | F=华氏"
},
"AdvancedIdle": {
"text2": "详细闲置画面",
"desc": "闲置画面以英语小字显示详细信息"
"text2": "闲置画面详情",
"desc": "闲置画面以英语小字显示详"
},
"DisplayRotation": {
"text2": "画面方向",
"desc": "右=使用右手 | 左=使用左手 | 自=自动"
"text2": "显示方向",
"desc": "右=右手 | 左=左手 | 自=自动"
},
"BoostTemperature": {
"text2": "增热温度",
"desc": "增热模式时使用的温度"
"desc": "增热模式时使用的温度"
},
"AutoStart": {
"text2": "自动启",
"desc": "开机时自动启 <无=禁用 | 焊=焊接模式 | 待=待机模式 | 室=室温待机>"
"text2": "自动启",
"desc": "开机时自动启 <无=禁用 | 焊=焊接模式 | 待=待机模式 | 室=室温待机>"
},
"CooldownBlink": {
"text2": "降温时闪",
"desc": "停止加热之后,当铬铁头仍处于高温时闪烁画面"
"text2": "降温时闪",
"desc": "停止加热之后,闪动温度显示提醒烙铁头仍处于高温状态"
},
"TemperatureCalibration": {
"text2": "温度校正?",
"desc": "开始校正铁头温度移"
"desc": "开始校正铁头温度移"
},
"SettingsReset": {
"text2": "全部重置?",
"desc": "将所有设重置为默认值"
"desc": "将所有设重置为默认值"
},
"VoltageCalibration": {
"text2": "输入电压校正?",
"desc": "开始校正VIN输入电压 <长按以退出>"
"desc": "开始校正输入电压VIN<长按以退出>"
},
"AdvancedSoldering": {
"text2": "详细焊接画面",
"desc": "焊接模式画面以英语小字显示详细信息"
"text2": "焊接画面详情",
"desc": "焊接模式画面以英语小字显示详"
},
"ScrollingSpeed": {
"text2": "动速度",
"desc": "解说文字的动速度"
"text2": "动速度",
"desc": "解说文字的动速度"
},
"QCMaxVoltage": {
"text2": "QC电压",
"desc": "使用QC电源时请求的最高目标电压"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
"text2": "PD超时",
"desc": "设定USB-PD协议交涉的超时时限为兼容某些QC电源而设 <x100ms亳秒>"
},
"PowerLimit": {
"text2": "功率限制",
"desc": "限制铁可用的最大功率 <W=watt瓦特>"
"desc": "限制铁可用的最大功率 <W=瓦特>"
},
"ReverseButtonTempChange": {
"text2": "调换加减键",
"desc": "调校温度时换加减键的方向"
"desc": "调校温度时换加减键的方向"
},
"TempChangeShortStep": {
"text2": "温度调整",
"desc": "调校温度时短按一下的温度变幅"
"text2": "短按温度调整",
"desc": "调校温度时短按按键的温度变幅"
},
"TempChangeLongStep": {
"text2": "温度调整",
"text2": "长按温度调整",
"desc": "调校温度时长按按键的温度变幅"
},
"PowerPulsePower": {
"text2": "电源脉冲",
"desc": "为保持电源唤醒而通电所用的功率 <watt瓦特>"
"desc": "为保持电源处于唤醒状态所用的功率 <Watt瓦特>"
},
"HallEffSensitivity": {
"text2": "磁场灵敏度",
"desc": "磁场感应器用作启动待机模式的灵敏度 <关=禁用 | 低=低灵敏度 | 中=中灵敏度 | 高=高灵敏度>"
"desc": "霍尔效应传感器用作启动待机模式的灵敏度 <关=禁用 | 低=低灵敏度 | 中=中灵敏度 | 高=高灵敏度>"
},
"LockingMode": {
"text2": "按键锁定",
"desc": "焊接模式时,同时长按两个按键启用按键锁定 <无=禁用 | 增=只容许增热模式 | 全=锁定全部>"
"desc": "焊接模式时,同时长按两个按键启用按键锁定 <无=禁用 | 增=只容许增热模式 | 全=完全锁定>"
},
"MinVolCell": {
"text2": "最低电压",
"desc": "每电池的最低可用电压 <伏特> <3S: 3.0V - 3.7V, 4/5/6S: 2.4V - 3.7V>"
"desc": "每电池的最低允许电压 <V伏特> <3S: 3.0V - 3.7V, 4/5/6S: 2.4V - 3.7V>"
},
"AnimLoop": {
"text2": "动画循环",
"desc": "循环显示功能表图示动画"
"desc": "主菜单中循环播放功能图标动画"
},
"AnimSpeed": {
"text2": "动画速度",
"desc": "功能表图示动画的速度 <关=不显示动画 | 慢=慢速 | 中=中速 | 快=快速>"
"desc": "主菜单中功能图标动画的播放速度 <关=不显示动画 | 慢=慢速 | 中=中速 | 快=快速>"
},
"PowerPulseWait": {
"text2": "电源脉冲间隔",
"desc": "为保持电源唤醒,每次通电之间的间隔时间 <x2.5s(秒)>"
"desc": "为保持电源处于唤醒状态,每次通电之间的间隔时间 <x2.5s(秒)>"
},
"PowerPulseDuration": {
"text2": "电源脉冲时长",
"desc": "为保持电源唤醒,每次通电脉冲的时间长度 <x250ms亳秒>"
"desc": "为保持电源处于唤醒状态,每次通电脉冲的时间长度 <x250ms亳秒>"
},
"LanguageSwitch": {
"text2": "语言:简体中文",
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
"text2": "屏幕亮度",
"desc": "调整OLED屏幕的亮度"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
"text2": "反转屏幕颜色",
"desc": "反转OLED黑/白屏幕"
}
}
}

View File

@@ -4,36 +4,29 @@
"fonts": ["ascii_basic", "cjk"],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationDone": "校正完成",
"SettingsCalibrationWarning": "開始溫度校正前,請先確定鉻鐵頭正處於室溫!",
"SettingsCalibrationWarning": "開始溫度校正前,請先確定烙鐵頭正處於室溫",
"SettingsResetWarning": "你是否確定要將全部設定重設到預設值?",
"UVLOWarningString": "電壓過低",
"UndervoltageString": "Undervoltage",
"InputVoltageString": "Input V: ",
"WarningTipTempString": "Tip temp: ",
"BadTipString": "BAD TIP",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Sleeping...",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "!!! HOT TIP !!!",
"SleepingTipAdvancedString": "Tip:",
"IdleTipString": "Tip:",
"IdleSetString": " Set:",
"TipDisconnectedString": "NO TIP",
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "關",
"YourGainMessage": "Your gain:"
"OffString": "關"
},
"messagesWarn": {
"ResetOKMessage": "已重設!",
"SettingsResetMessage": "設定已被重設!",
"NoAccelerometerMessage": ["No accelerometer", "detected!"],
"NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"],
"NoAccelerometerMessage": "未能偵測加速度計",
"NoPowerDeliveryMessage": "未能偵測PD晶片",
"LockingKeysString": "已鎖定",
"UnlockingKeysString": "已解除鎖定",
"WarningKeysLockedString": "!按鍵鎖定!",
"WarningThermalRunaway": ["Thermal", "Runaway"],
"WarningThermalRunaway": ["Thermal", "Runaway"]
"WarningThermalRunaway": "加熱失控"
},
"characters": {
"SettingRightChar": "右",
@@ -85,7 +78,7 @@
},
"SleepTemperature": {
"text2": "待機溫度",
"desc": "於待機模式時的鐵頭溫度"
"desc": "於待機模式時的鐵頭溫度"
},
"SleepTimeout": {
"text2": "待機延時",
@@ -121,11 +114,11 @@
},
"CooldownBlink": {
"text2": "降溫時閃爍",
"desc": "停止加熱之後,當鐵頭仍處於高溫時閃爍畫面"
"desc": "停止加熱之後,當鐵頭仍處於高溫時閃爍畫面"
},
"TemperatureCalibration": {
"text2": "溫度校正?",
"desc": "開始校正鐵頭溫度位移"
"desc": "開始校正鐵頭溫度位移"
},
"SettingsReset": {
"text2": "全部重設?",
@@ -148,12 +141,12 @@
"desc": "使用QC電源時請求的最高目標電壓"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
"text2": "PD逾時",
"desc": "設定USB PD協定交涉的逾時時限為兼容某些QC電源而設 <x100ms亳秒>"
},
"PowerLimit": {
"text2": "功率限制",
"desc": "限制鐵可用的最大功率 <W=watt瓦特>"
"desc": "限制鐵可用的最大功率 <W=watt瓦特>"
},
"ReverseButtonTempChange": {
"text2": "調換加減鍵",
@@ -204,12 +197,12 @@
"desc": ""
},
"Brightness": {
"text2": ["Screen", "Brightness"],
"desc": "Adjust the contrast/brightness of the OLED screen"
"text2": "螢幕亮度",
"desc": "設定OLED螢幕的亮度"
},
"ColourInversion": {
"text2": ["Screen", "Invert"],
"desc": "Invert the colours of the OLED screen"
"text2": "螢幕反轉色",
"desc": "反轉OLED螢幕的黑白色彩"
}
}
}

View File

@@ -1,2 +1,2 @@
#!/usr/bin/env bash
docker-compose run --rm builder /bin/bash /build/ci/buildAll.sh
#!/bin/sh
docker-compose run --rm builder /bin/bash /build/ci/buildAll.sh

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
set -e
set -u

View File

@@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/sh
set -e
# Setup shell file to setup the environment on an ubuntu machine
sudo apt-get update && sudo apt-get install -y make bzip2 git python3 python3-pip wget dfu-util
sudo apt-get update && sudo apt-get install -y make bzip2 git python3 python3-pip wget dfu-util
python3 -m pip install bdflib black flake8
sudo mkdir -p /build
cd /build
@@ -12,7 +12,7 @@ cd /build
MDPATH=${GITHUB_WORKSPACE:-/build/source/}
sudo mkdir -p /build/cache
cd /build/cache/
if md5sum -c $MDPATH/ci/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2.md5; then
if md5sum -c "$MDPATH"/ci/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2.md5; then
echo "Good MD5 ARM"
else
echo "ARM MD5 Mismatch, downloading fresh"
@@ -20,7 +20,7 @@ else
sudo wget -q "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2" -O gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
fi
if md5sum -c $MDPATH/ci/nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2.md5; then
if md5sum -c "$MDPATH"/ci/nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2.md5; then
echo "Good MD5 RISCV"
else
echo "RISCV MD5 Mismatch, downloading fresh"

View File

@@ -1,4 +1,5 @@
#include "BSP_Flash.h"
#include "BSP_PD.h"
#include "BSP_Power.h"
#include "BSP_QC.h"
#include "Defines.h"
@@ -58,9 +59,8 @@ void reboot();
uint8_t showBootLogoIfavailable();
// delay wrapper for delay using the hardware timer (used before RTOS)
void delay_ms(uint16_t count);
// Used to allow knowledge of if usb_pd is being used
uint8_t usb_pd_detect();
bool getHallSensorFitted();
// Probe if the Hall sensor is fitted to the unit
bool getHallSensorFitted();
// If the iron has a hall effect sensor in the handle, return an signed count of the reading
// If the sensor is single polarity (or polarity insensitive) just return 0..32768
int16_t getRawHallEffect();

View File

@@ -8,5 +8,8 @@
#ifndef USER_BSP_PD_H_
#define USER_BSP_PD_H_
#include "BSP.h"
bool fusb_write_buf(const uint8_t deviceAddr, const uint8_t registerAdd, const uint8_t size, uint8_t *buf);
bool fusb_read_buf(const uint8_t deviceAddr, const uint8_t registerAdd, const uint8_t size, uint8_t *buf);
void setupFUSBIRQ();
bool getFUS302IRQLow();
#endif /* USER_BSP_PD_H_ */

View File

@@ -7,7 +7,7 @@
#include "IRQ.h"
#include "Pins.h"
#include "int_n.h"
#include "configuration.h"
/*
* Catch the IRQ that says that the conversion is done on the temperature
@@ -34,13 +34,22 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCal
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
extern osThreadId POWTaskHandle;
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
(void)GPIO_Pin;
InterruptHandler::irqCallback();
// Notify POW thread that an irq occured
if (POWTaskHandle != nullptr) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xTaskNotifyFromISR(POWTaskHandle, 1, eSetBits, &xHigherPriorityTaskWoken);
/* Force a context switch if xHigherPriorityTaskWoken is now set to pdTRUE.
The macro used to do this is dependent on the port and may be called
portEND_SWITCHING_ISR. */
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
}
bool getFUS302IRQLow() {
#ifdef POW_PD
#if POW_PD
// Return true if the IRQ line is still held low
return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_RESET;
#else

View File

@@ -3,42 +3,17 @@
#include "Pins.h"
#include "QC3.h"
#include "Settings.h"
#include "USBPD.h"
#include "configuration.h"
#include "fusb_user.h"
#include "fusbpd.h"
#include "int_n.h"
#include "policy_engine.h"
bool FUSB302_present = false;
bool FUSB302_probed = false;
void power_check() {
#ifdef POW_PD
if (FUSB302_present) {
PolicyEngine::PPSTimerCallback();
// Cant start QC until either PD works or fails
if (PolicyEngine::setupCompleteOrTimedOut(getSettingValue(SettingsOptions::PDNegTimeout)) == false) {
return;
}
if (PolicyEngine::pdHasNegotiated()) {
return;
}
#if POW_PD
// Cant start QC until either PD works or fails
if (USBPowerDelivery::negotiationComplete()) {
return;
}
#endif
#ifdef POW_QC
QC_resync();
#endif
}
uint8_t usb_pd_detect() {
#ifdef POW_PD
if (FUSB302_probed) {
return FUSB302_present;
} else {
FUSB302_present = fusb302_detect();
FUSB302_probed = true;
}
return FUSB302_present;
#endif
return false;
}
bool getIsPoweredByDCIN() { return false; }

View File

@@ -1,22 +1,22 @@
/**
******************************************************************************
* @file stm32f1xx_hal_adc.h
* @author MCD Application Team
* @brief Header file containing functions prototypes of ADC HAL library.
******************************************************************************
* @attention
*
*
* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
******************************************************************************
* @file stm32f1xx_hal_adc.h
* @author MCD Application Team
* @brief Header file containing functions prototypes of ADC HAL library.
******************************************************************************
* @attention
*
*
* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_ADC_H

View File

@@ -1,21 +1,21 @@
/**
******************************************************************************
* @file stm32f1xx_hal_adc_ex.h
* @author MCD Application Team
* @brief Header file of ADC HAL extension module.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
******************************************************************************
* @file stm32f1xx_hal_adc_ex.h
* @author MCD Application Team
* @brief Header file of ADC HAL extension module.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_ADC_EX_H

View File

@@ -1,21 +1,21 @@
/**
******************************************************************************
* @file stm32f1xx_hal_cortex.h
* @author MCD Application Team
* @brief Header file of CORTEX HAL module.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
******************************************************************************
* @file stm32f1xx_hal_cortex.h
* @author MCD Application Team
* @brief Header file of CORTEX HAL module.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_CORTEX_H

View File

@@ -1,22 +1,22 @@
/**
******************************************************************************
* @file stm32f1xx_hal_def.h
* @author MCD Application Team
* @brief This file contains HAL common defines, enumeration, macros and
* structures definitions.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
******************************************************************************
* @file stm32f1xx_hal_def.h
* @author MCD Application Team
* @brief This file contains HAL common defines, enumeration, macros and
* structures definitions.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_DEF

View File

@@ -1,21 +1,21 @@
/**
******************************************************************************
* @file stm32f1xx_hal_dma_ex.h
* @author MCD Application Team
* @brief Header file of DMA HAL extension module.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
******************************************************************************
* @file stm32f1xx_hal_dma_ex.h
* @author MCD Application Team
* @brief Header file of DMA HAL extension module.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_DMA_EX_H

View File

@@ -95,8 +95,9 @@
#define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0
#define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0
#define THERMAL_RUNAWAY_TIME_SEC 20
#define THERMAL_RUNAWAY_TEMP_C 20
// Due to large thermal mass of the PCB being heated we need to pull this back a bit
#define THERMAL_RUNAWAY_TIME_SEC 45
#define THERMAL_RUNAWAY_TEMP_C 3
#define CUT_OUT_SETTING 0 // default to no cut-off voltage
#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33))
@@ -118,27 +119,28 @@
#endif
#ifdef MODEL_MHP30
#define SOLDERING_TEMP 200 // Default soldering temp is 200.0 °C
#define VOLTAGE_DIV 360 // Default for MHP30
#define PID_POWER_LIMIT 65 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 0 // the adc offset in uV - MHP compensates automagically
#define POWER_LIMIT 65 // 65 watts default power limit
#define MAX_POWER_LIMIT 65 //
#define POWER_LIMIT_STEPS 1 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_MHP30 //
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
#define MODEL_HAS_DCDC // Has inductor to current filter
#define PID_TIM_HZ (16) //
#define MAX_TEMP_C 300 // Max soldering temp selectable °C
#define MAX_TEMP_F 570 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 150 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 300 // The min settable temp for boost mode °F
#define NO_DISPLAY_ROTATE // Disable OLED rotation by accel
#define SLEW_LIMIT 50 // Limit to 3.0 Watts per 64ms pid loop update rate slew rate
#define SOLDERING_TEMP 200 // Default soldering temp is 200.0 °C
#define VOLTAGE_DIV 360 // Default for MHP30
#define PID_POWER_LIMIT 65 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 0 // the adc offset in uV - MHP compensates automagically
#define MIN_CALIBRATION_OFFSET 0 // Min value for calibration
#define POWER_LIMIT 65 // 65 watts default power limit
#define MAX_POWER_LIMIT 65 //
#define POWER_LIMIT_STEPS 1 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_MHP30 //
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
#define MODEL_HAS_DCDC // Has inductor to current filter
#define PID_TIM_HZ (16) //
#define MAX_TEMP_C 350 // Max soldering temp selectable °C
#define MAX_TEMP_F 660 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 150 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 300 // The min settable temp for boost mode °F
#define NO_DISPLAY_ROTATE // Disable OLED rotation by accel
#define SLEW_LIMIT 50 // Limit to 3.0 Watts per 64ms pid loop update rate slew rate
#define ACCEL_MSA
#define POW_PD
#define POW_PD 1
#define TEMP_NTC
#define I2C_SOFT
#define BATTFILTERDEPTH 8
@@ -147,7 +149,7 @@
#define HARDWARE_MAX_WATTAGE_X10 650
#define TIP_THERMAL_MASS 65 // TODO, needs refinement
#define tipResistance 60 // x10 ohms, ~6 typical
#define TIP_RESISTANCE 60 // x10 ohms, ~6 typical
#endif
#ifdef ACCEL_EXITS_ON_MOVEMENT

View File

@@ -1,20 +1,13 @@
#include "configuration.h"
#ifdef POW_PD
#if POW_PD
#include "BSP.h"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
#include "Setup.h"
#include "fusb302b.h"
#include "fusb_user.h"
#include "USBPD.h"
bool fusb_read_buf(const uint8_t deviceAddr, const uint8_t registerAdd, const uint8_t size, uint8_t *buf) { return FRToSI2C::Mem_Read(deviceAddr, registerAdd, buf, size); }
bool fusb_read_buf(uint8_t addr, uint8_t size, uint8_t *buf) { return FRToSI2C::Mem_Read(FUSB302B_ADDR, addr, buf, size); }
bool fusb_write_buf(uint8_t addr, uint8_t size, const uint8_t *buf) { return FRToSI2C::Mem_Write(FUSB302B_ADDR, addr, (uint8_t *)buf, size); }
bool fusb302_detect() {
// Probe the I2C bus for its address
return FRToSI2C::probe(FUSB302B_ADDR);
}
bool fusb_write_buf(const uint8_t deviceAddr, const uint8_t registerAdd, const uint8_t size, uint8_t *buf) { return FRToSI2C::Mem_Write(deviceAddr, registerAdd, (uint8_t *)buf, size); }
void setupFUSBIRQ() {
GPIO_InitTypeDef GPIO_InitStruct;

View File

@@ -4,7 +4,6 @@
#include "QC3.h"
#include "Settings.h"
#include "cmsis_os.h"
#include "fusbpd.h"
#include "main.hpp"
#include "power.hpp"
#include "stdlib.h"

View File

@@ -9,8 +9,6 @@
#include "I2CBB.hpp"
#include "Pins.h"
#include "Setup.h"
#include "configuration.h"
#include "fusbpd.h"
#include <I2C_Wrapper.hpp>
void preRToSInit() {

View File

@@ -7,7 +7,7 @@
#include "IRQ.h"
#include "Pins.h"
#include "int_n.h"
#include "configuration.h"
/*
* Catch the IRQ that says that the conversion is done on the temperature
@@ -30,13 +30,23 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCal
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
extern osThreadId POWTaskHandle;
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
(void)GPIO_Pin;
InterruptHandler::irqCallback();
// Notify POW thread that an irq occured
if (POWTaskHandle != nullptr) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xTaskNotifyFromISR(POWTaskHandle, 1, eSetBits, &xHigherPriorityTaskWoken);
/* Force a context switch if xHigherPriorityTaskWoken is now set to pdTRUE.
The macro used to do this is dependent on the port and may be called
portEND_SWITCHING_ISR. */
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
}
bool getFUS302IRQLow() {
#ifdef POW_PD
#if POW_PD
// Return true if the IRQ line is still held low
return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_RESET;
#else

View File

@@ -78,8 +78,6 @@
#define SCL2_GPIO_Port GPIOA
#define SDA2_Pin GPIO_PIN_1
#define SDA2_GPIO_Port GPIOA
#define INT_PD_Pin GPIO_PIN_9
#define INT_PD_GPIO_Port GPIOA
#endif
#ifdef MODEL_TS80P

View File

@@ -3,43 +3,23 @@
#include "Pins.h"
#include "QC3.h"
#include "Settings.h"
#include "USBPD.h"
#include "configuration.h"
#include "fusb_user.h"
#include "fusbpd.h"
#include "int_n.h"
#include "policy_engine.h"
bool FUSB302_present = false;
bool FUSB302_probed = false;
void power_check() {
#ifdef POW_PD
if (FUSB302_present) {
PolicyEngine::PPSTimerCallback();
// Cant start QC until either PD works or fails
if (PolicyEngine::setupCompleteOrTimedOut(getSettingValue(SettingsOptions::PDNegTimeout)) == false) {
return;
}
if (PolicyEngine::pdHasNegotiated()) {
return;
}
#if POW_PD
// Cant start QC until either PD works or fails
if (!USBPowerDelivery::negotiationComplete()) {
return;
}
if (USBPowerDelivery::negotiationHasWorked()) {
return; // We are using PD
}
#endif
#ifdef POW_QC
QC_resync();
#endif
}
uint8_t usb_pd_detect() {
#ifdef POW_PD
if (FUSB302_probed) {
return FUSB302_present;
} else {
FUSB302_present = fusb302_detect();
FUSB302_probed = true;
}
return FUSB302_present;
#endif
return false;
}
bool getIsPoweredByDCIN() {
#ifdef MODEL_TS80

View File

@@ -20,11 +20,12 @@
#define SOFT_SCL_READ() (HAL_GPIO_ReadPin(SCL2_GPIO_Port, SCL2_Pin) == GPIO_PIN_SET ? 1 : 0)
#define SOFT_I2C_DELAY() \
{ \
for (int xx = 0; xx < 40; xx++) { \
for (int xx = 0; xx < 15; xx++) { \
asm("nop"); \
} \
}
#endif
// 40 ~= 100kHz; 15 gives around 250kHz or so which is fast _and_ stable
#endif /* BSP_MINIWARE_SOFTWARE_I2C_H_ */

View File

@@ -125,76 +125,81 @@
#endif
#ifdef MODEL_TS100
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 467 // 467 - Default divider from schematic
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
#define PID_POWER_LIMIT 70 // Sets the max pwm power limit
#define POWER_LIMIT 0 // 0 watts default limit
#define MAX_POWER_LIMIT 70 //
#define POWER_LIMIT_STEPS 5 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 //
#define TEMP_uV_LOOKUP_HAKKO //
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 467 // 467 - Default divider from schematic
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
#define PID_POWER_LIMIT 70 // Sets the max pwm power limit
#define POWER_LIMIT 0 // 0 watts default limit
#define MAX_POWER_LIMIT 70 //
#define POWER_LIMIT_STEPS 5 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 //
#define TEMP_uV_LOOKUP_HAKKO //
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define POW_DC
#define ACCEL_MMA
#define POW_PD 0
#define ACCEL_LIS
#define TEMP_TMP36
#endif
#ifdef MODEL_TS80
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 780 // Default divider from schematic
#define PID_POWER_LIMIT 24 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 900 // the adc offset in uV
#define POWER_LIMIT 24 // 24 watts default power limit
#define MAX_POWER_LIMIT 40 //
#define POWER_LIMIT_STEPS 2 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 //
#define TEMP_uV_LOOKUP_TS80 //
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 780 // Default divider from schematic
#define PID_POWER_LIMIT 24 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 900 // the adc offset in uV
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
#define POWER_LIMIT 24 // 24 watts default power limit
#define MAX_POWER_LIMIT 40 //
#define POWER_LIMIT_STEPS 2 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 //
#define TEMP_uV_LOOKUP_TS80 //
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define ACCEL_LIS
#define POW_QC
#define POW_PD 0
#define TEMP_TMP36
#define LIS_ORI_FLIP
#define OLED_FLIP
#endif
#ifdef MODEL_TS80P
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors
#define PID_POWER_LIMIT 35 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 1500 // the adc offset in uV
#define POWER_LIMIT 30 // 30 watts default power limit
#define MAX_POWER_LIMIT 40 //
#define POWER_LIMIT_STEPS 2 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 //
#define TEMP_uV_LOOKUP_TS80 //
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors
#define PID_POWER_LIMIT 35 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 1500 // the adc offset in uV
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
#define POWER_LIMIT 30 // 30 watts default power limit
#define MAX_POWER_LIMIT 40 //
#define POWER_LIMIT_STEPS 2 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 //
#define TEMP_uV_LOOKUP_TS80 //
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define ACCEL_LIS
#define ACCEL_MSA
#define POW_PD
#define POW_QC
#define POW_PD 1
#define POW_QC 1
#define TEMP_NTC
#define I2C_SOFT
#define LIS_ORI_FLIP
@@ -204,18 +209,18 @@
#ifdef MODEL_TS100
#define HARDWARE_MAX_WATTAGE_X10 750
#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second
#define tipResistance 75 // x10 ohms, 7.5 typical for ts100 tips
#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips
#endif
#ifdef MODEL_TS80
#define HARDWARE_MAX_WATTAGE_X10 180
#define TIP_THERMAL_MASS 40
#define tipResistance 45 // x10 ohms, 4.5 typical for ts80 tips
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
#endif
#ifdef MODEL_TS80P
#define HARDWARE_MAX_WATTAGE_X10 300
#define TIP_THERMAL_MASS 40
#define tipResistance 45 // x10 ohms, 4.5 typical for ts80 tips
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
#endif
#endif

View File

@@ -1,43 +1,20 @@
#include "configuration.h"
#ifdef POW_PD
#if POW_PD
#include "BSP.h"
#include "I2CBB.hpp"
#include "Setup.h"
#include "fusb302b.h"
#include "fusb_user.h"
/*
* Read multiple bytes from the FUSB302B
*
* cfg: The FUSB302B to communicate with
* addr: The memory address from which to read
* size: The number of bytes to read
* buf: The buffer into which data will be read
*/
bool fusb_read_buf(uint8_t addr, uint8_t size, uint8_t *buf) { return I2CBB::Mem_Read(FUSB302B_ADDR, addr, buf, size); }
bool fusb_read_buf(const uint8_t deviceAddr, const uint8_t registerAdd, const uint8_t size, uint8_t *buf) { return I2CBB::Mem_Read(deviceAddr, registerAdd, buf, size); }
/*
* Write multiple bytes to the FUSB302B
*
* cfg: The FUSB302B to communicate with
* addr: The memory address to which we will write
* size: The number of bytes to write
* buf: The buffer to write
*/
bool fusb_write_buf(uint8_t addr, uint8_t size, const uint8_t *buf) { return I2CBB::Mem_Write(FUSB302B_ADDR, addr, buf, size); }
bool fusb302_detect() {
// Probe the I2C bus for its address
return I2CBB::probe(FUSB302B_ADDR);
}
bool fusb_write_buf(const uint8_t deviceAddr, const uint8_t registerAdd, const uint8_t size, uint8_t *buf) { return I2CBB::Mem_Write(deviceAddr, registerAdd, buf, size); }
void setupFUSBIRQ() {
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Pin = INT_PD_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
HAL_GPIO_Init(INT_PD_GPIO_Port, &GPIO_InitStruct);
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 10, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
}

View File

@@ -1,14 +1,4 @@
#include "BSP.h"
#include "FreeRTOS.h"
#include "I2C_Wrapper.hpp"
#include "QC3.h"
#include "Settings.h"
#include "cmsis_os.h"
#include "fusbpd.h"
#include "main.hpp"
#include "power.hpp"
#include "stdlib.h"
#include "task.h"
// Initialisation to be performed with scheduler active
void postRToSInit() {}

View File

@@ -9,8 +9,6 @@
#include "I2CBB.hpp"
#include "Pins.h"
#include "Setup.h"
#include "configuration.h"
#include "fusbpd.h"
#include <I2C_Wrapper.hpp>
void preRToSInit() {

View File

@@ -5,8 +5,11 @@
* Author: Ralim
*/
#include "Debug.h"
#include "FreeRTOS.h"
#include "Pins.h"
extern "C" {
#include "gd32vf103_usart.h"
}
char uartOutputBuffer[uartOutputBufferLength];
@@ -34,7 +37,18 @@ void log_system_state(int32_t PWMWattsx10) {
usart_interrupt_enable(UART_PERIF, USART_INT_TBE);
}
}
ssize_t _write(int fd, const void *ptr, size_t len) {
if (len > uartOutputBufferLength) {
len = uartOutputBufferLength;
}
outputLength = len;
currentOutputPos = 0;
memcpy(uartOutputBuffer, ptr, len);
/* enable USART1 Transmit Buffer Empty interrupt */
usart_interrupt_enable(UART_PERIF, USART_INT_TBE);
delay_ms(1);
return len;
}
void USART1_IRQHandler(void) {
if (RESET != usart_interrupt_flag_get(UART_PERIF, USART_INT_FLAG_TBE)) {
/* write one byte to the transmit data register */

View File

@@ -16,7 +16,7 @@
const unsigned int uartOutputBufferLength = 32;
extern char uartOutputBuffer[uartOutputBufferLength];
extern "C" {
void USART1_IRQHandler(void);
ssize_t _write(int fd, const void *ptr, size_t len);
void USART1_IRQHandler(void);
}
#endif /* CORE_BSP_PINE64_DEBUG_H_ */

View File

@@ -2,9 +2,6 @@
#define FREERTOS_CONFIG_H
#include "nuclei_sdk_soc.h"
#include <stdint.h>
// RISC-V configuration
#define USER_MODE_TASKS 0
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configUSE_TICKLESS_IDLE 0
@@ -25,7 +22,6 @@
#define configUSE_TIME_SLICING 1
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 0
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1
@@ -39,7 +35,7 @@
/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0

View File

@@ -8,6 +8,7 @@
#include "IRQ.h"
#include "Setup.h"
#include <I2C_Wrapper.hpp>
SemaphoreHandle_t FRToSI2C::I2CSemaphore = nullptr;
StaticSemaphore_t FRToSI2C::xSemaphoreBuffer;
#define I2C_TIME_OUT (uint16_t)(12000)
@@ -23,7 +24,7 @@ uint8_t FRToSI2C::I2C_RegisterRead(uint8_t add, uint8_t reg) {
return temp;
}
enum i2c_step {
enum class i2c_step {
// Write+read steps
Write_start, // Sending start on bus
Write_device_address, // start sent, send device address
@@ -51,32 +52,20 @@ struct i2c_state {
uint16_t numberOfBytes;
dma_parameter_struct dma_init_struct;
};
volatile i2c_state currentState;
i2c_state currentState;
void perform_i2c_step() {
// Performs next step of the i2c state machine
if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) {
i2c_flag_clear(I2C0, I2C_FLAG_AERR);
// Arb error - we lost the bus / nacked
currentState.currentStep = Error_occured;
} else if (i2c_flag_get(I2C0, I2C_FLAG_BERR)) {
i2c_flag_clear(I2C0, I2C_FLAG_BERR);
// Bus Error
currentState.currentStep = Error_occured;
} else if (i2c_flag_get(I2C0, I2C_FLAG_LOSTARB)) {
i2c_flag_clear(I2C0, I2C_FLAG_LOSTARB);
// Bus Error
currentState.currentStep = Error_occured;
} else if (i2c_flag_get(I2C0, I2C_FLAG_PECERR)) {
i2c_flag_clear(I2C0, I2C_FLAG_PECERR);
// Bus Error
currentState.currentStep = Error_occured;
currentState.currentStep = i2c_step::Error_occured;
}
switch (currentState.currentStep) {
case Error_occured:
case i2c_step::Error_occured:
i2c_stop_on_bus(I2C0);
break;
case Write_start:
case i2c_step::Write_start:
/* enable acknowledge */
i2c_ack_config(I2C0, I2C_ACK_ENABLE);
@@ -84,133 +73,177 @@ void perform_i2c_step() {
if (!i2c_flag_get(I2C0, I2C_FLAG_I2CBSY)) {
/* send the start signal */
i2c_start_on_bus(I2C0);
currentState.currentStep = Write_device_address;
currentState.currentStep = i2c_step::Write_device_address;
}
break;
case Write_device_address:
case i2c_step::Write_device_address:
/* i2c master sends START signal successfully */
if (i2c_flag_get(I2C0, I2C_FLAG_SBSEND)) {
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND);
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); // Clear sbsend by reading ctrl banks
i2c_master_addressing(I2C0, currentState.deviceAddress, I2C_TRANSMITTER);
currentState.currentStep = Write_device_memory_address;
currentState.currentStep = i2c_step::Write_device_memory_address;
}
break;
case Write_device_memory_address:
case i2c_step::Write_device_memory_address:
// Send the device memory location
if (i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) { // addr sent
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND);
if (i2c_flag_get(I2C0, I2C_FLAG_BERR)) {
i2c_flag_clear(I2C0, I2C_FLAG_BERR);
// Bus Error
currentState.currentStep = Error_occured;
} else if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) {
i2c_flag_clear(I2C0, I2C_FLAG_AERR);
// Arb error - we lost the bus / nacked
currentState.currentStep = Error_occured;
} else if (currentState.wakePart) {
if (currentState.wakePart) {
// We are stopping here
currentState.currentStep = Send_stop;
} else if (i2c_flag_get(I2C0, I2C_FLAG_TBE)) {
// Write out the 8 byte address
i2c_data_transmit(I2C0, currentState.memoryAddress);
if (currentState.isMemoryWrite) {
currentState.currentStep = Write_device_data_start;
} else {
currentState.currentStep = Read_start;
}
currentState.currentStep = i2c_step::Send_stop;
return;
}
i2c_flag_clear(I2C0, I2C_FLAG_BTC);
// Write out the 8 byte address
i2c_data_transmit(I2C0, currentState.memoryAddress);
if (currentState.isMemoryWrite) {
currentState.currentStep = i2c_step::Write_device_data_start;
} else {
currentState.currentStep = i2c_step::Read_start;
}
}
break;
case Write_device_data_start:
/* wait until BTC bit is set */
case i2c_step::Write_device_data_start:
/* wait until the transmission data register is empty */
if (i2c_flag_get(I2C0, I2C_FLAG_BTC)) {
dma_deinit(DMA0, DMA_CH5);
dma_init(DMA0, DMA_CH5, &currentState.dma_init_struct);
i2c_dma_last_transfer_config(I2C0, I2C_DMALST_ON);
dma_circulation_disable(DMA0, DMA_CH5);
/* enable I2C0 DMA */
i2c_dma_enable(I2C0, I2C_DMA_ON);
/* enable DMA0 channel5 */
dma_channel_enable(DMA0, DMA_CH5);
currentState.currentStep = Write_device_data_finish;
currentState.currentStep = i2c_step::Write_device_data_finish;
}
break;
case Write_device_data_finish: // Wait for complete then goto stop
case i2c_step::Write_device_data_finish: // Wait for complete then goto stop
/* wait until BTC bit is set */
if (dma_flag_get(DMA0, DMA_CH5, DMA_FLAG_FTF)) {
/* wait until BTC bit is set */
if (i2c_flag_get(I2C0, I2C_FLAG_BTC)) {
currentState.currentStep = Send_stop;
currentState.currentStep = i2c_step::Send_stop;
}
}
break;
case Read_start:
/* wait until BTC bit is set */
case i2c_step::Read_start:
if (i2c_flag_get(I2C0, I2C_FLAG_BTC)) {
/* wait until BTC bit is set */
i2c_start_on_bus(I2C0);
currentState.currentStep = Read_device_address;
currentState.currentStep = i2c_step::Read_device_address;
}
break;
case Read_device_address:
case i2c_step::Read_device_address:
if (i2c_flag_get(I2C0, I2C_FLAG_SBSEND)) {
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND);
i2c_master_addressing(I2C0, currentState.deviceAddress, I2C_RECEIVER);
currentState.currentStep = Read_device_data_start;
if (currentState.numberOfBytes == 1) {
/* disable acknowledge */
i2c_master_addressing(I2C0, currentState.deviceAddress, I2C_RECEIVER);
while (!i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) {}
i2c_ack_config(I2C0, I2C_ACK_DISABLE);
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND);
/* wait for the byte to be received */
while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE)) {}
/* read the byte received from the EEPROM */
*currentState.buffer = i2c_data_receive(I2C0);
while (i2c_flag_get(I2C0, I2C_FLAG_RBNE)) {
i2c_data_receive(I2C0);
}
i2c_stop_on_bus(I2C0);
while ((I2C_CTL0(I2C0) & I2C_CTL0_STOP)) {
asm("nop");
}
currentState.currentStep = i2c_step::Done;
} else if (currentState.numberOfBytes == 2) {
/* disable acknowledge */
i2c_master_addressing(I2C0, currentState.deviceAddress, I2C_RECEIVER);
while (!i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) {}
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND);
/* wait for the byte to be received */
while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE)) {}
i2c_ackpos_config(I2C0, I2C_ACKPOS_CURRENT);
i2c_ack_config(I2C0, I2C_ACK_DISABLE);
/* read the byte received from the EEPROM */
*currentState.buffer = i2c_data_receive(I2C0);
currentState.buffer++;
/* wait for the byte to be received */
while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE)) {}
/* read the byte received from the EEPROM */
*currentState.buffer = i2c_data_receive(I2C0);
while (i2c_flag_get(I2C0, I2C_FLAG_RBNE)) {
i2c_data_receive(I2C0);
}
i2c_stop_on_bus(I2C0);
while ((I2C_CTL0(I2C0) & I2C_CTL0_STOP)) {
asm("nop");
}
currentState.currentStep = i2c_step::Done;
} else {
i2c_master_addressing(I2C0, currentState.deviceAddress, I2C_RECEIVER);
currentState.currentStep = i2c_step::Read_device_data_start;
}
}
break;
case Read_device_data_start:
case i2c_step::Read_device_data_start:
if (i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) { // addr sent
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND);
if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) {
// Arb error - we lost the bus / nacked
currentState.currentStep = Error_occured;
}
/* one byte master reception procedure (polling) */
if (currentState.numberOfBytes == 0) {
currentState.currentStep = Send_stop;
} else if (currentState.numberOfBytes == 1) {
/* disable acknowledge */
i2c_ack_config(I2C0, I2C_ACK_DISABLE);
/* clear ADDSEND register by reading I2C_STAT0 then I2C_STAT1 register
* (I2C_STAT0 has already been read) */
i2c_flag_get(I2C0, I2C_FLAG_ADDSEND); // sat0
i2c_flag_get(I2C0, I2C_FLAG_I2CBSY); // sat1
/* send a stop condition to I2C bus*/
i2c_stop_on_bus(I2C0);
/* wait for the byte to be received */
while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE))
;
/* read the byte received from the EEPROM */
*currentState.buffer = i2c_data_receive(I2C0);
currentState.currentStep = Wait_stop;
currentState.currentStep = i2c_step::Send_stop;
} else { /* more than one byte master reception procedure (DMA) */
/* enable I2C0 DMA */
i2c_dma_enable(I2C0, I2C_DMA_ON);
/* enable DMA0 channel5 */
dma_channel_enable(DMA0, DMA_CH6);
currentState.currentStep = Read_device_data_finish;
while (currentState.numberOfBytes) {
if (3 == currentState.numberOfBytes) {
/* wait until BTC bit is set */
while (!i2c_flag_get(I2C0, I2C_FLAG_BTC)) {}
i2c_ackpos_config(I2C0, I2C_ACKPOS_CURRENT);
/* disable acknowledge */
i2c_ack_config(I2C0, I2C_ACK_DISABLE);
} else if (2 == currentState.numberOfBytes) {
/* wait until BTC bit is set */
while (!i2c_flag_get(I2C0, I2C_FLAG_BTC)) {}
/* disable acknowledge */
i2c_ack_config(I2C0, I2C_ACK_DISABLE);
/* send a stop condition to I2C bus */
i2c_stop_on_bus(I2C0);
}
/* wait until RBNE bit is set */
while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE)) {}
/* read a byte from the EEPROM */
*currentState.buffer = i2c_data_receive(I2C0);
/* point to the next location where the byte read will be saved */
currentState.buffer++;
/* decrement the read bytes counter */
currentState.numberOfBytes--;
}
currentState.currentStep = i2c_step::Wait_stop;
// currentState.currentStep = i2c_step::Read_device_data_finish;
}
}
break;
case Read_device_data_finish: // Wait for complete then goto stop
case i2c_step::Read_device_data_finish: // Wait for complete then goto stop
/* wait until BTC bit is set */
if (dma_flag_get(DMA0, DMA_CH6, DMA_FLAG_FTF)) {
currentState.currentStep = Send_stop;
}
break;
case Send_stop:
case i2c_step::Send_stop:
/* send a stop condition to I2C bus*/
i2c_stop_on_bus(I2C0);
currentState.currentStep = Wait_stop;
currentState.currentStep = i2c_step::Wait_stop;
break;
case Wait_stop:
case i2c_step::Wait_stop:
/* i2c master sends STOP signal successfully */
if ((I2C_CTL0(I2C0) & 0x0200) != 0x0200) {
currentState.currentStep = Done;
if ((I2C_CTL0(I2C0) & I2C_CTL0_STOP) != I2C_CTL0_STOP) {
currentState.currentStep = i2c_step::Done;
}
break;
default:
@@ -220,16 +253,6 @@ void perform_i2c_step() {
}
bool perform_i2c_transaction(uint16_t DevAddress, uint16_t memory_address, uint8_t *p_buffer, uint16_t number_of_byte, bool isWrite, bool isWakeOnly) {
{
// TODO is this required
/* disable I2C0 */
i2c_disable(I2C0);
/* enable I2C0 */
i2c_enable(I2C0);
}
i2c_interrupt_disable(I2C0, I2C_INT_ERR);
i2c_interrupt_disable(I2C0, I2C_INT_BUF);
i2c_interrupt_disable(I2C0, I2C_INT_EV);
currentState.isMemoryWrite = isWrite;
currentState.wakePart = isWakeOnly;
@@ -237,45 +260,38 @@ bool perform_i2c_transaction(uint16_t DevAddress, uint16_t memory_address, uint8
currentState.memoryAddress = memory_address;
currentState.numberOfBytes = number_of_byte;
currentState.buffer = p_buffer;
if (!isWakeOnly) {
// Setup DMA
currentState.dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT;
currentState.dma_init_struct.memory_addr = (uint32_t)p_buffer;
currentState.dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE;
currentState.dma_init_struct.number = number_of_byte;
currentState.dma_init_struct.periph_addr = (uint32_t)&I2C_DATA(I2C0);
currentState.dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_DISABLE;
currentState.dma_init_struct.periph_width = DMA_PERIPHERAL_WIDTH_8BIT;
currentState.dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH;
if (currentState.isMemoryWrite) {
dma_deinit(DMA0, DMA_CH5);
currentState.dma_init_struct.direction = DMA_MEMORY_TO_PERIPHERAL;
dma_init(DMA0, DMA_CH5, (dma_parameter_struct *)&currentState.dma_init_struct);
} else {
dma_deinit(DMA0, DMA_CH6);
currentState.dma_init_struct.direction = DMA_PERIPHERAL_TO_MEMORY;
dma_init(DMA0, DMA_CH6, (dma_parameter_struct *)&currentState.dma_init_struct);
}
// Setup DMA
currentState.dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT;
currentState.dma_init_struct.memory_addr = (uint32_t)p_buffer;
currentState.dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE;
currentState.dma_init_struct.number = number_of_byte;
currentState.dma_init_struct.periph_addr = (uint32_t)&I2C_DATA(I2C0);
currentState.dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_DISABLE;
currentState.dma_init_struct.periph_width = DMA_PERIPHERAL_WIDTH_8BIT;
currentState.dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH;
if (!currentState.isMemoryWrite) {
i2c_dma_last_transfer_config(I2C0, I2C_DMALST_ON);
}
if (currentState.isMemoryWrite) {
currentState.dma_init_struct.direction = DMA_MEMORY_TO_PERIPHERAL;
} else {
currentState.dma_init_struct.direction = DMA_PERIPHERAL_TO_MEMORY;
}
// Clear flags
I2C_STAT0(I2C0) = 0;
I2C_STAT1(I2C0) = 0;
i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND);
currentState.currentStep = Write_start; // Always start in write mode
TickType_t timeout = xTaskGetTickCount() + TICKS_SECOND;
while ((currentState.currentStep != Done) && (currentState.currentStep != Error_occured)) {
i2c_ackpos_config(I2C0, I2C_ACKPOS_CURRENT);
i2c_data_receive(I2C0);
i2c_data_receive(I2C0);
currentState.currentStep = i2c_step::Write_start; // Always start in write mode
TickType_t timeout = xTaskGetTickCount() + TICKS_100MS;
while ((currentState.currentStep != i2c_step::Done) && (currentState.currentStep != i2c_step::Error_occured)) {
if (xTaskGetTickCount() > timeout) {
i2c_stop_on_bus(I2C0);
return false;
}
perform_i2c_step();
}
return currentState.currentStep == Done;
return currentState.currentStep == i2c_step::Done;
}
bool FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t read_address, uint8_t *p_buffer, uint16_t number_of_byte) {

View File

@@ -7,7 +7,7 @@
#include "IRQ.h"
#include "Pins.h"
#include "int_n.h"
#include "configuration.h"
volatile uint8_t i2c_read_process = 0;
volatile uint8_t i2c_write_process = 0;
volatile uint8_t i2c_slave_address = 0;
@@ -90,16 +90,20 @@ void setTipPWM(const uint8_t pulse, const bool shouldUseFastModePWM) {
pendingPWM = pulse;
fastPWM = shouldUseFastModePWM;
}
extern osThreadId POWTaskHandle;
void EXTI5_9_IRQHandler(void) {
#ifdef POW_PD
#if POW_PD
if (RESET != exti_interrupt_flag_get(EXTI_5)) {
exti_interrupt_flag_clear(EXTI_5);
if (RESET == gpio_input_bit_get(FUSB302_IRQ_GPIO_Port, FUSB302_IRQ_Pin)) {
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) {
InterruptHandler::irqCallback();
}
if (POWTaskHandle != nullptr) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xTaskNotifyFromISR(POWTaskHandle, 1, eSetBits, &xHigherPriorityTaskWoken);
/* Force a context switch if xHigherPriorityTaskWoken is now set to pdTRUE.
The macro used to do this is dependent on the port and may be called
portEND_SWITCHING_ISR. */
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
}
#endif

View File

@@ -3,54 +3,38 @@
#include "Pins.h"
#include "QC3.h"
#include "Settings.h"
#include "USBPD.h"
#include "configuration.h"
#include "fusb_user.h"
#include "fusbpd.h"
#include "int_n.h"
#include "policy_engine.h"
bool FUSB302_present = false;
bool FUSB302_probed = false;
void power_check() {
#ifdef POW_PD
if (FUSB302_present) {
PolicyEngine::PPSTimerCallback();
// Cant start QC until either PD works or fails
if (PolicyEngine::setupCompleteOrTimedOut(getSettingValue(SettingsOptions::PDNegTimeout)) == false) {
return;
}
if (PolicyEngine::pdHasNegotiated()) {
return;
}
#if POW_PD
// Cant start QC until either PD works or fails
if (!USBPowerDelivery::negotiationComplete()) {
return;
}
if (USBPowerDelivery::negotiationHasWorked()) {
return; // We are using PD
}
#endif
#ifdef POW_QC
QC_resync();
#endif
}
uint8_t usb_pd_detect() {
#ifdef POW_PD
if (FUSB302_probed) {
return FUSB302_present;
} else {
FUSB302_present = fusb302_detect();
FUSB302_probed = true;
}
return FUSB302_present;
#endif
return false;
}
bool getIsPoweredByDCIN() {
// We return false until we are sure we are not using PD
if (PolicyEngine::setupCompleteOrTimedOut(getSettingValue(SettingsOptions::PDNegTimeout)) == false) {
return false;
#if POW_PD
if (!USBPowerDelivery::negotiationComplete()) {
return false; // We are assuming not dc while negotiating
}
if (PolicyEngine::pdHasNegotiated()) {
if (USBPowerDelivery::negotiationHasWorked()) {
return false; // We are using PD
}
#endif
#ifdef POW_QC
if (hasQCNegotiated()) {
return false; // We are using QC
}
#endif
return true;
}

View File

@@ -25,19 +25,20 @@ void setup_iwdg();
void setup_uart();
void hardware_init() {
// I2C
setup_i2c();
// GPIO
setup_gpio();
// DMA
setup_dma();
// I2C
setup_i2c();
// ADC's
setup_adc();
// Timers
setup_timers();
// Watchdog
setup_iwdg();
// ELIC
eclic_priority_group_set(ECLIC_PRIGROUP_LEVEL0_PRIO4);
// uart for debugging
setup_uart();
/* enable TIMER1 - PWM control timing*/
@@ -102,7 +103,7 @@ void setup_uart() {
/* USART configure */
usart_deinit(UART_PERIF);
usart_baudrate_set(UART_PERIF, 2 * 1000 * 1000U);
usart_baudrate_set(UART_PERIF, 1000000);
usart_word_length_set(UART_PERIF, USART_WL_8BIT);
usart_stop_bit_set(UART_PERIF, USART_STB_1BIT);
usart_parity_config(UART_PERIF, USART_PM_NONE);
@@ -126,10 +127,9 @@ void setup_gpio() {
gpio_init(KEY_B_GPIO_Port, GPIO_MODE_IPD, GPIO_OSPEED_2MHZ, KEY_B_Pin);
// OLED reset as output
gpio_init(OLED_RESET_GPIO_Port, GPIO_MODE_OUT_PP, GPIO_OSPEED_2MHZ, OLED_RESET_Pin);
gpio_bit_set(SDA_GPIO_Port, SDA_Pin);
gpio_bit_set(SDA_GPIO_Port, SCL_Pin);
// I2C as AF Open Drain
gpio_init(SDA_GPIO_Port, GPIO_MODE_AF_OD, GPIO_OSPEED_2MHZ, SDA_Pin | SCL_Pin);
gpio_init(SDA_GPIO_Port, GPIO_MODE_AF_OD, GPIO_OSPEED_50MHZ, SDA_Pin);
gpio_init(SCL_GPIO_Port, GPIO_MODE_AF_OD, GPIO_OSPEED_50MHZ, SCL_Pin);
// PWM output as AF Push Pull
gpio_init(PWM_Out_GPIO_Port, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, PWM_Out_Pin);
// Analog Inputs ... as analog inputs
@@ -139,15 +139,15 @@ void setup_gpio() {
// Remap PB4 away from JTAG NJRST
gpio_pin_remap_config(GPIO_SWJ_NONJTRST_REMAP, ENABLE);
// TODO - rest of pins as floating
// FUSB interrupt
gpio_init(FUSB302_IRQ_GPIO_Port, GPIO_MODE_IPU, GPIO_OSPEED_50MHZ, FUSB302_IRQ_Pin);
}
void setup_dma() {
// Setup DMA for ADC0
{
/* enable DMA0 clock */
rcu_periph_clock_enable(RCU_DMA0);
rcu_periph_clock_enable(RCU_DMA1);
// rcu_periph_clock_enable(RCU_DMA1);
/* ADC_DMA_channel configuration */
dma_parameter_struct dma_data_parameter;
@@ -175,14 +175,14 @@ void setup_dma() {
void setup_i2c() {
/* enable I2C0 clock */
rcu_periph_clock_enable(RCU_I2C0);
/* enable DMA0 clock */
rcu_periph_clock_enable(RCU_DMA0);
// Setup I20 at 400kHz
i2c_clock_config(I2C0, 400 * 1000, I2C_DTCY_2);
i2c_mode_addr_config(I2C0, I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, 0x00);
i2c_mode_addr_config(I2C0, I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, 0x7F);
i2c_enable(I2C0);
/* enable acknowledge */
i2c_ack_config(I2C0, I2C_ACK_ENABLE);
eclic_irq_enable(I2C0_EV_IRQn, 1, 0);
eclic_irq_enable(I2C0_ER_IRQn, 2, 0);
}
void setup_adc() {
@@ -197,7 +197,7 @@ void setup_adc() {
/* config ADC clock */
rcu_adc_clock_config(RCU_CKADC_CKAPB2_DIV16);
// Run in normal parallel + inserted parallel
adc_mode_config(ADC0, ADC_DAUL_INSERTED_PARALLEL);
adc_mode_config(ADC_DAUL_INSERTED_PARALLEL);
adc_special_function_config(ADC0, ADC_CONTINUOUS_MODE, ENABLE);
adc_special_function_config(ADC0, ADC_SCAN_MODE, ENABLE);
adc_special_function_config(ADC1, ADC_CONTINUOUS_MODE, ENABLE);
@@ -333,13 +333,10 @@ void setup_iwdg() {
}
void setupFUSBIRQ() {
// Setup IRQ for USB-PD
gpio_init(FUSB302_IRQ_GPIO_Port, GPIO_MODE_IPU, GPIO_OSPEED_2MHZ, FUSB302_IRQ_Pin);
eclic_irq_enable(EXTI5_9_IRQn, 1, 1);
/* connect key EXTI line to key GPIO pin */
eclic_global_interrupt_enable();
eclic_irq_enable(EXTI5_9_IRQn, 15, 0);
gpio_exti_source_select(GPIO_PORT_SOURCE_GPIOB, GPIO_PIN_SOURCE_5);
/* configure key EXTI line */
exti_init(EXTI_5, EXTI_INTERRUPT, EXTI_TRIG_FALLING);
exti_interrupt_flag_clear(EXTI_5);
}

View File

@@ -15,12 +15,12 @@ extern "C" {
#endif
uint16_t getADC(uint8_t channel);
void hardware_init();
void setupFUSBIRQ();
uint16_t getADCHandleTemp(uint8_t sample);
uint16_t getADCVin(uint8_t sample);
#ifdef __cplusplus
}
#endif
void setupFUSBIRQ();
extern const uint8_t holdoffTicks;
extern const uint8_t tempMeasureTicks;
#endif /* PINE_SETUP_H_ */

View File

@@ -608,6 +608,118 @@ extern "C" {
#define DCAUSE_FAULT_STORE_PMP 0x1
#define DCAUSE_FAULT_STORE_INST 0x2
#define read_fpu(reg) \
({ \
unsigned long __tmp; \
asm volatile("fmv.x.w %0, " #reg : "=r"(__tmp)); \
__tmp; \
})
#define write_fpu(reg, val) \
({ \
if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \
asm volatile("fmv.w.x " #reg ", %0" ::"i"(val)); \
else \
asm volatile("fmv.w.x " #reg ", %0" ::"r"(val)); \
})
#define read_csr(reg) \
({ \
unsigned long __tmp; \
asm volatile("csrr %0, " #reg : "=r"(__tmp)); \
__tmp; \
})
#define write_csr(reg, val) \
({ \
if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \
asm volatile("csrw " #reg ", %0" ::"i"(val)); \
else \
asm volatile("csrw " #reg ", %0" ::"r"(val)); \
})
#define swap_csr(reg, val) \
({ \
unsigned long __tmp; \
if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \
asm volatile("csrrw %0, " #reg ", %1" : "=r"(__tmp) : "i"(val)); \
else \
asm volatile("csrrw %0, " #reg ", %1" : "=r"(__tmp) : "r"(val)); \
__tmp; \
})
#define set_csr(reg, bit) \
({ \
unsigned long __tmp; \
if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \
asm volatile("csrrs %0, " #reg ", %1" : "=r"(__tmp) : "i"(bit)); \
else \
asm volatile("csrrs %0, " #reg ", %1" : "=r"(__tmp) : "r"(bit)); \
__tmp; \
})
#define clear_csr(reg, bit) \
({ \
unsigned long __tmp; \
if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \
asm volatile("csrrc %0, " #reg ", %1" : "=r"(__tmp) : "i"(bit)); \
else \
asm volatile("csrrc %0, " #reg ", %1" : "=r"(__tmp) : "r"(bit)); \
__tmp; \
})
#define rdtime() read_csr(time)
#define rdcycle() read_csr(cycle)
#define rdinstret() read_csr(instret)
#define ECLICINTCTLBITS 4
/*ECLIC memory map */
/* Offset */
/* 0x0000 1B RW ecliccfg */
#define ECLIC_CFG_OFFSET 0x0
/* 0x0004 4B R eclicinfo */
#define ECLIC_INFO_OFFSET 0x4
/* 0x000B 1B RW mintthresh */
#define ECLIC_MTH_OFFSET 0xB
/* 0x1000+4*i 1B/input RW eclicintip[i] */
#define ECLIC_INT_IP_OFFSET _AC(0x1000, UL)
/* 0x1001+4*i 1B/input RW eclicintie[i] */
#define ECLIC_INT_IE_OFFSET _AC(0x1001, UL)
/* 0x1002+4*i 1B/input RW eclicintattr[i]*/
#define ECLIC_INT_ATTR_OFFSET _AC(0x1002, UL)
#define ECLIC_INT_ATTR_SHV 0x01
#define ECLIC_INT_ATTR_TRIG_LEVEL 0x00
#define ECLIC_INT_ATTR_TRIG_EDGE 0x02
#define ECLIC_INT_ATTR_TRIG_POS 0x00
#define ECLIC_INT_ATTR_TRIG_NEG 0x04
/* 0x1003+4*i 1B/input RW eclicintctl[i] */
#define ECLIC_INT_CTRL_OFFSET _AC(0x1003, UL)
#define ECLIC_ADDR_BASE 0xd2000000
#define ECLIC_CFG_NLBITS_MASK _AC(0x1E, UL)
#define ECLIC_CFG_NLBITS_LSB (1u)
#define MSIP_HANDLER eclic_msip_handler
#define MTIME_HANDLER eclic_mtip_handler
#define BWEI_HANDLER eclic_bwei_handler
#define PMOVI_HANDLER eclic_pmovi_handler
#define TIMER_MSIP 0xFFC
#define TIMER_MSIP_size 0x4
#define TIMER_MTIMECMP 0x8
#define TIMER_MTIMECMP_size 0x8
#define TIMER_MTIME 0x0
#define TIMER_MTIME_size 0x8
#define TIMER_CTRL_ADDR 0xd1000000
#define TIMER_REG(offset) _REG32(TIMER_CTRL_ADDR, offset)
#define TIMER_FREQ ((uint32_t)SystemCoreClock / 4)
/** @} */ /** End of Doxygen Group NMSIS_Core_CSR_Encoding **/
#ifdef __cplusplus

View File

@@ -1,48 +0,0 @@
/*!
\file gd32vf103v_eval.h
\brief definitions for GD32VF103V_EVAL's leds, keys and COM ports hardware resources
\version 2019-6-5, V1.0.0, demo for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef GD32VF103V_EVAL_H
#define GD32VF103V_EVAL_H
#ifdef cplusplus
extern "C" {
#endif
#include "nuclei_sdk_soc.h"
#ifdef cplusplus
}
#endif
#endif /* GD32VF103V_EVAL_H */

View File

@@ -1,18 +0,0 @@
// See LICENSE for license details.
#ifndef _NUCLEI_SDK_HAL_H
#define _NUCLEI_SDK_HAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "gd32vf103v_eval.h"
#ifndef NUCLEI_BANNER
#define NUCLEI_BANNER 0
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,38 +0,0 @@
/*!
\file gd32vf103v_eval.c
\brief firmware functions to manage leds, keys, COM ports
\version 2019-6-5, V1.0.0, demo for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#include "gd32vf103_exti.h"
#include "gd32vf103_gpio.h"
#include "gd32vf103_usart.h"
#include "nuclei_sdk_hal.h"

View File

@@ -344,6 +344,35 @@ extern void delay_1ms(uint32_t count);
/** @} */ /* End of group gd32vf103 */
/* define startup timeout value of high speed crystal oscillator (HXTAL) */
#if !defined(HXTAL_STARTUP_TIMEOUT)
#define HXTAL_STARTUP_TIMEOUT ((uint16_t)0xFFFF)
#endif /* high speed crystal oscillator startup timeout */
/* define value of internal 8MHz RC oscillator (IRC8M) in Hz */
#if !defined(IRC8M_VALUE)
#define IRC8M_VALUE ((uint32_t)8000000)
#endif /* internal 8MHz RC oscillator value */
/* define startup timeout value of internal 8MHz RC oscillator (IRC8M) */
#if !defined(IRC8M_STARTUP_TIMEOUT)
#define IRC8M_STARTUP_TIMEOUT ((uint16_t)0x0500)
#endif /* internal 8MHz RC oscillator startup timeout */
/* define value of internal 40KHz RC oscillator(IRC40K) in Hz */
#if !defined(IRC40K_VALUE)
#define IRC40K_VALUE ((uint32_t)40000)
#endif /* internal 40KHz RC oscillator value */
/* define value of low speed crystal oscillator (LXTAL)in Hz */
#if !defined(LXTAL_VALUE)
#define LXTAL_VALUE ((uint32_t)32768)
#endif /* low speed crystal oscillator value */
#if !defined(HXTAL_VALUE)
#define HXTAL_VALUE ((uint32_t)8000000)
#endif /* high speed crystal oscillator value */
#ifdef __cplusplus
}
#endif

View File

@@ -1,398 +1,397 @@
/*!
\file gd32vf103_adc.h
\brief definitions for the ADC
\version 2019-6-5, V1.0.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef GD32VF103_ADC_H
#define GD32VF103_ADC_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* ADC definitions */
#define ADC0 ADC_BASE
#define ADC1 (ADC_BASE + 0x400U)
/* registers definitions */
#define ADC_STAT(adcx) REG32((adcx) + 0x00U) /*!< ADC status register */
#define ADC_CTL0(adcx) REG32((adcx) + 0x04U) /*!< ADC control register 0 */
#define ADC_CTL1(adcx) REG32((adcx) + 0x08U) /*!< ADC control register 1 */
#define ADC_SAMPT0(adcx) REG32((adcx) + 0x0CU) /*!< ADC sampling time register 0 */
#define ADC_SAMPT1(adcx) REG32((adcx) + 0x10U) /*!< ADC sampling time register 1 */
#define ADC_IOFF0(adcx) REG32((adcx) + 0x14U) /*!< ADC inserted channel data offset register 0 */
#define ADC_IOFF1(adcx) REG32((adcx) + 0x18U) /*!< ADC inserted channel data offset register 1 */
#define ADC_IOFF2(adcx) REG32((adcx) + 0x1CU) /*!< ADC inserted channel data offset register 2 */
#define ADC_IOFF3(adcx) REG32((adcx) + 0x20U) /*!< ADC inserted channel data offset register 3 */
#define ADC_WDHT(adcx) REG32((adcx) + 0x24U) /*!< ADC watchdog high threshold register */
#define ADC_WDLT(adcx) REG32((adcx) + 0x28U) /*!< ADC watchdog low threshold register */
#define ADC_RSQ0(adcx) REG32((adcx) + 0x2CU) /*!< ADC regular sequence register 0 */
#define ADC_RSQ1(adcx) REG32((adcx) + 0x30U) /*!< ADC regular sequence register 1 */
#define ADC_RSQ2(adcx) REG32((adcx) + 0x34U) /*!< ADC regular sequence register 2 */
#define ADC_ISQ(adcx) REG32((adcx) + 0x38U) /*!< ADC inserted sequence register */
#define ADC_IDATA0(adcx) REG32((adcx) + 0x3CU) /*!< ADC inserted data register 0 */
#define ADC_IDATA1(adcx) REG32((adcx) + 0x40U) /*!< ADC inserted data register 1 */
#define ADC_IDATA2(adcx) REG32((adcx) + 0x44U) /*!< ADC inserted data register 2 */
#define ADC_IDATA3(adcx) REG32((adcx) + 0x48U) /*!< ADC inserted data register 3 */
#define ADC_RDATA(adcx) REG32((adcx) + 0x4CU) /*!< ADC regular data register */
#define ADC_OVSCR(adcx) REG32((adcx) + 0x80U) /*!< ADC oversample control register */
/* bits definitions */
/* ADC_STAT */
#define ADC_STAT_WDE BIT(0) /*!< analog watchdog event flag */
#define ADC_STAT_EOC BIT(1) /*!< end of conversion */
#define ADC_STAT_EOIC BIT(2) /*!< inserted channel end of conversion */
#define ADC_STAT_STIC BIT(3) /*!< inserted channel start flag */
#define ADC_STAT_STRC BIT(4) /*!< regular channel start flag */
/* ADC_CTL0 */
#define ADC_CTL0_WDCHSEL BITS(0, 4) /*!< analog watchdog channel select bits */
#define ADC_CTL0_EOCIE BIT(5) /*!< interrupt enable for EOC */
#define ADC_CTL0_WDEIE BIT(6) /*!< analog watchdog interrupt enable */
#define ADC_CTL0_EOICIE BIT(7) /*!< interrupt enable for inserted channels */
#define ADC_CTL0_SM BIT(8) /*!< scan mode */
#define ADC_CTL0_WDSC BIT(9) /*!< when in scan mode, analog watchdog is effective on a single channel */
#define ADC_CTL0_ICA BIT(10) /*!< automatic inserted group conversion */
#define ADC_CTL0_DISRC BIT(11) /*!< discontinuous mode on regular channels */
#define ADC_CTL0_DISIC BIT(12) /*!< discontinuous mode on inserted channels */
#define ADC_CTL0_DISNUM BITS(13, 15) /*!< discontinuous mode channel count */
#define ADC_CTL0_SYNCM BITS(16, 19) /*!< sync mode selection */
#define ADC_CTL0_IWDEN BIT(22) /*!< analog watchdog enable on inserted channels */
#define ADC_CTL0_RWDEN BIT(23) /*!< analog watchdog enable on regular channels */
/* ADC_CTL1 */
#define ADC_CTL1_ADCON BIT(0) /*!< ADC converter on */
#define ADC_CTL1_CTN BIT(1) /*!< continuous conversion */
#define ADC_CTL1_CLB BIT(2) /*!< ADC calibration */
#define ADC_CTL1_RSTCLB BIT(3) /*!< reset calibration */
#define ADC_CTL1_DMA BIT(8) /*!< direct memory access mode */
#define ADC_CTL1_DAL BIT(11) /*!< data alignment */
#define ADC_CTL1_ETSIC BITS(12, 14) /*!< external trigger select for inserted channel */
#define ADC_CTL1_ETEIC BIT(15) /*!< external trigger enable for inserted channel */
#define ADC_CTL1_ETSRC BITS(17, 19) /*!< external trigger select for regular channel */
#define ADC_CTL1_ETERC BIT(20) /*!< external trigger conversion mode for inserted channels */
#define ADC_CTL1_SWICST BIT(21) /*!< start on inserted channel */
#define ADC_CTL1_SWRCST BIT(22) /*!< start on regular channel */
#define ADC_CTL1_TSVREN BIT(23) /*!< channel 16 and 17 enable of ADC0 */
/* ADC_SAMPTx x=0..1 */
#define ADC_SAMPTX_SPTN BITS(0, 2) /*!< channel n sample time selection */
/* ADC_IOFFx x=0..3 */
#define ADC_IOFFX_IOFF BITS(0, 11) /*!< data offset for inserted channel x */
/* ADC_WDHT */
#define ADC_WDHT_WDHT BITS(0, 11) /*!< analog watchdog high threshold */
/* ADC_WDLT */
#define ADC_WDLT_WDLT BITS(0, 11) /*!< analog watchdog low threshold */
/* ADC_RSQx x=0..2 */
#define ADC_RSQX_RSQN BITS(0, 4) /*!< nth conversion in regular sequence */
#define ADC_RSQ0_RL BITS(20, 23) /*!< regular channel sequence length */
/* ADC_ISQ */
#define ADC_ISQ_ISQN BITS(0, 4) /*!< nth conversion in inserted sequence */
#define ADC_ISQ_IL BITS(20, 21) /*!< inserted sequence length */
/* ADC_IDATAx x=0..3*/
#define ADC_IDATAX_IDATAN BITS(0, 15) /*!< inserted data n */
/* ADC_RDATA */
#define ADC_RDATA_RDATA BITS(0, 15) /*!< regular data */
#define ADC_RDATA_ADC1RDTR BITS(16, 31) /*!< ADC1 regular channel data */
/* ADC_OVSCR */
#define ADC_OVSCR_OVSEN BIT(0) /*!< oversampling enable */
#define ADC_OVSCR_OVSR BITS(2, 4) /*!< oversampling ratio */
#define ADC_OVSCR_OVSS BITS(5, 8) /*!< oversampling shift */
#define ADC_OVSCR_TOVS BIT(9) /*!< triggered oversampling */
#define ADC_OVSCR_DRES BITS(12, 13) /*!< ADC data resolution */
/* constants definitions */
/* adc_stat register value */
#define ADC_FLAG_WDE ADC_STAT_WDE /*!< analog watchdog event flag */
#define ADC_FLAG_EOC ADC_STAT_EOC /*!< end of conversion */
#define ADC_FLAG_EOIC ADC_STAT_EOIC /*!< inserted channel end of conversion */
#define ADC_FLAG_STIC ADC_STAT_STIC /*!< inserted channel start flag */
#define ADC_FLAG_STRC ADC_STAT_STRC /*!< regular channel start flag */
/* adc_ctl0 register value */
#define CTL0_DISNUM(regval) (BITS(13, 15) & ((uint32_t)(regval) << 13)) /*!< write value to ADC_CTL0_DISNUM bit field */
/* scan mode */
#define ADC_SCAN_MODE ADC_CTL0_SM /*!< scan mode */
/* inserted channel group convert automatically */
#define ADC_INSERTED_CHANNEL_AUTO ADC_CTL0_ICA /*!< inserted channel group convert automatically */
/* ADC sync mode */
#define CTL0_SYNCM(regval) (BITS(16, 19) & ((uint32_t)(regval) << 16)) /*!< write value to ADC_CTL0_SYNCM bit field */
#define ADC_MODE_FREE CTL0_SYNCM(0) /*!< all the ADCs work independently */
#define ADC_DAUL_REGULAL_PARALLEL_INSERTED_PARALLEL CTL0_SYNCM(1) /*!< ADC0 and ADC1 work in combined regular parallel + inserted parallel mode */
#define ADC_DAUL_REGULAL_PARALLEL_INSERTED_ROTATION CTL0_SYNCM(2) /*!< ADC0 and ADC1 work in combined regular parallel + trigger rotation mode */
#define ADC_DAUL_INSERTED_PARALLEL_REGULAL_FOLLOWUP_FAST CTL0_SYNCM(3) /*!< ADC0 and ADC1 work in combined inserted parallel + follow-up fast mode */
#define ADC_DAUL_INSERTED_PARALLEL_REGULAL_FOLLOWUP_SLOW CTL0_SYNCM(4) /*!< ADC0 and ADC1 work in combined inserted parallel + follow-up slow mode */
#define ADC_DAUL_INSERTED_PARALLEL CTL0_SYNCM(5) /*!< ADC0 and ADC1 work in inserted parallel mode only */
#define ADC_DAUL_REGULAL_PARALLEL CTL0_SYNCM(6) /*!< ADC0 and ADC1 work in regular parallel mode only */
#define ADC_DAUL_REGULAL_FOLLOWUP_FAST CTL0_SYNCM(7) /*!< ADC0 and ADC1 work in follow-up fast mode only */
#define ADC_DAUL_REGULAL_FOLLOWUP_SLOW CTL0_SYNCM(8) /*!< ADC0 and ADC1 work in follow-up slow mode only */
#define ADC_DAUL_INSERTED_TRIGGER_ROTATION CTL0_SYNCM(9) /*!< ADC0 and ADC1 work in trigger rotation mode only */
/* adc_ctl1 register value */
#define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000U) /*!< LSB alignment */
#define ADC_DATAALIGN_LEFT ADC_CTL1_DAL /*!< MSB alignment */
/* continuous mode */
#define ADC_CONTINUOUS_MODE ADC_CTL1_CTN /*!< continuous mode */
/* external trigger select for regular channel */
#define CTL1_ETSRC(regval) (BITS(17, 19) & ((uint32_t)(regval) << 17)) /*!< write value to ADC_CTL1_ETSRC bit field */
/* for ADC0 and ADC1 regular channel */
#define ADC0_1_EXTTRIG_REGULAR_T0_CH0 CTL1_ETSRC(0) /*!< TIMER0 CH0 event select */
#define ADC0_1_EXTTRIG_REGULAR_T0_CH1 CTL1_ETSRC(1) /*!< TIMER0 CH1 event select */
#define ADC0_1_EXTTRIG_REGULAR_T0_CH2 CTL1_ETSRC(2) /*!< TIMER0 CH2 event select */
#define ADC0_1_EXTTRIG_REGULAR_T1_CH1 CTL1_ETSRC(3) /*!< TIMER1 CH1 event select */
#define ADC0_1_EXTTRIG_REGULAR_T2_TRGO CTL1_ETSRC(4) /*!< TIMER2 TRGO event select */
#define ADC0_1_EXTTRIG_REGULAR_T3_CH3 CTL1_ETSRC(5) /*!< TIMER3 CH3 event select */
#define ADC0_1_EXTTRIG_REGULAR_EXTI_11 CTL1_ETSRC(6) /*!< external interrupt line 11 */
#define ADC0_1_EXTTRIG_REGULAR_NONE CTL1_ETSRC(7) /*!< software trigger */
/* external trigger mode for inserted channel */
#define CTL1_ETSIC(regval) (BITS(12, 14) & ((uint32_t)(regval) << 12)) /*!< write value to ADC_CTL1_ETSIC bit field */
/* for ADC0 and ADC1 inserted channel */
#define ADC0_1_EXTTRIG_INSERTED_T0_TRGO CTL1_ETSIC(0) /*!< TIMER0 TRGO event select */
#define ADC0_1_EXTTRIG_INSERTED_T0_CH3 CTL1_ETSIC(1) /*!< TIMER0 CH3 event select */
#define ADC0_1_EXTTRIG_INSERTED_T1_TRGO CTL1_ETSIC(2) /*!< TIMER1 TRGO event select */
#define ADC0_1_EXTTRIG_INSERTED_T1_CH0 CTL1_ETSIC(3) /*!< TIMER1 CH0 event select */
#define ADC0_1_EXTTRIG_INSERTED_T2_CH3 CTL1_ETSIC(4) /*!< TIMER2 CH3 event select */
#define ADC0_1_EXTTRIG_INSERTED_T3_TRGO CTL1_ETSIC(5) /*!< TIMER3 TRGO event select */
#define ADC0_1_EXTTRIG_INSERTED_EXTI_15 CTL1_ETSIC(6) /*!< external interrupt line 15 */
#define ADC0_1_EXTTRIG_INSERTED_NONE CTL1_ETSIC(7) /*!< software trigger */
/* adc_samptx register value */
#define SAMPTX_SPT(regval) (BITS(0, 2) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_SAMPTX_SPT bit field */
#define ADC_SAMPLETIME_1POINT5 SAMPTX_SPT(0) /*!< 1.5 sampling cycles */
#define ADC_SAMPLETIME_7POINT5 SAMPTX_SPT(1) /*!< 7.5 sampling cycles */
#define ADC_SAMPLETIME_13POINT5 SAMPTX_SPT(2) /*!< 13.5 sampling cycles */
#define ADC_SAMPLETIME_28POINT5 SAMPTX_SPT(3) /*!< 28.5 sampling cycles */
#define ADC_SAMPLETIME_41POINT5 SAMPTX_SPT(4) /*!< 41.5 sampling cycles */
#define ADC_SAMPLETIME_55POINT5 SAMPTX_SPT(5) /*!< 55.5 sampling cycles */
#define ADC_SAMPLETIME_71POINT5 SAMPTX_SPT(6) /*!< 71.5 sampling cycles */
#define ADC_SAMPLETIME_239POINT5 SAMPTX_SPT(7) /*!< 239.5 sampling cycles */
/* adc_ioffx register value */
#define IOFFX_IOFF(regval) (BITS(0, 11) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_IOFFX_IOFF bit field */
/* adc_wdht register value */
#define WDHT_WDHT(regval) (BITS(0, 11) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_WDHT_WDHT bit field */
/* adc_wdlt register value */
#define WDLT_WDLT(regval) (BITS(0, 11) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_WDLT_WDLT bit field */
/* adc_rsqx register value */
#define RSQ0_RL(regval) (BITS(20, 23) & ((uint32_t)(regval) << 20)) /*!< write value to ADC_RSQ0_RL bit field */
/* adc_isq register value */
#define ISQ_IL(regval) (BITS(20, 21) & ((uint32_t)(regval) << 20)) /*!< write value to ADC_ISQ_IL bit field */
/* ADC channel group definitions */
#define ADC_REGULAR_CHANNEL ((uint8_t)0x01U) /*!< adc regular channel group */
#define ADC_INSERTED_CHANNEL ((uint8_t)0x02U) /*!< adc inserted channel group */
#define ADC_REGULAR_INSERTED_CHANNEL ((uint8_t)0x03U) /*!< both regular and inserted channel group */
#define ADC_CHANNEL_DISCON_DISABLE ((uint8_t)0x04U) /*!< disable discontinuous mode of regular & inserted channel */
/* ADC inserted channel definitions */
#define ADC_INSERTED_CHANNEL_0 ((uint8_t)0x00U) /*!< adc inserted channel 0 */
#define ADC_INSERTED_CHANNEL_1 ((uint8_t)0x01U) /*!< adc inserted channel 1 */
#define ADC_INSERTED_CHANNEL_2 ((uint8_t)0x02U) /*!< adc inserted channel 2 */
#define ADC_INSERTED_CHANNEL_3 ((uint8_t)0x03U) /*!< adc inserted channel 3 */
/* ADC channel definitions */
#define ADC_CHANNEL_0 ((uint8_t)0x00U) /*!< ADC channel 0 */
#define ADC_CHANNEL_1 ((uint8_t)0x01U) /*!< ADC channel 1 */
#define ADC_CHANNEL_2 ((uint8_t)0x02U) /*!< ADC channel 2 */
#define ADC_CHANNEL_3 ((uint8_t)0x03U) /*!< ADC channel 3 */
#define ADC_CHANNEL_4 ((uint8_t)0x04U) /*!< ADC channel 4 */
#define ADC_CHANNEL_5 ((uint8_t)0x05U) /*!< ADC channel 5 */
#define ADC_CHANNEL_6 ((uint8_t)0x06U) /*!< ADC channel 6 */
#define ADC_CHANNEL_7 ((uint8_t)0x07U) /*!< ADC channel 7 */
#define ADC_CHANNEL_8 ((uint8_t)0x08U) /*!< ADC channel 8 */
#define ADC_CHANNEL_9 ((uint8_t)0x09U) /*!< ADC channel 9 */
#define ADC_CHANNEL_10 ((uint8_t)0x0AU) /*!< ADC channel 10 */
#define ADC_CHANNEL_11 ((uint8_t)0x0BU) /*!< ADC channel 11 */
#define ADC_CHANNEL_12 ((uint8_t)0x0CU) /*!< ADC channel 12 */
#define ADC_CHANNEL_13 ((uint8_t)0x0DU) /*!< ADC channel 13 */
#define ADC_CHANNEL_14 ((uint8_t)0x0EU) /*!< ADC channel 14 */
#define ADC_CHANNEL_15 ((uint8_t)0x0FU) /*!< ADC channel 15 */
#define ADC_CHANNEL_16 ((uint8_t)0x10U) /*!< ADC channel 16 */
#define ADC_CHANNEL_17 ((uint8_t)0x11U) /*!< ADC channel 17 */
/* ADC interrupt */
#define ADC_INT_WDE ADC_STAT_WDE /*!< analog watchdog event interrupt */
#define ADC_INT_EOC ADC_STAT_EOC /*!< end of group conversion interrupt */
#define ADC_INT_EOIC ADC_STAT_EOIC /*!< end of inserted group conversion interrupt */
/* ADC interrupt flag */
#define ADC_INT_FLAG_WDE ADC_STAT_WDE /*!< analog watchdog event interrupt flag */
#define ADC_INT_FLAG_EOC ADC_STAT_EOC /*!< end of group conversion interrupt flag */
#define ADC_INT_FLAG_EOIC ADC_STAT_EOIC /*!< end of inserted group conversion interrupt flag */
/* ADC resolution definitions */
#define OVSCR_DRES(regval) (BITS(12, 13) & ((uint32_t)(regval) << 12))
#define ADC_RESOLUTION_12B OVSCR_DRES(0) /*!< 12-bit ADC resolution */
#define ADC_RESOLUTION_10B OVSCR_DRES(1) /*!< 10-bit ADC resolution */
#define ADC_RESOLUTION_8B OVSCR_DRES(2) /*!< 8-bit ADC resolution */
#define ADC_RESOLUTION_6B OVSCR_DRES(3) /*!< 6-bit ADC resolution */
/* ADC oversampling mode */
#define ADC_OVERSAMPLING_ALL_CONVERT 0 /*!< all oversampled conversions for a channel are done consecutively after a trigger */
#define ADC_OVERSAMPLING_ONE_CONVERT 1 /*!< each oversampled conversion for a channel needs a trigger */
/* ADC oversampling shift */
#define OVSCR_OVSS(regval) (BITS(5, 8) & ((uint32_t)(regval) << 5))
#define ADC_OVERSAMPLING_SHIFT_NONE OVSCR_OVSS(0) /*!< no oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_1B OVSCR_OVSS(1) /*!< 1-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_2B OVSCR_OVSS(2) /*!< 2-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_3B OVSCR_OVSS(3) /*!< 3-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_4B OVSCR_OVSS(4) /*!< 4-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_5B OVSCR_OVSS(5) /*!< 5-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_6B OVSCR_OVSS(6) /*!< 6-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_7B OVSCR_OVSS(7) /*!< 7-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_8B OVSCR_OVSS(8) /*!< 8-bit oversampling shift */
/* ADC oversampling ratio */
#define OVSCR_OVSR(regval) (BITS(2, 4) & ((uint32_t)(regval) << 2))
#define ADC_OVERSAMPLING_RATIO_MUL2 OVSCR_OVSR(0) /*!< oversampling ratio X2 */
#define ADC_OVERSAMPLING_RATIO_MUL4 OVSCR_OVSR(1) /*!< oversampling ratio X4 */
#define ADC_OVERSAMPLING_RATIO_MUL8 OVSCR_OVSR(2) /*!< oversampling ratio X8 */
#define ADC_OVERSAMPLING_RATIO_MUL16 OVSCR_OVSR(3) /*!< oversampling ratio X16 */
#define ADC_OVERSAMPLING_RATIO_MUL32 OVSCR_OVSR(4) /*!< oversampling ratio X32 */
#define ADC_OVERSAMPLING_RATIO_MUL64 OVSCR_OVSR(5) /*!< oversampling ratio X64 */
#define ADC_OVERSAMPLING_RATIO_MUL128 OVSCR_OVSR(6) /*!< oversampling ratio X128 */
#define ADC_OVERSAMPLING_RATIO_MUL256 OVSCR_OVSR(7) /*!< oversampling ratio X256 */
/* function declarations */
/* initialization config */
/* reset ADC */
void adc_deinit(uint32_t adc_periph);
/* configure the ADC sync mode */
void adc_mode_config(uint32_t adc_periph, uint32_t mode);
/* enable or disable ADC special function */
void adc_special_function_config(uint32_t adc_periph, uint32_t function, ControlStatus newvalue);
/* configure ADC data alignment */
void adc_data_alignment_config(uint32_t adc_periph, uint32_t data_alignment);
/* enable ADC interface */
void adc_enable(uint32_t adc_periph);
/* disable ADC interface */
void adc_disable(uint32_t adc_periph);
/* ADC calibration and reset calibration */
void adc_calibration_enable(uint32_t adc_periph);
/* enable the temperature sensor and Vrefint channel */
void adc_tempsensor_vrefint_enable(void);
/* disable the temperature sensor and Vrefint channel */
void adc_tempsensor_vrefint_disable(void);
/* DMA config */
/* enable DMA request */
void adc_dma_mode_enable(uint32_t adc_periph);
/* disable DMA request */
void adc_dma_mode_disable(uint32_t adc_periph);
/* regular group and inserted group config */
/* configure ADC discontinuous mode */
void adc_discontinuous_mode_config(uint32_t adc_periph, uint8_t adc_channel_group, uint8_t length);
/* configure the length of regular channel group or inserted channel group */
void adc_channel_length_config(uint32_t adc_periph, uint8_t adc_channel_group, uint32_t length);
/* configure ADC regular channel */
void adc_regular_channel_config(uint32_t adc_periph, uint8_t rank, uint8_t adc_channel, uint32_t sample_time);
/* configure ADC inserted channel */
void adc_inserted_channel_config(uint32_t adc_periph, uint8_t rank, uint8_t adc_channel, uint32_t sample_time);
/* configure ADC inserted channel offset */
void adc_inserted_channel_offset_config(uint32_t adc_periph, uint8_t inserted_channel, uint16_t offset);
/* configure ADC external trigger source */
void adc_external_trigger_source_config(uint32_t adc_periph, uint8_t adc_channel_group, uint32_t external_trigger_source);
/* configure ADC external trigger */
void adc_external_trigger_config(uint32_t adc_periph, uint8_t adc_channel_group, ControlStatus newvalue);
/* enable ADC software trigger */
void adc_software_trigger_enable(uint32_t adc_periph, uint8_t adc_channel_group);
/* get channel data */
/* read ADC regular group data register */
uint16_t adc_regular_data_read(uint32_t adc_periph);
/* read ADC inserted group data register */
uint16_t adc_inserted_data_read(uint32_t adc_periph, uint8_t inserted_channel);
/* read the last ADC0 and ADC1 conversion result data in sync mode */
uint32_t adc_sync_mode_convert_value_read(void);
/* watchdog config */
/* configure ADC analog watchdog single channel */
void adc_watchdog_single_channel_enable(uint32_t adc_periph, uint8_t adc_channel);
/* configure ADC analog watchdog group channel */
void adc_watchdog_group_channel_enable(uint32_t adc_periph, uint8_t adc_channel_group);
/* disable ADC analog watchdog */
void adc_watchdog_disable(uint32_t adc_periph);
/* configure ADC analog watchdog threshold */
void adc_watchdog_threshold_config(uint32_t adc_periph, uint16_t low_threshold, uint16_t high_threshold);
/* interrupt & flag functions */
/* get the ADC flag bits */
FlagStatus adc_flag_get(uint32_t adc_periph, uint32_t adc_flag);
/* clear the ADC flag bits */
void adc_flag_clear(uint32_t adc_periph, uint32_t adc_flag);
/* get the bit state of ADCx software start conversion */
FlagStatus adc_regular_software_startconv_flag_get(uint32_t adc_periph);
/* get the bit state of ADCx software inserted channel start conversion */
FlagStatus adc_inserted_software_startconv_flag_get(uint32_t adc_periph);
/* get the ADC interrupt bits */
FlagStatus adc_interrupt_flag_get(uint32_t adc_periph, uint32_t adc_interrupt);
/* clear the ADC flag */
void adc_interrupt_flag_clear(uint32_t adc_periph, uint32_t adc_interrupt);
/* enable ADC interrupt */
void adc_interrupt_enable(uint32_t adc_periph, uint32_t adc_interrupt);
/* disable ADC interrupt */
void adc_interrupt_disable(uint32_t adc_periph, uint32_t adc_interrupt);
/* ADC resolution & oversample */
/* ADC resolution config */
void adc_resolution_config(uint32_t adc_periph, uint32_t resolution);
/* ADC oversample mode config */
void adc_oversample_mode_config(uint32_t adc_periph, uint8_t mode, uint16_t shift, uint8_t ratio);
/* enable ADC oversample mode */
void adc_oversample_mode_enable(uint32_t adc_periph);
/* disable ADC oversample mode */
void adc_oversample_mode_disable(uint32_t adc_periph);
#endif /* GD32VF103_ADC_H */
/*!
\file gd32vf103_adc.h
\brief definitions for the ADC
\version 2020-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef GD32VF103_ADC_H
#define GD32VF103_ADC_H
#include "gd32vf103.h"
/* ADC definitions */
#define ADC0 ADC_BASE
#define ADC1 (ADC_BASE + 0x400U)
/* registers definitions */
#define ADC_STAT(adcx) REG32((adcx) + 0x00U) /*!< ADC status register */
#define ADC_CTL0(adcx) REG32((adcx) + 0x04U) /*!< ADC control register 0 */
#define ADC_CTL1(adcx) REG32((adcx) + 0x08U) /*!< ADC control register 1 */
#define ADC_SAMPT0(adcx) REG32((adcx) + 0x0CU) /*!< ADC sampling time register 0 */
#define ADC_SAMPT1(adcx) REG32((adcx) + 0x10U) /*!< ADC sampling time register 1 */
#define ADC_IOFF0(adcx) REG32((adcx) + 0x14U) /*!< ADC inserted channel data offset register 0 */
#define ADC_IOFF1(adcx) REG32((adcx) + 0x18U) /*!< ADC inserted channel data offset register 1 */
#define ADC_IOFF2(adcx) REG32((adcx) + 0x1CU) /*!< ADC inserted channel data offset register 2 */
#define ADC_IOFF3(adcx) REG32((adcx) + 0x20U) /*!< ADC inserted channel data offset register 3 */
#define ADC_WDHT(adcx) REG32((adcx) + 0x24U) /*!< ADC watchdog high threshold register */
#define ADC_WDLT(adcx) REG32((adcx) + 0x28U) /*!< ADC watchdog low threshold register */
#define ADC_RSQ0(adcx) REG32((adcx) + 0x2CU) /*!< ADC regular sequence register 0 */
#define ADC_RSQ1(adcx) REG32((adcx) + 0x30U) /*!< ADC regular sequence register 1 */
#define ADC_RSQ2(adcx) REG32((adcx) + 0x34U) /*!< ADC regular sequence register 2 */
#define ADC_ISQ(adcx) REG32((adcx) + 0x38U) /*!< ADC inserted sequence register */
#define ADC_IDATA0(adcx) REG32((adcx) + 0x3CU) /*!< ADC inserted data register 0 */
#define ADC_IDATA1(adcx) REG32((adcx) + 0x40U) /*!< ADC inserted data register 1 */
#define ADC_IDATA2(adcx) REG32((adcx) + 0x44U) /*!< ADC inserted data register 2 */
#define ADC_IDATA3(adcx) REG32((adcx) + 0x48U) /*!< ADC inserted data register 3 */
#define ADC_RDATA(adcx) REG32((adcx) + 0x4CU) /*!< ADC regular data register */
#define ADC_OVSCR(adcx) REG32((adcx) + 0x80U) /*!< ADC oversample control register */
/* bits definitions */
/* ADC_STAT */
#define ADC_STAT_WDE BIT(0) /*!< analog watchdog event flag */
#define ADC_STAT_EOC BIT(1) /*!< end of conversion */
#define ADC_STAT_EOIC BIT(2) /*!< inserted channel end of conversion */
#define ADC_STAT_STIC BIT(3) /*!< inserted channel start flag */
#define ADC_STAT_STRC BIT(4) /*!< regular channel start flag */
/* ADC_CTL0 */
#define ADC_CTL0_WDCHSEL BITS(0, 4) /*!< analog watchdog channel select bits */
#define ADC_CTL0_EOCIE BIT(5) /*!< interrupt enable for EOC */
#define ADC_CTL0_WDEIE BIT(6) /*!< analog watchdog interrupt enable */
#define ADC_CTL0_EOICIE BIT(7) /*!< interrupt enable for inserted channels */
#define ADC_CTL0_SM BIT(8) /*!< scan mode */
#define ADC_CTL0_WDSC BIT(9) /*!< when in scan mode, analog watchdog is effective on a single channel */
#define ADC_CTL0_ICA BIT(10) /*!< automatic inserted group conversion */
#define ADC_CTL0_DISRC BIT(11) /*!< discontinuous mode on regular channels */
#define ADC_CTL0_DISIC BIT(12) /*!< discontinuous mode on inserted channels */
#define ADC_CTL0_DISNUM BITS(13, 15) /*!< discontinuous mode channel count */
#define ADC_CTL0_SYNCM BITS(16, 19) /*!< sync mode selection */
#define ADC_CTL0_IWDEN BIT(22) /*!< analog watchdog enable on inserted channels */
#define ADC_CTL0_RWDEN BIT(23) /*!< analog watchdog enable on regular channels */
/* ADC_CTL1 */
#define ADC_CTL1_ADCON BIT(0) /*!< ADC converter on */
#define ADC_CTL1_CTN BIT(1) /*!< continuous conversion */
#define ADC_CTL1_CLB BIT(2) /*!< ADC calibration */
#define ADC_CTL1_RSTCLB BIT(3) /*!< reset calibration */
#define ADC_CTL1_DMA BIT(8) /*!< direct memory access mode */
#define ADC_CTL1_DAL BIT(11) /*!< data alignment */
#define ADC_CTL1_ETSIC BITS(12, 14) /*!< external trigger select for inserted channel */
#define ADC_CTL1_ETEIC BIT(15) /*!< external trigger enable for inserted channel */
#define ADC_CTL1_ETSRC BITS(17, 19) /*!< external trigger select for regular channel */
#define ADC_CTL1_ETERC BIT(20) /*!< external trigger conversion mode for inserted channels */
#define ADC_CTL1_SWICST BIT(21) /*!< start on inserted channel */
#define ADC_CTL1_SWRCST BIT(22) /*!< start on regular channel */
#define ADC_CTL1_TSVREN BIT(23) /*!< channel 16 and 17 enable of ADC0 */
/* ADC_SAMPTx x=0..1 */
#define ADC_SAMPTX_SPTN BITS(0, 2) /*!< channel n sample time selection */
/* ADC_IOFFx x=0..3 */
#define ADC_IOFFX_IOFF BITS(0, 11) /*!< data offset for inserted channel x */
/* ADC_WDHT */
#define ADC_WDHT_WDHT BITS(0, 11) /*!< analog watchdog high threshold */
/* ADC_WDLT */
#define ADC_WDLT_WDLT BITS(0, 11) /*!< analog watchdog low threshold */
/* ADC_RSQx x=0..2 */
#define ADC_RSQX_RSQN BITS(0, 4) /*!< nth conversion in regular sequence */
#define ADC_RSQ0_RL BITS(20, 23) /*!< regular channel sequence length */
/* ADC_ISQ */
#define ADC_ISQ_ISQN BITS(0, 4) /*!< nth conversion in inserted sequence */
#define ADC_ISQ_IL BITS(20, 21) /*!< inserted sequence length */
/* ADC_IDATAx x=0..3*/
#define ADC_IDATAX_IDATAN BITS(0, 15) /*!< inserted data n */
/* ADC_RDATA */
#define ADC_RDATA_RDATA BITS(0, 15) /*!< regular data */
#define ADC_RDATA_ADC1RDTR BITS(16, 31) /*!< ADC1 regular channel data */
/* ADC_OVSCR */
#define ADC_OVSCR_OVSEN BIT(0) /*!< oversampling enable */
#define ADC_OVSCR_OVSR BITS(2, 4) /*!< oversampling ratio */
#define ADC_OVSCR_OVSS BITS(5, 8) /*!< oversampling shift */
#define ADC_OVSCR_TOVS BIT(9) /*!< triggered oversampling */
#define ADC_OVSCR_DRES BITS(12, 13) /*!< ADC data resolution */
/* constants definitions */
/* adc_stat register value */
#define ADC_FLAG_WDE ADC_STAT_WDE /*!< analog watchdog event flag */
#define ADC_FLAG_EOC ADC_STAT_EOC /*!< end of conversion */
#define ADC_FLAG_EOIC ADC_STAT_EOIC /*!< inserted channel end of conversion */
#define ADC_FLAG_STIC ADC_STAT_STIC /*!< inserted channel start flag */
#define ADC_FLAG_STRC ADC_STAT_STRC /*!< regular channel start flag */
/* adc_ctl0 register value */
#define CTL0_DISNUM(regval) (BITS(13, 15) & ((uint32_t)(regval) << 13)) /*!< write value to ADC_CTL0_DISNUM bit field */
/* scan mode */
#define ADC_SCAN_MODE ADC_CTL0_SM /*!< scan mode */
/* inserted channel group convert automatically */
#define ADC_INSERTED_CHANNEL_AUTO ADC_CTL0_ICA /*!< inserted channel group convert automatically */
/* ADC sync mode */
#define CTL0_SYNCM(regval) (BITS(16, 19) & ((uint32_t)(regval) << 16)) /*!< write value to ADC_CTL0_SYNCM bit field */
#define ADC_MODE_FREE CTL0_SYNCM(0) /*!< all the ADCs work independently */
#define ADC_DAUL_REGULAL_PARALLEL_INSERTED_PARALLEL CTL0_SYNCM(1) /*!< ADC0 and ADC1 work in combined regular parallel + inserted parallel mode */
#define ADC_DAUL_REGULAL_PARALLEL_INSERTED_ROTATION CTL0_SYNCM(2) /*!< ADC0 and ADC1 work in combined regular parallel + trigger rotation mode */
#define ADC_DAUL_INSERTED_PARALLEL_REGULAL_FOLLOWUP_FAST CTL0_SYNCM(3) /*!< ADC0 and ADC1 work in combined inserted parallel + follow-up fast mode */
#define ADC_DAUL_INSERTED_PARALLEL_REGULAL_FOLLOWUP_SLOW CTL0_SYNCM(4) /*!< ADC0 and ADC1 work in combined inserted parallel + follow-up slow mode */
#define ADC_DAUL_INSERTED_PARALLEL CTL0_SYNCM(5) /*!< ADC0 and ADC1 work in inserted parallel mode only */
#define ADC_DAUL_REGULAL_PARALLEL CTL0_SYNCM(6) /*!< ADC0 and ADC1 work in regular parallel mode only */
#define ADC_DAUL_REGULAL_FOLLOWUP_FAST CTL0_SYNCM(7) /*!< ADC0 and ADC1 work in follow-up fast mode only */
#define ADC_DAUL_REGULAL_FOLLOWUP_SLOW CTL0_SYNCM(8) /*!< ADC0 and ADC1 work in follow-up slow mode only */
#define ADC_DAUL_INSERTED_TRIGGER_ROTATION CTL0_SYNCM(9) /*!< ADC0 and ADC1 work in trigger rotation mode only */
/* adc_ctl1 register value */
#define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000U) /*!< LSB alignment */
#define ADC_DATAALIGN_LEFT ADC_CTL1_DAL /*!< MSB alignment */
/* continuous mode */
#define ADC_CONTINUOUS_MODE ADC_CTL1_CTN /*!< continuous mode */
/* external trigger select for regular channel */
#define CTL1_ETSRC(regval) (BITS(17, 19) & ((uint32_t)(regval) << 17)) /*!< write value to ADC_CTL1_ETSRC bit field */
/* for ADC0 and ADC1 regular channel */
#define ADC0_1_EXTTRIG_REGULAR_T0_CH0 CTL1_ETSRC(0) /*!< TIMER0 CH0 event select */
#define ADC0_1_EXTTRIG_REGULAR_T0_CH1 CTL1_ETSRC(1) /*!< TIMER0 CH1 event select */
#define ADC0_1_EXTTRIG_REGULAR_T0_CH2 CTL1_ETSRC(2) /*!< TIMER0 CH2 event select */
#define ADC0_1_EXTTRIG_REGULAR_T1_CH1 CTL1_ETSRC(3) /*!< TIMER1 CH1 event select */
#define ADC0_1_EXTTRIG_REGULAR_T2_TRGO CTL1_ETSRC(4) /*!< TIMER2 TRGO event select */
#define ADC0_1_EXTTRIG_REGULAR_T3_CH3 CTL1_ETSRC(5) /*!< TIMER3 CH3 event select */
#define ADC0_1_EXTTRIG_REGULAR_EXTI_11 CTL1_ETSRC(6) /*!< external interrupt line 11 */
#define ADC0_1_EXTTRIG_REGULAR_NONE CTL1_ETSRC(7) /*!< software trigger */
/* external trigger mode for inserted channel */
#define CTL1_ETSIC(regval) (BITS(12, 14) & ((uint32_t)(regval) << 12)) /*!< write value to ADC_CTL1_ETSIC bit field */
/* for ADC0 and ADC1 inserted channel */
#define ADC0_1_EXTTRIG_INSERTED_T0_TRGO CTL1_ETSIC(0) /*!< TIMER0 TRGO event select */
#define ADC0_1_EXTTRIG_INSERTED_T0_CH3 CTL1_ETSIC(1) /*!< TIMER0 CH3 event select */
#define ADC0_1_EXTTRIG_INSERTED_T1_TRGO CTL1_ETSIC(2) /*!< TIMER1 TRGO event select */
#define ADC0_1_EXTTRIG_INSERTED_T1_CH0 CTL1_ETSIC(3) /*!< TIMER1 CH0 event select */
#define ADC0_1_EXTTRIG_INSERTED_T2_CH3 CTL1_ETSIC(4) /*!< TIMER2 CH3 event select */
#define ADC0_1_EXTTRIG_INSERTED_T3_TRGO CTL1_ETSIC(5) /*!< TIMER3 TRGO event select */
#define ADC0_1_EXTTRIG_INSERTED_EXTI_15 CTL1_ETSIC(6) /*!< external interrupt line 15 */
#define ADC0_1_EXTTRIG_INSERTED_NONE CTL1_ETSIC(7) /*!< software trigger */
/* adc_samptx register value */
#define SAMPTX_SPT(regval) (BITS(0, 2) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_SAMPTX_SPT bit field */
#define ADC_SAMPLETIME_1POINT5 SAMPTX_SPT(0) /*!< 1.5 sampling cycles */
#define ADC_SAMPLETIME_7POINT5 SAMPTX_SPT(1) /*!< 7.5 sampling cycles */
#define ADC_SAMPLETIME_13POINT5 SAMPTX_SPT(2) /*!< 13.5 sampling cycles */
#define ADC_SAMPLETIME_28POINT5 SAMPTX_SPT(3) /*!< 28.5 sampling cycles */
#define ADC_SAMPLETIME_41POINT5 SAMPTX_SPT(4) /*!< 41.5 sampling cycles */
#define ADC_SAMPLETIME_55POINT5 SAMPTX_SPT(5) /*!< 55.5 sampling cycles */
#define ADC_SAMPLETIME_71POINT5 SAMPTX_SPT(6) /*!< 71.5 sampling cycles */
#define ADC_SAMPLETIME_239POINT5 SAMPTX_SPT(7) /*!< 239.5 sampling cycles */
/* adc_ioffx register value */
#define IOFFX_IOFF(regval) (BITS(0, 11) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_IOFFX_IOFF bit field */
/* adc_wdht register value */
#define WDHT_WDHT(regval) (BITS(0, 11) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_WDHT_WDHT bit field */
/* adc_wdlt register value */
#define WDLT_WDLT(regval) (BITS(0, 11) & ((uint32_t)(regval) << 0)) /*!< write value to ADC_WDLT_WDLT bit field */
/* adc_rsqx register value */
#define RSQ0_RL(regval) (BITS(20, 23) & ((uint32_t)(regval) << 20)) /*!< write value to ADC_RSQ0_RL bit field */
/* adc_isq register value */
#define ISQ_IL(regval) (BITS(20, 21) & ((uint32_t)(regval) << 20)) /*!< write value to ADC_ISQ_IL bit field */
/* ADC channel group definitions */
#define ADC_REGULAR_CHANNEL ((uint8_t)0x01U) /*!< adc regular channel group */
#define ADC_INSERTED_CHANNEL ((uint8_t)0x02U) /*!< adc inserted channel group */
#define ADC_REGULAR_INSERTED_CHANNEL ((uint8_t)0x03U) /*!< both regular and inserted channel group */
#define ADC_CHANNEL_DISCON_DISABLE ((uint8_t)0x04U) /*!< disable discontinuous mode of regular & inserted channel */
/* ADC inserted channel definitions */
#define ADC_INSERTED_CHANNEL_0 ((uint8_t)0x00U) /*!< adc inserted channel 0 */
#define ADC_INSERTED_CHANNEL_1 ((uint8_t)0x01U) /*!< adc inserted channel 1 */
#define ADC_INSERTED_CHANNEL_2 ((uint8_t)0x02U) /*!< adc inserted channel 2 */
#define ADC_INSERTED_CHANNEL_3 ((uint8_t)0x03U) /*!< adc inserted channel 3 */
/* ADC channel definitions */
#define ADC_CHANNEL_0 ((uint8_t)0x00U) /*!< ADC channel 0 */
#define ADC_CHANNEL_1 ((uint8_t)0x01U) /*!< ADC channel 1 */
#define ADC_CHANNEL_2 ((uint8_t)0x02U) /*!< ADC channel 2 */
#define ADC_CHANNEL_3 ((uint8_t)0x03U) /*!< ADC channel 3 */
#define ADC_CHANNEL_4 ((uint8_t)0x04U) /*!< ADC channel 4 */
#define ADC_CHANNEL_5 ((uint8_t)0x05U) /*!< ADC channel 5 */
#define ADC_CHANNEL_6 ((uint8_t)0x06U) /*!< ADC channel 6 */
#define ADC_CHANNEL_7 ((uint8_t)0x07U) /*!< ADC channel 7 */
#define ADC_CHANNEL_8 ((uint8_t)0x08U) /*!< ADC channel 8 */
#define ADC_CHANNEL_9 ((uint8_t)0x09U) /*!< ADC channel 9 */
#define ADC_CHANNEL_10 ((uint8_t)0x0AU) /*!< ADC channel 10 */
#define ADC_CHANNEL_11 ((uint8_t)0x0BU) /*!< ADC channel 11 */
#define ADC_CHANNEL_12 ((uint8_t)0x0CU) /*!< ADC channel 12 */
#define ADC_CHANNEL_13 ((uint8_t)0x0DU) /*!< ADC channel 13 */
#define ADC_CHANNEL_14 ((uint8_t)0x0EU) /*!< ADC channel 14 */
#define ADC_CHANNEL_15 ((uint8_t)0x0FU) /*!< ADC channel 15 */
#define ADC_CHANNEL_16 ((uint8_t)0x10U) /*!< ADC channel 16 */
#define ADC_CHANNEL_17 ((uint8_t)0x11U) /*!< ADC channel 17 */
/* ADC interrupt */
#define ADC_INT_WDE ADC_STAT_WDE /*!< analog watchdog event interrupt */
#define ADC_INT_EOC ADC_STAT_EOC /*!< end of group conversion interrupt */
#define ADC_INT_EOIC ADC_STAT_EOIC /*!< end of inserted group conversion interrupt */
/* ADC interrupt flag */
#define ADC_INT_FLAG_WDE ADC_STAT_WDE /*!< analog watchdog event interrupt flag */
#define ADC_INT_FLAG_EOC ADC_STAT_EOC /*!< end of group conversion interrupt flag */
#define ADC_INT_FLAG_EOIC ADC_STAT_EOIC /*!< end of inserted group conversion interrupt flag */
/* ADC resolution definitions */
#define OVSCR_DRES(regval) (BITS(12, 13) & ((uint32_t)(regval) << 12))
#define ADC_RESOLUTION_12B OVSCR_DRES(0) /*!< 12-bit ADC resolution */
#define ADC_RESOLUTION_10B OVSCR_DRES(1) /*!< 10-bit ADC resolution */
#define ADC_RESOLUTION_8B OVSCR_DRES(2) /*!< 8-bit ADC resolution */
#define ADC_RESOLUTION_6B OVSCR_DRES(3) /*!< 6-bit ADC resolution */
/* ADC oversampling mode */
#define ADC_OVERSAMPLING_ALL_CONVERT 0 /*!< all oversampled conversions for a channel are done consecutively after a trigger */
#define ADC_OVERSAMPLING_ONE_CONVERT 1 /*!< each oversampled conversion for a channel needs a trigger */
/* ADC oversampling shift */
#define OVSCR_OVSS(regval) (BITS(5, 8) & ((uint32_t)(regval) << 5))
#define ADC_OVERSAMPLING_SHIFT_NONE OVSCR_OVSS(0) /*!< no oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_1B OVSCR_OVSS(1) /*!< 1-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_2B OVSCR_OVSS(2) /*!< 2-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_3B OVSCR_OVSS(3) /*!< 3-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_4B OVSCR_OVSS(4) /*!< 4-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_5B OVSCR_OVSS(5) /*!< 5-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_6B OVSCR_OVSS(6) /*!< 6-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_7B OVSCR_OVSS(7) /*!< 7-bit oversampling shift */
#define ADC_OVERSAMPLING_SHIFT_8B OVSCR_OVSS(8) /*!< 8-bit oversampling shift */
/* ADC oversampling ratio */
#define OVSCR_OVSR(regval) (BITS(2, 4) & ((uint32_t)(regval) << 2))
#define ADC_OVERSAMPLING_RATIO_MUL2 OVSCR_OVSR(0) /*!< oversampling ratio X2 */
#define ADC_OVERSAMPLING_RATIO_MUL4 OVSCR_OVSR(1) /*!< oversampling ratio X4 */
#define ADC_OVERSAMPLING_RATIO_MUL8 OVSCR_OVSR(2) /*!< oversampling ratio X8 */
#define ADC_OVERSAMPLING_RATIO_MUL16 OVSCR_OVSR(3) /*!< oversampling ratio X16 */
#define ADC_OVERSAMPLING_RATIO_MUL32 OVSCR_OVSR(4) /*!< oversampling ratio X32 */
#define ADC_OVERSAMPLING_RATIO_MUL64 OVSCR_OVSR(5) /*!< oversampling ratio X64 */
#define ADC_OVERSAMPLING_RATIO_MUL128 OVSCR_OVSR(6) /*!< oversampling ratio X128 */
#define ADC_OVERSAMPLING_RATIO_MUL256 OVSCR_OVSR(7) /*!< oversampling ratio X256 */
/* function declarations */
/* initialization config */
/* reset ADC */
void adc_deinit(uint32_t adc_periph);
/* configure the ADC sync mode */
void adc_mode_config(uint32_t mode);
/* enable or disable ADC special function */
void adc_special_function_config(uint32_t adc_periph, uint32_t function, ControlStatus newvalue);
/* configure ADC data alignment */
void adc_data_alignment_config(uint32_t adc_periph, uint32_t data_alignment);
/* enable ADC interface */
void adc_enable(uint32_t adc_periph);
/* disable ADC interface */
void adc_disable(uint32_t adc_periph);
/* ADC calibration and reset calibration */
void adc_calibration_enable(uint32_t adc_periph);
/* enable the temperature sensor and Vrefint channel */
void adc_tempsensor_vrefint_enable(void);
/* disable the temperature sensor and Vrefint channel */
void adc_tempsensor_vrefint_disable(void);
/* DMA config */
/* enable DMA request */
void adc_dma_mode_enable(uint32_t adc_periph);
/* disable DMA request */
void adc_dma_mode_disable(uint32_t adc_periph);
/* regular group and inserted group config */
/* configure ADC discontinuous mode */
void adc_discontinuous_mode_config(uint32_t adc_periph, uint8_t adc_channel_group, uint8_t length);
/* configure the length of regular channel group or inserted channel group */
void adc_channel_length_config(uint32_t adc_periph, uint8_t adc_channel_group, uint32_t length);
/* configure ADC regular channel */
void adc_regular_channel_config(uint32_t adc_periph, uint8_t rank, uint8_t adc_channel, uint32_t sample_time);
/* configure ADC inserted channel */
void adc_inserted_channel_config(uint32_t adc_periph, uint8_t rank, uint8_t adc_channel, uint32_t sample_time);
/* configure ADC inserted channel offset */
void adc_inserted_channel_offset_config(uint32_t adc_periph, uint8_t inserted_channel, uint16_t offset);
/* configure ADC external trigger source */
void adc_external_trigger_source_config(uint32_t adc_periph, uint8_t adc_channel_group, uint32_t external_trigger_source);
/* configure ADC external trigger */
void adc_external_trigger_config(uint32_t adc_periph, uint8_t adc_channel_group, ControlStatus newvalue);
/* enable ADC software trigger */
void adc_software_trigger_enable(uint32_t adc_periph, uint8_t adc_channel_group);
/* get channel data */
/* read ADC regular group data register */
uint16_t adc_regular_data_read(uint32_t adc_periph);
/* read ADC inserted group data register */
uint16_t adc_inserted_data_read(uint32_t adc_periph, uint8_t inserted_channel);
/* read the last ADC0 and ADC1 conversion result data in sync mode */
uint32_t adc_sync_mode_convert_value_read(void);
/* watchdog config */
/* configure ADC analog watchdog single channel */
void adc_watchdog_single_channel_enable(uint32_t adc_periph, uint8_t adc_channel);
/* configure ADC analog watchdog group channel */
void adc_watchdog_group_channel_enable(uint32_t adc_periph, uint8_t adc_channel_group);
/* disable ADC analog watchdog */
void adc_watchdog_disable(uint32_t adc_periph);
/* configure ADC analog watchdog threshold */
void adc_watchdog_threshold_config(uint32_t adc_periph, uint16_t low_threshold, uint16_t high_threshold);
/* interrupt & flag functions */
/* get the ADC flag bits */
FlagStatus adc_flag_get(uint32_t adc_periph, uint32_t adc_flag);
/* clear the ADC flag bits */
void adc_flag_clear(uint32_t adc_periph, uint32_t adc_flag);
/* get the bit state of ADCx software start conversion */
FlagStatus adc_regular_software_startconv_flag_get(uint32_t adc_periph);
/* get the bit state of ADCx software inserted channel start conversion */
FlagStatus adc_inserted_software_startconv_flag_get(uint32_t adc_periph);
/* get the ADC interrupt bits */
FlagStatus adc_interrupt_flag_get(uint32_t adc_periph, uint32_t adc_interrupt);
/* clear the ADC flag */
void adc_interrupt_flag_clear(uint32_t adc_periph, uint32_t adc_interrupt);
/* enable ADC interrupt */
void adc_interrupt_enable(uint32_t adc_periph, uint32_t adc_interrupt);
/* disable ADC interrupt */
void adc_interrupt_disable(uint32_t adc_periph, uint32_t adc_interrupt);
/* ADC resolution & oversample */
/* ADC resolution config */
void adc_resolution_config(uint32_t adc_periph, uint32_t resolution);
/* ADC oversample mode config */
void adc_oversample_mode_config(uint32_t adc_periph, uint8_t mode, uint16_t shift, uint8_t ratio);
/* enable ADC oversample mode */
void adc_oversample_mode_enable(uint32_t adc_periph);
/* disable ADC oversample mode */
void adc_oversample_mode_disable(uint32_t adc_periph);
#endif /* GD32VF103_ADC_H */

View File

@@ -2,11 +2,12 @@
\file gd32vf103_bkp.h
\brief definitions for the BKP
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_BKP_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* BKP definitions */
#define BKP BKP_BASE /*!< BKP base address */

View File

@@ -1,714 +0,0 @@
/*!
\file gd32vf103_can.h
\brief definitions for the CAN
\version 2019-6-5, V1.0.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef GD32VF103_CAN_H
#define GD32VF103_CAN_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* CAN definitions */
#define CAN0 CAN_BASE /*!< CAN0 base address */
#define CAN1 (CAN0 + 0x00000400U) /*!< CAN1 base address */
/* registers definitions */
#define CAN_CTL(canx) REG32((canx) + 0x00U) /*!< CAN control register */
#define CAN_STAT(canx) REG32((canx) + 0x04U) /*!< CAN status register */
#define CAN_TSTAT(canx) REG32((canx) + 0x08U) /*!< CAN transmit status register*/
#define CAN_RFIFO0(canx) REG32((canx) + 0x0CU) /*!< CAN receive FIFO0 register */
#define CAN_RFIFO1(canx) REG32((canx) + 0x10U) /*!< CAN receive FIFO1 register */
#define CAN_INTEN(canx) REG32((canx) + 0x14U) /*!< CAN interrupt enable register */
#define CAN_ERR(canx) REG32((canx) + 0x18U) /*!< CAN error register */
#define CAN_BT(canx) REG32((canx) + 0x1CU) /*!< CAN bit timing register */
#define CAN_TMI0(canx) REG32((canx) + 0x180U) /*!< CAN transmit mailbox0 identifier register */
#define CAN_TMP0(canx) REG32((canx) + 0x184U) /*!< CAN transmit mailbox0 property register */
#define CAN_TMDATA00(canx) REG32((canx) + 0x188U) /*!< CAN transmit mailbox0 data0 register */
#define CAN_TMDATA10(canx) REG32((canx) + 0x18CU) /*!< CAN transmit mailbox0 data1 register */
#define CAN_TMI1(canx) REG32((canx) + 0x190U) /*!< CAN transmit mailbox1 identifier register */
#define CAN_TMP1(canx) REG32((canx) + 0x194U) /*!< CAN transmit mailbox1 property register */
#define CAN_TMDATA01(canx) REG32((canx) + 0x198U) /*!< CAN transmit mailbox1 data0 register */
#define CAN_TMDATA11(canx) REG32((canx) + 0x19CU) /*!< CAN transmit mailbox1 data1 register */
#define CAN_TMI2(canx) REG32((canx) + 0x1A0U) /*!< CAN transmit mailbox2 identifier register */
#define CAN_TMP2(canx) REG32((canx) + 0x1A4U) /*!< CAN transmit mailbox2 property register */
#define CAN_TMDATA02(canx) REG32((canx) + 0x1A8U) /*!< CAN transmit mailbox2 data0 register */
#define CAN_TMDATA12(canx) REG32((canx) + 0x1ACU) /*!< CAN transmit mailbox2 data1 register */
#define CAN_RFIFOMI0(canx) REG32((canx) + 0x1B0U) /*!< CAN receive FIFO0 mailbox identifier register */
#define CAN_RFIFOMP0(canx) REG32((canx) + 0x1B4U) /*!< CAN receive FIFO0 mailbox property register */
#define CAN_RFIFOMDATA00(canx) REG32((canx) + 0x1B8U) /*!< CAN receive FIFO0 mailbox data0 register */
#define CAN_RFIFOMDATA10(canx) REG32((canx) + 0x1BCU) /*!< CAN receive FIFO0 mailbox data1 register */
#define CAN_RFIFOMI1(canx) REG32((canx) + 0x1C0U) /*!< CAN receive FIFO1 mailbox identifier register */
#define CAN_RFIFOMP1(canx) REG32((canx) + 0x1C4U) /*!< CAN receive FIFO1 mailbox property register */
#define CAN_RFIFOMDATA01(canx) REG32((canx) + 0x1C8U) /*!< CAN receive FIFO1 mailbox data0 register */
#define CAN_RFIFOMDATA11(canx) REG32((canx) + 0x1CCU) /*!< CAN receive FIFO1 mailbox data1 register */
#define CAN_FCTL(canx) REG32((canx) + 0x200U) /*!< CAN filter control register */
#define CAN_FMCFG(canx) REG32((canx) + 0x204U) /*!< CAN filter mode register */
#define CAN_FSCFG(canx) REG32((canx) + 0x20CU) /*!< CAN filter scale register */
#define CAN_FAFIFO(canx) REG32((canx) + 0x214U) /*!< CAN filter associated FIFO register */
#define CAN_FW(canx) REG32((canx) + 0x21CU) /*!< CAN filter working register */
#define CAN_F0DATA0(canx) REG32((canx) + 0x240U) /*!< CAN filter 0 data 0 register */
#define CAN_F1DATA0(canx) REG32((canx) + 0x248U) /*!< CAN filter 1 data 0 register */
#define CAN_F2DATA0(canx) REG32((canx) + 0x250U) /*!< CAN filter 2 data 0 register */
#define CAN_F3DATA0(canx) REG32((canx) + 0x258U) /*!< CAN filter 3 data 0 register */
#define CAN_F4DATA0(canx) REG32((canx) + 0x260U) /*!< CAN filter 4 data 0 register */
#define CAN_F5DATA0(canx) REG32((canx) + 0x268U) /*!< CAN filter 5 data 0 register */
#define CAN_F6DATA0(canx) REG32((canx) + 0x270U) /*!< CAN filter 6 data 0 register */
#define CAN_F7DATA0(canx) REG32((canx) + 0x278U) /*!< CAN filter 7 data 0 register */
#define CAN_F8DATA0(canx) REG32((canx) + 0x280U) /*!< CAN filter 8 data 0 register */
#define CAN_F9DATA0(canx) REG32((canx) + 0x288U) /*!< CAN filter 9 data 0 register */
#define CAN_F10DATA0(canx) REG32((canx) + 0x290U) /*!< CAN filter 10 data 0 register */
#define CAN_F11DATA0(canx) REG32((canx) + 0x298U) /*!< CAN filter 11 data 0 register */
#define CAN_F12DATA0(canx) REG32((canx) + 0x2A0U) /*!< CAN filter 12 data 0 register */
#define CAN_F13DATA0(canx) REG32((canx) + 0x2A8U) /*!< CAN filter 13 data 0 register */
#define CAN_F14DATA0(canx) REG32((canx) + 0x2B0U) /*!< CAN filter 14 data 0 register */
#define CAN_F15DATA0(canx) REG32((canx) + 0x2B8U) /*!< CAN filter 15 data 0 register */
#define CAN_F16DATA0(canx) REG32((canx) + 0x2C0U) /*!< CAN filter 16 data 0 register */
#define CAN_F17DATA0(canx) REG32((canx) + 0x2C8U) /*!< CAN filter 17 data 0 register */
#define CAN_F18DATA0(canx) REG32((canx) + 0x2D0U) /*!< CAN filter 18 data 0 register */
#define CAN_F19DATA0(canx) REG32((canx) + 0x2D8U) /*!< CAN filter 19 data 0 register */
#define CAN_F20DATA0(canx) REG32((canx) + 0x2E0U) /*!< CAN filter 20 data 0 register */
#define CAN_F21DATA0(canx) REG32((canx) + 0x2E8U) /*!< CAN filter 21 data 0 register */
#define CAN_F22DATA0(canx) REG32((canx) + 0x2F0U) /*!< CAN filter 22 data 0 register */
#define CAN_F23DATA0(canx) REG32((canx) + 0x3F8U) /*!< CAN filter 23 data 0 register */
#define CAN_F24DATA0(canx) REG32((canx) + 0x300U) /*!< CAN filter 24 data 0 register */
#define CAN_F25DATA0(canx) REG32((canx) + 0x308U) /*!< CAN filter 25 data 0 register */
#define CAN_F26DATA0(canx) REG32((canx) + 0x310U) /*!< CAN filter 26 data 0 register */
#define CAN_F27DATA0(canx) REG32((canx) + 0x318U) /*!< CAN filter 27 data 0 register */
#define CAN_F0DATA1(canx) REG32((canx) + 0x244U) /*!< CAN filter 0 data 1 register */
#define CAN_F1DATA1(canx) REG32((canx) + 0x24CU) /*!< CAN filter 1 data 1 register */
#define CAN_F2DATA1(canx) REG32((canx) + 0x254U) /*!< CAN filter 2 data 1 register */
#define CAN_F3DATA1(canx) REG32((canx) + 0x25CU) /*!< CAN filter 3 data 1 register */
#define CAN_F4DATA1(canx) REG32((canx) + 0x264U) /*!< CAN filter 4 data 1 register */
#define CAN_F5DATA1(canx) REG32((canx) + 0x26CU) /*!< CAN filter 5 data 1 register */
#define CAN_F6DATA1(canx) REG32((canx) + 0x274U) /*!< CAN filter 6 data 1 register */
#define CAN_F7DATA1(canx) REG32((canx) + 0x27CU) /*!< CAN filter 7 data 1 register */
#define CAN_F8DATA1(canx) REG32((canx) + 0x284U) /*!< CAN filter 8 data 1 register */
#define CAN_F9DATA1(canx) REG32((canx) + 0x28CU) /*!< CAN filter 9 data 1 register */
#define CAN_F10DATA1(canx) REG32((canx) + 0x294U) /*!< CAN filter 10 data 1 register */
#define CAN_F11DATA1(canx) REG32((canx) + 0x29CU) /*!< CAN filter 11 data 1 register */
#define CAN_F12DATA1(canx) REG32((canx) + 0x2A4U) /*!< CAN filter 12 data 1 register */
#define CAN_F13DATA1(canx) REG32((canx) + 0x2ACU) /*!< CAN filter 13 data 1 register */
#define CAN_F14DATA1(canx) REG32((canx) + 0x2B4U) /*!< CAN filter 14 data 1 register */
#define CAN_F15DATA1(canx) REG32((canx) + 0x2BCU) /*!< CAN filter 15 data 1 register */
#define CAN_F16DATA1(canx) REG32((canx) + 0x2C4U) /*!< CAN filter 16 data 1 register */
#define CAN_F17DATA1(canx) REG32((canx) + 0x24CU) /*!< CAN filter 17 data 1 register */
#define CAN_F18DATA1(canx) REG32((canx) + 0x2D4U) /*!< CAN filter 18 data 1 register */
#define CAN_F19DATA1(canx) REG32((canx) + 0x2DCU) /*!< CAN filter 19 data 1 register */
#define CAN_F20DATA1(canx) REG32((canx) + 0x2E4U) /*!< CAN filter 20 data 1 register */
#define CAN_F21DATA1(canx) REG32((canx) + 0x2ECU) /*!< CAN filter 21 data 1 register */
#define CAN_F22DATA1(canx) REG32((canx) + 0x2F4U) /*!< CAN filter 22 data 1 register */
#define CAN_F23DATA1(canx) REG32((canx) + 0x2FCU) /*!< CAN filter 23 data 1 register */
#define CAN_F24DATA1(canx) REG32((canx) + 0x304U) /*!< CAN filter 24 data 1 register */
#define CAN_F25DATA1(canx) REG32((canx) + 0x30CU) /*!< CAN filter 25 data 1 register */
#define CAN_F26DATA1(canx) REG32((canx) + 0x314U) /*!< CAN filter 26 data 1 register */
#define CAN_F27DATA1(canx) REG32((canx) + 0x31CU) /*!< CAN filter 27 data 1 register */
/* CAN transmit mailbox bank */
#define CAN_TMI(canx, bank) REG32((canx) + 0x180U + ((bank)*0x10U)) /*!< CAN transmit mailbox identifier register */
#define CAN_TMP(canx, bank) REG32((canx) + 0x184U + ((bank)*0x10U)) /*!< CAN transmit mailbox property register */
#define CAN_TMDATA0(canx, bank) REG32((canx) + 0x188U + ((bank)*0x10U)) /*!< CAN transmit mailbox data0 register */
#define CAN_TMDATA1(canx, bank) REG32((canx) + 0x18CU + ((bank)*0x10U)) /*!< CAN transmit mailbox data1 register */
/* CAN filter bank */
#define CAN_FDATA0(canx, bank) REG32((canx) + 0x240U + ((bank)*0x8U) + 0x0U) /*!< CAN filter data 0 register */
#define CAN_FDATA1(canx, bank) REG32((canx) + 0x240U + ((bank)*0x8U) + 0x4U) /*!< CAN filter data 1 register */
/* CAN receive fifo mailbox bank */
#define CAN_RFIFOMI(canx, bank) REG32((canx) + 0x1B0U + ((bank)*0x10U)) /*!< CAN receive FIFO mailbox identifier register */
#define CAN_RFIFOMP(canx, bank) REG32((canx) + 0x1B4U + ((bank)*0x10U)) /*!< CAN receive FIFO mailbox property register */
#define CAN_RFIFOMDATA0(canx, bank) REG32((canx) + 0x1B8U + ((bank)*0x10U)) /*!< CAN receive FIFO mailbox data0 register */
#define CAN_RFIFOMDATA1(canx, bank) REG32((canx) + 0x1BCU + ((bank)*0x10U)) /*!< CAN receive FIFO mailbox data1 register */
/* bits definitions */
/* CAN_CTL */
#define CAN_CTL_IWMOD BIT(0) /*!< initial working mode */
#define CAN_CTL_SLPWMOD BIT(1) /*!< sleep working mode */
#define CAN_CTL_TFO BIT(2) /*!< transmit FIFO order */
#define CAN_CTL_RFOD BIT(3) /*!< receive FIFO overwrite disable */
#define CAN_CTL_ARD BIT(4) /*!< automatic retransmission disable */
#define CAN_CTL_AWU BIT(5) /*!< automatic wakeup */
#define CAN_CTL_ABOR BIT(6) /*!< automatic bus-off recovery */
#define CAN_CTL_TTC BIT(7) /*!< time triggered communication */
#define CAN_CTL_SWRST BIT(15) /*!< CAN software reset */
#define CAN_CTL_DFZ BIT(16) /*!< CAN debug freeze */
/* CAN_STAT */
#define CAN_STAT_IWS BIT(0) /*!< initial working state */
#define CAN_STAT_SLPWS BIT(1) /*!< sleep working state */
#define CAN_STAT_ERRIF BIT(2) /*!< error interrupt flag*/
#define CAN_STAT_WUIF BIT(3) /*!< status change interrupt flag of wakeup from sleep working mode */
#define CAN_STAT_SLPIF BIT(4) /*!< status change interrupt flag of sleep working mode entering */
#define CAN_STAT_TS BIT(8) /*!< transmitting state */
#define CAN_STAT_RS BIT(9) /*!< receiving state */
#define CAN_STAT_LASTRX BIT(10) /*!< last sample value of rx pin */
#define CAN_STAT_RXL BIT(11) /*!< CAN rx signal */
/* CAN_TSTAT */
#define CAN_TSTAT_MTF0 BIT(0) /*!< mailbox0 transmit finished */
#define CAN_TSTAT_MTFNERR0 BIT(1) /*!< mailbox0 transmit finished and no error */
#define CAN_TSTAT_MAL0 BIT(2) /*!< mailbox0 arbitration lost */
#define CAN_TSTAT_MTE0 BIT(3) /*!< mailbox0 transmit error */
#define CAN_TSTAT_MST0 BIT(7) /*!< mailbox0 stop transmitting */
#define CAN_TSTAT_MTF1 BIT(8) /*!< mailbox1 transmit finished */
#define CAN_TSTAT_MTFNERR1 BIT(9) /*!< mailbox1 transmit finished and no error */
#define CAN_TSTAT_MAL1 BIT(10) /*!< mailbox1 arbitration lost */
#define CAN_TSTAT_MTE1 BIT(11) /*!< mailbox1 transmit error */
#define CAN_TSTAT_MST1 BIT(15) /*!< mailbox1 stop transmitting */
#define CAN_TSTAT_MTF2 BIT(16) /*!< mailbox2 transmit finished */
#define CAN_TSTAT_MTFNERR2 BIT(17) /*!< mailbox2 transmit finished and no error */
#define CAN_TSTAT_MAL2 BIT(18) /*!< mailbox2 arbitration lost */
#define CAN_TSTAT_MTE2 BIT(19) /*!< mailbox2 transmit error */
#define CAN_TSTAT_MST2 BIT(23) /*!< mailbox2 stop transmitting */
#define CAN_TSTAT_NUM BITS(24, 25) /*!< mailbox number */
#define CAN_TSTAT_TME0 BIT(26) /*!< transmit mailbox0 empty */
#define CAN_TSTAT_TME1 BIT(27) /*!< transmit mailbox1 empty */
#define CAN_TSTAT_TME2 BIT(28) /*!< transmit mailbox2 empty */
#define CAN_TSTAT_TMLS0 BIT(29) /*!< last sending priority flag for mailbox0 */
#define CAN_TSTAT_TMLS1 BIT(30) /*!< last sending priority flag for mailbox1 */
#define CAN_TSTAT_TMLS2 BIT(31) /*!< last sending priority flag for mailbox2 */
/* CAN_RFIFO0 */
#define CAN_RFIFO0_RFL0 BITS(0, 1) /*!< receive FIFO0 length */
#define CAN_RFIFO0_RFF0 BIT(3) /*!< receive FIFO0 full */
#define CAN_RFIFO0_RFO0 BIT(4) /*!< receive FIFO0 overfull */
#define CAN_RFIFO0_RFD0 BIT(5) /*!< receive FIFO0 dequeue */
/* CAN_RFIFO1 */
#define CAN_RFIFO1_RFL1 BITS(0, 1) /*!< receive FIFO1 length */
#define CAN_RFIFO1_RFF1 BIT(3) /*!< receive FIFO1 full */
#define CAN_RFIFO1_RFO1 BIT(4) /*!< receive FIFO1 overfull */
#define CAN_RFIFO1_RFD1 BIT(5) /*!< receive FIFO1 dequeue */
/* CAN_INTEN */
#define CAN_INTEN_TMEIE BIT(0) /*!< transmit mailbox empty interrupt enable */
#define CAN_INTEN_RFNEIE0 BIT(1) /*!< receive FIFO0 not empty interrupt enable */
#define CAN_INTEN_RFFIE0 BIT(2) /*!< receive FIFO0 full interrupt enable */
#define CAN_INTEN_RFOIE0 BIT(3) /*!< receive FIFO0 overfull interrupt enable */
#define CAN_INTEN_RFNEIE1 BIT(4) /*!< receive FIFO1 not empty interrupt enable */
#define CAN_INTEN_RFFIE1 BIT(5) /*!< receive FIFO1 full interrupt enable */
#define CAN_INTEN_RFOIE1 BIT(6) /*!< receive FIFO1 overfull interrupt enable */
#define CAN_INTEN_WERRIE BIT(8) /*!< warning error interrupt enable */
#define CAN_INTEN_PERRIE BIT(9) /*!< passive error interrupt enable */
#define CAN_INTEN_BOIE BIT(10) /*!< bus-off interrupt enable */
#define CAN_INTEN_ERRNIE BIT(11) /*!< error number interrupt enable */
#define CAN_INTEN_ERRIE BIT(15) /*!< error interrupt enable */
#define CAN_INTEN_WIE BIT(16) /*!< wakeup interrupt enable */
#define CAN_INTEN_SLPWIE BIT(17) /*!< sleep working interrupt enable */
/* CAN_ERR */
#define CAN_ERR_WERR BIT(0) /*!< warning error */
#define CAN_ERR_PERR BIT(1) /*!< passive error */
#define CAN_ERR_BOERR BIT(2) /*!< bus-off error */
#define CAN_ERR_ERRN BITS(4, 6) /*!< error number */
#define CAN_ERR_TECNT BITS(16, 23) /*!< transmit error count */
#define CAN_ERR_RECNT BITS(24, 31) /*!< receive error count */
/* CAN_BT */
#define CAN_BT_BAUDPSC BITS(0, 9) /*!< baudrate prescaler */
#define CAN_BT_BS1 BITS(16, 19) /*!< bit segment 1 */
#define CAN_BT_BS2 BITS(20, 22) /*!< bit segment 2 */
#define CAN_BT_SJW BITS(24, 25) /*!< resynchronization jump width */
#define CAN_BT_LCMOD BIT(30) /*!< loopback communication mode */
#define CAN_BT_SCMOD BIT(31) /*!< silent communication mode */
/* CAN_TMIx */
#define CAN_TMI_TEN BIT(0) /*!< transmit enable */
#define CAN_TMI_FT BIT(1) /*!< frame type */
#define CAN_TMI_FF BIT(2) /*!< frame format */
#define CAN_TMI_EFID BITS(3, 31) /*!< the frame identifier */
#define CAN_TMI_SFID BITS(21, 31) /*!< the frame identifier */
/* CAN_TMPx */
#define CAN_TMP_DLENC BITS(0, 3) /*!< data length code */
#define CAN_TMP_TSEN BIT(8) /*!< time stamp enable */
#define CAN_TMP_TS BITS(16, 31) /*!< time stamp */
/* CAN_TMDATA0x */
#define CAN_TMDATA0_DB0 BITS(0, 7) /*!< transmit data byte 0 */
#define CAN_TMDATA0_DB1 BITS(8, 15) /*!< transmit data byte 1 */
#define CAN_TMDATA0_DB2 BITS(16, 23) /*!< transmit data byte 2 */
#define CAN_TMDATA0_DB3 BITS(24, 31) /*!< transmit data byte 3 */
/* CAN_TMDATA1x */
#define CAN_TMDATA1_DB4 BITS(0, 7) /*!< transmit data byte 4 */
#define CAN_TMDATA1_DB5 BITS(8, 15) /*!< transmit data byte 5 */
#define CAN_TMDATA1_DB6 BITS(16, 23) /*!< transmit data byte 6 */
#define CAN_TMDATA1_DB7 BITS(24, 31) /*!< transmit data byte 7 */
/* CAN_RFIFOMIx */
#define CAN_RFIFOMI_FT BIT(1) /*!< frame type */
#define CAN_RFIFOMI_FF BIT(2) /*!< frame format */
#define CAN_RFIFOMI_EFID BITS(3, 31) /*!< the frame identifier */
#define CAN_RFIFOMI_SFID BITS(21, 31) /*!< the frame identifier */
/* CAN_RFIFOMPx */
#define CAN_RFIFOMP_DLENC BITS(0, 3) /*!< receive data length code */
#define CAN_RFIFOMP_FI BITS(8, 15) /*!< filter index */
#define CAN_RFIFOMP_TS BITS(16, 31) /*!< time stamp */
/* CAN_RFIFOMDATA0x */
#define CAN_RFIFOMDATA0_DB0 BITS(0, 7) /*!< receive data byte 0 */
#define CAN_RFIFOMDATA0_DB1 BITS(8, 15) /*!< receive data byte 1 */
#define CAN_RFIFOMDATA0_DB2 BITS(16, 23) /*!< receive data byte 2 */
#define CAN_RFIFOMDATA0_DB3 BITS(24, 31) /*!< receive data byte 3 */
/* CAN_RFIFOMDATA1x */
#define CAN_RFIFOMDATA1_DB4 BITS(0, 7) /*!< receive data byte 4 */
#define CAN_RFIFOMDATA1_DB5 BITS(8, 15) /*!< receive data byte 5 */
#define CAN_RFIFOMDATA1_DB6 BITS(16, 23) /*!< receive data byte 6 */
#define CAN_RFIFOMDATA1_DB7 BITS(24, 31) /*!< receive data byte 7 */
/* CAN_FCTL */
#define CAN_FCTL_FLD BIT(0) /*!< filter lock disable */
#define CAN_FCTL_HBC1F BITS(8, 13) /*!< header bank of CAN1 filter */
/* CAN_FMCFG */
#define CAN_FMCFG_FMOD(regval) BIT(regval) /*!< filter mode, list or mask*/
/* CAN_FSCFG */
#define CAN_FSCFG_FS(regval) BIT(regval) /*!< filter scale, 32 bits or 16 bits*/
/* CAN_FAFIFO */
#define CAN_FAFIFOR_FAF(regval) BIT(regval) /*!< filter associated with FIFO */
/* CAN_FW */
#define CAN_FW_FW(regval) BIT(regval) /*!< filter working */
/* CAN_FxDATAy */
#define CAN_FDATA_FD(regval) BIT(regval) /*!< filter data */
/* consts definitions */
/* define the CAN bit position and its register index offset */
#define CAN_REGIDX_BIT(regidx, bitpos) (((uint32_t)(regidx) << 6) | (uint32_t)(bitpos))
#define CAN_REG_VAL(canx, offset) (REG32((canx) + ((uint32_t)(offset) >> 6)))
#define CAN_BIT_POS(val) ((uint32_t)(val)&0x1FU)
#define CAN_REGIDX_BITS(regidx, bitpos0, bitpos1) (((uint32_t)(regidx) << 12) | ((uint32_t)(bitpos0) << 6) | (uint32_t)(bitpos1))
#define CAN_REG_VALS(canx, offset) (REG32((canx) + ((uint32_t)(offset) >> 12)))
#define CAN_BIT_POS0(val) (((uint32_t)(val) >> 6) & 0x1FU)
#define CAN_BIT_POS1(val) ((uint32_t)(val)&0x1FU)
/* register offset */
#define STAT_REG_OFFSET ((uint8_t)0x04U) /*!< STAT register offset */
#define TSTAT_REG_OFFSET ((uint8_t)0x08U) /*!< TSTAT register offset */
#define RFIFO0_REG_OFFSET ((uint8_t)0x0CU) /*!< RFIFO0 register offset */
#define RFIFO1_REG_OFFSET ((uint8_t)0x10U) /*!< RFIFO1 register offset */
#define ERR_REG_OFFSET ((uint8_t)0x18U) /*!< ERR register offset */
/* CAN flags */
typedef enum {
/* flags in TSTAT register */
CAN_FLAG_MTE2 = CAN_REGIDX_BIT(TSTAT_REG_OFFSET, 19U), /*!< mailbox 2 transmit error */
CAN_FLAG_MTE1 = CAN_REGIDX_BIT(TSTAT_REG_OFFSET, 11U), /*!< mailbox 1 transmit error */
CAN_FLAG_MTE0 = CAN_REGIDX_BIT(TSTAT_REG_OFFSET, 3U), /*!< mailbox 0 transmit error */
CAN_FLAG_MTF2 = CAN_REGIDX_BIT(TSTAT_REG_OFFSET, 16U), /*!< mailbox 2 transmit finished */
CAN_FLAG_MTF1 = CAN_REGIDX_BIT(TSTAT_REG_OFFSET, 8U), /*!< mailbox 1 transmit finished */
CAN_FLAG_MTF0 = CAN_REGIDX_BIT(TSTAT_REG_OFFSET, 0U), /*!< mailbox 0 transmit finished */
/* flags in RFIFO0 register */
CAN_FLAG_RFO0 = CAN_REGIDX_BIT(RFIFO0_REG_OFFSET, 4U), /*!< receive FIFO0 overfull */
CAN_FLAG_RFF0 = CAN_REGIDX_BIT(RFIFO0_REG_OFFSET, 3U), /*!< receive FIFO0 full */
/* flags in RFIFO1 register */
CAN_FLAG_RFO1 = CAN_REGIDX_BIT(RFIFO1_REG_OFFSET, 4U), /*!< receive FIFO1 overfull */
CAN_FLAG_RFF1 = CAN_REGIDX_BIT(RFIFO1_REG_OFFSET, 3U), /*!< receive FIFO1 full */
/* flags in ERR register */
CAN_FLAG_BOERR = CAN_REGIDX_BIT(ERR_REG_OFFSET, 2U), /*!< bus-off error */
CAN_FLAG_PERR = CAN_REGIDX_BIT(ERR_REG_OFFSET, 1U), /*!< passive error */
CAN_FLAG_WERR = CAN_REGIDX_BIT(ERR_REG_OFFSET, 0U), /*!< warning error */
} can_flag_enum;
/* CAN interrupt flags */
typedef enum {
/* interrupt flags in STAT register */
CAN_INT_FLAG_SLPIF = CAN_REGIDX_BITS(STAT_REG_OFFSET, 4U, 17U), /*!< status change interrupt flag of sleep working mode entering */
CAN_INT_FLAG_WUIF = CAN_REGIDX_BITS(STAT_REG_OFFSET, 3U, 16), /*!< status change interrupt flag of wakeup from sleep working mode */
CAN_INT_FLAG_ERRIF = CAN_REGIDX_BITS(STAT_REG_OFFSET, 2U, 15), /*!< error interrupt flag */
/* interrupt flags in TSTAT register */
CAN_INT_FLAG_MTF2 = CAN_REGIDX_BITS(TSTAT_REG_OFFSET, 16U, 0U), /*!< mailbox 2 transmit finished interrupt flag */
CAN_INT_FLAG_MTF1 = CAN_REGIDX_BITS(TSTAT_REG_OFFSET, 8U, 0U), /*!< mailbox 1 transmit finished interrupt flag */
CAN_INT_FLAG_MTF0 = CAN_REGIDX_BITS(TSTAT_REG_OFFSET, 0U, 0U), /*!< mailbox 0 transmit finished interrupt flag */
/* interrupt flags in RFIFO0 register */
CAN_INT_FLAG_RFO0 = CAN_REGIDX_BITS(RFIFO0_REG_OFFSET, 4U, 3U), /*!< receive FIFO0 overfull interrupt flag */
CAN_INT_FLAG_RFF0 = CAN_REGIDX_BITS(RFIFO0_REG_OFFSET, 3U, 2U), /*!< receive FIFO0 full interrupt flag */
/* interrupt flags in RFIFO0 register */
CAN_INT_FLAG_RFO1 = CAN_REGIDX_BITS(RFIFO1_REG_OFFSET, 4U, 6U), /*!< receive FIFO1 overfull interrupt flag */
CAN_INT_FLAG_RFF1 = CAN_REGIDX_BITS(RFIFO1_REG_OFFSET, 3U, 5U), /*!< receive FIFO1 full interrupt flag */
} can_interrupt_flag_enum;
/* CAN initiliaze parameters struct */
typedef struct {
uint8_t working_mode; /*!< CAN working mode */
uint8_t resync_jump_width; /*!< CAN resynchronization jump width */
uint8_t time_segment_1; /*!< time segment 1 */
uint8_t time_segment_2; /*!< time segment 2 */
ControlStatus time_triggered; /*!< time triggered communication mode */
ControlStatus auto_bus_off_recovery; /*!< automatic bus-off recovery */
ControlStatus auto_wake_up; /*!< automatic wake-up mode */
ControlStatus no_auto_retrans; /*!< automatic retransmission mode disable */
ControlStatus rec_fifo_overwrite; /*!< receive FIFO overwrite mode */
ControlStatus trans_fifo_order; /*!< transmit FIFO order */
uint16_t prescaler; /*!< baudrate prescaler */
} can_parameter_struct;
/* CAN transmit message struct */
typedef struct {
uint32_t tx_sfid; /*!< standard format frame identifier */
uint32_t tx_efid; /*!< extended format frame identifier */
uint8_t tx_ff; /*!< format of frame, standard or extended format */
uint8_t tx_ft; /*!< type of frame, data or remote */
uint8_t tx_dlen; /*!< data length */
uint8_t tx_data[8]; /*!< transmit data */
} can_trasnmit_message_struct;
/* CAN receive message struct */
typedef struct {
uint32_t rx_sfid; /*!< standard format frame identifier */
uint32_t rx_efid; /*!< extended format frame identifier */
uint8_t rx_ff; /*!< format of frame, standard or extended format */
uint8_t rx_ft; /*!< type of frame, data or remote */
uint8_t rx_dlen; /*!< data length */
uint8_t rx_data[8]; /*!< receive data */
uint8_t rx_fi; /*!< filtering index */
} can_receive_message_struct;
/* CAN filter parameters struct */
typedef struct {
uint16_t filter_list_high; /*!< filter list number high bits*/
uint16_t filter_list_low; /*!< filter list number low bits */
uint16_t filter_mask_high; /*!< filter mask number high bits */
uint16_t filter_mask_low; /*!< filter mask number low bits */
uint16_t filter_fifo_number; /*!< receive FIFO associated with the filter */
uint16_t filter_number; /*!< filter number */
uint16_t filter_mode; /*!< filter mode, list or mask */
uint16_t filter_bits; /*!< filter scale */
ControlStatus filter_enable; /*!< filter work or not */
} can_filter_parameter_struct;
/* CAN errors */
typedef enum {
CAN_ERROR_NONE = 0, /*!< no error */
CAN_ERROR_FILL, /*!< fill error */
CAN_ERROR_FORMATE, /*!< format error */
CAN_ERROR_ACK, /*!< ACK error */
CAN_ERROR_BITRECESSIVE, /*!< bit recessive error */
CAN_ERROR_BITDOMINANTER, /*!< bit dominant error */
CAN_ERROR_CRC, /*!< CRC error */
CAN_ERROR_SOFTWARECFG, /*!< software configure */
} can_error_enum;
/* transmit states */
typedef enum {
CAN_TRANSMIT_FAILED = 0, /*!< CAN transmitted failure */
CAN_TRANSMIT_OK = 1, /*!< CAN transmitted success */
CAN_TRANSMIT_PENDING = 2, /*!< CAN transmitted pending */
CAN_TRANSMIT_NOMAILBOX = 4, /*!< no empty mailbox to be used for CAN */
} can_transmit_state_enum;
typedef enum {
CAN_INIT_STRUCT = 0, /* CAN initiliaze parameters struct */
CAN_FILTER_STRUCT, /* CAN filter parameters struct */
CAN_TX_MESSAGE_STRUCT, /* CAN transmit message struct */
CAN_RX_MESSAGE_STRUCT, /* CAN receive message struct */
} can_struct_type_enum;
/* CAN baudrate prescaler*/
#define BT_BAUDPSC(regval) (BITS(0, 9) & ((uint32_t)(regval) << 0))
/* CAN bit segment 1*/
#define BT_BS1(regval) (BITS(16, 19) & ((uint32_t)(regval) << 16))
/* CAN bit segment 2*/
#define BT_BS2(regval) (BITS(20, 22) & ((uint32_t)(regval) << 20))
/* CAN resynchronization jump width*/
#define BT_SJW(regval) (BITS(24, 25) & ((uint32_t)(regval) << 24))
/* CAN communication mode*/
#define BT_MODE(regval) (BITS(30, 31) & ((uint32_t)(regval) << 30))
/* CAN FDATA high 16 bits */
#define FDATA_MASK_HIGH(regval) (BITS(16, 31) & ((uint32_t)(regval) << 16))
/* CAN FDATA low 16 bits */
#define FDATA_MASK_LOW(regval) (BITS(0, 15) & ((uint32_t)(regval) << 0))
/* CAN1 filter start bank_number*/
#define FCTL_HBC1F(regval) (BITS(8, 13) & ((uint32_t)(regval) << 8))
/* CAN transmit mailbox extended identifier*/
#define TMI_EFID(regval) (BITS(3, 31) & ((uint32_t)(regval) << 3))
/* CAN transmit mailbox standard identifier*/
#define TMI_SFID(regval) (BITS(21, 31) & ((uint32_t)(regval) << 21))
/* transmit data byte 0 */
#define TMDATA0_DB0(regval) (BITS(0, 7) & ((uint32_t)(regval) << 0))
/* transmit data byte 1 */
#define TMDATA0_DB1(regval) (BITS(8, 15) & ((uint32_t)(regval) << 8))
/* transmit data byte 2 */
#define TMDATA0_DB2(regval) (BITS(16, 23) & ((uint32_t)(regval) << 16))
/* transmit data byte 3 */
#define TMDATA0_DB3(regval) (BITS(24, 31) & ((uint32_t)(regval) << 24))
/* transmit data byte 4 */
#define TMDATA1_DB4(regval) (BITS(0, 7) & ((uint32_t)(regval) << 0))
/* transmit data byte 5 */
#define TMDATA1_DB5(regval) (BITS(8, 15) & ((uint32_t)(regval) << 8))
/* transmit data byte 6 */
#define TMDATA1_DB6(regval) (BITS(16, 23) & ((uint32_t)(regval) << 16))
/* transmit data byte 7 */
#define TMDATA1_DB7(regval) (BITS(24, 31) & ((uint32_t)(regval) << 24))
/* receive mailbox extended identifier*/
#define GET_RFIFOMI_EFID(regval) GET_BITS((uint32_t)(regval), 3, 31)
/* receive mailbox standrad identifier*/
#define GET_RFIFOMI_SFID(regval) GET_BITS((uint32_t)(regval), 21, 31)
/* receive data length */
#define GET_RFIFOMP_DLENC(regval) GET_BITS((uint32_t)(regval), 0, 3)
/* the index of the filter by which the frame is passed */
#define GET_RFIFOMP_FI(regval) GET_BITS((uint32_t)(regval), 8, 15)
/* receive data byte 0 */
#define GET_RFIFOMDATA0_DB0(regval) GET_BITS((uint32_t)(regval), 0, 7)
/* receive data byte 1 */
#define GET_RFIFOMDATA0_DB1(regval) GET_BITS((uint32_t)(regval), 8, 15)
/* receive data byte 2 */
#define GET_RFIFOMDATA0_DB2(regval) GET_BITS((uint32_t)(regval), 16, 23)
/* receive data byte 3 */
#define GET_RFIFOMDATA0_DB3(regval) GET_BITS((uint32_t)(regval), 24, 31)
/* receive data byte 4 */
#define GET_RFIFOMDATA1_DB4(regval) GET_BITS((uint32_t)(regval), 0, 7)
/* receive data byte 5 */
#define GET_RFIFOMDATA1_DB5(regval) GET_BITS((uint32_t)(regval), 8, 15)
/* receive data byte 6 */
#define GET_RFIFOMDATA1_DB6(regval) GET_BITS((uint32_t)(regval), 16, 23)
/* receive data byte 7 */
#define GET_RFIFOMDATA1_DB7(regval) GET_BITS((uint32_t)(regval), 24, 31)
/* error number */
#define GET_ERR_ERRN(regval) GET_BITS((uint32_t)(regval), 4, 6)
/* transmit error count */
#define GET_ERR_TECNT(regval) GET_BITS((uint32_t)(regval), 16, 23)
/* receive error count */
#define GET_ERR_RECNT(regval) GET_BITS((uint32_t)(regval), 24, 31)
/* CAN errors */
#define ERR_ERRN(regval) (BITS(4, 6) & ((uint32_t)(regval) << 4))
#define CAN_ERRN_0 ERR_ERRN(0) /* no error */
#define CAN_ERRN_1 ERR_ERRN(1) /*!< fill error */
#define CAN_ERRN_2 ERR_ERRN(2) /*!< format error */
#define CAN_ERRN_3 ERR_ERRN(3) /*!< ACK error */
#define CAN_ERRN_4 ERR_ERRN(4) /*!< bit recessive error */
#define CAN_ERRN_5 ERR_ERRN(5) /*!< bit dominant error */
#define CAN_ERRN_6 ERR_ERRN(6) /*!< CRC error */
#define CAN_ERRN_7 ERR_ERRN(7) /*!< software error */
#define CAN_STATE_PENDING ((uint32_t)0x00000000U) /*!< CAN pending */
/* CAN communication mode */
#define CAN_NORMAL_MODE ((uint8_t)0x00U) /*!< normal communication mode */
#define CAN_LOOPBACK_MODE ((uint8_t)0x01U) /*!< loopback communication mode */
#define CAN_SILENT_MODE ((uint8_t)0x02U) /*!< silent communication mode */
#define CAN_SILENT_LOOPBACK_MODE ((uint8_t)0x03U) /*!< loopback and silent communication mode */
/* CAN resynchronisation jump width */
#define CAN_BT_SJW_1TQ ((uint8_t)0x00U) /*!< 1 time quanta */
#define CAN_BT_SJW_2TQ ((uint8_t)0x01U) /*!< 2 time quanta */
#define CAN_BT_SJW_3TQ ((uint8_t)0x02U) /*!< 3 time quanta */
#define CAN_BT_SJW_4TQ ((uint8_t)0x03U) /*!< 4 time quanta */
/* CAN time segment 1 */
#define CAN_BT_BS1_1TQ ((uint8_t)0x00U) /*!< 1 time quanta */
#define CAN_BT_BS1_2TQ ((uint8_t)0x01U) /*!< 2 time quanta */
#define CAN_BT_BS1_3TQ ((uint8_t)0x02U) /*!< 3 time quanta */
#define CAN_BT_BS1_4TQ ((uint8_t)0x03U) /*!< 4 time quanta */
#define CAN_BT_BS1_5TQ ((uint8_t)0x04U) /*!< 5 time quanta */
#define CAN_BT_BS1_6TQ ((uint8_t)0x05U) /*!< 6 time quanta */
#define CAN_BT_BS1_7TQ ((uint8_t)0x06U) /*!< 7 time quanta */
#define CAN_BT_BS1_8TQ ((uint8_t)0x07U) /*!< 8 time quanta */
#define CAN_BT_BS1_9TQ ((uint8_t)0x08U) /*!< 9 time quanta */
#define CAN_BT_BS1_10TQ ((uint8_t)0x09U) /*!< 10 time quanta */
#define CAN_BT_BS1_11TQ ((uint8_t)0x0AU) /*!< 11 time quanta */
#define CAN_BT_BS1_12TQ ((uint8_t)0x0BU) /*!< 12 time quanta */
#define CAN_BT_BS1_13TQ ((uint8_t)0x0CU) /*!< 13 time quanta */
#define CAN_BT_BS1_14TQ ((uint8_t)0x0DU) /*!< 14 time quanta */
#define CAN_BT_BS1_15TQ ((uint8_t)0x0EU) /*!< 15 time quanta */
#define CAN_BT_BS1_16TQ ((uint8_t)0x0FU) /*!< 16 time quanta */
/* CAN time segment 2 */
#define CAN_BT_BS2_1TQ ((uint8_t)0x00U) /*!< 1 time quanta */
#define CAN_BT_BS2_2TQ ((uint8_t)0x01U) /*!< 2 time quanta */
#define CAN_BT_BS2_3TQ ((uint8_t)0x02U) /*!< 3 time quanta */
#define CAN_BT_BS2_4TQ ((uint8_t)0x03U) /*!< 4 time quanta */
#define CAN_BT_BS2_5TQ ((uint8_t)0x04U) /*!< 5 time quanta */
#define CAN_BT_BS2_6TQ ((uint8_t)0x05U) /*!< 6 time quanta */
#define CAN_BT_BS2_7TQ ((uint8_t)0x06U) /*!< 7 time quanta */
#define CAN_BT_BS2_8TQ ((uint8_t)0x07U) /*!< 8 time quanta */
/* CAN mailbox number */
#define CAN_MAILBOX0 ((uint8_t)0x00U) /*!< mailbox0 */
#define CAN_MAILBOX1 ((uint8_t)0x01U) /*!< mailbox1 */
#define CAN_MAILBOX2 ((uint8_t)0x02U) /*!< mailbox2 */
#define CAN_NOMAILBOX ((uint8_t)0x03U) /*!< no mailbox empty */
/* CAN frame format */
#define CAN_FF_STANDARD ((uint32_t)0x00000000U) /*!< standard frame */
#define CAN_FF_EXTENDED ((uint32_t)0x00000004U) /*!< extended frame */
/* CAN receive fifo */
#define CAN_FIFO0 ((uint8_t)0x00U) /*!< receive FIFO0 */
#define CAN_FIFO1 ((uint8_t)0x01U) /*!< receive FIFO1 */
/* frame number of receive fifo */
#define CAN_RFIF_RFL_MASK ((uint32_t)0x00000003U) /*!< mask for frame number in receive FIFOx */
#define CAN_SFID_MASK ((uint32_t)0x000007FFU) /*!< mask of standard identifier */
#define CAN_EFID_MASK ((uint32_t)0x1FFFFFFFU) /*!< mask of extended identifier */
/* CAN working mode */
#define CAN_MODE_INITIALIZE ((uint8_t)0x01U) /*!< CAN initialize mode */
#define CAN_MODE_NORMAL ((uint8_t)0x02U) /*!< CAN normal mode */
#define CAN_MODE_SLEEP ((uint8_t)0x04U) /*!< CAN sleep mode */
/* filter bits */
#define CAN_FILTERBITS_16BIT ((uint8_t)0x00U) /*!< CAN filter 16 bits */
#define CAN_FILTERBITS_32BIT ((uint8_t)0x01U) /*!< CAN filter 32 bits */
/* filter mode */
#define CAN_FILTERMODE_MASK ((uint8_t)0x00U) /*!< mask mode */
#define CAN_FILTERMODE_LIST ((uint8_t)0x01U) /*!< list mode */
/* filter 16 bits mask */
#define CAN_FILTER_MASK_16BITS ((uint32_t)0x0000FFFFU) /*!< can filter 16 bits mask */
/* frame type */
#define CAN_FT_DATA ((uint32_t)0x00000000U) /*!< data frame */
#define CAN_FT_REMOTE ((uint32_t)0x00000002U) /*!< remote frame */
/* CAN timeout */
#define CAN_TIMEOUT ((uint32_t)0x0000FFFFU) /*!< timeout value */
/* interrupt enable bits */
#define CAN_INT_TME CAN_INTEN_TMEIE /*!< transmit mailbox empty interrupt enable */
#define CAN_INT_RFNE0 CAN_INTEN_RFNEIE0 /*!< receive FIFO0 not empty interrupt enable */
#define CAN_INT_RFF0 CAN_INTEN_RFFIE0 /*!< receive FIFO0 full interrupt enable */
#define CAN_INT_RFO0 CAN_INTEN_RFOIE0 /*!< receive FIFO0 overfull interrupt enable */
#define CAN_INT_RFNE1 CAN_INTEN_RFNEIE1 /*!< receive FIFO1 not empty interrupt enable */
#define CAN_INT_RFF1 CAN_INTEN_RFFIE1 /*!< receive FIFO1 full interrupt enable */
#define CAN_INT_RFO1 CAN_INTEN_RFOIE1 /*!< receive FIFO1 overfull interrupt enable */
#define CAN_INT_WERR CAN_INTEN_WERRIE /*!< warning error interrupt enable */
#define CAN_INT_PERR CAN_INTEN_PERRIE /*!< passive error interrupt enable */
#define CAN_INT_BO CAN_INTEN_BOIE /*!< bus-off interrupt enable */
#define CAN_INT_ERRN CAN_INTEN_ERRNIE /*!< error number interrupt enable */
#define CAN_INT_ERR CAN_INTEN_ERRIE /*!< error interrupt enable */
#define CAN_INT_WAKEUP CAN_INTEN_WIE /*!< wakeup interrupt enable */
#define CAN_INT_SLPW CAN_INTEN_SLPWIE /*!< sleep working interrupt enable */
/* function declarations */
/* deinitialize CAN */
void can_deinit(uint32_t can_periph);
/* initialize CAN struct */
void can_struct_para_init(can_struct_type_enum type, void *p_struct);
/* initialize CAN */
ErrStatus can_init(uint32_t can_periph, can_parameter_struct *can_parameter_init);
/* CAN filter init */
void can_filter_init(can_filter_parameter_struct *can_filter_parameter_init);
/* set can1 fliter start bank number */
void can1_filter_start_bank(uint8_t start_bank);
/* enable functions */
/* CAN debug freeze enable */
void can_debug_freeze_enable(uint32_t can_periph);
/* CAN debug freeze disable */
void can_debug_freeze_disable(uint32_t can_periph);
/* CAN time trigger mode enable */
void can_time_trigger_mode_enable(uint32_t can_periph);
/* CAN time trigger mode disable */
void can_time_trigger_mode_disable(uint32_t can_periph);
/* transmit functions */
/* transmit CAN message */
uint8_t can_message_transmit(uint32_t can_periph, can_trasnmit_message_struct *transmit_message);
/* get CAN transmit state */
can_transmit_state_enum can_transmit_states(uint32_t can_periph, uint8_t mailbox_number);
/* stop CAN transmission */
void can_transmission_stop(uint32_t can_periph, uint8_t mailbox_number);
/* CAN receive message */
void can_message_receive(uint32_t can_periph, uint8_t fifo_number, can_receive_message_struct *receive_message);
/* CAN release fifo */
void can_fifo_release(uint32_t can_periph, uint8_t fifo_number);
/* CAN receive message length */
uint8_t can_receive_message_length_get(uint32_t can_periph, uint8_t fifo_number);
/* CAN working mode */
ErrStatus can_working_mode_set(uint32_t can_periph, uint8_t working_mode);
/* CAN wakeup from sleep mode */
ErrStatus can_wakeup(uint32_t can_periph);
/* CAN get error */
can_error_enum can_error_get(uint32_t can_periph);
/* get CAN receive error number */
uint8_t can_receive_error_number_get(uint32_t can_periph);
/* get CAN transmit error number */
uint8_t can_transmit_error_number_get(uint32_t can_periph);
/* CAN interrupt enable */
void can_interrupt_enable(uint32_t can_periph, uint32_t interrupt);
/* CAN interrupt disable */
void can_interrupt_disable(uint32_t can_periph, uint32_t interrupt);
/* CAN get flag state */
FlagStatus can_flag_get(uint32_t can_periph, can_flag_enum flag);
/* CAN clear flag state */
void can_flag_clear(uint32_t can_periph, can_flag_enum flag);
/* CAN get interrupt flag state */
FlagStatus can_interrupt_flag_get(uint32_t can_periph, can_interrupt_flag_enum flag);
/* CAN clear interrupt flag state */
void can_interrupt_flag_clear(uint32_t can_periph, can_interrupt_flag_enum flag);
#endif /* GD32VF103_CAN_H */

View File

@@ -1,13 +1,13 @@
/*!
\file gd32vf103_crc.h
\brief definitions for the CRC
\file gd32vf103_crc.h
\brief definitions for the CRC
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -37,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_CRC_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* CRC definitions */
#define CRC CRC_BASE

View File

@@ -2,11 +2,12 @@
\file gd32vf103_dac.h
\brief definitions for the DAC
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_DAC_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* DACx(x=0,1) definitions */
#define DAC DAC_BASE

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_dbg.h
\brief definitions for the DBG
\file gd32vf103_dbg.h
\brief definitions for the DBG
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,7 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_DBG_H
#include "gd32vf103.h"
#include "gd32vf103_rcu.h"
/* DBG definitions */
#define DBG DBG_BASE

View File

@@ -2,11 +2,13 @@
\file gd32vf103_dma.h
\brief definitions for the DMA
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2019-10-30, V1.0.1, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,11 +38,7 @@ OF SUCH DAMAGE.
#define GD32VF103_DMA_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
#ifdef _cplusplus
extern "C" {
#endif
/* DMA definitions */
#define DMA0 (DMA_BASE) /*!< DMA0 base address */
#define DMA1 (DMA_BASE + 0x0400U) /*!< DMA1 base address */
@@ -181,16 +179,16 @@ typedef struct {
#define DMA_INT_ERR DMA_CHXCTL_ERRIE /*!< enable bit for channel error interrupt */
/* transfer direction */
#define DMA_PERIPHERAL_TO_MEMORY ((uint8_t)0x0000U) /*!< read from peripheral and write to memory */
#define DMA_MEMORY_TO_PERIPHERAL ((uint8_t)0x0001U) /*!< read from memory and write to peripheral */
#define DMA_PERIPHERAL_TO_MEMORY ((uint8_t)0x00U) /*!< read from peripheral and write to memory */
#define DMA_MEMORY_TO_PERIPHERAL ((uint8_t)0x01U) /*!< read from memory and write to peripheral */
/* peripheral increasing mode */
#define DMA_PERIPH_INCREASE_DISABLE ((uint8_t)0x0000U) /*!< next address of peripheral is fixed address mode */
#define DMA_PERIPH_INCREASE_ENABLE ((uint8_t)0x0001U) /*!< next address of peripheral is increasing address mode */
#define DMA_PERIPH_INCREASE_DISABLE ((uint8_t)0x00U) /*!< next address of peripheral is fixed address mode */
#define DMA_PERIPH_INCREASE_ENABLE ((uint8_t)0x01U) /*!< next address of peripheral is increasing address mode */
/* memory increasing mode */
#define DMA_MEMORY_INCREASE_DISABLE ((uint8_t)0x0000U) /*!< next address of memory is fixed address mode */
#define DMA_MEMORY_INCREASE_ENABLE ((uint8_t)0x0001U) /*!< next address of memory is increasing address mode */
#define DMA_MEMORY_INCREASE_DISABLE ((uint8_t)0x00U) /*!< next address of memory is fixed address mode */
#define DMA_MEMORY_INCREASE_ENABLE ((uint8_t)0x01U) /*!< next address of memory is increasing address mode */
/* transfer data size of peripheral */
#define CHCTL_PWIDTH(regval) (BITS(8, 9) & ((uint32_t)(regval) << 8)) /*!< transfer data size of peripheral */
@@ -264,7 +262,7 @@ void dma_periph_increase_enable(uint32_t dma_periph, dma_channel_enum channelx);
/* disable next address increasement algorithm of peripheral */
void dma_periph_increase_disable(uint32_t dma_periph, dma_channel_enum channelx);
/* configure the direction of data transfer on the channel */
void dma_transfer_direction_config(uint32_t dma_periph, dma_channel_enum channelx, uint32_t direction);
void dma_transfer_direction_config(uint32_t dma_periph, dma_channel_enum channelx, uint8_t direction);
/* flag and interrupt functions */
/* check DMA flag is set or not */
@@ -279,8 +277,5 @@ void dma_interrupt_flag_clear(uint32_t dma_periph, dma_channel_enum channelx, ui
void dma_interrupt_enable(uint32_t dma_periph, dma_channel_enum channelx, uint32_t source);
/* disable DMA interrupt */
void dma_interrupt_disable(uint32_t dma_periph, dma_channel_enum channelx, uint32_t source);
#ifdef _cplusplus
}
#endif
#endif /* GD32VF103_DMA_H */

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_eclic.h
\brief definitions for the ECLIC(Enhancement Core-Local Interrupt Controller)
\file gd32vf103_eclic.h
\brief definitions for the ECLIC(Enhancement Core-Local Interrupt Controller)
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -31,9 +32,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GD32VF103_ECLIC_H
#define GD32VF103_ECLIC_H
@@ -49,8 +48,12 @@ extern "C" {
#define __SEV eclic_send_event
/* function declarations */
/* enable the global interrupt */
void eclic_global_interrupt_enable(void);
/* disable the global interrupt */
void eclic_global_interrupt_disable(void);
/* set the priority group */
void eclic_priority_group_set(uint32_t prigroup);
void eclic_priority_group_set(uint8_t prigroup);
/* enable the interrupt request */
void eclic_irq_enable(uint32_t source, uint8_t level, uint8_t priority);
/* disable the interrupt request */
@@ -62,6 +65,3 @@ void eclic_system_reset(void);
void eclic_send_event(void);
#endif /* GD32VF103_ECLIC_H */
#ifdef __cplusplus
}
#endif

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_exmc.h
\brief definitions for the EXMC
\file gd32vf103_exmc.h
\brief definitions for the EXMC
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_EXMC_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* EXMC definitions */
#define EXMC (EXMC_BASE) /*!< EXMC register base address */
@@ -79,13 +78,13 @@ typedef struct {
/* EXMC NOR/SRAM initialize struct */
typedef struct {
uint32_t norsram_region; /*!< select the region of EXMC NOR/SRAM bank */
uint32_t asyn_wait; /*!< enable or disable the asynchronous wait function */
uint32_t nwait_signal; /*!< enable or disable the NWAIT signal */
uint32_t memory_write; /*!< enable or disable the write operation */
ControlStatus asyn_wait; /*!< enable or disable the asynchronous wait function */
ControlStatus nwait_signal; /*!< enable or disable the NWAIT signal */
ControlStatus memory_write; /*!< enable or disable the write operation */
uint32_t nwait_polarity; /*!< specifies the polarity of NWAIT signal from memory */
uint32_t databus_width; /*!< specifies the databus width of external memory */
uint32_t memory_type; /*!< specifies the type of external memory */
uint32_t address_data_mux; /*!< specifies whether the data bus and address bus are multiplexed */
ControlStatus address_data_mux; /*!< specifies whether the data bus and address bus are multiplexed */
exmc_norsram_timing_parameter_struct *read_write_timing; /*!< timing parameters for read and write */
} exmc_norsram_parameter_struct;

View File

@@ -2,11 +2,12 @@
\file gd32vf103_exti.h
\brief definitions for the EXTI
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_EXTI_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* EXTI definitions */
#define EXTI EXTI_BASE

View File

@@ -1,12 +1,15 @@
/*!
\file gd32vf103_fmc.h
\brief definitions for the FMC
\file gd32vf103_fmc.h
\brief definitions for the FMC
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2019-09-18, V1.0.1, firmware for GD32VF103
\version 2020-02-20, V1.0.2, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +39,6 @@ OF SUCH DAMAGE.
#define GD32VF103_FMC_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* FMC and option byte definition */
#define FMC FMC_BASE /*!< FMC register base address */
@@ -45,11 +46,11 @@ OF SUCH DAMAGE.
/* registers definitions */
#define FMC_WS REG32((FMC) + 0x00U) /*!< FMC wait state register */
#define FMC_KEY0 REG32((FMC) + 0x04U) /*!< FMC unlock key register 0 */
#define FMC_KEY REG32((FMC) + 0x04U) /*!< FMC unlock key register */
#define FMC_OBKEY REG32((FMC) + 0x08U) /*!< FMC option bytes unlock key register */
#define FMC_STAT0 REG32((FMC) + 0x0CU) /*!< FMC status register 0 */
#define FMC_CTL0 REG32((FMC) + 0x10U) /*!< FMC control register 0 */
#define FMC_ADDR0 REG32((FMC) + 0x14U) /*!< FMC address register 0 */
#define FMC_STAT REG32((FMC) + 0x0CU) /*!< FMC status register */
#define FMC_CTL REG32((FMC) + 0x10U) /*!< FMC control register */
#define FMC_ADDR REG32((FMC) + 0x14U) /*!< FMC address register */
#define FMC_OBSTAT REG32((FMC) + 0x1CU) /*!< FMC option bytes status register */
#define FMC_WP REG32((FMC) + 0x20U) /*!< FMC erase/program protection register */
#define FMC_PID REG32((FMC) + 0x100U) /*!< FMC product ID register */
@@ -65,31 +66,31 @@ OF SUCH DAMAGE.
/* FMC_WS */
#define FMC_WS_WSCNT BITS(0, 2) /*!< wait state counter */
/* FMC_KEY0 */
#define FMC_KEY0_KEY BITS(0, 31) /*!< FMC_CTL0 unlock key bits */
/* FMC_KEY */
#define FMC_KEY_KEY BITS(0, 31) /*!< FMC_CTL unlock key bits */
/* FMC_OBKEY */
#define FMC_OBKEY_OBKEY BITS(0, 31) /*!< option bytes unlock key bits */
/* FMC_STAT0 */
#define FMC_STAT0_BUSY BIT(0) /*!< flash busy flag bit */
#define FMC_STAT0_PGERR BIT(2) /*!< flash program error flag bit */
#define FMC_STAT0_WPERR BIT(4) /*!< erase/program protection error flag bit */
#define FMC_STAT0_ENDF BIT(5) /*!< end of operation flag bit */
/* FMC_STAT */
#define FMC_STAT_BUSY BIT(0) /*!< flash busy flag bit */
#define FMC_STAT_PGERR BIT(2) /*!< flash program error flag bit */
#define FMC_STAT_WPERR BIT(4) /*!< erase/program protection error flag bit */
#define FMC_STAT_ENDF BIT(5) /*!< end of operation flag bit */
/* FMC_CTL0 */
#define FMC_CTL0_PG BIT(0) /*!< main flash program for bank0 command bit */
#define FMC_CTL0_PER BIT(1) /*!< main flash page erase for bank0 command bit */
#define FMC_CTL0_MER BIT(2) /*!< main flash mass erase for bank0 command bit */
#define FMC_CTL0_OBPG BIT(4) /*!< option bytes program command bit */
#define FMC_CTL0_OBER BIT(5) /*!< option bytes erase command bit */
#define FMC_CTL0_START BIT(6) /*!< send erase command to FMC bit */
#define FMC_CTL0_LK BIT(7) /*!< FMC_CTL0 lock bit */
#define FMC_CTL0_OBWEN BIT(9) /*!< option bytes erase/program enable bit */
#define FMC_CTL0_ERRIE BIT(10) /*!< error interrupt enable bit */
#define FMC_CTL0_ENDIE BIT(12) /*!< end of operation interrupt enable bit */
/* FMC_CTL */
#define FMC_CTL_PG BIT(0) /*!< main flash program command bit */
#define FMC_CTL_PER BIT(1) /*!< main flash page erase command bit */
#define FMC_CTL_MER BIT(2) /*!< main flash mass erase command bit */
#define FMC_CTL_OBPG BIT(4) /*!< option bytes program command bit */
#define FMC_CTL_OBER BIT(5) /*!< option bytes erase command bit */
#define FMC_CTL_START BIT(6) /*!< send erase command to FMC bit */
#define FMC_CTL_LK BIT(7) /*!< FMC_CTL lock bit */
#define FMC_CTL_OBWEN BIT(9) /*!< option bytes erase/program enable bit */
#define FMC_CTL_ERRIE BIT(10) /*!< error interrupt enable bit */
#define FMC_CTL_ENDIE BIT(12) /*!< end of operation interrupt enable bit */
/* FMC_ADDR0 */
/* FMC_ADDR */
#define FMC_ADDR0_ADDR BITS(0, 31) /*!< Flash erase/program command address bits */
/* FMC_OBSTAT */
@@ -119,8 +120,8 @@ OF SUCH DAMAGE.
#define FMC_REG_OFFSET_GET(flag) ((uint32_t)(flag) >> 12)
/* configuration register */
#define FMC_STAT0_REG_OFFSET 0x0CU /*!< status register 0 offset */
#define FMC_CTL0_REG_OFFSET 0x10U /*!< control register 0 offset */
#define FMC_STAT_REG_OFFSET 0x0CU /*!< status register offset */
#define FMC_CTL_REG_OFFSET 0x10U /*!< control register offset */
#define FMC_OBSTAT_REG_OFFSET 0x1CU /*!< option byte status register offset */
/* fmc state */
@@ -134,24 +135,23 @@ typedef enum {
/* FMC interrupt enable */
typedef enum {
FMC_INT_END = FMC_REGIDX_BIT(FMC_CTL0_REG_OFFSET, 12U), /*!< enable FMC end of program interrupt */
FMC_INT_ERR = FMC_REGIDX_BIT(FMC_CTL0_REG_OFFSET, 10U), /*!< enable FMC error interrupt */
FMC_INT_END = FMC_CTL_ENDIE, /*!< enable FMC end of program interrupt */
FMC_INT_ERR = FMC_CTL_ERRIE, /*!< enable FMC error interrupt */
} fmc_int_enum;
/* FMC flags */
typedef enum {
FMC_FLAG_BUSY = FMC_REGIDX_BIT(FMC_STAT0_REG_OFFSET, 0U), /*!< FMC busy flag */
FMC_FLAG_PGERR = FMC_REGIDX_BIT(FMC_STAT0_REG_OFFSET, 2U), /*!< FMC operation error flag bit */
FMC_FLAG_WPERR = FMC_REGIDX_BIT(FMC_STAT0_REG_OFFSET, 4U), /*!< FMC erase/program protection error flag bit */
FMC_FLAG_END = FMC_REGIDX_BIT(FMC_STAT0_REG_OFFSET, 5U), /*!< FMC end of operation flag bit */
FMC_FLAG_OBERR = FMC_REGIDX_BIT(FMC_OBSTAT_REG_OFFSET, 0U), /*!< FMC option bytes read error flag */
FMC_FLAG_BUSY = FMC_STAT_BUSY, /*!< FMC busy flag */
FMC_FLAG_PGERR = FMC_STAT_PGERR, /*!< FMC operation error flag */
FMC_FLAG_WPERR = FMC_STAT_WPERR, /*!< FMC erase/program protection error flag */
FMC_FLAG_END = FMC_STAT_ENDF, /*!< FMC end of operation flag */
} fmc_flag_enum;
/* FMC interrupt flags */
typedef enum {
FMC_INT_FLAG_PGERR = FMC_REGIDX_BITS(FMC_STAT0_REG_OFFSET, 2U, 10U), /*!< FMC operation error interrupt flag bit */
FMC_INT_FLAG_WPERR = FMC_REGIDX_BITS(FMC_STAT0_REG_OFFSET, 4U, 10U), /*!< FMC erase/program protection error interrupt flag bit */
FMC_INT_FLAG_END = FMC_REGIDX_BITS(FMC_STAT0_REG_OFFSET, 5U, 12U), /*!< FMC end of operation interrupt flag bit */
FMC_INT_FLAG_PGERR = FMC_STAT_PGERR, /*!< FMC operation error interrupt flag */
FMC_INT_FLAG_WPERR = FMC_STAT_WPERR, /*!< FMC erase/program protection error interrupt flag */
FMC_INT_FLAG_END = FMC_STAT_ENDF, /*!< FMC end of operation interrupt flag */
} fmc_interrupt_flag_enum;
/* unlock key */
@@ -271,32 +271,32 @@ void ob_unlock(void);
void ob_lock(void);
/* erase the FMC option byte */
fmc_state_enum ob_erase(void);
/* enable write protect */
/* enable write protection */
fmc_state_enum ob_write_protection_enable(uint32_t ob_wp);
/* configure the option byte security protection */
/* configure security protection */
fmc_state_enum ob_security_protection_config(uint8_t ob_spc);
/* write the FMC option byte */
/* program the FMC user option byte */
fmc_state_enum ob_user_write(uint8_t ob_fwdgt, uint8_t ob_deepsleep, uint8_t ob_stdby, uint8_t ob_boot);
/* program option bytes data */
/* program the FMC data option byte */
fmc_state_enum ob_data_program(uint32_t address, uint8_t data);
/* get the FMC option byte user */
/* get OB_USER in register FMC_OBSTAT */
uint8_t ob_user_get(void);
/* get OB_DATA in register FMC_OBSTAT */
uint16_t ob_data_get(void);
/* get the FMC option byte write protection */
uint32_t ob_write_protection_get(void);
/* get FMC option byte security protection code value */
/* get FMC option byte security protection state */
FlagStatus ob_spc_get(void);
/* FMC interrupts and flags management functions */
/* enable FMC interrupt */
void fmc_interrupt_enable(uint32_t interrupt);
void fmc_interrupt_enable(fmc_int_enum interrupt);
/* disable FMC interrupt */
void fmc_interrupt_disable(uint32_t interrupt);
void fmc_interrupt_disable(fmc_int_enum interrupt);
/* check flag is set or not */
FlagStatus fmc_flag_get(uint32_t flag);
FlagStatus fmc_flag_get(fmc_flag_enum flag);
/* clear the FMC flag */
void fmc_flag_clear(uint32_t flag);
void fmc_flag_clear(fmc_flag_enum flag);
/* get FMC interrupt flag state */
FlagStatus fmc_interrupt_flag_get(fmc_interrupt_flag_enum flag);
/* clear FMC interrupt flag state */

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_fwdgt.h
\brief definitions for the FWDGT
\file gd32vf103_fwdgt.h
\brief definitions for the FWDGT
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_FWDGT_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* FWDGT definitions */
#define FWDGT FWDGT_BASE /*!< FWDGT base address */

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_gpio.h
\brief definitions for the GPIO
\file gd32vf103_gpio.h
\brief definitions for the GPIO
\version 2019-06-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,11 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_GPIO_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
#ifdef __cplusplus
extern "C" {
#endif
/* GPIOx(x=A,B,C,D,E) definitions */
#define GPIOA (GPIO_BASE + 0x00000000U)
@@ -422,8 +418,5 @@ void gpio_event_output_disable(void);
/* lock GPIO pin bit */
void gpio_pin_lock(uint32_t gpio_periph, uint32_t pin);
#ifdef __cplusplus
}
#endif
#endif /* GD32VF103_GPIO_H */

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_i2c.h
\brief definitions for the I2C
\file gd32vf103_i2c.h
\brief definitions for the I2C
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_I2C_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* I2Cx(x=0,1) definitions */
#define I2C0 I2C_BASE /*!< I2C0 base address */
@@ -53,7 +52,7 @@ OF SUCH DAMAGE.
#define I2C_STAT1(i2cx) REG32((i2cx) + 0x18U) /*!< I2C transfer status register */
#define I2C_CKCFG(i2cx) REG32((i2cx) + 0x1CU) /*!< I2C clock configure register */
#define I2C_RT(i2cx) REG32((i2cx) + 0x20U) /*!< I2C rise time register */
#define I2C_FMPCFG(i2cx) REG32((i2cx) + 0x90U) /*!< I2C fast-mode-plus configure register */
/* bits definitions */
/* I2Cx_CTL0 */
#define I2C_CTL0_I2CEN BIT(0) /*!< peripheral enable */
@@ -126,6 +125,9 @@ OF SUCH DAMAGE.
/* I2Cx_RT */
#define I2C_RT_RISETIME BITS(0, 5) /*!< maximum rise time in fast/standard mode (Master mode) */
/* I2Cx_FMPCFG */
#define I2C_FMPCFG_FMPEN BIT(0) /*!< fast mode plus enable bit */
/* constants definitions */
/* define the I2C bit position and its register index offset */
#define I2C_REGIDX_BIT(regidx, bitpos) (((uint32_t)(regidx) << 6) | (uint32_t)(bitpos))
@@ -286,8 +288,6 @@ void i2c_ack_config(uint32_t i2c_periph, uint32_t ack);
void i2c_ackpos_config(uint32_t i2c_periph, uint32_t pos);
/* master sends slave address */
void i2c_master_addressing(uint32_t i2c_periph, uint32_t addr, uint32_t trandirection);
/* configure I2C saddress1 */
void i2c_saddr1_config(uint32_t i2c_periph, uint32_t addr);
/* enable dual-address mode */
void i2c_dualaddr_enable(uint32_t i2c_periph, uint32_t dualaddr);
/* disable dual-address mode */

View File

@@ -40,7 +40,6 @@ extern "C" {
#include "gd32vf103.h"
#include "gd32vf103_adc.h"
#include "gd32vf103_bkp.h"
#include "gd32vf103_can.h"
#include "gd32vf103_crc.h"
#include "gd32vf103_dac.h"
#include "gd32vf103_dbg.h"

View File

@@ -2,11 +2,12 @@
\file gd32vf103_pmu.h
\brief definitions for the PMU
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_PMU_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* PMU definitions */
#define PMU PMU_BASE /*!< PMU base address */

View File

@@ -2,11 +2,12 @@
\file gd32vf103_rcu.h
\brief definitions for the RCU
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,7 +37,10 @@ OF SUCH DAMAGE.
#define GD32VF103_RCU_H
#include "gd32vf103.h"
/* define clock source */
#define SEL_IRC8M ((uint16_t)0U)
#define SEL_HXTAL ((uint16_t)1U)
#define SEL_PLL ((uint16_t)2U)
/* RCU definitions */
#define RCU RCU_BASE
@@ -227,46 +231,6 @@ OF SUCH DAMAGE.
#define RCU_DSV_DSLPVS BITS(0, 1) /*!< deep-sleep mode voltage select */
/* constants definitions */
/* define value of high speed crystal oscillator (HXTAL) in Hz */
#if !defined HXTAL_VALUE
#define HXTAL_VALUE ((uint32_t)8000000) /*!< value of the external oscillator in Hz */
#define HXTAL_VALUE_25M HXTAL_VALUE
#endif /* high speed crystal oscillator value */
/* define startup timeout value of high speed crystal oscillator (HXTAL) */
#if !defined(HXTAL_STARTUP_TIMEOUT)
#define HXTAL_STARTUP_TIMEOUT ((uint16_t)0xFFFF)
#endif /* high speed crystal oscillator startup timeout */
/* define value of internal 8MHz RC oscillator (IRC8M) in Hz */
#if !defined(IRC8M_VALUE)
#define IRC8M_VALUE ((uint32_t)8000000)
#endif /* internal 8MHz RC oscillator value */
/* define startup timeout value of internal 8MHz RC oscillator (IRC8M) */
#if !defined(IRC8M_STARTUP_TIMEOUT)
#define IRC8M_STARTUP_TIMEOUT ((uint16_t)0x0500)
#endif /* internal 8MHz RC oscillator startup timeout */
/* define value of internal 40KHz RC oscillator(IRC40K) in Hz */
#if !defined(IRC40K_VALUE)
#define IRC40K_VALUE ((uint32_t)40000)
#endif /* internal 40KHz RC oscillator value */
/* define value of low speed crystal oscillator (LXTAL)in Hz */
#if !defined(LXTAL_VALUE)
#define LXTAL_VALUE ((uint32_t)32768)
#endif /* low speed crystal oscillator value */
/* define clock source */
#define SEL_IRC8M ((uint16_t)0U)
#define SEL_HXTAL ((uint16_t)1U)
#define SEL_PLL ((uint16_t)2U)
/* define startup timeout count */
#define OSC_STARTUP_TIMEOUT ((uint32_t)0xFFFFFU)
#define LXTAL_STARTUP_TIMEOUT ((uint32_t)0x3FFFFFFU)
/* define the peripheral clock enable bit position and its register index offset */
#define RCU_REGIDX_BIT(regidx, bitpos) (((uint32_t)(regidx) << 6) | (uint32_t)(bitpos))
#define RCU_REG_VAL(periph) (REG32(RCU + ((uint32_t)(periph) >> 6)))

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_rtc.h
\brief definitions for the RTC
\file gd32vf103_rtc.h
\brief definitions for the RTC
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_RTC_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* RTC definitions */
#define RTC RTC_BASE

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_spi.h
\brief definitions for the SPI
\file gd32vf103_spi.h
\brief definitions for the SPI
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_SPI_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* SPIx(x=0,1,2) definitions */
#define SPI0 (SPI_BASE + 0x0000F800U)

View File

@@ -2,11 +2,12 @@
\file gd32vf103_timer.h
\brief definitions for the TIMER
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.1, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_TIMER_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* TIMERx(x=0..13) definitions */
#define TIMER0 (TIMER_BASE + 0x00012C00U)

View File

@@ -2,11 +2,13 @@
\file gd32vf103_usart.h
\brief definitions for the USART
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2019-09-18, V1.0.1, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2018, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,11 +38,6 @@ OF SUCH DAMAGE.
#define GD32VF103_USART_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
#ifdef _cplusplus
extern "C" {
#endif
/* USARTx(x=0,1,2)/UARTx(x=3,4) definitions */
#define USART1 USART_BASE /*!< USART1 base address */
@@ -140,12 +137,12 @@ extern "C" {
/* USART flags */
typedef enum {
/* flags in STAT register */
USART_FLAG_CTSF = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 9U), /*!< CTS change flag */
USART_FLAG_LBDF = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 8U), /*!< LIN break detected flag */
USART_FLAG_CTS = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 9U), /*!< CTS change flag */
USART_FLAG_LBD = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 8U), /*!< LIN break detected flag */
USART_FLAG_TBE = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 7U), /*!< transmit data buffer empty */
USART_FLAG_TC = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 6U), /*!< transmission complete */
USART_FLAG_RBNE = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 5U), /*!< read data buffer not empty */
USART_FLAG_IDLEF = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 4U), /*!< IDLE frame detected flag */
USART_FLAG_IDLE = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 4U), /*!< IDLE frame detected flag */
USART_FLAG_ORERR = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 3U), /*!< overrun error */
USART_FLAG_NERR = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 2U), /*!< noise error flag */
USART_FLAG_FERR = USART_REGIDX_BIT(USART_STAT_REG_OFFSET, 1U), /*!< frame error flag */
@@ -365,17 +362,11 @@ void usart_flag_clear(uint32_t usart_periph, usart_flag_enum flag);
/* interrupt functions */
/* enable USART interrupt */
void usart_interrupt_enable(uint32_t usart_periph, uint32_t int_flag);
void usart_interrupt_enable(uint32_t usart_periph, uint32_t interrupt);
/* disable USART interrupt */
void usart_interrupt_disable(uint32_t usart_periph, uint32_t int_flag);
void usart_interrupt_disable(uint32_t usart_periph, uint32_t interrupt);
/* get USART interrupt and flag status */
FlagStatus usart_interrupt_flag_get(uint32_t usart_periph, uint32_t int_flag);
/* clear interrupt flag in STAT register */
void usart_interrupt_flag_clear(uint32_t usart_periph, uint32_t flag);
int usart_write(uint32_t usart_periph, int ch);
uint8_t usart_read(uint32_t usart_periph);
#ifdef _cplusplus
}
#endif
void usart_interrupt_flag_clear(uint32_t usart_periph, uint32_t int_flag);
#endif /* GD32VF103_USART_H */

View File

@@ -1,12 +1,13 @@
/*!
\file gd32vf103_wwdgt.h
\brief definitions for the WWDGT
\file gd32vf103_wwdgt.h
\brief definitions for the WWDGT
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -36,8 +37,6 @@ OF SUCH DAMAGE.
#define GD32VF103_WWDGT_H
#include "gd32vf103.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_rcu.h"
/* WWDGT definitions */
#define WWDGT WWDGT_BASE /*!< WWDGT base address */

View File

@@ -0,0 +1,77 @@
/* See LICENSE file for licence details */
#ifndef N200_FUNC_H
#define N200_FUNC_H
#include <stddef.h>
#define ECLIC_GROUP_LEVEL0_PRIO4 0
#define ECLIC_GROUP_LEVEL1_PRIO3 1
#define ECLIC_GROUP_LEVEL2_PRIO2 2
#define ECLIC_GROUP_LEVEL3_PRIO1 3
#define ECLIC_GROUP_LEVEL4_PRIO0 4
void pmp_open_all_space(void);
void switch_m2u_mode(void);
uint32_t get_mtime_freq(void);
uint32_t mtime_lo(void);
uint32_t mtime_hi(void);
uint64_t get_mtime_value(void);
uint64_t get_instret_value(void);
uint64_t get_cycle_value(void);
uint32_t __attribute__((noinline)) measure_cpu_freq(size_t n);
/* ECLIC relevant functions */
void eclic_init(uint32_t num_irq);
uint64_t get_timer_value(void);
void eclic_enable_interrupt(uint32_t source);
void eclic_disable_interrupt(uint32_t source);
void eclic_set_pending(uint32_t source);
void eclic_clear_pending(uint32_t source);
void eclic_set_intctrl(uint32_t source, uint8_t intctrl);
uint8_t eclic_get_intctrl(uint32_t source);
void eclic_set_intattr(uint32_t source, uint8_t intattr);
uint8_t eclic_get_intattr(uint32_t source);
void eclic_set_cliccfg(uint8_t cliccfg);
uint8_t eclic_get_cliccfg(void);
void eclic_set_mth(uint8_t mth);
uint8_t eclic_get_mth(void);
/* sets nlbits */
void eclic_set_nlbits(uint8_t nlbits);
/* get nlbits */
uint8_t eclic_get_nlbits(void);
void eclic_set_irq_lvl(uint32_t source, uint8_t lvl);
uint8_t eclic_get_irq_lvl(uint32_t source);
void eclic_set_irq_lvl_abs(uint32_t source, uint8_t lvl_abs);
uint8_t eclic_get_irq_lvl_abs(uint32_t source);
uint8_t eclic_set_irq_priority(uint32_t source, uint8_t priority);
uint8_t eclic_get_irq_priority(uint32_t source);
void eclic_mode_enable(void);
void eclic_set_vmode(uint32_t source);
void eclic_set_nonvmode(uint32_t source);
void eclic_set_level_trig(uint32_t source);
void eclic_set_posedge_trig(uint32_t source);
void eclic_set_negedge_trig(uint32_t source);
#endif

View File

@@ -2,11 +2,12 @@
\file gd32vf103_bkp.c
\brief BKP driver
\version 2019-6-5, V1.0.0, firmware for GD32VF103
\version 2019-06-05, V1.0.0, firmware for GD32VF103
\version 2020-08-04, V1.1.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -33,6 +34,7 @@ OF SUCH DAMAGE.
*/
#include "gd32vf103_bkp.h"
#include "gd32vf103_rcu.h"
/* BKP register bits offset */
#define BKP_TAMPER_BITS_OFFSET ((uint32_t)8U)
@@ -43,10 +45,7 @@ OF SUCH DAMAGE.
\param[out] none
\retval none
*/
void bkp_deinit(void) {
/* reset BKP domain register*/
rcu_bkp_reset_enable();
rcu_bkp_reset_disable();
void bkp_deinit(void) { /* reset BKP domain register*/
}
/*!
@@ -60,9 +59,9 @@ void bkp_deinit(void) {
*/
void bkp_data_write(bkp_data_register_enum register_number, uint16_t data) {
if ((register_number >= BKP_DATA_10) && (register_number <= BKP_DATA_41)) {
BKP_DATA10_41(register_number - 1U) = data;
BKP_DATA10_41((uint32_t)register_number - 1U) = data;
} else if ((register_number >= BKP_DATA_0) && (register_number <= BKP_DATA_9)) {
BKP_DATA0_9(register_number - 1U) = data;
BKP_DATA0_9((uint32_t)register_number - 1U) = data;
} else {
/* illegal parameters */
}
@@ -81,9 +80,9 @@ uint16_t bkp_data_read(bkp_data_register_enum register_number) {
/* get the data from the BKP data register */
if ((register_number >= BKP_DATA_10) && (register_number <= BKP_DATA_41)) {
data = BKP_DATA10_41(register_number - 1U);
data = BKP_DATA10_41((uint32_t)register_number - 1U);
} else if ((register_number >= BKP_DATA_0) && (register_number <= BKP_DATA_9)) {
data = BKP_DATA0_9(register_number - 1U);
data = BKP_DATA0_9((uint32_t)register_number - 1U);
} else {
/* illegal parameters */
}
@@ -216,7 +215,7 @@ void bkp_interrupt_disable(void) { BKP_TPCS &= (uint16_t)~BKP_TPCS_TPIE; }
\retval FlagStatus: SET or RESET
*/
FlagStatus bkp_flag_get(void) {
if (RESET != (BKP_TPCS & BKP_FLAG_TAMPER)) {
if (BKP_TPCS & BKP_FLAG_TAMPER) {
return SET;
} else {
return RESET;
@@ -238,7 +237,7 @@ void bkp_flag_clear(void) { BKP_TPCS |= (uint16_t)(BKP_FLAG_TAMPER >> BKP_TAMPER
\retval FlagStatus: SET or RESET
*/
FlagStatus bkp_interrupt_flag_get(void) {
if (RESET != (BKP_TPCS & BKP_INT_FLAG_TAMPER)) {
if (BKP_TPCS & BKP_INT_FLAG_TAMPER) {
return SET;
} else {
return RESET;

View File

@@ -1,940 +0,0 @@
/*!
\file gd32vf103_can.c
\brief CAN driver
\version 2019-6-5, V1.0.0, firmware for GD32VF103
*/
/*
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#include "gd32vf103_can.h"
#define CAN_ERROR_HANDLE(s) \
do { \
} while (1)
/*!
\brief deinitialize CAN
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval none
*/
void can_deinit(uint32_t can_periph) {
if (CAN0 == can_periph) {
rcu_periph_reset_enable(RCU_CAN0RST);
rcu_periph_reset_disable(RCU_CAN0RST);
} else {
rcu_periph_reset_enable(RCU_CAN1RST);
rcu_periph_reset_disable(RCU_CAN1RST);
}
}
/*!
\brief initialize CAN parameter struct with a default value
\param[in] type: the type of CAN parameter struct
only one parameter can be selected which is shown as below:
\arg CAN_INIT_STRUCT: the CAN initial struct
\arg CAN_FILTER_STRUCT: the CAN filter struct
\arg CAN_TX_MESSAGE_STRUCT: the CAN TX message struct
\arg CAN_RX_MESSAGE_STRUCT: the CAN RX message struct
\param[in] p_struct: the pointer of the specific struct
\param[out] none
\retval none
*/
void can_struct_para_init(can_struct_type_enum type, void *p_struct) {
uint8_t i;
/* get type of the struct */
switch (type) {
/* used for can_init() */
case CAN_INIT_STRUCT:
((can_parameter_struct *)p_struct)->auto_bus_off_recovery = DISABLE;
((can_parameter_struct *)p_struct)->no_auto_retrans = DISABLE;
((can_parameter_struct *)p_struct)->auto_wake_up = DISABLE;
((can_parameter_struct *)p_struct)->prescaler = 0x03FFU;
((can_parameter_struct *)p_struct)->rec_fifo_overwrite = DISABLE;
((can_parameter_struct *)p_struct)->resync_jump_width = CAN_BT_SJW_1TQ;
((can_parameter_struct *)p_struct)->time_segment_1 = CAN_BT_BS1_3TQ;
((can_parameter_struct *)p_struct)->time_segment_2 = CAN_BT_BS2_1TQ;
((can_parameter_struct *)p_struct)->time_triggered = DISABLE;
((can_parameter_struct *)p_struct)->trans_fifo_order = DISABLE;
((can_parameter_struct *)p_struct)->working_mode = CAN_NORMAL_MODE;
break;
/* used for can_filter_init() */
case CAN_FILTER_STRUCT:
((can_filter_parameter_struct *)p_struct)->filter_bits = CAN_FILTERBITS_32BIT;
((can_filter_parameter_struct *)p_struct)->filter_enable = DISABLE;
((can_filter_parameter_struct *)p_struct)->filter_fifo_number = CAN_FIFO0;
((can_filter_parameter_struct *)p_struct)->filter_list_high = 0x0000U;
((can_filter_parameter_struct *)p_struct)->filter_list_low = 0x0000U;
((can_filter_parameter_struct *)p_struct)->filter_mask_high = 0x0000U;
((can_filter_parameter_struct *)p_struct)->filter_mask_low = 0x0000U;
((can_filter_parameter_struct *)p_struct)->filter_mode = CAN_FILTERMODE_MASK;
((can_filter_parameter_struct *)p_struct)->filter_number = 0U;
break;
/* used for can_message_transmit() */
case CAN_TX_MESSAGE_STRUCT:
for (i = 0U; i < 8U; i++) {
((can_trasnmit_message_struct *)p_struct)->tx_data[i] = 0U;
}
((can_trasnmit_message_struct *)p_struct)->tx_dlen = 0u;
((can_trasnmit_message_struct *)p_struct)->tx_efid = 0U;
((can_trasnmit_message_struct *)p_struct)->tx_ff = (uint8_t)CAN_FF_STANDARD;
((can_trasnmit_message_struct *)p_struct)->tx_ft = (uint8_t)CAN_FT_DATA;
((can_trasnmit_message_struct *)p_struct)->tx_sfid = 0U;
break;
/* used for can_message_receive() */
case CAN_RX_MESSAGE_STRUCT:
for (i = 0U; i < 8U; i++) {
((can_receive_message_struct *)p_struct)->rx_data[i] = 0U;
}
((can_receive_message_struct *)p_struct)->rx_dlen = 0U;
((can_receive_message_struct *)p_struct)->rx_efid = 0U;
((can_receive_message_struct *)p_struct)->rx_ff = (uint8_t)CAN_FF_STANDARD;
((can_receive_message_struct *)p_struct)->rx_fi = 0U;
((can_receive_message_struct *)p_struct)->rx_ft = (uint8_t)CAN_FT_DATA;
((can_receive_message_struct *)p_struct)->rx_sfid = 0U;
break;
default:
CAN_ERROR_HANDLE("parameter is invalid \r\n");
}
}
/*!
\brief initialize CAN
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] can_parameter_init: parameters for CAN initializtion
\arg working_mode: CAN_NORMAL_MODE, CAN_LOOPBACK_MODE, CAN_SILENT_MODE, CAN_SILENT_LOOPBACK_MODE
\arg resync_jump_width: CAN_BT_SJW_xTQ(x=1, 2, 3, 4)
\arg time_segment_1: CAN_BT_BS1_xTQ(1..16)
\arg time_segment_2: CAN_BT_BS2_xTQ(1..8)
\arg time_triggered: ENABLE or DISABLE
\arg auto_bus_off_recovery: ENABLE or DISABLE
\arg auto_wake_up: ENABLE or DISABLE
\arg no_auto_retrans: ENABLE or DISABLE
\arg rec_fifo_overwrite: ENABLE or DISABLE
\arg trans_fifo_order: ENABLE or DISABLE
\arg prescaler: 0x0000 - 0x03FF
\param[out] none
\retval ErrStatus: SUCCESS or ERROR
*/
ErrStatus can_init(uint32_t can_periph, can_parameter_struct *can_parameter_init) {
uint32_t timeout = CAN_TIMEOUT;
ErrStatus flag = ERROR;
/* disable sleep mode */
CAN_CTL(can_periph) &= ~CAN_CTL_SLPWMOD;
/* enable initialize mode */
CAN_CTL(can_periph) |= CAN_CTL_IWMOD;
/* wait ACK */
while ((CAN_STAT_IWS != (CAN_STAT(can_periph) & CAN_STAT_IWS)) && (0U != timeout)) {
timeout--;
}
/* check initialize working success */
if (CAN_STAT_IWS != (CAN_STAT(can_periph) & CAN_STAT_IWS)) {
flag = ERROR;
} else {
/* set the bit timing register */
CAN_BT(can_periph) = (BT_MODE((uint32_t)can_parameter_init->working_mode) | BT_SJW((uint32_t)can_parameter_init->resync_jump_width) | BT_BS1((uint32_t)can_parameter_init->time_segment_1)
| BT_BS2((uint32_t)can_parameter_init->time_segment_2) | BT_BAUDPSC(((uint32_t)(can_parameter_init->prescaler) - 1U)));
/* time trigger communication mode */
if (ENABLE == can_parameter_init->time_triggered) {
CAN_CTL(can_periph) |= CAN_CTL_TTC;
} else {
CAN_CTL(can_periph) &= ~CAN_CTL_TTC;
}
/* automatic bus-off managment */
if (ENABLE == can_parameter_init->auto_bus_off_recovery) {
CAN_CTL(can_periph) |= CAN_CTL_ABOR;
} else {
CAN_CTL(can_periph) &= ~CAN_CTL_ABOR;
}
/* automatic wakeup mode */
if (ENABLE == can_parameter_init->auto_wake_up) {
CAN_CTL(can_periph) |= CAN_CTL_AWU;
} else {
CAN_CTL(can_periph) &= ~CAN_CTL_AWU;
}
/* automatic retransmission mode disable*/
if (ENABLE == can_parameter_init->no_auto_retrans) {
CAN_CTL(can_periph) |= CAN_CTL_ARD;
} else {
CAN_CTL(can_periph) &= ~CAN_CTL_ARD;
}
/* receive fifo overwrite mode */
if (ENABLE == can_parameter_init->rec_fifo_overwrite) {
CAN_CTL(can_periph) |= CAN_CTL_RFOD;
} else {
CAN_CTL(can_periph) &= ~CAN_CTL_RFOD;
}
/* transmit fifo order */
if (ENABLE == can_parameter_init->trans_fifo_order) {
CAN_CTL(can_periph) |= CAN_CTL_TFO;
} else {
CAN_CTL(can_periph) &= ~CAN_CTL_TFO;
}
/* disable initialize mode */
CAN_CTL(can_periph) &= ~CAN_CTL_IWMOD;
timeout = CAN_TIMEOUT;
/* wait the ACK */
while ((CAN_STAT_IWS == (CAN_STAT(can_periph) & CAN_STAT_IWS)) && (0U != timeout)) {
timeout--;
}
/* check exit initialize mode */
if (0U != timeout) {
flag = SUCCESS;
}
}
CAN_TMI0(can_periph) = 0x0;
CAN_TMI1(can_periph) = 0x0;
CAN_TMI2(can_periph) = 0x0;
CAN_TMP0(can_periph) = 0x0;
CAN_TMP1(can_periph) = 0x0;
CAN_TMP2(can_periph) = 0x0;
CAN_TMDATA00(can_periph) = 0x0;
CAN_TMDATA01(can_periph) = 0x0;
CAN_TMDATA02(can_periph) = 0x0;
CAN_TMDATA10(can_periph) = 0x0;
CAN_TMDATA11(can_periph) = 0x0;
CAN_TMDATA12(can_periph) = 0x0;
return flag;
}
/*!
\brief initialize CAN filter
\param[in] can_filter_parameter_init: struct for CAN filter initialization
\arg filter_list_high: 0x0000 - 0xFFFF
\arg filter_list_low: 0x0000 - 0xFFFF
\arg filter_mask_high: 0x0000 - 0xFFFF
\arg filter_mask_low: 0x0000 - 0xFFFF
\arg filter_fifo_number: CAN_FIFO0, CAN_FIFO1
\arg filter_number: 0 - 27
\arg filter_mode: CAN_FILTERMODE_MASK, CAN_FILTERMODE_LIST
\arg filter_bits: CAN_FILTERBITS_32BIT, CAN_FILTERBITS_16BIT
\arg filter_enable: ENABLE or DISABLE
\param[out] none
\retval none
*/
void can_filter_init(can_filter_parameter_struct *can_filter_parameter_init) {
uint32_t val = 0U;
val = ((uint32_t)1) << (can_filter_parameter_init->filter_number);
/* filter lock disable */
CAN_FCTL(CAN0) |= CAN_FCTL_FLD;
/* disable filter */
CAN_FW(CAN0) &= ~(uint32_t)val;
/* filter 16 bits */
if (CAN_FILTERBITS_16BIT == can_filter_parameter_init->filter_bits) {
/* set filter 16 bits */
CAN_FSCFG(CAN0) &= ~(uint32_t)val;
/* first 16 bits list and first 16 bits mask or first 16 bits list and second 16 bits list */
CAN_FDATA0(CAN0, can_filter_parameter_init->filter_number)
= FDATA_MASK_HIGH((can_filter_parameter_init->filter_mask_low) & CAN_FILTER_MASK_16BITS) | FDATA_MASK_LOW((can_filter_parameter_init->filter_list_low) & CAN_FILTER_MASK_16BITS);
/* second 16 bits list and second 16 bits mask or third 16 bits list and fourth 16 bits list */
CAN_FDATA1(CAN0, can_filter_parameter_init->filter_number)
= FDATA_MASK_HIGH((can_filter_parameter_init->filter_mask_high) & CAN_FILTER_MASK_16BITS) | FDATA_MASK_LOW((can_filter_parameter_init->filter_list_high) & CAN_FILTER_MASK_16BITS);
}
/* filter 32 bits */
if (CAN_FILTERBITS_32BIT == can_filter_parameter_init->filter_bits) {
/* set filter 32 bits */
CAN_FSCFG(CAN0) |= (uint32_t)val;
/* 32 bits list or first 32 bits list */
CAN_FDATA0(CAN0, can_filter_parameter_init->filter_number)
= FDATA_MASK_HIGH((can_filter_parameter_init->filter_list_high) & CAN_FILTER_MASK_16BITS) | FDATA_MASK_LOW((can_filter_parameter_init->filter_list_low) & CAN_FILTER_MASK_16BITS);
/* 32 bits mask or second 32 bits list */
CAN_FDATA1(CAN0, can_filter_parameter_init->filter_number)
= FDATA_MASK_HIGH((can_filter_parameter_init->filter_mask_high) & CAN_FILTER_MASK_16BITS) | FDATA_MASK_LOW((can_filter_parameter_init->filter_mask_low) & CAN_FILTER_MASK_16BITS);
}
/* filter mode */
if (CAN_FILTERMODE_MASK == can_filter_parameter_init->filter_mode) {
/* mask mode */
CAN_FMCFG(CAN0) &= ~(uint32_t)val;
} else {
/* list mode */
CAN_FMCFG(CAN0) |= (uint32_t)val;
}
/* filter FIFO */
if (CAN_FIFO0 == (can_filter_parameter_init->filter_fifo_number)) {
/* FIFO0 */
CAN_FAFIFO(CAN0) &= ~(uint32_t)val;
} else {
/* FIFO1 */
CAN_FAFIFO(CAN0) |= (uint32_t)val;
}
/* filter working */
if (ENABLE == can_filter_parameter_init->filter_enable) {
CAN_FW(CAN0) |= (uint32_t)val;
}
/* filter lock enable */
CAN_FCTL(CAN0) &= ~CAN_FCTL_FLD;
}
/*!
\brief set CAN1 fliter start bank number
\param[in] start_bank: CAN1 start bank number
only one parameter can be selected which is shown as below:
\arg (1..27)
\param[out] none
\retval none
*/
void can1_filter_start_bank(uint8_t start_bank) {
/* filter lock disable */
CAN_FCTL(CAN0) |= CAN_FCTL_FLD;
/* set CAN1 filter start number */
CAN_FCTL(CAN0) &= ~(uint32_t)CAN_FCTL_HBC1F;
CAN_FCTL(CAN0) |= FCTL_HBC1F(start_bank);
/* filter lock enaable */
CAN_FCTL(CAN0) &= ~CAN_FCTL_FLD;
}
/*!
\brief enable CAN debug freeze
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval none
*/
void can_debug_freeze_enable(uint32_t can_periph) {
/* set DFZ bit */
CAN_CTL(can_periph) |= CAN_CTL_DFZ;
if (CAN0 == can_periph) {
dbg_periph_enable(DBG_CAN0_HOLD);
} else {
dbg_periph_enable(DBG_CAN1_HOLD);
}
}
/*!
\brief disable CAN debug freeze
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval none
*/
void can_debug_freeze_disable(uint32_t can_periph) {
/* set DFZ bit */
CAN_CTL(can_periph) &= ~CAN_CTL_DFZ;
if (CAN0 == can_periph) {
dbg_periph_disable(DBG_CAN0_HOLD);
} else {
dbg_periph_disable(DBG_CAN1_HOLD);
}
}
/*!
\brief enable CAN time trigger mode
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval none
*/
void can_time_trigger_mode_enable(uint32_t can_periph) {
uint8_t mailbox_number;
/* enable the tcc mode */
CAN_CTL(can_periph) |= CAN_CTL_TTC;
/* enable time stamp */
for (mailbox_number = 0U; mailbox_number < 3U; mailbox_number++) {
CAN_TMP(can_periph, mailbox_number) |= CAN_TMP_TSEN;
}
}
/*!
\brief disable CAN time trigger mode
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval none
*/
void can_time_trigger_mode_disable(uint32_t can_periph) {
uint8_t mailbox_number;
/* disable the TCC mode */
CAN_CTL(can_periph) &= ~CAN_CTL_TTC;
/* reset TSEN bits */
for (mailbox_number = 0U; mailbox_number < 3U; mailbox_number++) {
CAN_TMP(can_periph, mailbox_number) &= ~CAN_TMP_TSEN;
}
}
/*!
\brief transmit CAN message
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] transmit_message: struct for CAN transmit message
\arg tx_sfid: 0x00000000 - 0x000007FF
\arg tx_efid: 0x00000000 - 0x1FFFFFFF
\arg tx_ff: CAN_FF_STANDARD, CAN_FF_EXTENDED
\arg tx_ft: CAN_FT_DATA, CAN_FT_REMOTE
\arg tx_dlenc: 1 - 7
\arg tx_data[]: 0x00 - 0xFF
\param[out] none
\retval mailbox_number
*/
uint8_t can_message_transmit(uint32_t can_periph, can_trasnmit_message_struct *transmit_message) {
uint8_t mailbox_number = CAN_MAILBOX0;
/* select one empty mailbox */
if (CAN_TSTAT_TME0 == (CAN_TSTAT(can_periph) & CAN_TSTAT_TME0)) {
mailbox_number = CAN_MAILBOX0;
} else if (CAN_TSTAT_TME1 == (CAN_TSTAT(can_periph) & CAN_TSTAT_TME1)) {
mailbox_number = CAN_MAILBOX1;
} else if (CAN_TSTAT_TME2 == (CAN_TSTAT(can_periph) & CAN_TSTAT_TME2)) {
mailbox_number = CAN_MAILBOX2;
} else {
mailbox_number = CAN_NOMAILBOX;
}
/* return no mailbox empty */
if (CAN_NOMAILBOX == mailbox_number) {
return CAN_NOMAILBOX;
}
CAN_TMI(can_periph, mailbox_number) &= CAN_TMI_TEN;
if (CAN_FF_STANDARD == transmit_message->tx_ff) {
/* set transmit mailbox standard identifier */
CAN_TMI(can_periph, mailbox_number) |= (uint32_t)(TMI_SFID(transmit_message->tx_sfid) | transmit_message->tx_ft);
} else {
/* set transmit mailbox extended identifier */
CAN_TMI(can_periph, mailbox_number) |= (uint32_t)(TMI_EFID(transmit_message->tx_efid) | transmit_message->tx_ff | transmit_message->tx_ft);
}
/* set the data length */
CAN_TMP(can_periph, mailbox_number) &= ~CAN_TMP_DLENC;
CAN_TMP(can_periph, mailbox_number) |= transmit_message->tx_dlen;
/* set the data */
CAN_TMDATA0(can_periph, mailbox_number)
= TMDATA0_DB3(transmit_message->tx_data[3]) | TMDATA0_DB2(transmit_message->tx_data[2]) | TMDATA0_DB1(transmit_message->tx_data[1]) | TMDATA0_DB0(transmit_message->tx_data[0]);
CAN_TMDATA1(can_periph, mailbox_number)
= TMDATA1_DB7(transmit_message->tx_data[7]) | TMDATA1_DB6(transmit_message->tx_data[6]) | TMDATA1_DB5(transmit_message->tx_data[5]) | TMDATA1_DB4(transmit_message->tx_data[4]);
/* enable transmission */
CAN_TMI(can_periph, mailbox_number) |= CAN_TMI_TEN;
return mailbox_number;
}
/*!
\brief get CAN transmit state
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] mailbox_number
only one parameter can be selected which is shown as below:
\arg CAN_MAILBOX(x=0,1,2)
\param[out] none
\retval can_transmit_state_enum
*/
can_transmit_state_enum can_transmit_states(uint32_t can_periph, uint8_t mailbox_number) {
can_transmit_state_enum state = CAN_TRANSMIT_FAILED;
uint32_t val = 0U;
/* check selected mailbox state */
switch (mailbox_number) {
/* mailbox0 */
case CAN_MAILBOX0:
val = CAN_TSTAT(can_periph) & (CAN_TSTAT_MTF0 | CAN_TSTAT_MTFNERR0 | CAN_TSTAT_TME0);
break;
/* mailbox1 */
case CAN_MAILBOX1:
val = CAN_TSTAT(can_periph) & (CAN_TSTAT_MTF1 | CAN_TSTAT_MTFNERR1 | CAN_TSTAT_TME1);
break;
/* mailbox2 */
case CAN_MAILBOX2:
val = CAN_TSTAT(can_periph) & (CAN_TSTAT_MTF2 | CAN_TSTAT_MTFNERR2 | CAN_TSTAT_TME2);
break;
default:
val = CAN_TRANSMIT_FAILED;
break;
}
switch (val) {
/* transmit pending */
case (CAN_STATE_PENDING):
state = CAN_TRANSMIT_PENDING;
break;
/* mailbox0 transmit succeeded */
case (CAN_TSTAT_MTF0 | CAN_TSTAT_MTFNERR0 | CAN_TSTAT_TME0):
state = CAN_TRANSMIT_OK;
break;
/* mailbox1 transmit succeeded */
case (CAN_TSTAT_MTF1 | CAN_TSTAT_MTFNERR1 | CAN_TSTAT_TME1):
state = CAN_TRANSMIT_OK;
break;
/* mailbox2 transmit succeeded */
case (CAN_TSTAT_MTF2 | CAN_TSTAT_MTFNERR2 | CAN_TSTAT_TME2):
state = CAN_TRANSMIT_OK;
break;
/* transmit failed */
default:
state = CAN_TRANSMIT_FAILED;
break;
}
return state;
}
/*!
\brief stop CAN transmission
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] mailbox_number
only one parameter can be selected which is shown as below:
\arg CAN_MAILBOXx(x=0,1,2)
\param[out] none
\retval none
*/
void can_transmission_stop(uint32_t can_periph, uint8_t mailbox_number) {
if (CAN_MAILBOX0 == mailbox_number) {
CAN_TSTAT(can_periph) |= CAN_TSTAT_MST0;
while (CAN_TSTAT_MST0 == (CAN_TSTAT(can_periph) & CAN_TSTAT_MST0)) {}
} else if (CAN_MAILBOX1 == mailbox_number) {
CAN_TSTAT(can_periph) |= CAN_TSTAT_MST1;
while (CAN_TSTAT_MST1 == (CAN_TSTAT(can_periph) & CAN_TSTAT_MST1)) {}
} else if (CAN_MAILBOX2 == mailbox_number) {
CAN_TSTAT(can_periph) |= CAN_TSTAT_MST2;
while (CAN_TSTAT_MST2 == (CAN_TSTAT(can_periph) & CAN_TSTAT_MST2)) {}
} else {
/* illegal parameters */
}
}
/*!
\brief CAN receive message
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] fifo_number
\arg CAN_FIFOx(x=0,1)
\param[out] receive_message: struct for CAN receive message
\arg rx_sfid: 0x00000000 - 0x000007FF
\arg rx_efid: 0x00000000 - 0x1FFFFFFF
\arg rx_ff: CAN_FF_STANDARD, CAN_FF_EXTENDED
\arg rx_ft: CAN_FT_DATA, CAN_FT_REMOTE
\arg rx_dlenc: 1 - 7
\arg rx_data[]: 0x00 - 0xFF
\arg rx_fi: 0 - 27
\retval none
*/
void can_message_receive(uint32_t can_periph, uint8_t fifo_number, can_receive_message_struct *receive_message) {
/* get the frame format */
receive_message->rx_ff = (uint8_t)(CAN_RFIFOMI_FF & CAN_RFIFOMI(can_periph, fifo_number));
if (CAN_FF_STANDARD == receive_message->rx_ff) {
/* get standard identifier */
receive_message->rx_sfid = (uint32_t)(GET_RFIFOMI_SFID(CAN_RFIFOMI(can_periph, fifo_number)));
} else {
/* get extended identifier */
receive_message->rx_efid = (uint32_t)(GET_RFIFOMI_EFID(CAN_RFIFOMI(can_periph, fifo_number)));
}
/* get frame type */
receive_message->rx_ft = (uint8_t)(CAN_RFIFOMI_FT & CAN_RFIFOMI(can_periph, fifo_number));
/* filtering index */
receive_message->rx_fi = (uint8_t)(GET_RFIFOMP_FI(CAN_RFIFOMP(can_periph, fifo_number)));
/* get recevie data length */
receive_message->rx_dlen = (uint8_t)(GET_RFIFOMP_DLENC(CAN_RFIFOMP(can_periph, fifo_number)));
/* receive data */
receive_message->rx_data[0] = (uint8_t)(GET_RFIFOMDATA0_DB0(CAN_RFIFOMDATA0(can_periph, fifo_number)));
receive_message->rx_data[1] = (uint8_t)(GET_RFIFOMDATA0_DB1(CAN_RFIFOMDATA0(can_periph, fifo_number)));
receive_message->rx_data[2] = (uint8_t)(GET_RFIFOMDATA0_DB2(CAN_RFIFOMDATA0(can_periph, fifo_number)));
receive_message->rx_data[3] = (uint8_t)(GET_RFIFOMDATA0_DB3(CAN_RFIFOMDATA0(can_periph, fifo_number)));
receive_message->rx_data[4] = (uint8_t)(GET_RFIFOMDATA1_DB4(CAN_RFIFOMDATA1(can_periph, fifo_number)));
receive_message->rx_data[5] = (uint8_t)(GET_RFIFOMDATA1_DB5(CAN_RFIFOMDATA1(can_periph, fifo_number)));
receive_message->rx_data[6] = (uint8_t)(GET_RFIFOMDATA1_DB6(CAN_RFIFOMDATA1(can_periph, fifo_number)));
receive_message->rx_data[7] = (uint8_t)(GET_RFIFOMDATA1_DB7(CAN_RFIFOMDATA1(can_periph, fifo_number)));
/* release FIFO */
if (CAN_FIFO0 == fifo_number) {
CAN_RFIFO0(can_periph) |= CAN_RFIFO0_RFD0;
} else {
CAN_RFIFO1(can_periph) |= CAN_RFIFO1_RFD1;
}
}
/*!
\brief release FIFO0
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] fifo_number
only one parameter can be selected which is shown as below:
\arg CAN_FIFOx(x=0,1)
\param[out] none
\retval none
*/
void can_fifo_release(uint32_t can_periph, uint8_t fifo_number) {
if (CAN_FIFO0 == fifo_number) {
CAN_RFIFO0(can_periph) |= CAN_RFIFO0_RFD0;
} else if (CAN_FIFO1 == fifo_number) {
CAN_RFIFO1(can_periph) |= CAN_RFIFO1_RFD1;
} else {
/* illegal parameters */
CAN_ERROR_HANDLE("CAN FIFO NUM is invalid \r\n");
}
}
/*!
\brief CAN receive message length
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] fifo_number
only one parameter can be selected which is shown as below:
\arg CAN_FIFOx(x=0,1)
\param[out] none
\retval message length
*/
uint8_t can_receive_message_length_get(uint32_t can_periph, uint8_t fifo_number) {
uint8_t val = 0U;
if (CAN_FIFO0 == fifo_number) {
/* FIFO0 */
val = (uint8_t)(CAN_RFIFO0(can_periph) & CAN_RFIF_RFL_MASK);
} else if (CAN_FIFO1 == fifo_number) {
/* FIFO1 */
val = (uint8_t)(CAN_RFIFO1(can_periph) & CAN_RFIF_RFL_MASK);
} else {
/* illegal parameters */
}
return val;
}
/*!
\brief set CAN working mode
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] can_working_mode
only one parameter can be selected which is shown as below:
\arg CAN_MODE_INITIALIZE
\arg CAN_MODE_NORMAL
\arg CAN_MODE_SLEEP
\param[out] none
\retval ErrStatus: SUCCESS or ERROR
*/
ErrStatus can_working_mode_set(uint32_t can_periph, uint8_t working_mode) {
ErrStatus flag = ERROR;
/* timeout for IWS or also for SLPWS bits */
uint32_t timeout = CAN_TIMEOUT;
if (CAN_MODE_INITIALIZE == working_mode) {
/* disable sleep mode */
CAN_CTL(can_periph) &= (~(uint32_t)CAN_CTL_SLPWMOD);
/* set initialize mode */
CAN_CTL(can_periph) |= (uint8_t)CAN_CTL_IWMOD;
/* wait the acknowledge */
while ((CAN_STAT_IWS != (CAN_STAT(can_periph) & CAN_STAT_IWS)) && (0U != timeout)) {
timeout--;
}
if (CAN_STAT_IWS != (CAN_STAT(can_periph) & CAN_STAT_IWS)) {
flag = ERROR;
} else {
flag = SUCCESS;
}
} else if (CAN_MODE_NORMAL == working_mode) {
/* enter normal mode */
CAN_CTL(can_periph) &= ~(uint32_t)(CAN_CTL_SLPWMOD | CAN_CTL_IWMOD);
/* wait the acknowledge */
while ((0U != (CAN_STAT(can_periph) & (CAN_STAT_IWS | CAN_STAT_SLPWS))) && (0U != timeout)) {
timeout--;
}
if (0U != (CAN_STAT(can_periph) & (CAN_STAT_IWS | CAN_STAT_SLPWS))) {
flag = ERROR;
} else {
flag = SUCCESS;
}
} else if (CAN_MODE_SLEEP == working_mode) {
/* disable initialize mode */
CAN_CTL(can_periph) &= (~(uint32_t)CAN_CTL_IWMOD);
/* set sleep mode */
CAN_CTL(can_periph) |= (uint8_t)CAN_CTL_SLPWMOD;
/* wait the acknowledge */
while ((CAN_STAT_SLPWS != (CAN_STAT(can_periph) & CAN_STAT_SLPWS)) && (0U != timeout)) {
timeout--;
}
if (CAN_STAT_SLPWS != (CAN_STAT(can_periph) & CAN_STAT_SLPWS)) {
flag = ERROR;
} else {
flag = SUCCESS;
}
} else {
flag = ERROR;
}
return flag;
}
/*!
\brief wake up CAN
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval ErrStatus: SUCCESS or ERROR
*/
ErrStatus can_wakeup(uint32_t can_periph) {
ErrStatus flag = ERROR;
uint32_t timeout = CAN_TIMEOUT;
/* wakeup */
CAN_CTL(can_periph) &= ~CAN_CTL_SLPWMOD;
while ((0U != (CAN_STAT(can_periph) & CAN_STAT_SLPWS)) && (0x00U != timeout)) {
timeout--;
}
/* check state */
if (0U != (CAN_STAT(can_periph) & CAN_STAT_SLPWS)) {
flag = ERROR;
} else {
flag = SUCCESS;
}
return flag;
}
/*!
\brief get CAN error type
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval can_error_enum
\arg CAN_ERROR_NONE: no error
\arg CAN_ERROR_FILL: fill error
\arg CAN_ERROR_FORMATE: format error
\arg CAN_ERROR_ACK: ACK error
\arg CAN_ERROR_BITRECESSIVE: bit recessive
\arg CAN_ERROR_BITDOMINANTER: bit dominant error
\arg CAN_ERROR_CRC: CRC error
\arg CAN_ERROR_SOFTWARECFG: software configure
*/
can_error_enum can_error_get(uint32_t can_periph) {
can_error_enum error;
error = CAN_ERROR_NONE;
/* get error type */
error = (can_error_enum)(GET_ERR_ERRN(CAN_ERR(can_periph)));
return error;
}
/*!
\brief get CAN receive error number
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval error number
*/
uint8_t can_receive_error_number_get(uint32_t can_periph) {
uint8_t val;
/* get error count */
val = (uint8_t)(GET_ERR_RECNT(CAN_ERR(can_periph)));
return val;
}
/*!
\brief get CAN transmit error number
\param[in] can_periph
\arg CANx(x=0,1)
\param[out] none
\retval error number
*/
uint8_t can_transmit_error_number_get(uint32_t can_periph) {
uint8_t val;
val = (uint8_t)(GET_ERR_TECNT(CAN_ERR(can_periph)));
return val;
}
/*!
\brief enable CAN interrupt
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] interrupt
one or more parameters can be selected which are shown as below:
\arg CAN_INT_TME: transmit mailbox empty interrupt enable
\arg CAN_INT_RFNE0: receive FIFO0 not empty interrupt enable
\arg CAN_INT_RFF0: receive FIFO0 full interrupt enable
\arg CAN_INT_RFO0: receive FIFO0 overfull interrupt enable
\arg CAN_INT_RFNE1: receive FIFO1 not empty interrupt enable
\arg CAN_INT_RFF1: receive FIFO1 full interrupt enable
\arg CAN_INT_RFO1: receive FIFO1 overfull interrupt enable
\arg CAN_INT_WERR: warning error interrupt enable
\arg CAN_INT_PERR: passive error interrupt enable
\arg CAN_INT_BO: bus-off interrupt enable
\arg CAN_INT_ERRN: error number interrupt enable
\arg CAN_INT_ERR: error interrupt enable
\arg CAN_INT_WU: wakeup interrupt enable
\arg CAN_INT_SLPW: sleep working interrupt enable
\param[out] none
\retval none
*/
void can_interrupt_enable(uint32_t can_periph, uint32_t interrupt) { CAN_INTEN(can_periph) |= interrupt; }
/*!
\brief disable CAN interrupt
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] interrupt
one or more parameters can be selected which are shown as below:
\arg CAN_INT_TME: transmit mailbox empty interrupt enable
\arg CAN_INT_RFNE0: receive FIFO0 not empty interrupt enable
\arg CAN_INT_RFF0: receive FIFO0 full interrupt enable
\arg CAN_INT_RFO0: receive FIFO0 overfull interrupt enable
\arg CAN_INT_RFNE1: receive FIFO1 not empty interrupt enable
\arg CAN_INT_RFF1: receive FIFO1 full interrupt enable
\arg CAN_INT_RFO1: receive FIFO1 overfull interrupt enable
\arg CAN_INT_WERR: warning error interrupt enable
\arg CAN_INT_PERR: passive error interrupt enable
\arg CAN_INT_BO: bus-off interrupt enable
\arg CAN_INT_ERRN: error number interrupt enable
\arg CAN_INT_ERR: error interrupt enable
\arg CAN_INT_WU: wakeup interrupt enable
\arg CAN_INT_SLPW: sleep working interrupt enable
\param[out] none
\retval none
*/
void can_interrupt_disable(uint32_t can_periph, uint32_t interrupt) { CAN_INTEN(can_periph) &= ~interrupt; }
/*!
\brief get CAN flag state
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] flag: CAN flags, refer to can_flag_enum
only one parameter can be selected which is shown as below:
\arg CAN_FLAG_MTE2: mailbox 2 transmit error
\arg CAN_FLAG_MTE1: mailbox 1 transmit error
\arg CAN_FLAG_MTE0: mailbox 0 transmit error
\arg CAN_FLAG_MTF2: mailbox 2 transmit finished
\arg CAN_FLAG_MTF1: mailbox 1 transmit finished
\arg CAN_FLAG_MTF0: mailbox 0 transmit finished
\arg CAN_FLAG_RFO0: receive FIFO0 overfull
\arg CAN_FLAG_RFF0: receive FIFO0 full
\arg CAN_FLAG_RFO1: receive FIFO1 overfull
\arg CAN_FLAG_RFF1: receive FIFO1 full
\arg CAN_FLAG_BOERR: bus-off error
\arg CAN_FLAG_PERR: passive error
\arg CAN_FLAG_WERR: warning error
\param[out] none
\retval FlagStatus: SET or RESET
*/
FlagStatus can_flag_get(uint32_t can_periph, can_flag_enum flag) {
/* get flag and interrupt enable state */
if (RESET != (CAN_REG_VAL(can_periph, flag) & BIT(CAN_BIT_POS(flag)))) {
return SET;
} else {
return RESET;
}
}
/*!
\brief clear CAN flag state
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] flag: CAN flags, refer to can_flag_enum
only one parameter can be selected which is shown as below:
\arg CAN_FLAG_MTE2: mailbox 2 transmit error
\arg CAN_FLAG_MTE1: mailbox 1 transmit error
\arg CAN_FLAG_MTE0: mailbox 0 transmit error
\arg CAN_FLAG_MTF2: mailbox 2 transmit finished
\arg CAN_FLAG_MTF1: mailbox 1 transmit finished
\arg CAN_FLAG_MTF0: mailbox 0 transmit finished
\arg CAN_FLAG_RFO0: receive FIFO0 overfull
\arg CAN_FLAG_RFF0: receive FIFO0 full
\arg CAN_FLAG_RFO1: receive FIFO1 overfull
\arg CAN_FLAG_RFF1: receive FIFO1 full
\arg CAN_FLAG_BOERR: bus-off error
\arg CAN_FLAG_PERR: passive error
\arg CAN_FLAG_WERR: warning error
\param[out] none
\retval none
*/
void can_flag_clear(uint32_t can_periph, can_flag_enum flag) { CAN_REG_VAL(can_periph, flag) = BIT(CAN_BIT_POS(flag)); }
/*!
\brief get CAN interrupt flag state
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] flag: CAN interrupt flags, refer to can_interrupt_flag_enum
only one parameter can be selected which is shown as below:
\arg CAN_INT_FLAG_SLPIF: status change interrupt flag of sleep working mode entering
\arg CAN_INT_FLAG_WUIF: status change interrupt flag of wakeup from sleep working mode
\arg CAN_INT_FLAG_ERRIF: error interrupt flag
\arg CAN_INT_FLAG_MTF2: mailbox 2 transmit finished interrupt flag
\arg CAN_INT_FLAG_MTF1: mailbox 1 transmit finished interrupt flag
\arg CAN_INT_FLAG_MTF0: mailbox 0 transmit finished interrupt flag
\arg CAN_INT_FLAG_RFO0: receive FIFO0 overfull interrupt flag
\arg CAN_INT_FLAG_RFF0: receive FIFO0 full interrupt flag
\arg CAN_INT_FLAG_RFO1: receive FIFO1 overfull interrupt flag
\arg CAN_INT_FLAG_RFF1: receive FIFO1 full interrupt flag
\param[out] none
\retval FlagStatus: SET or RESET
*/
FlagStatus can_interrupt_flag_get(uint32_t can_periph, can_interrupt_flag_enum flag) {
uint32_t ret1 = RESET;
uint32_t ret2 = RESET;
/* get the staus of interrupt flag */
ret1 = CAN_REG_VALS(can_periph, flag) & BIT(CAN_BIT_POS0(flag));
/* get the staus of interrupt enale bit */
ret2 = CAN_INTEN(can_periph) & BIT(CAN_BIT_POS1(flag));
if (ret1 && ret2) {
return SET;
} else {
return RESET;
}
}
/*!
\brief clear CAN interrupt flag state
\param[in] can_periph
\arg CANx(x=0,1)
\param[in] flag: CAN interrupt flags, refer to can_interrupt_flag_enum
only one parameter can be selected which is shown as below:
\arg CAN_INT_FLAG_SLPIF: status change interrupt flag of sleep working mode entering
\arg CAN_INT_FLAG_WUIF: status change interrupt flag of wakeup from sleep working mode
\arg CAN_INT_FLAG_ERRIF: error interrupt flag
\arg CAN_INT_FLAG_MTF2: mailbox 2 transmit finished interrupt flag
\arg CAN_INT_FLAG_MTF1: mailbox 1 transmit finished interrupt flag
\arg CAN_INT_FLAG_MTF0: mailbox 0 transmit finished interrupt flag
\arg CAN_INT_FLAG_RFO0: receive FIFO0 overfull interrupt flag
\arg CAN_INT_FLAG_RFF0: receive FIFO0 full interrupt flag
\arg CAN_INT_FLAG_RFO1: receive FIFO1 overfull interrupt flag
\arg CAN_INT_FLAG_RFF1: receive FIFO1 full interrupt flag
\arg CAN_FLAG_BOERR: bus-off error
\arg CAN_FLAG_PERR: passive error
\arg CAN_FLAG_WERR: warning error
\param[out] none
\retval none
*/
void can_interrupt_flag_clear(uint32_t can_periph, can_interrupt_flag_enum flag) { CAN_REG_VALS(can_periph, flag) = BIT(CAN_BIT_POS0(flag)); }

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