Skip to content

Conversation

@victor-Lopez25
Copy link
Contributor

Adds a new PWM abstraction over TimerWrapper instead of the previous PWM abstraction which was over TimerPeripheral.
Example usage:

using ST_LIB::TimerDomain;
using ST_LIB::TimerRequest;

constexpr ST_LIB::TimerPin pwm_pin{
    .af = ST_LIB::TimerAF::PWM,
    .pin = ST_LIB::PD12,
    .channel = ST_LIB::TimerChannel::CHANNEL_1,
};
constexpr TimerDomain::Timer tim1_decl{{
    .name = {'t', 'i', 'm', '0', '4', 0, 0, 0},
    .request = TimerRequest::GeneralPurpose_4,
}, pwm_pin};
int main() {
  using pwmBoard = ST_LIB::Board<tim1_decl>;
  pwmBoard::init();

  auto timer = get_timer_instance(pwmBoard, tim1_decl);

  ST_LIB::PWM<tim1_decl, pwm_pin> pwm = timer.get_pwm<pwm_pin>();
  pwm.configure(1000, 95.0f);
  pwm.turn_on();

  while(1) {
    __NOP();
  }  
}

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

g0nz4I0 and others added 30 commits December 3, 2025 19:17
#534 (comment)

Co-authored-by: Jorge Sáez <125664643+jorgesg82@users.noreply.github.com>
Rebased from remotes/origin/MockTim
victor-Lopez25 and others added 30 commits January 13, 2026 20:28
+ NewPWM now starts up the timer channel
should work now?
Also removed Wpedantic because I hate it
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.

5 participants