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
d1fab308
Commit
d1fab308
authored
6 years ago
by
Schorcht
Browse files
Options
Downloads
Patches
Plain Diff
sys/auto_init: add SHT3X sensor driver auto init
parent
9d59e27d
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
+5
-0
5 additions, 0 deletions
sys/auto_init/auto_init.c
sys/auto_init/saul/auto_init_sht3x.c
+82
-0
82 additions, 0 deletions
sys/auto_init/saul/auto_init_sht3x.c
with
87 additions
and
0 deletions
sys/auto_init/auto_init.c
+
5
−
0
View file @
d1fab308
...
@@ -429,6 +429,11 @@ auto_init_mpu9150();
...
@@ -429,6 +429,11 @@ auto_init_mpu9150();
auto_init_mma7660
();
auto_init_mma7660
();
#endif
#endif
#ifdef MODULE_SHT3X
extern
void
auto_init_sht3x
(
void
);
auto_init_sht3x
();
#endif
#endif
/* MODULE_AUTO_INIT_SAUL */
#endif
/* MODULE_AUTO_INIT_SAUL */
#ifdef MODULE_AUTO_INIT_GNRC_RPL
#ifdef MODULE_AUTO_INIT_GNRC_RPL
...
...
This diff is collapsed.
Click to expand it.
sys/auto_init/saul/auto_init_sht3x.c
0 → 100644
+
82
−
0
View file @
d1fab308
/*
* Copyright (C) 2018 Gunar Schorcht
*
* 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
* directory for more details.
*/
/**
* @ingroup sys_auto_init_saul
* @brief Auto initialization of Sensirion SHT30/SHT31/SHT35 device driver
* @author Gunar Schorcht <gunar@schorcht.net>
* @file
*/
#ifdef MODULE_SHT3X
#include
"assert.h"
#include
"log.h"
#include
"saul_reg.h"
#include
"sht3x.h"
#include
"sht3x_params.h"
/**
* @brief Define the number of configured sensors
*/
#define SHT3X_NUM (sizeof(sht3x_params) / sizeof(sht3x_params[0]))
/**
* @brief Allocation of memory for device descriptors
*/
sht3x_dev_t
sht3x_devs
[
SHT3X_NUM
];
/**
* @brief Memory for the SAUL registry entries
*/
static
saul_reg_t
saul_entries
[
SHT3X_NUM
*
2
];
/**
* @brief Define the number of saul info
*/
#define SHT3X_INFO_NUM (sizeof(sht3x_saul_info) / sizeof(sht3x_saul_info[0]))
/**
* @name Reference the driver structs.
* @{
*/
extern
const
saul_driver_t
sht3x_saul_driver_temperature
;
extern
const
saul_driver_t
sht3x_saul_driver_humidity
;
/** @} */
void
auto_init_sht3x
(
void
)
{
assert
(
SHT3X_INFO_NUM
==
SHT3X_NUM
);
for
(
unsigned
i
=
0
;
i
<
SHT3X_NUM
;
i
++
)
{
LOG_DEBUG
(
"[auto_init_saul] initializing sht3x #%u
\n
"
,
i
);
if
(
sht3x_init
(
&
sht3x_devs
[
i
],
&
sht3x_params
[
i
])
!=
SHT3X_OK
)
{
LOG_ERROR
(
"[auto_init_saul] error initializing sht3x #%u
\n
"
,
i
);
continue
;
}
/* temperature */
saul_entries
[(
i
*
2
)].
dev
=
&
(
sht3x_devs
[
i
]);
saul_entries
[(
i
*
2
)].
name
=
sht3x_saul_info
[
i
].
name
;
saul_entries
[(
i
*
2
)].
driver
=
&
sht3x_saul_driver_temperature
;
/* relative humidity */
saul_entries
[(
i
*
2
)
+
1
].
dev
=
&
(
sht3x_devs
[
i
]);
saul_entries
[(
i
*
2
)
+
1
].
name
=
sht3x_saul_info
[
i
].
name
;
saul_entries
[(
i
*
2
)
+
1
].
driver
=
&
sht3x_saul_driver_humidity
;
/* register to saul */
saul_reg_add
(
&
(
saul_entries
[(
i
*
2
)]));
saul_reg_add
(
&
(
saul_entries
[(
i
*
2
)
+
1
]));
}
}
#else
typedef
int
dont_be_pedantic
;
#endif
/* MODULE_SHT3X */
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