/// <summary> /// Format the config word /// </summary> /// <param name="inputData">input data</param> private void SetConfigWord(ConfigWord inputData) { // format config data ConfigWord = 0x0000; if (inputData.TamperAlarm) { ConfigWord |= (0x0001 << 15); } if (inputData.ExternalSupply) { ConfigWord |= (0x0001 << 14); } if (inputData.RFU2) { ConfigWord |= (0x0001 << 13); } if (inputData.RFU3) { ConfigWord |= (0x0001 << 12); } if (inputData.InvertDigitalOutput) { ConfigWord |= (0x0001 << 11); } if (inputData.TransparentMode) { ConfigWord |= (0x0001 << 10); } if (inputData.DataMode) { ConfigWord |= (0x0001 << 9); } if (inputData.ConditionalReadRangeReduction_onOff) { ConfigWord |= (0x0001 << 8); } if (inputData.ConditionalReadRangeReduction_openShort) { ConfigWord |= (0x0001 << 7); } if (inputData.MaxBackscatterStrength) { ConfigWord |= (0x0001 << 6); } if (inputData.DigitalOutput) { ConfigWord |= (0x0001 << 5); } if (inputData.PrivacyMode) { ConfigWord |= (0x0001 << 4); } if (inputData.ReadProtectUser) { ConfigWord |= (0x0001 << 3); } if (inputData.ReadProtectEPC) { ConfigWord |= (0x0001 << 2); } if (inputData.ReadProtectTID) { ConfigWord |= (0x0001 << 1); } if (inputData.PsfAlarm) { ConfigWord |= 0x0001; } }
/// <summary> /// Retrieve configuration word /// </summary> /// <param name="inputData"></param> /// <returns></returns> public ConfigWord GetConfigWord(UInt16 inputData) { ConfigWord cfgWord = new ConfigWord(); /* format config data*/ if ((inputData & 0x8000) != 0) { cfgWord.TamperAlarm = true; } if ((inputData & 0x4000) != 0) { cfgWord.ExternalSupply = true; } if ((inputData & 0x2000) != 0) { cfgWord.RFU2 = true; } if ((inputData & 0x1000) != 0) { cfgWord.RFU3 = true; } if ((inputData & 0x0800) != 0) { cfgWord.InvertDigitalOutput = true; } if ((inputData & 0x0400) != 0) { cfgWord.TransparentMode = true; } if ((inputData & 0x0200) != 0) { cfgWord.DataMode = true; } if ((inputData & 0x0100) != 0) { cfgWord.ConditionalReadRangeReduction_onOff = true; } if ((inputData & 0x0080) != 0) { cfgWord.ConditionalReadRangeReduction_openShort = true; } if ((inputData & 0x0040) != 0) { cfgWord.MaxBackscatterStrength = true; } if ((inputData & 0x0020) != 0) { cfgWord.DigitalOutput = true; } if ((inputData & 0x0010) != 0) { cfgWord.PrivacyMode = true; } if ((inputData & 0x0008) != 0) { cfgWord.ReadProtectUser = true; } if ((inputData & 0x0004) != 0) { cfgWord.ReadProtectEPC = true; } if ((inputData & 0x0002) != 0) { cfgWord.ReadProtectTID = true; } if ((inputData & 0x0001) != 0) { cfgWord.PsfAlarm = true; } return cfgWord; }
/// <summary> /// Constructor to initialize parameters of NxpConfigChange /// </summary> /// <param name="accessPassword">the access password</param> /// <param name="configWord">Config Word</param> public ChangeConfig(UInt32 accessPassword, ConfigWord configWord): base(accessPassword) { ChipType = 0x07; SetConfigWord(configWord); }