private byte[] Seq_read(UInt16 Data_addr, ushort len) { Viewer.UpadateLogColorInvoke UpdateLog = LogUpdatewColor; byte Dev_addr = byte.Parse("49", System.Globalization.NumberStyles.HexNumber); byte Dev_Ack; byte[] Data_pac; ErrorCode ret = Viewer.fingerPrint.FP_I2CRead(Dev_addr, Data_addr, len, out Dev_Ack, out Data_pac); if (ret != ErrorCode.FP_STATUS_OK) { UpdateLog("[E] FP_I2CRead - ErrorCode = " + ret.ToString(), true, Color.Red); } else if (Dev_Ack == 0) { UpdateLog("[E] FP_I2CRead - DeviceACK = " + Dev_Ack.ToString(), true, Color.Red); } else { UpdateLog("I2C SRead : " + Dec2Hex(Data_addr) + " Success!", true, Color.Green); if (cb_detail_log.Checked) { UpdateLog("[Detail] Value :", false, Color.Black); for (int i = 0; i < Data_pac.Length; i++) { UpdateLog(Data_pac[i].ToString(), false, Color.Black); } UpdateLog("", true, Color.Black); } } return(Data_pac); }
private byte Byte_read(UInt16 Data_addr) { Viewer.UpadateLogColorInvoke UpdateLog = LogUpdatewColor; byte Dev_addr = byte.Parse("49", System.Globalization.NumberStyles.HexNumber); byte Dev_Ack; byte[] Data_pac; ErrorCode ret = Viewer.fingerPrint.FP_I2CRead(Dev_addr, Data_addr, 1, out Dev_Ack, out Data_pac); if (ret != ErrorCode.FP_STATUS_OK) { UpdateLog("[E] FP_I2CRead - ErrorCode = " + ret.ToString(), true, Color.Red); } else if (Dev_Ack == 0) { UpdateLog("[E] FP_I2CRead - DeviceACK = " + Dev_Ack.ToString(), true, Color.Red); } else { UpdateLog("I2C Read : " + Dec2Hex(Data_addr) + " Success!", true, Color.Green); } return(Data_pac[0]); }
private bool Seq_write(UInt16 Data_addr, ushort len, byte[] Data) { Viewer.UpadateLogColorInvoke UpdateLog = LogUpdatewColor; byte Dev_addr = byte.Parse("49", System.Globalization.NumberStyles.HexNumber); byte Dev_Ack; ErrorCode ret = Viewer.fingerPrint.FP_I2CWrite(Dev_addr, Data_addr, len, Data, out Dev_Ack); if (ret != ErrorCode.FP_STATUS_OK) { UpdateLog("[E] FP_I2CWrite - ErrorCode = " + ret.ToString(), true, Color.Red); } else if (Dev_Ack == 0 || Dev_Ack == 81) { UpdateLog("[S] FP_I2CWrite - DeviceACK = " + Dev_Ack.ToString(), true, Color.Red); } else { UpdateLog("I2C SWrite : " + Dec2Hex(Data_addr) + ", Len : " + len + " Success!", true, Color.Red); if (cb_detail_log.Checked) { UpdateLog("[Detail] Value :", false, Color.Black); for (int i = 0; i < Data.Length; i++) { UpdateLog(Data[i].ToString("X2"), false, Color.Black); } UpdateLog("", true, Color.Black); } } return(ret == ErrorCode.FP_STATUS_OK && Dev_Ack == 1); }
private bool Byte_write(UInt16 Data_addr, byte Data) { Viewer.UpadateLogColorInvoke UpdateLog = LogUpdatewColor; byte Dev_addr = byte.Parse("49", System.Globalization.NumberStyles.HexNumber); byte Dev_Ack; byte[] Data_pac = new byte[1] { Data }; ErrorCode ret = Viewer.fingerPrint.FP_I2CWrite(Dev_addr, Data_addr, 1, Data_pac, out Dev_Ack); if (ret != ErrorCode.FP_STATUS_OK) { UpdateLog("[E] FP_I2CWrite - ErrorCode = " + ret.ToString(), true, Color.Red); } else if (Dev_Ack == 0 || Dev_Ack == 81) { UpdateLog("[S] FP_I2CWrite - DeviceACK = " + Dev_Ack.ToString(), true, Color.Red); } else { UpdateLog("I2C Write : " + Dec2Hex(Data_addr) + ", Value : " + Data + " Success!", true, Color.Red); } return(ret == ErrorCode.FP_STATUS_OK && Dev_Ack == 1); }