No compiler errors - Not hardware tested#301
Open
Z-Bedard wants to merge 3 commits into
Open
Conversation
dechair3
reviewed
May 17, 2026
| SPI1.VirtualType=VM_MASTER | ||
| TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 | ||
| TIM1.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period | ||
| TIM1.Period=19999 |
There was a problem hiding this comment.
It would be more optimal to have a higher period and lower prescalar value. Try to go for the most efficient values possible
dechair3
reviewed
May 17, 2026
| /* USER CODE BEGIN PV */ | ||
|
|
||
| const uint16_t PWM_MIN_US = 1000; | ||
| const uint16_t PWM_MAX_US = 2000; |
There was a problem hiding this comment.
you would have to adjust these values after making changes to the timer peripherals
dechair3
reviewed
May 17, 2026
| uint16_t adc_in = readADC(1); | ||
|
|
||
| uint16_t pwm_us = PWM_MIN_US + ((adc_in * (PWM_MAX_US - PWM_MIN_US)) / 1023); | ||
|
|
There was a problem hiding this comment.
1023 what? Using a constant or a preproccesser directive instead of magic numbers is always better.
dechair3
reviewed
May 19, 2026
| { | ||
| /* USER CODE END WHILE */ | ||
|
|
||
| /* USER CODE BEGIN 3 */ |
There was a problem hiding this comment.
great work but you need to call the functions to use them in main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implementation was actually done earlier in the week, but I didn't create a thread until last night.