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
17e78f7d
Commit
17e78f7d
authored
8 years ago
by
Sebastian Meiling
Browse files
Options
Downloads
Patches
Plain Diff
driver, mag3110: add saul auto init
parent
36526f8a
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/mag3110/mag3110_saul.c
+2
-2
2 additions, 2 deletions
drivers/mag3110/mag3110_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_mag3110.c
+71
-0
71 additions, 0 deletions
sys/auto_init/saul/auto_init_mag3110.c
with
77 additions
and
2 deletions
drivers/mag3110/mag3110_saul.c
+
2
−
2
View file @
17e78f7d
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#include
"saul.h"
#include
"saul.h"
#include
"mag3110.h"
#include
"mag3110.h"
static
int
read_
acc
(
void
*
dev
,
phydat_t
*
res
)
static
int
read_
mag
(
void
*
dev
,
phydat_t
*
res
)
{
{
mag3110_read
((
mag3110_t
*
)
dev
,
(
mag3110_data_t
*
)
res
);
mag3110_read
((
mag3110_t
*
)
dev
,
(
mag3110_data_t
*
)
res
);
...
@@ -35,7 +35,7 @@ static int read_acc(void *dev, phydat_t *res)
...
@@ -35,7 +35,7 @@ static int read_acc(void *dev, phydat_t *res)
}
}
const
saul_driver_t
mag3110_saul_driver
=
{
const
saul_driver_t
mag3110_saul_driver
=
{
.
read
=
read_
acc
,
.
read
=
read_
mag
,
.
write
=
saul_notsup
,
.
write
=
saul_notsup
,
.
type
=
SAUL_SENSE_MAG
,
.
type
=
SAUL_SENSE_MAG
,
};
};
This diff is collapsed.
Click to expand it.
sys/auto_init/auto_init.c
+
4
−
0
View file @
17e78f7d
...
@@ -271,6 +271,10 @@ void auto_init(void)
...
@@ -271,6 +271,10 @@ void auto_init(void)
extern
void
auto_init_lis3dh
(
void
);
extern
void
auto_init_lis3dh
(
void
);
auto_init_lis3dh
();
auto_init_lis3dh
();
#endif
#endif
#ifdef MODULE_MAG3110
extern
void
auto_init_mag3110
(
void
);
auto_init_mag3110
();
#endif
#ifdef MODULE_MMA8X5X
#ifdef MODULE_MMA8X5X
extern
void
auto_init_mma8x5x
(
void
);
extern
void
auto_init_mma8x5x
(
void
);
auto_init_mma8x5x
();
auto_init_mma8x5x
();
...
...
This diff is collapsed.
Click to expand it.
sys/auto_init/saul/auto_init_mag3110.c
0 → 100644
+
71
−
0
View file @
17e78f7d
/*
* Copyright (C) 2017 HAW Hamburg
*
* 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 MAG3110 magnetometers
*
* @author Sebastian Meiling <s@mlng.net>
*
* @}
*/
#ifdef MODULE_MAG3110
#include
"log.h"
#include
"saul_reg.h"
#include
"mag3110.h"
#include
"mag3110_params.h"
/**
* @brief Define the number of configured sensors
*/
#define MAG3110_NUM (sizeof(mag3110_params) / sizeof(mag3110_params[0]))
/**
* @brief Allocate memory for the device descriptors
*/
static
mag3110_t
mag3110_devs
[
MAG3110_NUM
];
/**
* @brief Memory for the SAUL registry entries
*/
static
saul_reg_t
saul_entries
[
MAG3110_NUM
];
/**
* @brief Reference the driver struct
* @{
*/
extern
const
saul_driver_t
mag3110_saul_driver
;
/** @} */
void
auto_init_mag3110
(
void
)
{
for
(
unsigned
i
=
0
;
i
<
MAG3110_NUM
;
i
++
)
{
LOG_DEBUG
(
"[auto_init_saul] initializing mag3110 #%u
\n
"
,
i
);
if
(
mag3110_init
(
&
mag3110_devs
[
i
],
&
mag3110_params
[
i
])
!=
MAG3110_OK
)
{
LOG_ERROR
(
"[auto_init_saul] error initializing mag3110 #%u
\n
"
,
i
);
continue
;
}
saul_entries
[
i
].
dev
=
&
(
mag3110_devs
[
i
]);
saul_entries
[
i
].
name
=
mag3110_saul_info
[
i
].
name
;
saul_entries
[
i
].
driver
=
&
mag3110_saul_driver
;
saul_reg_add
(
&
(
saul_entries
[
i
]));
}
}
#else
typedef
int
dont_be_pedantic
;
#endif
/* MODULE_MAG3110 */
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