static async Task AlterLockAsync(this Samba nxt, int regionNum, Commands cmd) { var w = 0x5A000000 | (uint)((64 * regionNum) << 8); w += (uint)cmd; await nxt.WaitReadyAsync(); /* Flash mode register: FCMN 0x5, FWS 0x1 * Flash command register: KEY 0x5A, FCMD = clear-lock-bit (0x4) * Flash mode register: FCMN 0x34, FWS 0x1 */ await nxt.WriteWordAsync(0xFFFFFF60, 0x00050100); await nxt.WriteWordAsync(0xFFFFFF64, w); await nxt.WriteWordAsync(0xFFFFFF60, 0x00340100); }
static Task FlashFinishAsync(this Samba nxt) { return(nxt.WaitReadyAsync()); }