Skip to content

Scheduler implementation#534

Merged
jorgesg82 merged 116 commits intodevelopmentfrom
feat/scheduler
Jan 15, 2026
Merged

Scheduler implementation#534
jorgesg82 merged 116 commits intodevelopmentfrom
feat/scheduler

Conversation

@victor-Lopez25
Copy link
Copy Markdown
Contributor

@victor-Lopez25 victor-Lopez25 commented Dec 2, 2025

example main.cpp:

#include "main.h"
#include "ST-LIB.hpp"

DigitalOutput *led_on_1_ptr;
DigitalOutput *led_on_2_ptr;
DigitalOutput *led_on_3_ptr;

#define def_led_toggle_task(num) \
    void led_##num##_toggle_task(void) { \
        led_on_##num##_ptr->toggle(); \
    }

def_led_toggle_task(1)
def_led_toggle_task(2)
def_led_toggle_task(3)

int main(void) {
#ifdef SIM_ON
    SharedMemory::start();
#endif

    DigitalOutput led_1_on(PB0);
    DigitalOutput led_2_on(PE1);
    DigitalOutput led_3_on(PB14);
    led_on_1_ptr = &led_1_on;
    led_on_2_ptr = &led_2_on;
    led_on_3_ptr = &led_3_on;
    STLIB::start();

    // STLIB::start() enables this, I only want it to be enabled in Scheduler::start() for testing purposes
    RCC->APB1LENR &= ~RCC_APB1LENR_TIM2EN;

#define PARTY_MODE 0
#if PARTY_MODE
    Scheduler::register_task(200*1000, led_1_toggle_task);
    Scheduler::register_task(300*1000, led_2_toggle_task);
    Scheduler::register_task(500*1000, led_3_toggle_task);
    
    Scheduler::register_task(700*1000, led_1_toggle_task);
    Scheduler::register_task(1100*1000, led_2_toggle_task);
    Scheduler::register_task(1300*1000, led_3_toggle_task);
#else
    Scheduler::register_task(200*1000, led_1_toggle_task);
#endif
    Scheduler::start();

    while (1) {
        STLIB::update();
        Scheduler::update();
    }
}

void Error_Handler(void) {
    ErrorHandler("HAL error handler triggered");
    while (1) {
    }
}

@victor-Lopez25 victor-Lopez25 marked this pull request as draft December 2, 2025 09:01
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp
Comment thread Inc/HALAL/Services/Time/Scheduler.hpp Outdated
Copy link
Copy Markdown
Member

@StefanCostea StefanCostea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks very good

Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Inc/HALAL/Services/Time/Scheduler.hpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Src/HALAL/Services/Time/Scheduler.cpp
Comment thread Src/HALAL/Services/Time/Scheduler.cpp Outdated
Comment thread Inc/MockedDrivers/mocked_ll_tim.hpp
Comment thread Inc/MockedDrivers/tim_register_definitions.hpp Outdated
Comment on lines +65 to +66
this->CNT += val;
simulate_ticks(this);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have removed the side effects fomr CNT and added them into this function, why have you chosen this approach?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I wanted something separate that would only increment CNT when specified, when I used the previous approach, clearing CNT from the scheduler in schedule_next_interval() would cause simulate_ticks() to be called sometimes

Comment thread CMakeLists.txt
Comment on lines +243 to +248

$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Time/Scheduler.cpp>
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/mocked_ll_tim.cpp>
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/mocked_system_stm32h7xx.c>
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/stm32h723xx_wrapper.c>
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/NVIC.cpp>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be moved into a variable, MockedSources or something like that

victor-Lopez25 added a commit that referenced this pull request Dec 27, 2025
#534 (comment)

Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>
@victor-Lopez25 victor-Lopez25 marked this pull request as ready for review January 13, 2026 21:34
@jorgesg82 jorgesg82 merged commit fc00a32 into development Jan 15, 2026
13 checks passed
jorgesg82 added a commit that referenced this pull request Jan 22, 2026
* feat: add DSB and ISB intructions in x86_64

* feat: add NVIC

* add NVIC logic

* feat: use NVIC and remove print

* fix: move extern"C" block to allow using <iostream>

* add Register class to allow for side effects

* feat: use newly created Register class for side effects, neat trick in CNT write

* feat: be as realistic as possible in test, by using CNT++

* feat: remove unnecessary include

