Exemplo n.º 1
0
        /// <summary>
        /// Generic state change request that represents the P-ROC's PRDriverUpdateState function
        /// </summary>
        /// <param name="newState"></param>
        public void UpdateState(DriverState newState)
        {
            // Copy the newState object to the current local state
            this._state.DriverNum            = newState.DriverNum;
            this._state.OutputDriveTime      = newState.OutputDriveTime;
            this._state.PatterEnable         = newState.PatterEnable;
            this._state.PatterOffTime        = newState.PatterOffTime;
            this._state.PatterOnTime         = newState.PatterOnTime;
            this._state.Polarity             = newState.Polarity;
            this._state.State                = newState.State;
            this._state.Timeslots            = newState.Timeslots;
            this._state.WaitForFirstTimeSlot = newState.WaitForFirstTimeSlot;

            if (!newState.State)
            {
                this.Disable();
            }
            else if (newState.Timeslots == 0)
            {
                this.Pulse(newState.OutputDriveTime);
            }
            else
            {
                this.Schedule(newState.Timeslots, newState.OutputDriveTime, newState.WaitForFirstTimeSlot);
            }
        }
Exemplo n.º 2
0
        public void reconfigure(bool polarity)
        {
            DriverState state = this.State;

            state.Polarity = polarity;
            this.proc.driver_update_state(ref state);
        }
Exemplo n.º 3
0
 public void driver_update_state(ref DriverState driver)
 {
     lock (procSyncObject)
     {
         PinProc.PRDriverUpdateState(ProcHandle, ref driver);
     }
 }
Exemplo n.º 4
0
 public DriverState DriverStateFuturePulse(DriverState state, byte milliseconds, UInt16 futureTime)
 {
     lock (procSyncObject)
     {
         PinProc.PRDriverStateFuturePulse(ref state, milliseconds, futureTime);
     }
     return(state);
 }
Exemplo n.º 5
0
 public DriverState DriverStatePulse(DriverState state, byte milliseconds)
 {
     lock (procSyncObject)
     {
         PinProc.PRDriverStatePulse(ref state, milliseconds);
     }
     return(state);
 }
Exemplo n.º 6
0
 public DriverState DriverStateDisable(DriverState state)
 {
     lock (procSyncObject)
     {
         PinProc.PRDriverStateDisable(ref state);
     }
     return(state);
 }
Exemplo n.º 7
0
 public DriverState driver_state_schedule(DriverState state, uint schedule, byte seconds, bool now)
 {
     lock (procSyncObject)
     {
         PinProc.PRDriverStateSchedule(ref state, schedule, seconds, now);
     }
     return(state);
 }
Exemplo n.º 8
0
 public DriverState DriverStatePatter(DriverState state, ushort milliseconds_on, ushort milliseconds_off, ushort original_on_time)
 {
     lock (procSyncObject)
     {
         PinProc.PRDriverStatePatter(ref state, milliseconds_on, milliseconds_off, original_on_time);
     }
     return(state);
 }
Exemplo n.º 9
0
 public DriverState DriverStatePulsedPatter(DriverState state, ushort milliseconds_on, ushort milliseconds_off, ushort milliseconds_overall_patter_time)
 {
     lock (procSyncObject)
     {
         PinProc.PRDriverStatePulsedPatter(ref state, milliseconds_on, milliseconds_off, milliseconds_overall_patter_time);
     }
     return(state);
 }
Exemplo n.º 10
0
        public DriverState DriverGetState(ushort number)
        {
            DriverState ds = new DriverState();

            lock (procSyncObject)
            {
                PinProc.PRDriverGetState(ProcHandle, (byte)number, ref ds);
            }
            return(ds);
        }
Exemplo n.º 11
0
        public void DriverPulsedPatter(ushort number, ushort milliseconds_on, ushort milliseconds_off, ushort milliseconds_overall_patter_time)
        {
            DriverState state = this.DriverGetState(number);

            lock (procSyncObject)
            {
                PinProc.PRDriverStatePulsedPatter(ref state, milliseconds_on, milliseconds_off, milliseconds_overall_patter_time);
                PinProc.PRDriverUpdateState(ProcHandle, ref state);
                PinProc.PRFlushWriteData(ProcHandle);
            }
        }
