mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 05:06:32 +00:00
solve merge conflict
This commit is contained in:
commit
8033920f45
@ -131,6 +131,7 @@
|
|||||||
| USE_VEML7700 | - | - | - | - | - | - | - |
|
| USE_VEML7700 | - | - | - | - | - | - | - |
|
||||||
| USE_MCP9808 | - | - | - | - | - | - | - |
|
| USE_MCP9808 | - | - | - | - | - | - | - |
|
||||||
| USE_HP303B | - | - | - | - | - | - | - |
|
| USE_HP303B | - | - | - | - | - | - | - |
|
||||||
|
| USE_EZOCO2 | - | - | - | - | - | - | - |
|
||||||
| USE_EZOEC | - | - | - | - | - | - | - |
|
| USE_EZOEC | - | - | - | - | - | - | - |
|
||||||
| USE_EZOHUM | - | - | - | - | - | - | - |
|
| USE_EZOHUM | - | - | - | - | - | - | - |
|
||||||
| USE_EZOORP | - | - | - | - | - | - | - |
|
| USE_EZOORP | - | - | - | - | - | - | - |
|
||||||
|
@ -3,17 +3,23 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
## [Unreleased] - Development
|
## [Unreleased] - Development
|
||||||
|
|
||||||
## [9.0.0.2]
|
## [9.0.0.3]
|
||||||
|
### Added
|
||||||
|
- TLS in binary tasmota-zbbridge (#9620)
|
||||||
|
|
||||||
|
## [9.0.0.2] - 20201025
|
||||||
### Added
|
### Added
|
||||||
- Support for Vietnamese language translations by Tâm.NT
|
- Support for Vietnamese language translations by Tâm.NT
|
||||||
- Support for timers in case of no-sunset permanent day by cybermaus (#9543)
|
- Support for timers in case of no-sunset permanent day by cybermaus (#9543)
|
||||||
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
|
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
|
||||||
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593)
|
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593)
|
||||||
- Command ``ShutterChange`` to increment change position (#9594)
|
- Command ``ShutterChange`` to increment change position (#9594)
|
||||||
|
- Command ``SetOption113 1`` to set dimmer low on rotary dial after power off
|
||||||
- Support for EZO Ph and ORP sensors by Christopher Tremblay (#9567)
|
- Support for EZO Ph and ORP sensors by Christopher Tremblay (#9567)
|
||||||
- Support for EZO RTD sensors by Christopher Tremblay (#9585)
|
- Support for EZO RTD sensors by Christopher Tremblay (#9585)
|
||||||
- Support for EZO HUM sensors by Christopher Tremblay (#9599)
|
- Support for EZO HUM sensors by Christopher Tremblay (#9599)
|
||||||
- Support for EZO EC sensors by Christopher Tremblay (#9613)
|
- Support for EZO EC sensors by Christopher Tremblay (#9613)
|
||||||
|
- Support for EZO CO2 sensors by Christopher Tremblay (#9619)
|
||||||
- On ZigbeeBridge support for glowing led when permit join is active (#9581)
|
- On ZigbeeBridge support for glowing led when permit join is active (#9581)
|
||||||
- Support for PWM Dimmer multi-press and ledmask (#9584)
|
- Support for PWM Dimmer multi-press and ledmask (#9584)
|
||||||
- Support for fixed output Hi or Lo GPIO selection
|
- Support for fixed output Hi or Lo GPIO selection
|
||||||
|
@ -77,7 +77,9 @@ Index | Define | Driver | Device | Address(es) | Description
|
|||||||
52 | USE_HP303B | xsns_73 | HP303B | 0x76 - 0x77 | Pressure and temperature sensor
|
52 | USE_HP303B | xsns_73 | HP303B | 0x76 - 0x77 | Pressure and temperature sensor
|
||||||
53 | USE_MLX90640 | xdrv_84 | MLX90640 | 0x33 | IR array temperature sensor
|
53 | USE_MLX90640 | xdrv_84 | MLX90640 | 0x33 | IR array temperature sensor
|
||||||
54 | USE_VL53L1X | xsns_77 | VL53L1X | 0x29 | Time-of-flight (ToF) distance sensor
|
54 | USE_VL53L1X | xsns_77 | VL53L1X | 0x29 | Time-of-flight (ToF) distance sensor
|
||||||
55 | USE_EZOPH | xsns_78 | EZOPH | 0x61 - 0x70 | pH Sensor
|
55 | USE_EZOPH | xsns_78 | EZOPH | 0x61 - 0x70 | pH sensor
|
||||||
55 | USE_EZOORP | xsns_78 | EZOORP | 0x61 - 0x70 | ORP Sensor
|
55 | USE_EZOORP | xsns_78 | EZOORP | 0x61 - 0x70 | ORP sensor
|
||||||
55 | USE_EZORTD | xsns_78 | EZORTD | 0x61 - 0x70 | Temperature Sensor
|
55 | USE_EZORTD | xsns_78 | EZORTD | 0x61 - 0x70 | Temperature sensor
|
||||||
55 | USE_EZOHUM | xsns_78 | EZORTD | 0x61 - 0x70 | Humidity Sensor
|
55 | USE_EZOHUM | xsns_78 | EZOHUM | 0x61 - 0x70 | Humidity sensor
|
||||||
|
55 | USE_EZOEC | xsns_78 | EZOEC | 0x61 - 0x70 | Electric conductivity sensor
|
||||||
|
55 | USE_EZOCO2 | xsns_78 | EZOCO2 | 0x61 - 0x70 | CO2 sensor
|
||||||
|
@ -57,11 +57,12 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
|
|
||||||
[Complete list](BUILDS.md) of available feature and sensors.
|
[Complete list](BUILDS.md) of available feature and sensors.
|
||||||
|
|
||||||
## Changelog v9.0.0.2
|
## Changelog v9.0.0.3
|
||||||
### Added
|
### Added
|
||||||
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
|
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
|
||||||
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593)
|
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593)
|
||||||
- Command ``ShutterChange`` to increment change position (#9594)
|
- Command ``ShutterChange`` to increment change position (#9594)
|
||||||
|
- Command ``SetOption113 1`` to set dimmer low on rotary dial after power off
|
||||||
- Zigbee command ``ZbData`` for better support of device specific data
|
- Zigbee command ``ZbData`` for better support of device specific data
|
||||||
- Optional support for Mitsubishi Electric HVAC by David Gwynne (#9237)
|
- Optional support for Mitsubishi Electric HVAC by David Gwynne (#9237)
|
||||||
- Optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353)
|
- Optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353)
|
||||||
@ -72,8 +73,9 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
- Support for analog buttons indexed within standard button range
|
- Support for analog buttons indexed within standard button range
|
||||||
- Support for Vietnamese language translations by Tâm.NT
|
- Support for Vietnamese language translations by Tâm.NT
|
||||||
- Support for timers in case of no-sunset permanent day by cybermaus (#9543)
|
- Support for timers in case of no-sunset permanent day by cybermaus (#9543)
|
||||||
- Support for EZO EC, HUM, ORP, Ph and RTD sensors by Christopher Tremblay
|
- Support for EZO CO2, EC, HUM, ORP, Ph and RTD sensors by Christopher Tremblay
|
||||||
- Support for fixed output Hi or Lo GPIO selection
|
- Support for fixed output Hi or Lo GPIO selection
|
||||||
|
- TLS in binary tasmota-zbbridge (#9620)
|
||||||
- ESP32 support for Wireless-Tag WT32-ETH01 (#9496)
|
- ESP32 support for Wireless-Tag WT32-ETH01 (#9496)
|
||||||
- ESP32 MI32 Beacon support, RSSI at TELEPERIOD, refactoring (#9609)
|
- ESP32 MI32 Beacon support, RSSI at TELEPERIOD, refactoring (#9609)
|
||||||
|
|
||||||
|
334
lib/AT24C256_512/Eeprom24C128_256.cpp
Normal file
334
lib/AT24C256_512/Eeprom24C128_256.cpp
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* \brief EEPROM 24C128 / 24C256 library for Arduino
|
||||||
|
* \author Copyright (C) 2012 Julien Le Sech - www.idreammicro.com
|
||||||
|
* \version 1.0
|
||||||
|
* \date 20120203
|
||||||
|
*
|
||||||
|
* This file is part of the EEPROM 24C128 / 24C256 library for Arduino.
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU Lesser General Public License as published by the Free
|
||||||
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see http://www.gnu.org/licenses/
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \file Eeprom24C128_256.cpp
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Header file inclusions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
#include <Eeprom24C128_256.h>
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Private macro definitions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \def EEPROM__PAGE_SIZE
|
||||||
|
* \brief Size of a page in EEPROM memory.
|
||||||
|
* This size is given by EEPROM memory datasheet.
|
||||||
|
******************************************************************************/
|
||||||
|
#define EEPROM__PAGE_SIZE 64
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \def EEPROM__RD_BUFFER_SIZE
|
||||||
|
* \brief Size of input TWI buffer.
|
||||||
|
* This size is equal to BUFFER_LENGTH defined in Wire library (32 bytes).
|
||||||
|
******************************************************************************/
|
||||||
|
#define xBUFFER_LENGTH 24
|
||||||
|
#define EEPROM__RD_BUFFER_SIZE xBUFFER_LENGTH
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \def EEPROM__WR_BUFFER_SIZE
|
||||||
|
* \brief Size of output TWI buffer.
|
||||||
|
* This size is equal to BUFFER_LENGTH - 2 bytes reserved for address.
|
||||||
|
******************************************************************************/
|
||||||
|
#define EEPROM__WR_BUFFER_SIZE (xBUFFER_LENGTH - 2)
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Public method definitions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn Eeprom24C128_256::Eeprom24C128_256(byte deviceAddress)
|
||||||
|
*
|
||||||
|
* \brief Constructor.
|
||||||
|
*
|
||||||
|
* \param deviceAddress EEPROM address on TWI bus.
|
||||||
|
******************************************************************************/
|
||||||
|
Eeprom24C128_256::Eeprom24C128_256
|
||||||
|
(
|
||||||
|
byte deviceAddress
|
||||||
|
){
|
||||||
|
m_deviceAddress = deviceAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C128_256::initialize()
|
||||||
|
*
|
||||||
|
* \brief Initialize library and TWI bus.
|
||||||
|
*
|
||||||
|
* If several devices are connected to TWI bus, this method mustn't be
|
||||||
|
* called. TWI bus must be initialized out of this library using
|
||||||
|
* Wire.begin() method.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C128_256::initialize()
|
||||||
|
{
|
||||||
|
Wire.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C128_256::writeByte(
|
||||||
|
* word address,
|
||||||
|
* byte data)
|
||||||
|
*
|
||||||
|
* \brief Write a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \remarks A delay of 10 ms is required after write cycle.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
* \param data Byte to write.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C128_256::writeByte
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte data
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
Wire.write(data);
|
||||||
|
Wire.endTransmission();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C128_256::writeBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to write.
|
||||||
|
* \param[in] p_data Bytes to write.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C128_256::writeBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
// Write first page if not aligned.
|
||||||
|
byte notAlignedLength = 0;
|
||||||
|
byte pageOffset = address % EEPROM__PAGE_SIZE;
|
||||||
|
if (pageOffset > 0)
|
||||||
|
{
|
||||||
|
notAlignedLength = EEPROM__PAGE_SIZE - pageOffset;
|
||||||
|
if (length < notAlignedLength)
|
||||||
|
{
|
||||||
|
notAlignedLength = length;
|
||||||
|
}
|
||||||
|
writePage(address, notAlignedLength, p_data);
|
||||||
|
length -= notAlignedLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length > 0)
|
||||||
|
{
|
||||||
|
address += notAlignedLength;
|
||||||
|
p_data += notAlignedLength;
|
||||||
|
|
||||||
|
// Write complete and aligned pages.
|
||||||
|
word pageCount = length / EEPROM__PAGE_SIZE;
|
||||||
|
for (word i = 0; i < pageCount; i++)
|
||||||
|
{
|
||||||
|
writePage(address, EEPROM__PAGE_SIZE, p_data);
|
||||||
|
address += EEPROM__PAGE_SIZE;
|
||||||
|
p_data += EEPROM__PAGE_SIZE;
|
||||||
|
length -= EEPROM__PAGE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length > 0)
|
||||||
|
{
|
||||||
|
// Write remaining uncomplete page.
|
||||||
|
writePage(address, length, p_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn byte Eeprom24C128_256::readByte(word address)
|
||||||
|
*
|
||||||
|
* \brief Read a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
*
|
||||||
|
* \return Read byte.
|
||||||
|
******************************************************************************/
|
||||||
|
byte
|
||||||
|
Eeprom24C128_256::readByte
|
||||||
|
(
|
||||||
|
word address
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(m_deviceAddress, (byte)1);
|
||||||
|
byte data = 0;
|
||||||
|
if (Wire.available())
|
||||||
|
{
|
||||||
|
data = Wire.read();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C128_256::readBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to read.
|
||||||
|
* \patam[in] p_data Byte array to fill with read bytes.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C128_256::readBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
byte bufferCount = length / EEPROM__RD_BUFFER_SIZE;
|
||||||
|
for (byte i = 0; i < bufferCount; i++)
|
||||||
|
{
|
||||||
|
word offset = i * EEPROM__RD_BUFFER_SIZE;
|
||||||
|
readBuffer(address + offset, EEPROM__RD_BUFFER_SIZE, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte remainingBytes = length % EEPROM__RD_BUFFER_SIZE;
|
||||||
|
word offset = length - remainingBytes;
|
||||||
|
readBuffer(address + offset, remainingBytes, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Private method definitions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C128_256::writePage(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write page in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (EEPROM__PAGE_SIZE bytes max).
|
||||||
|
* \param[in] p_data Data.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C128_256::writePage
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
// Write complete buffers.
|
||||||
|
byte bufferCount = length / EEPROM__WR_BUFFER_SIZE;
|
||||||
|
for (byte i = 0; i < bufferCount; i++)
|
||||||
|
{
|
||||||
|
byte offset = i * EEPROM__WR_BUFFER_SIZE;
|
||||||
|
writeBuffer(address + offset, EEPROM__WR_BUFFER_SIZE, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write remaining bytes.
|
||||||
|
byte remainingBytes = length % EEPROM__WR_BUFFER_SIZE;
|
||||||
|
byte offset = length - remainingBytes;
|
||||||
|
writeBuffer(address + offset, remainingBytes, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C128_256::writeBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes into memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (EEPROM__WR_BUFFER_SIZE bytes max).
|
||||||
|
* \param[in] p_data Data.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C128_256::writeBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
for (byte i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
Wire.write(p_data[i]);
|
||||||
|
}
|
||||||
|
Wire.endTransmission();
|
||||||
|
|
||||||
|
// Write cycle time (tWR). See EEPROM memory datasheet for more details.
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C128_256::readBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (EEPROM__RD_BUFFER_SIZE bytes max).
|
||||||
|
* \param[in] p_data Buffer to fill with read bytes.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C128_256::readBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(m_deviceAddress, length);
|
||||||
|
for (byte i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if (Wire.available())
|
||||||
|
{
|
||||||
|
p_data[i] = Wire.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
212
lib/AT24C256_512/Eeprom24C128_256.h
Normal file
212
lib/AT24C256_512/Eeprom24C128_256.h
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* \brief EEPROM 24C128 / 24C256 library for Arduino
|
||||||
|
* \author Copyright (C) 2012 Julien Le Sech - www.idreammicro.com
|
||||||
|
* \version 1.0
|
||||||
|
* \date 20120203
|
||||||
|
*
|
||||||
|
* This file is part of the EEPROM 24C128 / 24C256 library for Arduino.
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU Lesser General Public License as published by the Free
|
||||||
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see http://www.gnu.org/licenses/
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \headerfile Eeprom24C128_256.h
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef Eeprom24C128_256_h
|
||||||
|
#define Eeprom24C128_256_h
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Header file inclusion.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \class Eeprom24C128_256
|
||||||
|
*
|
||||||
|
* \brief EEPROM 24C128 / 24C256 memory driver.
|
||||||
|
*
|
||||||
|
* This driver is mainly designed for 24C128 and 24C256 EEPROM memories. It's
|
||||||
|
* also suitable for 24C512 memories.
|
||||||
|
******************************************************************************/
|
||||||
|
class Eeprom24C128_256
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn Eeprom24C128_256(byte deviceAddress)
|
||||||
|
*
|
||||||
|
* \brief Constructor.
|
||||||
|
*
|
||||||
|
* \param deviceAddress EEPROM address on TWI bus.
|
||||||
|
**********************************************************************/
|
||||||
|
Eeprom24C128_256
|
||||||
|
(
|
||||||
|
byte deviceAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void initialize()
|
||||||
|
*
|
||||||
|
* \brief Initialize library abnd TWI bus.
|
||||||
|
*
|
||||||
|
* If several devices are connected to TWI bus, this method mustn't be
|
||||||
|
* called. TWI bus must be initialized out of this library using
|
||||||
|
* Wire.begin() method.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
initialize();
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writeByte(
|
||||||
|
* word address,
|
||||||
|
* byte data)
|
||||||
|
*
|
||||||
|
* \brief Write a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \remarks A delay of 10 ms is required after write cycle.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
* \param data Byte to write.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writeByte
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writeBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to write.
|
||||||
|
* \param[in] p_data Bytes to write.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writeBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn byte readByte(word address)
|
||||||
|
*
|
||||||
|
* \brief Read a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
*
|
||||||
|
* \return Read byte.
|
||||||
|
**********************************************************************/
|
||||||
|
byte
|
||||||
|
readByte
|
||||||
|
(
|
||||||
|
word address
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void readBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to read.
|
||||||
|
* \patam[in] p_data Byte array to fill with read bytes.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
readBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
byte m_deviceAddress;
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writePage(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write page in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (64 bytes max).
|
||||||
|
* \param[in] p_data Data.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writePage
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writeBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes into memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (30 bytes max).
|
||||||
|
* \param[in] p_date Data.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writeBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void readBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to read (32 bytes max).
|
||||||
|
* \param[in] p_data Buffer to fill with read bytes.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
readBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // Eeprom24C128_256_h
|
||||||
|
|
334
lib/AT24C256_512/Eeprom24C512.cpp
Normal file
334
lib/AT24C256_512/Eeprom24C512.cpp
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* \brief EEPROM 24C512 library for Arduino
|
||||||
|
* \author Copyright (C) 2012 Julien Le Sech - www.idreammicro.com
|
||||||
|
* \version 1.0
|
||||||
|
* \date 20120218
|
||||||
|
*
|
||||||
|
* This file is part of the EEPROM 24C512 library for Arduino.
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU Lesser General Public License as published by the Free
|
||||||
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see http://www.gnu.org/licenses/
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \file Eeprom24C512.cpp
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Header file inclusions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
#include <Eeprom24C512.h>
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Private macro definitions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \def EEPROM__PAGE_SIZE
|
||||||
|
* \brief Size of a page in EEPROM memory.
|
||||||
|
* This size is given by EEPROM memory datasheet.
|
||||||
|
******************************************************************************/
|
||||||
|
#define EEPROM__PAGE_SIZE 128
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \def EEPROM__RD_BUFFER_SIZE
|
||||||
|
* \brief Size of input TWI buffer.
|
||||||
|
* This size is equal to BUFFER_LENGTH defined in Wire library (32 bytes).
|
||||||
|
******************************************************************************/
|
||||||
|
#define EEPROM__RD_BUFFER_SIZE BUFFER_LENGTH
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \def EEPROM__WR_BUFFER_SIZE
|
||||||
|
* \brief Size of output TWI buffer.
|
||||||
|
* This size is equal to BUFFER_LENGTH - 2 bytes reserved for address.
|
||||||
|
******************************************************************************/
|
||||||
|
#define EEPROM__WR_BUFFER_SIZE (BUFFER_LENGTH - 2)
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Public method definitions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn Eeprom24C512::Eeprom24C512(byte deviceAddress)
|
||||||
|
*
|
||||||
|
* \brief Constructor.
|
||||||
|
*
|
||||||
|
* \param deviceAddress EEPROM address on TWI bus.
|
||||||
|
******************************************************************************/
|
||||||
|
Eeprom24C512::Eeprom24C512
|
||||||
|
(
|
||||||
|
byte deviceAddress
|
||||||
|
){
|
||||||
|
m_deviceAddress = deviceAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C512::initialize()
|
||||||
|
*
|
||||||
|
* \brief Initialize library and TWI bus.
|
||||||
|
*
|
||||||
|
* If several devices are connected to TWI bus, this method mustn't be
|
||||||
|
* called. TWI bus must be initialized out of this library using
|
||||||
|
* Wire.begin() method.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C512::initialize()
|
||||||
|
{
|
||||||
|
Wire.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C512::writeByte(
|
||||||
|
* word address,
|
||||||
|
* byte data)
|
||||||
|
*
|
||||||
|
* \brief Write a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \remarks A delay of 10 ms is required after write cycle.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
* \param data Byte to write.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C512::writeByte
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte data
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
Wire.write(data);
|
||||||
|
Wire.endTransmission();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C512::writeBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to write.
|
||||||
|
* \param[in] p_data Bytes to write.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C512::writeBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
// Write first page if not aligned.
|
||||||
|
byte notAlignedLength = 0;
|
||||||
|
byte pageOffset = address % EEPROM__PAGE_SIZE;
|
||||||
|
if (pageOffset > 0)
|
||||||
|
{
|
||||||
|
notAlignedLength = EEPROM__PAGE_SIZE - pageOffset;
|
||||||
|
if (length < notAlignedLength)
|
||||||
|
{
|
||||||
|
notAlignedLength = length;
|
||||||
|
}
|
||||||
|
writePage(address, notAlignedLength, p_data);
|
||||||
|
length -= notAlignedLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length > 0)
|
||||||
|
{
|
||||||
|
address += notAlignedLength;
|
||||||
|
p_data += notAlignedLength;
|
||||||
|
|
||||||
|
// Write complete and aligned pages.
|
||||||
|
word pageCount = length / EEPROM__PAGE_SIZE;
|
||||||
|
for (word i = 0; i < pageCount; i++)
|
||||||
|
{
|
||||||
|
writePage(address, EEPROM__PAGE_SIZE, p_data);
|
||||||
|
address += EEPROM__PAGE_SIZE;
|
||||||
|
p_data += EEPROM__PAGE_SIZE;
|
||||||
|
length -= EEPROM__PAGE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length > 0)
|
||||||
|
{
|
||||||
|
// Write remaining uncomplete page.
|
||||||
|
writePage(address, length, p_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn byte Eeprom24C512::readByte(word address)
|
||||||
|
*
|
||||||
|
* \brief Read a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
*
|
||||||
|
* \return Read byte.
|
||||||
|
******************************************************************************/
|
||||||
|
byte
|
||||||
|
Eeprom24C512::readByte
|
||||||
|
(
|
||||||
|
word address
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(m_deviceAddress, (byte)1);
|
||||||
|
byte data = 0;
|
||||||
|
if (Wire.available())
|
||||||
|
{
|
||||||
|
data = Wire.read();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C512::readBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to read.
|
||||||
|
* \patam[in] p_data Byte array to fill with read bytes.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C512::readBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
word bufferCount = length / EEPROM__RD_BUFFER_SIZE;
|
||||||
|
for (word i = 0; i < bufferCount; i++)
|
||||||
|
{
|
||||||
|
word offset = i * EEPROM__RD_BUFFER_SIZE;
|
||||||
|
readBuffer(address + offset, EEPROM__RD_BUFFER_SIZE, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte remainingBytes = length % EEPROM__RD_BUFFER_SIZE;
|
||||||
|
word offset = length - remainingBytes;
|
||||||
|
readBuffer(address + offset, remainingBytes, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Private method definitions.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C512::writePage(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write page in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (EEPROM__PAGE_SIZE bytes max).
|
||||||
|
* \param[in] p_data Data.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C512::writePage
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
// Write complete buffers.
|
||||||
|
byte bufferCount = length / EEPROM__WR_BUFFER_SIZE;
|
||||||
|
for (byte i = 0; i < bufferCount; i++)
|
||||||
|
{
|
||||||
|
byte offset = i * EEPROM__WR_BUFFER_SIZE;
|
||||||
|
writeBuffer(address + offset, EEPROM__WR_BUFFER_SIZE, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write remaining bytes.
|
||||||
|
byte remainingBytes = length % EEPROM__WR_BUFFER_SIZE;
|
||||||
|
byte offset = length - remainingBytes;
|
||||||
|
writeBuffer(address + offset, remainingBytes, p_data + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C512::writeBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes into memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (EEPROM__WR_BUFFER_SIZE bytes max).
|
||||||
|
* \param[in] p_data Data.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C512::writeBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
for (byte i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
Wire.write(p_data[i]);
|
||||||
|
}
|
||||||
|
Wire.endTransmission();
|
||||||
|
|
||||||
|
// Write cycle time (tWR). See EEPROM memory datasheet for more details.
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \fn void Eeprom24C512::readBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (EEPROM__RD_BUFFER_SIZE bytes max).
|
||||||
|
* \param[in] p_data Buffer to fill with read bytes.
|
||||||
|
******************************************************************************/
|
||||||
|
void
|
||||||
|
Eeprom24C512::readBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
){
|
||||||
|
Wire.beginTransmission(m_deviceAddress);
|
||||||
|
Wire.write(address >> 8);
|
||||||
|
Wire.write(address & 0xFF);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(m_deviceAddress, length);
|
||||||
|
for (byte i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if (Wire.available())
|
||||||
|
{
|
||||||
|
p_data[i] = Wire.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
211
lib/AT24C256_512/Eeprom24C512.h
Normal file
211
lib/AT24C256_512/Eeprom24C512.h
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* \brief EEPROM 24C512 library for Arduino
|
||||||
|
* \author Copyright (C) 2012 Julien Le Sech - www.idreammicro.com
|
||||||
|
* \version 1.0
|
||||||
|
* \date 20120203
|
||||||
|
*
|
||||||
|
* This file is part of the EEPROM 24C512 library for Arduino.
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU Lesser General Public License as published by the Free
|
||||||
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see http://www.gnu.org/licenses/
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \headerfile Eeprom24C512.h
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef Eeprom24C512_h
|
||||||
|
#define Eeprom24C512_h
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Header file inclusion.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
/**************************************************************************//**
|
||||||
|
* \class Eeprom24C512
|
||||||
|
*
|
||||||
|
* \brief EEPROM 24C512 memory driver.
|
||||||
|
*
|
||||||
|
* This driver is designed for 24C512 memory.
|
||||||
|
******************************************************************************/
|
||||||
|
class Eeprom24C512
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn Eeprom24C512(byte deviceAddress)
|
||||||
|
*
|
||||||
|
* \brief Constructor.
|
||||||
|
*
|
||||||
|
* \param deviceAddress EEPROM address on TWI bus.
|
||||||
|
**********************************************************************/
|
||||||
|
Eeprom24C512
|
||||||
|
(
|
||||||
|
byte deviceAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void initialize()
|
||||||
|
*
|
||||||
|
* \brief Initialize library abnd TWI bus.
|
||||||
|
*
|
||||||
|
* If several devices are connected to TWI bus, this method mustn't be
|
||||||
|
* called. TWI bus must be initialized out of this library using
|
||||||
|
* Wire.begin() method.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
initialize();
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writeByte(
|
||||||
|
* word address,
|
||||||
|
* byte data)
|
||||||
|
*
|
||||||
|
* \brief Write a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \remarks A delay of 10 ms is required after write cycle.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
* \param data Byte to write.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writeByte
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writeBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to write.
|
||||||
|
* \param[in] p_data Bytes to write.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writeBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn byte readByte(word address)
|
||||||
|
*
|
||||||
|
* \brief Read a byte in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Address.
|
||||||
|
*
|
||||||
|
* \return Read byte.
|
||||||
|
**********************************************************************/
|
||||||
|
byte
|
||||||
|
readByte
|
||||||
|
(
|
||||||
|
word address
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void readBytes(
|
||||||
|
* word address,
|
||||||
|
* word length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to read.
|
||||||
|
* \patam[in] p_data Byte array to fill with read bytes.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
readBytes
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
word length,
|
||||||
|
byte* p_buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
byte m_deviceAddress;
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writePage(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write page in EEPROM memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (64 bytes max).
|
||||||
|
* \param[in] p_data Data.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writePage
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void writeBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Write bytes into memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes (30 bytes max).
|
||||||
|
* \param[in] p_date Data.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
writeBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
|
||||||
|
/******************************************************************//**
|
||||||
|
* \fn void readBuffer(
|
||||||
|
* word address,
|
||||||
|
* byte length,
|
||||||
|
* byte* p_data)
|
||||||
|
*
|
||||||
|
* \brief Read bytes in memory.
|
||||||
|
*
|
||||||
|
* \param address Start address.
|
||||||
|
* \param length Number of bytes to read (32 bytes max).
|
||||||
|
* \param[in] p_data Buffer to fill with read bytes.
|
||||||
|
**********************************************************************/
|
||||||
|
void
|
||||||
|
readBuffer
|
||||||
|
(
|
||||||
|
word address,
|
||||||
|
byte length,
|
||||||
|
byte* p_data
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // Eeprom24C512_h
|
||||||
|
|
9
lib/AT24C256_512/library.properties
Normal file
9
lib/AT24C256_512/library.properties
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
name=EEPROM 24C128_256_521
|
||||||
|
version=
|
||||||
|
author=Julien Le Sech
|
||||||
|
maintainer=Julien Le Sech - www.idreammicro.com
|
||||||
|
sentence=EEPROM 24C128 / 24C256 / 24C512 memory driver.
|
||||||
|
paragraph=EEPROM 24C128 / 24C256 / 24C512 memory driver.
|
||||||
|
category=
|
||||||
|
url=
|
||||||
|
architectures=*
|
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "my_user_config.h"
|
#include "my_user_config.h"
|
||||||
|
#include "tasmota_configurations.h"
|
||||||
#if defined(ESP8266) && defined(USE_TLS)
|
#if defined(ESP8266) && defined(USE_TLS)
|
||||||
|
|
||||||
// #define DEBUG_TLS
|
// #define DEBUG_TLS
|
||||||
|
@ -567,6 +567,7 @@
|
|||||||
// #define USE_EZORTD // [I2cDriver55] Enable support for EZO's RTD sensor (+0k2 code) - Shared EZO code required for any EZO device (+1k2 code)
|
// #define USE_EZORTD // [I2cDriver55] Enable support for EZO's RTD sensor (+0k2 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
// #define USE_EZOHUM // [I2cDriver55] Enable support for EZO's HUM sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
// #define USE_EZOHUM // [I2cDriver55] Enable support for EZO's HUM sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
// #define USE_EZOEC // [I2cDriver55] Enable support for EZO's EC sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
// #define USE_EZOEC // [I2cDriver55] Enable support for EZO's EC sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
|
// #define USE_EZOCO2 // [I2cDriver55] Enable support for EZO's CO2 sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
|
|
||||||
// #define USE_DISPLAY // Add I2C Display Support (+2k code)
|
// #define USE_DISPLAY // Add I2C Display Support (+2k code)
|
||||||
#define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0
|
#define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0
|
||||||
|
@ -132,7 +132,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
|||||||
uint32_t zb_disable_autobind : 1; // bit 28 (v8.5.0.1) - SetOption110 - disable Zigbee auto-config when pairing new devices
|
uint32_t zb_disable_autobind : 1; // bit 28 (v8.5.0.1) - SetOption110 - disable Zigbee auto-config when pairing new devices
|
||||||
uint32_t buzzer_freq_mode : 1; // bit 29 (v8.5.0.1) - SetOption111 - Use frequency output for buzzer pin instead of on/off signal
|
uint32_t buzzer_freq_mode : 1; // bit 29 (v8.5.0.1) - SetOption111 - Use frequency output for buzzer pin instead of on/off signal
|
||||||
uint32_t zb_topic_fname : 1; // bit 30 (v8.5.0.1) - SetOption112 - Use friendly name in zigbee topic (use with SetOption89)
|
uint32_t zb_topic_fname : 1; // bit 30 (v8.5.0.1) - SetOption112 - Use friendly name in zigbee topic (use with SetOption89)
|
||||||
uint32_t spare31 : 1; // bit 31
|
uint32_t rotary_poweron_dimlow : 1; // bit 31 (v9.0.0.2) - SetOption113 - Set dimmer low on rotary dial after power off
|
||||||
};
|
};
|
||||||
} SysBitfield4;
|
} SysBitfield4;
|
||||||
|
|
||||||
|
@ -642,8 +642,9 @@ void GetFeatures(void)
|
|||||||
#if defined(USE_I2C) && defined(USE_EZOEC)
|
#if defined(USE_I2C) && defined(USE_EZOEC)
|
||||||
feature7 |= 0x00000008; // xsns_78_ezoec.ino
|
feature7 |= 0x00000008; // xsns_78_ezoec.ino
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(USE_I2C) && defined(USE_EZOCO2)
|
||||||
// feature7 |= 0x00000010;
|
feature7 |= 0x00000010;
|
||||||
|
#endif
|
||||||
// feature7 |= 0x00000020;
|
// feature7 |= 0x00000020;
|
||||||
// feature7 |= 0x00000040;
|
// feature7 |= 0x00000040;
|
||||||
// feature7 |= 0x00000080;
|
// feature7 |= 0x00000080;
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
#ifndef ROTARY_MAX_STEPS
|
#ifndef ROTARY_MAX_STEPS
|
||||||
#define ROTARY_MAX_STEPS 10 // Rotary step boundary
|
#define ROTARY_MAX_STEPS 10 // Rotary step boundary
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ROTARY_START_DIM
|
||||||
|
#define ROTARY_START_DIM 1 // Minimal dimmer value after power on with SetOption113 1
|
||||||
|
#endif
|
||||||
#ifndef ROTARY_TIMEOUT
|
#ifndef ROTARY_TIMEOUT
|
||||||
#define ROTARY_TIMEOUT 2 // 2 * RotaryHandler() call which is usually 2 * 0.05 seconds
|
#define ROTARY_TIMEOUT 2 // 2 * RotaryHandler() call which is usually 2 * 0.05 seconds
|
||||||
#endif
|
#endif
|
||||||
@ -198,7 +201,14 @@ void RotaryHandler(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // Dimmer RGBCW or RGB only if second rotary
|
} else { // Dimmer RGBCW or RGB only if second rotary
|
||||||
LightDimmerOffset(second_rotary ? 1 : 0, rotary_position * rotary_dimmer_increment[Rotary.model]);
|
uint32_t dimmer_index = second_rotary ? 1 : 0;
|
||||||
|
if (!Settings.flag4.rotary_poweron_dimlow || power) { // SetOption113 - On rotary dial after power off set dimmer low
|
||||||
|
LightDimmerOffset(dimmer_index, rotary_position * rotary_dimmer_increment[Rotary.model]);
|
||||||
|
} else {
|
||||||
|
if (rotary_position > 0) { // Only power on if rotary increase
|
||||||
|
LightDimmerOffset(dimmer_index, -LightGetDimmer(dimmer_index) + ROTARY_START_DIM);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else { // Rotary2
|
} else { // Rotary2
|
||||||
if (button_pressed) { // Color Temperature
|
if (button_pressed) { // Color Temperature
|
||||||
|
@ -132,6 +132,7 @@
|
|||||||
//#define USE_EZORTD // [I2cDriver55] Enable support for EZO's RTD sensor (+0k2 code) - Shared EZO code required for any EZO device (+1k2 code)
|
//#define USE_EZORTD // [I2cDriver55] Enable support for EZO's RTD sensor (+0k2 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
//#define USE_EZOHUM // [I2cDriver55] Enable support for EZO's HUM sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
//#define USE_EZOHUM // [I2cDriver55] Enable support for EZO's HUM sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
//#define USE_EZOEC // [I2cDriver55] Enable support for EZO's EC sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
//#define USE_EZOEC // [I2cDriver55] Enable support for EZO's EC sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
|
//#define USE_EZOCO2 // [I2cDriver55] Enable support for EZO's CO2 sensor (+0k3 code) - Shared EZO code required for any EZO device (+1k2 code)
|
||||||
|
|
||||||
#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
|
#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
|
||||||
#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)
|
#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)
|
||||||
@ -438,15 +439,23 @@
|
|||||||
#define SERIAL_LOG_LEVEL LOG_LEVEL_NONE // [SerialLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
|
#define SERIAL_LOG_LEVEL LOG_LEVEL_NONE // [SerialLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
|
||||||
|
|
||||||
#undef USE_ARDUINO_OTA // Disable support for Arduino OTA
|
#undef USE_ARDUINO_OTA // Disable support for Arduino OTA
|
||||||
#define USE_DOMOTICZ // Disable Domoticz
|
#define USE_DOMOTICZ // Enable Domoticz
|
||||||
#undef USE_HOME_ASSISTANT // Disable Home Assistant
|
#undef USE_HOME_ASSISTANT // Disable Home Assistant
|
||||||
#undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set
|
|
||||||
|
// -- MQTT - TLS - AWS IoT ------------------------
|
||||||
|
#define USE_MQTT_TLS // Use TLS for MQTT connection (+34.5k code, +7.0k mem and +4.8k additional during connection handshake)
|
||||||
|
#define USE_MQTT_TLS_CA_CERT // Force full CA validation instead of fingerprints, slower, but simpler to use. (+2.2k code, +1.9k mem during connection handshake)
|
||||||
|
// This includes the LetsEncrypt CA in tasmota_ca.ino for verifying server certificates
|
||||||
|
#define USE_MQTT_TLS_FORCE_EC_CIPHER // Force Elliptic Curve cipher (higher security) required by some servers (automatically enabled with USE_MQTT_AWS_IOT) (+11.4k code, +0.4k mem)
|
||||||
|
#define USE_MQTT_AWS_IOT_LIGHT // Enable MQTT for AWS IoT in light mode, with user/password instead of private certificate
|
||||||
|
#define USE_TLS // flag indicates we need to include TLS code
|
||||||
|
|
||||||
#undef USE_KNX // Disable KNX IP Protocol Support
|
#undef USE_KNX // Disable KNX IP Protocol Support
|
||||||
//#undef USE_WEBSERVER // Disable Webserver
|
//#undef USE_WEBSERVER // Disable Webserver
|
||||||
//#undef USE_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code)
|
//#undef USE_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code)
|
||||||
#define USE_EMULATION // Disable Wemo or Hue emulation
|
#define USE_EMULATION // Enable Hue emulation
|
||||||
#define USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
#define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
||||||
//#undef USE_EMULATION_WEMO // Disable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
|
#undef USE_EMULATION_WEMO // Disable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
|
||||||
#undef USE_CUSTOM // Disable Custom features
|
#undef USE_CUSTOM // Disable Custom features
|
||||||
#undef USE_DISCOVERY // Disable Discovery services for both MQTT and web server
|
#undef USE_DISCOVERY // Disable Discovery services for both MQTT and web server
|
||||||
//#undef USE_TIMERS // Disable support for up to 16 timers
|
//#undef USE_TIMERS // Disable support for up to 16 timers
|
||||||
@ -552,14 +561,12 @@
|
|||||||
#undef USE_ZIGBEE_ZNP
|
#undef USE_ZIGBEE_ZNP
|
||||||
#define USE_ZIGBEE_EZSP
|
#define USE_ZIGBEE_EZSP
|
||||||
#define USE_TCP_BRIDGE
|
#define USE_TCP_BRIDGE
|
||||||
#define USE_ZIGBEE_CHANNEL 11 // Zigbee Channel (11-26)
|
#define USE_ZIGBEE_CHANNEL 11 // Zigbee Channel (11-26)
|
||||||
#define USE_ZIGBEE_COALESCE_ATTR_TIMER 350 // timer to coalesce attribute values (in ms)
|
#define USE_ZIGBEE_COALESCE_ATTR_TIMER 350 // timer to coalesce attribute values (in ms)
|
||||||
|
|
||||||
|
|
||||||
#endif // SONOFF_ZIGBEEBRIDGE ******************************************************************
|
#endif // SONOFF_ZIGBEEBRIDGE ******************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* [tasmota-lite.bin]
|
* [tasmota-lite.bin]
|
||||||
* Provide an image without sensors
|
* Provide an image without sensors
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef _TASMOTA_VERSION_H_
|
#ifndef _TASMOTA_VERSION_H_
|
||||||
#define _TASMOTA_VERSION_H_
|
#define _TASMOTA_VERSION_H_
|
||||||
|
|
||||||
const uint32_t VERSION = 0x09000002;
|
const uint32_t VERSION = 0x09000003;
|
||||||
|
|
||||||
// Lowest compatible version
|
// Lowest compatible version
|
||||||
const uint32_t VERSION_COMPATIBLE = 0x07010006;
|
const uint32_t VERSION_COMPATIBLE = 0x07010006;
|
||||||
|
@ -17,7 +17,11 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifdef USE_I2C
|
#ifdef USE_I2C
|
||||||
#if defined(USE_EZOPH) || defined(USE_EZOORP) || defined(USE_EZORTD) || defined(USE_EZOHUM) || defined(USE_EZOEC)
|
|
||||||
|
#if defined(USE_EZOPH) || defined(USE_EZOORP) || defined(USE_EZORTD) || defined(USE_EZOHUM) || defined(USE_EZOEC) || defined(USE_EZOCO2)
|
||||||
|
#define USE_EZO
|
||||||
|
#endif
|
||||||
|
#if defined(USE_EZO)
|
||||||
|
|
||||||
#define D_EZO_DELAY 300 // Minimum delay for any instruction
|
#define D_EZO_DELAY 300 // Minimum delay for any instruction
|
||||||
#define D_EZO_MAX_BUF 40 // Maximum response
|
#define D_EZO_MAX_BUF 40 // Maximum response
|
||||||
@ -106,5 +110,5 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // USE_EZO*
|
#endif // USE_EZO
|
||||||
#endif // USE_I2C
|
#endif // USE_I2C
|
||||||
|
57
tasmota/xsns_78_ezoco2.ino
Normal file
57
tasmota/xsns_78_ezoco2.ino
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
xsns_78_ezoco2.ino - EZO CO2 I2C CO2 sensor support for Tasmota
|
||||||
|
|
||||||
|
Copyright (C) 2020 Christopher Tremblay
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
#ifdef USE_EZOCO2
|
||||||
|
|
||||||
|
#define EZO_CO2_READ_LATENCY 900
|
||||||
|
|
||||||
|
struct EZOCO2 : public EZOStruct {
|
||||||
|
EZOCO2(uint32_t addr) : EZOStruct(addr), CO2(0) {}
|
||||||
|
|
||||||
|
virtual void ProcessMeasurement(void)
|
||||||
|
{
|
||||||
|
char data[D_EZO_MAX_BUF];
|
||||||
|
|
||||||
|
EZOStruct::ProcessMeasurement(data, sizeof(data), EZO_CO2_READ_LATENCY);
|
||||||
|
|
||||||
|
// sensor has a 10s warmup period
|
||||||
|
if (uptime >= 10) {
|
||||||
|
CO2 = atoi(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Show(bool json, const char *name)
|
||||||
|
{
|
||||||
|
if (json) {
|
||||||
|
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_CO2 "\":%d}" ), name, CO2);
|
||||||
|
}
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
|
else {
|
||||||
|
WSContentSend_PD(HTTP_SNS_CO2, name, CO2);
|
||||||
|
#endif // USE_WEBSERVER
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t CO2;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USE_EZOCO2
|
||||||
|
#endif // USE_I2C
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef USE_I2C
|
#ifdef USE_I2C
|
||||||
#if defined(USE_EZOPH) || defined(USE_EZOORP) || defined(USE_EZORTD) || defined(USE_EZOHUM) || defined(USE_EZOEC)
|
#if defined(USE_EZO)
|
||||||
|
|
||||||
#define XSNS_78 78
|
#define XSNS_78 78
|
||||||
#define XI2C_55 55 // See I2CDEVICES.md
|
#define XI2C_55 55 // See I2CDEVICES.md
|
||||||
@ -65,7 +65,7 @@ const char EZO_RTD_NAME[] PROGMEM = "RTD";
|
|||||||
#endif
|
#endif
|
||||||
//const char EZO_PMP_NAME[] PROGMEM = "PMP";
|
//const char EZO_PMP_NAME[] PROGMEM = "PMP";
|
||||||
//const char EZO_FLO_NAME[] PROGMEM = "FLO";
|
//const char EZO_FLO_NAME[] PROGMEM = "FLO";
|
||||||
//const char EZO_CO2_NAME[] PROGMEM = "CO2";
|
const char EZO_CO2_NAME[] PROGMEM = "CO2";
|
||||||
//const char EZO_PRS_NAME[] PROGMEM = "PRS";
|
//const char EZO_PRS_NAME[] PROGMEM = "PRS";
|
||||||
//const char EZO_O2_NAME[] PROGMEM = "O2";
|
//const char EZO_O2_NAME[] PROGMEM = "O2";
|
||||||
#ifdef USE_EZOHUM
|
#ifdef USE_EZOHUM
|
||||||
@ -104,7 +104,13 @@ const char *const EZOSupport[EZO_ADDR_n] PROGMEM = {
|
|||||||
|
|
||||||
EZO_EMPTY,
|
EZO_EMPTY,
|
||||||
EZO_EMPTY,
|
EZO_EMPTY,
|
||||||
|
|
||||||
|
#ifdef USE_EZOCO2
|
||||||
|
EZO_CO2_NAME,
|
||||||
|
#else
|
||||||
EZO_EMPTY,
|
EZO_EMPTY,
|
||||||
|
#endif
|
||||||
|
|
||||||
EZO_EMPTY,
|
EZO_EMPTY,
|
||||||
EZO_EMPTY,
|
EZO_EMPTY,
|
||||||
EZO_EMPTY,
|
EZO_EMPTY,
|
||||||
@ -265,6 +271,11 @@ private:
|
|||||||
sensor[count] = new EZORTD(addr);
|
sensor[count] = new EZORTD(addr);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_EZOCO2
|
||||||
|
case EZO_CO2:
|
||||||
|
sensor[count] = new EZOCO2(addr);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#ifdef USE_EZOHUM
|
#ifdef USE_EZOHUM
|
||||||
case EZO_HUM:
|
case EZO_HUM:
|
||||||
sensor[count] = new EZOHUM(addr);
|
sensor[count] = new EZOHUM(addr);
|
||||||
@ -324,5 +335,5 @@ bool Xsns78(uint8_t function)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_EZO*
|
#endif // USE_EZO
|
||||||
#endif // USE_I2C
|
#endif // USE_I2C
|
||||||
|
@ -165,7 +165,8 @@ a_setoption = [[
|
|||||||
"Force gen1 Alexa mode",
|
"Force gen1 Alexa mode",
|
||||||
"Disable Zigbee auto-config when pairing new devices",
|
"Disable Zigbee auto-config when pairing new devices",
|
||||||
"Use frequency output for buzzer pin instead of on/off signal",
|
"Use frequency output for buzzer pin instead of on/off signal",
|
||||||
"",""
|
"Use friendly name in zigbee topic (use with SetOption89)",
|
||||||
|
"Set dimmer low on rotary dial after power off"
|
||||||
],[
|
],[
|
||||||
"","","","",
|
"","","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
@ -267,7 +268,7 @@ else:
|
|||||||
obj = json.load(fp)
|
obj = json.load(fp)
|
||||||
|
|
||||||
def StartDecode():
|
def StartDecode():
|
||||||
print ("\n*** decode-status.py v20201024 by Theo Arends and Jacek Ziolkowski ***")
|
print ("\n*** decode-status.py v20201025 by Theo Arends and Jacek Ziolkowski ***")
|
||||||
|
|
||||||
# print("Decoding\n{}".format(obj))
|
# print("Decoding\n{}".format(obj))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user