From 50f8b3d338951fef5cec7ed558fc89ff8f943e8b Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 5 Oct 2015 18:33:32 +1100 Subject: [PATCH] core headers: Add C++ linker compatibility --- core/include/esp/hwrand.h | 8 ++++++++ core/include/esp/iomux.h | 8 ++++++++ core/include/esp/rom.h | 9 ++++++++- core/include/esp/timer.h | 8 ++++++++ core/include/esp/timer_private.h | 8 +++++++- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/core/include/esp/hwrand.h b/core/include/esp/hwrand.h index 8ec75e1..95143db 100644 --- a/core/include/esp/hwrand.h +++ b/core/include/esp/hwrand.h @@ -13,10 +13,18 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* Return a random 32-bit number */ uint32_t hwrand(void); /* Fill a variable size buffer with data from the Hardware RNG */ void hwrand_fill(uint8_t *buf, size_t len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/core/include/esp/iomux.h b/core/include/esp/iomux.h index f6715f4..a893f4e 100644 --- a/core/include/esp/iomux.h +++ b/core/include/esp/iomux.h @@ -11,6 +11,10 @@ #include "esp/types.h" #include "esp/iomux_regs.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * Convert a GPIO pin number to an iomux register index. * @@ -64,4 +68,8 @@ inline static void iomux_set_gpio_function(const uint8_t gpio_number, const uint declared above */ #include "esp/iomux_private.h" +#ifdef __cplusplus +} +#endif + #endif diff --git a/core/include/esp/rom.h b/core/include/esp/rom.h index 0fbf4bd..c2f8759 100644 --- a/core/include/esp/rom.h +++ b/core/include/esp/rom.h @@ -5,9 +5,12 @@ */ #ifndef _ESP_ROM_H #define _ESP_ROM_H - #include +#ifdef __cplusplus +extern "C" { +#endif + void Cache_Read_Disable(void); /* http://esp8266-re.foogod.com/wiki/Cache_Read_Enable @@ -18,4 +21,8 @@ void Cache_Read_Disable(void); */ void Cache_Read_Enable(uint32_t odd_even, uint32_t mb_count, uint32_t no_idea); +#ifdef __cplusplus +} +#endif + #endif diff --git a/core/include/esp/timer.h b/core/include/esp/timer.h index b83a0ee..0fb27ef 100644 --- a/core/include/esp/timer.h +++ b/core/include/esp/timer.h @@ -14,6 +14,10 @@ #include "esp/timer_regs.h" #include "esp/cpu.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { FRC1 = 0, FRC2 = 1, @@ -129,4 +133,8 @@ INLINED bool timer_set_timeout(const timer_frc_t frc, uint32_t us); #include "timer_private.h" +#ifdef __cplusplus +} +#endif + #endif diff --git a/core/include/esp/timer_private.h b/core/include/esp/timer_private.h index a5fc246..e57fd24 100644 --- a/core/include/esp/timer_private.h +++ b/core/include/esp/timer_private.h @@ -7,6 +7,10 @@ #ifndef _ESP_TIMER_PRIVATE_H #define _ESP_TIMER_PRIVATE_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -255,6 +259,8 @@ INLINED bool timer_set_timeout(const timer_frc_t frc, uint32_t us) return _timer_set_timeout_runtime(frc, us); } - +#ifdef __cplusplus +} +#endif #endif