* feat: add an __RBIT impl for x86_64

* fix: compilation

* fix: used_bitmap_ -> free_bitmap_

* Added tests check in CI/CD

* fix(ci/cd): output folder

* Added ARM specific instructions to be able to compile in ARM hosts (Mac)

* Fix: compiler barrier for msvc, hopefully works

* Fix: Try to fix -Wchanges-meaning warning

* Fix typo

* Update Inc/MockedDrivers/common.hpp

#534 (comment)

Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>

* Actually do the change github didn't do :/

* Fix typo p2

* Fix another typo

* Fix unsigned long - 64bit when testing using LL functions

* Minor fixes to scheduler
Rebased from remotes/origin/MockTim

* Fix: uint32_t* cast of a word instead of the ptr

* Fix: remove active_task_count_ decrement in pop_front()
#534 (comment)

* Try fix Wstrict-aliasing in front_id

* Try fix Wstrict-aliasing again

* Fix typo in allocate_slot

* fix: test UsedBitmap -> FreeBitmap

* used_bitmap_ -> free_bitmap_ in test part 2

* fixed tests discovery

* fix: set_timeout() test

* Add a test, fix the error (kind of)

* Fix: underflow in schedule_next_interval

* Fix: call schedule_next_interval() in start()

* Fix: invert condition, that was stupid

* feat: add test showcasing possible usage within StateMachine logic

* fix: Calculate correct prescaler & add to HALAL.hpp

* Try to fix tests

* try to fix tests part 2

* Try to fix tests part 3

* part 4 - add the wrapper.c to cmake, will this work?

* part 5 - fix cmake stm32h723xx_wrapper.c path

* fix: try to fix tests part 6

* fix: volatile warnings

* fix: active_PSC is now set when PSC is set

* fix: remove outdated comment

* fix: tests part 7, should work now

* fix: remove unecessary if, return if cancelled in cancel_timeout

* Pop all due tasks, several might be due in the same tick

* Revert force-push

* fix: off by one error + configure_timer_for_interval should use uint32_t

* fix: off by one error in schedule_next_interval()

* All 15 tasks in MultipleTasks test, and it works

* Add SameTaskMultipleTimes test, does all 16 tasks too

* larger NUM_TICKS just in case

* fix bug mentioned in previous cancel_timeout()

* fix: id uint32_t -> uint16_t + bug fix

* fix: remove TimerPeripheral::start and Time::start from HALAL::start

* try to fix ci/cd

* try to fix ci/cd part 2

* try to fix ci/cd part 3

* clean up ci/cd fix

* Remove unnecessary warning ignore

* fix: use wrapper instead of interface for stm32h7xx_ll_tim.h

* fix ci/cd and add the other submodule to be automatically added

* fix: actually add stm32h7xx_ll_tim_wrapper.h

* try to fix ci/cd warning

* try fix warnings again

* fix: add ignore Woverflow to stm32h7xx_ll_tim

* fix: remove need to ignore Woverflow warnings

* fix: Remove tim_register_definitions.hpp
We're already including them in stm32h723xx_wrapper

* Initial TimerDomain commit, lots of work to do...

* Change name to TimerDomain.hpp in comment

* feat: Implement getting AnyGeneralPurpose timer with priorities

* Make prettier

* Remove leftovers

* Remove outdated comment

* fix: Finish the comment :)

* Clean up error messages, add comment

* temp: setup to try to compile template_project

* Try to get TimerDomain to compile

* Add initial implementation of scheduler

* Try to fix -Wuninitialized warning

* Try to remove Wuninitialized warning temporarily

* Remove unnecessary clear of task element

* fix: Readability and todo for validation

* fix: allocate_slot

* Add explenation of sorted_task_ids_, static_assert for the bitmaps

* Remove long_wait_remaining_us_

* fix: better get_at

* fix: better front_id
Compiler would've probably optimized it but it's better to make it explicit

* fix: endianness in pop_front

* Added unlikely to release_slot conditional

* fix: Correct comment explenation

* No bit field insert, it annoyed me

* No more diagnostic ignore

* fix: loss in accuracy by not adding 1: #534 (comment)

* fix: Moved active_task_count_ modification

* Actually set used_bitmap_ in allocate_slot

* fix: used_bitmap_ -> free_bitmap_

* only include sources when cross-compiling

* modify CMakeLists inside Tests

* feat: use ugly ifdef guards for host testing purposes

