mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 06:40:47 +00:00
Fix LCD_CAM disabling its clocks (#3007)
This commit is contained in:
parent
53ba3ce95d
commit
5ec8be4af2
@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- `DmaDescriptor` is now `#[repr(C)]` (#2988)
|
||||
- Fixed an issue that caused LCD_CAM drivers to turn off their clocks unexpectedly (#3007)
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -115,6 +115,7 @@ use crate::{
|
||||
},
|
||||
peripheral::{Peripheral, PeripheralRef},
|
||||
peripherals::LCD_CAM,
|
||||
system::{self, GenericPeripheralGuard},
|
||||
Blocking,
|
||||
DriverMode,
|
||||
};
|
||||
@ -131,6 +132,7 @@ pub enum ConfigError {
|
||||
pub struct Dpi<'d, Dm: DriverMode> {
|
||||
lcd_cam: PeripheralRef<'d, LCD_CAM>,
|
||||
tx_channel: ChannelTx<'d, Blocking, PeripheralTxChannel<LCD_CAM>>,
|
||||
_guard: GenericPeripheralGuard<{ system::Peripheral::LcdCam as u8 }>,
|
||||
_mode: PhantomData<Dm>,
|
||||
}
|
||||
|
||||
@ -152,6 +154,7 @@ where
|
||||
let mut this = Self {
|
||||
lcd_cam: lcd.lcd_cam,
|
||||
tx_channel,
|
||||
_guard: lcd._guard,
|
||||
_mode: PhantomData,
|
||||
};
|
||||
|
||||
|
@ -79,6 +79,7 @@ use crate::{
|
||||
},
|
||||
peripheral::{Peripheral, PeripheralRef},
|
||||
peripherals::LCD_CAM,
|
||||
system::{self, GenericPeripheralGuard},
|
||||
Blocking,
|
||||
DriverMode,
|
||||
};
|
||||
@ -95,6 +96,7 @@ pub enum ConfigError {
|
||||
pub struct I8080<'d, Dm: DriverMode> {
|
||||
lcd_cam: PeripheralRef<'d, LCD_CAM>,
|
||||
tx_channel: ChannelTx<'d, Blocking, PeripheralTxChannel<LCD_CAM>>,
|
||||
_guard: GenericPeripheralGuard<{ system::Peripheral::LcdCam as u8 }>,
|
||||
_mode: PhantomData<Dm>,
|
||||
}
|
||||
|
||||
@ -118,6 +120,7 @@ where
|
||||
let mut this = Self {
|
||||
lcd_cam: lcd.lcd_cam,
|
||||
tx_channel,
|
||||
_guard: lcd._guard,
|
||||
_mode: PhantomData,
|
||||
};
|
||||
|
||||
|
@ -1066,12 +1066,14 @@ impl PeripheralClockControl {
|
||||
if enable {
|
||||
let prev = *ref_count;
|
||||
*ref_count += 1;
|
||||
trace!("Enable {:?} {} -> {}", peripheral, prev, *ref_count);
|
||||
if prev > 0 {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
let prev = *ref_count;
|
||||
*ref_count -= 1;
|
||||
trace!("Disable {:?} {} -> {}", peripheral, prev, *ref_count);
|
||||
if prev > 1 {
|
||||
return false;
|
||||
}
|
||||
|
@ -147,6 +147,10 @@ mod tests {
|
||||
.with_cs(cs_signal)
|
||||
.with_ctrl_pins(NoPin, NoPin);
|
||||
|
||||
// explicitly drop the camera half to see if it disables clocks (unexpectedly,
|
||||
// I8080 should keep it alive)
|
||||
core::mem::drop(ctx.lcd_cam.cam);
|
||||
|
||||
// This is to make the test values look more intuitive.
|
||||
i8080.set_bit_order(BitOrder::Inverted);
|
||||
|
||||
|
@ -58,6 +58,10 @@ mod tests {
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
// explicitly drop the camera half to see if it disables clocks (unexpectedly,
|
||||
// I8080 should keep it alive)
|
||||
core::mem::drop(ctx.lcd_cam.cam);
|
||||
|
||||
let mut transfer = i8080.send(Command::<u8>::None, 0, ctx.dma_buf).unwrap();
|
||||
|
||||
transfer.wait_for_done().await;
|
||||
|
Loading…
x
Reference in New Issue
Block a user