Arduino プログラムを Linux に移植しようとしています。Arduinoが「Wire.h」に持っているI²C機能に相当するものが見つからないように見えるので、私は立ち往生しています。
ワイヤ ヘッダー:ワイヤ ライブラリ
Linux i2C-dev.h: Linux でユーザー空間から I²C を使用する
具体的には、どうすればいいのかわかりません
Wire.request(address, num_of_bytes); //Request 4 bytes
int a = Wire.receive(); //Receive the four bytes
int b = Wire.receive();
int c = Wire.receive();
int d = Wire.receive();
Linux には、I²C デバイスから特定のバイト数を要求するのと同等の機能がないようです。「i2c_smbus_read_byte」は受信と同等であり、連続して呼び出されると利用可能なバイトを昇順であると想像します。
Linux の I²C オプション:
i2c_smbus_write_quick( int file, __u8 value)
i2c_smbus_read_byte(int file)
i2c_smbus_write_byte(int file, __u8 value)
i2c_smbus_read_byte_data(int file, __u8 command)
i2c_smbus_write_byte_data(int file, __u8 command, __u8 value)
i2c_smbus_read_word_data(int file, __u8 command)
i2c_smbus_write_word_data(int file, __u8 command, __u16 value)
i2c_smbus_process_call(int file, __u8 command, __u16 value)
i2c_smbus_read_block_data(int file, __u8 command, __u8 *values)
i2c_smbus_write_block_data(int file, __u8 command, __u8 length, __u8 *values)
i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 *values)
i2c_smbus_write_i2c_block_data(int file, __u8 command, __u8 length, __u8 *values)
i2c_smbus_block_process_call(int file, __u8 command, __u8 length, __u8 *values)