mharizanov / ESP8266_Relay_Board

Three Channel WiFi Relay/Thermostat Board
146 stars 78 forks source link

compiling issue #16

Open lordgeny opened 6 years ago

lordgeny commented 6 years ago

thanks in advance ... esp8266@esp8266-VirtualBox:~/ESP8266_Relay_Board-master/1ch_relay$ make CC driver/i2c.c In file included from driver/i2c.c:22:0: /opt/ESP8266_NONOS_SDK/include/osapi.h:45:15: error: conflicting types for 'os_random' unsigned long os_random(void); ^ In file included from driver/i2c.c:20:0: include/espmissingincludes.h:46:5: note: previous declaration of 'os_random' was here int os_random(); ^ In file included from /opt/ESP8266_NONOS_SDK/include/ets_sys.h:12:0, from include/espmissingincludes.h:4, from driver/i2c.c:20: driver/i2c.c: In function 'i2c_init': /opt/ESP8266_NONOS_SDK/include/eagle_soc.h:249:38: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses] & (~(PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S)) \ ^ /opt/ESP8266_NONOS_SDK/include/eagle_soc.h:50:98: note: in definition of macro 'WRITE_PERI_REG'

define WRITE_PERI_REG(addr, val) (((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)

                                                                                              ^

driver/i2c.c:64:5: note: in expansion of macro 'PIN_FUNC_SELECT' PIN_FUNC_SELECT(I2C_SDA_MUX, I2C_SDA_FUNC); ^ /opt/ESP8266_NONOS_SDK/include/eagle_soc.h:249:38: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses] & (~(PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S)) \ ^ /opt/ESP8266_NONOS_SDK/include/eagle_soc.h:50:98: note: in definition of macro 'WRITE_PERI_REG'

define WRITE_PERI_REG(addr, val) (((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)

                                                                                              ^

driver/i2c.c:65:5: note: in expansion of macro 'PIN_FUNC_SELECT' PIN_FUNC_SELECT(I2C_SCK_MUX, I2C_SCK_FUNC); ^ cc1: all warnings being treated as errors make: *** [build/driver/i2c.o] Error 1 esp8266@esp8266-VirtualBox:~/ESP8266_Relay_Board-master/1ch_relay$

mharizanov commented 6 years ago

try inserting this fragment in i2c.h

//Standard PIN_FUNC_SELECT gives a warning. Replace by a non-warning one.

ifdef PIN_FUNC_SELECT

undef PIN_FUNC_SELECT

define PIN_FUNC_SELECT(PIN_NAME, FUNC) do { \

WRITE_PERI_REG(PIN_NAME,   \
                            (READ_PERI_REG(PIN_NAME) \
                                 &  (~(PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S)))  \
                                 |( (((FUNC&BIT2)<<2)|(FUNC&0x3))<<PERIPHS_IO_MUX_FUNC_S) );  \
} while (0)

endif

lordgeny commented 6 years ago

ifndef __I2C_H__

define __I2C_H__

endif

/* I2C driver for the ESP8266 Copyright (C) 2014 Rudy Hardeman (zarya)

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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

*/

include "ets_sys.h"

include "osapi.h"

include "gpio.h"

define I2C_SLEEP_TIME 10

ifdef PIN_FUNC_SELECT

undef PIN_FUNC_SELECT

define PIN_FUNC_SELECT(PIN_NAME, FUNC) do {

WRITE_PERI_REG(PIN_NAME, (READ_PERI_REG(PIN_NAME) & (~(PERIPHS_IO_MUX_FUNC<<PERIPHS_IO_MUX_FUNC_S))) |( (((FUNC&BIT2)<<2)|(FUNC&0x3))<<PERIPHS_IO_MUX_FUNC_S) ); } while (0)

endif

//SDA on GPIO2 //#define I2C_SDA_MUX PERIPHS_IO_MUX_GPIO2_U //#define I2C_SDA_FUNC FUNC_GPIO2 //#define I2C_SDA_PIN 2

//SDA on GPIO14

define I2C_SDA_MUX PERIPHS_IO_MUX_MTMS_U

define I2C_SDA_FUNC FUNC_GPIO14

define I2C_SDA_PIN 14

//SCK on GPIO0

define I2C_SCK_MUX PERIPHS_IO_MUX_GPIO0_U

define I2C_SCK_PIN 0

define I2C_SCK_FUNC FUNC_GPIO0

define i2c_read() GPIO_INPUT_GET(GPIO_ID_PIN(I2C_SDA_PIN));

void i2c_init(void); void i2c_start(void); void i2c_stop(void); void i2c_send_ack(uint8 state); uint8 i2c_check_ack(void); uint8 i2c_readByte(void); void i2c_writeByte(uint8 data);

the error: esp8266@esp8266-VirtualBox:~/ESP8266_Relay_Board-master/1ch_relay$ make CC driver/i2c.c In file included from driver/i2c.c:20:0: include/espmissingincludes.h:17:6: error: conflicting types for 'ets_isr_attach' void ets_isr_attach(int intr, void handler, void arg); ^ In file included from include/espmissingincludes.h:4:0, from driver/i2c.c:20: /opt/ESP8266_SDK/include/ets_sys.h:67:6: note: previous declaration of 'ets_isr_attach' was here void ets_isr_attach(int i, ets_isr_t func, void arg); ^ In file included from driver/i2c.c:22:0: /opt/ESP8266_SDK/include/osapi.h:33:6: error: conflicting types for 'ets_delay_us' void ets_delay_us(uint16_t us); ^ In file included from driver/i2c.c:20:0: include/espmissingincludes.h:49:6: note: previous declaration of 'ets_delay_us' was here void ets_delay_us(long us); ^ In file included from driver/i2c.c:22:0: /opt/ESP8266_SDK/include/osapi.h:34:6: error: conflicting types for 'ets_install_putc1' void ets_install_putc1(void (p)(char c)); ^ In file included from driver/i2c.c:20:0: include/espmissingincludes.h:16:6: note: previous declaration of 'ets_install_putc1' was here void ets_install_putc1(void routine); ^ In file included from driver/i2c.c:22:0: /opt/ESP8266_SDK/include/osapi.h:47:5: error: conflicting types for 'ets_strlen' int ets_strlen(const char s); ^ In file included from driver/i2c.c:20:0: include/espmissingincludes.h:27:8: note: previous declaration of 'ets_strlen' was here size_t ets_strlen(const char s); ^ In file included from driver/i2c.c:22:0: /opt/ESP8266_SDK/include/osapi.h:48:5: error: conflicting types for 'ets_strncmp' int ets_strncmp(const char s1, const char s2, unsigned int n); ^ In file included from driver/i2c.c:20:0: include/espmissingincludes.h:28:5: note: previous declaration of 'ets_strncmp' was here int ets_strncmp(const char s1, const char s2, int len); ^ In file included from driver/i2c.c:22:0: /opt/ESP8266_SDK/include/osapi.h:65:6: error: conflicting types for 'ets_timer_arm_new' void ets_timer_arm_new(os_timer_t ptimer, uint32_t time, bool repeat_flag, bool ms_flag); ^ In file included from driver/i2c.c:20:0: include/espmissingincludes.h:31:6: note: previous declaration of 'ets_timer_arm_new' was here void ets_timer_arm_new(ETSTimer *a, int b, int c, int isMstimer); ^ In file included from driver/i2c.c:22:0: /opt/ESP8266_SDK/include/osapi.h:90:15: error: conflicting types for 'os_random' unsigned long os_random(void); ^ In file included from driver/i2c.c:20:0: include/espmissingincludes.h:46:5: note: previous declaration of 'os_random' was here int os_random(); ^ In file included from /opt/ESP8266_SDK/include/ets_sys.h:29:0, from include/espmissingincludes.h:4, from driver/i2c.c:20: /opt/ESP8266_SDK/include/eagle_soc.h:69:39: error: expected identifier or '(' before 'volatile'

define WRITE_PERI_REG(addr, val) (((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)

                                   ^

include/driver/i2c.h:33:1: note: in expansion of macro 'WRITE_PERI_REG' WRITE_PERI_REG(PIN_NAME, ^ /opt/ESP8266_SDK/include/eagle_soc.h:64:33: error: expected ')' before '(' token

define ETS_UNCACHED_ADDR(addr) (addr)

                             ^

/opt/ESP8266_SDK/include/eagle_soc.h:69:59: note: in expansion of macro 'ETS_UNCACHED_ADDR'

define WRITE_PERI_REG(addr, val) (((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)

                                                       ^

include/driver/i2c.h:33:1: note: in expansion of macro 'WRITE_PERI_REG' WRITE_PERI_REG(PIN_NAME, ^ In file included from driver/i2c.c:24:0: include/driver/i2c.h:37:1: error: expected identifier or '(' before '}' token } while (0) ^ include/driver/i2c.h:37:3: error: expected identifier or '(' before 'while' } while (0) ^ driver/i2c.c: In function 'i2c_init': driver/i2c.c:96:1: error: expected 'while' before 'void' void ICACHE_FLASH_ATTR ^ driver/i2c.c:233:1: error: expected declaration or statement at end of input } ^ driver/i2c.c:233:1: error: expected declaration or statement at end of input make: *** [build/driver/i2c.o] Error 1 esp8266@esp8266-VirtualBox:~/ESP8266_Relay_Board-master/1ch_relay$

lordgeny commented 6 years ago

maybe i writed i2c.h with error

lordgeny commented 6 years ago

someone have bin files already compiled ???