* add sample tests for Scheduler

* add emulated ticking

* test for execution count

* fix: CI

* fix: expected result in test case + explanation

* add compiler specific and CoreMacros

* copy files from LL and CMSIS for TIM Registers

* bridge between LL MMIO Timer and user defined TIMER

* reduce the number of ugly macros

* compile the new mock file

* update test

* enable debugging of tests with TestMate C++ extension

* feat: add DSB and ISB intructions in x86_64

* feat: add NVIC

* add NVIC logic

* feat: use NVIC and remove print

* fix: move extern"C" block to allow using <iostream>

* add Register class to allow for side effects

* feat: use newly created Register class for side effects, neat trick in CNT write

* feat: be as realistic as possible in test, by using CNT++

* feat: remove unnecessary include

* feat: add an __RBIT impl for x86_64

* fix: compilation

* Added tests check in CI/CD

* fix(ci/cd): output folder

* Added ARM specific instructions to be able to compile in ARM hosts (Mac)

* Fix: compiler barrier for msvc, hopefully works

* Fix: Try to fix -Wchanges-meaning warning

* Fix typo

* Update Inc/MockedDrivers/common.hpp

#534 (comment)

Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>

* Actually do the change github didn't do :/

* Fix typo p2

* Fix another typo

* Fix unsigned long - 64bit when testing using LL functions

* Fix: uint32_t* cast of a word instead of the ptr

* Minor fixes to scheduler
Rebased from remotes/origin/MockTim

* Fix: remove active_task_count_ decrement in pop_front()
#534 (comment)

* Try fix Wstrict-aliasing in front_id

* Try fix Wstrict-aliasing again

* Fix typo in allocate_slot

* fix: test UsedBitmap -> FreeBitmap

* used_bitmap_ -> free_bitmap_ in test part 2

* fixed tests discovery

* fix: set_timeout() test

* Add a test, fix the error (kind of)

* Fix: underflow in schedule_next_interval

* Fix: call schedule_next_interval() in start()

* Fix: invert condition, that was stupid

* feat: add test showcasing possible usage within StateMachine logic

* fix: Calculate correct prescaler & add to HALAL.hpp

* Try to fix tests

* try to fix tests part 2

* Try to fix tests part 3

* part 4 - add the wrapper.c to cmake, will this work?

* part 5 - fix cmake stm32h723xx_wrapper.c path

* fix: try to fix tests part 6

* fix: volatile warnings

* fix: active_PSC is now set when PSC is set

* fix: remove outdated comment

* fix: tests part 7, should work now

* fix: remove unecessary if, return if cancelled in cancel_timeout

* Pop all due tasks, several might be due in the same tick

* Revert force-push

* fix: off by one error + configure_timer_for_interval should use uint32_t

* fix: off by one error in schedule_next_interval()

* All 15 tasks in MultipleTasks test, and it works

* Add SameTaskMultipleTimes test, does all 16 tasks too

* larger NUM_TICKS just in case

* fix bug mentioned in previous cancel_timeout()

* fix: id uint32_t -> uint16_t + bug fix

* fix: remove TimerPeripheral::start and Time::start from HALAL::start

* try to fix ci/cd

* try to fix ci/cd part 2

* try to fix ci/cd part 3

* clean up ci/cd fix

* Remove unnecessary warning ignore

* fix: use wrapper instead of interface for stm32h7xx_ll_tim.h

* fix ci/cd and add the other submodule to be automatically added

* fix: actually add stm32h7xx_ll_tim_wrapper.h

* try to fix ci/cd warning

* try fix warnings again

* fix: add ignore Woverflow to stm32h7xx_ll_tim

* fix: remove need to ignore Woverflow warnings

* fix: Remove tim_register_definitions.hpp
We're already including them in stm32h723xx_wrapper

* Initial TimerDomain commit, lots of work to do...

* Change name to TimerDomain.hpp in comment

* feat: Implement getting AnyGeneralPurpose timer with priorities

* Make prettier

* Remove leftovers

* Remove outdated comment

* fix: Finish the comment :)

* Clean up error messages, add comment

* temp: setup to try to compile template_project

* Try to get TimerDomain to compile

* Fix all compilation errors (yipee)

* Try to fix compile errors when in template_project

* Try to fix compile errors...
Goodbye ErrorInRequestN I thought it could be used T-T

* try fix again

