X13.Periphery.TWIDriver.BME280.Poll C# (CSharp) Method

Poll() public method

public Poll ( byte &buf ) : bool
buf byte
return bool
      public override bool Poll(out byte[] buf) {
        //int oldSt=_st;
        buf=null;
        bool busy=false;
        if(_pt<DateTime.Now) {
          if(_st==-4) {
            _st=-3;
            buf=new byte[] { ADDR, 0x03, 0x01, 0x1A, 0x88 };
            _pt=DateTime.Now.AddMilliseconds(500);
            busy=true;
          } else if(_st==-2) {
            _st=-1;
            buf=new byte[] { ADDR, 0x03, 0x01, 0x07, 0xE1 };
            _pt=DateTime.Now.AddMilliseconds(500);
            busy=true;
          } else if(_st==0) {
            buf=new byte[] { ADDR, 0x01, 0x04, 0x00, 0xF2, 0x01, 0x00, 0x24 };  // Pressure oversampling x1, Temperature oversampling x1, Humidity oversampling x1
            _pt=DateTime.Now.AddMilliseconds(30);
            _st=1;
            busy=true;
          } else if(_st==1) {
            buf=new byte[] { ADDR, 0x01, 0x02, 0x00, 0xF4, 0x25 };  // forced mode
            _pt=DateTime.Now.AddMilliseconds(10);
            _st=2;
            busy=true;
          } else if(_st==2) {
            buf=new byte[] { ADDR, 0x03, 0x01, 0x08, 0xF7 };
            _pt=DateTime.Now.AddMilliseconds(500);
            _st=3;
            busy=true;
          } else {
            busy=true;
          }
          //if(oldSt!=_st) {
          //  Log.Debug("{0} st={1}, busy={2}", _T.parent.path, _st, busy);
          //}
        } else {
          busy=_st!=1;
        }
        return busy;
      }
      public override void Reset() {