Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Make function names in examples obviously example names #198

Closed
nkolban opened this issue Jan 4, 2017 · 0 comments
Closed
Labels
Resolution: Done Issue is done internally Status: Resolved Issue is done internally Type: Feature Request Feature request for IDF

Comments

@nkolban
Copy link
Contributor

nkolban commented Jan 4, 2017

While reading the examples supplied in the ESP-IDF, I found them confusing for a very simple reason (to me). Put yourself in the mind of someone studying the examples ... they are here because the APIs that they are about to use in their projects are new to them. Take for example the "i2c" samples ... all the ESP-IDF APIs exposed by the ESP-IDF for "i2c" all begin with the prefix "i2c_xxx" ... that makes perfect naming sense.

Now let us look in the sample ... the local functions that are defined ... merely as samples ... also begin with "i2c_xxx" and this provides a small degree of confusion ... if we look at the bottom of the sample, we see:

void app_main()
{
    print_mux = xSemaphoreCreateMutex();
    i2c_slave_init();
    i2c_master_init();

Just from reading this, it isn't obvious whether i2c_slave_init() and i2c_master_init() are local sample functions or ESP-IDF exposed functions ... without having to read through the whole code.

However, if we changed the sample code to read:

void app_main()
{
    print_mux = xSemaphoreCreateMutex();
    sample_i2c_slave_init();
    sample_i2c_master_init();

It might be much more obvious. This pattern appears in a number of samples ... so I am not picking on just the I2C sample.

Again, this issue is a suggestion merely for y'alls consideration.

@projectgus projectgus added the Type: Feature Request Feature request for IDF label Feb 16, 2017
@igrr igrr closed this as completed in 821c70f Mar 30, 2017
igrr pushed a commit that referenced this issue Mar 30, 2017
examples: Standardise naming of files, symbols, etc. in examples

* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes #198 #198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation

See merge request !601
@espressif-bot espressif-bot added Status: Opened Issue is new Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new Status: In Progress Work is in progress labels Sep 7, 2021
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Resolved Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Sep 16, 2021
david-cermak pushed a commit to david-cermak/esp-protocols that referenced this issue Mar 24, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue Mar 25, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue Apr 8, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 17, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 27, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 27, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 27, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
0xFEEDC0DE64 pushed a commit to 0xFEEDC0DE64/esp-protocols that referenced this issue Jun 30, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
euripedesrocha pushed a commit to euripedesrocha/esp-protocols that referenced this issue Oct 17, 2022
* Use "example" in all example function & variable names,
  ie use i2c_example_xxx instead of i2c_xxx for example functions.
  Closes espressif#198 espressif/esp-idf#198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation


* Original commit: espressif/esp-idf@821c70f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Resolved Issue is done internally Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

3 participants