Skip to content

Commit 3587bce

Browse files
committed
Merge branch 'main' into feature/diegolhendrix/sdo-sample
2 parents ea7e8b2 + 2a4abc3 commit 3587bce

14 files changed

Lines changed: 300 additions & 23 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ venv/
1212
.idea/
1313
.vscode/
1414
.cache/
15+
.settings/
16+
.clangd
1517

1618
# macOS files
1719
.DS_Store

.vscode/extensions.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"recommendations": [
3+
"eamodio.gitlens",
4+
"llvm-vs-code-extensions.vscode-clangd",
5+
"ms-vscode.cmake-tools",
6+
"stmicroelectronics.stm32cube-ide-debug-stlink-gdbserver",
7+
"stmicroelectronics.stm32cube-ide-registers",
8+
"seunlanlege.action-buttons",
9+
"rioj7.command-variable",
10+
"spadin.config-defaults",
11+
],
12+
}

.vscode/launch.default.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"configurations": [
3+
{
4+
"type": "stlinkgdbtarget",
5+
"request": "launch",
6+
"name": "Debug",
7+
"origin": "snippet",
8+
"cwd": "${workspaceFolder}",
9+
"preBuild": "${command:st-stm32-ide-debug-launch.build}",
10+
"runEntry": "main",
11+
"imagesAndSymbols": [
12+
{
13+
"imageFileName": "${command:cmake.launchTargetPath}"
14+
}
15+
],
16+
"faultUnalignedAccess": false
17+
},
18+
{
19+
"type": "stlinkgdbtarget",
20+
"request": "launch",
21+
"name": "Select From Targets",
22+
"origin": "snippet",
23+
"cwd": "${workspaceFolder}",
24+
"preBuild": "${command:st-stm32-ide-debug-launch.build}",
25+
"runEntry": "main",
26+
"imagesAndSymbols": [
27+
{
28+
"imageFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}" //Provides a run prompt
29+
}
30+
],
31+
"faultUnalignedAccess": false
32+
}
33+
]
34+
}

.vscode/settings.default.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"actionButtons": {
3+
"defaultColor": "statusBar.foreground",
4+
"reloadButton": "$(refresh)",
5+
"loadNpmCommands": false,
6+
"inheritGlobalCommands": true,
7+
"commands": [
8+
{
9+
"name": "$(trash) Clean",
10+
"tooltip": "Perform a CMAKE clean on the current preset",
11+
"command":"workbench.action.tasks.runTask",
12+
"args": ["CMake: clean"],
13+
"useVsCodeApi": true
14+
},
15+
{
16+
"name": "$(tools) Build",
17+
"tooltip": "Build the preset",
18+
"command":"workbench.action.tasks.runTask",
19+
"args": ["CMake: build"],
20+
"useVsCodeApi": true
21+
},
22+
{
23+
"name": "$(debug-alt) Debug",
24+
"tooltip": "Flash code and start debugging",
25+
"command":"workbench.action.tasks.runTask",
26+
"args": ["flash debug"],
27+
"useVsCodeApi": true
28+
},
29+
{
30+
"name": "$(play) Run",
31+
"tooltip": "Flash code",
32+
"command":"workbench.action.tasks.runTask",
33+
"args": ["Flash project"],
34+
"useVsCodeApi": true
35+
}
36+
]
37+
},
38+
"editor.tokenColorCustomizations": {
39+
"textMateRules": [
40+
{
41+
"scope": "markup.other.log.error",
42+
"settings": {
43+
"foreground": "#FF0000"
44+
}
45+
},
46+
{
47+
"scope": "markup.other.log.warn",
48+
"settings": {
49+
"foreground": "#c500f7cc"
50+
}
51+
},
52+
{
53+
"scope": "markup.other.log.info",
54+
"settings": {
55+
"foreground": "#2cd3c5"
56+
}
57+
},
58+
{
59+
"scope": "markup.other.log.debug",
60+
"settings": {
61+
"foreground": "#888585"
62+
}
63+
},
64+
{
65+
"scope": "markup.other.log.highlight",
66+
"settings": {
67+
"foreground": "#19ff04"
68+
}
69+
}
70+
]
71+
}
72+
}

