Beispiel #1
0
        /// <summary>
        /// Get the full analog buffer.
        /// This function can be used to get a buffer of all the keys that are pressed up to a maximum of 16 keys.This can be used for easier access to the keys that are currently pressed.
        /// It is not necesarry to initialize the keyboard before reading, but if the keyboard is not connected this function will return an empty list.
        /// </summary>
        /// <param name="no">The amount of items in the buffer to attempt to read</param>
        /// <returns>The List of all the Analog data that was read</returns>
        public static List <AnalogRaw> ReadFullBuffer(uint no)
        {
            AnalogRaw[] data = new AnalogRaw[no];
            int         ret  = ReadFullBuffer(data, no);

            if (ret <= 0)
            {
                return(new List <AnalogRaw>());
            }
            return(data.Take(ret).ToList());
        }
Beispiel #2
0
        AnalogRaw ReadAnalog(int index)
        {
            int       offset = (index * 2 + 8);
            AnalogRaw raw    = new AnalogRaw();

            for (int i = 0; i < Stamp.Count; i++)
            {
                raw.Add(ByteToS16(mData, offset));
                offset += (mCountA * 2 + 8);
                offset += ((mCountD > 0) ? 2 : 0);
            }
            return(raw);
        }
Beispiel #3
0
 void CreateAnalog()
 {
     Analog = new Analog();
     for (int i = 0; i < mCountA; i++)
     {
         string[]  row  = mConfig[i + 2];
         string    name = row[1];
         string    unit = row[4];
         double    k    = double.Parse(row[5]);
         double    b    = double.Parse(row[6]);
         AnalogRaw data = ReadAnalog(i);
         for (int m = 0; m < data.Count; m++)
         {
             data[m] = (data[m] * k + b);
         }
         Analog.Add(new AnalogData()
         {
             Data = data,
             Name = $"{name}({unit})"
         });
     }
 }