Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
cm-projects
RIOT
Commits
d7543ccf
Commit
d7543ccf
authored
8 years ago
by
Alexandre Abadie
Browse files
Options
Downloads
Patches
Plain Diff
sys/auto_init: use new bmx280 implementation for bme280 and bmp280
parent
4a852abd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys/auto_init/auto_init.c
+3
-3
3 additions, 3 deletions
sys/auto_init/auto_init.c
sys/auto_init/saul/auto_init_bmx280.c
+95
-0
95 additions, 0 deletions
sys/auto_init/saul/auto_init_bmx280.c
with
98 additions
and
3 deletions
sys/auto_init/auto_init.c
+
3
−
3
View file @
d7543ccf
...
@@ -295,9 +295,9 @@ void auto_init(void)
...
@@ -295,9 +295,9 @@ void auto_init(void)
extern
void
auto_init_bmp180
(
void
);
extern
void
auto_init_bmp180
(
void
);
auto_init_bmp180
();
auto_init_bmp180
();
#endif
#endif
#ifdef
MODULE_BME280
#if
def
ined(
MODULE_BME280
) || defined(MODULE_BMP280)
extern
void
auto_init_bm
e
280
(
void
);
extern
void
auto_init_bm
x
280
(
void
);
auto_init_bm
e
280
();
auto_init_bm
x
280
();
#endif
#endif
#ifdef MODULE_JC42
#ifdef MODULE_JC42
extern
void
auto_init_jc42
(
void
);
extern
void
auto_init_jc42
(
void
);
...
...
This diff is collapsed.
Click to expand it.
sys/auto_init/saul/auto_init_bm
e
280.c
→
sys/auto_init/saul/auto_init_bm
x
280.c
+
95
−
0
View file @
d7543ccf
/*
/*
* Copyright (C) 2016 Kees Bakker, SODAQ
* Copyright (C) 2016 Kees Bakker, SODAQ
* 2017 Inria
*
*
* This file is subject to the terms and conditions of the GNU Lesser
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* General Public License v2.1. See the file LICENSE in the top level
...
@@ -11,64 +12,84 @@
...
@@ -11,64 +12,84 @@
* @{
* @{
*
*
* @file
* @file
* @brief Auto initialization of BM
E
280 driver.
* @brief Auto initialization of BM
X
280 driver.
*
*
* @author Kees Bakker <kees@sodaq.com>
* @author Kees Bakker <kees@sodaq.com>
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
*
* @}
* @}
*/
*/
#ifdef
MODULE_BME280
#if
def
ined(
MODULE_BME280
) || defined(MODULE_BMP280)
#include
"log.h"
#include
"log.h"
#include
"saul_reg.h"
#include
"saul_reg.h"
#include
"bme280.h"
#include
"bme280_params.h"
#include
"bmx280_params.h"
#include
"bmx280.h"
/**
/**
* @brief Allocation of memory for device descriptors
* @brief Allocation of memory for device descriptors
*/
*/
static
bme280_t
bme280_devs
[
BME280_NUMOF
];
static
bmx280_t
bmx280_devs
[
BMX280_NUMOF
];
/**
* @brief Reference the driver structs.
* @{
*/
extern
const
saul_driver_t
bmx280_temperature_saul_driver
;
extern
const
saul_driver_t
bmx280_pressure_saul_driver
;
#if defined(MODULE_BME280)
extern
const
saul_driver_t
bme280_relative_humidity_saul_driver
;
#endif
/** @} */
/**
/**
* @brief Memory for the SAUL registry entries
* @brief Memory for the SAUL registry entries
*/
*/
static
saul_reg_t
saul_entries
[
BME280_NUMOF
*
3
];
#if defined(MODULE_BME280)
#define SENSORS_NUMOF 3
#else
#define SENSORS_NUMOF 2
#endif
static
saul_reg_t
saul_entries
[
BMX280_NUMOF
*
SENSORS_NUMOF
];
void
auto_init_bm
e
280
(
void
)
void
auto_init_bm
x
280
(
void
)
{
{
size_t
se_ix
=
0
;
size_t
se_ix
=
0
;
for
(
size_t
i
=
0
;
i
<
BM
E
280_NUMOF
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
BM
X
280_NUMOF
;
i
++
)
{
LOG_DEBUG
(
"[auto_init_saul] initializing BM
E
280 #%u
\n
"
,
i
);
LOG_DEBUG
(
"[auto_init_saul] initializing BM
X
280 #%u
\n
"
,
i
);
int
res
=
bm
e
280_init
(
&
bm
e
280_devs
[
i
],
&
bm
e
280_params
[
i
]);
int
res
=
bm
x
280_init
(
&
bm
x
280_devs
[
i
],
&
bm
x
280_params
[
i
]);
if
(
res
<
0
)
{
if
(
res
<
0
)
{
LOG_ERROR
(
"[auto_init_saul] error initializing BM
E
280 #%i
\n
"
,
i
);
LOG_ERROR
(
"[auto_init_saul] error initializing BM
X
280 #%i
\n
"
,
i
);
continue
;
continue
;
}
}
/* temperature */
/* temperature */
saul_entries
[
se_ix
].
dev
=
&
bm
e
280_devs
[
i
];
saul_entries
[
se_ix
].
dev
=
&
bm
x
280_devs
[
i
];
saul_entries
[
se_ix
].
name
=
bm
e
280_saul_reg_info
[
i
][
0
].
name
;
saul_entries
[
se_ix
].
name
=
bm
x
280_saul_reg_info
[
i
][
0
].
name
;
saul_entries
[
se_ix
].
driver
=
&
bm
e
280_temperature_saul_driver
;
saul_entries
[
se_ix
].
driver
=
&
bm
x
280_temperature_saul_driver
;
saul_reg_add
(
&
saul_entries
[
se_ix
]);
saul_reg_add
(
&
saul_entries
[
se_ix
]);
se_ix
++
;
se_ix
++
;
/* re
lative humidity
*/
/*
p
re
ssure
*/
saul_entries
[
se_ix
].
dev
=
&
bm
e
280_devs
[
i
];
saul_entries
[
se_ix
].
dev
=
&
bm
x
280_devs
[
i
];
saul_entries
[
se_ix
].
name
=
bm
e
280_saul_reg_info
[
i
][
1
].
name
;
saul_entries
[
se_ix
].
name
=
bm
x
280_saul_reg_info
[
i
][
1
].
name
;
saul_entries
[
se_ix
].
driver
=
&
bm
e
280_re
lative_humidity
_saul_driver
;
saul_entries
[
se_ix
].
driver
=
&
bm
x
280_
p
re
ssure
_saul_driver
;
saul_reg_add
(
&
saul_entries
[
se_ix
]);
saul_reg_add
(
&
saul_entries
[
se_ix
]);
se_ix
++
;
se_ix
++
;
/* pressure */
#if defined(MODULE_BME280)
saul_entries
[
se_ix
].
dev
=
&
bme280_devs
[
i
];
/* relative humidity */
saul_entries
[
se_ix
].
name
=
bme280_saul_reg_info
[
i
][
2
].
name
;
saul_entries
[
se_ix
].
dev
=
&
bmx280_devs
[
i
];
saul_entries
[
se_ix
].
driver
=
&
bme280_pressure_saul_driver
;
saul_entries
[
se_ix
].
name
=
bmx280_saul_reg_info
[
i
][
2
].
name
;
saul_entries
[
se_ix
].
driver
=
&
bme280_relative_humidity_saul_driver
;
saul_reg_add
(
&
saul_entries
[
se_ix
]);
saul_reg_add
(
&
saul_entries
[
se_ix
]);
se_ix
++
;
se_ix
++
;
#endif
}
}
}
}
#else
#else
typedef
int
dont_be_pedantic
;
typedef
int
dont_be_pedantic
;
#endif
/* MODULE_BM
E
280 */
#endif
/* MODULE_BM
X
280 */
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