Skip to content

Commit

Permalink
Change config argument to be a reference
Browse files Browse the repository at this point in the history
  • Loading branch information
GamerBene19 committed Sep 9, 2024
1 parent 76289a1 commit 4d34e0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/temp_sensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ pub struct TemperatureSensorDriver {
}

impl TemperatureSensorDriver {
pub fn new(config: TemperatureSensorConfig) -> Result<Self, EspError> {
pub fn new(config: &TemperatureSensorConfig) -> Result<Self, EspError> {
let mut sensor = core::ptr::null_mut();
esp!(unsafe { temperature_sensor_install(&config.into(), &mut sensor) })?;
esp!(unsafe { temperature_sensor_install(&config.clone().into(), &mut sensor) })?;
Ok(TemperatureSensorDriver { ptr: sensor })
}

Expand Down

0 comments on commit 4d34e0e

Please sign in to comment.