1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
HANDLE WINAPI CH341OpenDevice( // Open the CH341 device, return the handle, if an error occurs, it will be invalid
ULONG iIndex ); // Specify the device serial number of CH341, 0 corresponds to the first device
VOID WINAPI CH341CloseDevice( // Close the CH341 device
ULONG iIndex ); // Specify the serial number of the CH341 device
BOOL WINAPI CH341SetStream( // Set the serial port flow mode
ULONG iIndex, // Specify the CH341 device number
ULONG iMode ); // To specify the mode, see Downlink
// Bit 1-bit 0: I2C interface speed /SCL frequency, 00= low speed /20KHz,01= standard /100KHz(default),10= fast /400KHz,11= high speed /750KHz
// Bit 2: SPI I/O number /IO pins, 0= single in/single out (D3 clock /D5 out /D7 in)(default),1= double in/double out (D3 clock /D5 out D4 out /D7 in D6 in)
// Bit 7: Bit order in SPI bytes, 0= low first, 1= high first
// All other reservations must be 0
BOOL WINAPI CH341ReadI2C( // Read one byte of data from the I2C interface
ULONG iIndex, // Specify the serial number of the CH341 device
UCHAR iDevice, // The lower 7 bits specify the I2C device address
UCHAR iAddr, // Address of specified data unit
PUCHAR oByte ); // Address of specified data unit
BOOL WINAPI CH341WriteI2C( // Write a byte of data to the I2C interface
ULONG iIndex, // Specify the serial number of the CH341 device
UCHAR iDevice, // The lower 7 bits specify the I2C device address
UCHAR iAddr, // Address of specified data unit
UCHAR iByte ); // Byte data to be written
BOOL WINAPI CH341StreamI2C( // Process I2C data stream, 2-wire interface, clock line for SCL pin, data line for SDA pin (quasi-bidirectional I/O), speed of about 56K bytes
ULONG iIndex, // Specify the CH341 device number
ULONG iWriteLength, // Number of bytes of data to write out
PVOID iWriteBuffer, // Points to a buffer to place data to be written, usually with the I2C device address and read/write direction bits as the first byte
ULONG iReadLength, // Number of bytes of data to be read
PVOID oReadBuffer ); // Points to a buffer and returns the data read in |