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
e391c1bc
Commit
e391c1bc
authored
5 years ago
by
Daniel Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Add preliminary version of HDC1080 driver (not working reliably yet)
parent
8e0cde61
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+5
-0
5 additions, 0 deletions
Makefile
include/driver/hdc1080.h
+22
-0
22 additions, 0 deletions
include/driver/hdc1080.h
src/app/i2cdetect/main.cc
+13
-0
13 additions, 0 deletions
src/app/i2cdetect/main.cc
src/driver/hdc1080.cc
+51
-0
51 additions, 0 deletions
src/driver/hdc1080.cc
with
91 additions
and
0 deletions
Makefile
+
5
−
0
View file @
e391c1bc
...
@@ -63,6 +63,11 @@ ifneq ($(findstring max44009,${drivers}), )
...
@@ -63,6 +63,11 @@ ifneq ($(findstring max44009,${drivers}), )
COMMON_FLAGS
+=
-DDRIVER_MAX44009
COMMON_FLAGS
+=
-DDRIVER_MAX44009
endif
endif
ifneq
($(findstring hdc1080,${drivers}), )
CXX_TARGETS
+=
src/driver/hdc1080.cc
COMMON_FLAGS
+=
-DDRIVER_HDC1080
endif
ifneq
($(findstring mmsimple,${drivers}), )
ifneq
($(findstring mmsimple,${drivers}), )
CXX_TARGETS
+=
src/driver/mmsimple.cc
CXX_TARGETS
+=
src/driver/mmsimple.cc
COMMON_FLAGS
+=
-DDRIVER_MMSIMPLE
COMMON_FLAGS
+=
-DDRIVER_MMSIMPLE
...
...
This diff is collapsed.
Click to expand it.
include/driver/hdc1080.h
0 → 100644
+
22
−
0
View file @
e391c1bc
#ifndef HDC1080_H
#define HDC1080_H
class
HDC1080
{
private:
HDC1080
(
const
HDC1080
&
copy
);
unsigned
char
const
address
=
0x40
;
unsigned
char
txbuf
[
3
];
unsigned
char
rxbuf
[
2
];
public:
HDC1080
()
{}
float
getTemp
();
float
getRH
();
unsigned
int
getManufacturerID
();
void
init
();
};
extern
HDC1080
hdc1080
;
#endif
This diff is collapsed.
Click to expand it.
src/app/i2cdetect/main.cc
+
13
−
0
View file @
e391c1bc
...
@@ -25,6 +25,9 @@
...
@@ -25,6 +25,9 @@
#ifdef DRIVER_MAX44009
#ifdef DRIVER_MAX44009
#include
"driver/max44009.h"
#include
"driver/max44009.h"
#endif
#endif
#ifdef DRIVER_HDC1080
#include
"driver/hdc1080.h"
#endif
#ifdef DRIVER_MMSIMPLE
#ifdef DRIVER_MMSIMPLE
#include
"driver/mmsimple.h"
#include
"driver/mmsimple.h"
#endif
#endif
...
@@ -81,6 +84,10 @@ void loop(void)
...
@@ -81,6 +84,10 @@ void loop(void)
#ifdef DRIVER_CCS811
#ifdef DRIVER_CCS811
kout
<<
"CCS811 status is "
<<
ccs811
.
check
()
<<
endl
;
kout
<<
"CCS811 status is "
<<
ccs811
.
check
()
<<
endl
;
#endif
#endif
#ifdef DRIVER_HDC1080
kout
<<
"HDC1080 temperature "
<<
hdc1080
.
getTemp
()
<<
" degC"
<<
endl
;
kout
<<
"HDC1080 humidity "
<<
hdc1080
.
getRH
()
<<
" %H"
<<
endl
;
#endif
#ifdef DRIVER_MAX44009
#ifdef DRIVER_MAX44009
kout
.
printf_float
(
max44009
.
getLux
());
kout
.
printf_float
(
max44009
.
getLux
());
kout
<<
endl
;
kout
<<
endl
;
...
@@ -118,6 +125,12 @@ int main(void)
...
@@ -118,6 +125,12 @@ int main(void)
#ifdef DRIVER_CCS811
#ifdef DRIVER_CCS811
ccs811
.
init
();
ccs811
.
init
();
#endif
#endif
#ifdef DRIVER_HDC1080
hdc1080
.
init
();
if
(
hdc1080
.
getManufacturerID
()
!=
0x5449
)
{
kout
<<
"[!] invalid HDC1080 manufacturer ID: "
<<
hex
<<
hdc1080
.
getManufacturerID
()
<<
endl
;
}
#endif
for
(
unsigned
char
i
=
0
;
i
<
sizeof
(
i2c_status
)
/
sizeof
(
unsigned
int
);
i
++
)
{
for
(
unsigned
char
i
=
0
;
i
<
sizeof
(
i2c_status
)
/
sizeof
(
unsigned
int
);
i
++
)
{
i2c_status
[
i
]
=
0
;
i2c_status
[
i
]
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/driver/hdc1080.cc
0 → 100644
+
51
−
0
View file @
e391c1bc
#include
"driver/hdc1080.h"
#include
"arch.h"
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(DRIVER_SOFTI2C)
#include
"driver/i2c.h"
#else
#include
"driver/soft_i2c.h"
#endif
float
HDC1080
::
getTemp
()
{
txbuf
[
0
]
=
0x00
;
i2c
.
xmit
(
address
,
1
,
txbuf
,
0
,
rxbuf
);
arch
.
delay_ms
(
10
);
i2c
.
xmit
(
address
,
0
,
txbuf
,
2
,
rxbuf
);
return
(((
unsigned
int
)
rxbuf
[
0
]
<<
8
)
|
rxbuf
[
1
])
*
.00251770019531250000
-
40.
;
}
float
HDC1080
::
getRH
()
{
txbuf
[
0
]
=
0x01
;
i2c
.
xmit
(
address
,
1
,
txbuf
,
0
,
rxbuf
);
arch
.
delay_ms
(
10
);
i2c
.
xmit
(
address
,
0
,
txbuf
,
2
,
rxbuf
);
return
(((
unsigned
int
)
rxbuf
[
0
]
<<
8
)
|
rxbuf
[
1
])
*
.00152587890625000000
;
}
unsigned
int
HDC1080
::
getManufacturerID
()
{
txbuf
[
0
]
=
0xfe
;
i2c
.
xmit
(
address
,
1
,
txbuf
,
2
,
rxbuf
);
return
(
unsigned
int
)
rxbuf
[
0
]
<<
8
|
rxbuf
[
1
];
}
void
HDC1080
::
init
()
{
txbuf
[
0
]
=
0x02
;
txbuf
[
1
]
=
0x08
;
txbuf
[
2
]
=
0x00
;
i2c
.
xmit
(
address
,
3
,
txbuf
,
0
,
rxbuf
);
arch
.
delay_ms
(
15
);
}
HDC1080
hdc1080
;
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