public void Write(IntExpression value)
 {
     var f=FuncBuilder.Instance;
       f.If(value!=0)
     .Then(Set)
     .Else(Clear)
     .Endif();
 }
 public void Initialize(MethodDispatchTablePointer firmware, IntExpression pinNumber, bool initialValue)
 {
     firmware.GetPIOAndBitmask(pinNumber, ref pio, ref bitmask);
       pio.PER=bitmask; //enable PIO function
       if(initialValue) {
     pio.SODR=bitmask; //output should start high
       } else {
     pio.CODR=bitmask; //output should start low
       }
       pio.OER=bitmask; //enable output
 }
Example #3
0
 public IndirectIntReference this[IntExpression index]
 {
     get {
     return new IndirectIntReference(this, index);
       }
 }
Example #4
0
 public void EnqueueDelta(MethodDispatchTablePointer firmware, IntExpression delayInMicroseconds)
 {
     firmware.HAL_EnqueueDelta(storage, delayInMicroseconds);
 }
Example #5
0
 public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
 {
     if (type == typeof(IntExpression))
     {
         IntExpression result = new IntExpression(null, "", dictionary["abbr"] as string)
         {
             Data = dictionary["data"],
             Min = Convert.ToInt32(dictionary["min"]),
             Max = Convert.ToInt32(dictionary["max"]),
         };
         return result;
     }
     else if (type == typeof(UTrack))
     {
         UTrack result = new UTrack()
         {
             Name = dictionary["name"] as string,
             Comment = dictionary["comment"] as string,
             TrackNo = Convert.ToInt32(dictionary["trackno"]),
             Singer = new USinger() { Name = dictionary["singer"] as string }
         };
         return result;
     }
     else if (type == typeof(USinger))
     {
         USinger result = new USinger()
         {
             Name = dictionary["name"] as string,
             Path = dictionary["path"] as string
         };
         return result;
     }
     else return null;
 }
Example #6
0
            public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
            {
                UProject result = new UProject();
                string ustxVersion = dictionary["ustxversion"] as string;
                USTx.Project = result;
                result.Name = dictionary["name"] as string;
                result.Comment = dictionary["comment"] as string;
                result.OutputDir = dictionary["output"] as string;
                result.CacheDir = dictionary["cache"] as string;
                result.BPM = Convert.ToDouble(dictionary["bpm"]);
                result.BeatPerBar = Convert.ToInt32(dictionary["bpbar"]);
                result.BeatUnit = Convert.ToInt32(dictionary["bunit"]);
                result.Resolution = Convert.ToInt32(dictionary["res"]);

                foreach (var pair in (Dictionary<string, object>)(dictionary["exptable"]))
                {
                    var exp = serializer.ConvertToType(pair.Value, typeof(IntExpression)) as IntExpression;
                    var _exp = new IntExpression(null, pair.Key, exp.Abbr)
                    {
                        Data = exp.Data,
                        Min = exp.Min,
                        Max = exp.Max,
                    };
                    result.ExpressionTable.Add(pair.Key, _exp);
                }

                var singers = dictionary["singers"] as ArrayList;
                foreach (var singer in singers)
                    result.Singers.Add(serializer.ConvertToType(singer, typeof(USinger)) as USinger);

                foreach (var track in dictionary["tracks"] as ArrayList)
                {
                    var _tarck = serializer.ConvertToType(track, typeof(UTrack)) as UTrack;
                    result.Tracks.Add(_tarck);
                }

                foreach (var part in dictionary["parts"] as ArrayList)
                    result.Parts.Add(serializer.ConvertToType(part, typeof(UPart)) as UPart);

                USTx.Project = null;
                return result;
            }
Example #7
0
 private void SetHelper(int offset, IntExpression value)
 {
     this.AsIntPointer()[offset].Value=value;
 }