You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.7 KiB
C

4 years ago
/*
* Code generated from Atmel Start.
*
* This file will be overwritten when reconfiguring your Atmel Start project.
* Please copy examples or other code you want to keep to a separate file
* to avoid losing it when reconfiguring.
*/
#include "driver_examples.h"
#include "driver_init.h"
#include "utils.h"
4 years ago
/**
* Example of using CALENDER_INTERFACE.
*/
static struct calendar_alarm alarm;
static void alarm_cb(struct calendar_descriptor *const descr)
{
/* alarm expired */
}
void CALENDER_INTERFACE_example(void)
{
struct calendar_date date;
struct calendar_time time;
calendar_enable(&CALENDER_INTERFACE);
date.year = 2000;
date.month = 12;
date.day = 31;
time.hour = 12;
time.min = 59;
time.sec = 59;
calendar_set_date(&CALENDER_INTERFACE, &date);
calendar_set_time(&CALENDER_INTERFACE, &time);
alarm.cal_alarm.datetime.time.sec = 4;
alarm.cal_alarm.option = CALENDAR_ALARM_MATCH_SEC;
alarm.cal_alarm.mode = REPEAT;
calendar_set_alarm(&CALENDER_INTERFACE, &alarm, alarm_cb);
}
4 years ago
/**
* Example of using USART_DBG to write "Hello World" using the IO abstraction.
*/
void USART_DBG_example(void)
{
struct io_descriptor *io;
usart_sync_get_io_descriptor(&USART_DBG, &io);
usart_sync_enable(&USART_DBG);
io_write(io, (uint8_t *)"Hello World!", 12);
}
/**
* Example of using SPI_SD_MMC to write "Hello World" using the IO abstraction.
*/
static uint8_t example_SPI_SD_MMC[12] = "Hello World!";
void SPI_SD_MMC_example(void)
{
struct io_descriptor *io;
spi_m_sync_get_io_descriptor(&SPI_SD_MMC, &io);
spi_m_sync_enable(&SPI_SD_MMC);
io_write(io, example_SPI_SD_MMC, 12);
}
void delay_example(void)
{
delay_ms(5000);
}