diff --git a/extras/bmp180/bmp180.h b/extras/bmp180/bmp180.h index cbdad4a3..e7fc470e 100644 --- a/extras/bmp180/bmp180.h +++ b/extras/bmp180/bmp180.h @@ -20,6 +20,10 @@ #define BMP180_TEMPERATURE (1<<0) #define BMP180_PRESSURE (1<<1) +#ifdef __cplusplus +extern "C" { +#endif + // // Create bmp180_types // @@ -79,4 +83,8 @@ bool bmp180_fillInternalConstants(bmp180_constants_t *c); bool bmp180_measure(bmp180_constants_t *c, int32_t *temperature, uint32_t *pressure, uint8_t oss); +#ifdef __cplusplus +} +#endif + #endif /* DRIVER_BMP180_H_ */ diff --git a/extras/bmp280/bmp280.h b/extras/bmp280/bmp280.h index 8a43ad05..ea8e8f51 100644 --- a/extras/bmp280/bmp280.h +++ b/extras/bmp280/bmp280.h @@ -27,6 +27,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * Uncomment to enable debug output. */ @@ -184,4 +188,8 @@ bool bmp280_read_fixed(bmp280_t *dev, int32_t *temperature, bool bmp280_read_float(bmp280_t *dev, float *temperature, float *pressure, float *humidity); +#ifdef __cplusplus +} +#endif + #endif // __BMP280_H__ diff --git a/extras/dhcpserver/include/dhcpserver.h b/extras/dhcpserver/include/dhcpserver.h index 5548c19a..95a59b88 100644 --- a/extras/dhcpserver/include/dhcpserver.h +++ b/extras/dhcpserver/include/dhcpserver.h @@ -14,6 +14,10 @@ #define DHCPSERVER_LEASE_TIME 3600 #endif +#ifdef __cplusplus +extern "C" { +#endif + /* Start DHCP server. Static IP of server should already be set and network interface enabled. @@ -30,4 +34,8 @@ void dhcpserver_get_lease(const ip_addr_t *first_client_addr, uint8_t max_leases */ void dhcpserver_stop(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/extras/dht/dht.h b/extras/dht/dht.h index 3f69a29f..ab222692 100644 --- a/extras/dht/dht.h +++ b/extras/dht/dht.h @@ -17,6 +17,10 @@ // Type of sensor to use #define DHT_TYPE DHT22 +#ifdef __cplusplus +extern "C" { +#endif + /** * Read data from sensor on specified pin. * @@ -35,4 +39,8 @@ bool dht_read_data(uint8_t pin, int16_t *humidity, int16_t *temperature); */ bool dht_read_float_data(uint8_t pin, float *humidity, float *temperature); +#ifdef __cplusplus +} +#endif + #endif // __DHT_H__ diff --git a/extras/ds18b20/ds18b20.h b/extras/ds18b20/ds18b20.h index 04b4a53f..c53d97de 100644 --- a/extras/ds18b20/ds18b20.h +++ b/extras/ds18b20/ds18b20.h @@ -3,6 +3,10 @@ #include "onewire/onewire.h" +#ifdef __cplusplus +extern "C" { +#endif + /** @file ds18b20.h * * Communicate with the DS18B20 family of one-wire temperature sensor ICs. @@ -147,4 +151,8 @@ uint8_t ds18b20_read_all(uint8_t pin, ds_sensor_t *result); // temperature from single dallas chip. float ds18b20_read_single(uint8_t pin); +#ifdef __cplusplus +} #endif + +#endif /* DRIVER_DS18B20_H_ */ diff --git a/extras/ds3231/ds3231.h b/extras/ds3231/ds3231.h index 06cdb62c..ccc7335c 100644 --- a/extras/ds3231/ds3231.h +++ b/extras/ds3231/ds3231.h @@ -13,40 +13,44 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define DS3231_ADDR 0x68 -#define DS3231_STAT_OSCILLATOR 0x80 -#define DS3231_STAT_32KHZ 0x08 -#define DS3231_STAT_BUSY 0x04 -#define DS3231_STAT_ALARM_2 0x02 -#define DS3231_STAT_ALARM_1 0x01 - -#define DS3231_CTRL_OSCILLATOR 0x80 -#define DS3231_CTRL_SQUAREWAVE_BB 0x40 -#define DS3231_CTRL_TEMPCONV 0x20 -#define DS3231_CTRL_SQWAVE_4096HZ 0x10 -#define DS3231_CTRL_SQWAVE_1024HZ 0x08 -#define DS3231_CTRL_SQWAVE_8192HZ 0x18 -#define DS3231_CTRL_SQWAVE_1HZ 0x00 -#define DS3231_CTRL_ALARM_INTS 0x04 -#define DS3231_CTRL_ALARM2_INT 0x02 -#define DS3231_CTRL_ALARM1_INT 0x01 - -#define DS3231_ALARM_WDAY 0x40 -#define DS3231_ALARM_NOTSET 0x80 - -#define DS3231_ADDR_TIME 0x00 -#define DS3231_ADDR_ALARM1 0x07 -#define DS3231_ADDR_ALARM2 0x0b -#define DS3231_ADDR_CONTROL 0x0e -#define DS3231_ADDR_STATUS 0x0f -#define DS3231_ADDR_AGING 0x10 -#define DS3231_ADDR_TEMP 0x11 - -#define DS3231_12HOUR_FLAG 0x40 -#define DS3231_12HOUR_MASK 0x1f -#define DS3231_PM_FLAG 0x20 -#define DS3231_MONTH_MASK 0x1f +#define DS3231_STAT_OSCILLATOR 0x80 +#define DS3231_STAT_32KHZ 0x08 +#define DS3231_STAT_BUSY 0x04 +#define DS3231_STAT_ALARM_2 0x02 +#define DS3231_STAT_ALARM_1 0x01 + +#define DS3231_CTRL_OSCILLATOR 0x80 +#define DS3231_CTRL_SQUAREWAVE_BB 0x40 +#define DS3231_CTRL_TEMPCONV 0x20 +#define DS3231_CTRL_SQWAVE_4096HZ 0x10 +#define DS3231_CTRL_SQWAVE_1024HZ 0x08 +#define DS3231_CTRL_SQWAVE_8192HZ 0x18 +#define DS3231_CTRL_SQWAVE_1HZ 0x00 +#define DS3231_CTRL_ALARM_INTS 0x04 +#define DS3231_CTRL_ALARM2_INT 0x02 +#define DS3231_CTRL_ALARM1_INT 0x01 + +#define DS3231_ALARM_WDAY 0x40 +#define DS3231_ALARM_NOTSET 0x80 + +#define DS3231_ADDR_TIME 0x00 +#define DS3231_ADDR_ALARM1 0x07 +#define DS3231_ADDR_ALARM2 0x0b +#define DS3231_ADDR_CONTROL 0x0e +#define DS3231_ADDR_STATUS 0x0f +#define DS3231_ADDR_AGING 0x10 +#define DS3231_ADDR_TEMP 0x11 + +#define DS3231_12HOUR_FLAG 0x40 +#define DS3231_12HOUR_MASK 0x1f +#define DS3231_PM_FLAG 0x20 +#define DS3231_MONTH_MASK 0x1f enum { DS3231_SET = 0, @@ -184,4 +188,8 @@ bool ds3231_getTempFloat(float *temp); bool ds3231_getTime(struct tm *time); void ds3231_Init(uint8_t scl, uint8_t sda); +#ifdef __cplusplus +} #endif + +#endif /* __DS3231_H__ */ diff --git a/extras/i2c/i2c.h b/extras/i2c/i2c.h index ac3163f0..bfb38115 100644 --- a/extras/i2c/i2c.h +++ b/extras/i2c/i2c.h @@ -24,11 +24,14 @@ #ifndef __I2C_H__ #define __I2C_H__ -#endif #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Init bitbanging I2C driver on given pins void i2c_init(uint8_t scl_pin, uint8_t sda_pin); @@ -49,3 +52,9 @@ bool i2c_slave_read(uint8_t slave_addr, uint8_t data, uint8_t *buf, uint32_t len // devices where the i2c_slave_[read|write] functions above are of no use. void i2c_start(void); void i2c_stop(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __I2C_H__ */ diff --git a/extras/i2s_dma/i2s_dma.h b/extras/i2s_dma/i2s_dma.h index b566b342..ed6e5c0b 100644 --- a/extras/i2s_dma/i2s_dma.h +++ b/extras/i2s_dma/i2s_dma.h @@ -28,6 +28,10 @@ #include #include "esp/slc_regs.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*i2s_dma_isr_t)(void); typedef struct dma_descriptor { @@ -113,4 +117,8 @@ inline dma_descriptor_t *i2s_dma_get_eof_descriptor() return (dma_descriptor_t*)SLC.RX_EOF_DESCRIPTOR_ADDR; } +#ifdef __cplusplus +} +#endif + #endif // __I2S_DMA_H__ diff --git a/extras/onewire/onewire.h b/extras/onewire/onewire.h index 89823d75..ddc88dc3 100644 --- a/extras/onewire/onewire.h +++ b/extras/onewire/onewire.h @@ -4,6 +4,10 @@ #include // sdk_os_delay_us #include "FreeRTOS.h" +#ifdef __cplusplus +extern "C" { +#endif + /** @file onewire.h * * Routines to access devices using the Dallas Semiconductor 1-Wire(tm) @@ -232,4 +236,8 @@ bool onewire_check_crc16(const uint8_t* input, size_t len, const uint8_t* invert */ uint16_t onewire_crc16(const uint8_t* input, size_t len, uint16_t crc_iv); +#ifdef __cplusplus +} #endif + +#endif /* __ONEWIRE_H__ */ diff --git a/extras/pwm/pwm.h b/extras/pwm/pwm.h index ddf7f2bf..55b87614 100644 --- a/extras/pwm/pwm.h +++ b/extras/pwm/pwm.h @@ -5,10 +5,17 @@ * Copyright (C) 2015 Javier Cardona (https://github.com/jcard0na) * BSD Licensed as described in the file LICENSE */ +#ifndef EXTRAS_PWM_H_ +#define EXTRAS_PWM_H_ + #include #define MAX_PWM_PINS 8 +#ifdef __cplusplus +extern "C" { +#endif + void pwm_init(uint8_t npins, uint8_t* pins); void pwm_set_freq(uint16_t freq); void pwm_set_duty(uint16_t duty); @@ -16,3 +23,9 @@ void pwm_set_duty(uint16_t duty); void pwm_restart(); void pwm_start(); void pwm_stop(); + +#ifdef __cplusplus +} +#endif + +#endif /* EXTRAS_PWM_H_ */ diff --git a/extras/ws2812/ws2812.h b/extras/ws2812/ws2812.h index d614e605..7ef157a0 100644 --- a/extras/ws2812/ws2812.h +++ b/extras/ws2812/ws2812.h @@ -35,6 +35,10 @@ #include "espressif/esp_common.h" // sdk_os_delay_us #include "esp/gpio.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Struct for easy manipulation of RGB colors. * @@ -204,5 +208,8 @@ void ws2812_seq_end(void) sdk_os_delay_us(50); // display the loaded colors } +#ifdef __cplusplus +} +#endif #endif /* WS2812_DRV_H */ diff --git a/extras/ws2812_i2s/ws2812_i2s.h b/extras/ws2812_i2s/ws2812_i2s.h index fc12e26e..f6ebc827 100644 --- a/extras/ws2812_i2s/ws2812_i2s.h +++ b/extras/ws2812_i2s/ws2812_i2s.h @@ -27,6 +27,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { uint8_t red; uint8_t green; @@ -50,4 +54,8 @@ void ws2812_i2s_init(uint32_t pixels_number); */ void ws2812_i2s_update(ws2812_pixel_t *pixels); +#ifdef __cplusplus +} +#endif + #endif // __WS2812_I2S_H__