private void write ( final byte memAddr , final int value ) throws IOException { // bit 8 of value byte firstBit = ( byte ) ( ( value >> 8 ) & 0x000001 ) ; // ask device for setting a value - see FIGURE 7-2 byte cmd = ( byte ) ( ( memAddr << 4 ) | CMD_WRITE | firstBit ) ; // 7 bits of value byte data = ( byte ) ( value & 0x00FF ) ; // write sequence of cmd and data to the device byte [ ] sequence = new byte [ ] { cmd , data } ; i2cDevice . write ( sequence , 0 , sequence . length ) ; }
Writes 9 bits of the given value to the device .