Beispiel #1
0
        /** @brief Writes a configuration register to the Ntag I2C
         *
         * @param i2cAddress is the address of the device to be found on the i2c bus
         * @param ntagType indicates if the NTag I2C is 1k or 2k version
         * @param registerAddress is the specific register address memory
         * @param registerValue is the value of the register
         *
         *  @return the response of the transaction.
         */
        public I2CData writeConfigRegister(byte i2cAddress, TagType ntagType, byte registerAddress, byte registerValue)
        {
            I2CData configRegister = null;

            byte memoryBegin  = getConfigMemoryBegin(ntagType);
            var  allRegisters = readAllConfigRegister(i2cAddress, ntagType);

            byte[] registers = allRegisters.data;
            registers[(int)registerAddress] = registerValue;

            configRegister = i2cCommand.writeBlock(i2cAddress, (byte)(memoryBegin), registers);
            return(configRegister);
        }
Beispiel #2
0
        /** @brief Write a block of the memory of the NTag I2C.
         *  @param i2cAddress is the address of the device to be found on the i2c bus
         *  @param address is the block address on the Ntag I2C memory
         *  @param writeBytes is the byte array with the data to be written
         *
         * @return the result of the transaction
         */
        public I2CData write(byte I2Caddress, byte address, byte[] writeBytes)
        {
            I2CData write;

            write = i2cCommand.writeBlock(I2Caddress, address, writeBytes);
            return(write);
        }