Coder Social home page Coder Social logo

adafruit_shtc3's Introduction

Adafruit SHTC3 Temperature and Humidity Sensor Breakout Build StatusDocumentation

This is a library for the SHTC3 Digital Humidity + Temp sensor.

It is designed specifically to work with the SHTC3 Digital in the Adafruit shop:

These sensors use I2C to communicate, 2 pins are required to interface

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution

Check out the links above for our tutorials and wiring diagrams

Installation

Use the Arduino Library Manager to install this library. If you're unfamiliar with how this works, we have a great tutorial on Arduino library installation at: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

adafruit_shtc3's People

Contributors

hathach avatar ladyada avatar paintyourdragon avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_shtc3's Issues

Wrong declaration of a static function

  • Arduino board: esp32 dev
  • Arduino IDE version: no arduino-ide. arduino-cli version 0.20.1
  • List the steps to reproduce the problem below:

To reproduce the issue, just compile a sketch which uses this library. Maybe it is required to add -Wall -Wextra, the specific compiler flag seems to be -Wunused-function.

Just opened this issue to let you know about the following compiler warning message:

~/Arduino/libraries/Adafruit_SHTC3/Adafruit_SHTC3.h:51:16: warning: 'uint8_t crc8(const uint8_t*, int)' declared 'static' but never defined [-Wunused-function]
 static uint8_t crc8(const uint8_t *data, int len);

Actually, GCC is quite permissive in this case, since we are declaring a crc8() method inside each translation unit, with internal linkage, but then we do not provide its implementation (so this is not what is expected).
There are two possible fixes:

  1. If the crc8() method is "private" to the lib, just remove its declaration from the header.
  2. If it is intended to be publicly accessible, then remove static from both the header and the implementation.

Regards.

Memory Leak - Fix Found

A memory leak is caused by not deleting the Adafruit_I2CDevice object in the deconstructor.

In begin() line ~66 an Adafruit_I2CDevice object is newed:
i2c_dev = new Adafruit_I2CDevice(SHTC3_DEFAULT_ADDR, theWire);

The deconstructor fails to delete this object.

Adding the following in the deconstructor prevents the memory leak:
if (i2c_dev) { delete i2c_dev; // remove old interface }

The issue affects programs that call the library in a local method and the class goes out of scope in a looping fashion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.