mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
tsl2561: fix indentation, style and namespace
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
parent
685adc561b
commit
2ea12da8b8
@ -33,7 +33,8 @@
|
||||
using namespace upm;
|
||||
|
||||
|
||||
TSL2561::TSL2561(int bus, uint8_t devAddr, uint8_t gain, uint8_t integrationTime) {
|
||||
TSL2561::TSL2561(int bus, uint8_t devAddr, uint8_t gain, uint8_t integrationTime)
|
||||
{
|
||||
m_controlAddr = devAddr;
|
||||
m_bus = bus;
|
||||
m_gain = gain ;
|
||||
@ -73,7 +74,8 @@ TSL2561::TSL2561(int bus, uint8_t devAddr, uint8_t gain, uint8_t integrationTime
|
||||
}
|
||||
}
|
||||
|
||||
TSL2561::~TSL2561() {
|
||||
TSL2561::~TSL2561()
|
||||
{
|
||||
// POWER DOWN
|
||||
i2cWriteReg(REGISTER_Control,CONTROL_POWEROFF);
|
||||
|
||||
@ -186,7 +188,8 @@ TSL2561::getLux(int &lux)
|
||||
|
||||
|
||||
mraa_result_t
|
||||
TSL2561::i2cWriteReg (uint8_t reg, uint8_t value) {
|
||||
TSL2561::i2cWriteReg (uint8_t reg, uint8_t value)
|
||||
{
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
// Start transmission to device
|
||||
@ -215,7 +218,8 @@ TSL2561::i2cWriteReg (uint8_t reg, uint8_t value) {
|
||||
}
|
||||
|
||||
mraa_result_t
|
||||
TSL2561::i2cReadReg(uint8_t reg, uint8_t &data) {
|
||||
TSL2561::i2cReadReg(uint8_t reg, uint8_t &data)
|
||||
{
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
// Start transmission to device
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Author: Nandkishor Sonar <Nandkishor.Sonar@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* * LIGHT-TO-DIGITAL CONVERTER [TAOS-TSL2561]
|
||||
* LIGHT-TO-DIGITAL CONVERTER [TAOS-TSL2561]
|
||||
* Inspiration and lux calculation formulas from data sheet
|
||||
* URL: http://www.adafruit.com/datasheets/TSL2561.pdf
|
||||
*
|
||||
@ -32,6 +32,8 @@
|
||||
#include <mraa/i2c.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace upm {
|
||||
|
||||
#define TSL2561_Address (0x29) //Device address
|
||||
|
||||
// Integration time
|
||||
@ -89,9 +91,6 @@
|
||||
#define LUX_B8C (0x0000) // 0.000 * 2^LUX_SCALE
|
||||
#define LUX_M8C (0x0000) // 0.000 * 2^LUX_SCALE
|
||||
|
||||
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief TSL2561 Digital Light Sensor library
|
||||
* @defgroup tsl2561 libupm-tsl2561
|
||||
@ -116,6 +115,8 @@ class TSL2561{
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr address of used i2c device
|
||||
* @param gain the correct gain to use
|
||||
* @param integration time to use
|
||||
*/
|
||||
TSL2561(int bus=0, uint8_t devAddr=TSL2561_Address, uint8_t gain=GAIN_0X, uint8_t integrationTime=INTEGRATION_TIME1_101MS);
|
||||
|
||||
@ -139,8 +140,7 @@ class TSL2561{
|
||||
*
|
||||
* @param reg addess to write
|
||||
* @param value to write
|
||||
*
|
||||
* Return mraa_result_t
|
||||
* @return mraa_result_t
|
||||
*/
|
||||
mraa_result_t i2cWriteReg(uint8_t reg, uint8_t value);
|
||||
|
||||
@ -149,8 +149,7 @@ class TSL2561{
|
||||
*
|
||||
* @param reg addess to read
|
||||
* @param data byte read from the register
|
||||
*
|
||||
* Return mraa_result_t
|
||||
* @return mraa_result_t
|
||||
*/
|
||||
mraa_result_t i2cReadReg(uint8_t reg, uint8_t &data);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user