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

ESP printf support #18

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

ESP printf support #18

wants to merge 5 commits into from

Conversation

phillipjohnston
Copy link
Member

No description provided.

We'll use the ESP built-in support instead of the printf library. Some lambda trickery is required to get the library working with the built-in ets_vprintf, since they only provide a callback and no private data.
@phillipjohnston phillipjohnston added this to In progress in Arduino Libraries Jun 9, 2020
@phillipjohnston phillipjohnston moved this from To Do to In Progress in Arduino Libraries Jun 9, 2020

va_list va;
va_start(va, format);
ets_vprintf(callback, format, va);
Copy link

Choose a reason for hiding this comment

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

This line would cause compilation error if in ets_sys.h function declaration is as follows:
int ets_vprintf(int (*print_function)(int), const char * format, va_list arg) __attribute__ ((format (printf, 2, 0)));
and this is the case for ArduCAM ESP8266 UNO
error:
arduino-logger/src/ArduinoLogger.h:293:35: error: invalid conversion from 'void (*)(char)' to 'int (*)(int)' [-fpermissive] ets_vprintf(callback, format, va); ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Arduino Libraries
  
In progress
Arduino Libraries
  
In Progress
Development

Successfully merging this pull request may close these issues.

None yet

2 participants