typedef enum { VM_DCL_SPI_CONTROL_GET_PARAMETER = 0, VM_DCL_SPI_CONTROL_QUERY_CAPABILITY = 1, VM_DCL_SPI_CONTROL_QUERY_MODE_SUPPORT = 2, VM_DCL_SPI_CONTROL_QUERY_CLOCK = 3, VM_DCL_SPI_CONTROL_SET_MODE = 4, VM_DCL_SPI_CONTROL_GET_MODE = 5, VM_DCL_SPI_CONTROL_SET_CONFIG_PARAMETER = 8, VM_DCL_SPI_CONTROL_WRITE_AND_READ = 9 } VM_DCL_SPI_CONTROL_COMMAND;
typedef enum { VM_DCL_SPI_CONTROL_GET_PARAMETER = 0, VM_DCL_SPI_CONTROL_QUERY_CAPABILITY = 1, VM_DCL_SPI_CONTROL_QUERY_MODE_SUPPORT = 2, VM_DCL_SPI_CONTROL_QUERY_CLOCK = 3, VM_DCL_SPI_CONTROL_SET_MODE = 4, VM_DCL_SPI_CONTROL_GET_MODE = 5, VM_DCL_SPI_CONTROL_SET_CONFIG_PARAMETER = 8, VM_DCL_SPI_CONTROL_WRITE_AND_READ = 9 } VM_DCL_SPI_CONTROL_COMMAND;
This is the SPI IO control definition.
VM_DCL_HANDLE spi_handle; vm_dcl_spi_config_parameter_t config_data; spi_handle = vm_dcl_open(VM_DCL_SPI_PORT1,0); if(VM_DCL_HANDLE_INVALID == spi_handle) return; config_data.clock_high_time = 5; config_data.clock_low_time = 5; config_data.cs_hold_time = 15; config_data.cs_idle_time = 15; config_data.cs_setup_time= 15; config_data.clock_polarity = VM_DCL_SPI_CLOCK_POLARITY_0; config_data.clock_phase = VM_DCL_SPI_CLOCK_PHASE_0; config_data.rx_endian = VM_DCL_SPI_ENDIAN_LITTLE; config_data.tx_endian = VM_DCL_SPI_ENDIAN_LITTLE; config_data.rx_msbf = VM_DCL_SPI_MSB_FIRST; config_data.tx_msbf = VM_DCL_SPI_MSB_FIRST; vm_dcl_control(spi_handle,VM_DCL_SPI_CONTROL_SET_CONFIG_PARAMETER,(void *)&config_data); //To do something.
vmdcl_spi.h
|
Members |
Description |
|
VM_DCL_SPI_CONTROL_GET_PARAMETER = 0 |
Gets the current SPI configuration parameters. |
|
VM_DCL_SPI_CONTROL_QUERY_CAPABILITY = 1 |
Gets the capability of current SPI hardware. |
|
VM_DCL_SPI_CONTROL_QUERY_MODE_SUPPORT = 2 |
Queries supported SPI modes. |
|
VM_DCL_SPI_CONTROL_QUERY_CLOCK = 3 |
Queries SPI base clock. |
|
VM_DCL_SPI_CONTROL_SET_MODE = 4 |
Sets and configures SPI mode. |
|
VM_DCL_SPI_CONTROL_GET_MODE = 5 |
Gets SPI mode settings. |
|
VM_DCL_SPI_CONTROL_SET_CONFIG_PARAMETER = 8 |
Sets SPI driving current. |
|
VM_DCL_SPI_CONTROL_WRITE_AND_READ = 9 |
Sets SPI write and read. |
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.