mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Add I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor
This commit is contained in:
parent
bd90363565
commit
bec0c27750
@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
|
||||
- I2C bus2 support to ADS1115 A/D Converter
|
||||
- I2C bus2 support to SHTxX temperature and humidity sensor
|
||||
- I2C bus2 support to HYTxxx temperature and humidity sensor
|
||||
- I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
|
@ -37,9 +37,9 @@ Index | Define | Driver | Device | Address(es) | Bus2 | Descrip
|
||||
16 | USE_TSL2561 | xsns_16 | TSL2561 | 0x29, 0x39, 0x49 | | Light intensity sensor
|
||||
17 | USE_MGS | xsns_19 | Grove | 0x04 | | Multichannel gas sensor
|
||||
18 | USE_SGP30 | xsns_21 | SGP30 | 0x58 | | Gas (TVOC) and air quality sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1145 | 0x60 | | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1146 | 0x60 | | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1147 | 0x60 | | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1145 | 0x60 | Yes | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1146 | 0x60 | Yes | Ultra violet index and light sensor
|
||||
19 | USE_SI1145 | xsns_24 | SI1147 | 0x60 | Yes | Ultra violet index and light sensor
|
||||
20 | USE_LM75AD | xsns_26 | LM75AD | 0x48 - 0x4F | | Temperature sensor
|
||||
21 | USE_APDS9960 | xsns_27 | APDS9960 | 0x39 | | Proximity ambient light RGB and gesture sensor
|
||||
22 | USE_MCP230xx | xsns_29 | MCP23008 | 0x20 - 0x26 | | 8-bit I/O expander
|
||||
|
@ -119,6 +119,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||
- I2C bus2 support to ADS1115 A/D Converter
|
||||
- I2C bus2 support to SHTxX temperature and humidity sensor
|
||||
- I2C bus2 support to HYTxxx temperature and humidity sensor
|
||||
- I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
|
@ -188,27 +188,24 @@ uint16_t si1145_infrared;
|
||||
uint16_t si1145_uvindex;
|
||||
|
||||
bool si1145_type = false;
|
||||
uint8_t si1145_bus = 0;
|
||||
uint8_t si1145_valid = 0;
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
uint8_t Si1145ReadByte(uint8_t reg)
|
||||
{
|
||||
return I2cRead8(SI114X_ADDR, reg);
|
||||
uint8_t Si1145ReadByte(uint8_t reg) {
|
||||
return I2cRead8(SI114X_ADDR, reg, si1145_bus);
|
||||
}
|
||||
|
||||
uint16_t Si1145ReadHalfWord(uint8_t reg)
|
||||
{
|
||||
return I2cRead16LE(SI114X_ADDR, reg);
|
||||
uint16_t Si1145ReadHalfWord(uint8_t reg) {
|
||||
return I2cRead16LE(SI114X_ADDR, reg, si1145_bus);
|
||||
}
|
||||
|
||||
void Si1145WriteByte(uint8_t reg, uint16_t val)
|
||||
{
|
||||
I2cWrite8(SI114X_ADDR, reg, val);
|
||||
void Si1145WriteByte(uint8_t reg, uint16_t val) {
|
||||
I2cWrite8(SI114X_ADDR, reg, val, si1145_bus);
|
||||
}
|
||||
|
||||
uint8_t Si1145WriteParamData(uint8_t p, uint8_t v)
|
||||
{
|
||||
uint8_t Si1145WriteParamData(uint8_t p, uint8_t v) {
|
||||
Si1145WriteByte(SI114X_WR, v);
|
||||
Si1145WriteByte(SI114X_COMMAND, p | SI114X_SET);
|
||||
return Si1145ReadByte(SI114X_RD);
|
||||
@ -324,13 +321,15 @@ bool Si1145Read(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Si1145Detect(void)
|
||||
{
|
||||
if (!I2cSetDevice(SI114X_ADDR)) { return; }
|
||||
void Si1145Detect(void) {
|
||||
for (si1145_bus = 0; si1145_bus < 2; si1145_bus++) {
|
||||
if (!I2cSetDevice(SI114X_ADDR, si1145_bus)) { continue; }
|
||||
|
||||
if (Si1145Begin()) {
|
||||
si1145_type = true;
|
||||
I2cSetActiveFound(SI114X_ADDR, "SI1145");
|
||||
if (Si1145Begin()) {
|
||||
si1145_type = true;
|
||||
I2cSetActiveFound(SI114X_ADDR, "SI1145", si1145_bus);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user