* slowly but surely

* Fix TimerWrapper constructor

* Add timer interrupt callbacks, use XList for TIM_HandleTypeDef definitions

* try to choose 16 bit or 32 bit at compile time

* Fix compilation issues

* Fix overflow calculation and a test

* Fix all remaining issues

* Change TimerRequest values

* Remove temporary function

* fix: Remove static assert

* fix: Change order of parameters

* fix: timer 15 (hopefully?)

* fix: Rollback removal of tim15 when getting AnyGeneralPurpose timer

* fix: pins are now part of TimerWrapper, not TimerDomain

* fix: Split TimerWrapper into a different file: TimerWrapper.hpp

* fix: Use new way to add Domain to board

* feat: Initial implementation of new PWM class

* fix: Make PWM class more private

* feat: Use an initializer_list to get the pins without needing a size

* fix: Remove prescaler and period from TimerDomain

* feat: Add Any32bitTimer to TimerDomain

* fix: Rename Any32bitTimer to Any32bit

* Fix docker build hopefully

* feat: add a macro: get_timer_instance

* fix: compile error

* fix: revert change to .vscode settings

* fix: tim3 is 16 bit, tim5 is 32 bit + start of pin af checking

* More timer pin afs

* More pins, todo: tim23 and tim24

* tim23, tim24 pins done, now programming time

* next step: compile time check_pins

* feat: Finish implementing check_pins

* Add tests for TimerWrapper, not running them yet

* Almost implement all wrappers for TimerDomain tests

* Add TimerDomain.cpp to simulator

* Further fix compile errors

* Fix tests compilation!

* NVIC ICER now clears the bit in NVIC ISER

---------

Co-authored-by: Gonzalo Sánchez <gonzalosmoya24@gmail.com>
Co-authored-by: Jorge Sáez <jorgeesg82@gmail.com>
Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>
Co-authored-by: StefanCostea <stefanxenadu@gmail.com>
oganigl pushed a commit that referenced this pull request Jan 30, 2026
* Update Inc/MockedDrivers/common.hpp

#534 (comment)

Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>

* Actually do the change github didn't do :/

* Fix typo p2

* Fix another typo

* Fix unsigned long - 64bit when testing using LL functions

* Minor fixes to scheduler
Rebased from remotes/origin/MockTim

* Fix: uint32_t* cast of a word instead of the ptr

* Fix: remove active_task_count_ decrement in pop_front()
#534 (comment)

* Try fix Wstrict-aliasing in front_id

* Try fix Wstrict-aliasing again

* Fix typo in allocate_slot

* fix: test UsedBitmap -> FreeBitmap

* used_bitmap_ -> free_bitmap_ in test part 2

* fixed tests discovery

* fix: set_timeout() test

* Add a test, fix the error (kind of)

* Fix: underflow in schedule_next_interval

* Fix: call schedule_next_interval() in start()

* Fix: invert condition, that was stupid

* feat: add test showcasing possible usage within StateMachine logic

* fix: Calculate correct prescaler & add to HALAL.hpp

* Try to fix tests

* try to fix tests part 2

* Try to fix tests part 3

* part 4 - add the wrapper.c to cmake, will this work?

* part 5 - fix cmake stm32h723xx_wrapper.c path

* fix: try to fix tests part 6

* fix: volatile warnings

* fix: active_PSC is now set when PSC is set

* fix: remove outdated comment

* fix: tests part 7, should work now

* fix: remove unecessary if, return if cancelled in cancel_timeout

* Pop all due tasks, several might be due in the same tick

* Revert force-push

* fix: off by one error + configure_timer_for_interval should use uint32_t

* fix: off by one error in schedule_next_interval()

* All 15 tasks in MultipleTasks test, and it works

* Add SameTaskMultipleTimes test, does all 16 tasks too

* larger NUM_TICKS just in case

* fix bug mentioned in previous cancel_timeout()

* fix: id uint32_t -> uint16_t + bug fix

* fix: remove TimerPeripheral::start and Time::start from HALAL::start

* try to fix ci/cd

* try to fix ci/cd part 2

* try to fix ci/cd part 3

* clean up ci/cd fix

* Remove unnecessary warning ignore

* fix: use wrapper instead of interface for stm32h7xx_ll_tim.h

* fix ci/cd and add the other submodule to be automatically added

* fix: actually add stm32h7xx_ll_tim_wrapper.h

* try to fix ci/cd warning

* try fix warnings again

* fix: add ignore Woverflow to stm32h7xx_ll_tim

* fix: remove need to ignore Woverflow warnings

* fix: Remove tim_register_definitions.hpp
We're already including them in stm32h723xx_wrapper

* Initial TimerDomain commit, lots of work to do...

* Change name to TimerDomain.hpp in comment

* feat: Implement getting AnyGeneralPurpose timer with priorities

* Make prettier

* Remove leftovers

* Remove outdated comment

* fix: Finish the comment :)

* Clean up error messages, add comment

* temp: setup to try to compile template_project

* Try to get TimerDomain to compile

* Add initial implementation of scheduler

* Try to fix -Wuninitialized warning

* Try to remove Wuninitialized warning temporarily

* Remove unnecessary clear of task element

* fix: Readability and todo for validation

* fix: allocate_slot

* Add explenation of sorted_task_ids_, static_assert for the bitmaps

* Remove long_wait_remaining_us_

* fix: better get_at

* fix: better front_id
Compiler would've probably optimized it but it's better to make it explicit

* fix: endianness in pop_front

* Added unlikely to release_slot conditional

* fix: Correct comment explenation

* No bit field insert, it annoyed me

* No more diagnostic ignore

* fix: loss in accuracy by not adding 1: #534 (comment)

* fix: Moved active_task_count_ modification

* Actually set used_bitmap_ in allocate_slot

* fix: used_bitmap_ -> free_bitmap_

* only include sources when cross-compiling

* modify CMakeLists inside Tests

* feat: use ugly ifdef guards for host testing purposes

* add sample tests for Scheduler

* add emulated ticking

* test for execution count

* fix: CI

* fix: expected result in test case + explanation

* add compiler specific and CoreMacros

* copy files from LL and CMSIS for TIM Registers

* bridge between LL MMIO Timer and user defined TIMER

* reduce the number of ugly macros

* compile the new mock file

* update test

* enable debugging of tests with TestMate C++ extension

* feat: add DSB and ISB intructions in x86_64

* feat: add NVIC

* add NVIC logic

* feat: use NVIC and remove print

* fix: move extern"C" block to allow using <iostream>

* add Register class to allow for side effects

* feat: use newly created Register class for side effects, neat trick in CNT write

* feat: be as realistic as possible in test, by using CNT++

* feat: remove unnecessary include

* feat: add an __RBIT impl for x86_64

* fix: compilation

* Added tests check in CI/CD

* fix(ci/cd): output folder

* Added ARM specific instructions to be able to compile in ARM hosts (Mac)

* Fix: compiler barrier for msvc, hopefully works

* Fix: Try to fix -Wchanges-meaning warning

* Fix typo

* Update Inc/MockedDrivers/common.hpp

#534 (comment)

Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>

* Actually do the change github didn't do :/

* Fix typo p2

* Fix another typo

* Fix unsigned long - 64bit when testing using LL functions

* Fix: uint32_t* cast of a word instead of the ptr

* Minor fixes to scheduler
Rebased from remotes/origin/MockTim

* Fix: remove active_task_count_ decrement in pop_front()
#534 (comment)

* Try fix Wstrict-aliasing in front_id

* Try fix Wstrict-aliasing again

* Fix typo in allocate_slot

* fix: test UsedBitmap -> FreeBitmap

* used_bitmap_ -> free_bitmap_ in test part 2

* fixed tests discovery

* fix: set_timeout() test

* Add a test, fix the error (kind of)

* Fix: underflow in schedule_next_interval

* Fix: call schedule_next_interval() in start()

* Fix: invert condition, that was stupid

* feat: add test showcasing possible usage within StateMachine logic

* fix: Calculate correct prescaler & add to HALAL.hpp

* Try to fix tests

* try to fix tests part 2

* Try to fix tests part 3

* part 4 - add the wrapper.c to cmake, will this work?

* part 5 - fix cmake stm32h723xx_wrapper.c path

* fix: try to fix tests part 6

* fix: volatile warnings

* fix: active_PSC is now set when PSC is set

* fix: remove outdated comment

* fix: tests part 7, should work now

* fix: remove unecessary if, return if cancelled in cancel_timeout

* Pop all due tasks, several might be due in the same tick

* Revert force-push

* fix: off by one error + configure_timer_for_interval should use uint32_t