.vscode/tasks.default.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "cmake",
6+
"label": "CMake: clean",
7+
"command": "clean",
8+
"preset": "__defaultBuildPreset__",
9+
"problemMatcher": [],
10+
"detail": "CMake clean task"
11+
},
12+
{
13+
"type": "cmake",
14+
"label": "CMake: build",
15+
"command": "build",
16+
"targets": [
17+
"all"
18+
],
19+
"preset": "__defaultBuildPreset__",
20+
"group": "build",
21+
"problemMatcher": [],
22+
"detail": "CMake build task"
23+
},
24+
{
25+
"type": "cmake",
26+
"label": "CMake: clean rebuild",
27+
"command": "cleanRebuild",
28+
"targets": [
29+
"all"
30+
],
31+
"preset": "__defaultBuildPreset__",
32+
"group": "build",
33+
"problemMatcher": [],
34+
"detail": "CMake clean rebuild task"
35+
},
36+
{
37+
"type": "shell",
38+
"label": "flash debug",
39+
"command": "${command:workbench.action.debug.start}",
40+
"detail": "Flash code and launch the debugger"
41+
},
42+
{
43+
"type": "shell",
44+
"label": "Flash project",
45+
"command": "${env:STM32_PRG_PATH}\\STM32_Programmer_CLI",
46+
"windows":{
47+
"command": "${env:STM32_PRG_PATH}\\STM32_Programmer_CLI.exe"
48+
},
49+
"args": [
50+
"--connect",
51+
"port=swd",
52+
"mode=UR", //Under reset
53+
"--download", "${input:fileDirnameForwardSlash}",
54+
"-hardRst", // Hardware reset - if rst pin is connected
55+
"-rst", // Software reset (backup)
56+
"--start" // Start execution
57+
],
58+
"options": {
59+
"cwd": "${workspaceFolder}"
60+
},
61+
"problemMatcher": []
62+
}
63+
],
64+
"inputs": [
65+
{
66+
"id": "fileDirnameForwardSlash",
67+
"type": "command",
68+
"command": "extension.commandvariable.transform",
69+
"args": {
70+
"text": "${command:cmake.launchTargetPath}",
71+
"find": "\\\\", // Reason for four '\': https://stackoverflow.com/a/4025505/2909854
72+
"replace": "/",
73+
"flags": "g"
74+
}
75+
}
76+
]
77+
}

CMakePresets.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "stm32f302-preset",
6+
"displayName": "STM32F302x8 Build",
7+
"description": "Configures the build for an STM32F302x8 target using the ARM GCC toolchain and Ninja.",
8+
"generator": "Ninja",
9+
"binaryDir": "${sourceDir}/build/${presetName}",
10+
"cacheVariables": {
11+
"CMAKE_BUILD_TYPE": "Debug",
12+
"EVT_CORE_LOG_ENABLE": "1",
13+
"TARGET_DEV": "STM32F302x8",
14+
"FORCE_COLORED_OUTPUT": "1"
15+
}
16+
},
17+
{
18+
"name": "stm32f334-preset",
19+
"displayName": "STM32F334x8 Build",
20+
"description": "Configures the build for an STM32F334x8 target using the ARM GCC toolchain and Ninja.",
21+
"generator": "Ninja",
22+
"binaryDir": "${sourceDir}/build/${presetName}",
23+
"cacheVariables": {
24+
"CMAKE_BUILD_TYPE": "Debug",
25+
"EVT_CORE_LOG_ENABLE": "1",
26+
"TARGET_DEV": "STM32F334x8",
27+
"FORCE_COLORED_OUTPUT": "1"
28+
}
29+
},
30+
{
31+
"name": "stm32f446-preset",
32+
"displayName": "STM32F446xx Build",
33+
"description": "Configures the build for an STM32F446xx target using the ARM GCC toolchain and Ninja.",
34+
"generator": "Ninja",
35+
"binaryDir": "${sourceDir}/build/${presetName}",
36+
"cacheVariables": {
37+
"CMAKE_BUILD_TYPE": "Debug",
38+
"EVT_CORE_LOG_ENABLE": "1",
39+
"TARGET_DEV": "STM32F446xx",
40+
"FORCE_COLORED_OUTPUT": "1"
41+
}
42+
},
43+
{
44+
"name": "stm32f446-rtos-preset",
45+
"displayName": "STM32F446xx Build (RTOS)",
46+
"description": "Configures the build for an STM32F446xx target with RTOS support using the ARM GCC toolchain and Ninja.",
47+
"generator": "Ninja",
48+
"binaryDir": "${sourceDir}/build/${presetName}",
49+
"cacheVariables": {
50+
"CMAKE_BUILD_TYPE": "Debug",
51+
"EVT_CORE_LOG_ENABLE": true,
52+
"TARGET_DEV": "STM32F446xx",
53+
"FORCE_COLORED_OUTPUT": true,
54+
"USE_RTOS": true
55+
}
56+
}
57+
],
58+
"buildPresets": [
59+
{
60+
"name": "stm32f302-build",
61+
"configurePreset": "stm32f302-preset",
62+
"displayName": "Build for STM32F302"
63+
},
64+
{
65+
"name": "stm32f334-build",
66+
"configurePreset": "stm32f334-preset",
67+
"displayName": "Build for STM32F334"
68+
},
69+
{
70+
"name": "stm32f446-build",
71+
"configurePreset": "stm32f446-preset",
72+
"displayName": "Build for STM32F446"
73+
},
74+
{
75+
"name": "stm32f446-rtos-build",
76+
"configurePreset": "stm32f446-rtos-preset",
77+
"displayName": "Build for STM32F446 (RTOS)"
78+
}
79+
]
80+
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ Below is the supported features associated with each board
143143
| Feature | STM32F302R8 | STM32F334R8 | STM32F446RE |
144144
|----------|--------------------|--------------------|--------------------|
145145
| ADC | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
146-
| CAN | :heavy_check_mark: | :heavy_check_mark: | :x: |
147-
| CANopen | :heavy_check_mark: | :heavy_check_mark: | :x: |
146+
| CAN | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
147+
| CANopen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
148148
| GPIO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
149149
| I2C | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
150150
| PWM | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
151-
| RTC | :heavy_check_mark: | :heavy_check_mark: | :x: |
151+
| RTC | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
152152
| SPI | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
153-
| Timer | :heavy_check_mark: | :heavy_check_mark: | :x: |
153+
| Timer | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
154154
| UART | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
155155
| Watchdog | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
156156

