|
34 | 34 | //! and change their polarity with `set_polarity` and `set_complementary_polarity`.
|
35 | 35 |
|
36 | 36 | use super::{
|
37 |
| - compute_arr_presc, Advanced, Channel, FTimer, Instance, Ocm, Polarity, Timer, WithPwm, IdleState, |
| 37 | + compute_arr_presc, Advanced, Channel, FTimer, IdleState, Instance, Ocm, Polarity, Timer, |
| 38 | + WithPwm, |
38 | 39 | };
|
39 | 40 | use crate::rcc::Clocks;
|
40 | 41 | use core::marker::PhantomData;
|
@@ -438,17 +439,31 @@ where
|
438 | 439 | TIM::enable_nchannel(PINS::check_complementary_used(channel) as u8, false)
|
439 | 440 | }
|
440 | 441 |
|
| 442 | + /// Set number DTS ticks during that complementary pin is `dead` |
441 | 443 | #[inline]
|
442 | 444 | pub fn set_dead_time(&mut self, dts_ticks: u16) {
|
443 | 445 | let bits = pack_ceil_dead_time(dts_ticks);
|
444 | 446 | TIM::set_dtg_value(bits);
|
445 | 447 | }
|
446 | 448 |
|
| 449 | + /// Set raw dead time (DTG) bits |
| 450 | + #[inline] |
| 451 | + pub fn set_dead_time_bits(&mut self, bits: u8) { |
| 452 | + TIM::set_dtg_value(bits); |
| 453 | + } |
| 454 | + |
| 455 | + /// Return dead time for complementary pins in DTS ticks |
447 | 456 | #[inline]
|
448 | 457 | pub fn get_dead_time(&self) -> u16 {
|
449 | 458 | unpack_dead_time(TIM::read_dtg_value())
|
450 | 459 | }
|
451 | 460 |
|
| 461 | + /// Get raw dead time (DTG) bits |
| 462 | + #[inline] |
| 463 | + pub fn get_dead_time_bits(&self) -> u8 { |
| 464 | + TIM::read_dtg_value() |
| 465 | + } |
| 466 | + |
452 | 467 | #[inline]
|
453 | 468 | pub fn set_idle_state(&mut self, channel: Channel, s: IdleState) {
|
454 | 469 | TIM::idle_state(PINS::check_used(channel) as u8, false, s);
|
@@ -626,17 +641,31 @@ where
|
626 | 641 | TIM::enable_nchannel(PINS::check_complementary_used(channel) as u8, false)
|
627 | 642 | }
|
628 | 643 |
|
| 644 | + /// Set number DTS ticks during that complementary pin is `dead` |
629 | 645 | #[inline]
|
630 | 646 | pub fn set_dead_time(&mut self, dts_ticks: u16) {
|
631 | 647 | let bits = pack_ceil_dead_time(dts_ticks);
|
632 | 648 | TIM::set_dtg_value(bits);
|
633 | 649 | }
|
634 | 650 |
|
| 651 | + /// Set raw dead time (DTG) bits |
| 652 | + #[inline] |
| 653 | + pub fn set_dead_time_bits(&mut self, bits: u8) { |
| 654 | + TIM::set_dtg_value(bits); |
| 655 | + } |
| 656 | + |
| 657 | + /// Return dead time for complementary pins in DTS ticks |
635 | 658 | #[inline]
|
636 | 659 | pub fn get_dead_time(&self) -> u16 {
|
637 | 660 | unpack_dead_time(TIM::read_dtg_value())
|
638 | 661 | }
|
639 | 662 |
|
| 663 | + /// Get raw dead time (DTG) bits |
| 664 | + #[inline] |
| 665 | + pub fn get_dead_time_bits(&self) -> u8 { |
| 666 | + TIM::read_dtg_value() |
| 667 | + } |
| 668 | + |
640 | 669 | #[inline]
|
641 | 670 | pub fn set_idle_state(&mut self, channel: Channel, s: IdleState) {
|
642 | 671 | TIM::idle_state(PINS::check_used(channel) as u8, false, s);
|
|
0 commit comments