Exemplo n.º 12
0
        public void DriverDisable(ushort number)
        {
            DriverState state = this.DriverGetState(number);

            lock (procSyncObject)
            {
                PinProc.PRDriverStateDisable(ref state);
                PinProc.PRDriverUpdateState(ProcHandle, ref state);
                PinProc.PRFlushWriteData(ProcHandle);
            }
        }
Exemplo n.º 13
0
        public void DriverSchedule(ushort number, uint schedule, ushort cycle_seconds, bool now)
        {
            DriverState state = this.DriverGetState(number);

            lock (procSyncObject)
            {
                PinProc.PRDriverStateSchedule(ref state, schedule, (byte)cycle_seconds, now);
                PinProc.PRDriverUpdateState(ProcHandle, ref state);
                PinProc.PRFlushWriteData(ProcHandle);
            }
        }
Exemplo n.º 14
0
        public VirtualDriver(IProcDevice proc, string name, ushort number, bool polarity)
            : base(proc, name, number)
        {
            this._state                      = new DriverState();
            this._state.Polarity             = polarity;
            this._state.Timeslots            = 0x0;
            this._state.PatterEnable         = false;
            this._state.DriverNum            = number;
            this._state.PatterOnTime         = 0;
            this._state.PatterOffTime        = 0;
            this._state.State                = false;
            this._state.OutputDriveTime      = 0;
            this._state.WaitForFirstTimeSlot = false;

            this._currentValue = !(_currentState ^ this._state.Polarity);
        }
Exemplo n.º 15
0
        public Result DriverPulse(ushort number, byte milliseconds)
        {
            DriverState state = this.DriverGetState(number);
            Result      res;

            lock (procSyncObject)
            {
                PinProc.PRDriverStatePulse(ref state, milliseconds);
                res = PinProc.PRDriverUpdateState(ProcHandle, ref state);
            }

            if (res == Result.Success)
            {
                lock (procSyncObject)
                {
                    res = PinProc.PRDriverWatchdogTickle(ProcHandle);
                    res = PinProc.PRFlushWriteData(ProcHandle);
                }
            }
            return(res);
        }
Exemplo n.º 16
0
 public static extern void PRDriverStateDisable(ref DriverState state);
Exemplo n.º 17
0
 public static extern void PRDriverStatePulse(ref DriverState state, byte milliseconds);
Exemplo n.º 18
0
 public static extern void PRDriverStatePulsedPatter(ref DriverState state, UInt16 millisecondsOn, UInt16 millisecondsOff, UInt16 patterTime);
Exemplo n.º 19
0
 public static extern void PRDriverStateSchedule(ref DriverState state, UInt32 schedule, byte cycleSeconds, bool now);
Exemplo n.º 20
0
 public static extern Result PRDriverUpdateState(IntPtr handle, ref DriverState driverState);
Exemplo n.º 21
0
 public DriverState DriverStateFuturePulse(DriverState state, byte milliseconds, ushort futureTime)
 {
     return(state);
 }
Exemplo n.º 22
0
 public DriverState DriverStatePatter(DriverState state, ushort milliseconds_on, ushort milliseconds_off, ushort original_on_time)
 {
     return(state);
 }
Exemplo n.º 23
0
 public DriverState DriverStatePulse(DriverState state, byte milliseconds)
 {
     return(state);
 }
Exemplo n.º 24
0
 public DriverState DriverStatePulsedPatter(DriverState state, ushort milliseconds_on, ushort milliseconds_off, ushort milliseconds_overall_patter_time)
 {
     return(state);
 }
Exemplo n.º 25
0
 public DriverState driver_state_schedule(DriverState state, uint schedule, byte seconds, bool now)
 {
     return(state);
 }
Exemplo n.º 26
0
 public void driver_update_state(ref DriverState driver)
 {
     this.drivers[driver.DriverNum].State = driver;
 }
Exemplo n.º 27
0
 public static extern void PRDriverStatePatter(ref DriverState state, UInt16 millisecondsOn, UInt16 millisecondsOff, UInt16 originalOnTime);
Exemplo n.º 28
0
 public DriverState DriverStateDisable(DriverState state)
 {
     return(state);
 }
Exemplo n.º 29
0
 public static extern Result PRDriverGetState(IntPtr handle, byte driverNum, ref DriverState driverState);
Exemplo n.º 30
0
 public static extern void PRDriverStateFuturePulse(ref DriverState state, UInt16 milliseconds, UInt16 futureTime);