/** * Builds an array of bytes corresponding to writing a register value. The output of * this function needs to be written to the Command characteristic to set the value * of a register. * @param register Register to write to * @param parameters Additional parameters for the write command e.g. LED color or * a disable/enable bit * @return Array of bytes to write a register value * @see com.mbientlab.metawear.api.characteristic.MetaWear#COMMAND */ public static byte[] buildWriteCommand(APIRegister register, params byte[] parameters) { return(buildCommand(register.module(), register.opcode(), parameters)); }
/** * Builds an array of bytes corresponding to reading a register value. The output * of this function needs to be written to the Command characteristic to retrieve * the value of a register. * @param register Register to read from * @param parameters Additional parameters for the read command e.g. a pixel index * or a io pin number * @return Array of bytes to read a register value * @see com.mbientlab.metawear.api.characteristic.MetaWear#COMMAND */ public static byte[] buildReadCommand(APIRegister register, params byte[] parameters) { return(buildCommand(register.module(), (byte)(0x80 | register.opcode()), parameters)); }