diff --git a/test/LED/.clang-format b/test/LED/.clang-format new file mode 100644 index 0000000..ecc57c4 --- /dev/null +++ b/test/LED/.clang-format @@ -0,0 +1,38 @@ +--- +BasedOnStyle: Microsoft +Language: Cpp + +################################### +# indent conf +################################### + +UseTab: Never +IndentWidth: 4 +TabWidth: 4 +ColumnLimit: 0 +AccessModifierOffset: -4 +NamespaceIndentation: All +FixNamespaceComments: false +BreakBeforeBraces: Linux + +################################### +# other styles +################################### + +# +# for more conf, you can ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# + +AllowShortIfStatementsOnASingleLine: true + +AllowShortLoopsOnASingleLine: true + +AllowShortBlocksOnASingleLine: true + +IndentCaseLabels: true + +SortIncludes: false + +AlignConsecutiveMacros: AcrossEmptyLines + +AlignConsecutiveAssignments: Consecutive diff --git a/test/LED/.eide/eide.json b/test/LED/.eide/eide.json new file mode 100644 index 0000000..24d3b99 --- /dev/null +++ b/test/LED/.eide/eide.json @@ -0,0 +1,83 @@ +{ + "name": "LED", + "type": "C51", + "dependenceList": [], + "srcDirs": [], + "virtualFolder": { + "name": "", + "files": [ + { + "path": "src/main.c" + } + ], + "folders": [] + }, + "outDir": "build", + "deviceName": null, + "packDir": null, + "miscInfo": { + "uid": "bd391d467774c35a0de2b33748337588" + }, + "targets": { + "Debug": { + "excludeList": [], + "toolchain": "Keil_C51", + "compileConfig": { + "options": "null" + }, + "uploader": "Custom", + "uploadConfig": { + "bin": "", + "commandLine": "", + "eraseChipCommand": "" + }, + "uploadConfigMap": {}, + "custom_dep": { + "name": "default", + "incList": [], + "libList": [], + "defineList": [] + }, + "builderOptions": { + "SDCC": { + "version": 3, + "beforeBuildTasks": [], + "afterBuildTasks": [], + "global": { + "device": "mcs51", + "optimize-type": "speed", + "use-non-free": false + }, + "c/cpp-compiler": { + "language-c": "c99" + }, + "asm-compiler": {}, + "linker": { + "$mainFileName": "main", + "output-format": "hex" + } + }, + "Keil_C51": { + "version": 2, + "beforeBuildTasks": [], + "afterBuildTasks": [], + "global": { + "ram-mode": "SMALL", + "rom-mode": "LARGE" + }, + "c/cpp-compiler": { + "optimization-type": "SPEED", + "optimization-level": "level-8" + }, + "asm-compiler": {}, + "linker": { + "remove-unused": true, + "output-format": "elf", + "use-RTX": "None" + } + } + } + } + }, + "version": "3.5" +} \ No newline at end of file diff --git a/test/LED/.eide/files.options.yml b/test/LED/.eide/files.options.yml new file mode 100644 index 0000000..c258721 --- /dev/null +++ b/test/LED/.eide/files.options.yml @@ -0,0 +1,20 @@ +########################################################################################## +# Append Compiler Options For Source Files +########################################################################################## + +# syntax: +# : +# For get pattern syntax, please refer to: https://www.npmjs.com/package/micromatch +# +# examples: +# 'main.cpp': --cpp11 -Og ... +# 'src/*.c': -gnu -O2 ... +# 'src/lib/**/*.cpp': --cpp11 -Os ... +# '!Application/*.c': -O0 +# '**/*.c': -O2 -gnu ... + +version: "2.0" +options: + Debug: + files: {} + virtualPathFiles: {} diff --git a/test/LED/.gitignore b/test/LED/.gitignore new file mode 100644 index 0000000..c2f4ce9 --- /dev/null +++ b/test/LED/.gitignore @@ -0,0 +1,15 @@ +# dot files +/.vscode/launch.json +/.settings +/.eide/log +/.eide.usr.ctx.json + +# project out +/build +/bin +/obj +/out + +# eide template +*.ept +*.eide-template diff --git a/test/LED/.vscode/settings.json b/test/LED/.vscode/settings.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/test/LED/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/test/LED/.vscode/tasks.json b/test/LED/.vscode/tasks.json new file mode 100644 index 0000000..3e192b9 --- /dev/null +++ b/test/LED/.vscode/tasks.json @@ -0,0 +1,40 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "${command:eide.project.build}", + "group": "build", + "problemMatcher": [] + }, + { + "label": "flash", + "type": "shell", + "command": "${command:eide.project.uploadToDevice}", + "group": "build", + "problemMatcher": [] + }, + { + "label": "build and flash", + "type": "shell", + "command": "${command:eide.project.buildAndFlash}", + "group": "build", + "problemMatcher": [] + }, + { + "label": "rebuild", + "type": "shell", + "command": "${command:eide.project.rebuild}", + "group": "build", + "problemMatcher": [] + }, + { + "label": "clean", + "type": "shell", + "command": "${command:eide.project.clean}", + "group": "build", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/test/LED/LED.code-workspace b/test/LED/LED.code-workspace new file mode 100644 index 0000000..2a97a15 --- /dev/null +++ b/test/LED/LED.code-workspace @@ -0,0 +1,45 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "files.autoGuessEncoding": true, + "C_Cpp.default.configurationProvider": "cl.eide", + "C_Cpp.errorSquiggles": "disabled", + "files.associations": { + ".eideignore": "ignore", + "*.a51": "a51", + "*.h": "c", + "*.c": "c", + "*.hxx": "cpp", + "*.hpp": "cpp", + "*.c++": "cpp", + "*.cpp": "cpp", + "*.cxx": "cpp", + "*.cc": "cpp", + "REG52.H": "cpp" + }, + "[yaml]": { + "editor.insertSpaces": true, + "editor.tabSize": 4, + "editor.autoIndent": "advanced" + } + }, + "extensions": { + "recommendations": [ + "cl.eide", + "keroc.hex-fmt", + "xiaoyongdong.srecord", + "hars.cppsnippets", + "zixuanwang.linkerscript", + "redhat.vscode-yaml", + "IBM.output-colorizer", + "cschlosser.doxdocgen", + "ms-vscode.vscode-serial-monitor", + "alefragnani.project-manager", + "cl.stm8-debug" + ] + } +} \ No newline at end of file diff --git a/test/LED/LED.pdsprj b/test/LED/LED.pdsprj new file mode 100644 index 0000000..d8a93ab Binary files /dev/null and b/test/LED/LED.pdsprj differ diff --git a/test/LED.pdsprj b/test/LED/Project Backups/LED [20250225, 22-38-34].pdsprj similarity index 100% rename from test/LED.pdsprj rename to test/LED/Project Backups/LED [20250225, 22-38-34].pdsprj diff --git a/test/LED/Project Backups/LED [20250225, 22-38-38].pdsprj b/test/LED/Project Backups/LED [20250225, 22-38-38].pdsprj new file mode 100644 index 0000000..80073bd Binary files /dev/null and b/test/LED/Project Backups/LED [20250225, 22-38-38].pdsprj differ diff --git a/test/LED/README.MD b/test/LED/README.MD new file mode 100644 index 0000000..32a7ed3 --- /dev/null +++ b/test/LED/README.MD @@ -0,0 +1,9 @@ +# 点亮你的LED + +## 目标 + +通过程序控制51单片机点亮LED + +## 原理图 + +![image-20250225224203650](README.assets/image-20250225224203650.png) \ No newline at end of file diff --git a/test/LED/README.assets/image-20250225224203650.png b/test/LED/README.assets/image-20250225224203650.png new file mode 100644 index 0000000..e1e1de2 Binary files /dev/null and b/test/LED/README.assets/image-20250225224203650.png differ diff --git a/test/LED/src/main.c b/test/LED/src/main.c new file mode 100644 index 0000000..a0334f6 --- /dev/null +++ b/test/LED/src/main.c @@ -0,0 +1,20 @@ +#include + +sbit LED = P0 ^ 0; +sbit ADDR0 = P1 ^ 0; +sbit ADDR1 = P1 ^ 1; +sbit ADDR2 = P1 ^ 2; +sbit ADDR3 = P1 ^ 3; +sbit ENLED = P1 ^ 4; + +void main() +{ + ENLED = 0; + ADDR3 = 1; + ADDR2 = 1; + ADDR1 = 1; + ADDR0 = 0; + LED = 0; + while (1) { + } +} \ No newline at end of file