Z tego co pamiętam.
Z przyciskiem na gpio14 i dht ( lub ds-em ) na gpio3 nie powinno być problemu, ale ds-a na gpio1 (TX), nie można ustawić ( nie działa ).
IOT SDK
i właśnie tyle mi działa
na gpio3 daje DS albo DHT i działa
a na gpio1 niechce
dzięki za potwierdzenie,
W takim razie muszę pokombinować z wyborem w konfigu DS albo DHT na GPIO3
czy ktoś pomoże ?
Na GPIO 1 (TX) wszystko powinno działać bezproblematycznie, przynajmniej ja mam takie doświadczenia. Jedyne ograniczenie tego pinu jest takie, że podczas włączenia zasilania modułu ESP nie może on być na potencjale masy. Dlatego też nie można na nim stosować kontaktronów i przycisków bistabilnych, bo może tak się zdażyć, że będą w położeniu zawierającym pin do masy i moduł nie wstanie przy resecie lub power on.
"w supla_esp_gpio.c" dopisz
#ifdef USE_GPIO1_INPUT
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
PIN_PULLUP_EN(PERIPHS_IO_MUX_U0TXD_U);
#endif
Dopisz obsługę pinu GPIO1 w "supla_w1.c" poprzez analogię do innych pinów.
a w definicji płytki pliku *.h
#define USE_GPIO1_INPUT
#define W1_GPIO1
Dzięki !!!
Czy mógłbyś sprawdzić poprawność zmian w pliku "supla_w1.c", bo reszta jest ( dla mnie ) prosta.
I ewentualnie mnie poprawił.
Czy mógłbyś sprawdzić poprawność zmian w pliku "supla_w1.c", bo reszta jest ( dla mnie ) prosta.
I ewentualnie mnie poprawił.
Kod: Zaznacz cały
/*
Copyright (C) AC SOFTWARE SP. Z O.O.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <os_type.h>
#include <osapi.h>
#include <eagle_soc.h>
#include <gpio.h>
#include "supla_w1.h"
#ifdef W1_GPIO0
int supla_w1_pin = GPIO_ID_PIN(0);
#elif defined(W1_GPIO1)
int supla_w1_pin = GPIO_ID_PIN(1); // nowy dla TX
#elif defined(W1_GPIO4)
int supla_w1_pin = GPIO_ID_PIN(4);
#elif defined(W1_GPIO5)
int supla_w1_pin = GPIO_ID_PIN(5);
#elif defined(W1_GPIO3)
int supla_w1_pin = GPIO_ID_PIN(3);
#elif defined(W1_GPIO14)
int supla_w1_pin = GPIO_ID_PIN(14);
#else
int supla_w1_pin = GPIO_ID_PIN(2);
#endif
void ICACHE_FLASH_ATTR supla_w1_init(void) {
#ifdef W1_GPIO0
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);
PIN_PULLUP_EN(PERIPHS_IO_MUX_GPIO0_U);
#elif defined(W1_GPIO1)
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1); // nowy dla TX
PIN_PULLUP_EN(PERIPHS_IO_MUX_U0TXD_U); // nowy dla TX
#elif defined(W1_GPIO4)
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
PIN_PULLUP_EN(PERIPHS_IO_MUX_GPIO4_U);
#elif defined(W1_GPIO5)
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5);
PIN_PULLUP_EN(PERIPHS_IO_MUX_GPIO5_U);
#elif defined(W1_GPIO3)
system_uart_swap ();
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_GPIO3);
PIN_PULLUP_EN(PERIPHS_IO_MUX_U0RXD_U);
#elif defined(W1_GPIO14)
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14);
PIN_PULLUP_EN(PERIPHS_IO_MUX_MTMS_U);
#else
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
PIN_PULLUP_EN(PERIPHS_IO_MUX_GPIO2_U);
#endif
GPIO_DIS_OUTPUT( supla_w1_pin );
}