upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions
DS1808LC Class Reference

API for DS1808 Dual Log Digital Potentiometer as a Light Controller. More...

Detailed Description

The Maxim Integrated DS1808 Dual Log Digital Potentiometer

upm::DS1808LC lightController(DS1808_GPIO_PWR, EDISON_I2C_BUS);
std::cout << "Existing state: ";
printState(lightController);
if (argc == 2) {
std::string arg = argv[1];
int brightness = ::atoi(argv[1]);
if (brightness > 0) {
lightController.setPowerOn();
lightController.setBrightness(brightness);
} else
lightController.setPowerOff();
}
std::cout << "Now: ";
printState(lightController);

Public Member Functions

 DS1808LC (int gpioPower, int i2cBus)
 
const char * getModuleName ()
 
bool isPowered ()
 
void setPowerOn ()
 
void setPowerOff ()
 
int getBrightness ()
 
void setBrightness (int dutyPercent)
 

Member Function Documentation

const char* getModuleName ( )
inlinevirtual

Returns name of module. This is the string in library name after libupm_

Returns
name of module

Implements IModuleStatus.

Here is the call graph for this function:

bool isPowered ( )
virtual

Get power state

Returns
true if powered, false otherwise
Exceptions
std::runtime_error

Implements ILightController.

Here is the caller graph for this function:

void setPowerOn ( )
virtual

Turn on power

Exceptions
std::runtime_error

Implements ILightController.

Here is the call graph for this function:

Here is the caller graph for this function:

void setPowerOff ( )
virtual

Turn off power

Exceptions
std::runtime_error

Implements ILightController.

Here is the caller graph for this function:

int getBrightness ( )
virtual

Get brightness

Returns
brightness as percentage
Exceptions
std::runtime_error

Implements ILightController.

Here is the caller graph for this function:

void setBrightness ( int  percent)
virtual

Set brightness

Parameters
percentbrightness as percentage
Exceptions
std::runtime_error

Implements ILightController.

Here is the caller graph for this function:

Inheritance diagram for DS1808LC:
Inheritance graph
[legend]
Collaboration diagram for DS1808LC:
Collaboration graph
[legend]

The documentation for this class was generated from the following files: