liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame^] | 1 | #include "ql/ql_i2c.h" |
| 2 | |
| 3 | |
| 4 | int main(int argc, char *argv[]) |
| 5 | { |
| 6 | int fd = -1; |
| 7 | if(argc != 2) { |
| 8 | printf("./i2c_test <dev>\n"); |
| 9 | return -1; |
| 10 | } |
| 11 | char send_data[64] = {0}; |
| 12 | send_data[0] = 0x55; |
| 13 | send_data[1] = 0x00; |
| 14 | send_data[2] = 0x84; |
| 15 | fd= Ql_I2C_Init(argv[1]); |
| 16 | if(fd <= 0) { |
| 17 | printf("Ql_I2C_Init() fail.\n"); |
| 18 | return -1; |
| 19 | } |
| 20 | |
| 21 | if(Ql_I2C_Write(fd, 0x12, 0x10,send_data, 3) < 0) { |
| 22 | printf("Ql_I2C_Write() fail.\n"); |
| 23 | return -1; |
| 24 | } |
| 25 | |
| 26 | Ql_I2C_Deinit(fd); |
| 27 | |
| 28 | printf("Success!!!\n"); |
| 29 | |
| 30 | return 0; |
| 31 | } |