From 259ede3d5bbcfbff619139c9fee88605f5a066ab Mon Sep 17 00:00:00 2001 From: "H. Utku Maden" Date: Sun, 16 May 2021 10:31:06 +0300 Subject: [PATCH] Put C++ header guard and add extern to function declarations. --- include/bmx280.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/include/bmx280.h b/include/bmx280.h index 77b1fda..403a10b 100644 --- a/include/bmx280.h +++ b/include/bmx280.h @@ -10,11 +10,17 @@ #ifndef _BMX280_H_ #define _BMX280_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include "driver/i2c.h" #include "sdkconfig.h" +#define BMXAPI extern + /** * Anonymous structure to driver settings. */ @@ -27,43 +33,43 @@ typedef struct bmx280_t bmx280_t; * @param port The I2C port to use. * @return A non-null pointer to the driver structure on success. */ -bmx280_t* bmx280_create(i2c_port_t port); +BMXAPI bmx280_t* bmx280_create(i2c_port_t port); /** * Destroy your the instance. * @param bmx280 The instance to destroy. */ -void bmx280_close(bmx280_t* bmx280); +BMXAPI void bmx280_close(bmx280_t* bmx280); /** * Probe for the sensor and read calibration data. * @param bmx280 Driver structure. */ -esp_err_t bmx280_init(bmx280_t* bmx280); +BMXAPI esp_err_t bmx280_init(bmx280_t* bmx280); /** * Configure the sensor with the given parameters. * @param bmx280 Driver structure. * @param configuration The configuration to use. */ -esp_err_t bmx280_configure(bmx280_t* bmx280, bmx280_config_t *cfg); +BMXAPI esp_err_t bmx280_configure(bmx280_t* bmx280, bmx280_config_t *cfg); /** * Set the sensor mode of operation. * @param bmx280 Driver structure. * @param mode The mode to set the sensor to. */ -esp_err_t bmx280_setMode(bmx280_t* bmx280, bmx280_mode_t mode); +BMXAPI esp_err_t bmx280_setMode(bmx280_t* bmx280, bmx280_mode_t mode); /** * Get the sensor current mode of operation. * @param bmx280 Driver structure. * @param mode Pointer to write current mode to. */ -esp_err_t bmx280_getMode(bmx280_t* bmx280, bmx280_mode_t* mode); +BMXAPI esp_err_t bmx280_getMode(bmx280_t* bmx280, bmx280_mode_t* mode); /** * Returns true if sensor is currently sampling environment conditions. * @param bmx280 Driver structure. */ -bool bmx280_isSampling(bmx280_t* bmx280); +BMXAPI bool bmx280_isSampling(bmx280_t* bmx280); /** * Read sensor values as fixed point numbers. @@ -72,7 +78,7 @@ bool bmx280_isSampling(bmx280_t* bmx280); * @param pressure The pressure in Pa (1/256 Pa increments) * @param humidity The humidity in %RH (1/1024 %RH increments) (UINT32_MAX when invlaid.) */ -esp_err_t bmx280_readout(bmx280_t *bmx280, int32_t *temperature, uint32_t *pressure, uint32_t *humidity); +BMXAPI esp_err_t bmx280_readout(bmx280_t *bmx280, int32_t *temperature, uint32_t *pressure, uint32_t *humidity); /** * Convert sensor readout to floating point values. @@ -113,4 +119,8 @@ static inline esp_err_t bmx280_readoutFloat(bmx280_t *bmx280, float* temperature return err; } +#ifdef __cplusplus +}; +#endif + #endif