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

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

Detailed Description

This module defines the API for MAXDS3231M

upm::MAXDS3231M sensor(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.
upm_delay_us(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;
upm_delay_us(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: