Exemple #1
0
        /// <summary>
        /// Raises the <see cref="PinStatusChanged"/> event.
        /// </summary>
        /// <param name="e">The <see cref="Raspberry.IO.GeneralPurpose.PinStatusEventArgs"/> instance containing the event data.</param>
        protected void OnPinStatusChanged(PinStatusEventArgs e)
        {
            var handler = PinStatusChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemple #2
0
        private void ConnectionPinStatusChanged(object sender, PinStatusEventArgs pinStatusEventArgs)
        {
            if (pinStatusEventArgs.Configuration.Pin != Configuration.Pin)
            {
                return;
            }

            foreach (var eventHandler in events)
            {
                eventHandler(sender, pinStatusEventArgs);
            }
        }
Exemple #3
0
 public void PinStatusChanged(object sender, PinStatusEventArgs e)
 {
     var pinState = cn.Pins[e.Configuration.Pin];
     clicks++;
     clickDelta = (long)Math.Max((CurrentTime - lastClick), 1);
     if (clickDelta < 1000)
     {
         hertz = (int)(MS_IN_SECOND / clickDelta);
         if (hertz > MIN_HZ && hertz < MAX_HZ)
         {
             flow = (int)(hertz / (SECONDS_IN_A_MINUTE * 7.5));
             var instPour = flow * (clickDelta / MS_IN_SECOND);
             thisPour += instPour;
             totalPour += instPour;
         }
     }
     lastClick = (long)CurrentTime;
     FlowChanged(this, new EventArgs());
 }
 /// <summary>
 /// Raises the <see cref="PinStatusChanged"/> event.
 /// </summary>
 /// <param name="e">The <see cref="Raspberry.IO.GeneralPurpose.PinStatusEventArgs"/> instance containing the event data.</param>
 protected void OnPinStatusChanged(PinStatusEventArgs e)
 {
     var handler = PinStatusChanged;
     if (handler != null)
         handler(this, e);
 }
        private void ConnectionPinStatusChanged(object sender, PinStatusEventArgs pinStatusEventArgs)
        {
            if (pinStatusEventArgs.Configuration.Pin != Configuration.Pin)
                return;

            foreach (var eventHandler in events)
                eventHandler(sender, pinStatusEventArgs);
        }