summaryrefslogtreecommitdiff
path: root/model/driver/bme680.dfa
blob: 9f9d08e33009c717f5689dcee42c5481679fb882 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
codegen:
  instance: bme680
  includes: ['driver/i2c.h', 'driver/bme680.h', 'driver/bme680_util.h']
  flags: ['drivers=bme680', 'arch_drivers=i2c']
  setup:
  - i2c.setup();
  - struct bme680_field_data sensordata;
  - bme680.intf = BME680_I2C_INTF;
  - bme680.read = bme680_i2c_read;
  - bme680.write = bme680_i2c_write;
  - bme680.delay_ms = bme680_delay_ms;
  - bme680.amb_temp = 25;

dummygen:
  enum:
    rf24_pa_dbm_e:
      - RF24_PA_MIN
      - RF24_PA_LOW
      - RF24_PA_HIGH
      - RF24_PA_MAX
      - RF24_PA_ERROR
    rf24_datarate_e:
      - RF24_1MBPS
      - RF24_2MBPS
      - RF24_250KBPS
    rf24_crclength_e:
      - RF24_CRC_DISABLED
      - RF24_CRC_8
      - RF24_CRC_16

parameters:
- power_mode
- humidity_oversampling
- pressure_oversampling
- temperature_oversampling
- gas_enabled
- heater_duration_ms
- heater_temperature_degc
- iir_filter

parameter_normalization:
  humidity_oversampling:
    enum:
      BME680_OS_NONE: 0
      BME680_OS_1X: 1
      BME680_OS_2X: 2
      BME680_OS_4X: 4
      BME680_OS_8X: 8
      BME680_OS_16X: 16
  pressure_oversampling:
    enum:
      BME680_OS_NONE: 0
      BME680_OS_1X: 1
      BME680_OS_2X: 2
      BME680_OS_4X: 4
      BME680_OS_8X: 8
      BME680_OS_16X: 16
  temperature_oversampling:
    enum:
      BME680_OS_NONE: 0
      BME680_OS_1X: 1
      BME680_OS_2X: 2
      BME680_OS_4X: 4
      BME680_OS_8X: 8
      BME680_OS_16X: 16

states:
  - UNINITIALIZED
  - SLEEP
  - SLEEP_PENDING_ATTR
  - FORCED

transition:
  init:
    src: [UNINITIALIZED, SLEEP, FORCED]
    dst: SLEEP
    set_param:
      power_mode: BME680_SLEEP_MODE
      humidity_oversampling: BME680_OS_NONE
      pressure_oversampling: BME680_OS_NONE
      temperature_oversampling: BME680_OS_NONE
      gas_enabled: BME680_RUN_GAS_DISABLE
      heater_duration_ms: 0
  setPowerMode:
    loop: [SLEEP, SLEEP_PENDING_ATTR]
    arguments:
    - name: mode
      values: ['BME680_SLEEP_MODE', 'BME680_FORCED_MODE']
      parameter: power_mode
  setHumidityOversampling:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: os
      values: ['BME680_OS_NONE', 'BME680_OS_1X', 'BME680_OS_2X', 'BME680_OS_4X', 'BME680_OS_8X', 'BME680_OS_16X']
      parameter: humidity_oversampling
  setPressureOversampling:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: os
      values: ['BME680_OS_NONE', 'BME680_OS_1X', 'BME680_OS_2X', 'BME680_OS_4X', 'BME680_OS_8X', 'BME680_OS_16X']
      parameter: pressure_oversampling
  setTemperatureOversampling:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: os
      values: ['BME680_OS_NONE', 'BME680_OS_1X', 'BME680_OS_2X', 'BME680_OS_4X', 'BME680_OS_8X', 'BME680_OS_16X']
      parameter: temperature_oversampling
  setFilter:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: filter
      values: ['BME680_FILTER_SIZE_0', 'BME680_FILTER_SIZE_1', 'BME680_FILTER_SIZE_3', 'BME680_FILTER_SIZE_7', 'BME680_FILTER_SIZE_15', 'BME680_FILTER_SIZE_31', 'BME680_FILTER_SIZE_63', 'BME680_FILTER_SIZE_127']
      parameter: iir_filter
  setRunGas:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: enabled
      values: ['BME680_RUN_GAS_DISABLE', 'BME680_RUN_GAS_ENABLE']
      parameter: gas_enabled
  setHeaterDuration:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: ms
      values: [10, 30, 60, 100, 150, 200]
      parameter: heater_duration_ms
  setHeaterTemp:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: degc
      values: [100, 150, 200, 250, 300]
      parameter: heater_temperature_degc
  configure:
    src: [SLEEP, SLEEP_PENDING_ATTR]
    dst: SLEEP_PENDING_ATTR
    arguments:
    - name: os_hum
      values: ['BME680_OS_NONE', 'BME680_OS_1X', 'BME680_OS_2X', 'BME680_OS_4X', 'BME680_OS_8X', 'BME680_OS_16X']
      parameter: humidity_oversampling
    - name: os_pres
      values: ['BME680_OS_NONE', 'BME680_OS_1X', 'BME680_OS_2X', 'BME680_OS_4X', 'BME680_OS_8X', 'BME680_OS_16X']
      parameter: pressure_oversampling
    - name: os_temp
      values: ['BME680_OS_NONE', 'BME680_OS_1X', 'BME680_OS_2X', 'BME680_OS_4X', 'BME680_OS_8X', 'BME680_OS_16X']
      parameter: temperature_oversampling
    - name: run_gas
      values: ['BME680_DISABLE_GAS_MEAS', 'BME680_ENABLE_GAS_MEAS']
      parameter: gas_enabled
    - name: heatr_dur
      values: [10, 30, 60, 100, 150, 200]
      parameter: heater_duration_ms
    - name: heatr_temp
      values: [100, 150, 200, 250, 300]
      parameter: heater_temperature_degc
  setSensorSettings:
    src: [SLEEP_PENDING_ATTR]
    dst: SLEEP
    arguments:
    - name: desired_settings
      values: ['BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_GAS_SENSOR_SEL']
  setSensorMode:
    src: [SLEEP]
    dst: FORCED
    codegen:
      delay_after_ms: 500
  getSensorData:
    src: [FORCED]
    dst: SLEEP
    arguments:
      - name: data
        values: ['&sensordata']