Exemplo n.º 1
0
        public bool WriteLocks(DeviceOperation op)
        {
            var device = Config.Device;

            var locksBlocks = LocksHexBoard.SplitBlocks(device.LockBits.PageSize);

            op.LocksSize += locksBlocks.TotalBytes;

            using (var programmer = CreateProgrammer(op)) {
                using (programmer.Start()) {
                    foreach (var block in locksBlocks.Blocks)
                    {
                        programmer.WritePage(block.Address, device.LockBits.Location ?? AvrMemoryType.LockBits, block.Data, 0, block.Data.Length);
                    }
                }
            }
            op.CurrentState = "Everything is done";

            return(true);
        }
Exemplo n.º 2
0
        public bool VerifyLockBits(DeviceOperation op)
        {
            var device = Config.Device;

            var lockBlocks = LocksHexBoard.SplitBlocks(1);

            op.LocksSize += lockBlocks.TotalBytes;

            using (var programmer = CreateProgrammer(op)) {
                using (programmer.Start()) {
                    if (!VerifyBlocks(programmer, lockBlocks, device.LockBits.Location ?? AvrMemoryType.LockBits, op))
                    {
                        return(false);
                    }
                }
            }
            op.Complete();
            op.CurrentState = "Everything is done";

            return(true);
        }