mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Breaking change replaced NRF24L01 GPIO selection
Breaking change replaced NRF24L01 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_NRF24_CS`` and ``GPIO_SPI_DC`` by ``GPIO_NRF24_DC``
This commit is contained in:
parent
3c36962a58
commit
01f3a7da19
@ -6,12 +6,13 @@ All notable changes to this project will be documented in this file.
|
|||||||
## [9.2.0.2]
|
## [9.2.0.2]
|
||||||
### Added
|
### Added
|
||||||
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin (#8630)
|
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin (#8630)
|
||||||
- Command ``CTRange`` to specify the visible CT range the bulb is capable of
|
- Command ``CTRange`` to specify the visible CT range the bulb is capable of (#10311)
|
||||||
- Command ``VirtualCT`` to simulate or fine tune CT bulbs with 3,4,5 channels
|
- Command ``VirtualCT`` to simulate or fine tune CT bulbs with 3,4,5 channels (#10311)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_RC522_CS``
|
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_RC522_CS``
|
||||||
- Replaced ILI9341 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_ILI9341_CS`` and ``GPIO_SPI_DC`` by ``GPIO_ILI9341_DC``
|
- Replaced ILI9341 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_ILI9341_CS`` and ``GPIO_SPI_DC`` by ``GPIO_ILI9341_DC``
|
||||||
|
- Replaced NRF24L01 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_NRF24_CS`` and ``GPIO_SPI_DC`` by ``GPIO_NRF24_DC``
|
||||||
|
|
||||||
## [9.2.0.1] 20201229
|
## [9.2.0.1] 20201229
|
||||||
### Added
|
### Added
|
||||||
|
@ -58,6 +58,8 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
|
|
||||||
## Changelog v9.2.0.2
|
## Changelog v9.2.0.2
|
||||||
### Added
|
### Added
|
||||||
|
- Command ``CTRange`` to specify the visible CT range the bulb is capable of [#10311](https://github.com/arendst/Tasmota/issues/10311)
|
||||||
|
- Command ``VirtualCT`` to simulate or fine tune CT bulbs with 3,4,5 channels [#10311](https://github.com/arendst/Tasmota/issues/10311)
|
||||||
- Milliseconds to console output [#10152](https://github.com/arendst/Tasmota/issues/10152)
|
- Milliseconds to console output [#10152](https://github.com/arendst/Tasmota/issues/10152)
|
||||||
- Gpio ``Option_a1`` enabling PWM2 high impedance if powered off as used by Wyze bulbs [#10196](https://github.com/arendst/Tasmota/issues/10196)
|
- Gpio ``Option_a1`` enabling PWM2 high impedance if powered off as used by Wyze bulbs [#10196](https://github.com/arendst/Tasmota/issues/10196)
|
||||||
- BSSID and Signal Strength Indicator to GUI wifi scan result [#10253](https://github.com/arendst/Tasmota/issues/10253)
|
- BSSID and Signal Strength Indicator to GUI wifi scan result [#10253](https://github.com/arendst/Tasmota/issues/10253)
|
||||||
@ -73,6 +75,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_RC522_CS``
|
- Replaced MFRC522 13.56MHz rfid card reader GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_RC522_CS``
|
||||||
- Replaced ILI9341 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_ILI9341_CS`` and ``GPIO_SPI_DC`` by ``GPIO_ILI9341_DC``
|
- Replaced ILI9341 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_ILI9341_CS`` and ``GPIO_SPI_DC`` by ``GPIO_ILI9341_DC``
|
||||||
|
- Replaced NRF24L01 GPIO selection from ``GPIO_SPI_CS`` by ``GPIO_NRF24_CS`` and ``GPIO_SPI_DC`` by ``GPIO_NRF24_DC``
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Logging from heap to stack freeing 700 bytes RAM
|
- Logging from heap to stack freeing 700 bytes RAM
|
||||||
|
@ -1479,8 +1479,7 @@ bool FlashPin(uint32_t pin)
|
|||||||
return (((pin > 5) && (pin < 9)) || (11 == pin));
|
return (((pin > 5) && (pin < 9)) || (11 == pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ValidPin(uint32_t pin, uint32_t gpio)
|
uint32_t ValidPin(uint32_t pin, uint32_t gpio) {
|
||||||
{
|
|
||||||
if (FlashPin(pin)) {
|
if (FlashPin(pin)) {
|
||||||
return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
|
return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
|
||||||
}
|
}
|
||||||
@ -1495,8 +1494,7 @@ uint32_t ValidPin(uint32_t pin, uint32_t gpio)
|
|||||||
return gpio;
|
return gpio;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValidGPIO(uint32_t pin, uint32_t gpio)
|
bool ValidGPIO(uint32_t pin, uint32_t gpio) {
|
||||||
{
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#ifdef USE_ADC_VCC
|
#ifdef USE_ADC_VCC
|
||||||
if (ADC0_PIN == pin) { return false; } // ADC0 = GPIO17
|
if (ADC0_PIN == pin) { return false; } // ADC0 = GPIO17
|
||||||
@ -1505,6 +1503,17 @@ bool ValidGPIO(uint32_t pin, uint32_t gpio)
|
|||||||
return (GPIO_USER == ValidPin(pin, BGPIO(gpio))); // Only allow GPIO_USER pins
|
return (GPIO_USER == ValidPin(pin, BGPIO(gpio))); // Only allow GPIO_USER pins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ValidSpiGPIO(uint32_t gpio) {
|
||||||
|
// ESP8266: If SPI pin selected chk if it's not one of the three Hardware SPI pins (12..14)
|
||||||
|
bool result = true; // Not used and therefore valid
|
||||||
|
uint32_t pin;
|
||||||
|
if (PinUsed(gpio)) {
|
||||||
|
pin = Pin(gpio);
|
||||||
|
result = ((pin < 12) || (pin > 14));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool JsonTemplate(char* dataBuf)
|
bool JsonTemplate(char* dataBuf)
|
||||||
{
|
{
|
||||||
// Old: {"NAME":"Shelly 2.5","GPIO":[56,0,17,0,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}
|
// Old: {"NAME":"Shelly 2.5","GPIO":[56,0,17,0,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}
|
||||||
|
@ -1599,26 +1599,20 @@ void GpioInit(void)
|
|||||||
TasmotaGlobal.soft_spi_enabled = (PinUsed(GPIO_SSPI_SCLK) && (PinUsed(GPIO_SSPI_MOSI) || PinUsed(GPIO_SSPI_MISO)));
|
TasmotaGlobal.soft_spi_enabled = (PinUsed(GPIO_SSPI_SCLK) && (PinUsed(GPIO_SSPI_MOSI) || PinUsed(GPIO_SSPI_MISO)));
|
||||||
|
|
||||||
#ifdef USE_SPI
|
#ifdef USE_SPI
|
||||||
uint32_t pin_cs = Pin(GPIO_SPI_CS);
|
|
||||||
uint32_t pin_dc = Pin(GPIO_SPI_DC);
|
|
||||||
if (PinUsed(GPIO_RC522_CS)) {
|
|
||||||
pin_cs = Pin(GPIO_RC522_CS);
|
|
||||||
}
|
|
||||||
if (PinUsed(GPIO_ILI9341_CS)) {
|
|
||||||
pin_cs = Pin(GPIO_ILI9341_CS);
|
|
||||||
if (PinUsed(GPIO_ILI9341_DC)) {
|
|
||||||
pin_dc = Pin(GPIO_ILI9341_DC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
if (!TasmotaGlobal.soft_spi_enabled) {
|
if (!TasmotaGlobal.soft_spi_enabled) {
|
||||||
// If SPI_CS is used it must be valid
|
bool valid_cs = (ValidSpiGPIO(GPIO_SPI_CS) &&
|
||||||
TasmotaGlobal.spi_enabled = ((pin_cs < 99) && ((pin_cs > 14) || (pin_cs < 12)));
|
ValidSpiGPIO(GPIO_RC522_CS) &&
|
||||||
if (TasmotaGlobal.spi_enabled && (pin_dc < 99)) {
|
ValidSpiGPIO(GPIO_NRF24_CS) &&
|
||||||
// If SPI_DC is used it must be valid
|
ValidSpiGPIO(GPIO_ILI9341_CS)
|
||||||
TasmotaGlobal.spi_enabled = ((pin_dc > 14) || (pin_dc < 12));
|
);
|
||||||
}
|
bool valid_dc = (ValidSpiGPIO(GPIO_SPI_DC) &&
|
||||||
|
ValidSpiGPIO(GPIO_NRF24_DC) &&
|
||||||
|
ValidSpiGPIO(GPIO_ILI9341_DC)
|
||||||
|
);
|
||||||
|
|
||||||
|
// If SPI_CS and/or SPI_DC is used they must be valid
|
||||||
|
TasmotaGlobal.spi_enabled = (valid_cs && valid_dc);
|
||||||
if (TasmotaGlobal.spi_enabled) {
|
if (TasmotaGlobal.spi_enabled) {
|
||||||
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
||||||
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
||||||
@ -1631,57 +1625,26 @@ void GpioInit(void)
|
|||||||
}
|
}
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
if (pin_cs < 99) {
|
if (PinUsed(GPIO_SPI_CS) ||
|
||||||
/*
|
PinUsed(GPIO_RC522_CS) ||
|
||||||
// Do not do this as ESP32 can have SPI_CS everywhere
|
PinUsed(GPIO_NRF24_CS) ||
|
||||||
if ((15 == pin_cs) && (!GetPin(12) && !GetPin(13) && !GetPin(14))) { // HSPI
|
PinUsed(GPIO_ILI9341_CS)
|
||||||
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
) {
|
||||||
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
TasmotaGlobal.spi_enabled = true;
|
||||||
TasmotaGlobal.my_module.io[13] = AGPIO(GPIO_SPI_MOSI);
|
if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_CLK)) {
|
||||||
SetPin(13, AGPIO(GPIO_SPI_MOSI));
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO), GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
||||||
TasmotaGlobal.my_module.io[14] = AGPIO(GPIO_SPI_CLK);
|
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
||||||
SetPin(14, AGPIO(GPIO_SPI_CLK));
|
|
||||||
}
|
}
|
||||||
else if ((5 == pin_cs) && (!GetPin(19) && !GetPin(23) && !GetPin(18))) { // VSPI
|
else if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_CLK)) {
|
||||||
TasmotaGlobal.my_module.io[19] = AGPIO(GPIO_SPI_MISO);
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
||||||
SetPin(19, AGPIO(GPIO_SPI_MISO));
|
Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
||||||
TasmotaGlobal.my_module.io[23] = AGPIO(GPIO_SPI_MOSI);
|
|
||||||
SetPin(23, AGPIO(GPIO_SPI_MOSI));
|
|
||||||
TasmotaGlobal.my_module.io[18] = AGPIO(GPIO_SPI_CLK);
|
|
||||||
SetPin(18, AGPIO(GPIO_SPI_CLK));
|
|
||||||
}
|
}
|
||||||
else if ((12 == Pin(GPIO_SPI_MISO)) || (13 == Pin(GPIO_SPI_MOSI)) || (14 == Pin(GPIO_SPI_CLK))) { // HSPI
|
else if (PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_CLK)) {
|
||||||
TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO);
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO) and GPIO%02d(CLK)"),
|
||||||
SetPin(12, AGPIO(GPIO_SPI_MISO));
|
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_CLK));
|
||||||
TasmotaGlobal.my_module.io[13] = AGPIO(GPIO_SPI_MOSI);
|
} else {
|
||||||
SetPin(13, AGPIO(GPIO_SPI_MOSI));
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Failed as no CLK and MISO and/or MOSI GPIO defined"));
|
||||||
TasmotaGlobal.my_module.io[14] = AGPIO(GPIO_SPI_CLK);
|
TasmotaGlobal.spi_enabled = false;
|
||||||
SetPin(14, AGPIO(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
else if ((19 == Pin(GPIO_SPI_MISO)) || (23 == Pin(GPIO_SPI_MOSI)) || (18 == Pin(GPIO_SPI_CLK))) { // VSPI
|
|
||||||
TasmotaGlobal.my_module.io[19] = AGPIO(GPIO_SPI_MISO);
|
|
||||||
SetPin(19, AGPIO(GPIO_SPI_MISO));
|
|
||||||
TasmotaGlobal.my_module.io[23] = AGPIO(GPIO_SPI_MOSI);
|
|
||||||
SetPin(23, AGPIO(GPIO_SPI_MOSI));
|
|
||||||
TasmotaGlobal.my_module.io[18] = AGPIO(GPIO_SPI_CLK);
|
|
||||||
SetPin(18, AGPIO(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
TasmotaGlobal.spi_enabled = (PinUsed(GPIO_SPI_CLK) && (PinUsed(GPIO_SPI_MOSI) || PinUsed(GPIO_SPI_MISO)));
|
|
||||||
*/
|
|
||||||
TasmotaGlobal.spi_enabled = (pin_cs < 99);
|
|
||||||
if (TasmotaGlobal.spi_enabled) {
|
|
||||||
if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_CLK)) {
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO), GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
|
||||||
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
else if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_CLK)) {
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MOSI) and GPIO%02d(CLK)"),
|
|
||||||
Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
else if (PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_CLK)) {
|
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("SPI: Using GPIO%02d(MISO) and GPIO%02d(CLK)"),
|
|
||||||
Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_CLK));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
@ -46,6 +46,11 @@
|
|||||||
#undef CODE_IMAGE_STR
|
#undef CODE_IMAGE_STR
|
||||||
#define CODE_IMAGE_STR "odroid-go"
|
#define CODE_IMAGE_STR "odroid-go"
|
||||||
|
|
||||||
|
#undef MODULE
|
||||||
|
#define MODULE ODROID_GO // [Module] Select default module from tasmota_template.h
|
||||||
|
#undef FALLBACK_MODULE
|
||||||
|
#define FALLBACK_MODULE ODROID_GO // [Module2] Select default module on fast reboot where USER_MODULE is user template
|
||||||
|
|
||||||
#define USE_ODROID_GO // Add support for Odroid Go
|
#define USE_ODROID_GO // Add support for Odroid Go
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define USE_SPI
|
#define USE_SPI
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* NRF24l01(+)
|
* NRF24l01(+)
|
||||||
*
|
*
|
||||||
* Usage: 5 SPI-data-wires plus VVC/ground, use hardware SPI, select GPIO_SPI_CS/GPIO_SPI_DC
|
* Usage: 5 SPI-data-wires plus VVC/ground, use hardware SPI, select GPIO_NRF24_CS/GPIO_NRF24_DC
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
#define XDRV_33 33
|
#define XDRV_33 33
|
||||||
@ -51,28 +51,26 @@ struct {
|
|||||||
|
|
||||||
RF24 NRF24radio;
|
RF24 NRF24radio;
|
||||||
|
|
||||||
bool NRF24initRadio()
|
bool NRF24initRadio() {
|
||||||
{
|
NRF24radio.begin(Pin(GPIO_NRF24_CS), Pin(GPIO_NRF24_DC));
|
||||||
NRF24radio.begin(Pin(GPIO_SPI_CS),Pin(GPIO_SPI_DC));
|
|
||||||
NRF24radio.powerUp();
|
NRF24radio.powerUp();
|
||||||
|
|
||||||
if(NRF24radio.isChipConnected()){
|
if (NRF24radio.isChipConnected()) {
|
||||||
DEBUG_DRIVER_LOG(PSTR("NRF24 chip connected"));
|
DEBUG_DRIVER_LOG(PSTR("NRF: Chip connected"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
DEBUG_DRIVER_LOG(PSTR("NRF24 chip NOT !!!! connected"));
|
DEBUG_DRIVER_LOG(PSTR("NRF: Chip NOT !!!! connected"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NRF24Detect(void)
|
bool NRF24Detect(void) {
|
||||||
{
|
if (PinUsed(GPIO_NRF24_CS) && PinUsed(GPIO_NRF24_DC)) {
|
||||||
if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_DC)) {
|
if (NRF24initRadio()) {
|
||||||
if(NRF24initRadio()){
|
|
||||||
NRF24.chipType = 32; // SPACE
|
NRF24.chipType = 32; // SPACE
|
||||||
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF24L01 initialized"));
|
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF: Model 24L01 initialized"));
|
||||||
if(NRF24radio.isPVariant()){
|
if (NRF24radio.isPVariant()) {
|
||||||
NRF24.chipType = 43; // +
|
NRF24.chipType = 43; // +
|
||||||
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF24L01+ detected"));
|
AddLog_P(LOG_LEVEL_INFO,PSTR("NRF: Model 24L01+ detected"));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -84,12 +82,13 @@ bool NRF24Detect(void)
|
|||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
bool Xdrv33(uint8_t function)
|
bool Xdrv33(uint8_t function) {
|
||||||
{
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (FUNC_INIT == function) {
|
if (TasmotaGlobal.spi_enabled) {
|
||||||
result = NRF24Detect();
|
if (FUNC_INIT == function) {
|
||||||
|
result = NRF24Detect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,7 @@ bool Ili9341Header(void) {
|
|||||||
return (tft_cols > 17);
|
return (tft_cols > 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341InitMode(void)
|
void Ili9341InitMode(void) {
|
||||||
{
|
|
||||||
tft->setRotation(Settings.display_rotate); // 0
|
tft->setRotation(Settings.display_rotate); // 0
|
||||||
tft->invertDisplay(0);
|
tft->invertDisplay(0);
|
||||||
tft->fillScreen(ILI9341_BLACK);
|
tft->fillScreen(ILI9341_BLACK);
|
||||||
@ -78,8 +77,7 @@ void Ili9341InitMode(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341Init(uint8_t mode)
|
void Ili9341Init(uint8_t mode) {
|
||||||
{
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case DISPLAY_INIT_MODE:
|
case DISPLAY_INIT_MODE:
|
||||||
Ili9341InitMode();
|
Ili9341InitMode();
|
||||||
@ -95,24 +93,11 @@ void Ili9341Init(uint8_t mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341InitDriver(void)
|
void Ili9341InitDriver(void) {
|
||||||
{
|
if (PinUsed(GPIO_ILI9341_CS) && PinUsed(GPIO_ILI9341_DC)) {
|
||||||
uint32_t pin_cs = Pin(GPIO_SPI_CS);
|
|
||||||
uint32_t pin_dc = Pin(GPIO_SPI_DC);
|
|
||||||
if (!Settings.display_model) {
|
|
||||||
if (PinUsed(GPIO_ILI9341_CS)) {
|
|
||||||
pin_cs = Pin(GPIO_ILI9341_CS);
|
|
||||||
if (PinUsed(GPIO_ILI9341_DC)) {
|
|
||||||
pin_dc = Pin(GPIO_ILI9341_DC);
|
|
||||||
}
|
|
||||||
Settings.display_model = XDSP_04;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy
|
|
||||||
Settings.display_model = XDSP_04;
|
Settings.display_model = XDSP_04;
|
||||||
}
|
|
||||||
|
|
||||||
if (XDSP_04 == Settings.display_model) {
|
|
||||||
if (Settings.display_width != ILI9341_TFTWIDTH) {
|
if (Settings.display_width != ILI9341_TFTWIDTH) {
|
||||||
Settings.display_width = ILI9341_TFTWIDTH;
|
Settings.display_width = ILI9341_TFTWIDTH;
|
||||||
}
|
}
|
||||||
@ -120,7 +105,7 @@ void Ili9341InitDriver(void)
|
|||||||
Settings.display_height = ILI9341_TFTHEIGHT;
|
Settings.display_height = ILI9341_TFTHEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
tft = new Adafruit_ILI9341(pin_cs, pin_dc);
|
tft = new Adafruit_ILI9341(Pin(GPIO_ILI9341_CS), Pin(GPIO_ILI9341_DC));
|
||||||
tft->begin();
|
tft->begin();
|
||||||
|
|
||||||
#ifdef USE_DISPLAY_MODES1TO5
|
#ifdef USE_DISPLAY_MODES1TO5
|
||||||
@ -135,14 +120,12 @@ void Ili9341InitDriver(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341Clear(void)
|
void Ili9341Clear(void) {
|
||||||
{
|
|
||||||
tft->fillScreen(ILI9341_BLACK);
|
tft->fillScreen(ILI9341_BLACK);
|
||||||
tft->setCursor(0, 0);
|
tft->setCursor(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341DrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint8_t flag)
|
void Ili9341DrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint8_t flag) {
|
||||||
{
|
|
||||||
uint16_t active_color = ILI9341_WHITE;
|
uint16_t active_color = ILI9341_WHITE;
|
||||||
|
|
||||||
tft->setTextSize(Settings.display_size);
|
tft->setTextSize(Settings.display_size);
|
||||||
@ -156,8 +139,7 @@ void Ili9341DrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint
|
|||||||
tft->println(str);
|
tft->println(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341DisplayOnOff()
|
void Ili9341DisplayOnOff() {
|
||||||
{
|
|
||||||
// tft->showDisplay(disp_power);
|
// tft->showDisplay(disp_power);
|
||||||
// tft->invertDisplay(disp_power);
|
// tft->invertDisplay(disp_power);
|
||||||
if (PinUsed(GPIO_BACKLIGHT)) {
|
if (PinUsed(GPIO_BACKLIGHT)) {
|
||||||
@ -170,8 +152,7 @@ void Ili9341DisplayOnOff()
|
|||||||
|
|
||||||
#ifdef USE_DISPLAY_MODES1TO5
|
#ifdef USE_DISPLAY_MODES1TO5
|
||||||
|
|
||||||
void Ili9341PrintLog(void)
|
void Ili9341PrintLog(void) {
|
||||||
{
|
|
||||||
disp_refresh--;
|
disp_refresh--;
|
||||||
if (!disp_refresh) {
|
if (!disp_refresh) {
|
||||||
disp_refresh = Settings.display_refresh;
|
disp_refresh = Settings.display_refresh;
|
||||||
@ -217,8 +198,7 @@ void Ili9341PrintLog(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341Refresh(void) // Every second
|
void Ili9341Refresh(void) { // Every second
|
||||||
{
|
|
||||||
if (Settings.display_mode) { // Mode 0 is User text
|
if (Settings.display_mode) { // Mode 0 is User text
|
||||||
// 24-04-2017 13:45:43 = 19 + 1 ('\0') = 20
|
// 24-04-2017 13:45:43 = 19 + 1 ('\0') = 20
|
||||||
// 24-04-2017 13:45 = 16 + 1 ('\0') = 17
|
// 24-04-2017 13:45 = 16 + 1 ('\0') = 17
|
||||||
@ -263,8 +243,7 @@ void Ili9341Refresh(void) // Every second
|
|||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
bool Xdsp04(uint8_t function)
|
bool Xdsp04(uint8_t function) {
|
||||||
{
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (TasmotaGlobal.spi_enabled) {
|
if (TasmotaGlobal.spi_enabled) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user