public bool Persist(PersistentStorage storage) { lock (bufferLock) { if (!storage.Write(buffer, (ushort)buffer.Length)) { return(false); } bufferfull = false; } return(true); }
public DataCollectorMicrophoneSD() { Debug.Print("Initializing LCD ...."); lcd = new Samraksh.SPOT.Hardware.EmoteDotNow.EmoteLCD(); lcd.Initialize(); lcd.Clear(); Debug.Print("Initializing Serial ...."); serialPort = new SerialPort("COM1"); serialPort.BaudRate = 115200; serialPort.Parity = System.IO.Ports.Parity.None; serialPort.StopBits = StopBits.One; serialPort.DataBits = 8; serialPort.Handshake = Handshake.None; Debug.Print("Initializing ADC ....."); stopExperiment.OnInterrupt += stopExperiment_OnInterrupt; adcCallbackPtr = AdcCallbackFn; Samraksh.SPOT.Hardware.EmoteDotNow.AnalogInput.InitializeADC(); Samraksh.SPOT.Hardware.EmoteDotNow.AnalogInput.InitChannel(Samraksh.SPOT.Hardware.EmoteDotNow.ADCChannel.ADC_Channel1); Samraksh.SPOT.Hardware.EmoteDotNow.AnalogInput.ConfigureContinuousMode(sampleBuffer, Samraksh.SPOT.Hardware.EmoteDotNow.ADCChannel.ADC_Channel1, bufferSize, sampleTime, AdcCallbackFn); buffer = new BufferStorage(bufferSize); //transferBuffer = new BufferStorage(bufferSize); Debug.Print("Initializing NOR ..."); lcd.Write(Samraksh.SPOT.Hardware.EmoteDotNow.LCD.CHAR_E, Samraksh.SPOT.Hardware.EmoteDotNow.LCD.CHAR_R, Samraksh.SPOT.Hardware.EmoteDotNow.LCD.CHAR_A, Samraksh.SPOT.Hardware.EmoteDotNow.LCD.CHAR_S); storage = new NorStore(); Debug.Print("Initializing SD ..."); removableStorage = new SDStore(); }