From bdd68382b61c75eaf36909c478f92698ce112029 Mon Sep 17 00:00:00 2001 From: Fabio Mendes Date: Fri, 4 Oct 2024 10:54:13 -0400 Subject: [PATCH] Change receiver type for consistency --- src/wiegand.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wiegand.rs b/src/wiegand.rs index e3de6e7..d8ffb1a 100644 --- a/src/wiegand.rs +++ b/src/wiegand.rs @@ -178,8 +178,8 @@ impl Reader { Ok((boxed, reader_rx)) } - fn init(reader: &mut Self) -> anyhow::Result<()> { - let reader_ptr = reader as *mut _ as *mut c_void; + fn init(&mut self) -> anyhow::Result<()> { + let reader_ptr = self as *mut _ as *mut c_void; let timer_config = esp_timer_create_args_t { name: CString::new("wiegand")?.into_raw(), @@ -189,11 +189,11 @@ impl Reader { skip_unhandled_events: true, }; - esp!(unsafe { esp_timer_create(&timer_config, &mut reader.timer) })?; + esp!(unsafe { esp_timer_create(&timer_config, &mut self.timer) })?; // Configures d0 and d1 let io_conf = gpio_config_t { - pin_bit_mask: (1 << reader.d0_gpio.pin() | 1 << reader.d1_gpio.pin()), + pin_bit_mask: (1 << self.d0_gpio.pin() | 1 << self.d1_gpio.pin()), mode: gpio_mode_t_GPIO_MODE_INPUT, pull_up_en: true.into(), pull_down_en: false.into(), @@ -207,12 +207,12 @@ impl Reader { // Registers our function with the generic GPIO interrupt handler // This assumes gpio_install_isr_service was called before esp!(gpio_isr_handler_add( - reader.d0_gpio.pin(), + self.d0_gpio.pin(), Some(wiegand_interrupt::), reader_ptr ))?; esp!(gpio_isr_handler_add( - reader.d1_gpio.pin(), + self.d1_gpio.pin(), Some(wiegand_interrupt::), reader_ptr ))?;