embassy-stm32

Crates

git

Versions

stm32n645a0

Flavors

Pipe1

Struct Pipe1 

Source
pub struct Pipe1<'d, T: Instance> { /* private fields */ }
Expand description

Handle to DCMIPP Pipe1 (main ISP + format conversion). Obtained from Dcmipp::split.

Implementations§

Source§

impl<'d, T: Instance> Pipe1<'d, T>

Source

pub fn configure(&mut self, cfg: &Pipe1Config)

Configure Pipe1: input, VC, output format, pitch, optional demosaic, optional crop, optional downsize. Leaves the pipe disabled.

Source

pub async fn capture(&mut self, buffer: *mut u8) -> Result<(), Error>

Arm a single-shot capture. buffer must be 16-byte aligned.

Source

pub unsafe fn start_continuous(&mut self, buf_a: *mut u8, buf_b: *mut u8)

Start continuous double-buffered capture.

§Safety

Both buffers must remain valid and uniquely-owned until stop is called.

Source

pub async fn wait_frame(&mut self) -> Result<u8, Error>

Wait for the next frame. Returns the buffer index (0 or 1).

Source

pub fn stop(&mut self)

Stop whatever capture is running on Pipe1.

Source

pub fn set_color_gains(&mut self, gains: ChannelGains)

Program the colour-conversion matrix as a diagonal gain matrix and enable it. Off-diagonal coefficients and the offset column are zeroed. Re-callable while streaming — the new matrix latches at the next frame boundary.

This shares hardware with set_color_matrix; calling either after the other replaces the previous CCM. Use set_color_matrix for full 3×3 colour correction (and to keep WB+CCM separate by applying WB at the sensor / via the demosaic stage instead).

Source

pub fn set_color_matrix(&mut self, m: ColorMatrix)

Program the full 3×3 colour-conversion matrix and enable it.

Hardware applies out = M · in + offset, optionally clamped to 8-bit unsigned. Coefficients are encoded in 11-bit signed Q2.8 (range -4.0 ..= +3.996); offsets are 10-bit signed integers (range -512 ..= 511) added to the matrix product.

Re-callable while streaming — the new matrix latches at the next frame boundary. Shares hardware with set_color_gains; the last call wins.

Source

pub fn disable_color_matrix(&mut self)

Disable the colour-conversion matrix entirely (skip the stage in the ISP pipeline). After this call, neither set_color_gains nor set_color_matrix state is applied until called again.

Source

pub fn set_gamma_enable(&mut self, enable: bool)

Enable / disable Pipe1’s gamma stage (a fixed sRGB-2.2 curve in hardware — there is no programmable LUT). Re-callable while streaming.

Source

pub fn enable_rgb_stats(&mut self, width: u16, height: u16)

Configure the three statistics extractors to compute the per-frame mean of the post-demosaic R, G, B channels over the full Pipe1 output rectangle. Call once before streaming starts; the hardware then refreshes the result registers at every end-of-frame.

Source

pub fn read_rgb_means(&self) -> (u32, u32, u32)

Read the most recently latched per-channel means (P1ST{1,2,3}SR.accu). Returns (mean_r, mean_g, mean_b). Each value is the channel sum over the configured stats window divided by 256, per the metapac register description. Call only after enable_rgb_stats and at least one captured frame.

Trait Implementations§

Source§

impl<'d, T: Instance> Drop for Pipe1<'d, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'d, T> Freeze for Pipe1<'d, T>

§

impl<'d, T> RefUnwindSafe for Pipe1<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for Pipe1<'d, T>

§

impl<'d, T> Sync for Pipe1<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for Pipe1<'d, T>

§

impl<'d, T> !UnwindSafe for Pipe1<'d, T>

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.