cmake/evt-core_clang-format.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if(CLANG_FORMAT)
2525
# Loop through each file and create a separate command because Windows has a 128-character limit
2626
# on its commands
2727
foreach(src_file ${ALL_CXX_SOURCE_FILES})
28-
add_custom_command(TARGET clang-format
28+
add_custom_command(TARGET clang-format PRE_BUILD
2929
COMMAND ${CLANG_FORMAT} -i -style=file ${src_file}
3030
)
3131
endforeach()

include/core/io/GPIO.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class GPIO {
3333

3434
/**
3535
* Binary representation of the flow of information, either input or
36-
* output.
36+
* output
3737
*/
3838
enum class Direction {
3939
INPUT = 0u,
@@ -76,23 +76,23 @@ class GPIO {
7676
GPIO(Pin pin, Direction direction, Pull pull = Pull::PULL_DOWN);
7777

7878
/**
79-
* Set the direction of the pin.
79+
* Sets whether this pin is configured for input or output.
8080
*
81-
* @param[in] direction The direction of information.
81+
* @param[in] direction Pin direction: Direction::Input or Direction::Output.
8282
*/
8383
virtual void setDirection(Direction direction) = 0;
8484

8585
/**
86-
* Used for writing a state to a pin.
86+
* Set the output of this pin to the given logic state.
8787
*
88-
* @param[in] state The state to write to the pin
88+
* @param[in] state Logic level to set: State::LOW or State::HIGH.
8989
*/
9090
virtual void writePin(State state) = 0;
9191

9292
/**
93-
* Used for reading the state of a pin.
93+
* Read the current logic state of this pin.
9494
*
95-
* @return The state of the pin.
95+
* @return The pin's logic level: State::LOW or State::HIGH.
9696
*/
9797
virtual State readPin() = 0;
9898

include/core/manager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ GPIO& getGPIO(GPIO::Direction direction = GPIO::Direction::OUTPUT, GPIO::Pull pu
195195
return gpioPin;
196196
#endif
197197
#ifdef STM32F4xx
198-
static GPIOf4xx gpioPin(pin, direction);
198+
static GPIOf4xx gpioPin(pin, direction, pull);
199199
return gpioPin;
200200
#endif
201201
}

0 commit comments

Comments
 (0)