* fix: off by one error in schedule_next_interval()

* All 15 tasks in MultipleTasks test, and it works

* Add SameTaskMultipleTimes test, does all 16 tasks too

* larger NUM_TICKS just in case

* fix bug mentioned in previous cancel_timeout()

* fix: id uint32_t -> uint16_t + bug fix

* fix: remove TimerPeripheral::start and Time::start from HALAL::start

* try to fix ci/cd

* try to fix ci/cd part 2

* try to fix ci/cd part 3

* clean up ci/cd fix

* Remove unnecessary warning ignore

* fix: use wrapper instead of interface for stm32h7xx_ll_tim.h

* fix ci/cd and add the other submodule to be automatically added

* fix: actually add stm32h7xx_ll_tim_wrapper.h

* try to fix ci/cd warning

* try fix warnings again

* fix: add ignore Woverflow to stm32h7xx_ll_tim

* fix: remove need to ignore Woverflow warnings

* fix: Remove tim_register_definitions.hpp
We're already including them in stm32h723xx_wrapper

* Initial TimerDomain commit, lots of work to do...

* Change name to TimerDomain.hpp in comment

* feat: Implement getting AnyGeneralPurpose timer with priorities

* Make prettier

* Remove leftovers

* Remove outdated comment

* fix: Finish the comment :)

* Clean up error messages, add comment

* temp: setup to try to compile template_project

* Try to get TimerDomain to compile

* Fix all compilation errors (yipee)

* Try to fix compile errors when in template_project

* Try to fix compile errors...
Goodbye ErrorInRequestN I thought it could be used T-T

* try fix again

* slowly but surely

* Fix TimerWrapper constructor

* Add timer interrupt callbacks, use XList for TIM_HandleTypeDef definitions

* try to choose 16 bit or 32 bit at compile time

* Fix compilation issues

* Fix overflow calculation and a test

* Fix all remaining issues

* Change TimerRequest values

* Remove temporary function

* fix: Remove static assert

* fix: Change order of parameters

* fix: timer 15 (hopefully?)

* fix: Rollback removal of tim15 when getting AnyGeneralPurpose timer

* fix: pins are now part of TimerWrapper, not TimerDomain

* fix: Split TimerWrapper into a different file: TimerWrapper.hpp

* fix: Use new way to add Domain to board

* feat: Initial implementation of new PWM class

* fix: Make PWM class more private

* feat: Use an initializer_list to get the pins without needing a size

* fix: Remove prescaler and period from TimerDomain

* feat: Add Any32bitTimer to TimerDomain

* fix: Rename Any32bitTimer to Any32bit

* Fix docker build hopefully

* feat: add a macro: get_timer_instance

* fix: compile error

* fix: revert change to .vscode settings

* fix: tim3 is 16 bit, tim5 is 32 bit + start of pin af checking

* More timer pin afs

* More pins, todo: tim23 and tim24

* tim23, tim24 pins done, now programming time

* next step: compile time check_pins

* feat: Finish implementing check_pins

* Add tests for TimerWrapper, not running them yet

* Almost implement all wrappers for TimerDomain tests

* Add TimerDomain.cpp to simulator

* Further fix compile errors

* Fix tests compilation!

* NVIC ICER now clears the bit in NVIC ISER

* fix: TimerDomain pins

* hotfix! pwm compilation

* Huge cleanup of TimerDomain, TimerWrapper
+ NewPWM now starts up the timer channel
should work now?
Also removed Wpedantic because I hate it

* Keep TimerPeripheral behaviour - default psc = 5

* fix test

* get_CCR_offset -> set_capture_compare

* fix gpio operation mode

* Fix frequency, it was a typo T-T

* fix frequency completely, off by one errors and all

* cleanup get_pwm()

* fix get_pwm

* remove these todos

* add set_frequency, remove CLOCK_FREQ_MHZ_WITHOUT_PRESCALER

* set_frequency [uint64_t -> float], remove psc default 5

* Added newlines to GetPinFromIdx to make it more readable

* PWM gpio speed is now low

* Add compile time check for one pin per channel per timer

* remove outdated comment

---------

Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>
Co-authored-by: StefanCostea <stefanxenadu@gmail.com>
Co-authored-by: Jorge Sáez <jorgeesg82@gmail.com>
Co-authored-by: Gonzalo Sánchez <gonzalosmoya24@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants