Skip to content

Commit af79b3e

Browse files
committed
more inlines
1 parent 7d5ee6a commit af79b3e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/timer/pwm.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,22 +369,27 @@ where
369369
TIM: Instance + WithPwm,
370370
PINS: Pins<TIM, P>,
371371
{
372+
#[inline]
372373
pub fn enable(&mut self, channel: Channel) {
373374
TIM::enable_channel(PINS::check_used(channel) as u8, true)
374375
}
375376

377+
#[inline]
376378
pub fn disable(&mut self, channel: Channel) {
377379
TIM::enable_channel(PINS::check_used(channel) as u8, false)
378380
}
379381

382+
#[inline]
380383
pub fn set_polarity(&mut self, channel: Channel, p: Polarity) {
381384
TIM::set_channel_polarity(PINS::check_used(channel) as u8, p);
382385
}
383386

387+
#[inline]
384388
pub fn get_duty(&self, channel: Channel) -> u16 {
385389
TIM::read_cc_value(PINS::check_used(channel) as u8) as u16
386390
}
387391

392+
#[inline]
388393
pub fn set_duty(&mut self, channel: Channel, duty: u16) {
389394
TIM::set_cc_value(PINS::check_used(channel) as u8, duty as u32)
390395
}
@@ -412,6 +417,7 @@ where
412417
self.tim.cnt_reset();
413418
}
414419

420+
#[inline]
415421
pub fn set_complementary_polarity(&mut self, channel: Channel, p: Polarity) {
416422
TIM::set_channel_polarity(PINS::check_complementary_used(channel) as u8, p);
417423
}
@@ -550,30 +556,37 @@ where
550556
TIM: Instance + WithPwm,
551557
PINS: Pins<TIM, P>,
552558
{
559+
#[inline]
553560
pub fn enable(&mut self, channel: Channel) {
554561
TIM::enable_channel(PINS::check_used(channel) as u8, true)
555562
}
556563

564+
#[inline]
557565
pub fn disable(&mut self, channel: Channel) {
558566
TIM::enable_channel(PINS::check_used(channel) as u8, false)
559567
}
560568

569+
#[inline]
561570
pub fn set_polarity(&mut self, channel: Channel, p: Polarity) {
562571
TIM::set_channel_polarity(PINS::check_used(channel) as u8, p);
563572
}
564573

574+
#[inline]
565575
pub fn get_duty(&self, channel: Channel) -> u16 {
566576
TIM::read_cc_value(PINS::check_used(channel) as u8) as u16
567577
}
568578

579+
#[inline]
569580
pub fn get_duty_time(&self, channel: Channel) -> TimerDurationU32<FREQ> {
570581
TimerDurationU32::from_ticks(TIM::read_cc_value(PINS::check_used(channel) as u8))
571582
}
572583

584+
#[inline]
573585
pub fn set_duty(&mut self, channel: Channel, duty: u16) {
574586
TIM::set_cc_value(PINS::check_used(channel) as u8, duty.into())
575587
}
576588

589+
#[inline]
577590
pub fn set_duty_time(&mut self, channel: Channel, duty: TimerDurationU32<FREQ>) {
578591
TIM::set_cc_value(PINS::check_used(channel) as u8, duty.ticks())
579592
}
@@ -592,6 +605,7 @@ where
592605
self.tim.cnt_reset();
593606
}
594607

608+
#[inline]
595609
pub fn set_complementary_polarity(&mut self, channel: Channel, p: Polarity) {
596610
TIM::set_channel_polarity(PINS::check_complementary_used(channel) as u8, p);
597611
}

0 commit comments

Comments
 (0)