mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 09:20:39 +03:00
mcp9808: updated doxygen tags and formatted sources
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
85b5c8a64e
commit
90bf469245
Binary file not shown.
Before Width: | Height: | Size: 319 KiB After Width: | Height: | Size: 49 KiB |
@ -1,24 +1,19 @@
|
|||||||
|
|
||||||
#include "mraa.hpp"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "mcp9808.h"
|
#include "mcp9808.h"
|
||||||
|
|
||||||
|
#include "mraa.hpp"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
//! [Interesting]
|
||||||
int command;
|
int command;
|
||||||
upm::MCP9808 *temp = new upm::MCP9808(6);
|
upm::MCP9808 *temp = new upm::MCP9808(6);
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
||||||
cout << endl;
|
cout << endl;
|
||||||
cout << "1 - read temp \t" ;
|
cout << "1 - read temp \t" ;
|
||||||
cout << "2 - sleep mode \t";
|
cout << "2 - sleep mode \t";
|
||||||
@ -43,7 +38,6 @@ int main()
|
|||||||
cout << "Enter a command: ";
|
cout << "Enter a command: ";
|
||||||
cin >> command;
|
cin >> command;
|
||||||
|
|
||||||
|
|
||||||
switch(command)
|
switch(command)
|
||||||
{
|
{
|
||||||
float t;
|
float t;
|
||||||
@ -164,8 +158,6 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}while (command != -1 );
|
}while (command != -1 );
|
||||||
|
//! [Interesting]
|
||||||
|
|
||||||
|
|
||||||
return MRAA_SUCCESS;
|
return MRAA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -42,16 +42,23 @@
|
|||||||
#define MCP9808_CONFIG_INTCLR 0x2000
|
#define MCP9808_CONFIG_INTCLR 0x2000
|
||||||
|
|
||||||
namespace upm {
|
namespace upm {
|
||||||
|
/**
|
||||||
|
* @brief MCP9808 precision temperature sensor library
|
||||||
|
* @defgroup mcp9808 libupm-mcp9808
|
||||||
|
* @ingroup adafruit i2c temp
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @library mcp9808
|
* @library mcp9808
|
||||||
* @sensor MCP9808
|
* @sensor MCP9808
|
||||||
* @comname MCP9808
|
* @comname MCP9808 Temperature Sensor
|
||||||
* @type Temperature, precision.
|
* @type temp
|
||||||
* @man https://learn.adafruit.com/adafruit-mcp9808-precision-i2c-temperature-sensor-guide/overview
|
* @man adafruit
|
||||||
* @man http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf
|
|
||||||
* @con i2c
|
* @con i2c
|
||||||
|
* @web https://learn.adafruit.com/adafruit-mcp9808-precision-i2c-temperature-sensor-guide/overview
|
||||||
|
* @web http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf
|
||||||
*
|
*
|
||||||
* @brief API for MCP9808 precision temprature sensor
|
* @brief API for MCP9808 precision temprature sensor
|
||||||
|
*
|
||||||
* The MCP9808 digital temperature sensor converts temperatures between -20°C and +100°C
|
* The MCP9808 digital temperature sensor converts temperatures between -20°C and +100°C
|
||||||
* to a digital word with ±0.5°C (max.) accuracy. The MCP9808 comes with user-programmable
|
* to a digital word with ±0.5°C (max.) accuracy. The MCP9808 comes with user-programmable
|
||||||
* registers that provide flexibility for temperature sensing applications. The registers
|
* registers that provide flexibility for temperature sensing applications. The registers
|
||||||
@ -170,7 +177,6 @@ namespace upm {
|
|||||||
*/
|
*/
|
||||||
float getTemp(void);
|
float getTemp(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cause the devices to either sleep or wakeup.
|
* Will cause the devices to either sleep or wakeup.
|
||||||
*
|
*
|
||||||
@ -307,9 +313,6 @@ namespace upm {
|
|||||||
*/
|
*/
|
||||||
uint16_t getDevicedId();
|
uint16_t getDevicedId();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
bool m_celsius;
|
bool m_celsius;
|
||||||
@ -322,8 +325,5 @@ namespace upm {
|
|||||||
float getTempValue(uint16_t value);
|
float getTempValue(uint16_t value);
|
||||||
void updateConfigRegister(uint16_t update, bool on = true);
|
void updateConfigRegister(uint16_t update, bool on = true);
|
||||||
uint16_t swapWord(uint16_t value);
|
uint16_t swapWord(uint16_t value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user