2 * Copyright © 2016 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
17 #include <ao_dma_samd21.h>
23 ao_button_callback(void)
32 AO_BEEP_TCC->ctrlbset = (SAMD21_TCC_CTRLB_CMD_READSYNC << SAMD21_TCC_CTRLB_CMD);
33 printf("pressed timer %ld\n", AO_BEEP_TCC->count);
35 ao_beep_for(AO_BEEP_MID_DEFAULT, AO_MS_TO_TICKS(200));
41 ao_exti_setup(&samd21_port_a, 10, AO_EXTI_MODE_FALLING | AO_EXTI_MODE_PULL_UP, ao_button_callback);
42 ao_exti_enable(&samd21_port_a, 10);
44 ao_arch_block_interrupts();
48 ao_arch_release_interrupts();
53 static struct ao_task ao_button_task;
55 const struct ao_cmds ao_test_cmds[] = {
56 { ao_beep_test, "b \0beep" },
77 ao_cmd_register(ao_test_cmds);
78 ao_add_task(&ao_button_task, ao_button, "button");