Introduction

This guide explains the RTC (Waspmote's internal Real Time Clock) features and functions. There are some variations in this library for our new product lines Waspmote v15 and Plug & Sense! v15, released on October 2016.

Some functions may not be compatible with Waspmote v12 or Plug & Sense! v12. Besides, old functions may no longer exist. If you are using previous versions of our products, please use the corresponding guides, available on our Development website.

You can get more information about the generation change on the document "New generation of Libelium product lines".

Differences of this library compared to the previous version:

  • Alarm2 is no longer available

  • Temperature sensor is no longer available

  • New RTC Watchdog reset

Waspmote libraries

Waspmote RTC files

WaspRTC.h ; WaspRTC.cpp

Constructor

To start using the Waspmote RTC library, an object from class WaspRTC must be created. This object, called RTC, is created inside the Waspmote RTC library and it is public to all libraries. It is used through the guide to show how Waspmote RTC library works.

When creating this constructor, no variables are initialized by default.

Pre-Defined constants

There are some constants defined in 'WaspRTC.h' to help with the comprehension of the code when reading the first times. These constants are related with RTC register addresses, some functions, inputs and alarm modes.

Variables

Some variables have been defined for storing time, date and alarm data. These variables have been named after the data they store (i.e. RTC.year stores the year, and RTC.month stores the month).

The Waspmote RTC allows setting the day of the week, which is a number between 1-7. This part of the date can be modified by the user providing they are sequential, it meaning that if Sunday is equal to 1, Monday must be equal to 2.

An array called registersRTC has been created for storing the data to send to the RTC. This array is used in each writing or reading operation.

Flags

There are various flags used for handling interruptions while using Waspmote RTC.

Global Interruption Flag

It is used to check the port in which the interruption has got activated. It is used in this library and other libraries which generate interrupts too.

Global Interruption Flag Array

It is used to store the number of times each interruption has been detected. It is used in this library and other libraries which generate interrupts too.

Global Interruption Counter

It is used to store the number of interruptions detected. It is used in this library and other libraries which generate interrupts too.

Last updated