Kaynağa Gözat

AS7331 - I2C: prevent passing `FuriHalI2cBusHandle` to functions as future firmware uses `const` version

- Prevent passing mutable I2C bus handle to API functions.
- Align code with upcoming firmware change that makes FuriHalI2cBusHandle const.
Michael Baisch 9 ay önce
ebeveyn
işleme
6f36f65bd6
2 değiştirilmiş dosya ile 55 ekleme ve 63 silme
  1. 30 34
      AS7331.cpp
  2. 25 29
      AS7331.hpp

+ 30 - 34
AS7331.cpp

@@ -113,7 +113,7 @@ bool AS7331::setGain(const as7331_gain_t& gain) {
     }
     }
 
 
     // Read CREG1
     // Read CREG1
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgCreg1, creg1.byte)) {
+    if(!readRegister(RegCfgCreg1, creg1.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read CREG1 register from device.");
         FURI_LOG_E("AS7331", "Failed to read CREG1 register from device.");
         return false;
         return false;
@@ -121,7 +121,7 @@ bool AS7331::setGain(const as7331_gain_t& gain) {
 
 
     // Write new gain value
     // Write new gain value
     creg1.gain = gain;
     creg1.gain = gain;
-    if(!writeRegister(furi_hal_i2c_handle_external, RegCfgCreg1, creg1.byte)) {
+    if(!writeRegister(RegCfgCreg1, creg1.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to write gain value to device: %d.", creg1.gain);
         FURI_LOG_E("AS7331", "Failed to write gain value to device: %d.", creg1.gain);
         return false;
         return false;
@@ -173,7 +173,7 @@ bool AS7331::setIntegrationTime(const as7331_integration_time_t& time) {
     }
     }
 
 
     // Read CREG1
     // Read CREG1
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgCreg1, creg1.byte)) {
+    if(!readRegister(RegCfgCreg1, creg1.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read CREG1 register from device.");
         FURI_LOG_E("AS7331", "Failed to read CREG1 register from device.");
         return false;
         return false;
@@ -181,7 +181,7 @@ bool AS7331::setIntegrationTime(const as7331_integration_time_t& time) {
 
 
     // Write new integration time value
     // Write new integration time value
     creg1.integration_time = time;
     creg1.integration_time = time;
-    if(!writeRegister(furi_hal_i2c_handle_external, RegCfgCreg1, creg1.byte)) {
+    if(!writeRegister(RegCfgCreg1, creg1.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E(
         FURI_LOG_E(
             "AS7331",
             "AS7331",
@@ -218,7 +218,7 @@ bool AS7331::setDivider(const as7331_divider_t& divider, const bool enable) {
     }
     }
 
 
     // Read CREG2
     // Read CREG2
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgCreg2, creg2.byte)) {
+    if(!readRegister(RegCfgCreg2, creg2.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read CREG2 register from device.");
         FURI_LOG_E("AS7331", "Failed to read CREG2 register from device.");
         return false;
         return false;
@@ -227,7 +227,7 @@ bool AS7331::setDivider(const as7331_divider_t& divider, const bool enable) {
     // Write new divider value and enable/disable it
     // Write new divider value and enable/disable it
     creg2.divider = divider;
     creg2.divider = divider;
     creg2.enable_divider = enable;
     creg2.enable_divider = enable;
-    if(!writeRegister(furi_hal_i2c_handle_external, RegCfgCreg2, creg2.byte)) {
+    if(!writeRegister(RegCfgCreg2, creg2.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E(
         FURI_LOG_E(
             "AS7331",
             "AS7331",
@@ -266,7 +266,7 @@ bool AS7331::setClockFrequency(const as7331_clock_frequency_t& frequency) {
     }
     }
 
 
     // Read CREG3
     // Read CREG3
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgCreg3, creg3.byte)) {
+    if(!readRegister(RegCfgCreg3, creg3.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read CREG3 register from device.");
         FURI_LOG_E("AS7331", "Failed to read CREG3 register from device.");
         return false;
         return false;
@@ -274,7 +274,7 @@ bool AS7331::setClockFrequency(const as7331_clock_frequency_t& frequency) {
 
 
     // Write new clock frequency value
     // Write new clock frequency value
     creg3.clock_frequency = frequency;
     creg3.clock_frequency = frequency;
-    if(!writeRegister(furi_hal_i2c_handle_external, RegCfgCreg3, creg3.byte)) {
+    if(!writeRegister(RegCfgCreg3, creg3.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E(
         FURI_LOG_E(
             "AS7331",
             "AS7331",
@@ -311,7 +311,7 @@ bool AS7331::setMeasurementMode(const as7331_measurement_mode_t& mode) {
     }
     }
 
 
     // Read CREG3
     // Read CREG3
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgCreg3, creg3.byte)) {
+    if(!readRegister(RegCfgCreg3, creg3.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read CREG3 register from device.");
         FURI_LOG_E("AS7331", "Failed to read CREG3 register from device.");
         return false;
         return false;
@@ -319,7 +319,7 @@ bool AS7331::setMeasurementMode(const as7331_measurement_mode_t& mode) {
 
 
     // Write new measurement mode value
     // Write new measurement mode value
     creg3.measurement_mode = mode;
     creg3.measurement_mode = mode;
-    if(!writeRegister(furi_hal_i2c_handle_external, RegCfgCreg3, creg3.byte)) {
+    if(!writeRegister(RegCfgCreg3, creg3.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E(
         FURI_LOG_E(
             "AS7331", "Failed to write measurement mode to device: %d.", creg3.measurement_mode);
             "AS7331", "Failed to write measurement mode to device: %d.", creg3.measurement_mode);
@@ -390,7 +390,7 @@ bool AS7331::setStandby(const bool& standby) {
     }
     }
 
 
     // Read CREG3
     // Read CREG3
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgCreg3, creg3.byte)) {
+    if(!readRegister(RegCfgCreg3, creg3.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read CREG3 register from device.");
         FURI_LOG_E("AS7331", "Failed to read CREG3 register from device.");
         return false;
         return false;
@@ -401,7 +401,7 @@ bool AS7331::setStandby(const bool& standby) {
         creg3.standby = standby; // Set SB bit
         creg3.standby = standby; // Set SB bit
 
 
         // Write back the CREG3 register
         // Write back the CREG3 register
-        if(!writeRegister(furi_hal_i2c_handle_external, RegCfgCreg3, creg3.byte)) {
+        if(!writeRegister(RegCfgCreg3, creg3.byte)) {
             furi_hal_i2c_release(&furi_hal_i2c_handle_external);
             furi_hal_i2c_release(&furi_hal_i2c_handle_external);
             FURI_LOG_E("AS7331", "Failed to write standby state to device: %d.", standby);
             FURI_LOG_E("AS7331", "Failed to write standby state to device: %d.", standby);
             return false;
             return false;
@@ -507,7 +507,7 @@ bool AS7331::getRawResults(RawResults& rawResults) {
     }
     }
 
 
     // Read all measurement results in one I²C transaction
     // Read all measurement results in one I²C transaction
-    if(!readRegisters(furi_hal_i2c_handle_external, RegMeasResultA, buffer, 6)) {
+    if(!readRegisters(RegMeasResultA, buffer, 6)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read measurement results from device.");
         FURI_LOG_E("AS7331", "Failed to read measurement results from device.");
         return false;
         return false;
@@ -606,7 +606,7 @@ bool AS7331::getTemperature(double& temperature) {
     }
     }
 
 
     // Read temperature register
     // Read temperature register
-    if(!readRegister16(furi_hal_i2c_handle_external, RegMeasTemp, temperature_raw)) {
+    if(!readRegister16(RegMeasTemp, temperature_raw)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read temperature register from device.");
         FURI_LOG_E("AS7331", "Failed to read temperature register from device.");
         return false;
         return false;
@@ -680,7 +680,7 @@ bool AS7331::reset() {
 bool AS7331::getDeviceID(as7331_agen_reg_t& deviceID) {
 bool AS7331::getDeviceID(as7331_agen_reg_t& deviceID) {
     furi_hal_i2c_acquire(&furi_hal_i2c_handle_external);
     furi_hal_i2c_acquire(&furi_hal_i2c_handle_external);
 
 
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgAgen, deviceID.byte)) {
+    if(!readRegister(RegCfgAgen, deviceID.byte)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read device ID register from device.");
         FURI_LOG_E("AS7331", "Failed to read device ID register from device.");
         return false;
         return false;
@@ -702,7 +702,7 @@ bool AS7331::getStatus(as7331_osr_status_reg_t& status) {
         return false;
         return false;
     }
     }
 
 
-    if(!readRegister16(furi_hal_i2c_handle_external, RegMeasOsrStatus, status.word)) {
+    if(!readRegister16(RegMeasOsrStatus, status.word)) {
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         furi_hal_i2c_release(&furi_hal_i2c_handle_external);
         FURI_LOG_E("AS7331", "Failed to read status register from device.");
         FURI_LOG_E("AS7331", "Failed to read status register from device.");
         return false;
         return false;
@@ -840,7 +840,7 @@ bool AS7331::setDeviceMode(const as7331_device_mode_t& mode) {
 
 
 // Read OSR register and update local config
 // Read OSR register and update local config
 bool AS7331::readOSRRegister(as7331_osr_reg_t& osr) {
 bool AS7331::readOSRRegister(as7331_osr_reg_t& osr) {
-    if(!readRegister(furi_hal_i2c_handle_external, RegCfgOsr, osr.byte)) {
+    if(!readRegister(RegCfgOsr, osr.byte)) {
         FURI_LOG_E("AS7331", "Failed to read OSR Register from device.");
         FURI_LOG_E("AS7331", "Failed to read OSR Register from device.");
         return false;
         return false;
     }
     }
@@ -866,7 +866,7 @@ bool AS7331::writeOSRRegister(const as7331_osr_reg_t& osr) {
     }
     }
 
 
     // Write back OSR register
     // Write back OSR register
-    if(!writeRegister(furi_hal_i2c_handle_external, RegCfgOsr, osr.byte)) {
+    if(!writeRegister(RegCfgOsr, osr.byte)) {
         FURI_LOG_E("AS7331", "Failed to write OSR to device: %d.", osr.byte);
         FURI_LOG_E("AS7331", "Failed to write OSR to device: %d.", osr.byte);
         return false;
         return false;
     }
     }
@@ -879,16 +879,12 @@ bool AS7331::writeOSRRegister(const as7331_osr_reg_t& osr) {
 }
 }
 
 
 // Generalized method to read multiple bytes from consecutive registers
 // Generalized method to read multiple bytes from consecutive registers
-bool AS7331::readRegisters(
-    FuriHalI2cBusHandle& handle,
-    uint8_t start_register_addr,
-    uint8_t* buffer,
-    size_t length) {
+bool AS7331::readRegisters(uint8_t start_register_addr, uint8_t* buffer, size_t length) {
     bool success;
     bool success;
 
 
     // Write Phase: Send the start register address, end with AwaitRestart
     // Write Phase: Send the start register address, end with AwaitRestart
     success = furi_hal_i2c_tx_ext(
     success = furi_hal_i2c_tx_ext(
-        &handle,
+        &furi_hal_i2c_handle_external,
         _i2c_addr_8bit,
         _i2c_addr_8bit,
         false, // 7-bit address
         false, // 7-bit address
         &start_register_addr,
         &start_register_addr,
@@ -903,7 +899,7 @@ bool AS7331::readRegisters(
 
 
     // Read Phase: Read the data, begin with Restart, end with Stop
     // Read Phase: Read the data, begin with Restart, end with Stop
     success = furi_hal_i2c_rx_ext(
     success = furi_hal_i2c_rx_ext(
-        &handle,
+        &furi_hal_i2c_handle_external,
         _i2c_addr_8bit,
         _i2c_addr_8bit,
         false, // 7-bit address
         false, // 7-bit address
         buffer,
         buffer,
@@ -920,14 +916,14 @@ bool AS7331::readRegisters(
 }
 }
 
 
 // Function to read an 8-bit register
 // Function to read an 8-bit register
-bool AS7331::readRegister(FuriHalI2cBusHandle& handle, uint8_t register_addr, uint8_t& data) {
-    return readRegisters(handle, register_addr, &data, 1);
+bool AS7331::readRegister(uint8_t register_addr, uint8_t& data) {
+    return readRegisters(register_addr, &data, 1);
 }
 }
 
 
 // Function to read a 16-bit register
 // Function to read a 16-bit register
-bool AS7331::readRegister16(FuriHalI2cBusHandle& handle, uint8_t register_addr, uint16_t& data) {
+bool AS7331::readRegister16(uint8_t register_addr, uint16_t& data) {
     uint8_t buffer[2];
     uint8_t buffer[2];
-    bool success = readRegisters(handle, register_addr, buffer, 2);
+    bool success = readRegisters(register_addr, buffer, 2);
     if(!success) {
     if(!success) {
         return false;
         return false;
     }
     }
@@ -939,13 +935,13 @@ bool AS7331::readRegister16(FuriHalI2cBusHandle& handle, uint8_t register_addr,
 }
 }
 
 
 // Function to write an 8-bit register
 // Function to write an 8-bit register
-bool AS7331::writeRegister(FuriHalI2cBusHandle& handle, uint8_t register_addr, const uint8_t& data) {
+bool AS7331::writeRegister(uint8_t register_addr, const uint8_t& data) {
     bool success;
     bool success;
     uint8_t buffer[2] = {register_addr, data};
     uint8_t buffer[2] = {register_addr, data};
 
 
     // Write the register address and data in one transaction
     // Write the register address and data in one transaction
     success = furi_hal_i2c_tx_ext(
     success = furi_hal_i2c_tx_ext(
-        &handle,
+        &furi_hal_i2c_handle_external,
         _i2c_addr_8bit,
         _i2c_addr_8bit,
         false, // 7-bit address
         false, // 7-bit address
         buffer,
         buffer,
@@ -1001,9 +997,9 @@ bool AS7331::updateLocalConfig() {
     success &= setDeviceMode(DEVICE_MODE_CONFIG);
     success &= setDeviceMode(DEVICE_MODE_CONFIG);
 
 
     // Read configuration registers
     // Read configuration registers
-    success &= readRegister(furi_hal_i2c_handle_external, RegCfgCreg1, creg1.byte);
-    success &= readRegister(furi_hal_i2c_handle_external, RegCfgCreg2, creg2.byte);
-    success &= readRegister(furi_hal_i2c_handle_external, RegCfgCreg3, creg3.byte);
+    success &= readRegister(RegCfgCreg1, creg1.byte);
+    success &= readRegister(RegCfgCreg2, creg2.byte);
+    success &= readRegister(RegCfgCreg3, creg3.byte);
 
 
     furi_hal_i2c_release(&furi_hal_i2c_handle_external);
     furi_hal_i2c_release(&furi_hal_i2c_handle_external);
 
 

+ 25 - 29
AS7331.hpp

@@ -154,7 +154,11 @@ enum as7331_measurement_mode_t : uint8_t {
 };
 };
 
 
 /** @brief UV Type Selection */
 /** @brief UV Type Selection */
-enum as7331_uv_type_t : uint8_t { UV_A, UV_B, UV_C };
+enum as7331_uv_type_t : uint8_t {
+    UV_A,
+    UV_B,
+    UV_C
+};
 
 
 /** @} */ // End of AS7331_Enums group
 /** @} */ // End of AS7331_Enums group
 
 
@@ -175,11 +179,11 @@ const uint8_t RegCfgOsr = 0x00;
 typedef union {
 typedef union {
     struct {
     struct {
         as7331_device_mode_t
         as7331_device_mode_t
-            operating_state : 3; /**< DOS (010) - Device Operating State (OSR[2:0]) */
+            operating_state    : 3; /**< DOS (010) - Device Operating State (OSR[2:0]) */
         uint8_t software_reset : 1; /**< SW_RES (0) - Software Reset (OSR[3]) */
         uint8_t software_reset : 1; /**< SW_RES (0) - Software Reset (OSR[3]) */
-        uint8_t reserved : 2; /**< Reserved, do not write (OSR[5:4]) */
-        uint8_t power_down : 1; /**< PD (1) - Power Down (OSR[6]) */
-        uint8_t start_state : 1; /**< SS (0) - Start State (OSR[7]) */
+        uint8_t reserved       : 2; /**< Reserved, do not write (OSR[5:4]) */
+        uint8_t power_down     : 1; /**< PD (1) - Power Down (OSR[6]) */
+        uint8_t start_state    : 1; /**< SS (0) - Start State (OSR[7]) */
     };
     };
     uint8_t byte;
     uint8_t byte;
 } as7331_osr_reg_t;
 } as7331_osr_reg_t;
@@ -209,7 +213,7 @@ typedef union {
     struct {
     struct {
         as7331_integration_time_t
         as7331_integration_time_t
             integration_time : 4; /**< TIME (0110) - Integration time (CREG1[3:0]) */
             integration_time : 4; /**< TIME (0110) - Integration time (CREG1[3:0]) */
-        as7331_gain_t gain : 4; /**< GAIN (1010) - Sensor gain (CREG1[7:4]) */
+        as7331_gain_t gain   : 4; /**< GAIN (1010) - Sensor gain (CREG1[7:4]) */
     };
     };
     uint8_t byte;
     uint8_t byte;
 } as7331_creg1_reg_t;
 } as7331_creg1_reg_t;
@@ -223,8 +227,8 @@ const uint8_t RegCfgCreg2 = 0x07;
 typedef union {
 typedef union {
     struct {
     struct {
         as7331_divider_t divider : 3; /**< DIV (000) - Divider value (CREG2[2:0]) */
         as7331_divider_t divider : 3; /**< DIV (000) - Divider value (CREG2[2:0]) */
-        uint8_t enable_divider : 1; /**< EN_DIV (0) - Divider enable (CREG2[3]) */
-        uint8_t reserved : 2; /**< Reserved, do not write (CREG2[5:4]) */
+        uint8_t enable_divider   : 1; /**< EN_DIV (0) - Divider enable (CREG2[3]) */
+        uint8_t reserved         : 2; /**< Reserved, do not write (CREG2[5:4]) */
         uint8_t
         uint8_t
             enable_temp : 1; /**< EN_TM (1) - Temperature measurement enable in SYND mode (CREG2[6]) */
             enable_temp : 1; /**< EN_TM (1) - Temperature measurement enable in SYND mode (CREG2[6]) */
         uint8_t reserved1 : 1; /**< Reserved, do not write (CREG2[7]) */
         uint8_t reserved1 : 1; /**< Reserved, do not write (CREG2[7]) */
@@ -242,10 +246,10 @@ typedef union {
     struct {
     struct {
         as7331_clock_frequency_t
         as7331_clock_frequency_t
             clock_frequency : 2; /**< CCLK (00) - Internal clock frequency (CREG3[1:0]) */
             clock_frequency : 2; /**< CCLK (00) - Internal clock frequency (CREG3[1:0]) */
-        uint8_t reserved : 1; /**< Reserved, do not write (CREG3[2]) */
-        uint8_t ready_mode : 1; /**< RDYOD (0) - Ready pin mode (CREG3[3]) */
-        uint8_t standby : 1; /**< SB (0) - Standby mode (CREG3[4]) */
-        uint8_t reserved1 : 1; /**< Reserved, do not write (CREG3[5]) */
+        uint8_t reserved    : 1; /**< Reserved, do not write (CREG3[2]) */
+        uint8_t ready_mode  : 1; /**< RDYOD (0) - Ready pin mode (CREG3[3]) */
+        uint8_t standby     : 1; /**< SB (0) - Standby mode (CREG3[4]) */
+        uint8_t reserved1   : 1; /**< Reserved, do not write (CREG3[5]) */
         as7331_measurement_mode_t
         as7331_measurement_mode_t
             measurement_mode : 2; /**< MMODE (01) - Measurement mode selection (CREG3[7:6]) */
             measurement_mode : 2; /**< MMODE (01) - Measurement mode selection (CREG3[7:6]) */
     };
     };
@@ -292,12 +296,12 @@ const uint8_t RegMeasOsrStatus = 0x00;
 typedef union {
 typedef union {
     struct {
     struct {
         as7331_osr_reg_t osr; /**< OSR settings (lower byte) (OSRSTAT[7:0]) */
         as7331_osr_reg_t osr; /**< OSR settings (lower byte) (OSRSTAT[7:0]) */
-        uint8_t power_state : 1; /**< POWERSTATE - Power Down state (OSRSTAT[8]) */
+        uint8_t power_state   : 1; /**< POWERSTATE - Power Down state (OSRSTAT[8]) */
         uint8_t standby_state : 1; /**< STANDBYSTATE - Standby mode state (OSRSTAT[9]) */
         uint8_t standby_state : 1; /**< STANDBYSTATE - Standby mode state (OSRSTAT[9]) */
-        uint8_t not_ready : 1; /**< NOTREADY - Inverted ready pin state (OSRSTAT[10]) */
-        uint8_t new_data : 1; /**< NDATA - New data available (OSRSTAT[11]) */
-        uint8_t lost_data : 1; /**< LDATA - Data overwritten before retrieval (OSRSTAT[12]) */
-        uint8_t adc_overflow : 1; /**< ADCOF - Overflow of ADC channel (OSRSTAT[13]) */
+        uint8_t not_ready     : 1; /**< NOTREADY - Inverted ready pin state (OSRSTAT[10]) */
+        uint8_t new_data      : 1; /**< NDATA - New data available (OSRSTAT[11]) */
+        uint8_t lost_data     : 1; /**< LDATA - Data overwritten before retrieval (OSRSTAT[12]) */
+        uint8_t adc_overflow  : 1; /**< ADCOF - Overflow of ADC channel (OSRSTAT[13]) */
         uint8_t result_overflow : 1; /**< MRESOF - Overflow of MRES1...MRES3 (OSRSTAT[14]) */
         uint8_t result_overflow : 1; /**< MRESOF - Overflow of MRES1...MRES3 (OSRSTAT[14]) */
         uint8_t
         uint8_t
             out_conv_overflow : 1; /**< OUTCONVOF - Overflow of internal 24-bit OUTCONV (OSRSTAT[15]) */
             out_conv_overflow : 1; /**< OUTCONVOF - Overflow of internal 24-bit OUTCONV (OSRSTAT[15]) */
@@ -650,51 +654,43 @@ private:
     /**
     /**
      * @brief Read multiple bytes from consecutive registers
      * @brief Read multiple bytes from consecutive registers
      *
      *
-     * @param handle I2C bus handle
      * @param start_register_addr Starting register address
      * @param start_register_addr Starting register address
      * @param buffer Buffer to store read data
      * @param buffer Buffer to store read data
      * @param length Number of bytes to read
      * @param length Number of bytes to read
      * @return true if successful, false otherwise
      * @return true if successful, false otherwise
      * @ingroup AS7331_I2C_Methods
      * @ingroup AS7331_I2C_Methods
      */
      */
-    bool readRegisters(
-        FuriHalI2cBusHandle& handle,
-        uint8_t start_register_addr,
-        uint8_t* buffer,
-        size_t length);
+    bool readRegisters(uint8_t start_register_addr, uint8_t* buffer, size_t length);
 
 
     /**
     /**
      * @brief Read an 8-bit register
      * @brief Read an 8-bit register
      *
      *
-     * @param handle I2C bus handle
      * @param register_addr Register address to read
      * @param register_addr Register address to read
      * @param data Variable to store read data
      * @param data Variable to store read data
      * @return true if successful, false otherwise
      * @return true if successful, false otherwise
      * @ingroup AS7331_I2C_Methods
      * @ingroup AS7331_I2C_Methods
      */
      */
-    bool readRegister(FuriHalI2cBusHandle& handle, uint8_t register_addr, uint8_t& data);
+    bool readRegister(uint8_t register_addr, uint8_t& data);
 
 
     /**
     /**
      * @brief Read a 16-bit register
      * @brief Read a 16-bit register
      *
      *
-     * @param handle I2C bus handle
      * @param register_addr Register address to read
      * @param register_addr Register address to read
      * @param data Variable to store read data
      * @param data Variable to store read data
      * @return true if successful, false otherwise
      * @return true if successful, false otherwise
      * @ingroup AS7331_I2C_Methods
      * @ingroup AS7331_I2C_Methods
      */
      */
-    bool readRegister16(FuriHalI2cBusHandle& handle, uint8_t register_addr, uint16_t& data);
+    bool readRegister16(uint8_t register_addr, uint16_t& data);
 
 
     /**
     /**
      * @brief Write an 8-bit register
      * @brief Write an 8-bit register
      *
      *
-     * @param handle I2C bus handle
      * @param register_addr Register address to write
      * @param register_addr Register address to write
      * @param data Data to write
      * @param data Data to write
      * @return true if successful, false otherwise
      * @return true if successful, false otherwise
      * @ingroup AS7331_I2C_Methods
      * @ingroup AS7331_I2C_Methods
      */
      */
-    bool writeRegister(FuriHalI2cBusHandle& handle, uint8_t register_addr, const uint8_t& data);
+    bool writeRegister(uint8_t register_addr, const uint8_t& data);
 
 
     /** @} */ // End of AS7331_I2C_Methods group
     /** @} */ // End of AS7331_I2C_Methods group