aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/lptim/timer/channel_direction.rs
blob: e4af8f45f0da2c2d04333ea543e3d01e911357be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::pac::lptim::vals;

/// Direction of a low-power timer channel
pub enum ChannelDirection {
    /// Use channel as a PWM output
    OutputPwm,
    /// Use channel as an input capture
    InputCapture,
}

impl From<ChannelDirection> for vals::Ccsel {
    fn from(direction: ChannelDirection) -> Self {
        match direction {
            ChannelDirection::OutputPwm => vals::Ccsel::OUTPUT_COMPARE,
            ChannelDirection::InputCapture => vals::Ccsel::INPUT_CAPTURE,
        }
    }
}