Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By kolban
#22633 Howdy folks,
If we have a look at our Wiki under the heading "Pin Functions" which can be found here:

http://www.esp8266.com/wiki/doku.php?id=esp8266_gpio_pin_allocations

We see an interesting table with a column for "GPIO", a column for "Inst Name" and multiple columns for "Functions".

I combine this with my study of the PIN_FUNC_SELECT macro from the SDK ... and mix it all together ... and I'm afraid I'm lost.

I wondering if some kind soul can help me make sense of these concepts and ideas? I get the feeling that there is an architecture and model at play but I'll be darned if I can see it and any speculation on my part would be pure guess work.

Hoping for help ... thanks in advance.... Neil
User avatar
By martinayotte
#22636 Hi Neil,

Although I'm using exclusively Arduino IDE, in the old days when it didn't exist yet, I had to work this out too.
Take a look at eagle_soc.h file, it is defining all the PERIPHS_xxx_MUX_xxx register addresses and the FUNC_xxx defines.
For example, when I added I2C to my native code project with such code for init the SDA pin :

PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12);

The PERIPHS_IO_MUX_MTDI_U is the register base for GPIO12, and FUNC_GPIO12 is function No 3 in the table your provided. That switched the GPIO12 to GPIO mode. Then, other functions were called to make the pin open-drain, etc.