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
77278719
Commit
77278719
authored
7 years ago
by
Alexandre Abadie
Browse files
Options
Downloads
Patches
Plain Diff
sys/auto_init/saul: provide saul adaption to lis3mdl
parent
aec32df1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
drivers/lis3mdl/lis3mdl_saul.c
+41
-0
41 additions, 0 deletions
drivers/lis3mdl/lis3mdl_saul.c
sys/auto_init/auto_init.c
+4
-0
4 additions, 0 deletions
sys/auto_init/auto_init.c
sys/auto_init/saul/auto_init_lis3mdl.c
+75
-0
75 additions, 0 deletions
sys/auto_init/saul/auto_init_lis3mdl.c
with
120 additions
and
0 deletions
drivers/lis3mdl/lis3mdl_saul.c
0 → 100644
+
41
−
0
View file @
77278719
/*
* Copyright (C) 2017 Inria
*
* 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 drivers_lis3mdl
* @{
*
* @file
* @brief LIS3MDL adaption to the RIOT actuator/sensor interface
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#include
<string.h>
#include
"saul.h"
#include
"lis3mdl.h"
static
int
read_mag
(
const
void
*
dev
,
phydat_t
*
res
)
{
const
lis3mdl_t
*
d
=
(
const
lis3mdl_t
*
)
dev
;
lis3mdl_read_mag
(
d
,
(
lis3mdl_3d_data_t
*
)
res
);
res
->
unit
=
UNIT_GS
;
res
->
scale
=
-
3
;
return
3
;
}
const
saul_driver_t
lis3mdl_saul_mag_driver
=
{
.
read
=
read_mag
,
.
write
=
saul_notsup
,
.
type
=
SAUL_SENSE_MAG
,
};
This diff is collapsed.
Click to expand it.
sys/auto_init/auto_init.c
+
4
−
0
View file @
77278719
...
...
@@ -274,6 +274,10 @@ void auto_init(void)
extern
void
auto_init_lis3dh
(
void
);
auto_init_lis3dh
();
#endif
#ifdef MODULE_LIS3MDL
extern
void
auto_init_lis3mdl
(
void
);
auto_init_lis3mdl
();
#endif
#ifdef MODULE_MAG3110
extern
void
auto_init_mag3110
(
void
);
auto_init_mag3110
();
...
...
This diff is collapsed.
Click to expand it.
sys/auto_init/saul/auto_init_lis3mdl.c
0 → 100644
+
75
−
0
View file @
77278719
/*
* Copyright (C) 2017 Inria
*
* 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 auto_init_saul
* @{
*
* @file
* @brief Auto initialization of LIS3MDL magnetometer
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#ifdef MODULE_LIS3MDL
#include
"log.h"
#include
"saul_reg.h"
#include
"lis3mdl.h"
#include
"lis3mdl_params.h"
/**
* @brief Define the number of configured sensors
*/
#define LIS3MDL_NUM (sizeof(lis3mdl_params)/sizeof(lis3mdl_params[0]))
/**
* @brief Allocate memory for the device descriptors
*/
static
lis3mdl_t
lis3mdl_devs
[
LIS3MDL_NUM
];
/**
* @brief Memory for the SAUL registry entries
*/
static
saul_reg_t
saul_entries
[
LIS3MDL_NUM
];
/**
* @brief Define the number of saul info
*/
#define LIS3MDL_INFO_NUM (sizeof(lis3mdl_saul_info)/sizeof(lis3mdl_saul_info[0]))
/**
* @brief Reference the driver structs
*/
extern
saul_driver_t
lis3mdl_saul_mag_driver
;
void
auto_init_lis3mdl
(
void
)
{
assert
(
LIS3MDL_NUM
==
LIS3MDL_INFO_NUM
);
for
(
unsigned
int
i
=
0
;
i
<
LIS3MDL_NUM
;
i
++
)
{
LOG_DEBUG
(
"[auto_init_saul] initializing lis3mdl #%u
\n
"
,
i
);
if
(
lis3mdl_init
(
&
lis3mdl_devs
[
i
],
&
lis3mdl_params
[
i
])
<
0
)
{
LOG_ERROR
(
"[auto_init_saul] error initializing lis3mdl #%u
\n
"
,
i
);
continue
;
}
saul_entries
[
i
].
dev
=
&
(
lis3mdl_devs
[
i
]);
saul_entries
[
i
].
name
=
lis3mdl_saul_info
[
i
].
name
;
saul_entries
[
i
].
driver
=
&
lis3mdl_saul_mag_driver
;
saul_reg_add
(
&
(
saul_entries
[
i
]));
}
}
#else
typedef
int
dont_be_pedantic
;
#endif
/* MODULE_LIS3MDL */
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