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
14991400
Commit
14991400
authored
7 years ago
by
Hyungsin
Browse files
Options
Downloads
Patches
Plain Diff
sys/auto_init: add SAUL auto init for pulse counter
parent
a0587ca3
Branches
Branches containing commit
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
+4
-0
4 additions, 0 deletions
sys/auto_init/auto_init.c
sys/auto_init/saul/auto_init_pulse_counter.c
+74
-0
74 additions, 0 deletions
sys/auto_init/saul/auto_init_pulse_counter.c
with
78 additions
and
0 deletions
sys/auto_init/auto_init.c
+
4
−
0
View file @
14991400
...
...
@@ -314,6 +314,10 @@ auto_init_mpu9150();
extern
void
auto_init_tsl2561
(
void
);
auto_init_tsl2561
();
#endif
#ifdef MODULE_PULSE_COUNTER
extern
void
auto_init_pulse_counter
(
void
);
auto_init_pulse_counter
();
#endif
#ifdef MODULE_HDC1000
extern
void
auto_init_hdc1000
(
void
);
auto_init_hdc1000
();
...
...
This diff is collapsed.
Click to expand it.
sys/auto_init/saul/auto_init_pulse_counter.c
0 → 100644
+
74
−
0
View file @
14991400
/*
* Copyright (C) 2017 UC Berkeley
*
* 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 for PULSE_COUNTER devices
*
* @author Hyung-Sin Kim <hs.kim@cs.berkeley.edu>
*
* @}
*/
#ifdef MODULE_PULSE_COUNTER
#include
"log.h"
#include
"saul_reg.h"
#include
"pulse_counter_params.h"
/**
* @brief Define the number of configured sensors
*/
#define PULSE_COUNTER_NUM (sizeof(pulse_counter_params) / sizeof(pulse_counter_params[0]))
/**
* @brief Allocate memory for the device descriptors
*/
static
pulse_counter_t
pulse_counter_devs
[
PULSE_COUNTER_NUM
];
/**
* @brief Memory for the SAUL registry entries
*/
static
saul_reg_t
saul_entries
[
PULSE_COUNTER_NUM
];
/**
* @brief Define the number of configured sensors
*/
#define PULSE_COUNTER_INFO_NUM (sizeof(pulse_counter_saul_info) / sizeof(pulse_counter_saul_info[0]))
/**
* @brief Reference the driver struct
*/
extern
saul_driver_t
pulse_counter_saul_driver
;
void
auto_init_pulse_counter
(
void
)
{
assert
(
PULSE_COUNTER_NUM
==
PULSE_COUNTER_INFO_NUM
)
for
(
unsigned
i
=
0
;
i
<
PULSE_COUNTER_NUM
;
i
++
)
{
LOG_DEBUG
(
"[auto_init_saul] initializing pulse_counter #%u
\n
"
,
i
);
int
res
=
pulse_counter_init
(
&
pulse_counter_devs
[
i
],
&
pulse_counter_params
[
i
]);
if
(
res
!=
0
)
{
LOG_ERROR
(
"[auto_init_saul] error initializing pulse_counter #%u
\n
"
,
i
);
}
else
{
saul_entries
[
i
].
dev
=
&
(
pulse_counter_devs
[
i
]);
saul_entries
[
i
].
name
=
pulse_counter_saul_info
[
i
].
name
;
saul_entries
[
i
].
driver
=
&
pulse_counter_saul_driver
;
saul_reg_add
(
&
(
saul_entries
[
i
]));
}
}
}
#else
typedef
int
dont_be_pedantic
;
#endif
/* MODULE_PULSE_COUNTER */
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