CTIMER

Struct CTIMER 

Source
pub struct CTIMER<State, Channel1State, Channel2State, Channel3State> {
    pub channels: Channels<State, Channel1State, Channel2State, Channel3State>,
    /* private fields */
}
Expand description

Interface to a CTimer peripheral

Controls the CTimer. Use Peripherals to gain access to an instance of this struct.

Please refer to the module documentation for more information.

Fields§

§channels: Channels<State, Channel1State, Channel2State, Channel3State>

The PWM channels of this CTIMER

Implementations§

Source§

impl<Channel1State, Channel2State, Channel3State> CTIMER<Disabled, Channel1State, Channel2State, Channel3State>

Source

pub fn enable( self, period: u32, prescaler: u32, syscon: &mut Handle, ) -> CTIMER<Enabled, Channel1State, Channel2State, Channel3State>

Start the PWM timer, with a predefined period and prescaler

The period sets resolution of the pwm and is returned with get_max_duty.

Source§

impl CTIMER<Enabled, Detached, Detached, Detached>

Source

pub fn attach<Pin>( self, _: Function<<Channel1 as Trait>::Output, Assigned<Pin>>, ) -> CTIMER<Enabled, Attached, Detached, Detached>

Attach an output function to channel 1

This function is only available if no output functions has been attached to channel 1.

Source§

impl CTIMER<Enabled, Attached, Detached, Detached>

Source

pub fn attach<Pin>( self, _: Function<<Channel2 as Trait>::Output, Assigned<Pin>>, ) -> CTIMER<Enabled, Attached, Attached, Detached>

Attach an output function to channel 2

This function is only available if an output function has been attached to channel 1, but no output functions has been attached to channel 2.

Source§

impl CTIMER<Enabled, Attached, Attached, Detached>

Source

pub fn attach<Pin>( self, _: Function<<Channel3 as Trait>::Output, Assigned<Pin>>, ) -> CTIMER<Enabled, Attached, Attached, Attached>

Attach an output function to channel 3

This function is only available if output functions have been attached to channels 1 and 2, but no output functions has been attached to channel 3.

Source§

impl<Channel1State, Channel2State, Channel3State> CTIMER<Enabled, Channel1State, Channel2State, Channel3State>

Source

pub fn disable( self, syscon: &mut Handle, ) -> CTIMER<Disabled, Channel1State, Channel2State, Channel3State>

Disable the CTIMER

This method is only available, if CTIMER is in the Enabled state. Code that attempts to call this method when the peripheral is already disabled will not compile.

Consumes this instance of CTIMER and returns another instance that has its State type parameter set to Disabled.

Source§

impl<State, Channel1State, Channel2State, Channel3State> CTIMER<State, Channel1State, Channel2State, Channel3State>

Source

pub fn free(self) -> CTIMER0

Return the raw peripheral

This method serves as an escape hatch from the HAL API. It returns the raw peripheral, allowing you to do whatever you want with it, without limitations imposed by the API.

If you are using this method because a feature you need is missing from the HAL API, please open an issue or, if an issue for your feature request already exists, comment on the existing issue, so we can prioritize it accordingly.

Trait Implementations§

Source§

impl Pwm for CTIMER<Enabled, Attached, Attached, Attached>

Source§

type Channel = Channels123

Enumeration of channels that can be used with this Pwm interface Read more
Source§

type Time = u32

A time unit that can be converted into a human time unit (e.g. seconds)
Source§

type Duty = u32

Type for the duty methods Read more
Source§

fn disable(&mut self, channel: Self::Channel)

Disables a PWM channel
Source§

fn enable(&mut self, channel: Self::Channel)

Enables a PWM channel
Source§

fn get_period(&self) -> Self::Time

Returns the current PWM period
Source§

fn get_duty(&self, channel: Self::Channel) -> Self::Duty

Returns the current duty cycle
Source§

fn get_max_duty(&self) -> Self::Duty

Returns the maximum duty cycle value
Source§

fn set_duty(&mut self, channel: Self::Channel, duty: Self::Duty)

Sets a new duty cycle
Source§

fn set_period<P>(&mut self, period: P)
where P: Into<Self::Time>,

Sets a new PWM period
Source§

impl Pwm for CTIMER<Enabled, Attached, Attached, Attached>

Source§

type Error = Infallible

Enumeration of Pwm errors
Source§

type Channel = Channels123

Enumeration of channels that can be used with this Pwm interface Read more
Source§

type Time = u32

A time unit that can be converted into a human time unit (e.g. seconds)
Source§

type Duty = u32

Type for the duty methods Read more
Source§

fn disable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>

Disables a PWM channel
Source§

fn enable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>

Enables a PWM channel
Source§

fn get_period(&self) -> Result<Self::Time, Self::Error>

Returns the current PWM period
Source§

fn get_duty(&self, channel: &Self::Channel) -> Result<Self::Duty, Self::Error>

Returns the current duty cycle Read more
Source§

fn get_max_duty(&self) -> Result<Self::Duty, Self::Error>

Returns the maximum duty cycle value
Source§

fn set_duty( &mut self, channel: &Self::Channel, duty: Self::Duty, ) -> Result<(), Self::Error>

Sets a new duty cycle
Source§

fn set_period<P>(&mut self, period: P) -> Result<(), Self::Error>
where P: Into<Self::Time>,

Sets a new PWM period
Source§

impl Pwm for CTIMER<Enabled, Attached, Attached, Detached>

Source§

