Esempio n. 1
0
        public bool VerifyDevice(DeviceOperation op)
        {
            var device = Config.Device;

            var flashBlocks  = FlashHexBoard.SplitBlocks(device.Flash.PageSize);
            var eepromBlocks = EepromHexBoard.SplitBlocks(device.Eeprom.PageSize);

            op.FlashSize  += flashBlocks.TotalBytes;
            op.EepromSize += eepromBlocks.TotalBytes;

            using (var programmer = CreateProgrammer(op)) {
                using (programmer.Start()) {
                    if (!VerifyBlocks(programmer, flashBlocks, AvrMemoryType.Flash, op))
                    {
                        return(false);
                    }

                    if (!VerifyBlocks(programmer, eepromBlocks, AvrMemoryType.Eeprom, op))
                    {
                        return(false);
                    }
                }
            }
            op.Complete();
            op.CurrentState = "Everything is done";

            return(true);
        }
Esempio n. 2
0
 public void ClearAll()
 {
     FlashHexBoard.Clear();
     EepromHexBoard.Clear();
     FusesHexBoard.Clear();
     LocksHexBoard.Clear();
 }
Esempio n. 3
0
        public bool WriteDevice(DeviceOperation op)
        {
            var device = Config.Device;

            var flashBlocks  = FlashHexBoard.SplitBlocks(device.Flash.PageSize);
            var eepromBlocks = EepromHexBoard.SplitBlocks(device.Eeprom.PageSize, EEPROM_MAX_SUPERPAGE);

            op.FlashSize  += flashBlocks.TotalBytes;
            op.EepromSize += eepromBlocks.TotalBytes;

            using (var programmer = CreateProgrammer(op)) {
                using (programmer.Start()) {
                    foreach (var block in flashBlocks.Blocks)
                    {
                        programmer.WritePage(block.Address, AvrMemoryType.Flash, block.Data, 0, block.Data.Length);
                    }

                    foreach (var block in eepromBlocks.Blocks)
                    {
                        programmer.WritePage(block.Address, AvrMemoryType.Eeprom, block.Data, 0, block.Data.Length);
                    }
                }
            }
            op.CurrentState = "Everything is done";

            return(true);
        }