Newer
Older
/*
* 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"
static void convert_cb_ADC_0(const struct adc_async_descriptor *const descr, const uint8_t channel)
{
}
/**
* Example of using ADC_0 to generate waveform.
*/
void ADC_0_example(void)
{
adc_async_register_callback(&ADC_0, 0, ADC_ASYNC_CONVERT_CB, convert_cb_ADC_0);
adc_async_enable_channel(&ADC_0, 0);
adc_async_start_conversion(&ADC_0);
static void button_on_PA16_pressed(void)
{
}
static void button_on_PA17_pressed(void)
{
}
static void button_on_PA13_pressed(void)
{
}
/**
* Example of using EXTERNAL_IRQ_0
*/
void EXTERNAL_IRQ_0_example(void)
{
ext_irq_register(PIN_PA16, button_on_PA16_pressed);
ext_irq_register(PIN_PA17, button_on_PA17_pressed);
ext_irq_register(PIN_PA13, button_on_PA13_pressed);
}
static struct io_descriptor *io;
static void I2C_0_rx_complete(const struct i2c_s_async_descriptor *const descr)
{
uint8_t c;
io_read(io, &c, 1);
}
void I2C_0_example(void)
{
i2c_s_async_get_io_descriptor(&I2C_0, &io);
i2c_s_async_register_callback(&I2C_0, I2C_S_RX_COMPLETE, I2C_0_rx_complete);
i2c_s_async_enable(&I2C_0);
}
void delay_example(void)
{
delay_ms(5000);
}
static struct timer_task TIMER_0_task1, TIMER_0_task2;
/**
* Example of using TIMER_0.
*/
static void TIMER_0_task1_cb(const struct timer_task *const timer_task)
{
}
static void TIMER_0_task2_cb(const struct timer_task *const timer_task)
{
}
void TIMER_0_example(void)
{
TIMER_0_task1.interval = 100;
TIMER_0_task1.cb = TIMER_0_task1_cb;
TIMER_0_task1.mode = TIMER_TASK_REPEAT;
TIMER_0_task2.interval = 200;
TIMER_0_task2.cb = TIMER_0_task2_cb;
TIMER_0_task2.mode = TIMER_TASK_REPEAT;
timer_add_task(&TIMER_0, &TIMER_0_task1);
timer_add_task(&TIMER_0, &TIMER_0_task2);
timer_start(&TIMER_0);
}
/**
* Example of using PWM_0.
*/
void PWM_0_example(void)
{
pwm_set_parameters(&PWM_0, 10000, 5000);
pwm_enable(&PWM_0);
}
/**
* Example of using PWM_1.
*/
void PWM_1_example(void)
{
pwm_set_parameters(&PWM_1, 10000, 5000);
pwm_enable(&PWM_1);
}
/**
* Example of using PWM_2.
*/
void PWM_2_example(void)
{
pwm_set_parameters(&PWM_2, 10000, 5000);
pwm_enable(&PWM_2);
}
/**
* Example of using WDT_0.
*/
void WDT_0_example(void)
{
uint32_t clk_rate;
uint16_t timeout_period;
clk_rate = 1000;
timeout_period = 4096;
wdt_set_timeout_period(&WDT_0, clk_rate, timeout_period);
wdt_enable(&WDT_0);
}