Merge pull request #250 from UncleRus/extras/cpp_fix
Make headers in extras more cpp friendly
This commit is contained in:
commit
8840eb0411
12 changed files with 130 additions and 29 deletions
|
@ -20,6 +20,10 @@
|
||||||
#define BMP180_TEMPERATURE (1<<0)
|
#define BMP180_TEMPERATURE (1<<0)
|
||||||
#define BMP180_PRESSURE (1<<1)
|
#define BMP180_PRESSURE (1<<1)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create bmp180_types
|
// Create bmp180_types
|
||||||
//
|
//
|
||||||
|
@ -79,4 +83,8 @@ bool bmp180_fillInternalConstants(bmp180_constants_t *c);
|
||||||
bool bmp180_measure(bmp180_constants_t *c, int32_t *temperature,
|
bool bmp180_measure(bmp180_constants_t *c, int32_t *temperature,
|
||||||
uint32_t *pressure, uint8_t oss);
|
uint32_t *pressure, uint8_t oss);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* DRIVER_BMP180_H_ */
|
#endif /* DRIVER_BMP180_H_ */
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uncomment to enable debug output.
|
* 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,
|
bool bmp280_read_float(bmp280_t *dev, float *temperature,
|
||||||
float *pressure, float *humidity);
|
float *pressure, float *humidity);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __BMP280_H__
|
#endif // __BMP280_H__
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
#define DHCPSERVER_LEASE_TIME 3600
|
#define DHCPSERVER_LEASE_TIME 3600
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Start DHCP server.
|
/* Start DHCP server.
|
||||||
|
|
||||||
Static IP of server should already be set and network interface enabled.
|
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);
|
void dhcpserver_stop(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
// Type of sensor to use
|
// Type of sensor to use
|
||||||
#define DHT_TYPE DHT22
|
#define DHT_TYPE DHT22
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data from sensor on specified pin.
|
* 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);
|
bool dht_read_float_data(uint8_t pin, float *humidity, float *temperature);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __DHT_H__
|
#endif // __DHT_H__
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
#include "onewire/onewire.h"
|
#include "onewire/onewire.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/** @file ds18b20.h
|
/** @file ds18b20.h
|
||||||
*
|
*
|
||||||
* Communicate with the DS18B20 family of one-wire temperature sensor ICs.
|
* 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.
|
// temperature from single dallas chip.
|
||||||
float ds18b20_read_single(uint8_t pin);
|
float ds18b20_read_single(uint8_t pin);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* DRIVER_DS18B20_H_ */
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DS3231_ADDR 0x68
|
#define DS3231_ADDR 0x68
|
||||||
|
|
||||||
#define DS3231_STAT_OSCILLATOR 0x80
|
#define DS3231_STAT_OSCILLATOR 0x80
|
||||||
|
@ -184,4 +188,8 @@ bool ds3231_getTempFloat(float *temp);
|
||||||
bool ds3231_getTime(struct tm *time);
|
bool ds3231_getTime(struct tm *time);
|
||||||
void ds3231_Init(uint8_t scl, uint8_t sda);
|
void ds3231_Init(uint8_t scl, uint8_t sda);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* __DS3231_H__ */
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
|
|
||||||
#ifndef __I2C_H__
|
#ifndef __I2C_H__
|
||||||
#define __I2C_H__
|
#define __I2C_H__
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
// Init bitbanging I2C driver on given pins
|
// Init bitbanging I2C driver on given pins
|
||||||
void i2c_init(uint8_t scl_pin, uint8_t sda_pin);
|
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.
|
// devices where the i2c_slave_[read|write] functions above are of no use.
|
||||||
void i2c_start(void);
|
void i2c_start(void);
|
||||||
void i2c_stop(void);
|
void i2c_stop(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __I2C_H__ */
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "esp/slc_regs.h"
|
#include "esp/slc_regs.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void (*i2s_dma_isr_t)(void);
|
typedef void (*i2s_dma_isr_t)(void);
|
||||||
|
|
||||||
typedef struct dma_descriptor {
|
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;
|
return (dma_descriptor_t*)SLC.RX_EOF_DESCRIPTOR_ADDR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __I2S_DMA_H__
|
#endif // __I2S_DMA_H__
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
#include <espressif/esp_misc.h> // sdk_os_delay_us
|
#include <espressif/esp_misc.h> // sdk_os_delay_us
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/** @file onewire.h
|
/** @file onewire.h
|
||||||
*
|
*
|
||||||
* Routines to access devices using the Dallas Semiconductor 1-Wire(tm)
|
* 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);
|
uint16_t onewire_crc16(const uint8_t* input, size_t len, uint16_t crc_iv);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ONEWIRE_H__ */
|
||||||
|
|
|
@ -5,10 +5,17 @@
|
||||||
* Copyright (C) 2015 Javier Cardona (https://github.com/jcard0na)
|
* Copyright (C) 2015 Javier Cardona (https://github.com/jcard0na)
|
||||||
* BSD Licensed as described in the file LICENSE
|
* BSD Licensed as described in the file LICENSE
|
||||||
*/
|
*/
|
||||||
|
#ifndef EXTRAS_PWM_H_
|
||||||
|
#define EXTRAS_PWM_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define MAX_PWM_PINS 8
|
#define MAX_PWM_PINS 8
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void pwm_init(uint8_t npins, uint8_t* pins);
|
void pwm_init(uint8_t npins, uint8_t* pins);
|
||||||
void pwm_set_freq(uint16_t freq);
|
void pwm_set_freq(uint16_t freq);
|
||||||
void pwm_set_duty(uint16_t duty);
|
void pwm_set_duty(uint16_t duty);
|
||||||
|
@ -16,3 +23,9 @@ void pwm_set_duty(uint16_t duty);
|
||||||
void pwm_restart();
|
void pwm_restart();
|
||||||
void pwm_start();
|
void pwm_start();
|
||||||
void pwm_stop();
|
void pwm_stop();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* EXTRAS_PWM_H_ */
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include "espressif/esp_common.h" // sdk_os_delay_us
|
#include "espressif/esp_common.h" // sdk_os_delay_us
|
||||||
#include "esp/gpio.h"
|
#include "esp/gpio.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Struct for easy manipulation of RGB colors.
|
* @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
|
sdk_os_delay_us(50); // display the loaded colors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* WS2812_DRV_H */
|
#endif /* WS2812_DRV_H */
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t red;
|
uint8_t red;
|
||||||
uint8_t green;
|
uint8_t green;
|
||||||
|
@ -50,4 +54,8 @@ void ws2812_i2s_init(uint32_t pixels_number);
|
||||||
*/
|
*/
|
||||||
void ws2812_i2s_update(ws2812_pixel_t *pixels);
|
void ws2812_i2s_update(ws2812_pixel_t *pixels);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __WS2812_I2S_H__
|
#endif // __WS2812_I2S_H__
|
||||||
|
|
Loading…
Reference in a new issue