upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
MAXDS3231M Class Reference

API for the MAXDS3231M I2C Real-Time Clock. More...

Detailed Description

This module defines the API for MAXDS3231M

sensor = new upm::MAXDS3231M(0, ADDR);
t.second = 1;
t.minute = 3;
t.hour = 3;
t.day = 3;
t.month = 3;
t.year = 3;
t.weekDay = 3;
sensor->setDate (t); // Note, second should be set to 1.
usleep (500000);
while (!doWork) {
if (sensor->getDate (t)) {
std::cout << (int)t.hour << ":" << (int)t.minute << ":" << (int)t.second << std::endl;
}
std::cout << "Temperature " << sensor->getTemperature() << std::endl;
usleep (1000000);
}

Public Member Functions

 MAXDS3231M (int bus=0, int devAddr=0x68)
 
void setDate (Time3231 &time)
 
bool getDate (Time3231 &time)
 
uint16_t getTemperature ()
 
std::string name ()
 

Constructor & Destructor Documentation

MAXDS3231M ( int  bus = 0,
int  devAddr = 0x68 
)

Instantiates an MAXDS3231M object

Parameters
busNumber of the used bus
devAddrAddress of the used I2C device

Member Function Documentation

void setDate ( Time3231 time)

Sets the date and time on the chip.

Parameters
timeTime structure
bool getDate ( Time3231 time)

Gets the date and time from the chip.

Parameters
timeTime structure
uint16_t getTemperature ( void  )

Gets the on-board temperature.

std::string name ( )
inline

Returns the name of the component


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