示例#1
0
        public static void Configure(int BufferSize, Channels ChannelEnabledMask, int SampleSoc, int SampleAverage, int SampleRate)
        {
            if (Status != InitMode.Initialized)
            {
                throw new Exception("Pru1Aio must be initialized prior to Configuration.");
            }

            lock (Locker)
            {
                unsafe
                {
                    AsynchCall = new AsynchronousCallBack(ProcessBuffer);

                    PruMemory->Control.BufferCount        = 0;
                    PruMemory->Control.BufferSize         = (byte)BufferSize;         // 40;
                    PruMemory->Control.ChannelEnabledMask = (byte)ChannelEnabledMask; // 0x7F;
                    PruMemory->Control.SampleSoc          = (byte)SampleSoc;          // 15;
                    PruMemory->Control.SampleAverage      = (byte)SampleAverage;      // 16;
                    PruMemory->Control.SampleRate         = (uint)SampleRate;         // 1000;

                    IBuffer       = Pru1Aio.pru_rta_init_capture_buffer(PruMemory);
                    CaptureBuffer = (Pru1AioReading *)IBuffer.ToPointer();
                }

                _IsCapturing       = false;
                _Status            = InitMode.Configured;
                _TotalRecords      = 0;
                CurrentBufferIndex = 0;
            }
        }
示例#2
0
//        private unsafe static extern void pru_rta_test_callback(PruSharedMemory* PruMemory, [MarshalAs(UnmanagedType.LPArray)] Reading[] Buffer, CallState* CallState, AsynchronousCallBack CallBac);
        private unsafe static extern void pru_rta_test_callback(PruSharedMemory *PruMemory, Pru1AioReading *Buffer, CallState *CallState, AsynchronousCallBack CallBac);