Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
derf
multipass
Commits
7f1f4aee
Unverified
Commit
7f1f4aee
authored
1 year ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
MAX444006: Implement setAmbientConfig
parent
480c55a5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#65
failed
1 year ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/driver/max44006.h
+2
-1
2 additions, 1 deletion
include/driver/max44006.h
src/app/datalogger/main.cc
+5
-3
5 additions, 3 deletions
src/app/datalogger/main.cc
src/driver/max44006.cc
+20
-8
20 additions, 8 deletions
src/driver/max44006.cc
with
27 additions
and
12 deletions
include/driver/max44006.h
+
2
−
1
View file @
7f1f4aee
...
...
@@ -69,10 +69,11 @@ class MAX44006 {
MAX44006
(
unsigned
char
const
addr
=
0x45
)
:
address
(
addr
),
ambientConfig
(
TEMPEN
)
{}
uint8_t
init
();
bool
init
();
uint16_t
getTemperature
();
bool
getLight
(
float
*
red
,
float
*
green
,
float
*
blue
,
float
*
clear
,
float
*
ir
);
bool
setAmbientConfig
(
AmbientConfig
config
);
};
extern
MAX44006
max44006
;
...
...
This diff is collapsed.
Click to expand it.
src/app/datalogger/main.cc
+
5
−
3
View file @
7f1f4aee
...
...
@@ -365,9 +365,11 @@ int main(void)
#endif
#ifdef CONFIG_driver_max44006
unsigned
char
ret
;
if
((
ret
=
max44006
.
init
())
!=
0
)
{
kout
<<
"MAX44006 Initialization failed: "
<<
ret
<<
endl
;
if
(
!
max44006
.
init
())
{
kout
<<
"MAX44006 Initialization failed"
<<
endl
;
}
if
(
!
max44006
.
setAmbientConfig
(
max44006
.
AMBPGA_11
))
{
kout
<<
"MAX44006 setAmbientConfig failed"
<<
endl
;
}
#endif
...
...
This diff is collapsed.
Click to expand it.
src/driver/max44006.cc
+
20
−
8
View file @
7f1f4aee
...
...
@@ -15,41 +15,53 @@
#include
"arch.h"
uint8_t
MAX44006
::
init
()
bool
MAX44006
::
init
()
{
txbuf
[
0
]
=
interruptStatusReg
;
if
(
i2c
.
xmit
(
address
,
1
,
txbuf
,
1
,
rxbuf
)
!=
0
)
{
return
1
;
return
false
;
}
if
(
rxbuf
[
0
]
&
~
PWRON
)
{
// reset sensor
txbuf
[
1
]
=
0x10
;
if
(
i2c
.
xmit
(
address
,
2
,
txbuf
,
0
,
rxbuf
)
!=
0
)
{
return
1
;
return
false
;
}
arch
.
delay_ms
(
200
);
if
(
i2c
.
xmit
(
address
,
1
,
txbuf
,
1
,
rxbuf
)
!=
0
)
{
return
1
;
return
false
;
}
if
(
rxbuf
[
0
]
&
~
PWRON
)
{
return
2
;
return
false
;
}
}
txbuf
[
0
]
=
ambientConfigReg
;
txbuf
[
1
]
=
ambientConfig
;
if
(
i2c
.
xmit
(
address
,
2
,
txbuf
,
0
,
rxbuf
)
!=
0
)
{
return
1
;
return
false
;
}
txbuf
[
0
]
=
mainConfigReg
;
txbuf
[
1
]
=
MODE_10
;
// MODE = 10 -> Clear + RGB + IR measurement
if
(
i2c
.
xmit
(
address
,
2
,
txbuf
,
0
,
rxbuf
)
!=
0
)
{
return
1
;
return
false
;
}
return
0
;
return
true
;
}
bool
MAX44006
::
setAmbientConfig
(
AmbientConfig
config
)
{
txbuf
[
0
]
=
ambientConfigReg
;
txbuf
[
1
]
=
config
;
if
(
i2c
.
xmit
(
address
,
2
,
txbuf
,
0
,
rxbuf
)
!=
0
)
{
return
false
;
}
ambientConfig
=
config
;
return
true
;
}
uint16_t
MAX44006
::
getTemperature
()
...
...
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