many changes :Py

This commit is contained in:
kazu
2018-07-08 17:47:59 +02:00
parent 11ed5a9159
commit 528a00b0e9
14 changed files with 843 additions and 91 deletions

53
c++.h
View File

@@ -4,7 +4,11 @@
#define FALSE false
typedef void (*int_handler_t)(void*);
/*
// ONLY NEEDED FOR OLD SDK <= 2.0.0
//#define OLD_SDK
#ifdef OLD_SDK
void *pvPortMalloc(size_t xWantedSize, const char* file, int line) __attribute__((malloc, alloc_size(1)));
void *pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line) __attribute__((alloc_size(2)));
void vPortFree(void *ptr, const char* file, int line);
@@ -98,17 +102,14 @@ inline uint32_t ETS_INTR_PENDING(void)
#define ETS_CCOMPARE0_DISABLE() \
ETS_INTR_DISABLE(ETS_CCOMPARE0_INUM)
//#define ETS_FRC_TIMER1_INTR_ATTACH(func, arg) \
// ets_isr_attach(ETS_FRC_TIMER1_INUM, (int_handler_t)(func), (void *)(arg))
//#define ETS_FRC_TIMER1_INTR_ATTACH(func, arg) ets_isr_attach(ETS_FRC_TIMER1_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_FRC_TIMER1_NMI_INTR_ATTACH(func) \
NmiTimSetFunc(func)
//#define ETS_GPIO_INTR_ATTACH(func, arg) \
// ets_isr_attach(ETS_GPIO_INUM, (int_handler_t)(func), (void *)(arg))
//#define ETS_GPIO_INTR_ATTACH(func, arg) ets_isr_attach(ETS_GPIO_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_GPIO_INTR_ENABLE() \
@@ -118,8 +119,7 @@ inline uint32_t ETS_INTR_PENDING(void)
ETS_INTR_DISABLE(ETS_GPIO_INUM)
//#define ETS_UART_INTR_ATTACH(func, arg) \
// ets_isr_attach(ETS_UART_INUM, (int_handler_t)(func), (void *)(arg))
//#define ETS_UART_INTR_ATTACH(func, arg) ets_isr_attach(ETS_UART_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_UART_INTR_ENABLE() \
@@ -135,8 +135,7 @@ inline uint32_t ETS_INTR_PENDING(void)
ETS_INTR_DISABLE(ETS_FRC_TIMER1_INUM)
//#define ETS_SPI_INTR_ATTACH(func, arg) \
// ets_isr_attach(ETS_SPI_INUM, (int_handler_t)(func), (void *)(arg))
//#define ETS_SPI_INTR_ATTACH(func, arg) ets_isr_attach(ETS_SPI_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_SPI_INTR_ENABLE() \
@@ -156,8 +155,7 @@ inline uint32_t ETS_INTR_PENDING(void)
ETS_INTR_DISABLE(ETS_SLC_INUM)
//#define ETS_SDIO_INTR_ATTACH(func, arg) \
// ets_isr_attach(ETS_SDIO_INUM, (int_handler_t)(func), (void *)(arg))
//#define ETS_SDIO_INTR_ATTACH(func, arg) ets_isr_attach(ETS_SDIO_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_SDIO_INTR_ENABLE() \
ETS_INTR_ENABLE(ETS_SDIO_INUM)
@@ -183,7 +181,31 @@ extern void ets_delay_us(uint32_t us);
extern int os_printf_plus(const char * format, ...) __attribute__ ((format (printf, 1, 2)));
*/
#endif
void* malloc(size_t size) {
return os_malloc(size);
}
void free(void* ptr) {
os_free(ptr);
}
void operator delete(void* ptr) {
os_free(ptr);
}
void* operator new(size_t size) {
return os_malloc(size);
}
/** missing within headers?! */
int ipaddr_aton(const char *cp, ip_addr_t *addr)ICACHE_FLASH_ATTR;
char *ipaddr_ntoa(const ip_addr_t *addr);
//void run_sdk_tasks();
/*
bool wifi_station_get_config(struct station_config *config);
@@ -281,6 +303,7 @@ bool wifi_set_phy_mode(phy_mode_t mode);
// ensure constructors are called
// See more at: http://www.esp8266.com/viewtopic.php?f=9&t=478&start=8#sthash.uVL8shrS.dpuf
// https://www.esp8266.com/viewtopic.php?f=9&t=478&sid=4375c81b073ef125fb57ab2fc3b38041&start=8
// SEE NOTES BELOW!!!
extern void (*__init_array_start)(void);
extern void (*__init_array_end)(void);
@@ -295,3 +318,7 @@ static void do_global_ctors(void) {
}
// memory stuff
// https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map