Syntax
typedef enum {
  VM_DCL_I2C_CMD_GET_TRANSACTION_MODE = 0x901,
  VM_DCL_I2C_CMD_SET_TRANSACTION_SPEED,
  VM_DCL_I2C_CMD_SINGLE_WRITE,
  VM_DCL_I2C_CMD_SINGLE_READ,
  VM_DCL_I2C_CMD_CONT_WRITE,
  VM_DCL_I2C_CMD_CONT_READ,
  VM_DCL_I2C_CMD_WRITE_AND_READ,
  VM_DCL_I2C_CMD_RESERVED_0,
  VM_DCL_I2C_CMD_RESERVED_1,
  VM_DCL_I2C_CMD_RESERVED_2,
  VM_DCL_I2C_CMD_RESERVED_3,
  VM_DCL_I2C_CMD_SET_SLAVE_ADDRESS,
  VM_DCL_I2C_CMD_CONFIG
} VM_DCL_I2C_CONTROL_COMMAND;
ContentsIndex
PreviousUpNext
VM_DCL_I2C_CONTROL_COMMAND
Example
Syntax
typedef enum {
  VM_DCL_I2C_CMD_GET_TRANSACTION_MODE = 0x901,
  VM_DCL_I2C_CMD_SET_TRANSACTION_SPEED,
  VM_DCL_I2C_CMD_SINGLE_WRITE,
  VM_DCL_I2C_CMD_SINGLE_READ,
  VM_DCL_I2C_CMD_CONT_WRITE,
  VM_DCL_I2C_CMD_CONT_READ,
  VM_DCL_I2C_CMD_WRITE_AND_READ,
  VM_DCL_I2C_CMD_RESERVED_0,
  VM_DCL_I2C_CMD_RESERVED_1,
  VM_DCL_I2C_CMD_RESERVED_2,
  VM_DCL_I2C_CMD_RESERVED_3,
  VM_DCL_I2C_CMD_SET_SLAVE_ADDRESS,
  VM_DCL_I2C_CMD_CONFIG
} VM_DCL_I2C_CONTROL_COMMAND;
Description

VM_DCL_I2C_CTRL_CMD_T indicates the I2C control commands, you can select CMDS to control the driver.

Example
 VM_DCL_HANDLE i2c_handle;
 vm_dcl_i2c_control_config_t conf_data;
 vm_i2c_ctrl_single_write_t write_data;
 VM_DCL_BUFF_LEN len;
 VMUINT8 i2c_write_data[2] = {0x56,0x78};
i2c_handle = vm_dcl_open(VM_DCL_I2C,0);
if(VM_DCL_HANDLE_INVALID==i2c_handle) return;
conf_data.reserved_0 = 0;
conf_data.transaction_mode = VM_DCL_I2C_TRANSACTION_FAST_MODE;
conf_data.get_handle_wait = 0;
conf_data.reserved_1 = 0;
conf_data.delay_length = 0;
conf_data.slave_address = 0x98;
conf_data.fast_mode_speed = 400;
conf_data.high_mode_speed = 0;
vm_dcl_control(i2c_handle,VM_DCL_I2C_CMD_CONFIG,(void *)&conf_data);
write_data.data_ptr = i2c_write_data;
write_data.data_length = 2;
vm_dcl_write(i2c_handle,(VM_DCL_BUFF*)i2c_write_data,2,&len,0);
 //To do something with the handle.
File

vmdcl_i2c.h

Members
Members 
Description 
VM_DCL_I2C_CMD_GET_TRANSACTION_MODE = 0x901 
This gets the transaction mode. 
VM_DCL_I2C_CMD_SET_TRANSACTION_SPEED 
This sets the transaction speed. 
VM_DCL_I2C_CMD_SINGLE_WRITE 
The single write of a blocking mode. 
VM_DCL_I2C_CMD_SINGLE_READ 
The single read of a blocking mode. 
VM_DCL_I2C_CMD_CONT_WRITE 
This continues the write of a blocking mode. 
VM_DCL_I2C_CMD_CONT_READ 
This continues the read of a blocking mode. 
VM_DCL_I2C_CMD_WRITE_AND_READ 
This is the write and the read of a blocking mode. 
VM_DCL_I2C_CMD_RESERVED_0 
This is a reserved command. Do not use. 
VM_DCL_I2C_CMD_RESERVED_1 
This is a reserved command. Do not use. 
VM_DCL_I2C_CMD_RESERVED_2 
This is a reserved command. Do not use. 
VM_DCL_I2C_CMD_RESERVED_3 
This is a reserved command. Do not use. 
VM_DCL_I2C_CMD_SET_SLAVE_ADDRESS 
This sets the slave address of a sensor. 
VM_DCL_I2C_CMD_CONFIG 
This configures the I2C for read or write. 
Group
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.