-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hw timer #259
Conversation
* call autogen once per project * use jinja for test_runner generation * use pathlib for pathing * clean up build.scons * use emitter to define test.scons targets * change smoke to its own project type, update scons docs * use single option for target, fix test output format * clean up lint format * fix new target * update python modules for build * remove py can msg definition * remove py-can-msg-gen from build.scons * print out failed tests * merge with main, resolve issues * update build system doc * unchange can id * fix sim * msg for when flash fails
TIM_Cmd(TIM2, ENABLE); | ||
} | ||
|
||
void hw_timer_delay_us(uint32_t us) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, a possible issue with this is if a task delays for say 2ms, then gets pre empted by a task that delays for 1ms, the higher priority task would reset the timer, complete its delay, and then when the original task takes over, the timer would be disabled. I'm not 100% sure what the best fix for this is but I'll have to think about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it? TIM_GetCounter should be an atomic call. So the unless it happens before start_count
, it wouldn't be an issue right?
If that's the case, we could critical section this part until later
smoke/hw_timer/src/main.c
Outdated
gpio_toggle_state(&leds[0]); | ||
gpio_toggle_state(&leds[3]); | ||
LOG_DEBUG("HW Delay"); | ||
hw_timer_delay_ms(100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of a nitpick, I'd say test a shorter delay like 300us. It better reflects the use case of a module like this. I think you said you'd previously tested that though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested with 10us and it worked, but I can change the smoke tests delay
* modified autogen and created can parsing DBC file + jinja files * removed redundant variables and added vcan0 in autogeneration (CAN BE CHANGED TO CAN0) * added .zfill(3) to fill up hex message * Modified all main.c files to rely on autogenerated can IDS. Added constant messaging function with multiprocessing * formatted all files * removed redundant variable * Updated device ID's for can communication and can debuging with autogen values * formatting * opted to use threading over multiprocessing library --------- Co-authored-by: vagrant <vagrant@midsunbox>
* Added PD modifications for rev 2 * formatting * delete patch file * removed redundant logic * Added task stack param and updated brake light function to prv_ function * Updated FSM functions with new params * updated test_fsm * updated test_fsm * random file deleted --------- Co-authored-by: vagrant <vagrant@midsunbox>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost lgtm
start_count = current_count; | ||
} | ||
|
||
TIM_Cmd(TIM2, DISABLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a function for init and enable the timer
Does this still need the change for timer compare? |
No description provided.