diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-10-25 15:39:28 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-10-25 15:39:28 +0200 |
commit | 7047bcec472ae06ccb11849fb9538c687743ec9d (patch) | |
tree | b160f3d3f5cd1ff00b18b410e5db1de13889d6bb /model | |
parent | a4cad3173fc49cc0286f6eedf6efbca15db6688e (diff) |
BME280: Add DFA model
Diffstat (limited to 'model')
-rw-r--r-- | model/driver/bme280.dfa | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/model/driver/bme280.dfa b/model/driver/bme280.dfa new file mode 100644 index 0000000..2dcfb3e --- /dev/null +++ b/model/driver/bme280.dfa @@ -0,0 +1,114 @@ +codegen: + instance: bme280 + includes: ['driver/i2c.h', 'driver/bme280.h', 'driver/bme680_util.h'] + flags: ['drivers=bme280', 'arch_drivers=i2c'] + setup: + - i2c.setup(); + - struct bme280_data sensordata; + - bme280.intf = BME280_I2C_INTF; + - bme280.read = bme680_i2c_read; + - bme280.write = bme680_i2c_write; + - bme280.delay_ms = bme680_delay_ms; + +parameters: +- humidity_oversampling +- pressure_oversampling +- temperature_oversampling +- iir_filter + +parameter_normalization: + humidity_oversampling: + enum: + BME280_NO_OVERSAMPLING: 0 + BME280_OVERSAMPLING_1X: 1 + BME280_OVERSAMPLING_2X: 2 + BME280_OVERSAMPLING_4X: 4 + BME280_OVERSAMPLING_8X: 8 + BME280_OVERSAMPLING_16X: 16 + pressure_oversampling: + enum: + BME280_NO_OVERSAMPLING: 0 + BME280_OVERSAMPLING_1X: 1 + BME280_OVERSAMPLING_2X: 2 + BME280_OVERSAMPLING_4X: 4 + BME280_OVERSAMPLING_8X: 8 + BME280_OVERSAMPLING_16X: 16 + temperature_oversampling: + enum: + BME280_NO_OVERSAMPLING: 0 + BME280_OVERSAMPLING_1X: 1 + BME280_OVERSAMPLING_2X: 2 + BME280_OVERSAMPLING_4X: 4 + BME280_OVERSAMPLING_8X: 8 + BME280_OVERSAMPLING_16X: 16 + iir_filter: + enum: + BME280_FILTER_COEFF_OFF: 0 + BME280_FILTER_COEFF_2: 2 + BME280_FILTER_COEFF_4: 4 + BME280_FILTER_COEFF_8: 8 + BME280_FILTER_COEFF_16: 16 + standby_time: + enum: + BME280_STANDBY_TIME_0_5_MS: 0.5 + BME280_STANDBY_TIME_62_5_MS: 62.5 + BME280_STANDBY_TIME_125_MS: 125 + BME280_STANDBY_TIME_250_MS: 250 + BME280_STANDBY_TIME_500_MS: 500 + BME280_STANDBY_TIME_1000_MS: 1000 + BME280_STANDBY_TIME_10_MS: 10 + BME280_STANDBY_TIME_20_MS: 20 + +states: + - UNINITIALIZED + - SLEEP + - NORMAL + +transition: + init: + src: [UNINITIALIZED] + dst: SLEEP + set_param: + humidity_oversampling: BME280_NO_OVERSAMPLING + pressure_oversampling: BME280_NO_OVERSAMPLING + temperature_oversampling: BME280_NO_OVERSAMPLING + iir_filter: BME280_FILTER_COEFF_OFF + standby_time: BME280_STANDBY_TIME_0_5_MS + enterSleepMode: + src: [NORMAL] + dst: SLEEP + enterNormalMode: + src: [SLEEP] + dst: NORMAL + setHumidityOversampling: + loop: [SLEEP, NORMAL] + arguments: + - name: os + values: ['BME280_NO_OVERSAMPLING', 'BME280_OVERSAMPLING_1X', 'BME280_OVERSAMPLING_2X', 'BME280_OVERSAMPLING_4X', 'BME280_OVERSAMPLING_8X', 'BME280_OVERSAMPLING_16X'] + parameter: humidity_oversampling + setPressureOversampling: + loop: [SLEEP, NORMAL] + arguments: + - name: os + values: ['BME280_NO_OVERSAMPLING', 'BME280_OVERSAMPLING_1X', 'BME280_OVERSAMPLING_2X', 'BME280_OVERSAMPLING_4X', 'BME280_OVERSAMPLING_8X', 'BME280_OVERSAMPLING_16X'] + parameter: pressure_oversampling + setTemperatureOversampling: + loop: [SLEEP, NORMAL] + arguments: + - name: os + values: ['BME280_NO_OVERSAMPLING', 'BME280_OVERSAMPLING_1X', 'BME280_OVERSAMPLING_2X', 'BME280_OVERSAMPLING_4X', 'BME280_OVERSAMPLING_8X', 'BME280_OVERSAMPLING_16X'] + parameter: temperature_oversampling + setFilter: + loop: [SLEEP, NORMAL] + arguments: + - name: filter + values: ['BME280_FILTER_COEFF_OFF', 'BME280_FILTER_COEFF_2', 'BME280_FILTER_COEFF_4', 'BME280_FILTER_COEFF_8', 'BME280_FILTER_COEFF_16'] + parameter: iir_filter + getSensorData: + src: [NORMAL] + dst: NORMAL + arguments: + - name: what + values: ['BME280_ALL'] + - name: data + values: ['&sensordata'] |