Expose optional HSYNC input in LCD_CAM (#1707)
* Expose optional HSYNC input in LCD_CAM * Fix DMA wait check in LCD_CAM --------- Co-authored-by: Dominic Fischer <git@dominicfischer.me>
This commit is contained in:
parent
bdd3e93de2
commit
fc826caf18
@ -16,12 +16,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Add new `DmaError::UnsupportedMemoryRegion` - used memory regions are checked when preparing a transfer now (#1670)
|
||||
- Add DmaTransactionTxOwned, DmaTransactionRxOwned, DmaTransactionTxRxOwned, functions to do owning transfers added to SPI half-duplex (#1672)
|
||||
- uart: Implement `embedded_io::ReadReady` for `Uart` and `UartRx` (#1702)
|
||||
- ESP32-S3: Expose optional HSYNC input in LCD_CAM (#1707)
|
||||
- ESP32-C6: Support lp-core as wake-up source (#1723)
|
||||
- Add support for GPIO wake-up source (#1724)
|
||||
- Add `uart` wake source (#1727)
|
||||
|
||||
### Fixed
|
||||
|
||||
- ESP32-S3: Fix DMA waiting check in LCD_CAM (#1707)
|
||||
- TIMG: Fix interrupt handler setup (#1714)
|
||||
- Fix `sleep_light` for ESP32-C6 (#1720)
|
||||
- ROM Functions: Fix address of `ets_update_cpu_frequency_rom` (#1722)
|
||||
|
||||
@ -57,7 +57,8 @@
|
||||
//! )
|
||||
//! // Remove this for slave mode.
|
||||
//! .with_master_clock(mclk_pin)
|
||||
//! .with_ctrl_pins(vsync_pin, href_pin, pclk_pin);
|
||||
//! .with_pixel_clock(pclk_pin)
|
||||
//! .with_ctrl_pins(vsync_pin, href_pin);
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
@ -212,14 +213,22 @@ where
|
||||
|
||||
impl<'d, RX: Rx> DmaSupport for Camera<'d, RX> {
|
||||
fn peripheral_wait_dma(&mut self, _is_tx: bool, _is_rx: bool) {
|
||||
while !
|
||||
// Wait for IN_SUC_EOF (i.e. VSYNC)
|
||||
self.rx_channel.is_done() ||
|
||||
// Or for IN_DSCR_EMPTY (i.e. No more buffer space)
|
||||
self.rx_channel.has_dscr_empty_error() ||
|
||||
// Or for IN_DSCR_ERR (i.e. bad descriptor)
|
||||
self.rx_channel.has_error()
|
||||
{}
|
||||
loop {
|
||||
// Wait for IN_SUC_EOF (i.e. VSYNC)
|
||||
if self.rx_channel.is_done() {
|
||||
break;
|
||||
}
|
||||
|
||||
// Or for IN_DSCR_EMPTY (i.e. No more buffer space)
|
||||
if self.rx_channel.has_dscr_empty_error() {
|
||||
break;
|
||||
}
|
||||
|
||||
// Or for IN_DSCR_ERR (i.e. bad descriptor)
|
||||
if self.rx_channel.has_error() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn peripheral_dma_stop(&mut self) {
|
||||
@ -288,22 +297,55 @@ impl<'d, RX: Rx> Camera<'d, RX> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_ctrl_pins<VSYNC: InputPin, HENABLE: InputPin, PCLK: InputPin>(
|
||||
pub fn with_pixel_clock<PCLK: InputPin>(self, pclk: impl Peripheral<P = PCLK> + 'd) -> Self {
|
||||
crate::into_ref!(pclk);
|
||||
|
||||
pclk.set_to_input(crate::private::Internal);
|
||||
pclk.connect_input_to_peripheral(InputSignal::CAM_PCLK, crate::private::Internal);
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_ctrl_pins<VSYNC: InputPin, HENABLE: InputPin>(
|
||||
self,
|
||||
vsync: impl Peripheral<P = VSYNC> + 'd,
|
||||
h_enable: impl Peripheral<P = HENABLE> + 'd,
|
||||
pclk: impl Peripheral<P = PCLK> + 'd,
|
||||
) -> Self {
|
||||
crate::into_ref!(vsync);
|
||||
crate::into_ref!(h_enable);
|
||||
crate::into_ref!(pclk);
|
||||
|
||||
vsync.set_to_input(crate::private::Internal);
|
||||
vsync.connect_input_to_peripheral(InputSignal::CAM_V_SYNC, crate::private::Internal);
|
||||
h_enable.set_to_input(crate::private::Internal);
|
||||
h_enable.connect_input_to_peripheral(InputSignal::CAM_H_ENABLE, crate::private::Internal);
|
||||
pclk.set_to_input(crate::private::Internal);
|
||||
pclk.connect_input_to_peripheral(InputSignal::CAM_PCLK, crate::private::Internal);
|
||||
|
||||
self.lcd_cam
|
||||
.cam_ctrl1()
|
||||
.modify(|_, w| w.cam_vh_de_mode_en().clear_bit());
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_ctrl_pins_and_de<VSYNC: InputPin, HSYNC: InputPin, HENABLE: InputPin>(
|
||||
self,
|
||||
vsync: impl Peripheral<P = VSYNC> + 'd,
|
||||
hsync: impl Peripheral<P = HSYNC> + 'd,
|
||||
h_enable: impl Peripheral<P = HENABLE> + 'd,
|
||||
) -> Self {
|
||||
crate::into_ref!(vsync);
|
||||
crate::into_ref!(hsync);
|
||||
crate::into_ref!(h_enable);
|
||||
|
||||
vsync.set_to_input(crate::private::Internal);
|
||||
vsync.connect_input_to_peripheral(InputSignal::CAM_V_SYNC, crate::private::Internal);
|
||||
hsync.set_to_input(crate::private::Internal);
|
||||
hsync.connect_input_to_peripheral(InputSignal::CAM_H_SYNC, crate::private::Internal);
|
||||
h_enable.set_to_input(crate::private::Internal);
|
||||
h_enable.connect_input_to_peripheral(InputSignal::CAM_H_ENABLE, crate::private::Internal);
|
||||
|
||||
self.lcd_cam
|
||||
.cam_ctrl1()
|
||||
.modify(|_, w| w.cam_vh_de_mode_en().set_bit());
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
@ -85,7 +85,8 @@ fn main() -> ! {
|
||||
&clocks,
|
||||
)
|
||||
.with_master_clock(cam_xclk)
|
||||
.with_ctrl_pins(cam_vsync, cam_href, cam_pclk);
|
||||
.with_pixel_clock(cam_pclk)
|
||||
.with_ctrl_pins(cam_vsync, cam_href);
|
||||
|
||||
let delay = Delay::new(&clocks);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user