/* free I2C in case of slave deadlock in case printer is resetted during I2C transmit, slave can deadlock it has not been resetted and is expecting clock to finish its command problem is that it can hold SDA in '0' - it blocks the bus so master cannot do start / stop condition this code generates a clock until SDA is in '1' and than master sdoes start + stop to end any slave communication  */
static void i2c_free_bus_in_case_of_slave_deadlock(uint32_t clk, hw_pin sda, hw_pin scl)
/* free I2C in case of slave deadlock in case printer is resetted during I2C transmit, slave can deadlock it has not been resetted and is expecting clock to finish its command problem is that it can hold SDA in '0' - it blocks the bus so master cannot do start / stop condition this code generates a clock until SDA is in '1' and than master sdoes start + stop to end any slave communication  */
static void i2c_free_bus_in_case_of_slave_deadlock(uint32_t clk, hw_pin sda, hw_pin scl)
{
        set_pin_od(scl);
        i2c_unblock_sda(clk, sda, scl);
    }
    set_pin_od(sda);
    HAL_GPIO_WritePin(sda.port, sda.no, GPIO_PIN_RESET);
    delay_us_precise(i2c_get_edge_us(clk));
    HAL_GPIO_WritePin(sda.port, sda.no, GPIO_PIN_RESET);
    delay_us_precise(i2c_get_edge_us(clk));
}