Atmel Software Framework

Quick start guide for Calendar service

This is the quick start guide for the Calendar service, with step-by-step instructions on how to configure and use the driver in a selection of use cases.

The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g., the main application function.

Basic use case - Calculate timestamp

Calendar use cases

Basic use case - Calculate timestamp

The use case will let the user calculate the corresponding timestamp to a date

Setup steps

Prerequisites

For the code of this use case to work, the following must be added to the project:

  1. A date struct with a date:
    struct calendar_date date = {
    .second = 12,
    .minute = 1,
    .hour = 22,
    .date = 8,
    .month = 2,
    .year = 1985
    };

Example code

No setup code is needed, the service is ready for use as-is.

Usage steps

Example code

Add to, e.g. the main loop in the application C-file:

uint32_t timestamp = calendar_date_to_timestamp(&date);

Workflow

  1. Convert date to timestamp: