FTD2XX_NET.FTDI.WriteEEPROMLocation C# (CSharp) Method

WriteEEPROMLocation() public method

Writes an individual word value to a specified location in the device's EEPROM.
public WriteEEPROMLocation ( UInt32 Address, UInt16 EEValue ) : FT_STATUS
Address System.UInt32 The EEPROM location to read data from
EEValue System.UInt16 The WORD value to write to the EEPROM location specified by the Address parameter
return FT_STATUS
        public FT_STATUS WriteEEPROMLocation(UInt32 Address, UInt16 EEValue)
        {
            // Initialise ftStatus to something other than FT_OK
            FT_STATUS ftStatus = FT_STATUS.FT_OTHER_ERROR;

            // If the DLL hasn't been loaded, just return here
            if (hFTD2XXDLL == IntPtr.Zero)
                return ftStatus;

            // Check for our required function pointers being set up
            if (pFT_WriteEE != IntPtr.Zero)
            {
                tFT_WriteEE FT_WriteEE = (tFT_WriteEE)Marshal.GetDelegateForFunctionPointer(pFT_WriteEE, typeof(tFT_WriteEE));

                if (ftHandle != IntPtr.Zero)
                {
                    // Call FT_WriteEE
                    ftStatus = FT_WriteEE(ftHandle, Address, EEValue);
                }
            }
            else
            {
                if (pFT_WriteEE == IntPtr.Zero)
                {
                    LogB.Debug("FTD2XX: Failed to load function FT_WriteEE.");
                }
            }
            return ftStatus;
        }