Add GPIO Matrix support to Camera driver (#2279)

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
This commit is contained in:
Dominic Fischer 2024-10-07 07:20:06 +01:00 committed by GitHub
parent d3f03042f3
commit 62e991d749
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,7 +84,7 @@ use crate::{
LcdCamPeripheral, LcdCamPeripheral,
Rx, Rx,
}, },
gpio::{InputPin, InputSignal, OutputPin, OutputSignal, Pull}, gpio::{InputSignal, OutputSignal, PeripheralInput, PeripheralOutput, Pull},
lcd_cam::{cam::private::RxPins, private::calculate_clkm, BitOrder, ByteOrder}, lcd_cam::{cam::private::RxPins, private::calculate_clkm, BitOrder, ByteOrder},
peripheral::{Peripheral, PeripheralRef}, peripheral::{Peripheral, PeripheralRef},
peripherals::LCD_CAM, peripherals::LCD_CAM,
@ -241,7 +241,10 @@ impl<'d, CH: DmaChannel> Camera<'d, CH> {
} }
/// Configures the master clock (MCLK) pin for the camera interface. /// Configures the master clock (MCLK) pin for the camera interface.
pub fn with_master_clock<MCLK: OutputPin>(self, mclk: impl Peripheral<P = MCLK> + 'd) -> Self { pub fn with_master_clock<MCLK: PeripheralOutput>(
self,
mclk: impl Peripheral<P = MCLK> + 'd,
) -> Self {
crate::into_ref!(mclk); crate::into_ref!(mclk);
mclk.set_to_push_pull_output(crate::private::Internal); mclk.set_to_push_pull_output(crate::private::Internal);
mclk.connect_peripheral_to_output(OutputSignal::CAM_CLK, crate::private::Internal); mclk.connect_peripheral_to_output(OutputSignal::CAM_CLK, crate::private::Internal);
@ -249,7 +252,10 @@ impl<'d, CH: DmaChannel> Camera<'d, CH> {
} }
/// Configures the pixel clock (PCLK) pin for the camera interface. /// Configures the pixel clock (PCLK) pin for the camera interface.
pub fn with_pixel_clock<PCLK: InputPin>(self, pclk: impl Peripheral<P = PCLK> + 'd) -> Self { pub fn with_pixel_clock<PCLK: PeripheralInput>(
self,
pclk: impl Peripheral<P = PCLK> + 'd,
) -> Self {
crate::into_ref!(pclk); crate::into_ref!(pclk);
pclk.init_input(Pull::None, crate::private::Internal); pclk.init_input(Pull::None, crate::private::Internal);
@ -260,7 +266,7 @@ impl<'d, CH: DmaChannel> Camera<'d, CH> {
/// Configures the control pins for the camera interface (VSYNC and /// Configures the control pins for the camera interface (VSYNC and
/// HENABLE). /// HENABLE).
pub fn with_ctrl_pins<VSYNC: InputPin, HENABLE: InputPin>( pub fn with_ctrl_pins<VSYNC: PeripheralInput, HENABLE: PeripheralInput>(
self, self,
vsync: impl Peripheral<P = VSYNC> + 'd, vsync: impl Peripheral<P = VSYNC> + 'd,
h_enable: impl Peripheral<P = HENABLE> + 'd, h_enable: impl Peripheral<P = HENABLE> + 'd,
@ -282,7 +288,11 @@ impl<'d, CH: DmaChannel> Camera<'d, CH> {
/// Configures the control pins for the camera interface (VSYNC, HSYNC, and /// Configures the control pins for the camera interface (VSYNC, HSYNC, and
/// HENABLE) with DE (data enable). /// HENABLE) with DE (data enable).
pub fn with_ctrl_pins_and_de<VSYNC: InputPin, HSYNC: InputPin, HENABLE: InputPin>( pub fn with_ctrl_pins_and_de<
VSYNC: PeripheralInput,
HSYNC: PeripheralInput,
HENABLE: PeripheralInput,
>(
self, self,
vsync: impl Peripheral<P = VSYNC> + 'd, vsync: impl Peripheral<P = VSYNC> + 'd,
hsync: impl Peripheral<P = HSYNC> + 'd, hsync: impl Peripheral<P = HSYNC> + 'd,
@ -491,14 +501,14 @@ impl RxEightBits {
pin_7: impl Peripheral<P = P7> + 'd, pin_7: impl Peripheral<P = P7> + 'd,
) -> Self ) -> Self
where where
P0: InputPin, P0: PeripheralInput,
P1: InputPin, P1: PeripheralInput,
P2: InputPin, P2: PeripheralInput,
P3: InputPin, P3: PeripheralInput,
P4: InputPin, P4: PeripheralInput,
P5: InputPin, P5: PeripheralInput,
P6: InputPin, P6: PeripheralInput,
P7: InputPin, P7: PeripheralInput,
{ {
crate::into_ref!(pin_0); crate::into_ref!(pin_0);
crate::into_ref!(pin_1); crate::into_ref!(pin_1);
@ -563,22 +573,22 @@ impl RxSixteenBits {
pin_15: impl Peripheral<P = P15> + 'd, pin_15: impl Peripheral<P = P15> + 'd,
) -> Self ) -> Self
where where
P0: InputPin, P0: PeripheralInput,
P1: InputPin, P1: PeripheralInput,
P2: InputPin, P2: PeripheralInput,
P3: InputPin, P3: PeripheralInput,
P4: InputPin, P4: PeripheralInput,
P5: InputPin, P5: PeripheralInput,
P6: InputPin, P6: PeripheralInput,
P7: InputPin, P7: PeripheralInput,
P8: InputPin, P8: PeripheralInput,
P9: InputPin, P9: PeripheralInput,
P10: InputPin, P10: PeripheralInput,
P11: InputPin, P11: PeripheralInput,
P12: InputPin, P12: PeripheralInput,
P13: InputPin, P13: PeripheralInput,
P14: InputPin, P14: PeripheralInput,
P15: InputPin, P15: PeripheralInput,
{ {
crate::into_ref!(pin_0); crate::into_ref!(pin_0);
crate::into_ref!(pin_1); crate::into_ref!(pin_1);