Skip to content

Commit

Permalink
I2C slave support (originally by bjoham) (#5226)
Browse files Browse the repository at this point in the history
* I2C slave support; resolving conflicts against current master

* removed unused argument, updateded to hopefully pass Travis

* cleaning up commit as requested by #5162 (review)

* cleaning up commit as requested by #5162 (review)

* type fix
  • Loading branch information
suculent authored and devyte committed Oct 26, 2018
1 parent 42c977b commit cb05b86
Show file tree
Hide file tree
Showing 4 changed files with 890 additions and 86 deletions.
Loading

6 comments on commit cb05b86

@reaper7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is wrong with this commit...
I try to compile sonoff-tasmota (generic-8285) and with this commit I got compilation error:

C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\libraries\Wire\Wire.cpp: In member function 'void TwoWire::begin(uint8_t)':

C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\libraries\Wire\Wire.cpp:84:42: error: invalid conversion from 'void (*)(uint8_t*, int) {aka void (*)(unsigned char*, int)}' to 'void (*)(uint8_t*, size_t) {aka void (*)(unsigned char*, unsigned int)}' [-fpermissive]

   twi_attachSlaveRxEvent(onReceiveService);

                                          ^

In file included from C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\libraries\Wire\Wire.cpp:31:0:

C:\PROGRAMY\Arduino\hardware\esp8266com\esp8266\cores\esp8266/twi.h:51:6: error:   initializing argument 1 of 'void twi_attachSlaveRxEvent(void (*)(uint8_t*, size_t))' [-fpermissive]

 void twi_attachSlaveRxEvent( void (*)(uint8_t*, size_t) );

      ^

exit status 1
Błąd kompilacji dla płytki Generic ESP8285 Module.

@earlephilhower
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reaper7 Could you open an issue on this, please?

@devyte
Copy link
Collaborator

@devyte devyte commented on cb05b86 Oct 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@earlephilhower you beat me to it :)
The fix is to change this signature:
void TwoWire::onReceiveService(uint8_t* inBytes, int numBytes)
To this:
void TwoWire::onReceiveService(uint8_t* inBytes, size_t numBytes)

What irks me is why this wasn't caught before merging? Shouldn't CI have failed or something? Or is Tasmota building with stricter compiler settings, e.g.: stricter warnings-as-errors?

@earlephilhower
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never used this lib, and I imagine there are no examples that use this method. CI only checks that what's needed for the examples compiles. Arduino core is smart enough to not compile unneeded external libs.

@ascillato
Copy link
Contributor

@ascillato ascillato commented on cb05b86 Oct 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I can confirm that the core is not compiling if using this wire library in a sketch. So, Sonoff-Tasmota will not compile either under this commit. Tasmota does not have stricter compiler settings.

Also I can confirm that the fix proposed don't work either. The Arduino core stills not compile.

@reaper7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue opened by @mcspr
#5287

Please sign in to comment.