Moderator: igrr
not all functions are tested may there need for more "extern" the SDK seams to miss many prototypes
#ifdef __cplusplus
extern "C" {
#endif
#include "stdlib_noniso.h"
#include "ets_sys.h"
#include "osapi.h"
#include "mem.h"
#include <stdarg.h>
extern int vsnprintf(char * s, size_t n, const char * format, va_list arg);
extern int os_printf_plus(const char * format, ...);
#define vsnprintf_P(...) vsnprintf( __VA_ARGS__ )
#define snprintf_P(...) snprintf( __VA_ARGS__ )
#define putc(c) os_putc(c)
#define printf(...) os_printf( __VA_ARGS__ )
#define sprintf(...) os_sprintf( __VA_ARGS__ )
#define snprintf(...) os_snprintf( __VA_ARGS__ )
//#define memcmp(...) os_memcmp( __VA_ARGS__ )
#define memcpy(...) os_memcpy( __VA_ARGS__ )
#define memmove(...) os_memmove( __VA_ARGS__ )
#define memset(...) os_memset( __VA_ARGS__ )
#define str2macaddr(...) os_str2macaddr( __VA_ARGS__ )
#define strcat(...) os_strcat( __VA_ARGS__ )
#define strchr(...) os_strchr( __VA_ARGS__ )
#define strcmp(...) os_strcmp( __VA_ARGS__ )
#define strcpy(...) os_strcpy( __VA_ARGS__ )
#define strlen(...) os_strlen( __VA_ARGS__ )
#define strncmp(...) os_strncmp( __VA_ARGS__ )
#define strncpy(...) os_strncpy( __VA_ARGS__ )
#define strstr(...) os_strstr( __VA_ARGS__ )
#define malloc(size) os_malloc(size)
#define free(ptr) os_free(ptr)
#define wdt_enable(...)
#define wdt_reset() delay(0)
#ifdef __cplusplus
} // extern "C"
#endif
yuki wrote:ok i add some defines to use the os function, now i can port some code from avr Arduino projectsCode: Select all#define printf(...) os_printf( __VA_ARGS__ )
#define sprintf(...) os_sprintf( __VA_ARGS__ )
for some reasons i also need to addCode: Select allextern int os_printf_plus(const char * format, ...);
When I add this code, I get the following compile error:
core_esp8266_wiring_digital.c:In function '__attachInterrupt'
core_esp8266_wiring_digital.c:141:38: error: 'GPIO_PIN_INTR_ANYEDGE' undeclared (first use in this function)
:gpio_pin_intr_state_set(pin, GPIO_PIN_INTR_ANYEDGE);
:^
core_esp8266_wiring_digital.c:each undeclared identifier is reported only once for each function it appears in
I want to use printf, but I can't get it to work.. any ideas?