Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Slavey Karadzhov committed Apr 28, 2017
2 parents ac6fe3f + ad46428 commit 5c37d69
Show file tree
Hide file tree
Showing 99 changed files with 3,977 additions and 1,368 deletions.
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# generated binaries
out
Sming/compiler/lib/lib*.a

# generated documentation
docs/api

# dev tools, editors, etc.
language.settings.xml
.settings
nbproject
.*.swp
Sming/compiler/lib/lib*.a
docs/api
.vscode
GTAGS
GRTAGS
GPATH
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
path = Sming/third-party/pwm
url = https://github.com/StefanBruens/ESP8266_new_pwm.git
ignore = dirty
[submodule "third-party/axtls-8266"]
path = Sming/third-party/axtls-8266
url = https://github.com/igrr/axtls-8266.git
ignore = dirty
[submodule "Sming/third-party/spiffs"]
path = Sming/third-party/spiffs
url = https://github.com/pellepl/spiffs.git
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The commands below help you achieve this.
```
cd Sming
git checkout develop
git pull develop
git pull
git checkout feature/<short-explanation>
git merge develop
# Fix any merge conflicts if needed.
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SDK = Software Development Kit
n/a = The selected SDK is not available on that OS

## Latest Stable Release
- [Sming V3.1.2](https://github.com/SmingHub/Sming/releases/tag/3.1.2)
- [Sming V3.2.0](https://github.com/SmingHub/Sming/releases/tag/3.2.0)

## Getting started
- [Windows](https://github.com/SmingHub/Sming/wiki/Windows-Quickstart)
Expand Down
2 changes: 1 addition & 1 deletion Sming/Libraries/BH1750FVI/BH1750FVI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ uint16_t BH1750FVI::getLightIntensity(void)
{
uint16_t Intensity_value;
Wire.beginTransmission(address_value);
int res = Wire.requestFrom(address_value, 2);
int res = Wire.requestFrom(address_value, (uint8_t)2);
Intensity_value = Wire.read();
Intensity_value <<= 8;
Intensity_value |= Wire.read();
Expand Down
79 changes: 71 additions & 8 deletions Sming/Libraries/DS18S20/ds18s20.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
#ifndef READFROMDS_H_
#define READFROMDS_H_

/** @defgroup DS18S20 DS18S20 Temperature Sensor
* @brief This library provides access to DS18S20 temperature sensors connected via 1-Wire bus to a single GPIO
* The DS18S20 can run in several modes, with varying degrees of resolution. The highest resolution is 12-bit which provides 0.0625C resolution.
12-bit measurement takes 750ms. With 4 sensors connected, measurement will take 3s.
* @ingroup libraries
* @{
*/
#include "../../SmingCore/Wire.h"

#define MAX_SENSORS 4 //how many sensors reads up max
#define MAX_SENSORS 4 ///< Maximum quantity of sensors to read

// OneWire commands

Expand All @@ -22,22 +29,79 @@
#define ALARMSEARCH 0xEC // Query for alarm
#define STARTCONVO 0x44 // temperature reading

/** @brief Definition of callback function called on completion of measurement of all DS18S20 sensors
@note Example: void onMeasurment() { ... };
*/
typedef Delegate<void()> DS18S20CompletedDelegate;

/** @brief This class implements access to the DS18x20 range of temperature sensors
*/
class DS18S20
{
public:
DS18S20();
void Init(uint8_t); //call for OneWire init
void StartMeasure(); //Start measurement result after 1.2 seconds * number of sensors
void RegisterEndCallback(DS18S20CompletedDelegate); //Add function called of conversion end - "interrupt" function of end conversion
/** @brief Instantiate a DS18S20 object
*/
DS18S20();

/** @brief Initiate communication on 1-wire bus
* @param GPIO pin acting as 1-wire bus
*/
void Init(uint8_t);

/** @brief Start measurement of all connected sensors
* @note Scans for all connected sensors, measures value from each then calls the registered callback function
*/
void StartMeasure();

/** @brief Register the callback function that is run when measurement is complete
* @param Name of the callback function
* @note Callback function must be a DS18S20CommpleteDelegate type
*/
void RegisterEndCallback(DS18S20CompletedDelegate);

/** @brief Unregister the callback function to avoid activity after measurement is complete
*/
void UnRegisterCallback(); //Unset conversion end function

/** @brief Get the value of the last measurment from a sensor
* @param Index of sensor to retrieve value from
* @return Temperature value in degrees Celsius or zero for invalid sensor index
* @note Call IsValidTemperature() to check value is valid before calling this function
*/
float GetCelsius(uint8_t);

/** @brief Get the value of the last measurment from a sensor
* @param Index of sensor to retrieve value from
* @return Temperature value in degrees Fahrenheit or zero for invalid sensor index
* @note Call IsValidTemperature() to check value is valid before calling this function
*/
float GetFahrenheit(uint8_t);

/** @brief Check if the last measurement for a sensor is valid
* @param Index of sensor to check
* @return True if last measured temperature is valid, false for invalid value or invalid sensor index
* @note Call this function before reading value to ensure the value is valid
* @todo Initial code review suggests this is set once but never rechecked so may not be accurate
*/
bool IsValidTemperature(uint8_t);

/** @brief Check if measurement is in progress
* @return True if measurement is in progress
*/
bool MeasureStatus();

/** @brief Get the ID (1-wire address) of a sensor
* @param Index of sensor
* @return ID of sensor
*/
uint64_t GetSensorID(uint8_t);

/** @brief Get the quantity of sensors detected during last measurement
* @return Quantity of detected sensors
* @note Maximum quantity of sensors is defined in library header file by MAX_SENSORS
*/
uint8_t GetSensorsCount(); //how many the sensors detected

virtual ~DS18S20();

private:
Expand All @@ -63,10 +127,9 @@ class DS18S20


float celsius[MAX_SENSORS], fahrenheit[MAX_SENSORS];



};

/** @} */

#endif /* READFROMDS_H_ */

Loading

0 comments on commit 5c37d69

Please sign in to comment.