Skip to content

Commit 2fcd180

Browse files
authored
Merge pull request #17 from fgardt/push-qxrkportsrpx
add vishay VEML7700
2 parents 0a47ffd + 4f0fd2a commit 2fcd180

9 files changed

Lines changed: 683 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
target
22
result*
33
.pre-commit-config.yaml
4+
.direnv

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- move sensor and device traits into a new crate embedded-devices-hal
44
- untangle bme and bmp
55
- Configuration -> Config
6+
- update VEML7700 to use uom::si::illuminance::lux once uom 0.38 is out
67

78
codegen:
89

embedded-devices/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ all-devices = [
6565
"sensirion-sen65",
6666
"sensirion-sen66",
6767
"sensirion-sen68",
68+
"vishay-veml7700",
6869
]
6970

7071
# Analog Devices
@@ -100,5 +101,8 @@ sensirion-sen65 = []
100101
sensirion-sen66 = []
101102
sensirion-sen68 = []
102103

104+
# Vishay
105+
vishay-veml7700 = []
106+
103107
[package.metadata.docs.rs]
104108
all-features = true

embedded-devices/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Below you will find a list of all currently supported devices. Please visit thei
4747
| Sensirion | SEN65 | I2C | Particulate matter (PM1, PM2.5, PM4, PM10), VOC, NOₓ, temperature and relative humidity sensor | [Docs](https://docs.rs/embedded-devices/latest/embedded_devices/devices/sensirion/sen65/index.html) |
4848
| Sensirion | SEN66 | I2C | Particulate matter (PM1, PM2.5, PM4, PM10), CO₂, VOC, NOₓ, temperature and relative humidity sensor | [Docs](https://docs.rs/embedded-devices/latest/embedded_devices/devices/sensirion/sen66/index.html) |
4949
| Sensirion | SEN68 | I2C | Particulate matter (PM1, PM2.5, PM4, PM10), CO₂, VOC, NOₓ, HCHO, temperature and relative humidity sensor | [Docs](https://docs.rs/embedded-devices/latest/embedded_devices/devices/sensirion/sen68/index.html) |
50+
| Vishay | VEML7700 | I2C | High accuracy ambient light sensor with dynamic range | [Docs](https://docs.rs/embedded-devices/latest/embedded_devices/devices/vishay/veml7700/index.html) |
5051

5152
## Quick start
5253

embedded-devices/src/devices/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ pub mod bosch;
44
pub mod microchip;
55
pub mod sensirion;
66
pub mod texas_instruments;
7+
pub mod vishay;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#[cfg(feature = "vishay-veml7700")]
2+
pub mod veml7700;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const REGULAR_ADDRESS: u8 = 0x10;
2+
3+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
4+
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
5+
pub enum Address {
6+
/// Regular device address 0x10.
7+
Regular,
8+
/// Custom address not directly supported by the device, but may be useful
9+
/// when using address translators.
10+
Custom(u8),
11+
}
12+
13+
impl From<Address> for u8 {
14+
fn from(address: Address) -> Self {
15+
match address {
16+
Address::Regular => REGULAR_ADDRESS,
17+
Address::Custom(x) => x,
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)