public static IntPtr initializeAnalogOutputPort(IntPtr port_pointer, ref int status) { status = 0; AnalogPort p = new AnalogPort() { port = GetHalPort(port_pointer) }; halData["analog_out"][p.port.pin]["initialized"] = true; IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(p)); Marshal.StructureToPtr(p, ptr, true); return ptr; }
public static IntPtr initializeAnalogInputPort(IntPtr port_pointer, ref int status) { status = 0; AnalogPort p = new AnalogPort() { port = GetHalPort(port_pointer) }; halData["analog_in"][p.port.pin]["initialized"] = true; //Set default values here when we get them. IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(p)); Marshal.StructureToPtr(p, ptr, true); return ptr; }