type Channel = Channels12

Enumeration of channels that can be used with this Pwm interface Read more
Source§

type Time = u32

A time unit that can be converted into a human time unit (e.g. seconds)
Source§

type Duty = u32

Type for the duty methods Read more
Source§

fn disable(&mut self, channel: Self::Channel)

Disables a PWM channel
Source§

fn enable(&mut self, channel: Self::Channel)

Enables a PWM channel
Source§

fn get_period(&self) -> Self::Time

Returns the current PWM period
Source§

fn get_duty(&self, channel: Self::Channel) -> Self::Duty

Returns the current duty cycle
Source§

fn get_max_duty(&self) -> Self::Duty

Returns the maximum duty cycle value
Source§

fn set_duty(&mut self, channel: Self::Channel, duty: Self::Duty)

Sets a new duty cycle
Source§

fn set_period<P>(&mut self, period: P)
where P: Into<Self::Time>,

Sets a new PWM period
Source§

impl Pwm for CTIMER<Enabled, Attached, Attached, Detached>

Source§

type Error = Infallible

Enumeration of Pwm errors
Source§

type Channel = Channels12

Enumeration of channels that can be used with this Pwm interface Read more
Source§

type Time = u32

A time unit that can be converted into a human time unit (e.g. seconds)
Source§

type Duty = u32

Type for the duty methods Read more
Source§

fn disable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>

Disables a PWM channel
Source§

fn enable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>

Enables a PWM channel
Source§

fn get_period(&self) -> Result<Self::Time, Self::Error>

Returns the current PWM period
Source§

fn get_duty(&self, channel: &Self::Channel) -> Result<Self::Duty, Self::Error>

Returns the current duty cycle Read more
Source§

fn get_max_duty(&self) -> Result<Self::Duty, Self::Error>

Returns the maximum duty cycle value
Source§

fn set_duty( &mut self, channel: &Self::Channel, duty: Self::Duty, ) -> Result<(), Self::Error>

Sets a new duty cycle
Source§

fn set_period<P>(&mut self, period: P) -> Result<(), Self::Error>
where P: Into<Self::Time>,

Sets a new PWM period
Source§

impl Pwm for CTIMER<Enabled, Attached, Detached, Detached>

Source§

type Channel = Channels1

Enumeration of channels that can be used with this Pwm interface Read more
Source§

type Time = u32

A time unit that can be converted into a human time unit (e.g. seconds)
Source§

type Duty = u32

Type for the duty methods Read more
Source§

fn disable(&mut self, channel: Self::Channel)

Disables a PWM channel
Source§

fn enable(&mut self, channel: Self::Channel)

Enables a PWM channel
Source§

fn get_period(&self) -> Self::Time

Returns the current PWM period
Source§

fn get_duty(&self, channel: Self::Channel) -> Self::Duty

Returns the current duty cycle
Source§

fn get_max_duty(&self) -> Self::Duty

Returns the maximum duty cycle value
Source§

fn set_duty(&mut self, channel: Self::Channel, duty: Self::Duty)

Sets a new duty cycle
Source§

fn set_period<P>(&mut self, period: P)
where P: Into<Self::Time>,

Sets a new PWM period
Source§

impl Pwm for CTIMER<Enabled, Attached, Detached, Detached>

Source§

type Error = Infallible

Enumeration of Pwm errors
Source§

type Channel = Channels1

Enumeration of channels that can be used with this Pwm interface Read more
Source§

type Time = u32

A time unit that can be converted into a human time unit (e.g. seconds)
Source§

type Duty = u32

Type for the duty methods Read more
Source§

fn disable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>

Disables a PWM channel
Source§

fn enable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>

Enables a PWM channel
Source§

fn get_period(&self) -> Result<Self::Time, Self::Error>

Returns the current PWM period
Source§

fn get_duty(&self, channel: &Self::Channel) -> Result<Self::Duty, Self::Error>

Returns the current duty cycle Read more
Source§

fn get_max_duty(&self) -> Result<Self::Duty, Self::Error>

Returns the maximum duty cycle value
Source§

fn set_duty( &mut self, channel: &Self::Channel, duty: Self::Duty, ) -> Result<(), Self::Error>

Sets a new duty cycle
Source§

fn set_period<P>(&mut self, period: P) -> Result<(), Self::Error>
where P: Into<Self::Time>,

Sets a new PWM period

Auto Trait Implementations§

§

impl<State, Channel1State, Channel2State, Channel3State> Freeze for CTIMER<State, Channel1State, Channel2State, Channel3State>
where State: Freeze,

§

impl<State, Channel1State, Channel2State, Channel3State> !RefUnwindSafe for CTIMER<State, Channel1State, Channel2State, Channel3State>

§

impl<State, Channel1State, Channel2State, Channel3State> Send for CTIMER<State, Channel1State, Channel2State, Channel3State>
where State: Send, Channel1State: Send, Channel2State: Send, Channel3State: Send,

§

impl<State, Channel1State, Channel2State, Channel3State> !Sync for CTIMER<State, Channel1State, Channel2State, Channel3State>

§

impl<State, Channel1State, Channel2State, Channel3State> Unpin for CTIMER<State, Channel1State, Channel2State, Channel3State>
where State: Unpin, Channel1State: Unpin, Channel2State: Unpin, Channel3State: Unpin,

§

impl<State, Channel1State, Channel2State, Channel3State> !UnwindSafe for CTIMER<State, Channel1State, Channel2State, Channel3State>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.