pub fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Error> {
        let mut cmd_iterator = CommandRegister::COMD0;

        // If SCL is busy, reset the Master FSM
        if self.i2c.sr().read().bus_busy().bit_is_set() {
            self.i2c.ctr().modify(|_, w| w.fsm_rst().set_bit());
        }

        if bytes.len() > 255 {
            return Err(Error::ExceedingFifo);
        }

        // Reset FIFO and command list
        self.reset_fifo();

        self.add_cmd_lp(&mut cmd_iterator, Command::Start)?;

        // Load device address and R/W bit into FIFO
        self.write_fifo((address << 1) | OperationType::Write as u8);

        self.add_cmd_lp(
            &mut cmd_iterator,
            Command::Write {
                ack_exp: Ack::Ack,
                ack_check_en: true,
                length: 1_u8,
            },
        )?;

        self.enable_interrupts(I2C_LL_INTR_MASK);

        let mut data_idx = 0;
        let mut remaining_bytes = bytes.len() as u32;

        let mut fifo_available = LP_I2C_FIFO_LEN - 1;

        while remaining_bytes > 0 {
            let fifo_size = if remaining_bytes < fifo_available {
                remaining_bytes
            } else {
                fifo_available
            };
            remaining_bytes -= fifo_size;

            // Write data to the FIFO
            for &byte in &bytes[data_idx as usize..(data_idx as usize) + fifo_size as usize] {
                self.write_fifo(byte);
            }

            // Add a Write command with the specified length
            self.add_cmd_lp(
                &mut cmd_iterator,
                Command::Write {
                    ack_exp: Ack::Ack,
                    ack_check_en: true,
                    length: fifo_size as u8,
                },
            )?;

            // Check if this is the last chunk
            let cmd = if remaining_bytes == 0 {
                Command::Stop
            } else {
                Command::End
            };

            // Add the Stop/End command
            self.add_cmd_lp(&mut cmd_iterator, cmd)?;

            // Start the I2C transaction
            self.lp_i2c_update();
            self.i2c.ctr().modify(|_, w| w.trans_start().set_bit());

            // Wait for the transaction to complete
            self.wait_for_completion()?;

            // Update the index for the next data chunk
            data_idx += fifo_size;

            fifo_available = LP_I2C_FIFO_LEN;
        }

        Ok(())
    }
Writes bytes to slave with given `address`
esp-lp-hal/src/i2c.rs