drivers/gpio/gpio_pcal9535a.c
/**
 * @brief Write both port 0 and port 1 registers of certain register function.
 *
 * Given the register in reg, write the pair of port 0 and port 1.
 *
 * @param dev Device struct of the PCAL9535A.
 * @param reg Register to write into (the PORT0 of the pair of registers).
 * @param buf Buffer to write data from.
 *
 * @return 0 if successful, failed otherwise.
 */
@brief Write both port 0 and port 1 registers of certain register function.
Given the register in reg, write the pair of port 0 and port 1.

@param dev Device struct of the PCAL9535A.
@param reg Register to write into (the PORT0 of the pair of registers).
@param buf Buffer to write data from.

@return 0 if successful, failed otherwise.
@brief Write both port 0 and port 1 registers of certain register function . Given the register in reg write the pair of port 0 and port 1 . @param dev Device struct of the PCAL9535A . @param reg Register to write into ( the PORT0 of the pair of registers ) . @param buf Buffer to write data from . @return 0 if successful failed otherwise .
static int _write_port_regs(struct device *dev, u8_t reg,
			    union gpio_pcal9535a_port_data *buf)
{
	const struct gpio_pcal9535a_config * const config =
		dev->config->config_info;
	struct gpio_pcal9535a_drv_data * const drv_data =
		(struct gpio_pcal9535a_drv_data * const)dev->driver_data;
	struct device * const i2c_master = drv_data->i2c_master;
	u16_t i2c_addr = config->i2c_slave_addr;
	int ret;
	SYS_LOG_DBG("PCAL9535A[0x%X]: Write: REG[0x%X] = 0x%X, REG[0x%X] = "
		    "0x%X", i2c_addr, reg, buf->byte[0], (reg + 1),
		    buf->byte[1]);
	ret = i2c_burst_write(i2c_master, i2c_addr, reg, buf->byte, 2);
	if (ret) {
		SYS_LOG_ERR("PCAL9535A[0x%X]: error writing from register 0x%X "
			    "(%d)", i2c_addr, reg, ret);
	}
	return ret;
}
static int _write_port_regs ( struct device * dev , u8_t reg , union gpio_pcal9535a_port_data * buf ) { const struct gpio_pcal9535a_config * const config = dev -> config -> config_info ; struct gpio_pcal9535a_drv_data * const drv_data = ( struct gpio_pcal9535a_drv_data * const ) dev -> driver_data ; struct device * const i2c_master = drv_data -> i2c_master ; u16_t i2c_addr = config -> i2c_slave_addr ; int ret ; SYS_LOG_DBG ( " " " " , i2c_addr , reg , buf -> byte [ 0 ] , ( reg + 1 ) , buf -> byte [ 1 ] ) ; ret = i2c_burst_write ( i2c_master , i2c_addr , reg , buf -> byte , 2 ) ; if ( ret ) { SYS_LOG_ERR ( " " " " , i2c_addr , reg , ret ) ; } return ret ; }
@brief Write both port 0 and port 1 registers of certain register function.
@brief Write both port 0 and port 1 registers of certain register function .