Beispiel #1
0
        private DirectSsdWriter(DirectSsdWriter source, ImmutableList <int> segmentPins = null,
                                ImmutableList <int> digitPins = null, Action <int, bool> writeAction = null,
                                Func <ITicker> getTicker      = null, ImmutableList <byte> values    = null,
                                Option <ITicker>?ticker       = null, int?currentDigit = null)
        {
            Debug.Assert(segmentPins.Count == 8);

            this.segmentPins  = segmentPins ?? source.segmentPins;
            this.digitPins    = digitPins ?? source.digitPins;
            this.writeAction  = writeAction ?? source.writeAction;
            this.getTicker    = getTicker ?? source.getTicker;
            this.values       = values ?? source.values;
            this.ticker       = ticker ?? source.ticker;
            this.currentDigit = currentDigit ?? source.currentDigit;

            Write();
        }
Beispiel #2
0
        public ISsdWriter <ImmutableList <byte> > Tick(uint currentTime)
        {
            var result = this;

            ticker.MatchSome((tck) =>
            {
                if (tck.Ticked(currentTime))
                {
                    var nextDigit = currentDigit + 1;
                    if (nextDigit >= digitPins.Count)
                    {
                        nextDigit = 0;
                    }

                    result = new DirectSsdWriter(this, ticker: getTicker().Some(),
                                                 currentDigit: nextDigit);
                }
            });
            return(result);
        }