mirror of https://github.com/arendst/Tasmota.git
Release 6.7
This commit is contained in:
parent
9818f8b819
commit
1a6ead187d
|
@ -7,9 +7,11 @@
|
|||
.piolibdeps
|
||||
.clang_complete
|
||||
.gcc-flags.json
|
||||
.cache
|
||||
sonoff/user_config_override.h
|
||||
build
|
||||
firmware.map
|
||||
firmware.asm
|
||||
|
||||
## Visual Studio Code specific ######
|
||||
.vscode
|
||||
|
|
44
.travis.yml
44
.travis.yml
|
@ -1,14 +1,48 @@
|
|||
language: python
|
||||
python:
|
||||
- '2.7'
|
||||
- '3.7'
|
||||
sudo: false
|
||||
cache:
|
||||
directories:
|
||||
- "~/.platformio"
|
||||
install:
|
||||
- pip install -U platformio
|
||||
- platformio upgrade
|
||||
- platformio update
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- .cache
|
||||
- $HOME/.platformio
|
||||
|
||||
env:
|
||||
- ENV=sonoff
|
||||
- ENV=sonoff-minimal
|
||||
- ENV=sonoff-basic
|
||||
- ENV=sonoff-knx
|
||||
- ENV=sonoff-sensors
|
||||
- ENV=sonoff-display
|
||||
- ENV=sonoff-ir
|
||||
- ENV=sonoff-BG
|
||||
- ENV=sonoff-BR
|
||||
- ENV=sonoff-CN
|
||||
- ENV=sonoff-CZ
|
||||
- ENV=sonoff-DE
|
||||
- ENV=sonoff-ES
|
||||
- ENV=sonoff-FR
|
||||
- ENV=sonoff-GR
|
||||
- ENV=sonoff-HE
|
||||
- ENV=sonoff-HU
|
||||
- ENV=sonoff-IT
|
||||
- ENV=sonoff-KO
|
||||
- ENV=sonoff-NL
|
||||
- ENV=sonoff-PL
|
||||
- ENV=sonoff-PT
|
||||
- ENV=sonoff-RU
|
||||
- ENV=sonoff-SE
|
||||
- ENV=sonoff-SK
|
||||
- ENV=sonoff-TR
|
||||
- ENV=sonoff-TW
|
||||
- ENV=sonoff-UK
|
||||
|
||||
script:
|
||||
- platformio run
|
||||
- platformio run -e $ENV
|
||||
before_deploy:
|
||||
- for file in .pioenvs/*/firmware.bin; do cp $file ${file%/*}.bin; done
|
||||
|
|
20
README.md
20
README.md
|
@ -8,7 +8,7 @@ Alternative firmware for _ESP8266 based devices_ like [iTead](https://www.itead.
|
|||
[![License](https://img.shields.io/github/license/arendst/Sonoff-Tasmota.svg)](https://github.com/arendst/Sonoff-Tasmota/blob/master/LICENSE.txt)
|
||||
[![Chat](https://img.shields.io/discord/479389167382691863.svg)](https://discord.gg/Ks2Kzd4)
|
||||
|
||||
If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
|
||||
If you like **Sonoff-Tasmota**, give it a star, or fork it, and contribute!
|
||||
|
||||
[![GitHub stars](https://img.shields.io/github/stars/arendst/Sonoff-Tasmota.svg?style=social&label=Star)](https://github.com/arendst/Sonoff-Tasmota/stargazers)
|
||||
[![GitHub forks](https://img.shields.io/github/forks/arendst/Sonoff-Tasmota.svg?style=social&label=Fork)](https://github.com/arendst/Sonoff-Tasmota/network)
|
||||
|
@ -25,12 +25,16 @@ In addition to the [release webpage](https://github.com/arendst/Sonoff-Tasmota/r
|
|||
|
||||
See [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for detailed change information.
|
||||
|
||||
The development codebase is checked hourly for changes and if new commits have been merged and compile successfuly they will be posted at http://thehackbox.org/tasmota/ (this web address can be used for OTA too). It is important to note that these are based on the current development codebase and it is not recommended to flash it to devices used in production or which are hard to reach in the event that you need to manually flash the device if OTA failed. The last compiled commit number is also posted on the same page along with the current build status (if a firmware rebuild is in progress).
|
||||
Unless your Tasmota powered device exhibits a problem or you need to make use of a feature that is not available in the Tasmota version currently installed on your device, leave your device alone - it works so don't make unnecessary changes! If the release version (i.e., the master branch) exhibits unexpected behaviour for your device and configuration, you should upgrade to the latest development version instead to see if your problem is resolved as some bugs in previous releases or development builds may already have been resolved.
|
||||
|
||||
The Tasmota development codebase is checked every 1-2 hours for changes. If new commits have been merged and they compile successfuly, new binary files for every variant (excluding non-English languages) will be posted at http://thehackbox.org/tasmota/ (this web address can be used for OTA updates too). The last compiled commit number is also indicated on the same page. It is important to note that these binaries are based on the current development codebase. These commits are tested as much as is possible and are typically quite stable. However, it is infeasible to test on the hundreds of different types of devices with all the available configuration options permitted.
|
||||
|
||||
Note that there is a chance, as with any upgrade, that the device may not function as expected. You must always account for the possibility that you may need to flash the device via the serial programming interface if the OTA upgrade fails. Even with the master release, you should always attempt to test the device or a similar prototype before upgrading a device which is in production or is hard to reach. And, as always, make a backup of the device configuration before beginning any firmware update.
|
||||
|
||||
## Disclaimer
|
||||
:warning: **DANGER OF ELECTROCUTION** :warning:
|
||||
|
||||
A Sonoff device is not a toy. It uses Mains AC so there is a danger of electrocution if not installed properly. If you don't know how to install it, please call an electrician. Remember: _**SAFETY FIRST**_. It is not worth risk to yourself, your family, and your home if you don't know exactly what you are doing. Never try to flash a Sonoff device while it is connected to MAINS AC.
|
||||
An ESP82xx Wi-Fi device is not a toy. It uses Mains AC so there is a danger of electrocution if not installed properly. If you don't know how to install it, please call an electrician. Remember: _**SAFETY FIRST**_. It is not worth risk to yourself, your family, and your home if you don't know exactly what you are doing. Never try to flash a device using the serial programming interface while it is connected to MAINS AC.
|
||||
|
||||
We don't take any responsibility nor liability for using this software nor for the installation or any tips, advice, videos, etc. given by any member of this site or any related site.
|
||||
|
||||
|
@ -43,14 +47,12 @@ Download one of the released binaries from https://github.com/arendst/Sonoff-Tas
|
|||
## Important User Compilation Information
|
||||
If you want to compile Sonoff-Tasmota yourself keep in mind the following:
|
||||
|
||||
- Only Flash Mode **DOUT** is supported. Do not use Flash Mode DIO / QIO / QOUT as it might seem to brick your device. See [Wiki](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips) for background information.
|
||||
- Sonoff-Tasmota uses a 1M linker script WITHOUT spiffs **1M (no SPIFFS)** for optimal code space. If you compile using ESP/Arduino library 2.3.0 then download the provided new linker script to your Arduino IDE or Platformio base folder. Later version of ESP/Arduino library already contain the correct linker script. See [Wiki > Prerequisites](https://github.com/arendst/Sonoff-Tasmota/wiki/Prerequisites).
|
||||
- Only Flash Mode **DOUT** is supported. Do not use Flash Mode DIO / QIO / QOUT as it might seem to brick your device. See [Wiki](https://github.com/arendst/Sonoff-Tasmota/wiki/Flashing) for background information.
|
||||
- Sonoff-Tasmota uses a 1M linker script WITHOUT spiffs **1M (no SPIFFS)** for optimal code space. If you compile using ESP/Arduino library 2.3.0 then download the provided new linker script to your Arduino IDE or Platformio base folder. Later versions of ESP/Arduino library already contain the correct linker script. See [Wiki > Prerequisites](https://github.com/arendst/Sonoff-Tasmota/wiki/Prerequisites).
|
||||
- To make compile time changes to Sonoff-Tasmota it can use the ``user_config_override.h`` file. It assures keeping your settings when you download and compile a new version. To use ``user_config.override.h`` you will have to make a copy of the provided ``user_config_override_sample.h`` file and add your setting overrides. To enable the override file you will need to use a compile define as documented in the ``user_config_override_sample.h`` file.
|
||||
|
||||
## Version Information
|
||||
- Sonoff-Tasmota provides all (Sonoff) modules in one file and starts with module Sonoff Basic.
|
||||
- Once uploaded, select [Module](https://github.com/arendst/Sonoff-Tasmota/wiki/Modules) using the configuration webpage, the commands ```Modules``` and ```Module``` or configure the [Template](https://github.com/arendst/Sonoff-Tasmota/wiki/Templates) for your device
|
||||
- After reboot select config menu again or use commands ```GPIOs``` and ```GPIO``` to change GPIO with desired sensor.
|
||||
## Configuration Information
|
||||
Please refer to the Installation and configuration articles in the [wiki](https://github.com/arendst/Sonoff-Tasmota/wiki).
|
||||
|
||||
## Migration Information
|
||||
See [wiki migration path](https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade#migration-path) for instructions how to migrate to a major version. Pay attention to the following version breaks due to dynamic settings updates:
|
||||
|
|
298
RELEASENOTES.md
298
RELEASENOTES.md
|
@ -10,18 +10,16 @@ See [wiki migration path](https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade
|
|||
3. Migrate to **Sonoff-Tasmota 5.14**
|
||||
4. Migrate to **Sonoff-Tasmota 6.x**
|
||||
|
||||
## Supported Core versions
|
||||
This release will be supported from ESP8266/Arduino library Core version **pre-2.6.0** due to reported security and stability issues on previous Core version.
|
||||
|
||||
Although it might still compile on previous Core versions all support will be removed starting in the next Release.
|
||||
|
||||
## Support of TLS
|
||||
TLS support for core 2.3.0 is removed.
|
||||
To save resources when TLS is enabled mDNS needs to be disabled. In addition to TLS using fingerprints now also user supplied CA certs and AWS IoT is supported. See full documentation on https://github.com/arendst/Sonoff-Tasmota/wiki/AWS-IoT
|
||||
|
||||
TLS is supported on core 2.4.2 and up. To save resources when TLS is enabled mDNS needs to be disabled. In addition to TLS using fingerprints now also user supplied CA certs and AWS IoT is supported. See full documentation on https://github.com/arendst/Sonoff-Tasmota/wiki/AWS-IoT
|
||||
|
||||
## Core version 2.3.0 vs 2.4.2 vs 2.5.2
|
||||
This release is based on ESP8266/Arduino library core 2.3.0 as some people encountered wifi related issues on core 2.4.2 and 2.5.2. For others core 2.4.2 or 2.5.2 is working just fine. All version are available from http://thehackbox.org/tasmota/release/
|
||||
|
||||
## Change in default initial configuration tool
|
||||
Firmware binary **sonoff-classic.bin** supports **WifiManager, Wps and SmartConfig** for initial configuration. The default tool is **Wps**.
|
||||
|
||||
To save memory space all other binaries support **WifiManager only**.
|
||||
## Initial configuration tools
|
||||
For initial configuration this release supports Webserver based **WifiManager** or **Serial** based command interface only. Support for **WPS** and **SmartConfig** has been removed.
|
||||
|
||||
## Supported Modules
|
||||
The following hardware modules are supported.
|
||||
|
@ -98,74 +96,109 @@ Module | Description
|
|||
68 WAGA CHCZ02MB | WAGA life CHCZ02MB Wifi Smart Switch with Energy Monitoring
|
||||
69 SYF05 | Sunyesmart SYF05 RGBWW Wifi Led Bulb
|
||||
70 Sonoff L1 | Sonoff L1 light strip
|
||||
71 Sonoff iFan03 | Sonoff iFan03 Wifi Smart Ceiling Fan with Light
|
||||
72 EXS Dimmer | EXS Wifi Dimmer v4
|
||||
|
||||
## Provided Binary Downloads
|
||||
The following binary downloads have been compiled with ESP8266/Arduino library core version **2.3.0**.
|
||||
The following binary downloads have been compiled with ESP8266/Arduino library core version **pre-2.6.0**.
|
||||
|
||||
- **sonoff.bin** = The Sonoff version without Wps and SmartConfig configuration but adds more sensors. **RECOMMENDED RELEASE BINARY**
|
||||
- **sonoff-basic.bin** = The Basic version without Wps and SmartConfig configuration and most sensors.
|
||||
- **sonoff-classic.bin** = The Classic version allows initial installation using either WifiManager, Wps or SmartConfig.
|
||||
- **sonoff-BG.bin** to **sonoff-TW.bin** = The Sonoff version without Wps and SmartConfig configuration in different languages.
|
||||
- **sonoff-knx.bin** = The Knx version without Wps and SmartConfig configuration and some other features but adds KNX support.
|
||||
- **sonoff-sensors.bin** = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors.
|
||||
- **sonoff-display.bin** = The Display version without Wps and SmartConfig configuration and Energy Monitoring but adds display support.
|
||||
- **sonoff.bin** = The Sonoff version with sensors. **RECOMMENDED RELEASE BINARY**
|
||||
- **sonoff-BG.bin** to **sonoff-TW.bin** = The Sonoff version in different languages.
|
||||
- **sonoff-basic.bin** = The Basic version without most sensors.
|
||||
- **sonoff-knx.bin** = The Knx version without some features but adds KNX support.
|
||||
- **sonoff-sensors.bin** = The Sensors version adds more useful sensors.
|
||||
- **sonoff-ir** = The InfraRed Receiver and transmitter version allowing all available protocols provided by library IRremoteESP8266 but without most other features.
|
||||
- **sonoff-display.bin** = The Display version without Energy Monitoring but adds display support.
|
||||
- **sonoff-minimal.bin** = The Minimal version allows intermediate OTA uploads to support larger versions and does NOT change any persistent parameter. This version **should NOT be used for initial installation**.
|
||||
|
||||
Core version **2.4.2** binaries can be found at http://thehackbox.org/tasmota/release/020402/
|
||||
|
||||
Core version **2.5.2** binaries can be found at http://thehackbox.org/tasmota/release/020502/
|
||||
|
||||
## Available Features and Sensors
|
||||
|
||||
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks
|
||||
|-----------------------|---------|-------|---------|--------|------|---------|---------|--------
|
||||
| Feature or Sensor | minimal | basic | sonoff | knx | sensors | ir | display | Remarks
|
||||
|-----------------------|---------|-------|--------|-----|---------|----|---------|--------
|
||||
| MY_LANGUAGE en-GB | x | x | x | x | x | x | x |
|
||||
| USE_WPS | - | - | x | - | - | - | - | WPS
|
||||
| USE_SMARTCONFIG | - | - | x | - | - | - | - | SmartConfig
|
||||
| USE_ARDUINO_OTA | - | - | - | - | - | - | - |
|
||||
| USE_DOMOTICZ | - | - | x | x | x | x | - |
|
||||
| USE_HOME_ASSISTANT | - | - | - | x | x | x | - |
|
||||
| USE_HOME_ASSISTANT | - | - | x | x | x | x | - |
|
||||
| USE_MQTT_TLS | - | - | - | - | - | - | - |
|
||||
| USE_MQTT_TLS_CA_CERT | - | - | - | - | - | - | - |
|
||||
| USE_MQTT_AWS_IOT | - | - | - | - | - | - | - |
|
||||
| USE_KNX | - | - | - | - | x | - | - |
|
||||
| USE_WEBSERVER | x | x | x | x | x | x | x | WifiManager
|
||||
| USE_EMULATION_HUE | - | x | x | x | - | x | - |
|
||||
| USE_EMULATION_WEMO | - | x | x | x | - | x | - |
|
||||
| USE_DISCOVERY | - | - | x | x | x | x | x |
|
||||
| WEBSERVER_ADVERTISE | - | - | x | x | x | x | x |
|
||||
| MQTT_HOST_DISCOVERY | - | - | x | x | x | x | x |
|
||||
| USE_TIMERS | - | x | - | x | x | x | x |
|
||||
| USE_TIMERS_WEB | - | x | - | x | x | x | x |
|
||||
| USE_SUNRISE | - | x | - | x | x | x | x |
|
||||
| USE_RULES | - | x | - | x | x | x | x |
|
||||
| USE_KNX | - | - | - | x | - | - | - |
|
||||
| USE_WEBSERVER | x | x | x | x | x | x | x |
|
||||
| USE_JAVASCRIPT_ES6 | - | - | - | - | - | - | - |
|
||||
| USE_WEBSEND_RESPONSE | - | - | - | - | - | - | - |
|
||||
| USE_EMULATION_HUE | - | x | x | - | x | - | - |
|
||||
| USE_EMULATION_WEMO | - | x | x | - | x | - | - |
|
||||
| USE_DISCOVERY | - | - | x | x | - | - | x |
|
||||
| WEBSERVER_ADVERTISE | - | - | x | x | - | - | x |
|
||||
| MQTT_HOST_DISCOVERY | - | - | x | x | - | - | x |
|
||||
| USE_TIMERS | - | x | x | x | x | x | x |
|
||||
| USE_TIMERS_WEB | - | x | x | x | x | x | x |
|
||||
| USE_SUNRISE | - | x | x | x | x | x | x |
|
||||
| USE_RULES | - | x | x | x | x | x | x |
|
||||
| USE_SCRIPT | - | - | - | - | - | - | - |
|
||||
| USE_EXPRESSION | - | - | - | - | - | - | - |
|
||||
| SUPPORT_IF_STATEMENT | - | - | - | - | - | - | - |
|
||||
| | | | | | | | |
|
||||
| USE_ADC_VCC | x | x | x | - | - | - | - |
|
||||
| USE_COUNTER | - | - | - | x | x | x | x |
|
||||
| USE_DS18B20 | - | - | - | - | - | - | - | Single sensor
|
||||
| USE_DS18x20 | - | - | x | x | x | x | x | Multiple sensors
|
||||
| USE_DS18x20_LEGACY | - | - | - | - | - | - | - | Multiple sensors
|
||||
| Feature or Sensor | minimal | basic | sonoff | knx | sensors | ir | display | Remarks
|
||||
| ROTARY_V1 | - | - | - | - | - | - | - |
|
||||
| USE_SONOFF_RF | - | - | x | x | x | - | - |
|
||||
| USE_RF_FLASH | - | - | x | x | x | - | - |
|
||||
| USE_SONOFF_SC | - | - | x | - | x | - | - |
|
||||
| USE_TUYA_MCU | - | x | x | x | x | - | x |
|
||||
| USE_ARMTRONIX_DIMMERS | - | - | x | x | - | - | - |
|
||||
| USE_PS_16_DZ | - | - | x | x | x | - | - |
|
||||
| USE_SONOFF_IFAN | - | - | x | x | x | - | - |
|
||||
| USE_BUZZER | - | - | x | x | x | - | - |
|
||||
| USE_ARILUX_RF | - | - | x | x | x | - | - |
|
||||
| USE_SHUTTER | - | - | - | - | - | - | - |
|
||||
| USE_DEEPSLEEP | - | - | - | - | - | - | - |
|
||||
| USE_EXS_DIMMER | - | - | - | - | - | - | - |
|
||||
| | | | | | | | |
|
||||
| Feature or Sensor | minimal | basic | sonoff | knx | sensors | ir | display | Remarks
|
||||
| USE_LIGHT | - | x | x | x | x | x | x |
|
||||
| USE_WS2812 | - | - | x | x | x | - | x |
|
||||
| USE_WS2812_DMA | - | - | - | - | - | - | - |
|
||||
| USE_MY92X1 | - | - | x | x | x | - | x |
|
||||
| USE_SM16716 | - | - | x | x | x | - | x |
|
||||
| USE_SM2135 | - | - | x | x | x | - | x |
|
||||
| USE_SONOFF_L1 | - | - | x | x | x | - | x |
|
||||
| | | | | | | | |
|
||||
| USE_ENERGY_SENSOR | - | x | x | x | x | - | - |
|
||||
| USE_PZEM004T | - | - | x | x | x | - | - |
|
||||
| USE_PZEM_AC | - | - | x | x | x | - | - |
|
||||
| USE_PZEM_DC | - | - | x | x | x | - | - |
|
||||
| USE_MCP39F501 | - | x | x | x | x | - | - |
|
||||
| USE_SDM120 | - | - | - | - | x | - | - |
|
||||
| USE_SDM630 | - | - | - | - | x | - | - |
|
||||
| USE_DDS2382 | - | - | - | - | x | - | - |
|
||||
| USE_DDSU666 | - | - | - | - | x | - | - |
|
||||
| USE_SOLAX_X1 | - | - | - | - | - | - | - |
|
||||
| | | | | | | | |
|
||||
| USE_ADC_VCC | x | x | - | - | - | - | - |
|
||||
| USE_COUNTER | - | - | x | x | x | x | x |
|
||||
| USE_DS18x20 | - | - | x | x | x | - | x |
|
||||
| USE_DHT | - | - | x | x | x | x | x |
|
||||
| USE_MAX31855 | - | - | - | - | x | - | - |
|
||||
| USE_MAX31865 | - | - | - | - | - | - | - |
|
||||
| | | | | | | | |
|
||||
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks
|
||||
| USE_I2C | - | - | - | x | x | x | x |
|
||||
| USE_SHT | - | - | - | x | x | x | x |
|
||||
| USE_HTU | - | - | - | x | x | x | x |
|
||||
| USE_BMP | - | - | - | x | x | x | x |
|
||||
| USE_BME680 | - | - | - | - | - | x | - |
|
||||
| USE_BH1750 | - | - | - | x | x | x | x |
|
||||
| USE_VEML6070 | - | - | - | - | - | x | - |
|
||||
| USE_ADS1115 | - | - | - | - | - | x | - |
|
||||
| Feature or Sensor | minimal | basic | sonoff | knx | sensors | ir | display | Remarks
|
||||
| USE_I2C | - | - | x | x | x | - | x |
|
||||
| USE_SHT | - | - | x | x | x | - | x |
|
||||
| USE_HTU | - | - | x | x | x | - | x |
|
||||
| USE_BMP | - | - | x | x | x | - | x |
|
||||
| USE_BME680 | - | - | - | - | x | - | - |
|
||||
| USE_BH1750 | - | - | x | x | x | - | x |
|
||||
| USE_VEML6070 | - | - | - | - | x | - | - |
|
||||
| USE_ADS1115 | - | - | - | - | x | - | - |
|
||||
| USE_ADS1115_I2CDEV | - | - | - | - | - | - | - |
|
||||
| USE_INA219 | - | - | - | - | - | x | - |
|
||||
| USE_SHT3X | - | - | - | x | x | x | x |
|
||||
| USE_TSL2561 | - | - | - | - | - | x | - |
|
||||
| USE_MGS | - | - | - | - | - | x | - |
|
||||
| USE_SGP30 | - | - | - | x | x | x | x |
|
||||
| USE_INA219 | - | - | - | - | x | - | - |
|
||||
| USE_INA226 | - | - | - | - | - | - | - |
|
||||
| USE_SHT3X | - | - | x | x | x | - | x |
|
||||
| USE_TSL2561 | - | - | - | - | x | - | - |
|
||||
| USE_MGS | - | - | - | - | x | - | - |
|
||||
| USE_SGP30 | - | - | x | x | x | - | x |
|
||||
| USE_SI1145 | - | - | - | - | - | - | - |
|
||||
| USE_LM75AD | - | - | - | x | x | x | x |
|
||||
| USE_LM75AD | - | - | x | x | x | - | x |
|
||||
| USE_APDS9960 | - | - | - | - | - | - | - |
|
||||
| USE_MCP230xx | - | - | - | - | - | - | - |
|
||||
| USE_PCA9685 | - | - | - | - | - | - | - |
|
||||
|
@ -175,129 +208,54 @@ Core version **2.5.2** binaries can be found at http://thehackbox.org/tasmota/re
|
|||
| USE_DS3231 | - | - | - | - | - | - | - |
|
||||
| USE_MGC3130 | - | - | - | - | - | - | - |
|
||||
| USE_MAX44009 | - | - | - | - | - | - | - |
|
||||
| USE_SCD30 | - | - | - | - | - | x | - |
|
||||
| USE_SCD30 | - | - | - | - | x | - | - |
|
||||
| USE_SPS30 | - | - | - | - | - | - | - |
|
||||
| USE_ADE7953 | - | - | - | x | x | x | x |
|
||||
| USE_ADE7953 | - | - | x | x | x | - | x |
|
||||
| USE_VL53L0X | - | - | - | - | - | - | - |
|
||||
| USE_MLX90614 | - | - | - | - | - | - | - |
|
||||
| USE_CHIRP | - | - | - | - | - | - | - |
|
||||
| USE_PAJ7620 | - | - | - | - | - | - | - |
|
||||
| USE_PCF8574 | - | - | - | - | - | - | - |
|
||||
| | | | | | | | |
|
||||
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks
|
||||
| Feature or Sensor | minimal | basic | sonoff | knx | sensors | ir | display | Remarks
|
||||
| USE_SPI | - | - | - | - | - | - | x |
|
||||
| USE_MHZ19 | - | - | - | x | x | x | x |
|
||||
| USE_SENSEAIR | - | - | - | x | x | x | x |
|
||||
| USE_PMS5003 | - | - | - | x | x | x | x |
|
||||
| USE_NOVA_SDS | - | - | - | x | x | x | x |
|
||||
| USE_ENERGY_SENSOR | - | x | x | x | x | x | - |
|
||||
| USE_PZEM004T | - | - | - | x | x | x | - |
|
||||
| USE_PZEM_AC | - | - | - | x | x | x | - |
|
||||
| USE_PZEM_DC | - | - | - | x | x | x | - |
|
||||
| USE_MCP39F501 | - | x | - | x | x | x | - |
|
||||
| USE_SERIAL_BRIDGE | - | - | - | x | x | x | x |
|
||||
| USE_SDM120 | - | - | - | - | - | x | - |
|
||||
| USE_SDM630 | - | - | - | - | - | x | - |
|
||||
| USE_MP3_PLAYER | - | - | - | - | - | x | - |
|
||||
| USE_TUYA_DIMMER | - | x | - | x | x | x | x |
|
||||
| USE_ARMTRONIX_DIMMERS | - | x | - | x | x | x | x |
|
||||
| USE_PS_16_DZ | - | x | - | x | x | x | x |
|
||||
| USE_MHZ19 | - | - | x | x | x | - | x |
|
||||
| USE_SENSEAIR | - | - | x | x | x | - | x |
|
||||
| USE_PMS5003 | - | - | x | x | x | - | x |
|
||||
| USE_NOVA_SDS | - | - | x | x | x | - | x |
|
||||
| USE_SERIAL_BRIDGE | - | - | x | x | x | - | x |
|
||||
| USE_MP3_PLAYER | - | - | - | - | x | - | - |
|
||||
| USE_AZ7798 | - | - | - | - | - | - | - |
|
||||
| USE_PN532_HSU | - | - | - | - | - | x | - |
|
||||
| USE_IR_REMOTE | - | - | - | x | x | x | x |
|
||||
| USE_IR_HVAC | - | - | - | - | - | x | - |
|
||||
| USE_IR_RECEIVE | - | - | - | x | x | x | x |
|
||||
| USE_WS2812 | - | - | x | x | x | x | x |
|
||||
| USE_WS2812_DMA | - | - | - | - | - | - | - |
|
||||
| USE_ARILUX_RF | - | - | - | x | x | x | - |
|
||||
| USE_SR04 | - | - | - | x | x | x | x |
|
||||
| USE_TM1638 | - | - | - | - | - | x | - |
|
||||
| USE_HX711 | - | - | - | x | x | x | x |
|
||||
| USE_RF_FLASH | - | - | - | x | x | x | - |
|
||||
| USE_TX20_WIND_SENSOR | - | - | - | x | x | x | x |
|
||||
| USE_RC_SWITCH | - | - | - | x | x | x | x |
|
||||
| USE_RF_SENSOR | - | - | - | - | - | x | - | AlectoV2 only
|
||||
| USE_SM16716 | - | x | x | x | x | x | x |
|
||||
| USE_HRE | - | - | - | - | - | x | - |
|
||||
| USE_PN532_HSU | - | - | - | - | x | - | - |
|
||||
| USE_ZIGBEE | - | - | - | - | - | - | - | Experimental
|
||||
| | | | | | | | |
|
||||
| USE_IR_REMOTE | - | - | x | x | x | x | x |
|
||||
| USE_IR_HVAC | - | - | - | - | x | x | - |
|
||||
| USE_IR_RECEIVE | - | - | x | x | x | x | x |
|
||||
| | | | | | | | |
|
||||
| USE_SR04 | - | - | x | x | x | - | x |
|
||||
| USE_TM1638 | - | - | - | - | x | - | - |
|
||||
| USE_HX711 | - | - | x | x | x | - | x |
|
||||
| USE_TX20_WIND_SENSOR | - | - | - | - | x | - | - |
|
||||
| USE_RC_SWITCH | - | - | - | - | x | - | - |
|
||||
| USE_RF_SENSOR | - | - | - | - | x | - | - | AlectoV2 only
|
||||
| USE_HRE | - | - | - | - | x | - | - |
|
||||
| USE_A4988_STEPPER | - | - | - | - | - | - | - |
|
||||
| USE_ARDUINO_SLAVE | - | - | - | - | - | - | - | Experimental
|
||||
| | | | | | | | |
|
||||
| Feature or Sensor | minimal | basic | sonoff | knx | sensors | ir | display | Remarks
|
||||
| USE_DISPLAY | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_LCD | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_SSD1306 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_MATRIX | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_SH1106 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_ILI9341 | - | - | - | - | - | - | x |
|
||||
| USE_DISPLAY_EPAPER_29 | - | - | - | - | - | - | x | Disabled for core 2.3.0
|
||||
| USE_DISPLAY_EPAPER_42 | - | - | - | - | - | - | x | Disabled for core 2.3.0
|
||||
| USE_DISPLAY_ILI9488 | - | - | - | - | - | - | - |
|
||||
| USE_DISPLAY_SSD1351 | - | - | - | - | - | - | - |
|
||||
| USE_DISPLAY_RA8876 | - | - | - | - | - | - | - |
|
||||
|
||||
## Changelog
|
||||
Version 6.6.0 20190707
|
||||
* Remove support of TLS on core 2.3.0 and extent support on core 2.4.2 and up
|
||||
* Remove MQTT uptime message every hour
|
||||
* Refactor some defines to const
|
||||
* Refactor webserver HTML input, button, textarea, and select name based on id
|
||||
* Refactor webserver sensor data collection
|
||||
* Refactor TLS based on BearSSL, warning breaking change for fingerprints validation
|
||||
* Refactor management of lights, using classes and integers instead of floats
|
||||
* Refactor UDP initial message handling from string to char using static memory and add debug info (#5505)
|
||||
* Refactor ``IRsend`` and receive for 64-bit support (#5523)
|
||||
* Refactor MQTT which might solve issue (#5755)
|
||||
* Refactor ``IRSend`` by using heap when more than 199 values need to be send. May need increase of define MQTT_MAX_PACKET_SIZE too (#5950)
|
||||
* Refactor double to float in rules, and replaced trigonometric functions from stdlib with smaller versions (#6005)
|
||||
* Change pubsubclient MQTT_KEEPALIVE from 10 to 30 seconds for AWS IoT support
|
||||
* Change gamma correction as default behavior, ie "Ledtable 1"
|
||||
* Change PWM resolution from 8 to 10 bits for low brightness lights
|
||||
* Change ``IRSend`` Panasonic protocol to 64-bit (#5523)
|
||||
* Change ADC0 to enabled by default in my_user_config.h (#5671)
|
||||
* Change define USE_EMULATION by USE_EMULATION_HUE and USE_EMULATION_WEMO (#5826)
|
||||
* Change default ``PowerDelta`` from 80% to 0% on new installations (#5858, #5028, #4813, #4130, #4145, #3795, #3778, #3660, #3648)
|
||||
* Fix display Bug in KNX webmenu for Physical Address
|
||||
* Fix the Unescape() function and the ``SendSerial3`` behaviour
|
||||
* Fix webserver multiple Javascript window.onload functionality
|
||||
* Fix TasmotaSerial at 9600 bps solving DFPlayer comms (#5528)
|
||||
* Fix Configure Timer Web GUI (#5568)
|
||||
* Fix Shelly 2.5 I2C address priority issue when VEML6070 code is present by disabling VEML6070 for Shelly 2.5 (#5592)
|
||||
* Fix use of ``SerialDelimiter`` value 128 (#5634)
|
||||
* Fix Sonoff Pow R2 / S31 invalid energy increments (#5789)
|
||||
* Fix core 2.5.x ISR not in IRAM exception (#5837)
|
||||
* Fix Philips Hue emulation Alexa issue by using part of MAC address for LightId (#5849)
|
||||
* Fix missing white channel for WS2812 (#5869)
|
||||
* Fix PZem startup issue (#5875)
|
||||
* Fix exception 9 when syslog is enabled and NTP is just synced (#5917)
|
||||
* Fix Toggle functionality to button double press when one button and two devices are detected (#5935)
|
||||
* Fix command ``Channel`` for dual dimmers (#5940)
|
||||
* Fix not restoring white value on power off/power on (#5993)
|
||||
* Add command ``AdcParam`` to control ADC0 Temperature and Light formula parameters
|
||||
* Add command ``LedMask`` to assign which relay has access to power LED (#5602, #5612)
|
||||
* Add extended LED power control using command ``LedPowerX`` where X is 1 to 4. Enabled when "LedLink(i)" is configured too (#5709)
|
||||
* Add command ``Sensor20 1..255`` to change Nova Fitness SDS01 working period in minutes (#5452)
|
||||
* Add command ``SetOption38 6..255`` to set IRReceive protocol detection sensitivity mimizing UNKNOWN protocols (#5853)
|
||||
* Add command ``SetOption39 1..255`` to control CSE7766 (Pow R2) or HLW8032 (Blitzwolf SHP5) handling of power loads below 6W. Default setting is 128 (#5756)
|
||||
* Add command ``SetOption40 0..250`` to disable button functionality if activated for over 0.1 second. Needs SetOption1 1 and SetOption13 0 (#5449)
|
||||
* Add command ``SetOption63 0/1`` to disable relay state feedback scan at restart (#5594, #5663)
|
||||
* Add command ``SetOption64 0/1`` to switch between "-" or "_" as sensor index separator impacting DS18X20, DHT, BMP and SHT3X sensor names (#5689)
|
||||
* Add command ``SetOption65 0/1`` and more Tuya Serial based device support (#5815)
|
||||
* Add command ``WebColor`` to change GUI colors on the fly
|
||||
* Add support for AWS IoT with TLS 1.2 on core 2.4.2 and up. Full doc here: https://github.com/arendst/Sonoff-Tasmota/wiki/AWS-IoT
|
||||
* Add support for Badger HR-E Water Meter (#5539)
|
||||
* Add support for Shelly 2.5 Energy and overtemp Monitoring (#5592)
|
||||
* Add support for color and colortone for Philips Hue emulation via Alexa (#5600 #4809)
|
||||
* Add support for Scripts as replacement for Rules. Default disabled but can be enabled in my_user_config.h (#5689)
|
||||
* Add support for up to four LEDs related to four power outputs. Enabled when "LedLink(i)" is configured too (#5709)
|
||||
* Add support for Shelly 1PM Template ``{"NAME":"Shelly 1PM","GPIO":[56,0,0,0,82,134,0,0,0,0,0,21,0],"FLAG":2,"BASE":18}`` (#5716)
|
||||
* Add support for SPS30 Particle sensor thanks to Gerhard Mutz (#5830)
|
||||
* Add support for VL53L0x time of flight sensor. Might interfere with TSL2561 using same I2C address (#5845)
|
||||
* Add support for Sonoff L1 thanks to reef-actor (#6002)
|
||||
* Add rule Http#Initialized
|
||||
* Add rule System#Save executed just before a planned restart
|
||||
* Add rule support for single JSON value pair like {"SSerialReceived":"on"} by expanding it to {"SSerialReceived":{"Data":"on"}} allowing for trigger SSerialReceived#Data=on (#5638)
|
||||
* Add define USE_COUNTER to my_user_config.h to save space in sonoff-basic.bin and sonoff-minimal.bin
|
||||
* Add define USE_DHT to my_user_config.h to save space in sonoff-basic.bin
|
||||
* Add defines USE_EMULATION_WEMO and USE_EMULATION_HUE to my_user_config.h to control emulation features at compile time (#5826)
|
||||
* Add Toggle functionality to button double press when more devices are detected
|
||||
* Add device OverTemp (>73 Celsius) detection to Energy Monitoring devices with temperature sensor powering off all outputs
|
||||
* Add Tuya Dimmer 10 second heartbeat serial packet required by some Tuya dimmer secondary MCUs
|
||||
* Add all temperature, humidity and pressure for global access
|
||||
* Add validation check when loading settings from flash
|
||||
* Add HX711 weight restore after controlled restart or after power restore just before executing command Sensor34 7 (#5367, #5786)
|
||||
* Add GUI hexadecimal color options in my_user_config.h (#5586)
|
||||
* Add alternative ``IRSend`` command syntax ``IRSend raw,<freq>,<header mark>,<header space>,<bit mark>,<zero space>,<one space>,<bit stream>`` (#5610)
|
||||
* Add user configurable ADC0 to Module and Template configuration compatible with current FLAG options (#5671)
|
||||
* Add AriLux RF control GPIO option "ALux IrSel" (159) replacing "Led4i" (59) for full LED control (#5709)
|
||||
* Add LED GPIO option "LedLink" (157) and "LedLinki" (158) to select dedicated link status LED (#5709)
|
||||
* Add all 5 PWM channels individually adressable with LEDs. (#5741)
|
||||
* Add reset of Energy values when connection to sensor is lost for over 4 seconds (#5874, #5881)
|
||||
* Add checkbox to GUI password field enabling visibility during password entry only (#5934)
|
||||
Version 6.7.0 20191101
|
||||
* TBS
|
||||
|
|
|
@ -22,4 +22,4 @@ If you're looking for support on **Sonoff-Tasmota** there are some options avail
|
|||
* [Bug Report](https://github.com/arendst/Sonoff-Tasmota/issues/new?template=Bug_report.md): For reporting Bugs of Tasmota Software.
|
||||
* [Feature Request](https://github.com/arendst/Sonoff-Tasmota/issues/new?template=Feature_request.md): For requesting features/functions to Tasmota Software.
|
||||
* [Troubleshooting](https://github.com/arendst/Sonoff-Tasmota/issues/new?template=Custom.md): As a last resort, you can open new *Troubleshooting* issue on GitHub if the solution could not be found using the other channels. Just remember: the more info you provide the more chances you'll have to get an accurate answer.
|
||||
* [Issue a question](https://github.com/arendst/Sonoff-Tasmota/issues/new/choose): As a last resort, you can open new *Question* issue on GitHub if the answer could not be found using the other channels. Just remember: the more info you provide the more chances you'll have to get an accurate answer.
|
||||
* [Issue a question](https://github.com/arendst/Sonoff-Tasmota/issues/new/choose): As a last resort, you can open a new *Question* issue on GitHub if the answer could not be found using the other channels. Just remember: the more info you provide the more chances you'll have to get an accurate answer.
|
||||
|
|
89
TEMPLATE.md
89
TEMPLATE.md
|
@ -1,89 +0,0 @@
|
|||
<img src="/tools/logo/TASMOTA_FullLogo_Vector.svg" alt="Logo" align="right" height="76"/>
|
||||
|
||||
# Template information
|
||||
|
||||
Sonoff-Tasmota uses Device or Module information to control peripherals connected to GPIOs. This information is stored in the ``sonoff_template.h`` file as a device specific template. The template contains information about what GPIO should be connected to what peripheral and what GPIO may be configured online using the ``GPIO`` command or GUI Configure Module menu. In addition a device may need specific coding to process the data from these peripherals. The module number as provided by the ``Modules`` command is used to select this coding.
|
||||
|
||||
Starting with version 6.4.1.16 Sonoff-Tasmota Modules can be extended by users online using a template. To provide easy processing by Sonoff-Tasmota a user template is written as JSON text and could look like this:
|
||||
|
||||
{"NAME":"UserModule1","GPIO":[17,148,29,149,7,255,255,255,138,255,139,255,255],"FLAG":0,"BASE":18}
|
||||
|
||||
The four properties with UPPERCASE property names have the following functionality:
|
||||
|
||||
Property name | Property value description
|
||||
--------------|-------------------------------------------------------------------------------------------------------------------
|
||||
NAME | Up to 14 characters for the Module name
|
||||
GPIO | Up to 13 decimal numbers from 0 to 255 representing GPIO0 to GPIO5, GPIO09, GPIO10 and GPIO12 to GPIO16
|
||||
FLAG | 8 bit mask flag register
|
||||
BASE | Module number of a hard-coded device to be used when device specific functionality is needed
|
||||
|
||||
The above example, based on the Generic Module does not allow ADC0 input.
|
||||
|
||||
## GPIO functionality
|
||||
The GPIO functionality numbers are the same is shown by command ``GPIOs``. In addition code 255 is added to select a GPIO as user configurable via the GUI Configure Module menu.
|
||||
|
||||
## FLAG functionality
|
||||
The FLAG value is an 8-bit mask where each bit controls a features. Add FLAG values to set multiple bits.
|
||||
|
||||
FLAG | Mask | Feature description
|
||||
-----|----------|------------------------------
|
||||
1 | xxxxxxx1 | Allowing to use Analog0 (ADC0) as input if define USE_ADC_VCC in ``my_user_config.h`` is disabled
|
||||
2 | xxxxxx1x | Enable GUI pull-up control message
|
||||
4 | xxxxx1xx | Not used
|
||||
8 | xxxx1xxx | Not used
|
||||
16 | xxx1xxxx | Not used
|
||||
32 | xx1xxxxx | Not used
|
||||
64 | x1xxxxxx | Not used
|
||||
128 | 1xxxxxxx | Not used
|
||||
|
||||
## BASE functionality
|
||||
The following table lists hard-coded device specific functionality. Notice that not all device modules need special handling.
|
||||
|
||||
BASE | Module | Description
|
||||
-----|----------------|----------------------------------------------
|
||||
4 | Sonoff Dual | Process relay and button via hardware serial interface using GPIO01 and GPIO03. Change baudrate to 19200 bps. Process buttons as single press only
|
||||
9 | Sonoff Touch | Invert ledstate 1 functionality
|
||||
10 | Sonoff LED | Set light type to 2 PWM channels disregarding SetOption15. Fix device specific LED instabilities by disabling GPIO04, GPIO5 and GPIO14
|
||||
12 | 4 Channel | See 4
|
||||
13 | Motor C/AC | Force all relays ON at Power On and disable command ``PowerOnState``
|
||||
15 | EXS Relay(s) | Enable pulse latching using even/odd numbered relay pairs
|
||||
18 | Generic | Show Wemos specific pin information in GUI
|
||||
19 | H801 | Change hardware UART Tx from GPIO01 to GPIO02
|
||||
20 | Sonoff SC | Enable and Process data via hardware serial interface using GPIO01 and GPIO03. Change baudrate to 19200 bps
|
||||
21 | Sonoff BN-SZ | Set light type to 1 PWM channel disregarding SetOption15
|
||||
22 | Sonoff 4CH Pro | Button handling disregarding SetOption13 only allowing single press to enable RF learning while holding the button
|
||||
24 | Sonoff Bridge | Enable and Process data via hardware serial interface using GPIO01 and GPIO03. Change baudrate to 19200 bps. Process 16 buttons in web GUI. Enable EFM8BB1 firmware upload
|
||||
25 | Sonoff B1 | Set light type to RGBWC using MY92x1
|
||||
26 | AiLight | Set light type to RGBW using MY92x1
|
||||
27 | Sonoff T1 1CH | See 9
|
||||
28 | Sonoff T1 2CH | See 9
|
||||
29 | Sonoff T1 3CH | See 9
|
||||
38 | Sonoff Dual R2 | Process buttons as single press only
|
||||
43 | Sonoff iFan02 | Enable command ``Fanspeed``. Disable Interlock and PulseTime. Tune status information, MQTT data and GUI. Sync with microcontroller. Process Domoticz Fan state
|
||||
47 | Xiaomi Philips | Process Color Temperature using PWM2 and Intensity using PWM1
|
||||
53 | Tuya Dimmer | Enable and Process data via software or hardware serial interface using GPIO 148 and 149 or forced GPIO01 and GPIO03. Change baudrate to 9600 bps. Process all Buttons
|
||||
55 | ARMTR Dimmer | Enable and Process data via software or hardware serial interface using GPIO 148 and 149. Change baudrate to 115200 bps.
|
||||
57 | PS-16-DZ | Enable and Process data via software or hardware serial interface using GPIO 148 and 149. Change baudrate to 19200 bps.
|
||||
61 | YTF IR Bridge | Disable serial interface to stop loopback
|
||||
65 | Mi Desk Lamp | Process rotary and Button1 data specific to this device
|
||||
|
||||
## Usage
|
||||
A user provided template can be stored in Sonoff-Tasmota using the ``Template`` command. It has the following options.
|
||||
|
||||
Command | Payload | Description
|
||||
---------|----------|---------------------------------------
|
||||
Template | | Show current user template
|
||||
Template | 0 | Copy active module template to user template
|
||||
Template | 1 .. 69 | Copy hard-coded module template to user template
|
||||
|
||||
The following command will store a complete template based on the Generic module
|
||||
``Template {"NAME":"UserModule1","GPIO":[17,148,29,149,7,255,255,255,138,255,139,255,255],"FLAG":0,"BASE":18}``
|
||||
|
||||
The following command will update the name of a stored template
|
||||
``Template {"NAME":"UserModule2"}``
|
||||
|
||||
The following command will update the flag of a stored template
|
||||
``Template {"FLAG":1}``
|
||||
|
||||
The following command will update the base of a stored template to Generic
|
||||
``Template {"BASE":0}``
|
|
@ -0,0 +1,613 @@
|
|||
<img src="/tools/logo/TASMOTA_FullLogo_Vector.svg" alt="Logo" align="right" height="76"/>
|
||||
|
||||
# Templates
|
||||
|
||||
Find below the available templates as of October 22nd, 2019. More template information can be found in the [Tasmota Device Templates Repository](http://blakadder.github.io/templates)
|
||||
|
||||
## Bulb
|
||||
```
|
||||
A19 RGBW 8W E26 {"NAME":"OOOLED 60W RGB","GPIO":[255,255,255,255,39,40,255,255,37,255,38,255,255],"FLAG":1,"BASE":18}
|
||||
Aisirer 9W A19 E26 {"NAME":"AISIRER E26","GPIO":[0,0,0,0,0,37,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Anoopsyche CW/WW 60W {"NAME":"Anoop-CW-WW","GPIO":[0,0,0,0,0,37,0,0,0,38,0,0,0],"FLAG":0,"BASE":18}
|
||||
Aoycocr A19 {"NAME":"AoycocrA19","GPIO":[0,0,0,0,0,39,0,0,38,0,37,40,0],"FLAG":0,"BASE":18}
|
||||
Arlec GLD112HA {"NAME":"Arlec CCT","GPIO":[0,0,0,0,0,37,0,0,0,38,0,0,0],"FLAG":0,"BASE":48}
|
||||
Arlec GLD122HA {"NAME":"Arlec RGBWW","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Ausein E14 7W White {"NAME":"Tuya RGBW","GPIO":[255,255,255,255,40,255,255,255,38,39,37,255,255],"FLAG":0,"BASE":18}
|
||||
Avatar 5W E14 {"NAME":"AVATAR","GPIO":[0,0,0,0,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":27}
|
||||
BNeta A60 E27 {"NAME":"OM60/RGBW","GPIO":[255,255,255,255,140,37,0,0,38,142,141,255,255],"FLAG":0,"BASE":18}
|
||||
BNeta GU10 RGB {"NAME":"BNeta","GPIO":[255,255,255,255,140,37,0,0,38,142,141,255,255],"FLAG":0,"BASE":18}
|
||||
Bomcosy 7W E27 RGB CW {"NAME":"Generic","GPIO":[0,0,0,0,37,40,0,0,38,41,39,0,0],"FLAG":1,"BASE":18}
|
||||
Brilliant 20741 {"NAME":"Brilliant RGB+","GPIO":[255,255,255,255,37,40,255,255,38,0,39,0,0],"FLAG":0,"BASE":18}
|
||||
Brilliant HK17653S72 {"NAME":"Brilliant E14 ","GPIO":[255,255,255,255,37,40,255,255,38,255,39,255,255],"FLAG":0,"BASE":18}
|
||||
Candle 6W E14/E27 RGBWW {"NAME":"E14_RGBWW_6W","GPIO":[0,0,0,0,40,41,0,0,38,39,37,0,0],"FLAG":0,"BASE":20}
|
||||
DGM L-WT9W1 {"NAME":"DGM L-WT9W1","GPIO":[0,0,0,0,140,142,0,0,38,37,141,0,0],"FLAG":0,"BASE":18}
|
||||
electriQ RGBW B22 {"NAME":"ElectricQ B22","GPIO":[255,255,255,255,37,41,255,255,38,40,39,255,255],"FLAG":0,"BASE":18}
|
||||
EleLight 7W A19 E27 RGBW {"NAME":"EleLight 7wA19","GPIO":[255,255,255,255,140,37,255,255,255,142,141,255,255],"FLAG":0,"BASE":18}
|
||||
Esicoo 9W E26 {"NAME":"Esicoo Bulb","GPIO":[0,0,0,0,143,144,0,0,0,0,0,0,0],"FLAG":0,"BASE":27}
|
||||
Fcmila 7W RGBW E27 {"NAME":"FCMILA 7W","GPIO":[255,255,255,255,39,40,255,255,37,255,38,255,255],"FLAG":0,"BASE":18}
|
||||
Fcmila EQ723 {"NAME":"FCMILA LED E27","GPIO":[255,255,255,255,40,255,255,255,38,39,37,255,255],"FLAG":0,"BASE":18}
|
||||
Fcmila FC-12W {"NAME":"SYF05","GPIO":[255,0,255,0,140,37,0,0,255,255,141,0,255],"FLAG":1,"BASE":69}
|
||||
Feit Electric BPA800/RGBW/AG/2 {"NAME":" BPA800/RGBW","GPIO":[255,255,255,255,37,38,255,255,141,142,140,255,255],"FLAG":0,"BASE":48}
|
||||
Feit Electric BR30/927CA/AG {"NAME":"Feit BR30 WW","GPIO":[0,0,0,0,0,37,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Feit Electric BR30/950CA/AG {"NAME":"Feit BR30 CW","GPIO":[0,0,0,0,0,37,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Feit Electric OM60/927CA/AG {"NAME":" Feit P_A800_2","GPIO":[0,0,0,0,0,37,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Feit Electric OM60/RGBW/CA/AG {"NAME":"OM60/RGBW","GPIO":[255,255,255,255,140,37,0,0,38,142,141,255,255],"FLAG":0,"BASE":18}
|
||||
Geeni Lux A21 White {"NAME":"Geeni-1050-WW","GPIO":[0,0,0,0,37,37,0,0,38,0,0,0,0],"FLAG":1,"BASE":18}
|
||||
Generic 10W E26/E27 RGBW {"NAME":"10W E27 RGBW","GPIO":[0,0,0,0,0,39,0,0,38,0,37,40,0],"FLAG":0,"BASE":18}
|
||||
Globe CW/WW {"NAME":"Globe CW/WW","GPIO":[0,0,0,0,38,37,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Globe RGBW {"NAME":"GlobeRGBWW","GPIO":[0,0,0,0,37,40,0,0,38,41,39,0,0],"FLAG":0,"BASE":18}
|
||||
Gosund E27 8W RGBW {"NAME":"Gosund RGB+W","GPIO":[255,255,255,255,40,255,255,255,37,38,39,255,255],"FLAG":0,"BASE":18}
|
||||
Jomarto 9W B22 {"NAME":"Jomarto Wifi S","GPIO":[0,0,0,0,40,0,0,0,38,39,37,0,0],"FLAG":1,"BASE":18}
|
||||
Kainsy 7W E27 RGBW {"NAME":"KAINSY","GPIO":[17,255,255,255,143,144,0,0,0,0,0,0,0],"FLAG":0,"BASE":27}
|
||||
Kogan SmarterHome™ White 10W B22 {"NAME":"Kogan White/Wa","GPIO":[0,0,0,0,37,40,0,0,41,38,39,0,0],"FLAG":0,"BASE":18}
|
||||
Kohree A19 7W {"NAME":"Kohree VHP560","GPIO":[255,255,255,255,37,41,255,255,38,40,39,255,255],"FLAG":0,"BASE":18}
|
||||
LE A19 RGBCT 9W E26 {"NAME":"LE RGBWW 60W","GPIO":[255,0,255,0,140,37,0,0,38,142,141,0,255],"FLAG":1,"BASE":18}
|
||||
Legelite E26 {"NAME":"Legelite E26","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Linganzh LWE3 6W RGBW {"NAME":"Linganzh LWE3 ","GPIO":[255,255,255,255,255,38,255,255,39,255,40,37,255],"FLAG":0,"BASE":18}
|
||||
Lohas 5W E12 {"NAME":"LH-5W-ZN01204","GPIO":[0,0,0,0,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":27}
|
||||
Lohas 9W E26 RGBW {"NAME":"Lohas RGBW","GPIO":[0,0,0,0,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":18}
|
||||
Lohas A19 RGBW E12 {"NAME":"Lohas","GPIO":[17,255,255,255,0,0,0,0,0,143,0,144,0],"FLAG":1,"BASE":26}
|
||||
Lohas E14 R50 {"NAME":"Lohas E14 R50","GPIO":[17,255,255,255,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":27}
|
||||
Lohas ZN031 {"NAME":"Lohas ZN031","GPIO":[255,255,255,255,38,37,255,255,41,39,40,255,255],"FLAG":0,"BASE":18}
|
||||
LSC Smart Connect Multicolor Spot GU10 {"NAME":"LSC RGBCW LED","GPIO":[0,0,0,0,0,0,0,0,181,0,180,0,0],"FLAG":0,"BASE":18}
|
||||
LSC Smart Connect Smart Filament LED {"NAME":"LSC-Filam-Big","GPIO":[0,0,0,0,0,0,0,0,38,0,37,0,0],"FLAG":0,"BASE":18}
|
||||
Lumiman E27 Multicolor {"NAME":"Lumiman RGB","GPIO":[255,255,255,255,37,40,255,255,38,41,39,52,255],"FLAG":1,"BASE":18}
|
||||
Lumiman LM530 E26 {"NAME":"Lumiman LM530","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":1,"BASE":18}
|
||||
Lumiman LM650 {"NAME":"Legelite E26","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Luminea ZX-2831 E27 CCT {"NAME":"Luminea CCT","GPIO":[0,0,0,0,140,37,0,0,38,142,141,0,0],"FLAG":0,"BASE":18}
|
||||
Luminea ZX-2832 E27 RGBW {"NAME":"Luminea RGBW","GPIO":[255,255,255,255,140,37,255,255,38,142,141,255,255],"FLAG":1,"BASE":18}
|
||||
Lyasi PT-BW09 {"NAME":"Lyasi PT-BW09","GPIO":[17,255,255,255,143,144,0,0,0,0,0,0,0],"FLAG":0,"BASE":27}
|
||||
Maxcio YX-L01P-E7 {"NAME":"Maxcio YXL01P","GPIO":[17,255,255,255,143,144,0,0,0,0,0,0,0],"FLAG":0,"BASE":27}
|
||||
Merkury A19 60W {"NAME":"MI-BW902-999W","GPIO":[0,0,0,0,0,37,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Merkury A21 75W {"NAME":"MI-BW904-999W","GPIO":[0,0,0,0,140,37,0,0,0,142,141,0,0],"FLAG":1,"BASE":69}
|
||||
Merkury BR30 65W {"NAME":"MI-BW905-999W","GPIO":[0,0,0,0,37,37,0,0,38,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Mirabella Genio CW {"NAME":"GenioBulbCW","GPIO":[0,0,0,0,38,37,0,0,0,40,39,0,0],"FLAG":0,"BASE":18}
|
||||
Mirabella Genio Dimmable {"NAME":"GenioBulbCCT","GPIO":[0,0,0,0,0,37,0,0,0,38,0,0,0],"FLAG":0,"BASE":18}
|
||||
Mirabella Genio RGBW {"NAME":"GenioBulbRGB","GPIO":[255,255,255,255,37,40,255,255,38,255,39,255,255],"FLAG":1,"BASE":18}
|
||||
Mixigoo 10W E27 RGBW {"NAME":"Mixigoo Bulb","GPIO":[255,255,255,255,41,38,255,255,39,255,37,40,255],"FLAG":0,"BASE":18}
|
||||
MOKO YX-L01C-E27 {"NAME":"MOKO","GPIO":[17,255,255,255,143,144,0,0,0,0,0,0,0],"FLAG":0,"BASE":27}
|
||||
Nedis WIFILC10WTE27 {"NAME":"Nedis RGBW","GPIO":[0,0,0,0,140,37,0,0,0,142,141,0,0],"FLAG":1,"BASE":18}
|
||||
Nedis WIFILW10WTE27 {"NAME":"WIFILW10WTE27","GPIO":[0,0,0,0,0,37,0,0,38,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
NiteBird TT-WB4 {"NAME":"NiteBird TT-WB","GPIO":[255,255,255,255,40,255,255,255,37,38,39,255,255],"FLAG":0,"BASE":18}
|
||||
Novostella 12W RGBCT E27 {"NAME":"Novostella","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Novostella B22 7W {"NAME":"Novostella B22","GPIO":[255,255,255,255,37,41,255,255,38,40,39,255,255],"FLAG":0,"BASE":18}
|
||||
Oobest RGBW E27 {"NAME":"WifiBulb","GPIO":[0,0,0,0,0,37,0,0,39,40,38,0,0],"FLAG":1,"BASE":18}
|
||||
Oobest ZN93028 11W E27 RGB {"NAME":"RGB Bulb 11W","GPIO":[255,255,255,255,40,255,255,255,38,39,37,255,255],"FLAG":1,"BASE":18}
|
||||
Reafoo 9W A26 {"NAME":"ReaFooE26","GPIO":[0,0,0,0,41,38,0,0,39,0,40,37,0],"FLAG":0,"BASE":18}
|
||||
RGBW 7W B22 {"NAME":"SM16716","GPIO":[255,255,255,255,140,37,255,255,255,255,141,255,255],"FLAG":0,"BASE":18}
|
||||
RGBW 7W E14 {"NAME":"7W-E14-RGBW-La","GPIO":[255,255,255,255,38,37,255,255,39,255,40,255,255],"FLAG":0,"BASE":18}
|
||||
Solimo 12W B22 RGBWW {"NAME":"Solimo RGBWW12","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Solimo 9W B22 RGBWW {"NAME":"Solimo RGBWW 9","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Sonoff B1 (R2) {"NAME":"Sonoff B1","GPIO":[17,255,255,255,0,0,0,0,143,0,144,0,0],"FLAG":0,"BASE":26}
|
||||
TCP B22 RGBW {"NAME":"TCP Smart RGBW","GPIO":[255,255,255,255,140,37,0,0,38,142,141,255,255],"FLAG":0,"BASE":18}
|
||||
Teckin SB50 {"NAME":"Teckin SB50","GPIO":[255,255,255,255,40,255,255,255,38,39,37,255,255],"FLAG":0,"BASE":18}
|
||||
Teckin SB50 v2 {"NAME":"Teckin SB50","GPIO":[255,255,255,255,37,255,255,255,38,40,39,255,255],"FLAG":0,"BASE":18}
|
||||
Teckin SB50 V3 {"NAME":"Teckin SB50v3","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Teckin SB51 {"NAME":"Teckin SB51","GPIO":[255,255,255,255,40,255,255,255,38,39,37,255,255],"FLAG":0,"BASE":18}
|
||||
Teckin SB53 {"NAME":"Teckin SB53","GPIO":[255,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
TikLOk 7.5W A19 E26 {"NAME":"TikLOk WW-CW-L","GPIO":[0,0,0,0,0,37,0,0,38,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Wipro Garnet B22 9W {"NAME":"WiproSmartBulb","GPIO":[255,255,255,255,37,41,255,255,38,40,39,255,255],"FLAG":0,"BASE":18}
|
||||
Woopower RGBW E14 5W {"NAME":"Woopower E14","GPIO":[0,0,0,0,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":27}
|
||||
Xiaomi Phillips E14 {"NAME":"Xiaomi Philips","GPIO":[0,0,0,0,0,0,0,0,38,0,0,37,0],"FLAG":0,"BASE":48}
|
||||
Xiaomi Phillips E27 {"NAME":"Xiaomi Philips","GPIO":[0,0,0,0,0,0,0,0,38,0,0,37,0],"FLAG":0,"BASE":48}
|
||||
XMRJ {"NAME":"XMRJ","GPIO":[0,0,0,0,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":27}
|
||||
ZZHXON 6W E14/E27 {"NAME":"E27_RGB_Bulb","GPIO":[0,0,0,0,40,41,0,0,38,39,37,0,0],"FLAG":0,"BASE":18}
|
||||
```
|
||||
|
||||
## Bulb Socket
|
||||
```
|
||||
Elegant Choice E27/E26 {"NAME":"Sm Lghtg Base","GPIO":[0,0,0,0,56,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Slampher {"NAME":"Slampher","GPIO":[17,255,0,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":9}
|
||||
SmartBase E0260 {"NAME":"SmartBaseE0260","GPIO":[0,0,0,0,56,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
```
|
||||
|
||||
## Curtain Switch
|
||||
```
|
||||
Teepao {"NAME":"Taopao","GPIO":[255,255,255,18,22,19,255,255,255,21,255,255,17],"FLAG":1,"BASE":18}
|
||||
WF-CS01 {"NAME":"Tuya Shutter","GPIO":[157,0,54,10,22,19,0,0,17,21,53,23,52],"FLAG":0,"BASE":18}
|
||||
```
|
||||
|
||||
## DIY Project
|
||||
```
|
||||
LC-Tech 1Ch and PZEM-004T {"NAME":"HW-655 PZEM","GPIO":[0,63,0,62,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Luani HVIO {"NAME":"Luani HVIO","GPIO":[0,255,255,255,21,22,0,0,9,10,255,52,0],"FLAG":1,"BASE":35}
|
||||
SUPLA inCan by Espablo {"NAME":"Supla Espablo","GPIO":[0,255,4,255,17,21,0,0,255,22,255,0,52],"FLAG":1,"BASE":31}
|
||||
```
|
||||
|
||||
## Development Board
|
||||
```
|
||||
Witty Cloud {"NAME":"Witty Cloud","GPIO":[255,255,56,255,17,255,0,0,38,39,255,37,255],"FLAG":1,"BASE":32}
|
||||
```
|
||||
|
||||
## Dimmer
|
||||
```
|
||||
Armtronix AC Dimmer One Triac Board {"NAME":"ARMTR Dimmer","GPIO":[255,148,255,149,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":56}
|
||||
Armtronix AC Dimmer Two Triac Board {"NAME":"ARMTR Dimmer","GPIO":[255,148,255,149,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":56}
|
||||
CE Smart Home WF500D {"NAME":"CE-WF500D","GPIO":[255,255,255,255,255,255,0,0,255,108,255,107,255],"FLAG":0,"BASE":54}
|
||||
EVA LOGIK WF31 {"NAME":"WF31 Dimmer","GPIO":[255,107,255,108,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":54}
|
||||
EX-Store 2 Kanal RS232 V4 {"NAME":"EXS Dimmer","GPIO":[0,148,0,149,255,255,0,0,255,183,255,0,0],"FLAG":0,"BASE":72}
|
||||
Kingart Touch {"NAME":"PS-16-DZ","GPIO":[255,148,255,149,255,255,0,0,255,52,255,255,255],"FLAG":0,"BASE":58}
|
||||
Moes DS01 {"NAME":"MOES - DS01","GPIO":[255,255,255,255,255,255,0,0,255,108,255,107,255],"FLAG":0,"BASE":54}
|
||||
Moes QS-WiFi-D01 Dimmer 150W {"NAME":"WiFi-Dimmer","GPIO":[0,148,0,149,0,0,0,0,0,42,37,0,0],"FLAG":0,"BASE":18}
|
||||
PS-16-DZ {"NAME":"PS-16-DZ","GPIO":[255,148,255,149,255,255,0,0,255,52,255,255,255],"FLAG":0,"BASE":58}
|
||||
Zemismart KS-7011 {"NAME":"KS-7011 Dimmer","GPIO":[255,107,255,108,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":54}
|
||||
```
|
||||
|
||||
## Environment Monitor
|
||||
```
|
||||
Sonoff SC {"NAME":"Sonoff SC","GPIO":[17,148,255,149,0,0,0,0,0,56,0,0,0],"FLAG":0,"BASE":21}
|
||||
```
|
||||
|
||||
## Fan Controller
|
||||
```
|
||||
Sonoff iFan02 {"NAME":"Sonoff iFan02","GPIO":[17,255,0,255,23,22,18,19,21,56,20,24,0],"FLAG":0,"BASE":44}
|
||||
Sonoff iFan03 {"NAME":"SonoffiFan03","GPIO":[17,148,0,149,0,0,29,161,23,56,22,24,0],"FLAG":0,"BASE":71}
|
||||
```
|
||||
|
||||
## Humidifier
|
||||
```
|
||||
Asakuki 500ml {"NAME":"Oil Diffuser","GPIO":[255,255,255,255,255,255,255,255,255,255,255,21,22],"FLAG":0,"BASE":18}
|
||||
Maxcio 400ml {"NAME":"MaxcioDiffuser","GPIO":[255,255,255,255,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":54}
|
||||
Oil Diffuser 550ML {"NAME":"Oil Diffuser","GPIO":[255,255,255,255,255,255,255,255,255,255,255,21,22],"FLAG":0,"BASE":18}
|
||||
```
|
||||
|
||||
## IR Bridge
|
||||
```
|
||||
Alfawise KS1 {"NAME":"KS1","GPIO":[255,71,17,72,17,51,0,0,56,0,8,0,0],"FLAG":1,"BASE":62}
|
||||
auvisio S06 {"NAME":"NX-4519-675","GPIO":[255,255,255,255,52,51,255,255,255,255,8,255,255],"FLAG":1,"BASE":18}
|
||||
Eachen SANT-IR 01 {"NAME":"Eachen IR","GPIO":[0,0,0,0,56,51,255,255,255,17,8,0,0],"FLAG":0,"BASE":18}
|
||||
Geeklink {"NAME":"GL IR Blaster","GPIO":[255,255,255,255,56,51,0,0,0,17,8,0,0],"FLAG":0,"BASE":62}
|
||||
Mirabella Genio HKWL-IR02W {"NAME":"Genio IR TxRx","GPIO":[255,255,255,255,56,51,0,0,0,17,8,0,0],"FLAG":0,"BASE":62}
|
||||
STITCH by Monoprice 35753 {"NAME":"Stitch 35753","GPIO":[0,0,0,0,52,51,0,0,0,90,8,0,0],"FLAG":0,"BASE":18}
|
||||
YTF {"NAME":"YTF IR Bridge","GPIO":[255,255,255,255,56,51,0,0,0,17,8,0,0],"FLAG":0,"BASE":62}
|
||||
```
|
||||
|
||||
## LED Controller
|
||||
```
|
||||
Arilux AL-LC01 {"NAME":"Arilux LC01","GPIO":[17,255,59,255,147,37,0,0,38,39,255,0,0],"FLAG":0,"BASE":37}
|
||||
Arilux AL-LC06 {"NAME":"Arilux LC06","GPIO":[17,255,255,255,255,255,255,255,38,39,37,41,40],"FLAG":0,"BASE":18}
|
||||
Arilux AL-LC11 {"NAME":"Arilux LC11","GPIO":[17,255,59,255,38,37,0,0,41,40,39,147,0],"FLAG":0,"BASE":38}
|
||||
Electrodragon Mosfet Drive {"NAME":"LEDBoard RGBW","GPIO":[255,0,0,0,255,255,0,0,39,38,40,37,52],"FLAG":0,"BASE":18}
|
||||
H801 {"NAME":"H801","GPIO":[255,52,255,255,41,57,0,0,39,38,40,37,0],"FLAG":0,"BASE":20}
|
||||
LEDEnet {"NAME":"LEDEnet","GPIO":[0,255,56,255,147,0,0,0,38,39,37,40,0],"FLAG":0,"BASE":34}
|
||||
Luminea ZX-2844 {"NAME":"Luminea ZX-284","GPIO":[40,255,255,255,0,39,255,255,38,17,37,255,255],"FLAG":0,"BASE":18}
|
||||
MagicHome RGB ZJ-WFMN-A V1.1 {"NAME":"MagicHome RGB","GPIO":[0,0,0,0,0,37,0,0,38,39,0,0,0],"FLAG":0,"BASE":34}
|
||||
MagicHome RGBW ZJ-WFMN-A V1.1 {"NAME":"MagicHome RGBW","GPIO":[0,0,0,0,51,38,0,0,37,39,0,40,0],"FLAG":0,"BASE":34}
|
||||
MagicHome ZJ-ESP-IR-F V1 {"NAME":"ZJ-ESP-IR-F V1","GPIO":[255,255,255,255,51,38,255,255,37,39,255,40,255],"FLAG":0,"BASE":18}
|
||||
Nexlux {"NAME":"MagicHome V1.1","GPIO":[0,0,0,0,51,37,0,0,38,39,0,0,0],"FLAG":0,"BASE":34}
|
||||
Shelly RGBW2 {"NAME":"RGBW2","GPIO":[255,255,33,255,24,91,255,255,21,17,23,22,255],"FLAG":0,"BASE":18}
|
||||
```
|
||||
|
||||
## LED Strip
|
||||
```
|
||||
BlitzWolf BW-LT11 {"NAME":"BW-LT11 Strip","GPIO":[17,255,255,255,37,40,255,255,38,255,39,255,255],"FLAG":0,"BASE":18}
|
||||
LSC Smart Connect RGBW {"NAME":"LSC-RGBW-Strip","GPIO":[51,0,0,0,37,0,0,0,38,40,39,0,0],"FLAG":0,"BASE":18}
|
||||
Merkury Innovations MI-EW003-999W {"NAME":"MI-EW003-999W ","GPIO":[17,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Mirabella Genio 3 Metre {"NAME":"MirabellaStrip","GPIO":[17,255,255,255,37,40,255,255,38,255,39,255,255],"FLAG":0,"BASE":18}
|
||||
Monster Smart IlluminEssence {"NAME":"MI-EW003-999W ","GPIO":[17,255,255,255,37,40,255,255,38,41,39,255,255],"FLAG":0,"BASE":18}
|
||||
Sonoff L1 {"NAME":"SonoffL1","GPIO":[0,148,0,149,0,0,0,0,0,56,0,0,0],"FLAG":0,"BASE":70}
|
||||
Torchstar {"NAME":"Torchstar","GPIO":[255,255,255,255,52,255,255,255,255,255,255,37,53],"FLAG":1,"BASE":18}
|
||||
```
|
||||
|
||||
## Light
|
||||
```
|
||||
Brilliant 20702/06 Garden {"NAME":"Brilliant Gard","GPIO":[0,0,0,0,37,0,255,255,38,0,39,0,0],"FLAG":0,"BASE":18}
|
||||
Brilliant Smart WiFi Downlight CCT {"NAME":"SmartCCTDwnLgt","GPIO":[0,0,0,0,0,37,0,0,0,38,0,0,0],"FLAG":0,"BASE":48}
|
||||
Fcmila XDD-48W {"NAME":"XDD-48W","GPIO":[0,0,0,0,37,40,0,0,38,25,39,0,0],"FLAG":0,"BASE":18}
|
||||
Mi LED Desk Lamp MJTD01YL {"NAME":"Mi Desk Lamp","GPIO":[0,0,17,0,37,38,0,0,150,151,0,0,0],"FLAG":0,"BASE":66}
|
||||
Mirabella Genio Dimmable CCT Downlight {"NAME":"GenioDLightCCT","GPIO":[0,0,0,0,0,0,0,0,38,0,37,0,0],"FLAG":0,"BASE":48}
|
||||
Mirabella Genio Dimmable RGBCCT Downlight {"NAME":"GenioDLightRGB","GPIO":[0,0,0,0,38,37,0,0,41,39,40,0,0],"FLAG":0,"BASE":18}
|
||||
Sonoff BN-SZ01 {"NAME":"Sonoff BN-SZ","GPIO":[0,0,0,0,0,0,0,0,37,56,0,0,0],"FLAG":0,"BASE":22}
|
||||
Spotlight 9cm RGB+W 7W {"NAME":"Spotlight RGBW","GPIO":[0,0,0,0,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":27}
|
||||
Utorch PZE-911 {"NAME":"Utorch PZE-911","GPIO":[0,0,0,0,0,0,0,0,38,0,37,0,0],"FLAG":0,"BASE":1}
|
||||
Utorch UT40 {"NAME":"Utorch UT40","GPIO":[0,0,0,0,0,0,0,0,38,0,37,0,0],"FLAG":0,"BASE":1}
|
||||
Wipro Next 20W Smart LED Batten {"NAME":"WIPROBatten","GPIO":[255,255,255,255,255,37,255,255,255,47,255,255,255],"FLAG":1,"BASE":18}
|
||||
Zemismart 14W RGB-CCT {"NAME":"ZemiDownLight6","GPIO":[0,0,0,0,37,40,0,0,38,41,39,0,0],"FLAG":0,"BASE":18}
|
||||
Zemismart 4" 10W RGBW {"NAME":"ZemiDownLight","GPIO":[0,0,0,0,0,0,0,0,0,143,0,144,0],"FLAG":0,"BASE":27}
|
||||
```
|
||||
|
||||
## Outdoor Plug
|
||||
```
|
||||
Acenx SOP04-US Dual {"NAME":"SOP04-US Dual","GPIO":[255,255,255,255,56,57,255,255,21,17,22,255,255],"FLAG":0,"BASE":18}
|
||||
Albohes PC-1606 {"NAME":"Albohes PC1606","GPIO":[17,0,0,0,0,22,18,0,21,0,0,0,0],"FLAG":1,"BASE":39}
|
||||
ECF-SOP03 {"NAME":"Outdoor3Outlet","GPIO":[0,0,0,23,56,0,0,0,21,17,22,0,0],"FLAG":0,"BASE":18}
|
||||
Feit Electric Dual {"NAME":"Prime Smart ou","GPIO":[255,255,255,255,157,56,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
Geeni GN-OW101-101 {"NAME":"Geeni Outdoor","GPIO":[17,0,0,0,0,57,0,0,0,52,21,0,0],"FLAG":0,"BASE":18}
|
||||
LEPOWER {"NAME":"LEPOWER Outdoo","GPIO":[255,255,255,255,56,57,255,255,21,17,22,255,255],"FLAG":0,"BASE":18}
|
||||
Oittm Outdoor {"NAME":"Oittm Outdoor","GPIO":[17,0,0,0,0,0,0,0,0,0,56,21,255],"FLAG":0,"BASE":18}
|
||||
SK03 {"NAME":"SK03 Outdoor","GPIO":[17,0,0,0,133,132,0,0,131,57,56,21,0],"FLAG":0,"BASE":57}
|
||||
Top-Max PS-1602 {"NAME":"PS-1602","GPIO":[17,255,255,255,0,22,18,0,21,56,0,0,0],"FLAG":0,"BASE":29}
|
||||
```
|
||||
|
||||
## Plug
|
||||
```
|
||||
3Stone Mini {"NAME":"3Stone Smart P","GPIO":[0,17,0,0,0,0,0,0,0,57,21,0,0],"FLAG":0,"BASE":18}
|
||||
Acashna HS108 {"NAME":"HS108","GPIO":[0,17,0,0,0,0,0,0,0,56,21,0,0],"FLAG":1,"BASE":18}
|
||||
Aisirer UK1 {"NAME":"AISIRER","GPIO":[255,255,255,255,56,255,255,255,21,17,255,255,255],"FLAG":1,"BASE":18}
|
||||
Albohes PS-1602 {"NAME":"Albohes PC1606","GPIO":[17,0,0,0,0,22,18,0,21,0,0,0,0],"FLAG":1,"BASE":39}
|
||||
Aldi Medion Life+ S85225 {"NAME":"Medion","GPIO":[0,0,0,17,134,132,0,0,131,158,21,0,0],"FLAG":0,"BASE":52}
|
||||
Alexfirst TV-ASP801EU {"NAME":"Alexfirst","GPIO":[17,0,0,0,54,56,0,0,21,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
Alfawise PE1004T {"NAME":"PE1004T","GPIO":[255,255,255,255,56,57,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
Amysen YX-WS01 {"NAME":"Amyse YX WS01","GPIO":[255,17,255,255,255,255,255,255,255,56,21,255,255],"FLAG":1,"BASE":18}
|
||||
ANBES ABS-CZ004 {"NAME":"ANBES ABS-CZ00","GPIO":[0,0,0,0,21,133,0,0,131,17,132,22,18],"FLAG":0,"BASE":18}
|
||||
Anoopsyche AWP07L {"NAME":"Anoopsyche AWP","GPIO":[0,0,0,0,56,21,0,0,0,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Anoopsyche JH-G01B1 {"NAME":"JH-G01B1","GPIO":[0,145,0,146,0,0,0,0,17,56,21,0,0],"FLAG":0,"BASE":41}
|
||||
Anoopsyche UK1D {"NAME":"UK1D","GPIO":[0,17,0,0,133,132,0,0,130,52,21,0,0],"FLAG":0,"BASE":6}
|
||||
Aoycocr EU5-16A {"NAME":"Aoycocr","GPIO":[255,0,56,0,0,0,0,0,255,17,0,21,0],"FLAG":0,"BASE":17}
|
||||
Aoycocr Smart Plug {"NAME":"Aoycocr Smart ","GPIO":[0,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":1,"BASE":18}
|
||||
Arlec Grid Connect PC189HA {"NAME":"Arlec","GPIO":[0,0,0,0,123,0,0,0,21,56,17,0,0],"FLAG":0,"BASE":18}
|
||||
Arlec Twin PC288HA {"NAME":"Arlec Twin","GPIO":[0,17,0,22,0,0,0,0,0,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
Aukey SH-PA1 {"NAME":"AUKEY SH-PA1","GPIO":[0,0,57,0,0,0,0,0,0,17,0,21,0],"FLAG":0,"BASE":18}
|
||||
Avatar 10A {"NAME":"AWP07L","GPIO":[56,255,255,255,255,134,255,255,130,17,132,21,255],"FLAG":1,"BASE":18}
|
||||
Avatar AWP07L 10A {"NAME":"Avatar AWP07L","GPIO":[56,255,255,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Avatto JH-G01E {"NAME":"AVATTO JH-G01E","GPIO":[0,145,0,146,0,0,0,0,17,56,21,0,0],"FLAG":0,"BASE":41}
|
||||
AWP02L-N {"NAME":"AWP02L-N","GPIO":[57,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":1,"BASE":18}
|
||||
AWP04L {"NAME":"AWP04L","GPIO":[57,255,255,131,255,134,0,0,21,17,132,56,255],"FLAG":0,"BASE":18}
|
||||
AWP07L {"NAME":"AISIRER AWP07L","GPIO":[0,0,0,0,56,21,0,0,0,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
AWP08L {"NAME":"AWP08L","GPIO":[0,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":1,"BASE":18}
|
||||
AzpenHome Smart {"NAME":"Socket2Me","GPIO":[52,255,255,255,22,255,0,0,21,255,17,255,255],"FLAG":0,"BASE":18}
|
||||
Bestek MRJ1011 {"NAME":"BestekMRJ1011","GPIO":[0,0,0,0,56,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":1}
|
||||
Bilikay SP10 {"NAME":"Bilikay SP10","GPIO":[255,37,255,17,255,255,255,255,255,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
Blitzwolf BW-SHP2 {"NAME":"BlitzWolf SHP","GPIO":[57,255,56,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Blitzwolf BW-SHP3 {"NAME":"Blitzwolf SHP3","GPIO":[56,0,57,0,22,134,0,0,131,18,132,21,17],"FLAG":0,"BASE":45}
|
||||
Blitzwolf BW-SHP3 alt {"NAME":"Blitzwolf SHP3","GPIO":[18,56,0,131,134,132,0,0,17,0,22,21,0],"FLAG":0,"BASE":18}
|
||||
Blitzwolf BW-SHP4 {"NAME":"BlitzWolf SHP","GPIO":[57,255,56,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Blitzwolf BW-SHP5 {"NAME":"SHP5","GPIO":[57,145,56,146,0,22,0,0,0,0,21,0,17],"FLAG":0,"BASE":18}
|
||||
Blitzwolf BW-SHP6 {"NAME":"BlitzWolf SHP","GPIO":[57,255,56,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Blitzwolf BW-SHP8 {"NAME":"SHP8","GPIO":[0,56,0,17,134,132,0,0,131,53,21,0,0],"FLAG":0,"BASE":64}
|
||||
BN-LINK BNC-60/U133TJ-2P {"NAME":"BNC-60/U133TJ","GPIO":[0,56,0,17,134,132,0,0,131,57,21,0,0],"FLAG":0,"BASE":18}
|
||||
Brilliant USB Charger {"NAME":"Brilliant","GPIO":[0,0,0,0,0,21,0,0,0,52,90,0,0],"FLAG":0,"BASE":18}
|
||||
BSD15 {"NAME":"TuyaPlugBSD15","GPIO":[255,255,255,255,255,255,255,255,21,17,56,255,255],"FLAG":1,"BASE":18}
|
||||
BSD25 {"NAME":"Tuya Wifi Plug","GPIO":[255,255,255,255,56,255,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
BSD29 {"NAME":"BSD29","GPIO":[0,0,0,131,134,132,0,0,21,17,56,0,0],"FLAG":0,"BASE":52}
|
||||
BSD33 {"NAME":"Generic","GPIO":[255,255,255,131,134,132,255,255,21,17,56,255,255],"FLAG":0,"BASE":18}
|
||||
BSD34 {"NAME":"BSD34 Plug","GPIO":[255,255,255,255,255,255,255,255,21,17,56,255,255],"FLAG":0,"BASE":18}
|
||||
CE Smart Home - LA-WF3 {"NAME":"CE LA-WF3","GPIO":[0,0,0,0,56,57,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Conico SM-PW70 {"NAME":"Conico SM-PW70","GPIO":[0,0,0,0,56,57,0,0,21,17,0,0,0],"FLAG":1,"BASE":18}
|
||||
Coosa {"NAME":"COOSA","GPIO":[0,0,0,0,57,52,0,0,21,17,255,0,0],"FLAG":0,"BASE":1}
|
||||
Coosa SP1 {"NAME":"COOSA SP1","GPIO":[57,255,56,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
CrazyLynX WiFi {"NAME":"CrazyLynX","GPIO":[255,255,255,255,57,56,255,255,21,17,255,255,255],"FLAG":1,"BASE":18}
|
||||
CYYLTF BIFANS J23 {"NAME":"CYYLTD BIFANS J23","GPIO":[56,0,0,0,0,0,0,0,21,17,0,0,0],"FLAG":1,"BASE":18}
|
||||
Delock 11826 {"NAME":"Delock 11826","GPIO":[17,0,0,0,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":1}
|
||||
Digoo DG-SP01 {"NAME":"DG-SP01","GPIO":[255,17,255,21,56,37,255,255,38,39,40,255,255],"FLAG":0,"BASE":18}
|
||||
Digoo NX-SP202 {"NAME":"Generic_SP202","GPIO":[52,0,0,131,91,134,0,0,22,17,132,21,0],"FLAG":0,"BASE":63}
|
||||
DILISENS SP201 {"NAME":"Dilisens SP201","GPIO":[0,0,131,0,133,132,52,21,18,22,17,0,0],"FLAG":0,"BASE":18}
|
||||
DWFeng AWP02L-N {"NAME":"AWP02L-N","GPIO":[255,255,56,255,255,255,255,255,255,17,255,21,255],"FLAG":0,"BASE":18}
|
||||
ECO Plugs CT-065W {"NAME":"ECO/CT-065W","GPIO":[255,255,255,255,255,255,255,255,255,17,255,21,255],"FLAG":0,"BASE":18}
|
||||
EFUN SH331W {"NAME":"Efun-Plug","GPIO":[56,0,158,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":18}
|
||||
EletecPro 2 {"NAME":"EletecPro-2","GPIO":[255,255,255,255,17,255,255,255,53,52,21,255,255],"FLAG":1,"BASE":18}
|
||||
ENJOWI SP111-EU-W {"NAME":"Enjowi SP111-E","GPIO":[17,56,0,0,134,132,0,0,131,57,21,0,0],"FLAG":0,"BASE":55}
|
||||
Epicka {"NAME":"Epicka","GPIO":[255,255,255,255,57,56,255,255,21,17,255,255,255],"FLAG":1,"BASE":18}
|
||||
Esicoo YX-WS01 {"NAME":"Esicoo Plug","GPIO":[255,17,255,255,255,255,255,255,255,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
Estink C178 {"NAME":"Estink C178","GPIO":[0,0,0,0,52,57,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
ESW01-US {"NAME":"ESW01-US","GPIO":[0,0,0,0,21,56,0,0,0,0,9,0,0],"FLAG":1,"BASE":18}
|
||||
ET RGB {"NAME":"RGB Smart Plug","GPIO":[37,0,39,0,38,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
EVA LOGIK NWF001 {"NAME":"EVA LOGIK Plug","GPIO":[255,17,255,255,255,255,255,255,255,52,21,255,255],"FLAG":0,"BASE":18}
|
||||
EVO-Smart JH-G01U {"NAME":"EVO JH-G01U","GPIO":[0,0,0,0,21,17,0,0,56,0,0,0,0],"FLAG":0,"BASE":18}
|
||||
FK-PW901U {"NAME":"FK-PW901U","GPIO":[56,255,255,255,255,23,255,255,21,17,24,22,255],"FLAG":0,"BASE":18}
|
||||
FLHS-ZN04 {"NAME":"FLHS-ZN04","GPIO":[57,0,56,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Fontastic SH01 {"NAME":"Fontastic","GPIO":[255,0,255,0,56,0,255,255,21,17,0,0,0],"FLAG":1,"BASE":18}
|
||||
FrankEver FLHS-ZN04 {"NAME":"Israel plug","GPIO":[57,0,56,131,0,134,0,0,0,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
GDTech W-US001 {"NAME":"GDTech W-US001","GPIO":[255,17,255,255,255,255,255,255,255,56,21,255,255],"FLAG":1,"BASE":18}
|
||||
GDTech W-US003 {"NAME":"W-US003","GPIO":[0,17,255,255,255,0,0,0,0,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
Geeni Charge {"NAME":"Geeni Charge","GPIO":[0,0,0,0,52,57,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Geeni Glo {"NAME":"Geeni Glo","GPIO":[0,0,0,0,56,0,0,0,21,17,22,0,0],"FLAG":0,"BASE":18}
|
||||
Geeni Spot {"NAME":"Geeni Spot","GPIO":[0,0,0,0,52,57,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Geeni Switch Duo {"NAME":"Geeni Duo","GPIO":[0,0,0,0,18,22,0,0,17,52,21,0,53],"FLAG":0,"BASE":18}
|
||||
Globe Smart {"NAME":"GlobeSmartPlug","GPIO":[0,0,0,0,56,0,0,0,21,0,17,0,0],"FLAG":0,"BASE":18}
|
||||
Gosund SP1 {"NAME":"Gosund SP1 v23","GPIO":[0,56,0,17,134,132,0,0,131,57,21,0,0],"FLAG":0,"BASE":55}
|
||||
Gosund SP111 {"NAME":"Gosund SP111","GPIO":[56,0,57,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":18}
|
||||
Gosund SP112 {"NAME":"SHP5","GPIO":[56,145,57,146,255,22,0,0,255,255,21,255,18],"FLAG":0,"BASE":18}
|
||||
Gosund WP1-1 {"NAME":"Gosund WP1-1","GPIO":[0,0,56,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Gosund WP211 {"NAME":"Gosund wp211","GPIO":[0,0,0,0,21,0,0,0,0,17,0,22,18],"FLAG":0,"BASE":18}
|
||||
Gosund WP212 {"NAME":"Gosund_WP212","GPIO":[17,0,0,0,18,0,0,0,21,0,22,0,0],"FLAG":0,"BASE":18}
|
||||
Gosund WP3 {"NAME":"Gosund WP3","GPIO":[0,0,0,0,17,0,0,0,56,57,21,0,0],"FLAG":0,"BASE":18}
|
||||
Gosund WP5 {"NAME":"Gosund-WP5","GPIO":[255,255,255,255,17,255,255,255,53,52,21,255,255],"FLAG":1,"BASE":18}
|
||||
Gosund WP6 {"NAME":"Gosund WP6","GPIO":[0,0,0,17,0,0,0,0,56,57,21,0,0],"FLAG":0,"BASE":18}
|
||||
Grefic TE101 {"NAME":"Grefic TE101","GPIO":[0,0,0,0,56,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":1}
|
||||
Gyman SM-PW701U {"NAME":"Gyman","GPIO":[255,255,157,255,56,255,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
Hauppauge SL-1642 {"NAME":"SL-1642","GPIO":[0,0,0,0,52,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
HiHome WPP-16T {"NAME":"HiHome WPP-16T","GPIO":[17,56,255,255,134,132,255,255,18,255,22,130,21],"FLAG":1,"BASE":18}
|
||||
hiwild W-US002 {"NAME":"W-US002","GPIO":[0,17,0,0,0,0,0,0,0,52,21,0,158],"FLAG":0,"BASE":18}
|
||||
Houzetek AWP07L {"NAME":"AWP07L","GPIO":[56,255,255,130,255,134,255,255,0,17,132,21,255],"FLAG":0,"BASE":18}
|
||||
HuaFan QinLu {"NAME":"Huafan SS","GPIO":[56,0,0,57,17,29,0,0,132,130,133,0,0],"FLAG":0,"BASE":24}
|
||||
Hyleton 313 {"NAME":"Hyleton 313","GPIO":[57,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":0,"BASE":18}
|
||||
Hyleton 317 {"NAME":"hyleton-317","GPIO":[56,0,57,0,58,0,0,0,0,90,0,21,0],"FLAG":0,"BASE":18}
|
||||
Innens BSD29 {"NAME":"BSD29","GPIO":[0,0,56,131,0,134,0,0,0,17,132,21,0],"FLAG":0,"BASE":52}
|
||||
iSwitch {"NAME":"Smart Plug XSA","GPIO":[255,17,255,255,255,255,255,255,255,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
Jeeo TF-SH330 {"NAME":"Jeeo TF-SH330","GPIO":[56,255,255,255,255,255,255,255,255,17,255,21,255],"FLAG":1,"BASE":18}
|
||||
Jinvoo SM-PW701U {"NAME":"SM-PW702","GPIO":[0,0,0,0,57,56,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Jinvoo SM-PW762U {"NAME":"SM-PW762U","GPIO":[0,0,0,0,158,56,0,0,21,17,22,0,0],"FLAG":0,"BASE":18}
|
||||
Jules V (Upgrade Version) {"NAME":"Jules-V_UV","GPIO":[56,0,0,0,0,134,0,0,21,17,132,57,131],"FLAG":0,"BASE":18}
|
||||
Jules.V NX-SM300 {"NAME":"NX-SM300","GPIO":[52,0,0,0,0,130,0,0,21,132,133,52,0],"FLAG":0,"BASE":6}
|
||||
Kimire S12 {"NAME":"Kimire S12","GPIO":[255,255,255,17,255,255,255,255,255,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
King-Link C128 {"NAME":"King-Link C128","GPIO":[0,0,55,0,22,53,0,0,23,52,17,21,54],"FLAG":0,"BASE":18}
|
||||
KMC 4 30608 {"NAME":"KMC 4 Outlet","GPIO":[0,56,0,0,133,132,0,0,130,22,23,21,17],"FLAG":0,"BASE":36}
|
||||
KMC 70011 {"NAME":"KMC 70011","GPIO":[17,0,0,0,133,132,0,0,130,56,21,0,0],"FLAG":0,"BASE":36}
|
||||
Kogan SmarterHome™ Energy Meter {"NAME":"Kogan Smart Sw","GPIO":[17,0,0,0,133,132,0,0,131,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
Koogeek KLSP1 {"NAME":"Koogeek-KLSP1","GPIO":[0,0,0,17,134,132,0,0,131,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
Koogeek KLUP1 {"NAME":"Koogeek-KLUP1","GPIO":[0,0,0,17,134,132,0,0,131,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
LA-WF3 {"NAME":"CE Smart Plug","GPIO":[255,255,255,255,56,57,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
Laduo YX-DE01 {"NAME":"YX-DE01","GPIO":[255,17,255,255,255,255,255,255,255,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
LESHP KS-501 {"NAME":"LESHP KS-501","GPIO":[17,0,0,0,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":1}
|
||||
LINGANZH 16A {"NAME":"Linganzh Smart","GPIO":[56,0,0,0,0,0,0,0,0,17,0,21,0],"FLAG":0,"BASE":18}
|
||||
Lonsonho 10A Type E {"NAME":"Lonsonho10ALed","GPIO":[0,0,0,0,56,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Lonsonho RGB {"NAME":"RGB Smart Plug","GPIO":[37,0,38,0,0,39,0,0,0,17,0,21,0],"FLAG":0,"BASE":45}
|
||||
LSC Smart Connect {"NAME":"LSC Smart Plug","GPIO":[255,255,255,255,56,255,255,255,21,255,17,255,255],"FLAG":0,"BASE":18}
|
||||
Luminea ZX-2820-675 {"NAME":"ZX2820-675","GPIO":[0,0,56,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Luminea ZX-2820-919 {"NAME":"Luminea ZX2820","GPIO":[17,0,0,0,133,132,0,0,131,56,21,0,0],"FLAG":0,"BASE":65}
|
||||
Martin Jerry {"NAME":"MJ V01","GPIO":[255,255,255,255,56,255,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
Martin Jerry XS-SSA01 {"NAME":"MJ_XS-SSA01","GPIO":[0,0,0,0,0,0,0,0,56,17,0,21,0],"FLAG":0,"BASE":18}
|
||||
Maxcio W-DE004 {"NAME":"Maxcio W-DE004","GPIO":[0,17,0,0,0,0,0,0,0,56,21,0,0],"FLAG":1,"BASE":18}
|
||||
Maxcio W-UK007 {"NAME":"Maxcio","GPIO":[0,17,0,0,0,0,255,255,0,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
Maxcio W-UK007S {"NAME":"Maxcio","GPIO":[56,0,255,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Maxcio W-US002S {"NAME":"W-US002S","GPIO":[57,0,56,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Maxcio W-US003 {"NAME":"W-US003","GPIO":[255,17,255,255,255,255,255,255,255,22,21,255,255],"FLAG":0,"BASE":18}
|
||||
Maxcio YX-DE02 {"NAME":"Generic","GPIO":[255,17,255,21,56,37,255,255,38,39,40,255,255],"FLAG":1,"BASE":18}
|
||||
Merisny P2 {"NAME":"Generic","GPIO":[0,0,52,0,0,0,0,0,0,17,0,21,0],"FLAG":1,"BASE":18}
|
||||
Merkury 70011 MIC-WW102 {"NAME":"MIC-WW102","GPIO":[17,0,0,0,0,0,0,0,0,56,21,0,0],"FLAG":0,"BASE":36}
|
||||
Merkury Innovations {"NAME":"Merkury Switch","GPIO":[255,255,255,255,53,56,255,255,21,17,255,255,255],"FLAG":1,"BASE":18}
|
||||
Merkury MI-OW101-101W {"NAME":"Merkury Switch","GPIO":[17,255,255,255,255,56,255,255,255,255,21,255,255],"FLAG":1,"BASE":18}
|
||||
Mirabella Genio {"NAME":"Genio 1","GPIO":[0,0,56,0,0,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":1}
|
||||
Nanxin NX-SM200 16A {"NAME":"NX-SM200","GPIO":[56,0,0,0,0,134,0,0,21,17,132,57,131],"FLAG":0,"BASE":18}
|
||||
NEO Coolcam 16A {"NAME":"Neo Coolcam 16","GPIO":[17,0,0,0,133,132,0,0,131,56,21,0,0],"FLAG":0,"BASE":49}
|
||||
Obi Stecker {"NAME":"OBI Socket","GPIO":[255,255,0,255,52,21,0,0,54,255,17,0,255],"FLAG":1,"BASE":51}
|
||||
Obi Stecker 2 {"NAME":"OBI Socket 2","GPIO":[0,0,0,0,21,17,0,0,56,53,0,0,0],"FLAG":0,"BASE":61}
|
||||
Obi Stecker IP44 {"NAME":"OBI Socket 2","GPIO":[0,0,0,0,21,17,0,0,56,53,0,0,0],"FLAG":0,"BASE":61}
|
||||
Oittm Smart {"NAME":"Oittm","GPIO":[0,0,0,0,21,56,0,0,17,0,0,0,0],"FLAG":0,"BASE":1}
|
||||
Oukitel P1 {"NAME":"Oukitel P1Dual","GPIO":[52,255,255,255,255,255,255,255,22,17,255,21,255],"FLAG":0,"BASE":18}
|
||||
Oukitel X6P {"NAME":"OUKITEL X6P","GPIO":[255,255,57,255,255,255,255,255,255,17,255,21,255],"FLAG":0,"BASE":18}
|
||||
OxaOxe NX-SM200 {"NAME":"NX-SM200","GPIO":[17,0,0,0,133,132,0,0,131,158,21,0,0],"FLAG":0,"BASE":18}
|
||||
Oxaoxe NX-SM800 {"NAME":"NX-SM800","GPIO":[0,0,0,131,0,134,0,0,21,17,132,0,0],"FLAG":0,"BASE":45}
|
||||
OxaOxe NX-SP202 {"NAME":"oxaoxe-dual","GPIO":[18,0,0,0,134,132,0,0,131,56,21,22,17],"FLAG":0,"BASE":18}
|
||||
OxaOxe NX-SP202 v2 {"NAME":"oxaoxe-dold","GPIO":[56,0,0,131,17,134,0,0,21,18,132,22,0],"FLAG":0,"BASE":18}
|
||||
Panamalar NX-SM200 16A {"NAME":"NX-SM200","GPIO":[0,0,0,0,56,134,0,0,131,17,132,21,0],"FLAG":1,"BASE":18}
|
||||
Powertech {"NAME":"Jaycar","GPIO":[56,0,0,0,0,0,0,0,0,9,0,21,0],"FLAG":0,"BASE":6}
|
||||
Powrui AW-08 {"NAME":"POWRUI AW-08","GPIO":[0,0,0,0,9,21,0,0,0,52,57,0,0],"FLAG":1,"BASE":18}
|
||||
Prime CCRCWFII113PK {"NAME":"Prime","GPIO":[0,0,0,0,57,56,0,0,21,122,0,0,0],"FLAG":0,"BASE":18}
|
||||
RGB Light {"NAME":"RGB Light","GPIO":[37,0,38,0,0,39,0,0,0,90,0,21,0],"FLAG":0,"BASE":18}
|
||||
RSH-WS007 {"NAME":"RSH-WS007","GPIO":[0,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":1,"BASE":18}
|
||||
Shelly Plug S {"NAME":"Shelly Plug S","GPIO":[57,255,56,255,0,134,0,0,131,17,132,21,0],"FLAG":2,"BASE":45}
|
||||
Slitinto NX-SM110 {"NAME":"Slitinto SM110","GPIO":[0,0,56,0,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Slitinto NX-SM112 {"NAME":"NX-SM112","GPIO":[158,0,0,131,0,134,0,0,0,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Slitinto NX-SP202 {"NAME":"Slitinto SP202","GPIO":[17,0,0,0,134,132,0,0,131,52,22,21,91],"FLAG":0,"BASE":64}
|
||||
SM-PW702 {"NAME":"SM-PW702","GPIO":[0,0,0,0,57,56,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
SmartDGM PP-W162 {"NAME":"SmartDGM Plug","GPIO":[0,0,0,17,134,132,0,0,131,52,21,0,0],"FLAG":0,"BASE":18}
|
||||
Sonoff S20 {"NAME":"Sonoff S20","GPIO":[17,255,255,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":8}
|
||||
Sonoff S22 TH {"NAME":"Sonoff S22","GPIO":[17,255,0,255,255,0,0,0,21,56,255,0,0],"FLAG":0,"BASE":4}
|
||||
Sonoff S26 {"NAME":"Sonoff S26","GPIO":[17,255,255,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":8}
|
||||
Sonoff S31 {"NAME":"Sonoff S31","GPIO":[17,145,0,146,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":41}
|
||||
SP201 Dual {"NAME":"SP-201","GPIO":[31,0,0,131,17,134,0,0,21,18,132,22,0],"FLAG":0,"BASE":45}
|
||||
SS01 {"NAME":"Smart Plug SS0","GPIO":[255,255,255,255,255,255,255,255,21,17,255,255,255],"FLAG":1,"BASE":18}
|
||||
STITCH by Monoprice 27937 {"NAME":"Stitch 27937","GPIO":[17,0,56,0,133,132,0,0,131,0,21,0,57],"FLAG":0,"BASE":18}
|
||||
STITCH by Monoprice 35511 {"NAME":"Stitch 35511","GPIO":[56,0,57,0,0,0,0,0,0,17,0,21,0],"FLAG":1,"BASE":18}
|
||||
SuperNight Dual {"NAME":"SuperNight Dua","GPIO":[255,17,255,21,132,133,255,255,22,130,58,255,255],"FLAG":1,"BASE":18}
|
||||
SWA1 {"NAME":"SWA1","GPIO":[0,0,0,0,52,21,0,0,0,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
SWA1 {"NAME":"SWA1","GPIO":[0,0,0,0,52,21,0,0,0,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
SWA11 {"NAME":"SWA1","GPIO":[0,0,0,0,52,21,0,0,0,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
SWA9 {"NAME":"SWA9","GPIO":[0,0,0,0,52,21,0,0,0,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
TanTan WP3 {"NAME":"TanTan WP3","GPIO":[57,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":0,"BASE":18}
|
||||
Teckin SP10 {"NAME":"Teckin SP10","GPIO":[255,255,56,255,255,255,255,255,255,17,255,21,255],"FLAG":0,"BASE":18}
|
||||
Teckin SP20 {"NAME":"TECKIN SP20","GPIO":[56,255,57,255,21,134,0,0,131,17,132,0,0],"FLAG":0,"BASE":45}
|
||||
Teckin SP21 {"NAME":"Teckin SP21","GPIO":[0,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":0,"BASE":45}
|
||||
Teckin SP22 {"NAME":"Teckin","GPIO":[0,17,0,57,134,132,0,0,131,56,21,0,0],"FLAG":0,"BASE":52}
|
||||
Teckin SP23 {"NAME":"Teckin SP23","GPIO":[56,255,57,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
|
||||
Teckin SP25 {"NAME":"Teckin SP25","GPIO":[56,255,255,255,255,255,255,255,22,17,255,21,255],"FLAG":1,"BASE":18}
|
||||
Teckin SP27 {"NAME":"Teckin SP27","GPIO":[56,255,255,255,255,255,255,255,255,17,255,21,255],"FLAG":0,"BASE":18}
|
||||
Tflag NX-SM100 {"NAME":"NX-SM100","GPIO":[56,0,0,0,0,134,0,0,21,17,132,57,131],"FLAG":0,"BASE":18}
|
||||
THRUMM XS-A11 {"NAME":"THRUMM XS-A11 ","GPIO":[255,17,255,255,255,255,255,255,255,56,29,255,255],"FLAG":0,"BASE":18}
|
||||
Timethinker TK04 {"NAME":"TimethinkerEU","GPIO":[255,255,255,255,17,255,0,0,255,52,21,255,0],"FLAG":0,"BASE":18}
|
||||
TimeThinker WS2 {"NAME":"TimeThinkerWS2","GPIO":[0,0,0,0,17,0,0,0,0,52,21,0,0],"FLAG":0,"BASE":18}
|
||||
TomaxUSA HKWL-SO07W {"NAME":"HKWL-SO07W","GPIO":[17,255,255,255,255,255,255,255,255,255,21,255,56],"FLAG":0,"BASE":18}
|
||||
WAGA life CHCZ02MB {"NAME":"WAGA CHCZ02MB","GPIO":[57,0,0,131,0,134,0,0,21,17,132,56,0],"FLAG":0,"BASE":68}
|
||||
WAZA 10A {"NAME":"WAZA","GPIO":[0,0,0,0,21,17,0,0,56,0,0,0,0],"FLAG":1,"BASE":18}
|
||||
WAZA JH-G01B {"NAME":"Teckin SP27","GPIO":[255,255,255,255,53,255,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
WAZA JH-G01E {"NAME":"Waza JH-G01E","GPIO":[0,0,0,0,52,0,0,0,21,17,0,0,0],"FLAG":1,"BASE":18}
|
||||
WiOn 50055 {"NAME":"WiOn","GPIO":[255,0,52,0,0,0,0,0,255,17,0,21,0],"FLAG":0,"BASE":17}
|
||||
WL-SC01 {"NAME":"WL-SC01","GPIO":[0,0,0,0,56,0,0,0,21,0,17,0,0],"FLAG":0,"BASE":1}
|
||||
Woox R4026 {"NAME":"WOOX R4026","GPIO":[0,0,0,17,0,0,0,0,0,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
XS-SSA01 {"NAME":"XS-SSA01","GPIO":[255,17,255,255,255,255,255,255,255,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
XS-SSA01 Alternate {"NAME":"XS-SSA01","GPIO":[255,17,255,255,255,255,255,255,56,255,255,21,255],"FLAG":0,"BASE":18}
|
||||
XS-SSA05 {"NAME":"XS-SSA05","GPIO":[30,255,255,131,255,133,255,255,21,17,132,31,255],"FLAG":1,"BASE":18}
|
||||
XS-SSA06 {"NAME":"RGB Light","GPIO":[37,0,38,0,0,39,0,0,0,90,0,21,0],"FLAG":0,"BASE":18}
|
||||
Yelomin JH-G01E {"NAME":"Yelomin","GPIO":[0,145,0,146,0,0,0,0,17,56,21,0,0],"FLAG":0,"BASE":18}
|
||||
YERON US101 {"NAME":"YERON_US101","GPIO":[255,255,255,17,133,132,255,255,131,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
YT-E003 {"NAME":"YT-E003-SP202","GPIO":[17,0,0,0,134,132,0,0,131,52,22,21,91],"FLAG":0,"BASE":64}
|
||||
YX-WS02 {"NAME":"Amysen YX-WS02","GPIO":[255,17,255,255,255,255,255,255,255,56,21,255,255],"FLAG":1,"BASE":18}
|
||||
ZBR-001 {"NAME":"ZBR-001","GPIO":[17,255,255,255,133,132,255,255,130,56,21,255,57],"FLAG":1,"BASE":18}
|
||||
ZooZee {"NAME":"ZooZee","GPIO":[57,255,56,255,255,255,255,255,255,17,255,21,255],"FLAG":0,"BASE":18}
|
||||
ZooZee SA102 {"NAME":"ZooZee","GPIO":[57,255,56,255,21,133,255,255,131,17,132,255,255],"FLAG":0,"BASE":18}
|
||||
ZooZee SE131 {"NAME":"ZooZee SE131","GPIO":[255,0,56,0,0,0,0,0,255,17,0,21,0],"FLAG":0,"BASE":17}
|
||||
ZSP-001 {"NAME":"ZSP-001","GPIO":[17,255,255,255,133,132,255,255,130,57,21,255,56],"FLAG":1,"BASE":18}
|
||||
```
|
||||
|
||||
## Power Strip
|
||||
```
|
||||
3Stone (2019 Model) {"NAME":"3Stone-2019","GPIO":[0,0,56,0,25,22,0,0,24,17,23,21,0],"FLAG":0,"BASE":18}
|
||||
ACENX 3AC+3USB {"NAME":"ACENX 3-Outlet","GPIO":[56,55,54,53,0,21,0,0,23,24,22,0,17],"FLAG":0,"BASE":18}
|
||||
Annhome 3AC + 2USB {"NAME":"1200W WiFi SPS","GPIO":[32,0,0,0,57,52,0,0,21,17,22,23,33],"FLAG":0,"BASE":18}
|
||||
AOFO 3AC+4USB {"NAME":"AOFO","GPIO":[0,56,0,17,22,21,0,0,0,23,24,0,0],"FLAG":1,"BASE":18}
|
||||
AOFO 4AC+4USB {"NAME":"AOFO4AC4USB","GPIO":[0,56,0,17,22,21,0,0,23,24,25,0,0],"FLAG":1,"BASE":18}
|
||||
CE Garden Power Stake {"NAME":"CE Power Stake","GPIO":[0,0,0,0,56,57,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
CE Smart Home LTS-6A-W5 {"NAME":"CE Power Strip","GPIO":[52,0,0,0,22,21,0,0,24,23,25,26,17],"FLAG":0,"BASE":18}
|
||||
CRST LTS-4G-W {"NAME":"CRST LTS-4G-W","GPIO":[0,0,0,0,24,0,255,255,22,23,21,0,0],"FLAG":0,"BASE":18}
|
||||
Digoo DG-PS01 {"NAME":"Digoo DG-PS01","GPIO":[0,56,0,17,23,22,0,0,0,24,21,0,0],"FLAG":1,"BASE":18}
|
||||
Geekbes 4AC+4USB {"NAME":"Geekbes 4xStri","GPIO":[0,56,0,17,22,21,0,0,23,24,25,0,0],"FLAG":1,"BASE":18}
|
||||
Geeni GN-SW003 {"NAME":"Geeni GNCSW003","GPIO":[52,0,0,0,22,21,0,0,24,25,23,26,17],"FLAG":0,"BASE":18}
|
||||
Hyleton 330 {"NAME":"Hyleton-330","GPIO":[57,0,0,56,29,17,0,0,31,30,32,0,25],"FLAG":0,"BASE":18}
|
||||
Hyleton 331 {"NAME":"HLT-331","GPIO":[52,255,255,57,29,17,255,255,31,30,32,255,58],"FLAG":0,"BASE":18}
|
||||
Hyleton 336 {"NAME":"HLT-336","GPIO":[52,0,0,57,29,17,0,0,31,30,0,0,32],"FLAG":0,"BASE":18}
|
||||
KMC 5 {"NAME":"KMC 5-Outlet","GPIO":[56,0,0,0,25,9,0,0,22,21,23,0,24],"FLAG":0,"BASE":18}
|
||||
Koogeek KLOE4 {"NAME":"Koogeek KLOE4","GPIO":[0,56,0,17,22,21,0,0,23,24,25,0,0],"FLAG":1,"BASE":18}
|
||||
LeFun SK2 {"NAME":"LeFun SK2","GPIO":[0,0,0,17,22,21,0,0,23,24,25,0,0],"FLAG":0,"BASE":18}
|
||||
Meross MSS425 {"NAME":"Meross MSS425","GPIO":[33,0,0,0,56,0,0,0,21,17,22,23,32],"FLAG":0,"BASE":18}
|
||||
Monoprice 34082 {"NAME":"Stitch 34082","GPIO":[255,255,255,255,21,20,255,255,23,22,24,255,255],"FLAG":0,"BASE":18}
|
||||
Nedis WIFIP310FWT {"NAME":"Nedis WIFIP310","GPIO":[0,56,0,17,22,21,0,0,0,23,24,0,0],"FLAG":1,"BASE":18}
|
||||
Powrui AW-39 {"NAME":"Porui AW-39","GPIO":[56,0,0,0,21,255,0,0,23,24,22,0,9],"FLAG":0,"BASE":18}
|
||||
S2199EU {"NAME":"S2199EU","GPIO":[0,17,0,52,23,25,0,0,21,24,22,0,0],"FLAG":1,"BASE":18}
|
||||
SM-S0301 {"NAME":"SM-SO301","GPIO":[56,0,0,0,30,17,0,0,32,31,33,0,21],"FLAG":0,"BASE":18}
|
||||
SM-S0301 {"NAME":"SM-SO301","GPIO":[52,255,255,57,29,17,255,255,31,30,32,255,25],"FLAG":0,"BASE":18}
|
||||
SWB1 {"NAME":"SWB1","GPIO":[52,0,0,0,0,24,0,0,21,17,22,23,0],"FLAG":0,"BASE":18}
|
||||
Teckin SS30 {"NAME":"Teckin SS30","GPIO":[52,255,255,57,29,17,255,255,31,30,32,255,58],"FLAG":0,"BASE":18}
|
||||
Tellur TLL331031 {"NAME":"Tellur","GPIO":[0,56,0,17,22,21,0,0,0,23,24,0,0],"FLAG":1,"BASE":18}
|
||||
TESSAN A4L-BK {"NAME":"TESSAN A4L-BK","GPIO":[0,0,0,24,23,0,255,255,21,0,22,0,0],"FLAG":0,"BASE":18}
|
||||
Viflykoo 3AC+4USB {"NAME":"Viflykoo 3xStr","GPIO":[0,0,53,0,0,23,0,0,21,56,17,24,22],"FLAG":1,"BASE":18}
|
||||
Woox R4028 {"NAME":"Woox R4028","GPIO":[0,56,0,17,23,22,0,0,0,24,21,0,0],"FLAG":1,"BASE":18}
|
||||
Xenon SM-S0301 {"NAME":"SM-SO301","GPIO":[52,255,255,57,29,17,255,255,31,30,32,255,25],"FLAG":0,"BASE":18}
|
||||
XS-A25 {"NAME":"XS-A25","GPIO":[52,0,53,0,25,22,0,0,24,17,23,21,0],"FLAG":0,"BASE":18}
|
||||
XSA26-EU {"NAME":"XSA26-EU","GPIO":[52,0,53,0,25,22,0,0,24,17,23,21,0],"FLAG":0,"BASE":18}
|
||||
Yagala {"NAME":"Yagala","GPIO":[0,0,0,17,22,24,0,0,23,25,21,0,0],"FLAG":0,"BASE":18}
|
||||
Yagala SWB3 {"NAME":"YAGALA SWB3","GPIO":[0,0,53,0,0,23,0,0,21,0,22,24,0],"FLAG":1,"BASE":18}
|
||||
Yagala SWB3 v2 {"NAME":"YAGALA SWB3","GPIO":[157,0,53,0,0,23,0,0,21,17,22,0,0],"FLAG":0,"BASE":18}
|
||||
Yuanguo 4AC + 2 USB {"NAME":"YUANGUO","GPIO":[0,20,0,24,19,18,0,0,17,22,21,23,0],"FLAG":0,"BASE":1}
|
||||
Zeoota PS022 {"NAME":"ZEOOTA 3x plus","GPIO":[0,57,0,56,22,21,0,0,17,23,24,0,0],"FLAG":1,"BASE":18}
|
||||
ZLD-44EU-W {"NAME":"ZLD-44EU-W","GPIO":[17,255,255,255,22,21,18,19,23,24,25,0,0],"FLAG":0,"BASE":23}
|
||||
ZLD-44USA-W {"NAME":"ZLD-44USA-W","GPIO":[0,56,0,17,22,21,0,0,23,24,25,0,0],"FLAG":1,"BASE":18}
|
||||
ZLD64-EU-W {"NAME":"ZLD64-EU-W","GPIO":[0,56,0,17,22,21,0,0,0,0,23,0,0],"FLAG":0,"BASE":18}
|
||||
```
|
||||
|
||||
## RF Bridge
|
||||
```
|
||||
Sonoff RF Bridge 433 {"NAME":"Sonoff Bridge","GPIO":[17,148,255,149,255,255,0,0,255,56,255,0,0],"FLAG":0,"BASE":25}
|
||||
```
|
||||
|
||||
## Relay
|
||||
```
|
||||
1 Channel Inching/Self-Locking {"NAME":"1 Channel","GPIO":[17,0,0,0,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":12}
|
||||
Blitzwolf BW-SS1 {"NAME":"BW-SS1","GPIO":[255,255,255,255,157,21,0,0,255,17,255,255,0],"FLAG":0,"BASE":18}
|
||||
Canwing CW-001 {"NAME":"Canwing CW-001","GPIO":[17,255,0,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":1}
|
||||
EACHEN ST-DC2 {"NAME":"Garage Control","GPIO":[11,0,0,0,23,22,18,0,21,52,12,24,0],"FLAG":1,"BASE":18}
|
||||
Electrodragon Board SPDT {"NAME":"ED Relay Board","GPIO":[255,255,255,255,255,255,255,255,21,22,255,255,52],"FLAG":1,"BASE":18}
|
||||
Electrodragon ESP8266 {"NAME":"ElectroDragon","GPIO":[18,255,17,255,255,255,0,0,22,21,255,255,52],"FLAG":1,"BASE":15}
|
||||
eMylo SS-8839-03 {"NAME":"eMylo","GPIO":[0,0,0,0,56,0,0,0,21,0,17,0,0],"FLAG":1,"BASE":18}
|
||||
eMylo XL9251WI {"NAME":"XL9251WI","GPIO":[255,255,255,255,56,255,255,255,21,255,17,255,255],"FLAG":0,"BASE":18}
|
||||
eMylo YSA111A1N-FBA {"NAME":"Emylo","GPIO":[255,255,255,255,52,255,255,255,21,255,17,255,255],"FLAG":0,"BASE":18}
|
||||
ESP-01 Relay V4.0 {"NAME":"ESP01v4","GPIO":[29,52,0,255,255,255,255,255,255,255,255,255,255],"FLAG":0,"BASE":18}
|
||||
EX Store 2 Kanal V5 {"NAME":"EXS Relay V5","GPIO":[255,255,255,255,255,255,0,0,21,22,31,52,32],"FLAG":0,"BASE":16}
|
||||
Geekcreit 2 Channel {"NAME":"Geekcreit 2ch","GPIO":[17,0,0,0,0,22,18,0,21,52,0,0,0],"FLAG":1,"BASE":18}
|
||||
Gocomma Wi-Fi Smart Switch {"NAME":"GoCommaSmartSw","GPIO":[17,255,255,255,21,255,255,255,255,56,255,255,255],"FLAG":0,"BASE":18}
|
||||
LC Technology 4CH {"NAME":"LC-Tech_4CH ","GPIO":[52,255,17,255,255,255,255,255,21,22,23,24,255],"FLAG":0,"BASE":18}
|
||||
LinkNode R4 {"NAME":"LinkNode R4","GPIO":[0,0,0,0,0,0,0,0,21,22,23,0,24],"FLAG":0,"BASE":18}
|
||||
LinkNode R8 {"NAME":"LinkNode R8","GPIO":[0,0,0,0,25,26,0,28,23,24,22,27,21],"FLAG":0,"BASE":18}
|
||||
MHCOZY {"NAME":"Portail","GPIO":[9,0,0,0,0,0,0,0,21,56,0,0,0],"FLAG":1,"BASE":18}
|
||||
Moeshouse 2 way 2 gang MS-104B {"NAME":"moeshouse2gang","GPIO":[0,0,17,0,160,0,0,0,43,42,21,22,0],"FLAG":0,"BASE":18}
|
||||
Nova Digital Basic 1 MS101 {"NAME":"NovaDigBasic1","GPIO":[255,255,255,255,56,255,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
QS-WIFI-S03 {"NAME":"Generic","GPIO":[17,255,255,255,255,0,0,0,82,21,0,0,0],"FLAG":0,"BASE":1}
|
||||
Shelly 1 {"NAME":"Shelly 1","GPIO":[0,0,0,0,21,82,0,0,0,0,0,0,0],"FLAG":0,"BASE":46}
|
||||
Shelly 1PM {"NAME":"Shelly 1PM","GPIO":[56,0,0,0,82,134,0,0,0,0,0,21,0],"FLAG":2,"BASE":18}
|
||||
Shelly 2 {"NAME":"Shelly 2","GPIO":[0,135,0,136,21,22,0,0,9,0,10,137,0],"FLAG":0,"BASE":47}
|
||||
Shelly 2.5 {"NAME":"Shelly 2.5","GPIO":[56,255,17,255,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}
|
||||
SmartHome Smart Breaker {"NAME":"SmartHome Swit","GPIO":[255,255,255,255,21,255,255,255,17,57,255,56,255],"FLAG":0,"BASE":18}
|
||||
Sonoff 4CH (R2) {"NAME":"Sonoff 4CH","GPIO":[17,255,255,255,23,22,18,19,21,56,20,24,0],"FLAG":0,"BASE":7}
|
||||
Sonoff 4CH Pro (R2) {"NAME":"Sonoff 4CH Pro","GPIO":[17,255,255,255,23,22,18,19,21,56,20,24,0],"FLAG":0,"BASE":23}
|
||||
Sonoff 5V Inching/Selflock Module RE5V1C {"NAME":"Sonoff RE5V1C","GPIO":[17,255,255,255,255,255,0,0,21,56,0,0,0],"FLAG":0,"BASE":18}
|
||||
Sonoff Basic {"NAME":"Sonoff Basic","GPIO":[17,255,255,255,255,0,0,0,21,56,255,0,0],"FLAG":0,"BASE":1}
|
||||
Sonoff Basic R3 {"NAME":"Basic R3","GPIO":[17,255,0,255,255,0,255,255,21,56,255,0,255],"FLAG":0,"BASE":1}
|
||||
Sonoff Dual {"NAME":"Sonoff Dual","GPIO":[0,148,0,149,255,0,0,0,0,56,255,0,0],"FLAG":0,"BASE":5}
|
||||
Sonoff Dual R2 {"NAME":"Sonoff Dual R2","GPIO":[255,255,0,255,0,22,255,17,21,56,0,0,0],"FLAG":0,"BASE":39}
|
||||
Sonoff Mini {"NAME":"Sonoff Mini","GPIO":[17,0,0,0,9,0,0,0,21,56,0,0,255],"FLAG":0,"BASE":1}
|
||||
Sonoff Pow {"NAME":"Sonoff Pow","GPIO":[17,0,0,0,0,130,0,0,21,132,133,52,0],"FLAG":0,"BASE":6}
|
||||
Sonoff Pow R2 {"NAME":"Sonoff Pow R2","GPIO":[17,145,0,146,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":43}
|
||||
Sonoff RF {"NAME":"Sonoff RF","GPIO":[17,255,255,255,255,0,0,0,21,56,255,0,0],"FLAG":0,"BASE":2}
|
||||
Sonoff SV {"NAME":"Sonoff SV","GPIO":[17,255,0,255,255,255,0,0,21,56,255,0,0],"FLAG":1,"BASE":3}
|
||||
Sonoff TH10/TH16 {"NAME":"Sonoff TH","GPIO":[17,255,0,255,255,0,0,0,21,56,255,0,0],"FLAG":0,"BASE":4}
|
||||
Tuya Kinetic Switch {"NAME":"Kinetic Switch","GPIO":[0,0,0,0,52,0,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Wemos Module 10A {"NAME":"WeMos Relay","GPIO":[17,255,52,255,21,255,255,255,255,255,255,255,255],"FLAG":0,"BASE":18}
|
||||
WL-SW01_10 {"NAME":"WL-SW01_10","GPIO":[17,149,0,148,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":1}
|
||||
Yunshan 10A 7-30VDC {"NAME":"Yunshan Relay","GPIO":[0,255,56,255,21,17,0,0,0,0,0,0,0],"FLAG":0,"BASE":33}
|
||||
Zemismart ERC309 Kinetic {"NAME":"Kinetic Switch","GPIO":[255,255,255,255,255,255,0,0,255,108,255,107,255],"FLAG":0,"BASE":54}
|
||||
```
|
||||
|
||||
## Switch
|
||||
```
|
||||
3A Smart Home HGZB-043 {"NAME":"3A Smart Home ","GPIO":[52,0,55,18,22,19,0,0,17,21,54,23,53],"FLAG":0,"BASE":18}
|
||||
Deta 6912HA {"NAME":"DETA 2G Switch","GPIO":[0,0,0,0,157,0,0,0,91,21,22,0,90],"FLAG":0,"BASE":18}
|
||||
DS-102 1 Gang {"NAME":"DS-102 1 Gang","GPIO":[57,0,0,17,0,0,0,0,0,21,56,0,0],"FLAG":1,"BASE":18}
|
||||
DS-102 2 Gang {"NAME":"DS-102 2 Gang","GPIO":[56,58,0,17,22,18,0,0,0,21,57,255,0],"FLAG":0,"BASE":18}
|
||||
DS-102 3 Gang {"NAME":"DS-102 3 Gang","GPIO":[158,58,0,18,22,19,0,0,17,21,57,23,56],"FLAG":0,"BASE":18}
|
||||
Enjowi WF-SK301 {"NAME":"Tuya 3 Channel","GPIO":[0,0,0,0,23,18,0,0,17,21,19,22,157],"FLAG":0,"BASE":18}
|
||||
Etekcity 3-way {"NAME":"Etekcity 3Way","GPIO":[255,255,0,255,23,29,0,0,82,22,10,0,0],"FLAG":0,"BASE":18}
|
||||
EtekCity ESWL01 {"NAME":"EtekCityESWL01","GPIO":[255,255,255,255,52,53,255,255,255,21,122,255,255],"FLAG":1,"BASE":18}
|
||||
Gosund KS-602S {"NAME":"Gosund KS-602S","GPIO":[17,56,0,0,0,0,0,0,0,0,21,0,158],"FLAG":0,"BASE":18}
|
||||
Jinvoo SM-SW101-1 {"NAME":"SM-SW101-1","GPIO":[52,0,0,18,0,0,0,0,17,21,0,0,0],"FLAG":1,"BASE":18}
|
||||
Jinvoo SM-SW101-2 {"NAME":"SM-SW101-2","GPIO":[52,0,0,18,22,0,0,0,17,21,0,0,0],"FLAG":1,"BASE":18}
|
||||
Jinvoo SM-SW101-3 {"NAME":"Jinvoo Wall Sw","GPIO":[52,0,0,18,22,19,0,0,17,21,0,23,0],"FLAG":1,"BASE":18}
|
||||
Jinvoo SM-SW101-C Curtain {"NAME":"Jinvoo Curtain","GPIO":[52,0,0,18,22,19,0,0,17,21,0,23,0],"FLAG":1,"BASE":18}
|
||||
KMC 70008 {"NAME":"KMC 70008","GPIO":[17,255,255,0,0,255,255,255,0,56,21,255,255],"FLAG":0,"BASE":18}
|
||||
KOAANW DS302 {"NAME":"DS302","GPIO":[0,0,0,19,23,18,0,0,17,21,0,22,52],"FLAG":1,"BASE":18}
|
||||
KS-601 2-way {"NAME":"2way Switch","GPIO":[255,255,158,255,255,83,255,255,22,21,255,82,255],"FLAG":0,"BASE":18}
|
||||
Kuled K36 {"NAME":"KULED-B","GPIO":[9,255,255,255,255,255,21,52,29,56,255,255,255],"FLAG":0,"BASE":18}
|
||||
Kuled KS602S {"NAME":"KULED","GPIO":[9,255,255,255,255,255,255,255,21,56,255,255,255],"FLAG":0,"BASE":18}
|
||||
KYGNE CD-301 {"NAME":"KYGNE Touch","GPIO":[0,0,0,0,52,53,0,0,21,17,0,0,0],"FLAG":0,"BASE":10}
|
||||
Lonsonho SK3-01 {"NAME":"Tuya 1 Channel","GPIO":[0,0,0,0,0,17,0,0,0,0,0,21,52],"FLAG":0,"BASE":18}
|
||||
Lonsonho SK3-02 {"NAME":"Tuya 2 Channel","GPIO":[0,0,0,0,22,0,0,0,17,21,18,0,52],"FLAG":0,"BASE":18}
|
||||
Luminea LHC-101.on {"NAME":"LHC-101.on","GPIO":[157,0,0,17,21,0,0,0,0,0,52,0,0],"FLAG":0,"BASE":18}
|
||||
Luminea LHC-102.on {"NAME":"LHC-102.on","GPIO":[157,0,53,0,0,18,0,0,17,21,0,22,52],"FLAG":0,"BASE":18}
|
||||
LX-WIFI-00M 4 Gang {"NAME":"LX-WIFI-00M","GPIO":[17,25,255,255,23,22,18,19,21,0,20,24,0],"FLAG":0,"BASE":7}
|
||||
LYASI B07PYMG3WD {"NAME":"LYASI Touch Sw","GPIO":[0,0,0,0,56,52,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
Martin Jerry 15A {"NAME":"MJ Switch","GPIO":[255,255,255,255,57,56,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
Martin Jerry 3 Way {"NAME":"MJ 3Way Switch","GPIO":[255,255,255,255,52,53,0,0,21,9,157,255,0],"FLAG":0,"BASE":18}
|
||||
Merkury MI-WW107-199W {"NAME":"MI-WW107-199W","GPIO":[52,0,0,0,0,0,0,0,17,21,0,0,0],"FLAG":0,"BASE":18}
|
||||
Minitiger 1 Gang {"NAME":"minitiger 1 Gang","GPIO":[17,255,255,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":28}
|
||||
Minitiger 2 Gang {"NAME":"minitiger 2 Gang","GPIO":[17,255,255,255,0,22,18,0,21,56,0,0,0],"FLAG":0,"BASE":28}
|
||||
Moes 1 Gang Touch {"NAME":"B07C8FJY3G","GPIO":[54,0,0,17,21,0,0,0,0,0,52,0,55],"FLAG":0,"BASE":18}
|
||||
Moes 2 Gang Touch {"NAME":"B07BLZFQZZ ","GPIO":[52,0,53,0,0,18,0,0,17,21,0,22,54],"FLAG":0,"BASE":18}
|
||||
Moes 2 Gang Touch {"NAME":"Tuya Moes 2 Ch","GPIO":[25,255,24,0,0,18,0,0,17,21,0,22,23],"FLAG":0,"BASE":18}
|
||||
Moes 3 Gang Touch {"NAME":"Tuya Moes 3 Ch","GPIO":[27,255,26,18,22,19,0,0,17,21,25,23,24],"FLAG":0,"BASE":18}
|
||||
Moes 3-Way {"NAME":"Moes 3-Way","GPIO":[255,255,255,255,21,57,0,0,30,10,9,255,255],"FLAG":0,"BASE":18}
|
||||
Moko {"NAME":"Moko Switch","GPIO":[0,0,0,17,21,134,0,0,0,0,0,0,0],"FLAG":0,"BASE":59}
|
||||
Nexete DS-123 {"NAME":"DS-123","GPIO":[157,57,255,17,21,18,0,0,255,22,56,255,255],"FLAG":0,"BASE":18}
|
||||
Sainko 1-Way {"NAME":"SAINKO 1CH","GPIO":[17,255,255,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":28}
|
||||
SANA {"NAME":"SW02-03","GPIO":[56,255,255,19,23,18,255,255,17,21,255,22,255],"FLAG":0,"BASE":18}
|
||||
SANA SASW-03 {"NAME":"SANA SASW-03","GPIO":[54,0,0,19,23,18,0,0,17,21,0,22,0],"FLAG":0,"BASE":18}
|
||||
Sesoo SK3-04 {"NAME":"Tuya 4 Channel","GPIO":[52,255,255,19,23,17,0,0,20,24,22,21,18],"FLAG":0,"BASE":18}
|
||||
Sesoo WIFI-US-SK3-04 {"NAME":"WIFI-US-SK3-04","GPIO":[255,255,255,19,23,17,0,0,20,24,22,21,18],"FLAG":0,"BASE":18}
|
||||
SmartPlex 3 Gang {"NAME":"Tuya 3 Channel","GPIO":[255,255,255,255,21,18,0,0,19,23,17,22,255],"FLAG":0,"BASE":18}
|
||||
Sonoff T1 EU 1 Gang {"NAME":"Sonoff T1 1CH","GPIO":[17,255,255,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":28}
|
||||
Sonoff T1 EU 2 Gang {"NAME":"Sonoff T1 2CH","GPIO":[17,255,255,255,0,22,18,0,21,56,0,0,0],"FLAG":0,"BASE":29}
|
||||
Sonoff T1 UK 1 Gang {"NAME":"Sonoff T1 1CH","GPIO":[17,255,255,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":28}
|
||||
Sonoff T1 UK 2 Gang {"NAME":"Sonoff T1 2CH","GPIO":[17,255,255,255,0,22,18,0,21,56,0,0,0],"FLAG":0,"BASE":29}
|
||||
Sonoff T1 UK 3 Gang {"NAME":"Sonoff T1 3CH","GPIO":[17,255,255,255,23,22,18,19,21,56,0,0,0],"FLAG":0,"BASE":30}
|
||||
Sonoff T1 US 1 Gang {"NAME":"Sonoff T1 1CH","GPIO":[17,255,255,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":28}
|
||||
Sonoff T1 US 2 Gang {"NAME":"Sonoff T1 2CH","GPIO":[17,255,255,255,0,22,18,0,21,56,0,0,0],"FLAG":0,"BASE":29}
|
||||
Sonoff T1 US 3 Gang {"NAME":"Sonoff T1 3CH","GPIO":[17,255,255,255,23,22,18,19,21,56,0,0,0],"FLAG":0,"BASE":30}
|
||||
Sonoff Touch EU {"NAME":"Sonoff Touch","GPIO":[17,255,0,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":10}
|
||||
Sonoff Touch US {"NAME":"Sonoff Touch","GPIO":[17,255,0,255,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":10}
|
||||
SS118-01K1 {"NAME":"SS118-01K1","GPIO":[255,255,255,17,21,255,255,255,255,255,56,255,255],"FLAG":0,"BASE":18}
|
||||
STITCH by Monoprice 35557 {"NAME":"Tuya WF15S ","GPIO":[255,255,0,0,255,255,0,0,255,108,255,107,0],"FLAG":0,"BASE":54}
|
||||
Teepao Smart-Rollladen-Schalter {"NAME":"Teepao","GPIO":[158,58,23,18,22,19,0,0,56,21,57,0,17],"FLAG":0,"BASE":18}
|
||||
Tonbux AMZ180648-2 {"NAME":"Tonbux","GPIO":[17,255,255,255,255,0,0,0,21,56,255,0,0],"FLAG":0,"BASE":1}
|
||||
Touch 2 Gang {"NAME":"tuya_2_gang","GPIO":[52,0,0,0,18,0,0,0,17,21,255,22,29],"FLAG":0,"BASE":18}
|
||||
TreatLife SS01S {"NAME":"TL SS01S Swtch","GPIO":[0,0,0,0,52,158,0,0,21,17,0,0,0],"FLAG":0,"BASE":18}
|
||||
WS-US-03 {"NAME":"WS-US-03","GPIO":[17,255,255,255,23,22,18,19,21,56,0,0,0],"FLAG":0,"BASE":30}
|
||||
Xenon SM-SW102-2 {"NAME":"SM SW102","GPIO":[255,255,255,18,22,255,255,255,17,21,255,255,255],"FLAG":0,"BASE":18}
|
||||
Youngzuth SW02 2-way {"NAME":"SW02 2W","GPIO":[52,255,255,9,21,255,255,255,10,22,255,255,255],"FLAG":0,"BASE":18}
|
||||
Zemismart KS-611 3 Gang {"NAME":"Zemismart 3 Ga","GPIO":[0,0,56,0,19,18,0,0,22,21,23,0,17],"FLAG":0,"BASE":18}
|
||||
Zemismart KS-811 1 gang {"NAME":"KS-811 Single","GPIO":[17,255,255,255,255,255,255,255,21,56,255,255,255],"FLAG":0,"BASE":18}
|
||||
Zemismart KS-811 2 Gang {"NAME":"KS-811 Dual","GPIO":[255,255,52,255,255,18,255,255,22,21,255,255,17],"FLAG":0,"BASE":18}
|
||||
Zemismart KS-811 3 Gang {"NAME":"KS-811 Triple","GPIO":[255,255,56,255,19,18,255,255,22,21,23,255,17],"FLAG":0,"BASE":18}
|
||||
Zemismart WF-BS01 {"NAME":"WF-BS01","GPIO":[53,0,0,17,21,0,0,0,0,0,52,0,0],"FLAG":0,"BASE":18}
|
||||
Zemismart ZM-L02E {"NAME":"ZSmart ZM-L02E","GPIO":[255,255,255,255,255,17,255,255,18,21,22,255,255],"FLAG":0,"BASE":18}
|
||||
```
|
||||
|
||||
## Valve
|
||||
```
|
||||
Hoenyzy DN20 3/4 {"NAME":"Unbranded TYWE3S DN20 WIFI Valve","GPIO":[0,0,0,0,0,0,0,0,17,21,0,0,0],"FLAG":0,"BASE":18}
|
||||
Jinvoo SM-PW713 {"NAME":"Jinvoo Valve","GPIO":[0,0,0,0,21,52,0,0,17,53,0,0,0],"FLAG":1,"BASE":18}
|
||||
TopKitchen Irrigation Timer {"NAME":"HoseController","GPIO":[255,255,255,255,255,255,255,255,255,255,255,21,22],"FLAG":1,"BASE":18}
|
||||
```
|
||||
|
||||
## Wall Outlet
|
||||
```
|
||||
Bestten LO-2-W2 {"NAME":"BESTTEN LO-2-W","GPIO":[17,0,0,0,57,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":1}
|
||||
Charging Essentials WiFi Smart {"NAME":"CESmart-Wall","GPIO":[255,255,255,255,255,17,255,255,21,255,255,255,255],"FLAG":0,"BASE":18}
|
||||
Kesen KS-604 {"NAME":"KS-604","GPIO":[255,255,52,255,255,18,255,255,22,21,255,255,17],"FLAG":0,"BASE":18}
|
||||
Kesen KS-604S {"NAME":"KS-604S","GPIO":[255,255,31,255,255,18,255,255,22,21,255,255,17],"FLAG":1,"BASE":18}
|
||||
MakeGood MG-AUWF01 {"NAME":"MG-AUWF01","GPIO":[56,10,157,59,134,132,255,255,131,22,57,21,9],"FLAG":0,"BASE":18}
|
||||
MoesHouse Smart Socket {"NAME":"Smart Socket","GPIO":[255,255,255,255,52,53,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
Smanergy KA10 {"NAME":"KA10","GPIO":[0,56,0,17,134,132,0,0,131,53,21,0,0],"FLAG":0,"BASE":64}
|
||||
Sonoff S55 {"NAME":"Sonoff S55","GPIO":[17,255,0,255,255,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":1}
|
||||
Topgreener TGWF15RM {"NAME":"TGWF15RM","GPIO":[0,56,0,17,134,132,0,0,131,57,21,0,0],"FLAG":0,"BASE":55}
|
||||
Vigica VGSPK00815 {"NAME":"VIGICA outlet","GPIO":[17,255,255,255,255,22,18,255,21,255,255,255,255],"FLAG":1,"BASE":18}
|
||||
WWK-UN-W Glass Panel {"NAME":"tuya wall sock","GPIO":[255,255,255,255,52,53,255,255,21,17,255,255,255],"FLAG":0,"BASE":18}
|
||||
```
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,166 @@
|
|||
|
||||
# ESP8266 platform
|
||||
# ------------------------------
|
||||
|
||||
# For more info:
|
||||
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
|
||||
|
||||
name=ESP8266 Boards (2.5.2-196-g45d71ae4)
|
||||
version=2.5.2-196-g45d71ae4
|
||||
|
||||
# These will be removed by the packager script when doing a JSON release
|
||||
|
||||
|
||||
|
||||
|
||||
runtime.tools.signing={runtime.platform.path}/tools/signing.py
|
||||
runtime.tools.elf2bin={runtime.platform.path}/tools/elf2bin.py
|
||||
runtime.tools.sizes={runtime.platform.path}/tools/sizes.py
|
||||
runtime.tools.makecorever={runtime.platform.path}/tools/makecorever.py
|
||||
runtime.tools.eboot={runtime.platform.path}/bootloaders/eboot/eboot.elf
|
||||
|
||||
compiler.warning_flags=-w
|
||||
compiler.warning_flags.none=-w
|
||||
compiler.warning_flags.default=
|
||||
compiler.warning_flags.more=-Wall
|
||||
compiler.warning_flags.all=-Wall -Wextra
|
||||
|
||||
build.lwip_lib=-llwip_gcc
|
||||
build.lwip_include=lwip/include
|
||||
build.lwip_flags=-DLWIP_OPEN_SRC
|
||||
|
||||
build.vtable_flags=-DVTABLES_IN_FLASH
|
||||
|
||||
build.sslflags=
|
||||
|
||||
build.exception_flags=-fno-exceptions
|
||||
build.stdcpp_lib=-lstdc++
|
||||
build.stdcpp_level=-std=gnu++11
|
||||
|
||||
# build.float=-u _printf_float -u _scanf_float
|
||||
build.float=
|
||||
build.led=
|
||||
build.sdk=NONOSDK22y
|
||||
|
||||
compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
|
||||
compiler.sdk.path={runtime.platform.path}/tools/sdk
|
||||
|
||||
compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf
|
||||
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core"
|
||||
|
||||
compiler.c.cmd=xtensa-lx106-elf-gcc
|
||||
compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags}
|
||||
|
||||
compiler.S.cmd=xtensa-lx106-elf-gcc
|
||||
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls
|
||||
|
||||
compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/lib/{build.sdk}" "-L{compiler.sdk.path}/ld" "-L{compiler.libc.path}/lib" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read
|
||||
|
||||
compiler.c.elf.cmd=xtensa-lx106-elf-gcc
|
||||
compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc
|
||||
|
||||
compiler.cpp.cmd=xtensa-lx106-elf-g++
|
||||
compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 {build.stdcpp_level} -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags}
|
||||
|
||||
compiler.as.cmd=xtensa-lx106-elf-as
|
||||
|
||||
compiler.ar.cmd=xtensa-lx106-elf-ar
|
||||
compiler.ar.flags=cru
|
||||
|
||||
compiler.elf2hex.cmd=esptool
|
||||
compiler.elf2hex.flags=
|
||||
|
||||
compiler.size.cmd=xtensa-lx106-elf-size
|
||||
|
||||
# This can be overriden in boards.txt
|
||||
build.extra_flags=-DESP8266
|
||||
|
||||
# These can be overridden in platform.local.txt
|
||||
compiler.c.extra_flags=
|
||||
compiler.c.elf.extra_flags=
|
||||
compiler.S.extra_flags=
|
||||
compiler.cpp.extra_flags=
|
||||
compiler.ar.extra_flags=
|
||||
compiler.objcopy.eep.extra_flags=
|
||||
compiler.elf2hex.extra_flags=
|
||||
|
||||
## generate file with git version number
|
||||
## needs git
|
||||
recipe.hooks.sketch.prebuild.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h"
|
||||
# This is quite a working hack. This form of prebuild hook, while intuitive, is not explicitly documented.
|
||||
recipe.hooks.prebuild.10.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.makecorever}" --build_path "{build.path}" --platform_path "{runtime.platform.path}" --version "unix-{version}"
|
||||
|
||||
## Build the app.ld linker file
|
||||
recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld"
|
||||
|
||||
## Compile c files
|
||||
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
||||
|
||||
## Compile c++ files
|
||||
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
||||
|
||||
## Compile S files
|
||||
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
||||
|
||||
## Create archives
|
||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
|
||||
|
||||
## Combine gc-sections, archives, and objects
|
||||
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {build.exception_flags} -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group "-L{build.path}"
|
||||
|
||||
## Create eeprom
|
||||
recipe.objcopy.eep.pattern=
|
||||
|
||||
## Create hex
|
||||
recipe.objcopy.hex.1.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.elf2bin}" --eboot "{runtime.tools.eboot}" --app "{build.path}/{build.project_name}.elf" --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} --path "{runtime.tools.xtensa-lx106-elf-gcc.path}/bin" --out "{build.path}/{build.project_name}.bin"
|
||||
recipe.objcopy.hex.2.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed" --legacy "{build.path}/{build.project_name}.bin.legacy_sig"
|
||||
recipe.objcopy.hex.3.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.sizes}" --elf "{build.path}/{build.project_name}.elf" --path "{runtime.tools.xtensa-lx106-elf-gcc.path}/bin"
|
||||
|
||||
## Save hex
|
||||
recipe.output.tmp_file={build.project_name}.bin
|
||||
recipe.output.save_file={build.project_name}.{build.variant}.bin
|
||||
|
||||
## Compute size
|
||||
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
|
||||
recipe.size.regex=^(?:\.irom0\.text|\.text|\.text1|\.data|\.rodata|)\s+([0-9]+).*
|
||||
recipe.size.regex.data=^(?:\.data|\.rodata|\.bss)\s+([0-9]+).*
|
||||
#recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
|
||||
|
||||
# ------------------------------
|
||||
|
||||
tools.esptool.path=
|
||||
# Because the variable expansion doesn't allow one tool to find another, the following lines
|
||||
# will point to "{runtime.platform.path}/tools/python3/python3" in GIT and
|
||||
# "{runtime.tools.python3.path}/python3" for JSON board manager releases.
|
||||
tools.esptool.cmd={runtime.tools.python3.path}/python3
|
||||
tools.esptool.network_cmd={runtime.tools.python3.path}/python3
|
||||
|
||||
|
||||
|
||||
tools.esptool.upload.protocol=esp
|
||||
# esptool.py --trace option is a debug option, not a verbose option
|
||||
tools.esptool.upload.params.verbose=
|
||||
tools.esptool.upload.params.quiet=
|
||||
|
||||
# First, potentially perform an erase or nothing
|
||||
# Next, do the binary upload
|
||||
# Combined in one rule because Arduino doesn't suport upload.1.pattern/upload.3.pattern
|
||||
tools.esptool.upload.pattern="{cmd}" "{runtime.platform.path}/tools/upload.py" --chip esp8266 --port "{serial.port}" --baud "{upload.speed}" "{upload.verbose}" {upload.erase_cmd} --end --chip esp8266 --port "{serial.port}" --baud "{upload.speed}" "{upload.verbose}" write_flash 0x0 "{build.path}/{build.project_name}.bin" --end
|
||||
|
||||
tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"
|
||||
|
||||
tools.mkspiffs.cmd=mkspiffs
|
||||
tools.mkspiffs.cmd.windows=mkspiffs.exe
|
||||
tools.mkspiffs.path={runtime.tools.mkspiffs.path}
|
||||
|
||||
tools.mklittlefs.cmd=mklittlefs
|
||||
tools.mklittlefs.cmd.windows=mklittlefs.exe
|
||||
tools.mklittlefs.path={runtime.platform.path}/tools/mklittlefs
|
||||
|
||||
tools.espupload.cmd=python
|
||||
tools.espupload.cmd.windows=python.exe
|
||||
tools.espupload.path={runtime.platform.path}/tools
|
||||
tools.espupload.upload.protocol=espupload
|
||||
tools.espupload.upload.params.verbose=
|
||||
tools.espupload.upload.params.quiet=
|
||||
tools.espupload.upload.pattern="{cmd}" "{path}/espupload.py" -f "{build.path}/{build.project_name}.bin"
|
|
@ -0,0 +1,24 @@
|
|||
FROM python:2
|
||||
|
||||
LABEL author="Eduard Angold"
|
||||
|
||||
# Install platformio. To be able to build tasmota <=v6.6.0 (and later)
|
||||
# we have to use version 3.6.7 of platformio.
|
||||
RUN pip install --upgrade pip &&\
|
||||
pip install -U platformio==3.6.7
|
||||
|
||||
# Init project
|
||||
COPY init_pio_tasmota /init_pio_tasmota
|
||||
|
||||
# Install project dependencies using a init project.
|
||||
RUN cd /init_pio_tasmota &&\
|
||||
pio run &&\
|
||||
cd ../ &&\
|
||||
rm -fr init_pio_tasmota &&\
|
||||
cp -r /root/.platformio / &&\
|
||||
chmod -R 777 /.platformio
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# Docker container for tasmota builds
|
||||
This Container will setup a proper build environment for [Sonoff-Tasmota](https://github.com/arendst/Sonoff-Tasmota)
|
||||
|
||||
## Create container
|
||||
`docker build -t mytasmota:latest .`
|
||||
|
||||
## Use a ready container from docker hub
|
||||
Use instead of the container `mytasmota:latest` the published container `eddyhub/docker-tasmota:latest` from docker hub.
|
||||
|
||||
## Build all development binaries
|
||||
`git clone https://github.com/arendst/Sonoff-Tasmota.git`
|
||||
`docker run -ti --rm -v $(pwd)/Sonoff-Tasmota:/tasmota -u $UID:$GID mytasmota:latest`
|
||||
|
||||
## Build a specific binary with custom options
|
||||
Checkout Sonoff-Tasmota: `git clone https://github.com/arendst/Sonoff-Tasmota.git`
|
||||
Mount the source as volume in `/tasmota`. **Prefix** any parameter available in `Sonoff-Tasmota/sonoff/my_user_config.h` with `TASMOTA_` as a environment variable for the container. **Also don't forget to escape what needs to be escaped in your shell.** **Strings** should be in **double quotes**. My config example:
|
||||
`docker run -ti --rm -v $(pwd)/Sonoff-Tasmota:/tasmota -e TASMOTA_STA_SSID1='"my-wifi"' -e TASMOTA_STA_PASS1='"my-wifi-password"' -e TASMOTA_MQTT_HOST='my-mqtt-host' -e TASMOTA_MQTT_USER='"my-mqtt-user"' -e TASMOTA_MQTT_PASS='"my-mqtt-password"' -e TASMOTA_WEB_PASSWORD='"my-web-password"' -u $UID:$GID mytasmota:latest --environment sonoff-DE
|
||||
|
||||
Now you should have the file Sonoff-Tasmota/.pioenvs/sonoff-DE/firmware.bin which can be flashed on your device.
|
||||
|
||||
## Build a specific version of tasmota
|
||||
Checkout out the needed version before using the build instructions above:
|
||||
- `git clone https://github.com/arendst/Sonoff-Tasmota.git`
|
||||
- `git -C Sonoff-Tasmota checkout v6.6.0`
|
||||
Build it:
|
||||
- `docker run -ti --rm -v $(pwd)/Sonoff-Tasmota:/tasmota -u $UID:$GID mytasmota:latest`
|
|
@ -0,0 +1,35 @@
|
|||
# configure build via environment
|
||||
#!/bin/bash
|
||||
|
||||
TASMOTA_VOLUME='/tasmota'
|
||||
USER_CONFIG_OVERRIDE="${TASMOTA_VOLUME}/sonoff/user_config_override.h"
|
||||
|
||||
if [ -d $TASMOTA_VOLUME ]; then
|
||||
cd $TASMOTA_VOLUME
|
||||
if [ -n "$(env | grep ^TASMOTA_)" ]; then
|
||||
echo "Removing $USER_CONFIG_OVERRIDE and creating a new one."
|
||||
rm "$USER_CONFIG_OVERRIDE"
|
||||
#export PLATFORMIO_BUILD_FLAGS='-DUSE_CONFIG_OVERRIDE'
|
||||
sed -i 's/^; *-DUSE_CONFIG_OVERRIDE/ -DUSE_CONFIG_OVERRIDE/' platformio.ini
|
||||
echo '#ifndef _USER_CONFIG_OVERRIDE_H_' >> $USER_CONFIG_OVERRIDE
|
||||
echo '#define _USER_CONFIG_OVERRIDE_H_' >> $USER_CONFIG_OVERRIDE
|
||||
echo '#warning **** user_config_override.h: Using Settings from this File ****' >> $USER_CONFIG_OVERRIDE
|
||||
echo '#undef CFG_HOLDER' >> $USER_CONFIG_OVERRIDE
|
||||
echo '#define CFG_HOLDER 1' >> $USER_CONFIG_OVERRIDE
|
||||
for i in $(env | grep ^TASMOTA_); do
|
||||
config=${i#TASMOTA_}
|
||||
key=$(echo $config | cut -d '=' -f 1)
|
||||
value=$(echo $config | cut -d '=' -f 2)
|
||||
echo "#undef ${key}" >> $USER_CONFIG_OVERRIDE
|
||||
echo "#define ${key} ${value}" >> $USER_CONFIG_OVERRIDE
|
||||
done
|
||||
echo '#endif' >> $USER_CONFIG_OVERRIDE
|
||||
fi
|
||||
echo "Compiling..."
|
||||
#pio run -t clean
|
||||
pio run $@
|
||||
echo "Everything done you find your builds in .pioenvs/<build-flavour>/firmware.bin"
|
||||
else
|
||||
echo ">>> NO TASMOTA VOLUME MOUNTED --> EXITING"
|
||||
exit 0;
|
||||
fi
|
|
@ -0,0 +1,30 @@
|
|||
[env:core_2_3_0]
|
||||
; *** Esp8266 core for Arduino version 2.3.0
|
||||
platform = espressif8266@1.5.0
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
|
||||
[env:core_2_4_2]
|
||||
; *** Esp8266 core for Arduino version 2.4.2
|
||||
platform = espressif8266@1.8.0
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
|
||||
[env:core_2_5_2]
|
||||
; *** Esp8266 core for Arduino version 2.5.2
|
||||
platform = espressif8266@~2.2.2
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
|
||||
[env:core_stage]
|
||||
; *** Esp8266 core for Arduino version latest beta
|
||||
platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
|
||||
[env:core_pre]
|
||||
; *** Arduino Esp8266 core pre 2.6.x for Tasmota (mqtt reconnects fixed)
|
||||
platform = https://github.com/Jason2866/platform-espressif8266.git#Tasmota
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#include <Arduino.h>
|
||||
void setup() {}
|
||||
void loop() {}
|
|
@ -0,0 +1,19 @@
|
|||
Stepper Library for Tasmota
|
||||
|
||||
This Class allows you to control bipolar stepper motors. To use it you will need an A4988-StepperDriverCircuit, connected at least with 2 GPIO's (direction and step) and of cause a stepper motor.
|
||||
|
||||
== License ==
|
||||
|
||||
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 2.1 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 library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
@ -0,0 +1,24 @@
|
|||
#######################################
|
||||
# Syntax Coloring Map For Test
|
||||
#######################################
|
||||
|
||||
#######################################
|
||||
# Datatypes (KEYWORD1)
|
||||
#######################################
|
||||
|
||||
A4988_Stepper KEYWORD1 A4988_Stepper
|
||||
|
||||
#######################################
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
|
||||
doMove KEYWORD2
|
||||
doRotate KEYWORD2
|
||||
setRPM KEYWORD2
|
||||
setSPR KEYWORD2
|
||||
setMIS KEYWORD2
|
||||
version KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
#######################################
|
|
@ -0,0 +1,9 @@
|
|||
name=A4988_Stepper
|
||||
version=0.0.1
|
||||
author=Tim Leuschner
|
||||
maintainer=Tim Leuschner <tim@feuer.land>
|
||||
sentence=Allows Tasmota to control stepper motors, connected to A4988-StepperDriverCircuit.
|
||||
paragraph=This library allows you to control bipolar stepper motors, controlled by A4988-stepperDriverCircuit.
|
||||
category=Device Control
|
||||
url=
|
||||
architectures=*
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
This library 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 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 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/>.
|
||||
|
||||
Drives a bipolar motor, controlled by A4988 stepper driver circuit
|
||||
*/
|
||||
//
|
||||
#include "Arduino.h"
|
||||
#include "A4988_Stepper.h"
|
||||
A4988_Stepper::A4988_Stepper( int m_spr
|
||||
, int m_rpm
|
||||
, short m_mis
|
||||
, short m_dir_pin
|
||||
, short m_stp_pin
|
||||
, short m_ena_pin
|
||||
, short m_ms1_pin
|
||||
, short m_ms2_pin
|
||||
, short m_ms3_pin ) {
|
||||
last_time = 0; // time stamp in us of the last step taken
|
||||
motor_SPR = m_spr; // StepsPerRevolution
|
||||
motor_RPM = m_rpm; // RoundsPerMinute
|
||||
motor_MIS = m_mis; // Microsteps w/o effect if MS1-MS3 not connected - then full steps anyway
|
||||
motor_dir_pin = m_dir_pin;
|
||||
motor_stp_pin = m_stp_pin;
|
||||
motor_ena_pin = m_ena_pin;
|
||||
motor_ms1_pin = m_ms1_pin;
|
||||
motor_ms2_pin = m_ms2_pin;
|
||||
motor_ms3_pin = m_ms3_pin;
|
||||
|
||||
adjustDelay();
|
||||
adjustPins();
|
||||
adjustMicrosteps();
|
||||
}
|
||||
|
||||
void A4988_Stepper::adjustPins(void) {
|
||||
// setup the pins on the microcontroller:
|
||||
pinMode(motor_dir_pin, OUTPUT);
|
||||
pinMode(motor_stp_pin, OUTPUT);
|
||||
if (motor_ena_pin <99) {
|
||||
pinMode(motor_ena_pin, OUTPUT);
|
||||
digitalWrite(motor_ena_pin, HIGH);
|
||||
}
|
||||
|
||||
if ((motor_ms1_pin<99)&&(motor_ms2_pin<99)&&(motor_ms3_pin<99)) {
|
||||
pinMode(motor_ms1_pin, OUTPUT);
|
||||
pinMode(motor_ms2_pin, OUTPUT);
|
||||
pinMode(motor_ms3_pin, OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
void A4988_Stepper::adjustMicrosteps() {
|
||||
if ((motor_ms1_pin<99)&&(motor_ms2_pin<99)&&(motor_ms3_pin<99)) {
|
||||
unsigned short i = 0;
|
||||
while (i < 5){
|
||||
if (motor_MIS & (1<<i)){
|
||||
unsigned short mask = MIS_TABLE[i];
|
||||
digitalWrite(motor_ms1_pin, 1&mask?HIGH:LOW);
|
||||
digitalWrite(motor_ms2_pin, 2&mask?HIGH:LOW);
|
||||
digitalWrite(motor_ms3_pin, 4&mask?HIGH:LOW);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
motor_MIS = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void A4988_Stepper::adjustDelay(void) {
|
||||
motor_delay = 60L * 1000L * 1000L / motor_SPR / motor_RPM / motor_MIS/2;
|
||||
}
|
||||
|
||||
void A4988_Stepper::setMIS(short oneToSixteen) {
|
||||
motor_MIS = oneToSixteen;
|
||||
adjustMicrosteps();
|
||||
adjustDelay();
|
||||
}
|
||||
|
||||
short A4988_Stepper::getMIS(void) {
|
||||
return motor_MIS;
|
||||
}
|
||||
|
||||
void A4988_Stepper::setRPM(int howManyRounds) {
|
||||
motor_RPM = howManyRounds;
|
||||
adjustDelay();
|
||||
}
|
||||
|
||||
int A4988_Stepper::getRPM(void) {
|
||||
return motor_RPM;
|
||||
}
|
||||
|
||||
void A4988_Stepper::setSPR(int howManySteps){
|
||||
motor_SPR = howManySteps;
|
||||
adjustDelay();
|
||||
}
|
||||
|
||||
int A4988_Stepper::getSPR(void) {
|
||||
return motor_SPR;
|
||||
}
|
||||
|
||||
void A4988_Stepper::enable(){
|
||||
if (motor_ena_pin < 99) {digitalWrite(motor_ena_pin, LOW);}
|
||||
}
|
||||
|
||||
void A4988_Stepper::disable(){
|
||||
if (motor_ena_pin < 99) {digitalWrite(motor_ena_pin, HIGH);}
|
||||
}
|
||||
|
||||
void A4988_Stepper::doMove(long howManySteps)
|
||||
{
|
||||
long steps_togo = abs(howManySteps); // how many steps to take
|
||||
bool lastStepWasHigh = false;
|
||||
digitalWrite(motor_dir_pin, howManySteps>0?LOW:HIGH);
|
||||
enable();
|
||||
while (steps_togo > 0) {
|
||||
delay(0); // don't get watchdoged in loop
|
||||
unsigned long now = micros();
|
||||
// move if delay has passed:
|
||||
if (now - last_time >= motor_delay) {
|
||||
digitalWrite(motor_stp_pin, lastStepWasHigh?LOW:HIGH);
|
||||
lastStepWasHigh = !lastStepWasHigh;
|
||||
// remeber step-time
|
||||
last_time = now;
|
||||
if (!lastStepWasHigh) steps_togo--; // same here - only HIGH moves, if pulled LOW step is completed...
|
||||
}
|
||||
}
|
||||
disable();
|
||||
}
|
||||
|
||||
void A4988_Stepper::doRotate(long howManyDegrees)
|
||||
{ long lSteps = 0;
|
||||
lSteps = motor_SPR*motor_MIS*howManyDegrees/360;
|
||||
doMove(lSteps);
|
||||
}
|
||||
|
||||
void A4988_Stepper::doTurn(float howManyTimes)
|
||||
{ long lSteps = 0;
|
||||
lSteps = howManyTimes*motor_SPR;
|
||||
doMove(lSteps);
|
||||
}
|
||||
|
||||
int A4988_Stepper::version(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
This library 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 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 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef A4988_Stepper_h
|
||||
#define A4988_Stepper_h
|
||||
|
||||
class A4988_Stepper {
|
||||
public:
|
||||
// constructor:
|
||||
A4988_Stepper( int motor_spr
|
||||
, int motor_rpm
|
||||
, short motor_mis
|
||||
, short motor_dir_pin
|
||||
, short motor_stp_pin
|
||||
, short motor_ena_pin
|
||||
, short motor_ms1_pin
|
||||
, short motor_ms2_pin
|
||||
, short motor_ms3_pin
|
||||
);
|
||||
|
||||
void setRPM (int whatRPM );
|
||||
int getRPM (void );
|
||||
|
||||
void setMIS (short OneToSixteen);
|
||||
short getMIS (void );
|
||||
|
||||
void setSPR (int howMany );
|
||||
int getSPR (void );
|
||||
|
||||
void doMove (long steps_to_move);
|
||||
void doRotate(long degrs_to_turn);
|
||||
void doTurn (float howManyTimes);
|
||||
|
||||
void enable (void );
|
||||
void disable (void );
|
||||
|
||||
int version (void );
|
||||
const unsigned short MIS_TABLE[5] = {0b000,0b001,0b010,0b011,0b111};
|
||||
|
||||
private:
|
||||
void adjustDelay(void);
|
||||
void adjustPins(void);
|
||||
void adjustMicrosteps(void);
|
||||
unsigned long motor_delay; // delay between steps, in ms
|
||||
int motor_SPR; // Steps Per Revolution
|
||||
int motor_RPM; // Rounds Per Minute
|
||||
short motor_MIS; // Micro Steps
|
||||
|
||||
// motor pins:
|
||||
short motor_dir_pin;
|
||||
short motor_stp_pin;
|
||||
short motor_ena_pin;
|
||||
short motor_ms1_pin;
|
||||
short motor_ms2_pin;
|
||||
short motor_ms3_pin;
|
||||
|
||||
unsigned long last_time; // timestamp of last pincycle of last step
|
||||
};
|
||||
|
||||
#endif
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
@ -1,555 +0,0 @@
|
|||
/*!
|
||||
* @file Adafruit_SPITFT.cpp
|
||||
*
|
||||
* @mainpage Adafruit SPI TFT Displays
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
This is our library for generic SPI TFT Displays with
|
||||
address windows and 16 bit color (e.g. ILI9341, HX8357D, ST7735...)
|
||||
|
||||
Check out the links above for our tutorials and wiring diagrams
|
||||
These displays use SPI to communicate, 4 or 5 pins are required to
|
||||
interface (RST is optional)
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
MIT license, all text above must be included in any redistribution
|
||||
* @section dependencies Dependencies
|
||||
*
|
||||
* This library depends on <a href="https://github.com/adafruit/Adafruit_GFX">
|
||||
* Adafruit_GFX</a> being present on your system. Please make sure you have
|
||||
* installed the latest version before using this library.
|
||||
*
|
||||
* @section author Author
|
||||
*
|
||||
* Written by Limor "ladyada" Fried for Adafruit Industries.
|
||||
*
|
||||
* @section license License
|
||||
*
|
||||
* BSD license, all text here must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __AVR_ATtiny85__ // NOT A CHANCE of this stuff working on ATtiny!
|
||||
|
||||
#include "Adafruit_SPITFT.h"
|
||||
#ifndef ARDUINO_STM32_FEATHER
|
||||
#include "pins_arduino.h"
|
||||
#ifndef RASPI
|
||||
#include "wiring_private.h"
|
||||
#endif
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#include "Adafruit_SPITFT_Macros.h"
|
||||
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Pass 8-bit (each) R,G,B, get back 16-bit packed color
|
||||
This function converts 8-8-8 RGB data to 16-bit 5-6-5
|
||||
@param red Red 8 bit color
|
||||
@param green Green 8 bit color
|
||||
@param blue Blue 8 bit color
|
||||
@return Unsigned 16-bit down-sampled color in 5-6-5 format
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint16_t Adafruit_SPITFT::color565(uint8_t red, uint8_t green, uint8_t blue) {
|
||||
return ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | ((blue & 0xF8) >> 3);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Instantiate Adafruit SPI display driver with software SPI
|
||||
@param w Display width in pixels
|
||||
@param h Display height in pixels
|
||||
@param cs Chip select pin #
|
||||
@param dc Data/Command pin #
|
||||
@param mosi SPI MOSI pin #
|
||||
@param sclk SPI Clock pin #
|
||||
@param rst Reset pin # (optional, pass -1 if unused)
|
||||
@param miso SPI MISO pin # (optional, pass -1 if unused)
|
||||
*/
|
||||
/**************************************************************************/
|
||||
Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h,
|
||||
int8_t cs, int8_t dc, int8_t mosi,
|
||||
int8_t sclk, int8_t rst, int8_t miso)
|
||||
: Adafruit_GFX(w, h) {
|
||||
_cs = cs;
|
||||
_dc = dc;
|
||||
_rst = rst;
|
||||
_sclk = sclk;
|
||||
_mosi = mosi;
|
||||
_miso = miso;
|
||||
_freq = 0;
|
||||
#ifdef USE_FAST_PINIO
|
||||
dcport = (RwReg *)portOutputRegister(digitalPinToPort(dc));
|
||||
dcpinmask = digitalPinToBitMask(dc);
|
||||
clkport = (RwReg *)portOutputRegister(digitalPinToPort(sclk));
|
||||
clkpinmask = digitalPinToBitMask(sclk);
|
||||
mosiport = (RwReg *)portOutputRegister(digitalPinToPort(mosi));
|
||||
mosipinmask = digitalPinToBitMask(mosi);
|
||||
if(miso >= 0){
|
||||
misoport = (RwReg *)portInputRegister(digitalPinToPort(miso));
|
||||
misopinmask = digitalPinToBitMask(miso);
|
||||
} else {
|
||||
misoport = 0;
|
||||
misopinmask = 0;
|
||||
}
|
||||
if(cs >= 0) {
|
||||
csport = (RwReg *)portOutputRegister(digitalPinToPort(cs));
|
||||
cspinmask = digitalPinToBitMask(cs);
|
||||
} else {
|
||||
// No chip-select line defined; might be permanently tied to GND.
|
||||
// Assign a valid GPIO register (though not used for CS), and an
|
||||
// empty pin bitmask...the nonsense bit-twiddling might be faster
|
||||
// than checking _cs and possibly branching.
|
||||
csport = dcport;
|
||||
cspinmask = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Instantiate Adafruit SPI display driver with hardware SPI
|
||||
@param w Display width in pixels
|
||||
@param h Display height in pixels
|
||||
@param cs Chip select pin #
|
||||
@param dc Data/Command pin #
|
||||
@param rst Reset pin # (optional, pass -1 if unused)
|
||||
*/
|
||||
/**************************************************************************/
|
||||
Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h,
|
||||
int8_t cs, int8_t dc, int8_t rst)
|
||||
: Adafruit_GFX(w, h) {
|
||||
_cs = cs;
|
||||
_dc = dc;
|
||||
_rst = rst;
|
||||
_sclk = -1;
|
||||
_mosi = -1;
|
||||
_miso = -1;
|
||||
_freq = 0;
|
||||
#ifdef USE_FAST_PINIO
|
||||
clkport = 0;
|
||||
clkpinmask = 0;
|
||||
mosiport = 0;
|
||||
mosipinmask = 0;
|
||||
misoport = 0;
|
||||
misopinmask = 0;
|
||||
dcport = (RwReg *)portOutputRegister(digitalPinToPort(dc));
|
||||
dcpinmask = digitalPinToBitMask(dc);
|
||||
if(cs >= 0) {
|
||||
csport = (RwReg *)portOutputRegister(digitalPinToPort(cs));
|
||||
cspinmask = digitalPinToBitMask(cs);
|
||||
} else {
|
||||
// See notes in prior constructor.
|
||||
csport = dcport;
|
||||
cspinmask = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Initialiaze the SPI interface (hardware or software)
|
||||
@param freq The desired maximum SPI hardware clock frequency
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::initSPI(uint32_t freq) {
|
||||
_freq = freq;
|
||||
|
||||
// Control Pins
|
||||
if(_cs >= 0) {
|
||||
pinMode(_cs, OUTPUT);
|
||||
digitalWrite(_cs, HIGH); // Deselect
|
||||
}
|
||||
pinMode(_dc, OUTPUT);
|
||||
digitalWrite(_dc, LOW);
|
||||
|
||||
// Software SPI
|
||||
if(_sclk >= 0){
|
||||
pinMode(_mosi, OUTPUT);
|
||||
digitalWrite(_mosi, LOW);
|
||||
pinMode(_sclk, OUTPUT);
|
||||
digitalWrite(_sclk, HIGH);
|
||||
if(_miso >= 0){
|
||||
pinMode(_miso, INPUT);
|
||||
}
|
||||
}
|
||||
|
||||
// Hardware SPI
|
||||
SPI_BEGIN();
|
||||
|
||||
// toggle RST low to reset
|
||||
if (_rst >= 0) {
|
||||
pinMode(_rst, OUTPUT);
|
||||
digitalWrite(_rst, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(_rst, LOW);
|
||||
delay(100);
|
||||
digitalWrite(_rst, HIGH);
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Read one byte from SPI interface (hardware or software
|
||||
@returns One byte, MSB order
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint8_t Adafruit_SPITFT::spiRead() {
|
||||
if(_sclk < 0){
|
||||
return HSPI_READ();
|
||||
}
|
||||
if(_miso < 0){
|
||||
return 0;
|
||||
}
|
||||
uint8_t r = 0;
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
SSPI_SCK_LOW();
|
||||
SSPI_SCK_HIGH();
|
||||
r <<= 1;
|
||||
if (SSPI_MISO_READ()){
|
||||
r |= 0x1;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write one byte to SPI interface (hardware or software
|
||||
@param b One byte to send, MSB order
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::spiWrite(uint8_t b) {
|
||||
if(_sclk < 0){
|
||||
HSPI_WRITE(b);
|
||||
return;
|
||||
}
|
||||
for(uint8_t bit = 0x80; bit; bit >>= 1){
|
||||
if((b) & bit){
|
||||
SSPI_MOSI_HIGH();
|
||||
} else {
|
||||
SSPI_MOSI_LOW();
|
||||
}
|
||||
SSPI_SCK_LOW();
|
||||
SSPI_SCK_HIGH();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transaction API
|
||||
* */
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Begin an SPI transaction & set CS low.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void inline Adafruit_SPITFT::startWrite(void){
|
||||
SPI_BEGIN_TRANSACTION();
|
||||
SPI_CS_LOW();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Begin an SPI transaction & set CS high.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void inline Adafruit_SPITFT::endWrite(void){
|
||||
SPI_CS_HIGH();
|
||||
SPI_END_TRANSACTION();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write a command byte (must have a transaction in progress)
|
||||
@param cmd The 8-bit command to send
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::writeCommand(uint8_t cmd){
|
||||
SPI_DC_LOW();
|
||||
spiWrite(cmd);
|
||||
SPI_DC_HIGH();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Push a 2-byte color to the framebuffer RAM, will start transaction
|
||||
@param color 16-bit 5-6-5 Color to draw
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::pushColor(uint16_t color) {
|
||||
startWrite();
|
||||
SPI_WRITE16(color);
|
||||
endWrite();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Blit multiple 2-byte colors (must have a transaction in progress)
|
||||
@param colors Array of 16-bit 5-6-5 Colors to draw
|
||||
@param len How many pixels to draw - 2 bytes per pixel!
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::writePixels(uint16_t * colors, uint32_t len){
|
||||
SPI_WRITE_PIXELS((uint8_t*)colors , len * 2);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Blit a 2-byte color many times (must have a transaction in progress)
|
||||
@param color The 16-bit 5-6-5 Color to draw
|
||||
@param len How many pixels to draw
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len){
|
||||
#ifdef SPI_HAS_WRITE_PIXELS
|
||||
if(_sclk >= 0){
|
||||
for (uint32_t t=0; t<len; t++){
|
||||
writePixel(color);
|
||||
}
|
||||
return;
|
||||
}
|
||||
static uint16_t temp[SPI_MAX_PIXELS_AT_ONCE];
|
||||
size_t blen = (len > SPI_MAX_PIXELS_AT_ONCE)?SPI_MAX_PIXELS_AT_ONCE:len;
|
||||
uint16_t tlen = 0;
|
||||
|
||||
for (uint32_t t=0; t<blen; t++){
|
||||
temp[t] = color;
|
||||
}
|
||||
|
||||
while(len){
|
||||
tlen = (len>blen)?blen:len;
|
||||
writePixels(temp, tlen);
|
||||
len -= tlen;
|
||||
}
|
||||
#else
|
||||
uint8_t hi = color >> 8, lo = color;
|
||||
if(_sclk < 0){ //AVR Optimization
|
||||
for (uint32_t t=len; t; t--){
|
||||
HSPI_WRITE(hi);
|
||||
HSPI_WRITE(lo);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (uint32_t t=len; t; t--){
|
||||
spiWrite(hi);
|
||||
spiWrite(lo);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write a pixel (must have a transaction in progress)
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to draw with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::writePixel(int16_t x, int16_t y, uint16_t color) {
|
||||
if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
|
||||
setAddrWindow(x,y,1,1);
|
||||
writePixel(color);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write a filled rectangle (must have a transaction in progress)
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner y coordinate
|
||||
@param w Width in pixels
|
||||
@param h Height in pixels
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color){
|
||||
if((x >= _width) || (y >= _height)) return;
|
||||
int16_t x2 = x + w - 1, y2 = y + h - 1;
|
||||
if((x2 < 0) || (y2 < 0)) return;
|
||||
|
||||
// Clip left/top
|
||||
if(x < 0) {
|
||||
x = 0;
|
||||
w = x2 + 1;
|
||||
}
|
||||
if(y < 0) {
|
||||
y = 0;
|
||||
h = y2 + 1;
|
||||
}
|
||||
|
||||
// Clip right/bottom
|
||||
if(x2 >= _width) w = _width - x;
|
||||
if(y2 >= _height) h = _height - y;
|
||||
|
||||
int32_t len = (int32_t)w * h;
|
||||
setAddrWindow(x, y, w, h);
|
||||
writeColor(color, len);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write a perfectly vertical line (must have a transaction in progress)
|
||||
@param x Top-most x coordinate
|
||||
@param y Top-most y coordinate
|
||||
@param h Height in pixels
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void inline Adafruit_SPITFT::writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color){
|
||||
writeFillRect(x, y, 1, h, color);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write a perfectly horizontal line (must have a transaction in progress)
|
||||
@param x Left-most x coordinate
|
||||
@param y Left-most y coordinate
|
||||
@param w Width in pixels
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void inline Adafruit_SPITFT::writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color){
|
||||
writeFillRect(x, y, w, 1, color);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a pixel - sets up transaction
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to draw with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::drawPixel(int16_t x, int16_t y, uint16_t color){
|
||||
startWrite();
|
||||
writePixel(x, y, color);
|
||||
endWrite();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write a perfectly vertical line - sets up transaction
|
||||
@param x Top-most x coordinate
|
||||
@param y Top-most y coordinate
|
||||
@param h Height in pixels
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::drawFastVLine(int16_t x, int16_t y,
|
||||
int16_t h, uint16_t color) {
|
||||
startWrite();
|
||||
writeFastVLine(x, y, h, color);
|
||||
endWrite();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Write a perfectly horizontal line - sets up transaction
|
||||
@param x Left-most x coordinate
|
||||
@param y Left-most y coordinate
|
||||
@param w Width in pixels
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::drawFastHLine(int16_t x, int16_t y,
|
||||
int16_t w, uint16_t color) {
|
||||
startWrite();
|
||||
writeFastHLine(x, y, w, color);
|
||||
endWrite();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Fill a rectangle completely with one color.
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner y coordinate
|
||||
@param w Width in pixels
|
||||
@param h Height in pixels
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint16_t color) {
|
||||
startWrite();
|
||||
writeFillRect(x,y,w,h,color);
|
||||
endWrite();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Invert the display using built-in hardware command
|
||||
@param i True if you want to invert, false to make 'normal'
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::invertDisplay(boolean i) {
|
||||
startWrite();
|
||||
writeCommand(i ? invertOnCommand : invertOffCommand);
|
||||
endWrite();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a 16-bit image (RGB 5/6/5) at the specified (x,y) position.
|
||||
For 16-bit display devices; no color reduction performed.
|
||||
Adapted from https://github.com/PaulStoffregen/ILI9341_t3
|
||||
by Marc MERLIN. See examples/pictureEmbed to use this.
|
||||
5/6/2017: function name and arguments have changed for compatibility
|
||||
with current GFX library and to avoid naming problems in prior
|
||||
implementation. Formerly drawBitmap() with arguments in different order.
|
||||
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner y coordinate
|
||||
@param pcolors 16-bit array with 16-bit color bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::drawRGBBitmap(int16_t x, int16_t y,
|
||||
uint16_t *pcolors, int16_t w, int16_t h) {
|
||||
|
||||
int16_t x2, y2; // Lower-right coord
|
||||
if(( x >= _width ) || // Off-edge right
|
||||
( y >= _height) || // " top
|
||||
((x2 = (x+w-1)) < 0 ) || // " left
|
||||
((y2 = (y+h-1)) < 0) ) return; // " bottom
|
||||
|
||||
int16_t bx1=0, by1=0, // Clipped top-left within bitmap
|
||||
saveW=w; // Save original bitmap width value
|
||||
if(x < 0) { // Clip left
|
||||
w += x;
|
||||
bx1 = -x;
|
||||
x = 0;
|
||||
}
|
||||
if(y < 0) { // Clip top
|
||||
h += y;
|
||||
by1 = -y;
|
||||
y = 0;
|
||||
}
|
||||
if(x2 >= _width ) w = _width - x; // Clip right
|
||||
if(y2 >= _height) h = _height - y; // Clip bottom
|
||||
|
||||
pcolors += by1 * saveW + bx1; // Offset bitmap ptr to clipped top-left
|
||||
startWrite();
|
||||
setAddrWindow(x, y, w, h); // Clipped area
|
||||
while(h--) { // For each (clipped) scanline...
|
||||
writePixels(pcolors, w); // Push one (clipped) row
|
||||
pcolors += saveW; // Advance pointer by one full (unclipped) line
|
||||
}
|
||||
endWrite();
|
||||
}
|
||||
|
||||
#endif // !__AVR_ATtiny85__
|
|
@ -1,125 +0,0 @@
|
|||
#ifndef _ADAFRUIT_SPITFT_
|
||||
#define _ADAFRUIT_SPITFT_
|
||||
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#include "Print.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
#include <SPI.h>
|
||||
#include "Adafruit_GFX.h"
|
||||
|
||||
#define USE_FAST_PINIO
|
||||
|
||||
#if defined(__AVR__)
|
||||
typedef volatile uint8_t RwReg;
|
||||
#elif defined(ARDUINO_STM32_FEATHER)
|
||||
typedef volatile uint32 RwReg;
|
||||
#undef USE_FAST_PINIO
|
||||
#elif defined(__OPENCR__) || defined (__OPENCM904__)
|
||||
#undef USE_FAST_PINIO
|
||||
#elif defined(ARDUINO_FEATHER52) || defined(__arm__)
|
||||
typedef volatile uint32_t RwReg;
|
||||
#elif defined(ESP32) || defined(ESP8266)
|
||||
typedef volatile uint32_t RwReg;
|
||||
#undef USE_FAST_PINIO
|
||||
#else
|
||||
#undef USE_FAST_PINIO
|
||||
#endif
|
||||
|
||||
#include "Adafruit_SPITFT_Macros.h"
|
||||
|
||||
/// A heavily optimized SPI display subclass of GFX. Manages SPI bitbanging, transactions, DMA, etc! Despite being called SPITFT, the classic SPI data/command interface is also used by OLEDs.
|
||||
class Adafruit_SPITFT : public Adafruit_GFX {
|
||||
protected:
|
||||
|
||||
public:
|
||||
Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1);
|
||||
Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _RST = -1);
|
||||
|
||||
virtual void begin(uint32_t freq) = 0; ///< Virtual begin() function to set SPI frequency, must be overridden in subclass. @param freq Maximum SPI hardware clock speed
|
||||
|
||||
void initSPI(uint32_t freq);
|
||||
|
||||
// Required Non-Transaction
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
|
||||
// Transaction API
|
||||
void startWrite(void);
|
||||
void endWrite(void);
|
||||
|
||||
void writePixel(int16_t x, int16_t y, uint16_t color);
|
||||
void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
|
||||
// Transaction API not used by GFX
|
||||
|
||||
/*!
|
||||
@brief SPI displays set an address window rectangle for blitting pixels
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner x coordinate
|
||||
@param w Width of window
|
||||
@param h Height of window
|
||||
*/
|
||||
virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0;
|
||||
|
||||
/*!
|
||||
@brief Write a 2-byte color (must have a transaction in progress)
|
||||
@param color 16-bit 5-6-5 Color to draw
|
||||
*/
|
||||
void inline writePixel(uint16_t color) { SPI_WRITE16(color); }
|
||||
void writePixels(uint16_t * colors, uint32_t len);
|
||||
void writeColor(uint16_t color, uint32_t len);
|
||||
void pushColor(uint16_t color);
|
||||
|
||||
// Recommended Non-Transaction
|
||||
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
|
||||
using Adafruit_GFX::drawRGBBitmap; // Check base class first
|
||||
void drawRGBBitmap(int16_t x, int16_t y,
|
||||
uint16_t *pcolors, int16_t w, int16_t h);
|
||||
void invertDisplay(boolean i);
|
||||
|
||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
protected:
|
||||
uint32_t _freq; ///< SPI clock frequency (for hardware SPI)
|
||||
#if defined (__AVR__) || defined(TEENSYDUINO) || defined (ESP8266) || defined (ESP32)
|
||||
int8_t _cs, _dc, _rst, _sclk, _mosi, _miso;
|
||||
#else
|
||||
int32_t _cs, ///< Arduino pin # for chip-select pin
|
||||
_dc, ///< Arduino pin # for data-command pin
|
||||
_rst, ///< Arduino pin # for reset pin
|
||||
_sclk, ///< Arduino pin # for SPI clock pin
|
||||
_mosi, ///< Arduino pin # for SPI MOSI pin
|
||||
_miso; ///< Arduino pin # for SPI MISO pin
|
||||
#endif
|
||||
|
||||
#ifdef USE_FAST_PINIO
|
||||
volatile RwReg *mosiport, ///< Direct chip register for toggling MOSI with fast bitbang IO
|
||||
*misoport, ///< Direct chip register for toggling MISO with fast bitbang IO
|
||||
*clkport, ///< Direct chip register for toggling CLK with fast bitbang IO
|
||||
*dcport, ///< Direct chip register for toggling DC with fast bitbang IO
|
||||
*csport; ///< Direct chip register for toggling CS with fast bitbang IO
|
||||
RwReg mosipinmask, ///< bitmask for turning on/off MOSI with fast register bitbang IO
|
||||
misopinmask, ///< bitmask for turning on/off MISO with fast register bitbang IO
|
||||
clkpinmask, ///< bitmask for turning on/off CLK with fast register bitbang IO
|
||||
cspinmask, ///< bitmask for turning on/off CS with fast register bitbang IO
|
||||
dcpinmask; ///< bitmask for turning on/off DC with fast register bitbang IO
|
||||
#endif
|
||||
|
||||
void writeCommand(uint8_t cmd);
|
||||
void spiWrite(uint8_t v);
|
||||
uint8_t spiRead(void);
|
||||
|
||||
uint8_t invertOnCommand = 0, ///< SPI command byte to turn on invert
|
||||
invertOffCommand = 0; ///< SPI command byte to turn off invert
|
||||
int16_t _xstart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the x offset from 0 to align
|
||||
int16_t _ystart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the y offset from 0 to align
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,118 +0,0 @@
|
|||
#ifndef _ADAFRUIT_SPITFT_MACROS
|
||||
#define _ADAFRUIT_SPITFT_MACROS
|
||||
|
||||
/*
|
||||
* Control Pins
|
||||
* */
|
||||
|
||||
#ifdef USE_FAST_PINIO
|
||||
#define SPI_DC_HIGH() *dcport |= dcpinmask
|
||||
#define SPI_DC_LOW() *dcport &= ~dcpinmask
|
||||
#define SPI_CS_HIGH() *csport |= cspinmask
|
||||
#define SPI_CS_LOW() *csport &= ~cspinmask
|
||||
#else
|
||||
#define SPI_DC_HIGH() digitalWrite(_dc, HIGH)
|
||||
#define SPI_DC_LOW() digitalWrite(_dc, LOW)
|
||||
#define SPI_CS_HIGH() { if(_cs >= 0) digitalWrite(_cs, HIGH); }
|
||||
#define SPI_CS_LOW() { if(_cs >= 0) digitalWrite(_cs, LOW); }
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Software SPI Macros
|
||||
* */
|
||||
|
||||
#ifdef USE_FAST_PINIO
|
||||
#define SSPI_MOSI_HIGH() *mosiport |= mosipinmask
|
||||
#define SSPI_MOSI_LOW() *mosiport &= ~mosipinmask
|
||||
#define SSPI_SCK_HIGH() *clkport |= clkpinmask
|
||||
#define SSPI_SCK_LOW() *clkport &= ~clkpinmask
|
||||
#define SSPI_MISO_READ() ((*misoport & misopinmask) != 0)
|
||||
#else
|
||||
#define SSPI_MOSI_HIGH() digitalWrite(_mosi, HIGH)
|
||||
#define SSPI_MOSI_LOW() digitalWrite(_mosi, LOW)
|
||||
#define SSPI_SCK_HIGH() digitalWrite(_sclk, HIGH)
|
||||
#define SSPI_SCK_LOW() digitalWrite(_sclk, LOW)
|
||||
#define SSPI_MISO_READ() digitalRead(_miso)
|
||||
#endif
|
||||
|
||||
#define SSPI_BEGIN_TRANSACTION()
|
||||
#define SSPI_END_TRANSACTION()
|
||||
#define SSPI_WRITE(v) spiWrite(v)
|
||||
#define SSPI_WRITE16(s) SSPI_WRITE((s) >> 8); SSPI_WRITE(s)
|
||||
#define SSPI_WRITE32(l) SSPI_WRITE((l) >> 24); SSPI_WRITE((l) >> 16); SSPI_WRITE((l) >> 8); SSPI_WRITE(l)
|
||||
#define SSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<(l); i+=2){ SSPI_WRITE(((uint8_t*)(c))[i+1]); SSPI_WRITE(((uint8_t*)(c))[i]); }
|
||||
|
||||
/*
|
||||
* Hardware SPI Macros
|
||||
* */
|
||||
|
||||
#define SPI_OBJECT SPI
|
||||
|
||||
#if defined (__AVR__) || defined(TEENSYDUINO) || defined(ARDUINO_ARCH_STM32F1)
|
||||
#define HSPI_SET_CLOCK() SPI_OBJECT.setClockDivider(SPI_CLOCK_DIV2);
|
||||
#elif defined (__arm__)
|
||||
#define HSPI_SET_CLOCK() SPI_OBJECT.setClockDivider(11);
|
||||
#elif defined(ESP8266) || defined(ESP32)
|
||||
#define HSPI_SET_CLOCK() SPI_OBJECT.setFrequency(_freq);
|
||||
#elif defined(RASPI)
|
||||
#define HSPI_SET_CLOCK() SPI_OBJECT.setClock(_freq);
|
||||
#elif defined(ARDUINO_ARCH_STM32F1)
|
||||
#define HSPI_SET_CLOCK() SPI_OBJECT.setClock(_freq);
|
||||
#else
|
||||
#define HSPI_SET_CLOCK()
|
||||
#endif
|
||||
|
||||
#ifdef SPI_HAS_TRANSACTION
|
||||
#define HSPI_BEGIN_TRANSACTION() SPI_OBJECT.beginTransaction(SPISettings(_freq, MSBFIRST, SPI_MODE0))
|
||||
#define HSPI_END_TRANSACTION() SPI_OBJECT.endTransaction()
|
||||
#else
|
||||
#define HSPI_BEGIN_TRANSACTION() HSPI_SET_CLOCK(); SPI_OBJECT.setBitOrder(MSBFIRST); SPI_OBJECT.setDataMode(SPI_MODE0)
|
||||
#define HSPI_END_TRANSACTION()
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
#define SPI_HAS_WRITE_PIXELS
|
||||
#endif
|
||||
#if defined(ESP8266) || defined(ESP32)
|
||||
// Optimized SPI (ESP8266 and ESP32)
|
||||
#define HSPI_READ() SPI_OBJECT.transfer(0)
|
||||
#define HSPI_WRITE(b) SPI_OBJECT.write(b)
|
||||
#define HSPI_WRITE16(s) SPI_OBJECT.write16(s)
|
||||
#define HSPI_WRITE32(l) SPI_OBJECT.write32(l)
|
||||
#ifdef SPI_HAS_WRITE_PIXELS
|
||||
#define SPI_MAX_PIXELS_AT_ONCE 32
|
||||
#define HSPI_WRITE_PIXELS(c,l) SPI_OBJECT.writePixels(c,l)
|
||||
#else
|
||||
#define HSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<((l)/2); i++){ SPI_WRITE16(((uint16_t*)(c))[i]); }
|
||||
#endif
|
||||
#else
|
||||
// Standard Byte-by-Byte SPI
|
||||
|
||||
#if defined (__AVR__) || defined(TEENSYDUINO)
|
||||
static inline uint8_t _avr_spi_read(void) __attribute__((always_inline));
|
||||
static inline uint8_t _avr_spi_read(void) {
|
||||
uint8_t r = 0;
|
||||
SPDR = r;
|
||||
while(!(SPSR & _BV(SPIF)));
|
||||
r = SPDR;
|
||||
return r;
|
||||
}
|
||||
#define HSPI_WRITE(b) {SPDR = (b); while(!(SPSR & _BV(SPIF)));}
|
||||
#define HSPI_READ() _avr_spi_read()
|
||||
#else
|
||||
#define HSPI_WRITE(b) SPI_OBJECT.transfer((uint8_t)(b))
|
||||
#define HSPI_READ() HSPI_WRITE(0)
|
||||
#endif
|
||||
#define HSPI_WRITE16(s) HSPI_WRITE((s) >> 8); HSPI_WRITE(s)
|
||||
#define HSPI_WRITE32(l) HSPI_WRITE((l) >> 24); HSPI_WRITE((l) >> 16); HSPI_WRITE((l) >> 8); HSPI_WRITE(l)
|
||||
#define HSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<(l); i+=2){ HSPI_WRITE(((uint8_t*)(c))[i+1]); HSPI_WRITE(((uint8_t*)(c))[i]); }
|
||||
#endif
|
||||
|
||||
#define SPI_BEGIN() if(_sclk < 0){SPI_OBJECT.begin();}
|
||||
#define SPI_BEGIN_TRANSACTION() if(_sclk < 0){HSPI_BEGIN_TRANSACTION();}
|
||||
#define SPI_END_TRANSACTION() if(_sclk < 0){HSPI_END_TRANSACTION();}
|
||||
#define SPI_WRITE16(s) if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);}
|
||||
#define SPI_WRITE32(l) if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);}
|
||||
#define SPI_WRITE_PIXELS(c,l) if(_sclk < 0){HSPI_WRITE_PIXELS(c,l);}else{SSPI_WRITE_PIXELS(c,l);}
|
||||
|
||||
#endif // _ADAFRUIT_SPITFT_MACROS
|
|
@ -9,7 +9,6 @@ git:
|
|||
quiet: true
|
||||
env:
|
||||
global:
|
||||
- ARDUINO_IDE_VERSION="1.8.5"
|
||||
- PRETTYNAME="Adafruit GFX Library"
|
||||
|
||||
before_install:
|
||||
|
@ -24,4 +23,4 @@ script:
|
|||
# Generate and deploy documentation
|
||||
after_success:
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh)
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh)
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh)
|
|
@ -62,6 +62,30 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define pgm_read_pointer(addr) ((void *)pgm_read_word(addr))
|
||||
#endif
|
||||
|
||||
inline GFXglyph * pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c)
|
||||
{
|
||||
#ifdef __AVR__
|
||||
return &(((GFXglyph *)pgm_read_pointer(&gfxFont->glyph))[c]);
|
||||
#else
|
||||
// expression in __AVR__ section may generate "dereferencing type-punned pointer will break strict-aliasing rules" warning
|
||||
// In fact, on other platforms (such as STM32) there is no need to do this pointer magic as program memory may be read in a usual way
|
||||
// So expression may be simplified
|
||||
return gfxFont->glyph + c;
|
||||
#endif //__AVR__
|
||||
}
|
||||
|
||||
inline uint8_t * pgm_read_bitmap_ptr(const GFXfont *gfxFont)
|
||||
{
|
||||
#ifdef __AVR__
|
||||
return (uint8_t *)pgm_read_pointer(&gfxFont->bitmap);
|
||||
#else
|
||||
// expression in __AVR__ section generates "dereferencing type-punned pointer will break strict-aliasing rules" warning
|
||||
// In fact, on other platforms (such as STM32) there is no need to do this pointer magic as program memory may be read in a usual way
|
||||
// So expression may be simplified
|
||||
return gfxFont->bitmap;
|
||||
#endif //__AVR__
|
||||
}
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
@ -84,7 +108,7 @@ WIDTH(w), HEIGHT(h)
|
|||
_height = HEIGHT;
|
||||
rotation = 0;
|
||||
cursor_y = cursor_x = 0;
|
||||
textsize = 1;
|
||||
textsize_x = textsize_y = 1;
|
||||
textcolor = textbgcolor = 0xFFFF;
|
||||
wrap = true;
|
||||
_cp437 = false;
|
||||
|
@ -103,6 +127,9 @@ WIDTH(w), HEIGHT(h)
|
|||
/**************************************************************************/
|
||||
void Adafruit_GFX::writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||
uint16_t color) {
|
||||
#if defined(ESP8266)
|
||||
yield();
|
||||
#endif
|
||||
int16_t steep = abs(y1 - y0) > abs(x1 - x0);
|
||||
if (steep) {
|
||||
_swap_int16_t(x0, y0);
|
||||
|
@ -317,6 +344,9 @@ void Adafruit_GFX::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
|||
/**************************************************************************/
|
||||
void Adafruit_GFX::drawCircle(int16_t x0, int16_t y0, int16_t r,
|
||||
uint16_t color) {
|
||||
#if defined(ESP8266)
|
||||
yield();
|
||||
#endif
|
||||
int16_t f = 1 - r;
|
||||
int16_t ddF_x = 1;
|
||||
int16_t ddF_y = -2 * r;
|
||||
|
@ -353,7 +383,7 @@ void Adafruit_GFX::drawCircle(int16_t x0, int16_t y0, int16_t r,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Quarter-circle drawer, used to do circles and roundrects
|
||||
@brief Quarter-circle drawer, used to do circles and roundrects
|
||||
@param x0 Center-point x coordinate
|
||||
@param y0 Center-point y coordinate
|
||||
@param r Radius of circle
|
||||
|
@ -417,25 +447,29 @@ void Adafruit_GFX::fillCircle(int16_t x0, int16_t y0, int16_t r,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Quarter-circle drawer with fill, used to do circles and roundrects
|
||||
@param x0 Center-point x coordinate
|
||||
@param y0 Center-point y coordinate
|
||||
@param r Radius of circle
|
||||
@param cornername Mask bit #1 or bit #2 to indicate which quarters of the circle we're doing
|
||||
@param delta Offset from center-point, used for round-rects
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
@brief Quarter-circle drawer with fill, used for circles and roundrects
|
||||
@param x0 Center-point x coordinate
|
||||
@param y0 Center-point y coordinate
|
||||
@param r Radius of circle
|
||||
@param corners Mask bits indicating which quarters we're doing
|
||||
@param delta Offset from center-point, used for round-rects
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::fillCircleHelper(int16_t x0, int16_t y0, int16_t r,
|
||||
uint8_t cornername, int16_t delta, uint16_t color) {
|
||||
uint8_t corners, int16_t delta, uint16_t color) {
|
||||
|
||||
int16_t f = 1 - r;
|
||||
int16_t ddF_x = 1;
|
||||
int16_t ddF_y = -2 * r;
|
||||
int16_t x = 0;
|
||||
int16_t y = r;
|
||||
int16_t px = x;
|
||||
int16_t py = y;
|
||||
|
||||
while (x<y) {
|
||||
delta++; // Avoid some +1's in the loop
|
||||
|
||||
while(x < y) {
|
||||
if (f >= 0) {
|
||||
y--;
|
||||
ddF_y += 2;
|
||||
|
@ -444,15 +478,18 @@ void Adafruit_GFX::fillCircleHelper(int16_t x0, int16_t y0, int16_t r,
|
|||
x++;
|
||||
ddF_x += 2;
|
||||
f += ddF_x;
|
||||
|
||||
if (cornername & 0x1) {
|
||||
writeFastVLine(x0+x, y0-y, 2*y+1+delta, color);
|
||||
writeFastVLine(x0+y, y0-x, 2*x+1+delta, color);
|
||||
// These checks avoid double-drawing certain lines, important
|
||||
// for the SSD1306 library which has an INVERT drawing mode.
|
||||
if(x < (y + 1)) {
|
||||
if(corners & 1) writeFastVLine(x0+x, y0-y, 2*y+delta, color);
|
||||
if(corners & 2) writeFastVLine(x0-x, y0-y, 2*y+delta, color);
|
||||
}
|
||||
if (cornername & 0x2) {
|
||||
writeFastVLine(x0-x, y0-y, 2*y+1+delta, color);
|
||||
writeFastVLine(x0-y, y0-x, 2*x+1+delta, color);
|
||||
if(y != py) {
|
||||
if(corners & 1) writeFastVLine(x0+py, y0-px, 2*px+delta, color);
|
||||
if(corners & 2) writeFastVLine(x0-py, y0-px, 2*px+delta, color);
|
||||
py = y;
|
||||
}
|
||||
px = x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,7 +525,9 @@ void Adafruit_GFX::drawRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
|||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::drawRoundRect(int16_t x, int16_t y, int16_t w,
|
||||
int16_t h, int16_t r, uint16_t color) {
|
||||
int16_t h, int16_t r, uint16_t color) {
|
||||
int16_t max_radius = ((w < h) ? w : h) / 2; // 1/2 minor axis
|
||||
if(r > max_radius) r = max_radius;
|
||||
// smarter version
|
||||
startWrite();
|
||||
writeFastHLine(x+r , y , w-2*r, color); // Top
|
||||
|
@ -515,11 +554,12 @@ void Adafruit_GFX::drawRoundRect(int16_t x, int16_t y, int16_t w,
|
|||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::fillRoundRect(int16_t x, int16_t y, int16_t w,
|
||||
int16_t h, int16_t r, uint16_t color) {
|
||||
int16_t h, int16_t r, uint16_t color) {
|
||||
int16_t max_radius = ((w < h) ? w : h) / 2; // 1/2 minor axis
|
||||
if(r > max_radius) r = max_radius;
|
||||
// smarter version
|
||||
startWrite();
|
||||
writeFillRect(x+r, y, w-2*r, h, color);
|
||||
|
||||
// draw four corners
|
||||
fillCircleHelper(x+w-r-1, y+r, r, 1, h-2*r-1, color);
|
||||
fillCircleHelper(x+r , y+r, r, 2, h-2*r-1, color);
|
||||
|
@ -620,8 +660,8 @@ void Adafruit_GFX::fillTriangle(int16_t x0, int16_t y0,
|
|||
|
||||
// For lower part of triangle, find scanline crossings for segments
|
||||
// 0-2 and 1-2. This loop is skipped if y1=y2.
|
||||
sa = dx12 * (y - y1);
|
||||
sb = dx02 * (y - y0);
|
||||
sa = (int32_t)dx12 * (y - y1);
|
||||
sb = (int32_t)dx02 * (y - y0);
|
||||
for(; y<=y2; y++) {
|
||||
a = x1 + sa / dy12;
|
||||
b = x0 + sb / dy02;
|
||||
|
@ -646,7 +686,7 @@ void Adafruit_GFX::fillTriangle(int16_t x0, int16_t y0,
|
|||
@param y Top left corner y coordinate
|
||||
@param bitmap byte array with monochrome bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Hieght of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
@param color 16-bit 5-6-5 Color to draw with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
@ -674,7 +714,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
|
|||
@param y Top left corner y coordinate
|
||||
@param bitmap byte array with monochrome bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Hieght of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
@param color 16-bit 5-6-5 Color to draw pixels with
|
||||
@param bg 16-bit 5-6-5 Color to draw background with
|
||||
*/
|
||||
|
@ -704,7 +744,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
|
|||
@param y Top left corner y coordinate
|
||||
@param bitmap byte array with monochrome bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Hieght of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
@param color 16-bit 5-6-5 Color to draw with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
@ -732,7 +772,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
|
|||
@param y Top left corner y coordinate
|
||||
@param bitmap byte array with monochrome bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Hieght of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
@param color 16-bit 5-6-5 Color to draw pixels with
|
||||
@param bg 16-bit 5-6-5 Color to draw background with
|
||||
*/
|
||||
|
@ -756,7 +796,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw PROGMEM-resident XBitMap Files (*.xbm), exported from GIMP.
|
||||
@brief Draw PROGMEM-resident XBitMap Files (*.xbm), exported from GIMP.
|
||||
Usage: Export from GIMP to *.xbm, rename *.xbm to *.c and open in editor.
|
||||
C Array can be directly used with this function.
|
||||
There is no RAM-resident version of this function; if generating bitmaps
|
||||
|
@ -765,7 +805,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
|
|||
@param y Top left corner y coordinate
|
||||
@param bitmap byte array with monochrome bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Hieght of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
@param color 16-bit 5-6-5 Color to draw pixels with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
@ -791,13 +831,13 @@ void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a PROGMEM-resident 8-bit image (grayscale) at the specified (x,y) pos.
|
||||
@brief Draw a PROGMEM-resident 8-bit image (grayscale) at the specified (x,y) pos.
|
||||
Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner y coordinate
|
||||
@param bitmap byte array with grayscale bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Hieght of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
|
||||
|
@ -813,13 +853,13 @@ void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a RAM-resident 8-bit image (grayscale) at the specified (x,y) pos.
|
||||
@brief Draw a RAM-resident 8-bit image (grayscale) at the specified (x,y) pos.
|
||||
Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner y coordinate
|
||||
@param bitmap byte array with grayscale bitmap
|
||||
@param w Width of bitmap in pixels
|
||||
@param h Hieght of bitmap in pixels
|
||||
@param h Height of bitmap in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
|
||||
|
@ -900,7 +940,7 @@ void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position.
|
||||
@brief Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position.
|
||||
For 16-bit display devices; no color reduction performed.
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner y coordinate
|
||||
|
@ -922,7 +962,7 @@ void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y,
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a RAM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position.
|
||||
@brief Draw a RAM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position.
|
||||
For 16-bit display devices; no color reduction performed.
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner y coordinate
|
||||
|
@ -1016,13 +1056,31 @@ void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y,
|
|||
/**************************************************************************/
|
||||
void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
|
||||
uint16_t color, uint16_t bg, uint8_t size) {
|
||||
drawChar(x, y, c, color, bg, size, size);
|
||||
}
|
||||
|
||||
// Draw a character
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a single character
|
||||
@param x Bottom left corner x coordinate
|
||||
@param y Bottom left corner y coordinate
|
||||
@param c The 8-bit font-indexed character (likely ascii)
|
||||
@param color 16-bit 5-6-5 Color to draw chraracter with
|
||||
@param bg 16-bit 5-6-5 Color to fill background with (if same as color, no background)
|
||||
@param size_x Font magnification level in X-axis, 1 is 'original' size
|
||||
@param size_y Font magnification level in Y-axis, 1 is 'original' size
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
|
||||
uint16_t color, uint16_t bg, uint8_t size_x, uint8_t size_y) {
|
||||
|
||||
if(!gfxFont) { // 'Classic' built-in font
|
||||
|
||||
if((x >= _width) || // Clip right
|
||||
(y >= _height) || // Clip bottom
|
||||
((x + 6 * size - 1) < 0) || // Clip left
|
||||
((y + 8 * size - 1) < 0)) // Clip top
|
||||
((x + 6 * size_x - 1) < 0) || // Clip left
|
||||
((y + 8 * size_y - 1) < 0)) // Clip top
|
||||
return;
|
||||
|
||||
if(!_cp437 && (c >= 176)) c++; // Handle 'classic' charset behavior
|
||||
|
@ -1032,21 +1090,21 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
|
|||
uint8_t line = pgm_read_byte(&font[c * 5 + i]);
|
||||
for(int8_t j=0; j<8; j++, line >>= 1) {
|
||||
if(line & 1) {
|
||||
if(size == 1)
|
||||
if(size_x == 1 && size_y == 1)
|
||||
writePixel(x+i, y+j, color);
|
||||
else
|
||||
writeFillRect(x+i*size, y+j*size, size, size, color);
|
||||
writeFillRect(x+i*size_x, y+j*size_y, size_x, size_y, color);
|
||||
} else if(bg != color) {
|
||||
if(size == 1)
|
||||
if(size_x == 1 && size_y == 1)
|
||||
writePixel(x+i, y+j, bg);
|
||||
else
|
||||
writeFillRect(x+i*size, y+j*size, size, size, bg);
|
||||
writeFillRect(x+i*size_x, y+j*size_y, size_x, size_y, bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(bg != color) { // If opaque, draw vertical line for last column
|
||||
if(size == 1) writeFastVLine(x+5, y, 8, bg);
|
||||
else writeFillRect(x+5*size, y, size, 8*size, bg);
|
||||
if(size_x == 1 && size_y == 1) writeFastVLine(x+5, y, 8, bg);
|
||||
else writeFillRect(x+5*size_x, y, size_x, 8*size_y, bg);
|
||||
}
|
||||
endWrite();
|
||||
|
||||
|
@ -1057,8 +1115,8 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
|
|||
// drawChar() directly with 'bad' characters of font may cause mayhem!
|
||||
|
||||
c -= (uint8_t)pgm_read_byte(&gfxFont->first);
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_pointer(&gfxFont->glyph))[c]);
|
||||
uint8_t *bitmap = (uint8_t *)pgm_read_pointer(&gfxFont->bitmap);
|
||||
GFXglyph *glyph = pgm_read_glyph_ptr(gfxFont, c);
|
||||
uint8_t *bitmap = pgm_read_bitmap_ptr(gfxFont);
|
||||
|
||||
uint16_t bo = pgm_read_word(&glyph->bitmapOffset);
|
||||
uint8_t w = pgm_read_byte(&glyph->width),
|
||||
|
@ -1068,7 +1126,7 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
|
|||
uint8_t xx, yy, bits = 0, bit = 0;
|
||||
int16_t xo16 = 0, yo16 = 0;
|
||||
|
||||
if(size > 1) {
|
||||
if(size_x > 1 || size_y > 1) {
|
||||
xo16 = xo;
|
||||
yo16 = yo;
|
||||
}
|
||||
|
@ -1098,11 +1156,11 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
|
|||
bits = pgm_read_byte(&bitmap[bo++]);
|
||||
}
|
||||
if(bits & 0x80) {
|
||||
if(size == 1) {
|
||||
if(size_x == 1 && size_y == 1) {
|
||||
writePixel(x+xo+xx, y+yo+yy, color);
|
||||
} else {
|
||||
writeFillRect(x+(xo16+xx)*size, y+(yo16+yy)*size,
|
||||
size, size, color);
|
||||
writeFillRect(x+(xo16+xx)*size_x, y+(yo16+yy)*size_y,
|
||||
size_x, size_y, color);
|
||||
}
|
||||
}
|
||||
bits <<= 1;
|
||||
|
@ -1123,39 +1181,38 @@ size_t Adafruit_GFX::write(uint8_t c) {
|
|||
|
||||
if(c == '\n') { // Newline?
|
||||
cursor_x = 0; // Reset x to zero,
|
||||
cursor_y += textsize * 8; // advance y one line
|
||||
cursor_y += textsize_y * 8; // advance y one line
|
||||
} else if(c != '\r') { // Ignore carriage returns
|
||||
if(wrap && ((cursor_x + textsize * 6) > _width)) { // Off right?
|
||||
if(wrap && ((cursor_x + textsize_x * 6) > _width)) { // Off right?
|
||||
cursor_x = 0; // Reset x to zero,
|
||||
cursor_y += textsize * 8; // advance y one line
|
||||
cursor_y += textsize_y * 8; // advance y one line
|
||||
}
|
||||
drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize);
|
||||
cursor_x += textsize * 6; // Advance x one char
|
||||
drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize_x, textsize_y);
|
||||
cursor_x += textsize_x * 6; // Advance x one char
|
||||
}
|
||||
|
||||
} else { // Custom font
|
||||
|
||||
if(c == '\n') {
|
||||
cursor_x = 0;
|
||||
cursor_y += (int16_t)textsize *
|
||||
cursor_y += (int16_t)textsize_y *
|
||||
(uint8_t)pgm_read_byte(&gfxFont->yAdvance);
|
||||
} else if(c != '\r') {
|
||||
uint8_t first = pgm_read_byte(&gfxFont->first);
|
||||
if((c >= first) && (c <= (uint8_t)pgm_read_byte(&gfxFont->last))) {
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_pointer(
|
||||
&gfxFont->glyph))[c - first]);
|
||||
GFXglyph *glyph = pgm_read_glyph_ptr(gfxFont, c - first);
|
||||
uint8_t w = pgm_read_byte(&glyph->width),
|
||||
h = pgm_read_byte(&glyph->height);
|
||||
if((w > 0) && (h > 0)) { // Is there an associated bitmap?
|
||||
int16_t xo = (int8_t)pgm_read_byte(&glyph->xOffset); // sic
|
||||
if(wrap && ((cursor_x + textsize * (xo + w)) > _width)) {
|
||||
if(wrap && ((cursor_x + textsize_x * (xo + w)) > _width)) {
|
||||
cursor_x = 0;
|
||||
cursor_y += (int16_t)textsize *
|
||||
cursor_y += (int16_t)textsize_y *
|
||||
(uint8_t)pgm_read_byte(&gfxFont->yAdvance);
|
||||
}
|
||||
drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize);
|
||||
drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize_x, textsize_y);
|
||||
}
|
||||
cursor_x += (uint8_t)pgm_read_byte(&glyph->xAdvance) * (int16_t)textsize;
|
||||
cursor_x += (uint8_t)pgm_read_byte(&glyph->xAdvance) * (int16_t)textsize_x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1163,37 +1220,6 @@ size_t Adafruit_GFX::write(uint8_t c) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Set text cursor location
|
||||
@param x X coordinate in pixels
|
||||
@param y Y coordinate in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::setCursor(int16_t x, int16_t y) {
|
||||
cursor_x = x;
|
||||
cursor_y = y;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get text cursor X location
|
||||
@returns X coordinate in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
int16_t Adafruit_GFX::getCursorX(void) const {
|
||||
return cursor_x;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get text cursor Y location
|
||||
@returns Y coordinate in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
int16_t Adafruit_GFX::getCursorY(void) const {
|
||||
return cursor_y;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
@ -1202,51 +1228,19 @@ int16_t Adafruit_GFX::getCursorY(void) const {
|
|||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::setTextSize(uint8_t s) {
|
||||
textsize = (s > 0) ? s : 1;
|
||||
setTextSize(s, s);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Set text font color with transparant background
|
||||
@param c 16-bit 5-6-5 Color to draw text with
|
||||
@brief Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger.
|
||||
@param s_x Desired text width magnification level in X-axis. 1 is default
|
||||
@param s_y Desired text width magnification level in Y-axis. 1 is default
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::setTextColor(uint16_t c) {
|
||||
// For 'transparent' background, we'll set the bg
|
||||
// to the same as fg instead of using a flag
|
||||
textcolor = textbgcolor = c;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Set text font color with custom background color
|
||||
@param c 16-bit 5-6-5 Color to draw text with
|
||||
@param b 16-bit 5-6-5 Color to draw background/fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::setTextColor(uint16_t c, uint16_t b) {
|
||||
textcolor = c;
|
||||
textbgcolor = b;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Whether text that is too long should 'wrap' around to the next line.
|
||||
@param w Set true for wrapping, false for clipping
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::setTextWrap(boolean w) {
|
||||
wrap = w;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get rotation setting for display
|
||||
@returns 0 thru 3 corresponding to 4 cardinal rotations
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint8_t Adafruit_GFX::getRotation(void) const {
|
||||
return rotation;
|
||||
void Adafruit_GFX::setTextSize(uint8_t s_x, uint8_t s_y) {
|
||||
textsize_x = (s_x > 0) ? s_x : 1;
|
||||
textsize_y = (s_y > 0) ? s_y : 1;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -1271,22 +1265,6 @@ void Adafruit_GFX::setRotation(uint8_t x) {
|
|||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Enable (or disable) Code Page 437-compatible charset.
|
||||
There was an error in glcdfont.c for the longest time -- one character
|
||||
(#176, the 'light shade' block) was missing -- this threw off the index
|
||||
of every character that followed it. But a TON of code has been written
|
||||
with the erroneous character indices. By default, the library uses the
|
||||
original 'wrong' behavior and old sketches will still work. Pass 'true'
|
||||
to this function to use correct CP437 character values in your code.
|
||||
@param x Whether to enable (True) or not (False)
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX::cp437(boolean x) {
|
||||
_cp437 = x;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Set the font to display when print()ing, either custom or default
|
||||
|
@ -1329,32 +1307,32 @@ void Adafruit_GFX::charBounds(char c, int16_t *x, int16_t *y,
|
|||
|
||||
if(c == '\n') { // Newline?
|
||||
*x = 0; // Reset x to zero, advance y by one line
|
||||
*y += textsize * (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
|
||||
*y += textsize_y * (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
|
||||
} else if(c != '\r') { // Not a carriage return; is normal char
|
||||
uint8_t first = pgm_read_byte(&gfxFont->first),
|
||||
last = pgm_read_byte(&gfxFont->last);
|
||||
if((c >= first) && (c <= last)) { // Char present in this font?
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_pointer(
|
||||
&gfxFont->glyph))[c - first]);
|
||||
GFXglyph *glyph = pgm_read_glyph_ptr(gfxFont, c - first);
|
||||
uint8_t gw = pgm_read_byte(&glyph->width),
|
||||
gh = pgm_read_byte(&glyph->height),
|
||||
xa = pgm_read_byte(&glyph->xAdvance);
|
||||
int8_t xo = pgm_read_byte(&glyph->xOffset),
|
||||
yo = pgm_read_byte(&glyph->yOffset);
|
||||
if(wrap && ((*x+(((int16_t)xo+gw)*textsize)) > _width)) {
|
||||
if(wrap && ((*x+(((int16_t)xo+gw)*textsize_x)) > _width)) {
|
||||
*x = 0; // Reset x to zero, advance y by one line
|
||||
*y += textsize * (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
|
||||
*y += textsize_y * (uint8_t)pgm_read_byte(&gfxFont->yAdvance);
|
||||
}
|
||||
int16_t ts = (int16_t)textsize,
|
||||
x1 = *x + xo * ts,
|
||||
y1 = *y + yo * ts,
|
||||
x2 = x1 + gw * ts - 1,
|
||||
y2 = y1 + gh * ts - 1;
|
||||
int16_t tsx = (int16_t)textsize_x,
|
||||
tsy = (int16_t)textsize_y,
|
||||
x1 = *x + xo * tsx,
|
||||
y1 = *y + yo * tsy,
|
||||
x2 = x1 + gw * tsx - 1,
|
||||
y2 = y1 + gh * tsy - 1;
|
||||
if(x1 < *minx) *minx = x1;
|
||||
if(y1 < *miny) *miny = y1;
|
||||
if(x2 > *maxx) *maxx = x2;
|
||||
if(y2 > *maxy) *maxy = y2;
|
||||
*x += xa * ts;
|
||||
*x += xa * tsx;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1362,20 +1340,20 @@ void Adafruit_GFX::charBounds(char c, int16_t *x, int16_t *y,
|
|||
|
||||
if(c == '\n') { // Newline?
|
||||
*x = 0; // Reset x to zero,
|
||||
*y += textsize * 8; // advance y one line
|
||||
*y += textsize_y * 8; // advance y one line
|
||||
// min/max x/y unchaged -- that waits for next 'normal' character
|
||||
} else if(c != '\r') { // Normal char; ignore carriage returns
|
||||
if(wrap && ((*x + textsize * 6) > _width)) { // Off right?
|
||||
if(wrap && ((*x + textsize_x * 6) > _width)) { // Off right?
|
||||
*x = 0; // Reset x to zero,
|
||||
*y += textsize * 8; // advance y one line
|
||||
*y += textsize_y * 8; // advance y one line
|
||||
}
|
||||
int x2 = *x + textsize * 6 - 1, // Lower-right pixel of char
|
||||
y2 = *y + textsize * 8 - 1;
|
||||
int x2 = *x + textsize_x * 6 - 1, // Lower-right pixel of char
|
||||
y2 = *y + textsize_y * 8 - 1;
|
||||
if(x2 > *maxx) *maxx = x2; // Track max x, y
|
||||
if(y2 > *maxy) *maxy = y2;
|
||||
if(*x < *minx) *minx = *x; // Track min x, y
|
||||
if(*y < *miny) *miny = *y;
|
||||
*x += textsize * 6; // Advance x one char
|
||||
*x += textsize_x * 6; // Advance x one char
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1470,26 +1448,6 @@ void Adafruit_GFX::getTextBounds(const __FlashStringHelper *str,
|
|||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get width of the display, accounting for the current rotation
|
||||
@returns Width in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
int16_t Adafruit_GFX::width(void) const {
|
||||
return _width;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get height of the display, accounting for the current rotation
|
||||
@returns Height in pixels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
int16_t Adafruit_GFX::height(void) const {
|
||||
return _height;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Invert the display (ideally using built-in hardware command)
|
||||
|
@ -1537,6 +1495,33 @@ void Adafruit_GFX_Button::initButton(
|
|||
textcolor, label, textsize);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Initialize button with our desired color/size/settings
|
||||
@param gfx Pointer to our display so we can draw to it!
|
||||
@param x The X coordinate of the center of the button
|
||||
@param y The Y coordinate of the center of the button
|
||||
@param w Width of the buttton
|
||||
@param h Height of the buttton
|
||||
@param outline Color of the outline (16-bit 5-6-5 standard)
|
||||
@param fill Color of the button fill (16-bit 5-6-5 standard)
|
||||
@param textcolor Color of the button label (16-bit 5-6-5 standard)
|
||||
@param label Ascii string of the text inside the button
|
||||
@param textsize_x The font magnification in X-axis of the label text
|
||||
@param textsize_y The font magnification in Y-axis of the label text
|
||||
*/
|
||||
/**************************************************************************/
|
||||
// Classic initButton() function: pass center & size
|
||||
void Adafruit_GFX_Button::initButton(
|
||||
Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w, uint16_t h,
|
||||
uint16_t outline, uint16_t fill, uint16_t textcolor,
|
||||
char *label, uint8_t textsize_x, uint8_t textsize_y)
|
||||
{
|
||||
// Tweak arguments and pass to the newer initButtonUL() function...
|
||||
initButtonUL(gfx, x - (w / 2), y - (h / 2), w, h, outline, fill,
|
||||
textcolor, label, textsize_x, textsize_y);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Initialize button with our desired color/size/settings, with upper-left coordinates
|
||||
|
@ -1556,6 +1541,30 @@ void Adafruit_GFX_Button::initButtonUL(
|
|||
Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w, uint16_t h,
|
||||
uint16_t outline, uint16_t fill, uint16_t textcolor,
|
||||
char *label, uint8_t textsize)
|
||||
{
|
||||
initButtonUL(gfx, x1, y1, w, h, outline, fill, textcolor, label, textsize, textsize);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Initialize button with our desired color/size/settings, with upper-left coordinates
|
||||
@param gfx Pointer to our display so we can draw to it!
|
||||
@param x1 The X coordinate of the Upper-Left corner of the button
|
||||
@param y1 The Y coordinate of the Upper-Left corner of the button
|
||||
@param w Width of the buttton
|
||||
@param h Height of the buttton
|
||||
@param outline Color of the outline (16-bit 5-6-5 standard)
|
||||
@param fill Color of the button fill (16-bit 5-6-5 standard)
|
||||
@param textcolor Color of the button label (16-bit 5-6-5 standard)
|
||||
@param label Ascii string of the text inside the button
|
||||
@param textsize_x The font magnification in X-axis of the label text
|
||||
@param textsize_y The font magnification in Y-axis of the label text
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX_Button::initButtonUL(
|
||||
Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w, uint16_t h,
|
||||
uint16_t outline, uint16_t fill, uint16_t textcolor,
|
||||
char *label, uint8_t textsize_x, uint8_t textsize_y)
|
||||
{
|
||||
_x1 = x1;
|
||||
_y1 = y1;
|
||||
|
@ -1564,7 +1573,8 @@ void Adafruit_GFX_Button::initButtonUL(
|
|||
_outlinecolor = outline;
|
||||
_fillcolor = fill;
|
||||
_textcolor = textcolor;
|
||||
_textsize = textsize;
|
||||
_textsize_x = textsize_x;
|
||||
_textsize_y = textsize_y;
|
||||
_gfx = gfx;
|
||||
strncpy(_label, label, 9);
|
||||
}
|
||||
|
@ -1592,19 +1602,20 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) {
|
|||
_gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
|
||||
_gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);
|
||||
|
||||
_gfx->setCursor(_x1 + (_w/2) - (strlen(_label) * 3 * _textsize),
|
||||
_y1 + (_h/2) - (4 * _textsize));
|
||||
_gfx->setCursor(_x1 + (_w/2) - (strlen(_label) * 3 * _textsize_x),
|
||||
_y1 + (_h/2) - (4 * _textsize_y));
|
||||
_gfx->setTextColor(text);
|
||||
_gfx->setTextSize(_textsize);
|
||||
_gfx->setTextSize(_textsize_x, _textsize_y);
|
||||
_gfx->print(_label);
|
||||
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Helper to let us know if a coordinate is within the bounds of the button
|
||||
@brief Helper to let us know if a coordinate is within the bounds of the button
|
||||
@param x The X coordinate to check
|
||||
@param y The Y coordinate to check
|
||||
@returns True if within button graphics outline
|
||||
@returns True if within button graphics outline
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean Adafruit_GFX_Button::contains(int16_t x, int16_t y) {
|
||||
|
@ -1612,25 +1623,6 @@ boolean Adafruit_GFX_Button::contains(int16_t x, int16_t y) {
|
|||
(y >= _y1) && (y < (int16_t) (_y1 + _h)));
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Sets the state of the button, should be done by some touch function
|
||||
@param p True for pressed, false for not.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_GFX_Button::press(boolean p) {
|
||||
laststate = currstate;
|
||||
currstate = p;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Query whether the button is currently pressed
|
||||
@returns True if pressed
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean Adafruit_GFX_Button::isPressed() { return currstate; }
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Query whether the button was pressed since we last checked state
|
||||
|
@ -1691,20 +1683,10 @@ GFXcanvas1::~GFXcanvas1(void) {
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get a pointer to the internal buffer memory
|
||||
@returns A pointer to the allocated buffer
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint8_t* GFXcanvas1::getBuffer(void) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a pixel to the canvas framebuffer
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
@brief Draw a pixel to the canvas framebuffer
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||
|
@ -1749,8 +1731,8 @@ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Fill the framebuffer completely with one color
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
@brief Fill the framebuffer completely with one color
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void GFXcanvas1::fillScreen(uint16_t color) {
|
||||
|
@ -1783,23 +1765,12 @@ GFXcanvas8::~GFXcanvas8(void) {
|
|||
if(buffer) free(buffer);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get a pointer to the internal buffer memory
|
||||
@returns A pointer to the allocated buffer
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint8_t* GFXcanvas8::getBuffer(void) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a pixel to the canvas framebuffer
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
@brief Draw a pixel to the canvas framebuffer
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||
|
@ -1830,8 +1801,8 @@ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Fill the framebuffer completely with one color
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
@brief Fill the framebuffer completely with one color
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void GFXcanvas8::fillScreen(uint16_t color) {
|
||||
|
@ -1900,20 +1871,10 @@ GFXcanvas16::~GFXcanvas16(void) {
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Get a pointer to the internal buffer memory
|
||||
@returns A pointer to the allocated buffer
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint16_t* GFXcanvas16::getBuffer(void) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Draw a pixel to the canvas framebuffer
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
@brief Draw a pixel to the canvas framebuffer
|
||||
@param x x coordinate
|
||||
@param y y coordinate
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||
|
@ -1944,8 +1905,8 @@ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
|||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Fill the framebuffer completely with one color
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
@brief Fill the framebuffer completely with one color
|
||||
@param color 16-bit 5-6-5 Color to fill with
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void GFXcanvas16::fillScreen(uint16_t color) {
|
||||
|
@ -1960,3 +1921,22 @@ void GFXcanvas16::fillScreen(uint16_t color) {
|
|||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Reverses the "endian-ness" of each 16-bit pixel within the
|
||||
canvas; little-endian to big-endian, or big-endian to little.
|
||||
Most microcontrollers (such as SAMD) are little-endian, while
|
||||
most displays tend toward big-endianness. All the drawing
|
||||
functions (including RGB bitmap drawing) take care of this
|
||||
automatically, but some specialized code (usually involving
|
||||
DMA) can benefit from having pixel data already in the
|
||||
display-native order. Note that this does NOT convert to a
|
||||
SPECIFIC endian-ness, it just flips the bytes within each word.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void GFXcanvas16::byteSwap(void) {
|
||||
if(buffer) {
|
||||
uint32_t i, pixels = WIDTH * HEIGHT;
|
||||
for(i=0; i<pixels; i++) buffer[i] = __builtin_bswap16(buffer[i]);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ class Adafruit_GFX : public Print {
|
|||
Adafruit_GFX(int16_t w, int16_t h); // Constructor
|
||||
|
||||
// This MUST be defined by the subclass:
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; ///< Virtual drawPixel() function to draw to the screen/framebuffer/etc, must be overridden in subclass. @param x X coordinate. @param y Y coordinate. @param color 16-bit pixel color.
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; ///< Virtual drawPixel() function to draw to the screen/framebuffer/etc, must be overridden in subclass. @param x X coordinate. @param y Y coordinate. @param color 16-bit pixel color.
|
||||
|
||||
// TRANSACTION API / CORE DRAW API
|
||||
// These MAY be overridden by the subclass to provide device-specific
|
||||
|
@ -51,20 +51,10 @@ class Adafruit_GFX : public Print {
|
|||
|
||||
// These exist only with Adafruit_GFX (no subclass overrides)
|
||||
void
|
||||
drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||
drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
|
||||
uint16_t color),
|
||||
fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||
fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
|
||||
int16_t delta, uint16_t color),
|
||||
drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||
int16_t x2, int16_t y2, uint16_t color),
|
||||
fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||
int16_t x2, int16_t y2, uint16_t color),
|
||||
drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||
int16_t radius, uint16_t color),
|
||||
fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||
int16_t radius, uint16_t color),
|
||||
drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
|
||||
int16_t w, int16_t h, uint16_t color),
|
||||
drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
|
||||
|
@ -95,41 +85,143 @@ class Adafruit_GFX : public Print {
|
|||
uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h),
|
||||
drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
|
||||
uint16_t bg, uint8_t size),
|
||||
setCursor(int16_t x, int16_t y),
|
||||
setTextColor(uint16_t c),
|
||||
setTextColor(uint16_t c, uint16_t bg),
|
||||
setTextSize(uint8_t s),
|
||||
setTextWrap(boolean w),
|
||||
cp437(boolean x=true),
|
||||
setFont(const GFXfont *f = NULL),
|
||||
drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
|
||||
uint16_t bg, uint8_t size_x, uint8_t size_y),
|
||||
getTextBounds(const char *string, int16_t x, int16_t y,
|
||||
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h),
|
||||
getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
|
||||
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h),
|
||||
getTextBounds(const String &str, int16_t x, int16_t y,
|
||||
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
|
||||
int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h),
|
||||
setFont(const GFXfont *f = NULL);
|
||||
|
||||
virtual void
|
||||
drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||
fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
|
||||
drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||
int16_t radius, uint16_t color),
|
||||
fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
|
||||
int16_t radius, uint16_t color),
|
||||
drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||
int16_t x2, int16_t y2, uint16_t color),
|
||||
fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
||||
int16_t x2, int16_t y2, uint16_t color),
|
||||
setTextSize(uint8_t s),
|
||||
setTextSize(uint8_t sx, uint8_t sy);
|
||||
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Set text cursor location
|
||||
@param x X coordinate in pixels
|
||||
@param y Y coordinate in pixels
|
||||
*/
|
||||
/**********************************************************************/
|
||||
virtual void setCursor(int16_t x, int16_t y) { cursor_x = x; cursor_y = y; }
|
||||
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Set text font color with transparant background
|
||||
@param c 16-bit 5-6-5 Color to draw text with
|
||||
@note For 'transparent' background, background and foreground
|
||||
are set to same color rather than using a separate flag.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
void setTextColor(uint16_t c) { textcolor = textbgcolor = c; }
|
||||
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Set text font color with custom background color
|
||||
@param c 16-bit 5-6-5 Color to draw text with
|
||||
@param bg 16-bit 5-6-5 Color to draw background/fill with
|
||||
*/
|
||||
/**********************************************************************/
|
||||
void setTextColor(uint16_t c, uint16_t bg) {
|
||||
textcolor = c;
|
||||
textbgcolor = bg;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Set whether text that is too long for the screen width should
|
||||
automatically wrap around to the next line (else clip right).
|
||||
@param w true for wrapping, false for clipping
|
||||
*/
|
||||
/**********************************************************************/
|
||||
void setTextWrap(boolean w) { wrap = w; }
|
||||
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Enable (or disable) Code Page 437-compatible charset.
|
||||
There was an error in glcdfont.c for the longest time -- one
|
||||
character (#176, the 'light shade' block) was missing -- this
|
||||
threw off the index of every character that followed it.
|
||||
But a TON of code has been written with the erroneous
|
||||
character indices. By default, the library uses the original
|
||||
'wrong' behavior and old sketches will still work. Pass
|
||||
'true' to this function to use correct CP437 character values
|
||||
in your code.
|
||||
@param x true = enable (new behavior), false = disable (old behavior)
|
||||
*/
|
||||
/**********************************************************************/
|
||||
void cp437(boolean x=true) { _cp437 = x; }
|
||||
|
||||
#if ARDUINO >= 100
|
||||
virtual size_t write(uint8_t);
|
||||
#else
|
||||
virtual void write(uint8_t);
|
||||
#endif
|
||||
size_t iwrite(uint8_t);
|
||||
/************************************************************************/
|
||||
/*!
|
||||
@brief Get width of the display, accounting for current rotation
|
||||
@returns Width in pixels
|
||||
*/
|
||||
/************************************************************************/
|
||||
int16_t width(void) const { return _width; };
|
||||
|
||||
int16_t height(void) const;
|
||||
int16_t width(void) const;
|
||||
/************************************************************************/
|
||||
/*!
|
||||
@brief Get height of the display, accounting for current rotation
|
||||
@returns Height in pixels
|
||||
*/
|
||||
/************************************************************************/
|
||||
int16_t height(void) const { return _height; }
|
||||
|
||||
uint8_t getRotation(void) const;
|
||||
/************************************************************************/
|
||||
/*!
|
||||
@brief Get rotation setting for display
|
||||
@returns 0 thru 3 corresponding to 4 cardinal rotations
|
||||
*/
|
||||
/************************************************************************/
|
||||
uint8_t getRotation(void) const { return rotation; }
|
||||
|
||||
// get current cursor position (get rotation safe maximum values, using: width() for x, height() for y)
|
||||
int16_t getCursorX(void) const;
|
||||
int16_t getCursorY(void) const;
|
||||
// get current cursor position (get rotation safe maximum values,
|
||||
// using: width() for x, height() for y)
|
||||
/************************************************************************/
|
||||
/*!
|
||||
@brief Get text cursor X location
|
||||
@returns X coordinate in pixels
|
||||
*/
|
||||
/************************************************************************/
|
||||
int16_t getCursorX(void) const { return cursor_x; }
|
||||
|
||||
/************************************************************************/
|
||||
/*!
|
||||
@brief Get text cursor Y location
|
||||
@returns Y coordinate in pixels
|
||||
*/
|
||||
/************************************************************************/
|
||||
int16_t getCursorY(void) const { return cursor_y; };
|
||||
|
||||
uint16_t
|
||||
textcolor, ///< 16-bit background color for print()
|
||||
textbgcolor; ///< 16-bit text color for print()
|
||||
|
||||
protected:
|
||||
void
|
||||
charBounds(char c, int16_t *x, int16_t *y,
|
||||
int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy);
|
||||
const int16_t
|
||||
int16_t
|
||||
WIDTH, ///< This is the 'raw' display width - never changes
|
||||
HEIGHT; ///< This is the 'raw' display height - never changes
|
||||
int16_t
|
||||
|
@ -137,11 +229,12 @@ class Adafruit_GFX : public Print {
|
|||
_height, ///< Display height as modified by current rotation
|
||||
cursor_x, ///< x location to start print()ing text
|
||||
cursor_y; ///< y location to start print()ing text
|
||||
uint16_t
|
||||
textcolor, ///< 16-bit background color for print()
|
||||
textbgcolor; ///< 16-bit text color for print()
|
||||
//uint16_t
|
||||
// textcolor, ///< 16-bit background color for print()
|
||||
// textbgcolor; ///< 16-bit text color for print()
|
||||
uint8_t
|
||||
textsize, ///< Desired magnification of text to print()
|
||||
textsize_x, ///< Desired magnification in X-axis of text to print()
|
||||
textsize_y, ///< Desired magnification in Y-axis of text to print()
|
||||
rotation; ///< Display rotation (0 thru 3)
|
||||
boolean
|
||||
wrap, ///< If set, 'wrap' text at right edge of display
|
||||
|
@ -160,23 +253,44 @@ class Adafruit_GFX_Button {
|
|||
void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y,
|
||||
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
|
||||
uint16_t textcolor, char *label, uint8_t textsize);
|
||||
void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y,
|
||||
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
|
||||
uint16_t textcolor, char *label, uint8_t textsize_x, uint8_t textsize_y);
|
||||
// New/alt initButton() uses upper-left corner & size
|
||||
void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1,
|
||||
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
|
||||
uint16_t textcolor, char *label, uint8_t textsize);
|
||||
void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1,
|
||||
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
|
||||
uint16_t textcolor, char *label, uint8_t textsize_x, uint8_t textsize_y);
|
||||
void drawButton(boolean inverted = false);
|
||||
boolean contains(int16_t x, int16_t y);
|
||||
|
||||
void press(boolean p);
|
||||
boolean isPressed();
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Sets button state, should be done by some touch function
|
||||
@param p True for pressed, false for not.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
void press(boolean p) { laststate = currstate; currstate = p; }
|
||||
|
||||
boolean justPressed();
|
||||
boolean justReleased();
|
||||
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Query whether the button is currently pressed
|
||||
@returns True if pressed
|
||||
*/
|
||||
/**********************************************************************/
|
||||
boolean isPressed(void) { return currstate; };
|
||||
|
||||
private:
|
||||
Adafruit_GFX *_gfx;
|
||||
int16_t _x1, _y1; // Coordinates of top-left corner
|
||||
uint16_t _w, _h;
|
||||
uint8_t _textsize;
|
||||
uint8_t _textsize_x;
|
||||
uint8_t _textsize_y;
|
||||
uint16_t _outlinecolor, _fillcolor, _textcolor;
|
||||
char _label[10];
|
||||
|
||||
|
@ -191,7 +305,13 @@ class GFXcanvas1 : public Adafruit_GFX {
|
|||
~GFXcanvas1(void);
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||
fillScreen(uint16_t color);
|
||||
uint8_t *getBuffer(void);
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Get a pointer to the internal buffer memory
|
||||
@returns A pointer to the allocated buffer
|
||||
*/
|
||||
/**********************************************************************/
|
||||
uint8_t *getBuffer(void) const { return buffer; }
|
||||
private:
|
||||
uint8_t *buffer;
|
||||
};
|
||||
|
@ -205,8 +325,13 @@ class GFXcanvas8 : public Adafruit_GFX {
|
|||
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||
fillScreen(uint16_t color),
|
||||
writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
|
||||
uint8_t *getBuffer(void);
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Get a pointer to the internal buffer memory
|
||||
@returns A pointer to the allocated buffer
|
||||
*/
|
||||
/**********************************************************************/
|
||||
uint8_t *getBuffer(void) const { return buffer; }
|
||||
private:
|
||||
uint8_t *buffer;
|
||||
};
|
||||
|
@ -218,8 +343,15 @@ class GFXcanvas16 : public Adafruit_GFX {
|
|||
GFXcanvas16(uint16_t w, uint16_t h);
|
||||
~GFXcanvas16(void);
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||
fillScreen(uint16_t color);
|
||||
uint16_t *getBuffer(void);
|
||||
fillScreen(uint16_t color),
|
||||
byteSwap(void);
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
@brief Get a pointer to the internal buffer memory
|
||||
@returns A pointer to the allocated buffer
|
||||
*/
|
||||
/**********************************************************************/
|
||||
uint16_t *getBuffer(void) const { return buffer; }
|
||||
private:
|
||||
uint16_t *buffer;
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,519 @@
|
|||
/*!
|
||||
* @file Adafruit_SPITFT.h
|
||||
*
|
||||
* Part of Adafruit's GFX graphics library. Originally this class was
|
||||
* written to handle a range of color TFT displays connected via SPI,
|
||||
* but over time this library and some display-specific subclasses have
|
||||
* mutated to include some color OLEDs as well as parallel-interfaced
|
||||
* displays. The name's been kept for the sake of older code.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Written by Limor "ladyada" Fried for Adafruit Industries,
|
||||
* with contributions from the open source community.
|
||||
*
|
||||
* BSD license, all text here must be included in any redistribution.
|
||||
*/
|
||||
|
||||
#ifndef _ADAFRUIT_SPITFT_H_
|
||||
#define _ADAFRUIT_SPITFT_H_
|
||||
|
||||
#if !defined(__AVR_ATtiny85__) // Not for ATtiny, at all
|
||||
|
||||
#include <SPI.h>
|
||||
#include "Adafruit_GFX.h"
|
||||
|
||||
// HARDWARE CONFIG ---------------------------------------------------------
|
||||
|
||||
#if defined(__AVR__)
|
||||
typedef uint8_t ADAGFX_PORT_t; ///< PORT values are 8-bit
|
||||
#define USE_FAST_PINIO ///< Use direct PORT register access
|
||||
#elif defined(ARDUINO_STM32_FEATHER) // WICED
|
||||
typedef class HardwareSPI SPIClass; ///< SPI is a bit odd on WICED
|
||||
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
|
||||
#elif defined(__arm__)
|
||||
#if defined(ARDUINO_ARCH_SAMD)
|
||||
// Adafruit M0, M4
|
||||
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
|
||||
#define USE_FAST_PINIO ///< Use direct PORT register access
|
||||
#define HAS_PORT_SET_CLR ///< PORTs have set & clear registers
|
||||
#elif defined(CORE_TEENSY)
|
||||
// PJRC Teensy 4.x
|
||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
|
||||
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
|
||||
// PJRC Teensy 3.x
|
||||
#else
|
||||
typedef uint8_t ADAGFX_PORT_t; ///< PORT values are 8-bit
|
||||
#endif
|
||||
#define USE_FAST_PINIO ///< Use direct PORT register access
|
||||
#define HAS_PORT_SET_CLR ///< PORTs have set & clear registers
|
||||
#else
|
||||
// Arduino Due?
|
||||
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
|
||||
// USE_FAST_PINIO not available here (yet)...Due has a totally different
|
||||
// GPIO register set and will require some changes elsewhere (e.g. in
|
||||
// constructors especially).
|
||||
#endif
|
||||
#else // !ARM
|
||||
// Probably ESP8266 or ESP32. USE_FAST_PINIO is not available here (yet)
|
||||
// but don't worry about it too much...the digitalWrite() implementation
|
||||
// on these platforms is reasonably efficient and already RAM-resident,
|
||||
// only gotcha then is no parallel connection support for now.
|
||||
typedef uint32_t ADAGFX_PORT_t; ///< PORT values are 32-bit
|
||||
#endif // end !ARM
|
||||
typedef volatile ADAGFX_PORT_t* PORTreg_t; ///< PORT register type
|
||||
|
||||
#if defined(__AVR__)
|
||||
#define DEFAULT_SPI_FREQ 8000000L ///< Hardware SPI default speed
|
||||
#else
|
||||
#define DEFAULT_SPI_FREQ 16000000L ///< Hardware SPI default speed
|
||||
#endif
|
||||
|
||||
#if defined(ADAFRUIT_PYPORTAL) || defined(ADAFRUIT_PYBADGE_M4_EXPRESS) || defined(ADAFRUIT_PYGAMER_M4_EXPRESS)
|
||||
#define USE_SPI_DMA ///< Auto DMA if using PyPortal
|
||||
#else
|
||||
//#define USE_SPI_DMA ///< If set, use DMA if available
|
||||
#endif
|
||||
// Another "oops" name -- this now also handles parallel DMA.
|
||||
// If DMA is enabled, Arduino sketch MUST #include <Adafruit_ZeroDMA.h>
|
||||
// Estimated RAM usage:
|
||||
// 4 bytes/pixel on display major axis + 8 bytes/pixel on minor axis,
|
||||
// e.g. 320x240 pixels = 320 * 4 + 240 * 8 = 3,200 bytes.
|
||||
|
||||
#if !defined(ARDUINO_ARCH_SAMD)
|
||||
#undef USE_SPI_DMA ///< DMA currently for SAMD chips only
|
||||
#endif
|
||||
|
||||
#if defined(USE_SPI_DMA)
|
||||
#pragma message ("GFX DMA IS ENABLED. HIGHLY EXPERIMENTAL.")
|
||||
#include <Adafruit_ZeroDMA.h>
|
||||
#endif
|
||||
|
||||
// This is kind of a kludge. Needed a way to disambiguate the software SPI
|
||||
// and parallel constructors via their argument lists. Originally tried a
|
||||
// bool as the first argument to the parallel constructor (specifying 8-bit
|
||||
// vs 16-bit interface) but the compiler regards this as equivalent to an
|
||||
// integer and thus still ambiguous. SO...the parallel constructor requires
|
||||
// an enumerated type as the first argument: tft8 (for 8-bit parallel) or
|
||||
// tft16 (for 16-bit)...even though 16-bit isn't fully implemented or tested
|
||||
// and might never be, still needed that disambiguation from soft SPI.
|
||||
enum tftBusWidth { tft8bitbus, tft16bitbus }; ///< For first arg to parallel constructor
|
||||
|
||||
// CLASS DEFINITION --------------------------------------------------------
|
||||
|
||||
/*!
|
||||
@brief Adafruit_SPITFT is an intermediary class between Adafruit_GFX
|
||||
and various hardware-specific subclasses for different displays.
|
||||
It handles certain operations that are common to a range of
|
||||
displays (address window, area fills, etc.). Originally these were
|
||||
all color TFT displays interfaced via SPI, but it's since expanded
|
||||
to include color OLEDs and parallel-interfaced TFTs. THE NAME HAS
|
||||
BEEN KEPT TO AVOID BREAKING A LOT OF SUBCLASSES AND EXAMPLE CODE.
|
||||
Many of the class member functions similarly live on with names
|
||||
that don't necessarily accurately describe what they're doing,
|
||||
again to avoid breaking a lot of other code. If in doubt, read
|
||||
the comments.
|
||||
*/
|
||||
class Adafruit_SPITFT : public Adafruit_GFX {
|
||||
|
||||
public:
|
||||
|
||||
// CONSTRUCTORS --------------------------------------------------------
|
||||
|
||||
// Software SPI constructor: expects width & height (at default rotation
|
||||
// setting 0), 4 signal pins (cs, dc, mosi, sclk), 2 optional pins
|
||||
// (reset, miso). cs argument is required but can be -1 if unused --
|
||||
// rather than moving it to the optional arguments, it was done this way
|
||||
// to avoid breaking existing code (-1 option was a later addition).
|
||||
Adafruit_SPITFT(uint16_t w, uint16_t h,
|
||||
int8_t cs, int8_t dc, int8_t mosi, int8_t sck,
|
||||
int8_t rst = -1, int8_t miso = -1);
|
||||
|
||||
// Hardware SPI constructor using the default SPI port: expects width &
|
||||
// height (at default rotation setting 0), 2 signal pins (cs, dc),
|
||||
// optional reset pin. cs is required but can be -1 if unused -- rather
|
||||
// than moving it to the optional arguments, it was done this way to
|
||||
// avoid breaking existing code (-1 option was a later addition).
|
||||
Adafruit_SPITFT(uint16_t w, uint16_t h,
|
||||
int8_t cs, int8_t dc, int8_t rst = -1);
|
||||
|
||||
#if !defined(ESP8266) // See notes in .cpp
|
||||
// Hardware SPI constructor using an arbitrary SPI peripheral: expects
|
||||
// width & height (rotation 0), SPIClass pointer, 2 signal pins (cs, dc)
|
||||
// and optional reset pin. cs is required but can be -1 if unused.
|
||||
Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
|
||||
int8_t cs, int8_t dc, int8_t rst = -1);
|
||||
#endif // end !ESP8266
|
||||
|
||||
// Parallel constructor: expects width & height (rotation 0), flag
|
||||
// indicating whether 16-bit (true) or 8-bit (false) interface, 3 signal
|
||||
// pins (d0, wr, dc), 3 optional pins (cs, rst, rd). 16-bit parallel
|
||||
// isn't even fully implemented but the 'wide' flag was added as a
|
||||
// required argument to avoid ambiguity with other constructors.
|
||||
Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth,
|
||||
int8_t d0, int8_t wr, int8_t dc,
|
||||
int8_t cs = -1, int8_t rst = -1, int8_t rd = -1);
|
||||
|
||||
// CLASS MEMBER FUNCTIONS ----------------------------------------------
|
||||
|
||||
// These first two functions MUST be declared by subclasses:
|
||||
|
||||
/*!
|
||||
@brief Display-specific initialization function.
|
||||
@param freq SPI frequency, in hz (or 0 for default or unused).
|
||||
*/
|
||||
virtual void begin(uint32_t freq) = 0;
|
||||
|
||||
/*!
|
||||
@brief Set up the specific display hardware's "address window"
|
||||
for subsequent pixel-pushing operations.
|
||||
@param x Leftmost pixel of area to be drawn (MUST be within
|
||||
display bounds at current rotation setting).
|
||||
@param y Topmost pixel of area to be drawn (MUST be within
|
||||
display bounds at current rotation setting).
|
||||
@param w Width of area to be drawn, in pixels (MUST be >0 and,
|
||||
added to x, within display bounds at current rotation).
|
||||
@param h Height of area to be drawn, in pixels (MUST be >0 and,
|
||||
added to x, within display bounds at current rotation).
|
||||
*/
|
||||
virtual void setAddrWindow(
|
||||
uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0;
|
||||
|
||||
// Remaining functions do not need to be declared in subclasses
|
||||
// unless they wish to provide hardware-specific optimizations.
|
||||
// Brief comments here...documented more thoroughly in .cpp file.
|
||||
|
||||
// Subclass' begin() function invokes this to initialize hardware.
|
||||
// freq=0 to use default SPI speed. spiMode must be one of the SPI_MODEn
|
||||
// values defined in SPI.h, which are NOT the same as 0 for SPI_MODE0,
|
||||
// 1 for SPI_MODE1, etc...use ONLY the SPI_MODEn defines! Only!
|
||||
// Name is outdated (interface may be parallel) but for compatibility:
|
||||
void initSPI(uint32_t freq = 0, uint8_t spiMode = SPI_MODE0);
|
||||
// Chip select and/or hardware SPI transaction start as needed:
|
||||
void startWrite(void);
|
||||
// Chip deselect and/or hardware SPI transaction end as needed:
|
||||
void endWrite(void);
|
||||
void sendCommand(uint8_t commandByte, uint8_t *dataBytes = NULL, uint8_t numDataBytes = 0);
|
||||
void sendCommand(uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes);
|
||||
uint8_t readcommand8(uint8_t commandByte, uint8_t index = 0);
|
||||
|
||||
// These functions require a chip-select and/or SPI transaction
|
||||
// around them. Higher-level graphics primitives might start a
|
||||
// single transaction and then make multiple calls to these functions
|
||||
// (e.g. circle or text rendering might make repeated lines or rects)
|
||||
// before ending the transaction. It's more efficient than starting a
|
||||
// transaction every time.
|
||||
void writePixel(int16_t x, int16_t y, uint16_t color);
|
||||
void writePixels(uint16_t *colors, uint32_t len,
|
||||
bool block=true, bool bigEndian=false);
|
||||
void writeColor(uint16_t color, uint32_t len);
|
||||
void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint16_t color);
|
||||
void writeFastHLine(int16_t x, int16_t y, int16_t w,
|
||||
uint16_t color);
|
||||
void writeFastVLine(int16_t x, int16_t y, int16_t h,
|
||||
uint16_t color);
|
||||
// This is a new function, similar to writeFillRect() except that
|
||||
// all arguments MUST be onscreen, sorted and clipped. If higher-level
|
||||
// primitives can handle their own sorting/clipping, it avoids repeating
|
||||
// such operations in the low-level code, making it potentially faster.
|
||||
// CALLING THIS WITH UNCLIPPED OR NEGATIVE VALUES COULD BE DISASTROUS.
|
||||
inline void writeFillRectPreclipped(int16_t x, int16_t y,
|
||||
int16_t w, int16_t h, uint16_t color);
|
||||
// Another new function, companion to the new non-blocking
|
||||
// writePixels() variant.
|
||||
void dmaWait(void);
|
||||
|
||||
|
||||
// These functions are similar to the 'write' functions above, but with
|
||||
// a chip-select and/or SPI transaction built-in. They're typically used
|
||||
// solo -- that is, as graphics primitives in themselves, not invoked by
|
||||
// higher-level primitives (which should use the functions above).
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint16_t color);
|
||||
void drawFastHLine(int16_t x, int16_t y, int16_t w,
|
||||
uint16_t color);
|
||||
void drawFastVLine(int16_t x, int16_t y, int16_t h,
|
||||
uint16_t color);
|
||||
// A single-pixel push encapsulated in a transaction. I don't think
|
||||
// this is used anymore (BMP demos might've used it?) but is provided
|
||||
// for backward compatibility, consider it deprecated:
|
||||
void pushColor(uint16_t color);
|
||||
|
||||
using Adafruit_GFX::drawRGBBitmap; // Check base class first
|
||||
void drawRGBBitmap(int16_t x, int16_t y,
|
||||
uint16_t *pcolors, int16_t w, int16_t h);
|
||||
|
||||
void invertDisplay(bool i);
|
||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
// Despite parallel additions, function names kept for compatibility:
|
||||
void spiWrite(uint8_t b); // Write single byte as DATA
|
||||
void writeCommand(uint8_t cmd); // Write single byte as COMMAND
|
||||
uint8_t spiRead(void); // Read single byte of data
|
||||
|
||||
// Most of these low-level functions were formerly macros in
|
||||
// Adafruit_SPITFT_Macros.h. Some have been made into inline functions
|
||||
// to avoid macro mishaps. Despite the addition of code for a parallel
|
||||
// display interface, the names have been kept for backward
|
||||
// compatibility (some subclasses may be invoking these):
|
||||
void SPI_WRITE16(uint16_t w); // Not inline
|
||||
void SPI_WRITE32(uint32_t l); // Not inline
|
||||
// Old code had both a spiWrite16() function and SPI_WRITE16 macro
|
||||
// in addition to the SPI_WRITE32 macro. The latter two have been
|
||||
// made into functions here, and spiWrite16() removed (use SPI_WRITE16()
|
||||
// instead). It looks like most subclasses had gotten comfortable with
|
||||
// SPI_WRITE16 and SPI_WRITE32 anyway so those names were kept rather
|
||||
// than the less-obnoxious camelcase variants, oh well.
|
||||
|
||||
// Placing these functions entirely in the class definition inlines
|
||||
// them implicitly them while allowing their use in other code:
|
||||
|
||||
/*!
|
||||
@brief Set the chip-select line HIGH. Does NOT check whether CS pin
|
||||
is set (>=0), that should be handled in calling function.
|
||||
Despite function name, this is used even if the display
|
||||
connection is parallel.
|
||||
*/
|
||||
void SPI_CS_HIGH(void) {
|
||||
#if defined(USE_FAST_PINIO)
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
#if defined(KINETISK)
|
||||
*csPortSet = 1;
|
||||
#else // !KINETISK
|
||||
*csPortSet = csPinMask;
|
||||
#endif // end !KINETISK
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
*csPort |= csPinMaskSet;
|
||||
#endif // end !HAS_PORT_SET_CLR
|
||||
#else // !USE_FAST_PINIO
|
||||
digitalWrite(_cs, HIGH);
|
||||
#endif // end !USE_FAST_PINIO
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief Set the chip-select line LOW. Does NOT check whether CS pin
|
||||
is set (>=0), that should be handled in calling function.
|
||||
Despite function name, this is used even if the display
|
||||
connection is parallel.
|
||||
*/
|
||||
void SPI_CS_LOW(void) {
|
||||
#if defined(USE_FAST_PINIO)
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
#if defined(KINETISK)
|
||||
*csPortClr = 1;
|
||||
#else // !KINETISK
|
||||
*csPortClr = csPinMask;
|
||||
#endif // end !KINETISK
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
*csPort &= csPinMaskClr;
|
||||
#endif // end !HAS_PORT_SET_CLR
|
||||
#else // !USE_FAST_PINIO
|
||||
digitalWrite(_cs, LOW);
|
||||
#endif // end !USE_FAST_PINIO
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief Set the data/command line HIGH (data mode).
|
||||
*/
|
||||
void SPI_DC_HIGH(void) {
|
||||
#if defined(USE_FAST_PINIO)
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
#if defined(KINETISK)
|
||||
*dcPortSet = 1;
|
||||
#else // !KINETISK
|
||||
*dcPortSet = dcPinMask;
|
||||
#endif // end !KINETISK
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
*dcPort |= dcPinMaskSet;
|
||||
#endif // end !HAS_PORT_SET_CLR
|
||||
#else // !USE_FAST_PINIO
|
||||
digitalWrite(_dc, HIGH);
|
||||
#endif // end !USE_FAST_PINIO
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief Set the data/command line LOW (command mode).
|
||||
*/
|
||||
void SPI_DC_LOW(void) {
|
||||
#if defined(USE_FAST_PINIO)
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
#if defined(KINETISK)
|
||||
*dcPortClr = 1;
|
||||
#else // !KINETISK
|
||||
*dcPortClr = dcPinMask;
|
||||
#endif // end !KINETISK
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
*dcPort &= dcPinMaskClr;
|
||||
#endif // end !HAS_PORT_SET_CLR
|
||||
#else // !USE_FAST_PINIO
|
||||
digitalWrite(_dc, LOW);
|
||||
#endif // end !USE_FAST_PINIO
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// A few more low-level member functions -- some may have previously
|
||||
// been macros. Shouldn't have a need to access these externally, so
|
||||
// they've been moved to the protected section. Additionally, they're
|
||||
// declared inline here and the code is in the .cpp file, since outside
|
||||
// code doesn't need to see these.
|
||||
inline void SPI_MOSI_HIGH(void);
|
||||
inline void SPI_MOSI_LOW(void);
|
||||
inline void SPI_SCK_HIGH(void);
|
||||
inline void SPI_SCK_LOW(void);
|
||||
inline bool SPI_MISO_READ(void);
|
||||
inline void SPI_BEGIN_TRANSACTION(void);
|
||||
inline void SPI_END_TRANSACTION(void);
|
||||
inline void TFT_WR_STROBE(void); // Parallel interface write strobe
|
||||
inline void TFT_RD_HIGH(void); // Parallel interface read high
|
||||
inline void TFT_RD_LOW(void); // Parallel interface read low
|
||||
|
||||
// CLASS INSTANCE VARIABLES --------------------------------------------
|
||||
|
||||
// Here be dragons! There's a big union of three structures here --
|
||||
// one each for hardware SPI, software (bitbang) SPI, and parallel
|
||||
// interfaces. This is to save some memory, since a display's connection
|
||||
// will be only one of these. The order of some things is a little weird
|
||||
// in an attempt to get values to align and pack better in RAM.
|
||||
|
||||
#if defined(USE_FAST_PINIO)
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
PORTreg_t csPortSet; ///< PORT register for chip select SET
|
||||
PORTreg_t csPortClr; ///< PORT register for chip select CLEAR
|
||||
PORTreg_t dcPortSet; ///< PORT register for data/command SET
|
||||
PORTreg_t dcPortClr; ///< PORT register for data/command CLEAR
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
PORTreg_t csPort; ///< PORT register for chip select
|
||||
PORTreg_t dcPort; ///< PORT register for data/command
|
||||
#endif // end HAS_PORT_SET_CLR
|
||||
#endif // end USE_FAST_PINIO
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201100)
|
||||
union {
|
||||
#endif
|
||||
struct { // Values specific to HARDWARE SPI:
|
||||
SPIClass *_spi; ///< SPI class pointer
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPISettings settings; ///< SPI transaction settings
|
||||
#else
|
||||
uint32_t _freq; ///< SPI bitrate (if no SPI transactions)
|
||||
#endif
|
||||
uint32_t _mode; ///< SPI data mode (transactions or no)
|
||||
} hwspi; ///< Hardware SPI values
|
||||
struct { // Values specific to SOFTWARE SPI:
|
||||
#if defined(USE_FAST_PINIO)
|
||||
PORTreg_t misoPort; ///< PORT (PIN) register for MISO
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
PORTreg_t mosiPortSet; ///< PORT register for MOSI SET
|
||||
PORTreg_t mosiPortClr; ///< PORT register for MOSI CLEAR
|
||||
PORTreg_t sckPortSet; ///< PORT register for SCK SET
|
||||
PORTreg_t sckPortClr; ///< PORT register for SCK CLEAR
|
||||
#if !defined(KINETISK)
|
||||
ADAGFX_PORT_t mosiPinMask; ///< Bitmask for MOSI
|
||||
ADAGFX_PORT_t sckPinMask; ///< Bitmask for SCK
|
||||
#endif // end !KINETISK
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
PORTreg_t mosiPort; ///< PORT register for MOSI
|
||||
PORTreg_t sckPort; ///< PORT register for SCK
|
||||
ADAGFX_PORT_t mosiPinMaskSet; ///< Bitmask for MOSI SET (OR)
|
||||
ADAGFX_PORT_t mosiPinMaskClr; ///< Bitmask for MOSI CLEAR (AND)
|
||||
ADAGFX_PORT_t sckPinMaskSet; ///< Bitmask for SCK SET (OR bitmask)
|
||||
ADAGFX_PORT_t sckPinMaskClr; ///< Bitmask for SCK CLEAR (AND)
|
||||
#endif // end HAS_PORT_SET_CLR
|
||||
#if !defined(KINETISK)
|
||||
ADAGFX_PORT_t misoPinMask; ///< Bitmask for MISO
|
||||
#endif // end !KINETISK
|
||||
#endif // end USE_FAST_PINIO
|
||||
int8_t _mosi; ///< MOSI pin #
|
||||
int8_t _miso; ///< MISO pin #
|
||||
int8_t _sck; ///< SCK pin #
|
||||
} swspi; ///< Software SPI values
|
||||
struct { // Values specific to 8-bit parallel:
|
||||
#if defined(USE_FAST_PINIO)
|
||||
|
||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
|
||||
volatile uint32_t *writePort; ///< PORT register for DATA WRITE
|
||||
volatile uint32_t *readPort; ///< PORT (PIN) register for DATA READ
|
||||
#else
|
||||
volatile uint8_t *writePort; ///< PORT register for DATA WRITE
|
||||
volatile uint8_t *readPort; ///< PORT (PIN) register for DATA READ
|
||||
#endif
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
// Port direction register pointers are always 8-bit regardless of
|
||||
// PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
|
||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
|
||||
volatile uint32_t *dirSet; ///< PORT byte data direction SET
|
||||
volatile uint32_t *dirClr; ///< PORT byte data direction CLEAR
|
||||
#else
|
||||
volatile uint8_t *dirSet; ///< PORT byte data direction SET
|
||||
volatile uint8_t *dirClr; ///< PORT byte data direction CLEAR
|
||||
#endif
|
||||
PORTreg_t wrPortSet; ///< PORT register for write strobe SET
|
||||
PORTreg_t wrPortClr; ///< PORT register for write strobe CLEAR
|
||||
PORTreg_t rdPortSet; ///< PORT register for read strobe SET
|
||||
PORTreg_t rdPortClr; ///< PORT register for read strobe CLEAR
|
||||
#if !defined(KINETISK)
|
||||
ADAGFX_PORT_t wrPinMask; ///< Bitmask for write strobe
|
||||
#endif // end !KINETISK
|
||||
ADAGFX_PORT_t rdPinMask; ///< Bitmask for read strobe
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
// Port direction register pointer is always 8-bit regardless of
|
||||
// PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
|
||||
volatile uint8_t *portDir; ///< PORT direction register
|
||||
PORTreg_t wrPort; ///< PORT register for write strobe
|
||||
PORTreg_t rdPort; ///< PORT register for read strobe
|
||||
ADAGFX_PORT_t wrPinMaskSet; ///< Bitmask for write strobe SET (OR)
|
||||
ADAGFX_PORT_t wrPinMaskClr; ///< Bitmask for write strobe CLEAR (AND)
|
||||
ADAGFX_PORT_t rdPinMaskSet; ///< Bitmask for read strobe SET (OR)
|
||||
ADAGFX_PORT_t rdPinMaskClr; ///< Bitmask for read strobe CLEAR (AND)
|
||||
#endif // end HAS_PORT_SET_CLR
|
||||
#endif // end USE_FAST_PINIO
|
||||
int8_t _d0; ///< Data pin 0 #
|
||||
int8_t _wr; ///< Write strobe pin #
|
||||
int8_t _rd; ///< Read strobe pin # (or -1)
|
||||
bool wide = 0; ///< If true, is 16-bit interface
|
||||
} tft8; ///< Parallel interface settings
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201100)
|
||||
}; ///< Only one interface is active
|
||||
#endif
|
||||
#if defined(USE_SPI_DMA) // Used by hardware SPI and tft8
|
||||
Adafruit_ZeroDMA dma; ///< DMA instance
|
||||
DmacDescriptor *dptr = NULL; ///< 1st descriptor
|
||||
DmacDescriptor *descriptor = NULL; ///< Allocated descriptor list
|
||||
uint16_t *pixelBuf[2]; ///< Working buffers
|
||||
uint16_t maxFillLen; ///< Max pixels per DMA xfer
|
||||
uint16_t lastFillColor = 0; ///< Last color used w/fill
|
||||
uint32_t lastFillLen = 0; ///< # of pixels w/last fill
|
||||
uint8_t onePixelBuf; ///< For hi==lo fill
|
||||
#endif
|
||||
#if defined(USE_FAST_PINIO)
|
||||
#if defined(HAS_PORT_SET_CLR)
|
||||
#if !defined(KINETISK)
|
||||
ADAGFX_PORT_t csPinMask; ///< Bitmask for chip select
|
||||
ADAGFX_PORT_t dcPinMask; ///< Bitmask for data/command
|
||||
#endif // end !KINETISK
|
||||
#else // !HAS_PORT_SET_CLR
|
||||
ADAGFX_PORT_t csPinMaskSet; ///< Bitmask for chip select SET (OR)
|
||||
ADAGFX_PORT_t csPinMaskClr; ///< Bitmask for chip select CLEAR (AND)
|
||||
ADAGFX_PORT_t dcPinMaskSet; ///< Bitmask for data/command SET (OR)
|
||||
ADAGFX_PORT_t dcPinMaskClr; ///< Bitmask for data/command CLEAR (AND)
|
||||
#endif // end HAS_PORT_SET_CLR
|
||||
#endif // end USE_FAST_PINIO
|
||||
uint8_t connection; ///< TFT_HARD_SPI, TFT_SOFT_SPI, etc.
|
||||
int8_t _rst; ///< Reset pin # (or -1)
|
||||
int8_t _cs; ///< Chip select pin # (or -1)
|
||||
int8_t _dc; ///< Data/command pin #
|
||||
|
||||
int16_t _xstart = 0; ///< Internal framebuffer X offset
|
||||
int16_t _ystart = 0; ///< Internal framebuffer Y offset
|
||||
uint8_t invertOnCommand = 0; ///< Command to enable invert mode
|
||||
uint8_t invertOffCommand = 0; ///< Command to disable invert mode
|
||||
|
||||
uint32_t _freq = 0; ///< Dummy var to keep subclasses happy
|
||||
};
|
||||
|
||||
#endif // end __AVR_ATtiny85__
|
||||
#endif // end _ADAFRUIT_SPITFT_H_
|
|
@ -0,0 +1,6 @@
|
|||
// THIS FILE INTENTIONALLY LEFT BLANK.
|
||||
|
||||
// Macros previously #defined here have been made into (mostly) inline
|
||||
// functions in the Adafruit_SPITFT class. Other libraries might still
|
||||
// contain code trying to #include this header file, so until everything's
|
||||
// updated this file still exists (but doing nothing) to avoid trouble.
|
|
@ -1,4 +1,4 @@
|
|||
# Adafruit GFX Library # [![Build Status](https://travis-ci.org/adafruit/Adafruit_GFX.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_GFX)
|
||||
# Adafruit GFX Library [![Build Status](https://travis-ci.com/adafruit/Adafruit-GFX-Library.svg?branch=master)](https://travis-ci.com/adafruit/Adafruit-GFX-Library)
|
||||
|
||||
This is the core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.). It needs to be paired with a hardware-specific library for each display device we carry (to handle the lower-level functions).
|
||||
|
|
@ -362,4 +362,4 @@ unsigned long testFilledRoundRects() {
|
|||
}
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
}
|
|
@ -16,12 +16,14 @@ Keep 7-bit fonts around as an option in that case, more compact.
|
|||
|
||||
See notes at end for glyph nomenclature & other tidbits.
|
||||
*/
|
||||
#ifndef ARDUINO
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_GLYPH_H
|
||||
#include FT_TRUETYPE_DRIVER_H
|
||||
#include "../gfxfont.h" // Adafruit_GFX font structures
|
||||
|
||||
#define DPI 141 // Approximate res. of Adafruit 2.8" TFT
|
||||
|
@ -116,6 +118,16 @@ int main(int argc, char *argv[]) {
|
|||
fprintf(stderr, "FreeType init error: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
// Use TrueType engine version 35, without subpixel rendering.
|
||||
// This improves clarity of fonts since this library does not
|
||||
// support rendering multiple levels of gray in a glyph.
|
||||
// See https://github.com/adafruit/Adafruit-GFX-Library/issues/103
|
||||
FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35;
|
||||
FT_Property_Set( library, "truetype",
|
||||
"interpreter-version",
|
||||
&interpreter_version );
|
||||
|
||||
if((err = FT_New_Face(library, argv[1], 0, &face))) {
|
||||
fprintf(stderr, "Font load error: %d", err);
|
||||
FT_Done_FreeType(library);
|
||||
|
@ -282,3 +294,5 @@ the cursor on the X axis after drawing the corresponding symbol.
|
|||
There's also some changes with regard to 'background' color and new GFX
|
||||
fonts (classic fonts unchanged). See Adafruit_GFX.cpp for explanation.
|
||||
*/
|
||||
|
||||
#endif /* !ARDUINO */
|
|
@ -9,6 +9,10 @@
|
|||
#include <avr/pgmspace.h>
|
||||
#elif defined(ESP8266)
|
||||
#include <pgmspace.h>
|
||||
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||
// PROGMEM is defefind for T4 to place data in specific memory section
|
||||
#undef PROGMEM
|
||||
#define PROGMEM
|
||||
#else
|
||||
#define PROGMEM
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
name=Adafruit GFX Library
|
||||
version=1.2.9
|
||||
version=1.5.6
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.
|
|
@ -0,0 +1,286 @@
|
|||
/***************************************************
|
||||
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
|
||||
|
||||
Designed specifically to work with the Adafruit RTD Sensor
|
||||
----> https://www.adafruit.com/products/3328
|
||||
|
||||
This sensor uses SPI to communicate, 4 pins are required to
|
||||
interface
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, all text above must be included in any redistribution
|
||||
****************************************************/
|
||||
|
||||
#include "Adafruit_MAX31865.h"
|
||||
#ifdef __AVR
|
||||
#include <avr/pgmspace.h>
|
||||
#elif defined(ESP8266)
|
||||
#include <pgmspace.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <SPI.h>
|
||||
|
||||
static SPISettings max31865_spisettings = SPISettings(500000, MSBFIRST, SPI_MODE1);
|
||||
|
||||
|
||||
|
||||
// Software (bitbang) SPI
|
||||
Adafruit_MAX31865::Adafruit_MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk) {
|
||||
setPins( spi_cs, spi_mosi, spi_miso, spi_clk);
|
||||
}
|
||||
|
||||
void Adafruit_MAX31865::setPins(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk) {
|
||||
_sclk = spi_clk;
|
||||
_cs = spi_cs;
|
||||
_miso = spi_miso;
|
||||
_mosi = spi_mosi;
|
||||
}
|
||||
|
||||
// Hardware SPI init
|
||||
Adafruit_MAX31865::Adafruit_MAX31865(int8_t spi_cs) {
|
||||
_cs = spi_cs;
|
||||
_sclk = _miso = _mosi = -1;
|
||||
}
|
||||
|
||||
// Default constructor
|
||||
Adafruit_MAX31865::Adafruit_MAX31865(void) {
|
||||
_cs = _sclk = _miso = _mosi = -1;
|
||||
}
|
||||
|
||||
boolean Adafruit_MAX31865::begin(max31865_numwires_t wires) {
|
||||
pinMode(_cs, OUTPUT);
|
||||
digitalWrite(_cs, HIGH);
|
||||
|
||||
if (_sclk != -1) {
|
||||
//define pin modes
|
||||
pinMode(_sclk, OUTPUT);
|
||||
digitalWrite(_sclk, LOW);
|
||||
pinMode(_mosi, OUTPUT);
|
||||
pinMode(_miso, INPUT);
|
||||
} else {
|
||||
//start and configure hardware SPI
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
for (uint8_t i=0; i<16; i++) {
|
||||
// readRegister8(i);
|
||||
}
|
||||
|
||||
setWires(wires);
|
||||
enableBias(false);
|
||||
autoConvert(false);
|
||||
clearFault();
|
||||
|
||||
//Serial.print("config: "); Serial.println(readRegister8(MAX31856_CONFIG_REG), HEX);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
uint8_t Adafruit_MAX31865::readFault(void) {
|
||||
return readRegister8(MAX31856_FAULTSTAT_REG);
|
||||
}
|
||||
|
||||
void Adafruit_MAX31865::clearFault(void) {
|
||||
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
|
||||
t &= ~0x2C;
|
||||
t |= MAX31856_CONFIG_FAULTSTAT;
|
||||
writeRegister8(MAX31856_CONFIG_REG, t);
|
||||
}
|
||||
|
||||
void Adafruit_MAX31865::enableBias(boolean b) {
|
||||
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
|
||||
if (b) {
|
||||
t |= MAX31856_CONFIG_BIAS; // enable bias
|
||||
} else {
|
||||
t &= ~MAX31856_CONFIG_BIAS; // disable bias
|
||||
}
|
||||
writeRegister8(MAX31856_CONFIG_REG, t);
|
||||
}
|
||||
|
||||
void Adafruit_MAX31865::autoConvert(boolean b) {
|
||||
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
|
||||
if (b) {
|
||||
t |= MAX31856_CONFIG_MODEAUTO; // enable autoconvert
|
||||
} else {
|
||||
t &= ~MAX31856_CONFIG_MODEAUTO; // disable autoconvert
|
||||
}
|
||||
writeRegister8(MAX31856_CONFIG_REG, t);
|
||||
}
|
||||
|
||||
void Adafruit_MAX31865::setWires(max31865_numwires_t wires ) {
|
||||
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
|
||||
if (wires == MAX31865_3WIRE) {
|
||||
t |= MAX31856_CONFIG_3WIRE;
|
||||
} else {
|
||||
// 2 or 4 wire
|
||||
t &= ~MAX31856_CONFIG_3WIRE;
|
||||
}
|
||||
writeRegister8(MAX31856_CONFIG_REG, t);
|
||||
}
|
||||
|
||||
float Adafruit_MAX31865::rtd_to_temperature(uint16_t rtd, float RTDnominal, float refResistor) {
|
||||
//float Adafruit_MAX31865::temperature(float RTDnominal, float refResistor) {
|
||||
// http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
|
||||
|
||||
float Z1, Z2, Z3, Z4, Rt, temp;
|
||||
|
||||
Rt = rtd;
|
||||
Rt /= 32768;
|
||||
Rt *= refResistor;
|
||||
|
||||
// Serial.print("\nResistance: "); Serial.println(Rt, 8);
|
||||
|
||||
Z1 = -RTD_A;
|
||||
Z2 = RTD_A * RTD_A - (4 * RTD_B);
|
||||
Z3 = (4 * RTD_B) / RTDnominal;
|
||||
Z4 = 2 * RTD_B;
|
||||
|
||||
temp = Z2 + (Z3 * Rt);
|
||||
temp = (sqrt(temp) + Z1) / Z4;
|
||||
|
||||
if (temp >= 0) return temp;
|
||||
|
||||
// ugh.
|
||||
Rt /= RTDnominal;
|
||||
Rt *= 100; // normalize to 100 ohm
|
||||
|
||||
float rpoly = Rt;
|
||||
|
||||
temp = -242.02;
|
||||
temp += 2.2228 * rpoly;
|
||||
rpoly *= Rt; // square
|
||||
temp += 2.5859e-3 * rpoly;
|
||||
rpoly *= Rt; // ^3
|
||||
temp -= 4.8260e-6 * rpoly;
|
||||
rpoly *= Rt; // ^4
|
||||
temp -= 2.8183e-8 * rpoly;
|
||||
rpoly *= Rt; // ^5
|
||||
temp += 1.5243e-10 * rpoly;
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
float Adafruit_MAX31865::rtd_to_resistance(uint16_t rtd, float refResistor) {
|
||||
float Rt;
|
||||
|
||||
Rt = rtd;
|
||||
Rt /= 32768;
|
||||
Rt *= refResistor;
|
||||
|
||||
return Rt;
|
||||
}
|
||||
|
||||
float Adafruit_MAX31865::temperature(float RTDnominal, float refResistor) {
|
||||
uint16_t rtd = readRTD();
|
||||
return rtd_to_temperature(rtd, RTDnominal, refResistor);
|
||||
}
|
||||
|
||||
uint16_t Adafruit_MAX31865::readRTD (void) {
|
||||
clearFault();
|
||||
enableBias(true);
|
||||
delay(10);
|
||||
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
|
||||
t |= MAX31856_CONFIG_1SHOT;
|
||||
writeRegister8(MAX31856_CONFIG_REG, t);
|
||||
delay(65);
|
||||
|
||||
uint16_t rtd = readRegister16(MAX31856_RTDMSB_REG);
|
||||
|
||||
// remove fault
|
||||
rtd >>= 1;
|
||||
|
||||
return rtd;
|
||||
}
|
||||
|
||||
/**********************************************/
|
||||
|
||||
uint8_t Adafruit_MAX31865::readRegister8(uint8_t addr) {
|
||||
uint8_t ret = 0;
|
||||
readRegisterN(addr, &ret, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint16_t Adafruit_MAX31865::readRegister16(uint8_t addr) {
|
||||
uint8_t buffer[2] = {0, 0};
|
||||
readRegisterN(addr, buffer, 2);
|
||||
|
||||
uint16_t ret = buffer[0];
|
||||
ret <<= 8;
|
||||
ret |= buffer[1];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void Adafruit_MAX31865::readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n) {
|
||||
addr &= 0x7F; // make sure top bit is not set
|
||||
|
||||
if (_sclk == -1)
|
||||
SPI.beginTransaction(max31865_spisettings);
|
||||
else
|
||||
digitalWrite(_sclk, LOW);
|
||||
|
||||
digitalWrite(_cs, LOW);
|
||||
|
||||
spixfer(addr);
|
||||
|
||||
//Serial.print("$"); Serial.print(addr, HEX); Serial.print(": ");
|
||||
while (n--) {
|
||||
buffer[0] = spixfer(0xFF);
|
||||
//Serial.print(" 0x"); Serial.print(buffer[0], HEX);
|
||||
buffer++;
|
||||
}
|
||||
//Serial.println();
|
||||
|
||||
if (_sclk == -1)
|
||||
SPI.endTransaction();
|
||||
|
||||
digitalWrite(_cs, HIGH);
|
||||
}
|
||||
|
||||
|
||||
void Adafruit_MAX31865::writeRegister8(uint8_t addr, uint8_t data) {
|
||||
if (_sclk == -1)
|
||||
SPI.beginTransaction(max31865_spisettings);
|
||||
else
|
||||
digitalWrite(_sclk, LOW);
|
||||
|
||||
digitalWrite(_cs, LOW);
|
||||
|
||||
spixfer(addr | 0x80); // make sure top bit is set
|
||||
spixfer(data);
|
||||
|
||||
//Serial.print("$"); Serial.print(addr, HEX); Serial.print(" = 0x"); Serial.println(data, HEX);
|
||||
|
||||
if (_sclk == -1)
|
||||
SPI.endTransaction();
|
||||
|
||||
digitalWrite(_cs, HIGH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t Adafruit_MAX31865::spixfer(uint8_t x) {
|
||||
if (_sclk == -1)
|
||||
return SPI.transfer(x);
|
||||
|
||||
// software spi
|
||||
//Serial.println("Software SPI");
|
||||
uint8_t reply = 0;
|
||||
|
||||
for (int i=7; i>=0; i--) {
|
||||
reply <<= 1;
|
||||
digitalWrite(_sclk, HIGH);
|
||||
digitalWrite(_mosi, x & (1<<i));
|
||||
digitalWrite(_sclk, LOW);
|
||||
if (digitalRead(_miso))
|
||||
reply |= 1;
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/***************************************************
|
||||
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
|
||||
|
||||
Designed specifically to work with the Adafruit RTD Sensor
|
||||
----> https://www.adafruit.com/products/3328
|
||||
|
||||
This sensor uses SPI to communicate, 4 pins are required to
|
||||
interface
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, all text above must be included in any redistribution
|
||||
****************************************************/
|
||||
|
||||
#ifndef ADAFRUIT_MAX31865_H
|
||||
#define ADAFRUIT_MAX31865_H
|
||||
|
||||
#define MAX31856_CONFIG_REG 0x00
|
||||
#define MAX31856_CONFIG_BIAS 0x80
|
||||
#define MAX31856_CONFIG_MODEAUTO 0x40
|
||||
#define MAX31856_CONFIG_MODEOFF 0x00
|
||||
#define MAX31856_CONFIG_1SHOT 0x20
|
||||
#define MAX31856_CONFIG_3WIRE 0x10
|
||||
#define MAX31856_CONFIG_24WIRE 0x00
|
||||
#define MAX31856_CONFIG_FAULTSTAT 0x02
|
||||
#define MAX31856_CONFIG_FILT50HZ 0x01
|
||||
#define MAX31856_CONFIG_FILT60HZ 0x00
|
||||
|
||||
#define MAX31856_RTDMSB_REG 0x01
|
||||
#define MAX31856_RTDLSB_REG 0x02
|
||||
#define MAX31856_HFAULTMSB_REG 0x03
|
||||
#define MAX31856_HFAULTLSB_REG 0x04
|
||||
#define MAX31856_LFAULTMSB_REG 0x05
|
||||
#define MAX31856_LFAULTLSB_REG 0x06
|
||||
#define MAX31856_FAULTSTAT_REG 0x07
|
||||
|
||||
|
||||
#define MAX31865_FAULT_HIGHTHRESH 0x80
|
||||
#define MAX31865_FAULT_LOWTHRESH 0x40
|
||||
#define MAX31865_FAULT_REFINLOW 0x20
|
||||
#define MAX31865_FAULT_REFINHIGH 0x10
|
||||
#define MAX31865_FAULT_RTDINLOW 0x08
|
||||
#define MAX31865_FAULT_OVUV 0x04
|
||||
|
||||
|
||||
#define RTD_A 3.9083e-3
|
||||
#define RTD_B -5.775e-7
|
||||
|
||||
#if (ARDUINO >= 100)
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
typedef enum max31865_numwires {
|
||||
MAX31865_2WIRE = 0,
|
||||
MAX31865_3WIRE = 1,
|
||||
MAX31865_4WIRE = 0
|
||||
} max31865_numwires_t;
|
||||
|
||||
|
||||
class Adafruit_MAX31865 {
|
||||
public:
|
||||
Adafruit_MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk);
|
||||
Adafruit_MAX31865(int8_t spi_cs);
|
||||
Adafruit_MAX31865(void);
|
||||
|
||||
void setPins(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk);
|
||||
boolean begin(max31865_numwires_t x = MAX31865_2WIRE);
|
||||
|
||||
uint8_t readFault(void);
|
||||
void clearFault(void);
|
||||
uint16_t readRTD();
|
||||
|
||||
|
||||
void setWires(max31865_numwires_t wires);
|
||||
void autoConvert(boolean b);
|
||||
void enableBias(boolean b);
|
||||
|
||||
float temperature(float RTDnominal, float refResistor);
|
||||
float rtd_to_temperature(uint16_t rtd, float RTDnominal, float refResistor);
|
||||
float rtd_to_resistance(uint16_t rtd, float refResistor);
|
||||
|
||||
private:
|
||||
int8_t _sclk, _miso, _mosi, _cs;
|
||||
|
||||
void readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n);
|
||||
|
||||
uint8_t readRegister8(uint8_t addr);
|
||||
uint16_t readRegister16(uint8_t addr);
|
||||
|
||||
void writeRegister8(uint8_t addr, uint8_t reg);
|
||||
uint8_t spixfer(uint8_t addr);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,2 @@
|
|||
# Adafruit_MAX31865
|
||||
Arduino Library for Adafruit MAX31865 RTD Sensor
|
|
@ -0,0 +1,16 @@
|
|||
This is the Adafruit MAX31856 Arduino Library
|
||||
|
||||
Tested and works great with the Adafruit Thermocouple Breakout w/MAX31856
|
||||
|
||||
* http://www.adafruit.com/products/3328
|
||||
|
||||
These sensors use SPI to communicate, 4 pins are required to
|
||||
interface
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information
|
||||
All text above must be included in any redistribution
|
|
@ -0,0 +1,74 @@
|
|||
/***************************************************
|
||||
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
|
||||
|
||||
Designed specifically to work with the Adafruit RTD Sensor
|
||||
----> https://www.adafruit.com/products/3328
|
||||
|
||||
This sensor uses SPI to communicate, 4 pins are required to
|
||||
interface
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, all text above must be included in any redistribution
|
||||
****************************************************/
|
||||
|
||||
#include <Adafruit_MAX31865.h>
|
||||
|
||||
// Use software SPI: CS, DI, DO, CLK
|
||||
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
|
||||
// use hardware SPI, just pass in the CS pin
|
||||
//Adafruit_MAX31865 max = Adafruit_MAX31865(10);
|
||||
|
||||
// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
|
||||
#define RREF 430.0
|
||||
// The 'nominal' 0-degrees-C resistance of the sensor
|
||||
// 100.0 for PT100, 1000.0 for PT1000
|
||||
#define RNOMINAL 100.0
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
|
||||
|
||||
max.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
uint16_t rtd = max.readRTD();
|
||||
|
||||
Serial.print("RTD value: "); Serial.println(rtd);
|
||||
float ratio = rtd;
|
||||
ratio /= 32768;
|
||||
Serial.print("Ratio = "); Serial.println(ratio,8);
|
||||
Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
|
||||
Serial.print("Temperature = "); Serial.println(max.temperature(RNOMINAL, RREF));
|
||||
|
||||
// Check and print any faults
|
||||
uint8_t fault = max.readFault();
|
||||
if (fault) {
|
||||
Serial.print("Fault 0x"); Serial.println(fault, HEX);
|
||||
if (fault & MAX31865_FAULT_HIGHTHRESH) {
|
||||
Serial.println("RTD High Threshold");
|
||||
}
|
||||
if (fault & MAX31865_FAULT_LOWTHRESH) {
|
||||
Serial.println("RTD Low Threshold");
|
||||
}
|
||||
if (fault & MAX31865_FAULT_REFINLOW) {
|
||||
Serial.println("REFIN- > 0.85 x Bias");
|
||||
}
|
||||
if (fault & MAX31865_FAULT_REFINHIGH) {
|
||||
Serial.println("REFIN- < 0.85 x Bias - FORCE- open");
|
||||
}
|
||||
if (fault & MAX31865_FAULT_RTDINLOW) {
|
||||
Serial.println("RTDIN- < 0.85 x Bias - FORCE- open");
|
||||
}
|
||||
if (fault & MAX31865_FAULT_OVUV) {
|
||||
Serial.println("Under/Over voltage");
|
||||
}
|
||||
max.clearFault();
|
||||
}
|
||||
Serial.println();
|
||||
delay(1000);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
name=Adafruit MAX31865 library
|
||||
version=1.0.1
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Library for the Adafruit RTD Amplifier breakout with MAX31865
|
||||
paragraph=Library for the Adafruit RTD Amplifier breakout with MAX31865
|
||||
category=Sensors
|
||||
url=https://github.com/adafruit/Adafruit_MAX31865
|
||||
architectures=*
|
|
@ -0,0 +1,291 @@
|
|||
/*********************************************************************
|
||||
This is a library for our Monochrome OLEDs based on SSD1306 drivers
|
||||
|
||||
Pick one up today in the adafruit shop!
|
||||
------> http://www.adafruit.com/category/63_98
|
||||
|
||||
These displays use SPI to communicate, 4 or 5 pins are required to
|
||||
interface
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information
|
||||
All text above, and the splash screen below must be included in any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
I change the adafruit SSD1306 to SH1106
|
||||
|
||||
SH1106 driver similar to SSD1306 so, just change the display() method.
|
||||
|
||||
However, SH1106 driver don't provide several functions such as scroll commands.
|
||||
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
//#include <avr/pgmspace.h>
|
||||
#ifndef __SAM3X8E__
|
||||
// #include <util/delay.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <Wire.h>
|
||||
//#include <../../sonoff/settings.h>
|
||||
|
||||
#include "Adafruit_SH1106.h"
|
||||
#define DISPLAY_INIT_MODE 0
|
||||
|
||||
// the memory buffer for the LCD
|
||||
extern uint8_t *buffer;
|
||||
|
||||
Adafruit_SH1106::Adafruit_SH1106(int16_t width, int16_t height) :
|
||||
Renderer(width,height) {
|
||||
}
|
||||
|
||||
void Adafruit_SH1106::DisplayOnff(int8_t on) {
|
||||
if (on) {
|
||||
SH1106_command(SH1106_DISPLAYON);
|
||||
} else {
|
||||
SH1106_command(SH1106_DISPLAYOFF);
|
||||
}
|
||||
}
|
||||
|
||||
void Adafruit_SH1106::Updateframe() {
|
||||
display();
|
||||
}
|
||||
|
||||
void Adafruit_SH1106::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) {
|
||||
// ignore update mode
|
||||
//if (p==DISPLAY_INIT_MODE) {
|
||||
setRotation(rot);
|
||||
invertDisplay(false);
|
||||
setTextWrap(false); // Allow text to run off edges
|
||||
cp437(true);
|
||||
setTextFont(font);
|
||||
setTextSize(size);
|
||||
setTextColor(WHITE,BLACK);
|
||||
setCursor(0,0);
|
||||
fillScreen(BLACK);
|
||||
Updateframe();
|
||||
//}
|
||||
}
|
||||
|
||||
int16_t Adafruit_SH1106::Begin(int16_t p1,int16_t p2,int16_t p3) {
|
||||
begin(p1,p2,p3);
|
||||
}
|
||||
|
||||
|
||||
void Adafruit_SH1106::begin(uint8_t vccstate, uint8_t i2caddr, bool reset) {
|
||||
_vccstate = vccstate;
|
||||
_i2caddr = i2caddr;
|
||||
// I2C Init
|
||||
Wire.begin();
|
||||
|
||||
#if defined SH1106_128_32
|
||||
// Init sequence for 128x32 OLED module
|
||||
SH1106_command(SH1106_DISPLAYOFF); // 0xAE
|
||||
SH1106_command(SH1106_SETDISPLAYCLOCKDIV); // 0xD5
|
||||
SH1106_command(0x80); // the suggested ratio 0x80
|
||||
SH1106_command(SH1106_SETMULTIPLEX); // 0xA8
|
||||
SH1106_command(0x1F);
|
||||
SH1106_command(SH1106_SETDISPLAYOFFSET); // 0xD3
|
||||
SH1106_command(0x0); // no offset
|
||||
SH1106_command(SH1106_SETSTARTLINE | 0x0); // line #0
|
||||
SH1106_command(SH1106_CHARGEPUMP); // 0x8D
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x10); }
|
||||
else
|
||||
{ SH1106_command(0x14); }
|
||||
SH1106_command(SH1106_MEMORYMODE); // 0x20
|
||||
SH1106_command(0x00); // 0x0 act like ks0108
|
||||
SH1106_command(SH1106_SEGREMAP | 0x1);
|
||||
SH1106_command(SH1106_COMSCANDEC);
|
||||
SH1106_command(SH1106_SETCOMPINS); // 0xDA
|
||||
SH1106_command(0x02);
|
||||
SH1106_command(SH1106_SETCONTRAST); // 0x81
|
||||
SH1106_command(0x8F);
|
||||
SH1106_command(SH1106_SETPRECHARGE); // 0xd9
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x22); }
|
||||
else
|
||||
{ SH1106_command(0xF1); }
|
||||
SH1106_command(SH1106_SETVCOMDETECT); // 0xDB
|
||||
SH1106_command(0x40);
|
||||
SH1106_command(SH1106_DISPLAYALLON_RESUME); // 0xA4
|
||||
SH1106_command(SH1106_NORMALDISPLAY); // 0xA6
|
||||
#endif
|
||||
|
||||
#if defined SH1106_128_64
|
||||
// Init sequence for 128x64 OLED module
|
||||
SH1106_command(SH1106_DISPLAYOFF); // 0xAE
|
||||
SH1106_command(SH1106_SETDISPLAYCLOCKDIV); // 0xD5
|
||||
SH1106_command(0x80); // the suggested ratio 0x80
|
||||
SH1106_command(SH1106_SETMULTIPLEX); // 0xA8
|
||||
SH1106_command(0x3F);
|
||||
SH1106_command(SH1106_SETDISPLAYOFFSET); // 0xD3
|
||||
SH1106_command(0x00); // no offset
|
||||
|
||||
SH1106_command(SH1106_SETSTARTLINE | 0x0); // line #0 0x40
|
||||
SH1106_command(SH1106_CHARGEPUMP); // 0x8D
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x10); }
|
||||
else
|
||||
{ SH1106_command(0x14); }
|
||||
SH1106_command(SH1106_MEMORYMODE); // 0x20
|
||||
SH1106_command(0x00); // 0x0 act like ks0108
|
||||
SH1106_command(SH1106_SEGREMAP | 0x1);
|
||||
SH1106_command(SH1106_COMSCANDEC);
|
||||
SH1106_command(SH1106_SETCOMPINS); // 0xDA
|
||||
SH1106_command(0x12);
|
||||
SH1106_command(SH1106_SETCONTRAST); // 0x81
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x9F); }
|
||||
else
|
||||
{ SH1106_command(0xCF); }
|
||||
SH1106_command(SH1106_SETPRECHARGE); // 0xd9
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x22); }
|
||||
else
|
||||
{ SH1106_command(0xF1); }
|
||||
SH1106_command(SH1106_SETVCOMDETECT); // 0xDB
|
||||
SH1106_command(0x40);
|
||||
SH1106_command(SH1106_DISPLAYALLON_RESUME); // 0xA4
|
||||
SH1106_command(SH1106_NORMALDISPLAY); // 0xA6
|
||||
#endif
|
||||
|
||||
#if defined SH1106_96_16
|
||||
// Init sequence for 96x16 OLED module
|
||||
SH1106_command(SH1106_DISPLAYOFF); // 0xAE
|
||||
SH1106_command(SH1106_SETDISPLAYCLOCKDIV); // 0xD5
|
||||
SH1106_command(0x80); // the suggested ratio 0x80
|
||||
SH1106_command(SH1106_SETMULTIPLEX); // 0xA8
|
||||
SH1106_command(0x0F);
|
||||
SH1106_command(SH1106_SETDISPLAYOFFSET); // 0xD3
|
||||
SH1106_command(0x00); // no offset
|
||||
SH1106_command(SH1106_SETSTARTLINE | 0x0); // line #0
|
||||
SH1106_command(SH1106_CHARGEPUMP); // 0x8D
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x10); }
|
||||
else
|
||||
{ SH1106_command(0x14); }
|
||||
SH1106_command(SH1106_MEMORYMODE); // 0x20
|
||||
SH1106_command(0x00); // 0x0 act like ks0108
|
||||
SH1106_command(SH1106_SEGREMAP | 0x1);
|
||||
SH1106_command(SH1106_COMSCANDEC);
|
||||
SH1106_command(SH1106_SETCOMPINS); // 0xDA
|
||||
SH1106_command(0x2); //ada x12
|
||||
SH1106_command(SH1106_SETCONTRAST); // 0x81
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x10); }
|
||||
else
|
||||
{ SH1106_command(0xAF); }
|
||||
SH1106_command(SH1106_SETPRECHARGE); // 0xd9
|
||||
if (vccstate == SH1106_EXTERNALVCC)
|
||||
{ SH1106_command(0x22); }
|
||||
else
|
||||
{ SH1106_command(0xF1); }
|
||||
SH1106_command(SH1106_SETVCOMDETECT); // 0xDB
|
||||
SH1106_command(0x40);
|
||||
SH1106_command(SH1106_DISPLAYALLON_RESUME); // 0xA4
|
||||
SH1106_command(SH1106_NORMALDISPLAY); // 0xA6
|
||||
#endif
|
||||
|
||||
SH1106_command(SH1106_DISPLAYON);//--turn on oled panel
|
||||
}
|
||||
|
||||
|
||||
void Adafruit_SH1106::invertDisplay(uint8_t i) {
|
||||
if (i) {
|
||||
SH1106_command(SH1106_INVERTDISPLAY);
|
||||
} else {
|
||||
SH1106_command(SH1106_NORMALDISPLAY);
|
||||
}
|
||||
}
|
||||
|
||||
void Adafruit_SH1106::SH1106_command(uint8_t c) {
|
||||
|
||||
// I2C
|
||||
uint8_t control = 0x00; // Co = 0, D/C = 0
|
||||
Wire.beginTransmission(_i2caddr);
|
||||
WIRE_WRITE(control);
|
||||
WIRE_WRITE(c);
|
||||
Wire.endTransmission();
|
||||
|
||||
}
|
||||
|
||||
// Dim the display
|
||||
// dim = true: display is dimmed
|
||||
// dim = false: display is normal
|
||||
void Adafruit_SH1106::dim(uint8_t dim) {
|
||||
uint8_t contrast;
|
||||
|
||||
if (dim) {
|
||||
contrast = 0; // Dimmed display
|
||||
} else {
|
||||
if (_vccstate == SH1106_EXTERNALVCC) {
|
||||
contrast = 0x9F;
|
||||
} else {
|
||||
contrast = 0xCF;
|
||||
}
|
||||
}
|
||||
// the range of contrast to too small to be really useful
|
||||
// it is useful to dim the display
|
||||
SH1106_command(SH1106_SETCONTRAST);
|
||||
SH1106_command(contrast);
|
||||
}
|
||||
|
||||
void Adafruit_SH1106::SH1106_data(uint8_t c) {
|
||||
// I2C
|
||||
uint8_t control = 0x40; // Co = 0, D/C = 1
|
||||
Wire.beginTransmission(_i2caddr);
|
||||
WIRE_WRITE(control);
|
||||
WIRE_WRITE(c);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
void Adafruit_SH1106::display(void) {
|
||||
SH1106_command(SH1106_SETLOWCOLUMN | 0x0); // low col = 0
|
||||
SH1106_command(SH1106_SETHIGHCOLUMN | 0x0); // hi col = 0
|
||||
SH1106_command(SH1106_SETSTARTLINE | 0x0); // line #0
|
||||
// I2C
|
||||
//height >>= 3;
|
||||
//width >>= 3;
|
||||
byte height=64;
|
||||
byte width=132;
|
||||
byte m_row = 0;
|
||||
byte m_col = 2;
|
||||
|
||||
|
||||
height >>= 3;
|
||||
width >>= 3;
|
||||
//Serial.println(width);
|
||||
|
||||
int p = 0;
|
||||
|
||||
byte i, j, k =0;
|
||||
|
||||
for ( i = 0; i < height; i++) {
|
||||
|
||||
// send a bunch of data in one xmission
|
||||
SH1106_command(0xB0 + i + m_row);//set page address
|
||||
SH1106_command(m_col & 0xf);//set lower column address
|
||||
SH1106_command(0x10 | (m_col >> 4));//set higher column address
|
||||
|
||||
for( j = 0; j < 8; j++){
|
||||
Wire.beginTransmission(_i2caddr);
|
||||
Wire.write(0x40);
|
||||
for ( k = 0; k < width; k++, p++) {
|
||||
Wire.write(buffer[p]);
|
||||
}
|
||||
Wire.endTransmission();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// clear everything
|
||||
void Adafruit_SH1106::clearDisplay(void) {
|
||||
memset(buffer, 0, (SH1106_LCDWIDTH*SH1106_LCDHEIGHT/8));
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue