1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Extern C blocks (#1352) (#4044)

* Add extern C guard blocks to SDK header files #1352

* fixed some extern C blocks in core and libraries
This commit is contained in:
Develo 2017-12-30 02:03:26 -03:00 committed by GitHub
parent 1cd4a00cff
commit a2d16f38d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 165 additions and 11 deletions

View File

@ -4,9 +4,6 @@
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __ets__
@ -26,6 +23,10 @@ extern "C" {
#endif // __ets__
#ifdef __cplusplus
extern "C" {
#endif
#define _SFR_BYTE(n) (n)
typedef void prog_void;

View File

@ -6,13 +6,13 @@
#define _UMM_MALLOC_CFG_H
#include <debug.h>
#ifdef __cplusplus
extern "C" {
#endif
//#ifdef __cplusplus
//extern "C" {
//#endif
#include "c_types.h"
#ifdef __cplusplus
}
#endif
//#ifdef __cplusplus
//}
//#endif
/*
* There are a number of defines you can set at compile time that affect how
* the memory allocator will operate.

View File

@ -19,7 +19,7 @@ int gdbstub_del_hw_watchpoint(int addr);
extern void* gdbstub_do_break_breakpoint_addr;
#ifdef __cplusplus
{
}
#endif
#endif

View File

@ -27,6 +27,10 @@
#include "c_types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
char *at_cmdName;
@ -169,4 +173,8 @@ bool at_fake_uart_enable(bool enable,at_fake_uart_tx_func_type at_fake_uart_tx_f
*/
bool at_set_escape_character(uint8 ch);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -25,6 +25,10 @@
#ifndef __ESPCONN_H__
#define __ESPCONN_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef sint8 err_t;
typedef void *espconn_handle;
@ -742,5 +746,13 @@ void espconn_dns_setserver(uint8 numdns, ip_addr_t *dnsserver);
* Returns : dnsserver -- IP address of the DNS server to set
*******************************************************************************/
ip_addr_t espconn_dns_getserver(uint8 numdns);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -25,6 +25,11 @@
#ifndef __ESPNOW_H__
#define __ESPNOW_H__
#ifdef __cplusplus
extern "C" {
#endif
enum esp_now_role {
ESP_NOW_ROLE_IDLE = 0,
ESP_NOW_ROLE_CONTROLLER,
@ -70,4 +75,8 @@ int esp_now_get_cnt_info(u8 *all_cnt, u8 *encrypt_cnt);
int esp_now_set_kok(u8 *key, u8 len);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -29,6 +29,10 @@
#include "eagle_soc.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef uint32_t ETSSignal;
typedef uint32_t ETSParam;
@ -213,4 +217,8 @@ bool ets_task(ETSTask task, uint8 prio, ETSEvent *queue, uint8 qlen);
bool ets_post(uint8 prio, ETSSignal sig, ETSParam par);
#ifdef __cplusplus
}
#endif
#endif /* _ETS_SYS_H */

View File

@ -25,6 +25,10 @@
#ifndef _GPIO_H_
#define _GPIO_H_
#ifdef __cplusplus
extern "C" {
#endif
#define GPIO_PIN_ADDR(i) (GPIO_PIN0_ADDRESS + i*4)
#define GPIO_ID_IS_PIN_REGISTER(reg_id) \
@ -116,4 +120,8 @@ void gpio_pin_wakeup_disable();
void gpio_pin_intr_state_set(uint32 i, GPIO_INT_TYPE intr_state);
#ifdef __cplusplus
}
#endif
#endif // _GPIO_H_

View File

@ -27,6 +27,10 @@
#include "c_types.h"
#ifdef __cplusplus
extern "C" {
#endif
struct ip_addr {
uint32 addr;
};
@ -84,4 +88,9 @@ uint32 ipaddr_addr(const char *cp);
#define IPSTR "%d.%d.%d.%d"
#ifdef __cplusplus
}
#endif
#endif /* __IP_ADDR_H__ */

View File

@ -25,6 +25,10 @@
#ifndef __MEM_H__
#define __MEM_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Note: check_memleak_debug_enable is a weak function inside SDK.
* please copy following codes to user_main.c.
#include "mem.h"
@ -77,5 +81,10 @@ do{\
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -27,6 +27,7 @@
#include "ip_addr.h"
#include "user_interface.h"
#include "espconn.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -28,6 +28,10 @@
#include <string.h>
#include "user_config.h"
#ifdef __cplusplus
extern "C" {
#endif
#define os_bzero ets_bzero
#define os_delay_us ets_delay_us
#define os_install_putc1 ets_install_putc1
@ -77,5 +81,10 @@ extern int os_printf_plus(const char * format, ...) __attribute__ ((format (prin
unsigned long os_random(void);
int os_get_random(unsigned char *buf, size_t len);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -25,6 +25,9 @@
#ifndef __PING_H__
#define __PING_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef void (* ping_recv_function)(void* arg, void *pdata);
typedef void (* ping_sent_function)(void* arg, void *pdata);
@ -53,4 +56,8 @@ bool ping_start(struct ping_option *ping_opt);
bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv);
bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent);
#ifdef __cplusplus
}
#endif
#endif /* __PING_H__ */

View File

@ -25,6 +25,10 @@
#ifndef __PWM_H__
#define __PWM_H__
#ifdef __cplusplus
extern "C" {
#endif
/*pwm.h: function and macro definition of PWM API , driver level */
/*user_light.h: user interface for light API, user level*/
/*user_light_adj: API for color changing and lighting effects, user level*/
@ -54,5 +58,10 @@ uint32 pwm_get_period(void);
uint32 get_pwm_version(void);
void set_pwm_debug_en(uint8 print_en);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -25,6 +25,10 @@
#ifndef __SIMPLE_PAIR_H__
#define __SIMPLE_PAIR_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
SP_ST_STA_FINISH = 0,
SP_ST_AP_FINISH = 0,
@ -61,4 +65,8 @@ int simple_pair_set_peer_ref(u8 *peer_mac, u8 *tmp_key, u8 *ex_key);
int simple_pair_get_peer_ref(u8 *peer_mac, u8 *tmp_key, u8 *ex_key);
#ifdef __cplusplus
}
#endif
#endif /* __SIMPLE_PAIR_H__ */

View File

@ -25,6 +25,10 @@
#ifndef __SMARTCONFIG_H__
#define __SMARTCONFIG_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
SC_STATUS_WAIT = 0,
SC_STATUS_FIND_CHANNEL,
@ -47,4 +51,9 @@ bool smartconfig_stop(void);
bool esptouch_set_timeout(uint8 time_s); //15s~255s, offset:45s
bool smartconfig_set_type(sc_type type);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -7,6 +7,11 @@
#else
#include "ip_addr.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* get the seconds since Jan 01, 1970, 00:00 (GMT + 8)
*/
@ -65,4 +70,9 @@ char *sntp_getservername(unsigned char idx);
#define sntp_servermode_dhcp(x)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -25,6 +25,10 @@
#ifndef SPI_FLASH_H
#define SPI_FLASH_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
SPI_FLASH_RESULT_OK,
SPI_FLASH_RESULT_ERR,
@ -60,4 +64,9 @@ void spi_flash_set_read_func(user_spi_flash_read read);
bool spi_flash_erase_protect_enable(void);
bool spi_flash_erase_protect_disable(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -25,6 +25,11 @@
#ifndef __UPGRADE_H__
#define __UPGRADE_H__
#ifdef __cplusplus
extern "C" {
#endif
#define SPI_FLASH_SEC_SIZE 4096
#define LIMIT_ERASE_SIZE 0x10000
@ -71,4 +76,10 @@ bool system_upgrade_start_ssl(struct upgrade_server_info *server); // not suppor
#else
bool system_upgrade_start(struct upgrade_server_info *server);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -37,6 +37,10 @@
#include "spi_flash.h"
#include "gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MAC2STR
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
@ -651,4 +655,9 @@ void wifi_disable_gpio_wakeup(void);
void uart_div_modify(uint8 uart_no, uint32 DivLatchValue);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -25,6 +25,10 @@
#ifndef __WPA2_ENTERPRISE_H__
#define __WPA2_ENTERPRISE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef long os_time_t;
struct os_time {
@ -62,4 +66,8 @@ bool wifi_station_get_enterprise_disable_time_check(void);
void wpa2_enterprise_set_user_get_time(get_time_func_t cb);
#ifdef __cplusplus
}
#endif
#endif /* __WPA2_ENTERPRISE_H__ */