pub struct Ws2812Esp32RmtDriverBuilder<'d> { /* private fields */ }Expand description
Builder for Ws2812Esp32RmtDriver.
§Examples
// WS2812B timing parameters.
const WS2812_T0H_NS: Duration = Duration::from_nanos(400);
const WS2812_T0L_NS: Duration = Duration::from_nanos(850);
const WS2812_T1H_NS: Duration = Duration::from_nanos(800);
const WS2812_T1L_NS: Duration = Duration::from_nanos(450);
let driver_config = TransmitConfig::new()
.clock_divider(1); // Required parameter.
let tx_driver = TxRmtDriver::new(channel, led_pin, &driver_config).unwrap();
let driver = Ws2812Esp32RmtDriverBuilder::new_with_rmt_driver(tx_driver).unwrap()
.encoder_duration(&WS2812_T0H_NS, &WS2812_T0L_NS, &WS2812_T1H_NS, &WS2812_T1L_NS).unwrap()
.build().unwrap();Implementations§
Source§impl<'d> Ws2812Esp32RmtDriverBuilder<'d>
impl<'d> Ws2812Esp32RmtDriverBuilder<'d>
Sourcepub fn new<C: RmtChannel>(
channel: impl Peripheral<P = C> + 'd,
pin: impl Peripheral<P = impl OutputPin> + 'd,
) -> Result<Self, Ws2812Esp32RmtDriverError>
pub fn new<C: RmtChannel>( channel: impl Peripheral<P = C> + 'd, pin: impl Peripheral<P = impl OutputPin> + 'd, ) -> Result<Self, Ws2812Esp32RmtDriverError>
Creates a new Ws2812Esp32RmtDriverBuilder.
Sourcepub fn new_with_rmt_driver(
tx: TxRmtDriver<'d>,
) -> Result<Self, Ws2812Esp32RmtDriverError>
pub fn new_with_rmt_driver( tx: TxRmtDriver<'d>, ) -> Result<Self, Ws2812Esp32RmtDriverError>
Creates a new Ws2812Esp32RmtDriverBuilder with TxRmtDriver.
Sourcepub fn encoder_duration(
self,
t0h: &Duration,
t0l: &Duration,
t1h: &Duration,
t1l: &Duration,
) -> Result<Self, Ws2812Esp32RmtDriverError>
pub fn encoder_duration( self, t0h: &Duration, t0l: &Duration, t1h: &Duration, t1l: &Duration, ) -> Result<Self, Ws2812Esp32RmtDriverError>
Sets the encoder duration times.
§Arguments
clock_hz- The clock frequency.t0h- T0H duration time (0 code, high voltage time)t0l- T0L duration time (0 code, low voltage time)t1h- T1H duration time (1 code, high voltage time)t1l- T1L duration time (1 code, low voltage time)
§Errors
Returns an error if the encoder initialization failed.
Sourcepub fn build(
self,
) -> Result<Ws2812Esp32RmtDriver<'d>, Ws2812Esp32RmtDriverError>
pub fn build( self, ) -> Result<Ws2812Esp32RmtDriver<'d>, Ws2812Esp32RmtDriverError>
Builds the Ws2812Esp32RmtDriver.
Auto Trait Implementations§
impl<'d> Freeze for Ws2812Esp32RmtDriverBuilder<'d>
impl<'d> RefUnwindSafe for Ws2812Esp32RmtDriverBuilder<'d>
impl<'d> Send for Ws2812Esp32RmtDriverBuilder<'d>
impl<'d> Sync for Ws2812Esp32RmtDriverBuilder<'d>
impl<'d> Unpin for Ws2812Esp32RmtDriverBuilder<'d>
impl<'d> !UnwindSafe for Ws2812Esp32RmtDriverBuilder<'d>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.