Clock Entity

BrainStem modules may have a real time clock. This capability will be listed in the product datasheet. The clock entity allows the user to set and read the real time clock.

Year (Get/Set)

clock . getYear <= (unsigned short) year
clock . setyear => (unsigned short) year

Gets or sets the year value of the real time clock.

Month (Get/Set)

clock . getMonth <= (unsigned char) month
clock . setMonth => (unsigned char) month

Gets or sets the month value of the real time clock. Valid values are 1-12.

Day (Get/Set)

clock . getDay <= (unsigned char) day
clock . setDay => (unsigned char) day

Gets or sets the day value of the real time clock. Valid values are 1-31 depending on the month setting.

Hour (Get/Set)

clock . getHour <= (unsigned char) hour
clock . setHour => (unsigned char) hour

Gets or sets the hour value of the real time clock. Valid values are 0-23.

Minute (Get/Set)

clock . getMinute <= (unsigned char) minute
clock . setMinute => (unsigned char) minute

Gets or sets the minute value of the real time clock. Valid values are 0-59.

Second (Get/Set)

clock . getSecond <= (unsigned char) second
clock . setSecond => (unsigned char) second

Gets or sets the second value of the real time clock. Valid values are 0-59.

Code Examples

C++

// All commands return aErr values when errors are encountered and aErrNone on
// success. Get requests fill the variable with the current clock value.

stem.clock.getYear(year);
stem.clock.setyear(year);
stem.clock.getMonth(month);
stem.clock.setMonth(month);
stem.clock.getDay(day);
stem.clock.setDay(day);
stem.clock.getHour(hour);
stem.clock.setHour(hour);
stem.clock.getMinute(minute);
stem.clock.setMinute(minute);
stem.clock.getSecond(second);
stem.clock.setSecond(second);

Reflex

// Get requests fill the variable with the value.

stem.clock.getYear(year);
stem.clock.setyear(year);
stem.clock.getMonth(month);
stem.clock.setMonth(month);
stem.clock.getDay(day);
stem.clock.setDay(day);
stem.clock.getHour(hour);
stem.clock.setHour(hour);
stem.clock.getMinute(minute);
stem.clock.setMinute(minute);
stem.clock.getSecond(second);
stem.clock.setSecond(second);

Python

year = stem.clock.getYear();
stem.clock.setyear(year);
month = stem.clock.getMonth();
stem.clock.setMonth(month);
day = stem.clock.getDay();
stem.clock.setDay(day);
hour = stem.clock.getHour();
stem.clock.setHour(hour);
minute = stem.clock.getMinute();
stem.clock.setMinute(minute);
second = stem.clock.getSecond();
stem.clock.setSecond(second);