Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
multipass
Commits
7047bcec
Commit
7047bcec
authored
5 years ago
by
Daniel Friesel
Browse files
Options
Downloads
Patches
Plain Diff
BME280: Add DFA model
parent
a4cad317
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/driver/bme280.h
+17
-0
17 additions, 0 deletions
include/driver/bme280.h
model/driver/bme280.dfa
+114
-0
114 additions, 0 deletions
model/driver/bme280.dfa
src/app/i2cdetect/main.cc
+1
-1
1 addition, 1 deletion
src/app/i2cdetect/main.cc
with
132 additions
and
1 deletion
include/driver/bme280.h
+
17
−
0
View file @
7047bcec
...
@@ -530,22 +530,39 @@ class BME280 {
...
@@ -530,22 +530,39 @@ class BME280 {
inline
void
setHumidityOversampling
(
uint8_t
os
)
{
inline
void
setHumidityOversampling
(
uint8_t
os
)
{
settings
.
osr_h
=
os
;
settings
.
osr_h
=
os
;
setSensorSettings
(
BME280_OSR_HUM_SEL
);
}
}
inline
void
setPressureOversampling
(
uint8_t
os
)
{
inline
void
setPressureOversampling
(
uint8_t
os
)
{
settings
.
osr_p
=
os
;
settings
.
osr_p
=
os
;
setSensorSettings
(
BME280_OSR_PRESS_SEL
);
}
}
inline
void
setTemperatureOversampling
(
uint8_t
os
)
{
inline
void
setTemperatureOversampling
(
uint8_t
os
)
{
settings
.
osr_t
=
os
;
settings
.
osr_t
=
os
;
setSensorSettings
(
BME280_OSR_TEMP_SEL
);
}
}
inline
void
setStandbyTime
(
uint8_t
standby_time
)
{
inline
void
setStandbyTime
(
uint8_t
standby_time
)
{
settings
.
standby_time
=
standby_time
;
settings
.
standby_time
=
standby_time
;
setSensorSettings
(
BME280_STANDBY_SEL
);
}
}
inline
void
setFilter
(
uint8_t
filter
)
{
inline
void
setFilter
(
uint8_t
filter
)
{
settings
.
filter
=
filter
;
settings
.
filter
=
filter
;
setSensorSettings
(
BME280_FILTER_SEL
);
}
inline
void
enterSleepMode
()
{
setSensorMode
(
BME280_SLEEP_MODE
);
}
inline
void
enterNormalMode
()
{
setSensorMode
(
BME280_NORMAL_MODE
);
}
inline
void
enterForcedMode
()
{
setSensorMode
(
BME280_FORCED_MODE
);
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
model/driver/bme280.dfa
0 → 100644
+
114
−
0
View file @
7047bcec
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']
This diff is collapsed.
Click to expand it.
src/app/i2cdetect/main.cc
+
1
−
1
View file @
7047bcec
...
@@ -72,7 +72,7 @@ void loop(void)
...
@@ -72,7 +72,7 @@ void loop(void)
bme280
.
settings
.
filter
=
BME280_FILTER_COEFF_OFF
;
bme280
.
settings
.
filter
=
BME280_FILTER_COEFF_OFF
;
bme280
.
settings
.
standby_time
=
BME280_STANDBY_TIME_500_MS
;
bme280
.
settings
.
standby_time
=
BME280_STANDBY_TIME_500_MS
;
bme280
.
setSensorSettings
(
BME280_OSR_PRESS_SEL
|
BME280_OSR_TEMP_SEL
|
BME280_OSR_HUM_SEL
|
BME280_FILTER_SEL
|
BME280_STANDBY_SEL
);
bme280
.
setSensorSettings
(
BME280_OSR_PRESS_SEL
|
BME280_OSR_TEMP_SEL
|
BME280_OSR_HUM_SEL
|
BME280_FILTER_SEL
|
BME280_STANDBY_SEL
);
bme280
.
setSensorMode
(
BME280_NORMAL_MODE
);
bme280
.
enterNormalMode
(
);
arch
.
delay_ms
(
100
);
arch
.
delay_ms
(
100
);
rslt
=
bme280
.
getSensorData
(
BME280_ALL
,
&
comp_data
);
rslt
=
bme280
.
getSensorData
(
BME280_ALL
,
&
comp_data
);
kout
<<
"BME280 read "
<<
rslt
<<
endl
;
kout
<<
"BME280 read "
<<
rslt
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment