IOT SDK

Patryk
Posts: 2944
Joined: Mon Jan 07, 2019 7:51 pm
Location: Rybnik

Post

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 ).
User avatar
lukfud
Posts: 2480
Joined: Thu Nov 23, 2017 11:33 pm
Location: Warszawa
Has thanked: 13 times
Been thanked: 11 times

Post

Patryk wrote: Wed Nov 04, 2020 2:30 pm 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 ).
Mi na TX(1) pod arduino działają 4 ds'y
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
Patryk
Posts: 2944
Joined: Mon Jan 07, 2019 7:51 pm
Location: Rybnik

Post

Ok.
Ale to nie jest Arduino, tylko IOT SDK.
User avatar
lukfud
Posts: 2480
Joined: Thu Nov 23, 2017 11:33 pm
Location: Warszawa
Has thanked: 13 times
Been thanked: 11 times

Post

Patryk wrote: Wed Nov 04, 2020 2:54 pm Ok.
Ale to nie jest Arduino, tylko IOT SDK.
Rozumiem, już się nie odzywam ;)
https://www.facebook.com/groups/supladiy
https://www.facebook.com/groups/suplazamel
https://www.facebook.com/groups/suplaauraton
https://smartnerzeczy.pl
bicker
Posts: 483
Joined: Tue Feb 02, 2016 8:18 am

Post

Patryk wrote: Wed Nov 04, 2020 2:30 pm 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 ).
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 ?
Zybi
Posts: 1511
Joined: Sun Jun 26, 2016 4:24 pm

Post

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.
Patryk
Posts: 2944
Joined: Mon Jan 07, 2019 7:51 pm
Location: Rybnik

Post

@Zybi , a mógł byś udostępnić jakiś prosty przykład ( kod źródłowy ) np dla sonoff-a z ds-em na gpio1 ( TX ).
Ja swego czasu próbowałem, ale bezskutecznie.
Zybi
Posts: 1511
Joined: Sun Jun 26, 2016 4:24 pm

Post

Patryk wrote: Wed Nov 04, 2020 4:25 pm @Zybi , a mógł byś udostępnić jakiś prosty przykład ( kod źródłowy ) np dla sonoff-a z ds-em na gpio1 ( TX ).
Ja swego czasu próbowałem, ale bezskutecznie.
"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
Patryk
Posts: 2944
Joined: Mon Jan 07, 2019 7:51 pm
Location: Rybnik

Post

Dzięki !!!
Czy mógłbyś sprawdzić poprawność zmian w pliku "supla_w1.c", bo reszta jest ( dla mnie ) prosta.
I ewentualnie mnie poprawił.

Code: Select all

/*
 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 );
}
Zybi
Posts: 1511
Joined: Sun Jun 26, 2016 4:24 pm

Post

Kompiluj, powinno działać.

Return to “Zagadnienia ogólne”