summaryrefslogtreecommitdiff
path: root/model/driver/bme280.dfa
blob: 3e9b56744933b3dcc94650a93dd8ef1c1ec13b09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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
- standby_time

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

  setStandbyTime:
    loop: [SLEEP, NORMAL]
    arguments:
    - name: standby_time
      values: ['BME280_STANDBY_TIME_0_5_MS', 'BME280_STANDBY_TIME_62_5_MS', 'BME280_STANDBY_TIME_125_MS', 'BME280_STANDBY_TIME_250_MS', 'BME280_STANDBY_TIME_500_MS', 'BME280_STANDBY_TIME_1000_MS', 'BME280_STANDBY_TIME_10_MS', 'BME280_STANDBY_TIME_20_MS']
      parameter: standby_time
  getSensorData:
    src: [NORMAL]
    dst: NORMAL
    arguments:
      - name: what
        values: ['BME280_ALL']
      - name: data
        values: ['&sensordata']