public static void ReadUnsigned32(uint baud, FPGA.InputSignal <bool> RXD, ref uint data) { for (byte i = 0; i < 4; i++) { FPGA.Config.SetInclusiveRange(0, 4, i); var part = UART.Read(baud, RXD); data = (data >> 8) | ((uint)part << 24); } }
public static void ReadUnsigned64(uint baud, FPGA.InputSignal <bool> RXD, ref ulong data) { for (byte i = 0; i < 8; i++) { FPGA.Config.SetInclusiveRange(0, 8, i); var part = UART.Read(baud, RXD); data = (data >> 8) | ((ulong)part << 56); } }
public static void ReadUnsigned32(uint baud, FPGA.InputSignal <bool> RXD, ref uint data) { byte part = 0; for (byte i = 0; i < 4; i++) { FPGA.Config.SetInclusiveRange(0, 4, i); UART.Read(baud, RXD, out part); data = (uint)((data >> 8) | (part << 24)); } }
public static void DeserializeFromUART <T>( ref T obj, FPGA.InputSignal <bool> RXD, FPGA.Signal <bool> deserialized) where T : new() { byte data = 0; FPGA.Config.JSONDeserializer(obj, data, deserialized); const bool trigger = true; Sequential uartHandler = () => { while (true) { UART.Read(115200, RXD, out data); } }; FPGA.Config.OnSignal(trigger, uartHandler); }