Code:
void * user_printfHook[2] = {NULL, NULL};
void * ICACHE_FLASH_ATTR user_printf(const char *s, ...)
{
/*
os_printf("[%s]\n", __func__);
int i=0;
os_printf("a");
for (i=0; i<(sizeof(user_printfHook)/4); i++)
{
os_printf("b");
if (user_printfHook[i] != NULL)
{
os_printf("c");
((void (*)(const char *))user_printfHook[i])(s);
}
}
*/
os_printf("1");
va_list args;
os_printf("2");
va_start(args, s);
os_printf("3");
ets_vprintf(ets_putc, s, args);
os_printf("4");
va_end(args);
os_printf("5");
}
Code:
void write_mychar(char ch)
{
os_printf("%c", ch);
}
void * ICACHE_FLASH_ATTR user_printf(const char *s, ...)
{
int i=0;
for (i=0; i<(sizeof(user_printfHook)/4); i++)
{
if (user_printfHook[i] != NULL)
{
((void (*)(const char *))user_printfHook[i])(s);
}
}
va_list args;
va_start(args, s);
ets_vprintf(write_mychar, s, args);
va_end(args);
}
Statistics: Posted by AgentSmithers — Wed Apr 17, 2019 1:51 am