sqefqsdf

Dependencies:   C12832 EthernetInterface LM75B mbed-rtos mbed

Fork of app-board-LM75B by Chris Styles

Committer:
gimohd
Date:
Thu Mar 23 12:51:27 2017 +0000
Revision:
6:77a4c45f6416
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gimohd 6:77a4c45f6416 1 #ifndef TemperatureSensor_H
gimohd 6:77a4c45f6416 2 #define TemperatureSensor_H
gimohd 6:77a4c45f6416 3 #include "LM75B.h"
gimohd 6:77a4c45f6416 4 #include <mbed.h>
gimohd 6:77a4c45f6416 5 #include <string>
gimohd 6:77a4c45f6416 6 #include <vector>
gimohd 6:77a4c45f6416 7
gimohd 6:77a4c45f6416 8
gimohd 6:77a4c45f6416 9 /** Temperature class.
gimohd 6:77a4c45f6416 10 * Utilised to read the
gimohd 6:77a4c45f6416 11 * with the help of a TCPSocketServer, but also to send packets to other clients
gimohd 6:77a4c45f6416 12 * with a TCPSocketConnection
gimohd 6:77a4c45f6416 13 * @ref LM75B
gimohd 6:77a4c45f6416 14 */
gimohd 6:77a4c45f6416 15 class TemperatureSensor : public LM75B
gimohd 6:77a4c45f6416 16 {
gimohd 6:77a4c45f6416 17 public:
gimohd 6:77a4c45f6416 18
gimohd 6:77a4c45f6416 19 /** Create an Temperature Sensor object (using the default ADDRESS_0)
gimohd 6:77a4c45f6416 20 * connected to the specified I2C pins with the specified I2C slave address
gimohd 6:77a4c45f6416 21 *
gimohd 6:77a4c45f6416 22 * @param sda The I2C data pin.
gimohd 6:77a4c45f6416 23 * @param scl The I2C clock pin.
gimohd 6:77a4c45f6416 24 */
gimohd 6:77a4c45f6416 25 TemperatureSensor(PinName sca, PinName scl);
gimohd 6:77a4c45f6416 26
gimohd 6:77a4c45f6416 27 /** Convert 11 bit sign extended value (int16_t) to a float in °C
gimohd 6:77a4c45f6416 28 *
gimohd 6:77a4c45f6416 29 * @param value temperature expressed as 11 bit sign extended values of type int16_t
gimohd 6:77a4c45f6416 30 * @returns the temperature in °C
gimohd 6:77a4c45f6416 31 */
gimohd 6:77a4c45f6416 32 float shortToFloat(int16_t value);
gimohd 6:77a4c45f6416 33
gimohd 6:77a4c45f6416 34 /** Get the current temperature measurement of the TemperatureSensor
gimohd 6:77a4c45f6416 35 *
gimohd 6:77a4c45f6416 36 * @returns The current temperature measurement as 11 bit extended sign value
gimohd 6:77a4c45f6416 37 */
gimohd 6:77a4c45f6416 38 int16_t temp_short(void);
gimohd 6:77a4c45f6416 39
gimohd 6:77a4c45f6416 40 /** Get the average temperature of a vector of 11 bit sign extended values
gimohd 6:77a4c45f6416 41 *
gimohd 6:77a4c45f6416 42 * @param TMP and std::vector of temperatures expressed as 11 bit sign extended values of type int16_t
gimohd 6:77a4c45f6416 43 * @returns the average temperature in °C
gimohd 6:77a4c45f6416 44 */
gimohd 6:77a4c45f6416 45 float average(std::vector<int16_t> TMP);
gimohd 6:77a4c45f6416 46
gimohd 6:77a4c45f6416 47 private:
gimohd 6:77a4c45f6416 48 PinName sca;
gimohd 6:77a4c45f6416 49 PinName scl;
gimohd 6:77a4c45f6416 50 };
gimohd 6:77a4c45f6416 51
gimohd 6:77a4c45f6416 52 #endif