SW RTC Implementation - A Custom Dialog Implementation¶
Example description¶
This application demonstrates a Real Time Clock (RTC) implementation, based on the low power (LP) clock used. In addition, application exhibits ALERT
as well as ALARM
functionalities. User is free to enable/disable any of the aforementioned functionalities, individually.
Warning: The RTC mechanism should be up and running before using ALARM
functionality.
HW & SW Configurations¶
- Hardware Configurations
- This example runs on a DA1468x Bluetooth Smart SoC.
- Either a DA1468x Basic or Pro Development Kit is needed for this example.
- Software Configurations
- Download the latest SDK version for the DA1468x family of devices.
- SEGGER’s J-Link tools should be downloaded and installed.
How to run the example¶
Initial Setup¶
- Download the source code from the Support Website.
- Import the project into your workspace.
- Connect the target device to your host PC.
- Modify the source code as needed:
The project exhibits three application tasks to demonstrate all the application feautures. In custom_config_xxx.h, select the tasks of interest using the appropriate macros. A value set to ‘1’ will create/enable the task, whilst a value set to ‘0’ will discard the task.
#define SW_RTC_TASK_ENABLE (1)
#define ALERT_TASK_ENABLE (1)
#define ALARM_TASK_ENABLE (1)
In sw_rtc_task.c, declare time parameters of your choice. These values will be the starting point for all the subsequent SW RTC operations:
__RETAINED_RW sw_rtc_date_time_t date_time = {
.date = {
.year = 2018,
.month = 9,
.month_date = 9,
},
.time = {
.hour = 0,
.min = 0,
.sec = 0,
}
};
Optionally, enable/disable debugging messages on the serial console (enabled by default):
#define SW_RTC_DBG_MESSAGES_CONSOLE 1
In alert.task.c, declare alert parameters of your choice:
__RETAINED_RW time_alert_t my_alert = {
.hour = 4,
.min = 2,
.sec = 5,
.repeat_h = false,
.repeat_m = true,
.repeat_s = false,
};
Optionally, enable/disable debugging messages on the serial console (enabled by default):
#define TIME_ALERT_DBG_MESSAGES_CONSOLE 1
Users may also enable the white LED1 on Pro DevKit (disabled by default):
#define TIME_ALERT_BREATH_TIMER_EN 0
In alarm_task.c, declare alarm parameters of your choice:
__RETAINED_RW time_alarm_t alarm_cfg = {
.date = {
.year = 2018,
.month = 9,
.month_date = 9,
},
.time = {
.hour = 0,
.min = 1,
.sec = 0,
}
};
Optionally, enable/disable debugging messages on the serial console (enabled by default):
#define TIME_ALARM_DBG_MESSAGES_CONSOLE 1
- Compile the code (either in RAM or QSPI build configuration) and load it into the chip.
- Open a serial terminal (115200/8 - N - 1)
- Press the reset button on DevKit to start executing the application.
- Press the K1 button on Pro DevKit. If enabled, a debugging message will be displayed on the console incdicating the current date and time.
- Upon an
ALERT
event, a message will be displayed on the serial console indicating the source of the alert. If blinking functionality has been enabled, LED1 on Pro DevKit will start blinking. At any time, it can be disabled by pressing K1 button.
- Upon an
ALARM
event, a message will be displayed on the serial console indicating the advent of the event.
Known Limitations¶
- The recommended
LP
clock is the external crystal, that isXTAL32768
. Due to its nature,RCX
is changing its frequency over time. These drifts, will be reflected in RTC measurements.
License¶
Copyright (c) 2018 Dialog Semiconductor. All rights reserved.
This software (“Software”) is owned by Dialog Semiconductor. By using this Software you agree that Dialog Semiconductor retains all intellectual property and proprietary rights in and to this Software and any use, reproduction, disclosure or distribution of the Software without express written permission or a license agreement from Dialog Semiconductor is strictly prohibited. This Software is solely for use on or in conjunction with Dialog Semiconductor products.
EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES OR AS REQUIRED BY LAW, THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES OR BY LAW, IN NO EVENT SHALL DIALOG SEMICONDUCTOR BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE SOFTWARE.