Struct stm32_cec::Cec

source ·
pub struct Cec<const BASE: usize> { /* private fields */ }
Expand description

HDMI-CEC driver.

Implementations§

source§

impl<const BASE: usize> Cec<BASE>

source

pub unsafe fn new() -> Cec<BASE>

Create a new HDMI CEC driver.

§Safety
  1. The HDMI CEC source clock must be enabled.
  2. The HDMI CEC pin must be configured.
  3. The HDMI CEC peripheral should be reset before.
  4. The HDMI CEC registers provided by the PAC should be dropped.
  5. The generic BASE parameter must be correct or bad things will happen.
§Panics

Panics if reading CFGR does not return the value written. This occurs when the HDMI CEC peripheral clocks are not configured correctly.

§Example
use stm32_cec::Cec;

// device specific setup occurs here
// ...

// valid address for the STM32H7
let mut cec: Cec<0x40006C00> = unsafe { Cec::<0x40006C00>::new() };
source

pub fn set_standby(&mut self, src: LogiAddr, dst: LogiAddr) -> Result<(), u32>

Power off devices.

§Example

Turn everything off.

use stm32_cec::{Cec, LogiAddr};

let mut cec = unsafe { stm32_cec::Cec::<0x40006C00>::new() };
cec.set_standby(LogiAddr::Broadcast, LogiAddr::Broadcast)?;
source

pub fn set_image_view_on( &mut self, src: LogiAddr, dst: LogiAddr ) -> Result<(), u32>

Power on the TV.

§Example

Turn everything on.

use stm32_cec::{Cec, LogiAddr};

let mut cec = unsafe { stm32_cec::Cec::<0x40006C00>::new() };
cec.set_image_view_on(LogiAddr::Broadcast, LogiAddr::Broadcast)?;

Trait Implementations§

source§

impl<const BASE: usize> Debug for Cec<BASE>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const BASE: usize> Format for Cec<BASE>
where Regs<BASE>: Format,

source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.

Auto Trait Implementations§

§

impl<const BASE: usize> Freeze for Cec<BASE>

§

impl<const BASE: usize> RefUnwindSafe for Cec<BASE>

§

impl<const BASE: usize> Send for Cec<BASE>

§

impl<const BASE: usize> Sync for Cec<BASE>

§

impl<const BASE: usize> Unpin for Cec<BASE>

§

impl<const BASE: usize> UnwindSafe for Cec<BASE>

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>,

§

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>,

§

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.