Dead-time computation in complementary PWM fixed (missing DTG msbs added)

This commit is contained in:
Ekaterina Savelyeva 2025-04-25 13:05:48 +04:00
parent a687fb20f6
commit d1555f4d5f

View File

@ -240,11 +240,11 @@ fn compute_dead_time_value(value: u16) -> (Ckd, u8) {
let (these_bits, result) = if target < 128 {
(target as u8, target)
} else if target < 255 {
(64 + (target / 2) as u8, (target - target % 2))
((64 + (target / 2) as u8) | 128, (target - target % 2))
} else if target < 508 {
(32 + (target / 8) as u8, (target - target % 8))
((32 + (target / 8) as u8) | 192, (target - target % 8))
} else if target < 1008 {
(32 + (target / 16) as u8, (target - target % 16))
((32 + (target / 16) as u8) | 224, (target - target % 16))
} else {
(u8::MAX, 1008)
};