Esempio n. 1
0
        protected override async Task InitAsync()
        {
            device = await I2cUtils.GetDeviceAsync(C_Addr, I2cBusSpeed.FastMode);

            // PD RESERVED BDU ODR1-0
            //  1     0000   1     11
            // active, n/a, non-continous, 12.5Hz for both
            I2cUtils.WriteByte(device, C_Ctrl1, 0x87);

            // RESERVED AVGT2-0 AVGH2-0
            //       00     011     011
            // n/a, average: 16, 32 (temperature, humidity)
            I2cUtils.WriteByte(device, C_AvConf, 0x1B);

            convertTemperature = GetTemperatureConverter();
            convertHumidity    = GetHumidityConverter();
        }
Esempio n. 2
0
        protected override async Task InitAsync()
        {
            device = await I2cUtils.GetDeviceAsync(C_Addr, I2cBusSpeed.FastMode);

            // PD ODR2-0 DIFF BDU RESET SIM
            //  1    100    0   1     0   0
            // Active mode, 25Hz, default, non-continous, disable, default
            I2cUtils.WriteByte(device, C_Ctrl1, 0xC4);

            // AVGP1-0 AVGT1-0
            //      01      01
            // N. internal average: 32, 16 (pressure, temperature)
            I2cUtils.WriteByte(device, C_ResConf, 0x05);

            // F_MODE2 F_MODE1 F_MODE0
            //       1       1       0
            // FIFO_MEAN_MODE: running average filtered pressure
            I2cUtils.WriteByte(device, C_FifoCtrl, 0xC0);

            // BOOT FIFO_EN WTM_EN FIFO_MEAN I2C_EN SWRESET AUTOZERO ONESHOT
            //    0    1         0         0      0       0        0       0
            // normal, enable, disable, disable, i2c enable, normal, normal, waiting
            I2cUtils.WriteByte(device, C_Ctrl2, 0x40);
        }