Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 1 | /* |
Kévin Redon | 78d2f44 | 2019-01-24 18:45:59 +0100 | [diff] [blame^] | 2 | * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | */ |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 18 | |
| 19 | #include "atmel_start.h" |
| 20 | #include "atmel_start_pins.h" |
| 21 | |
Kévin Redon | 78d2f44 | 2019-01-24 18:45:59 +0100 | [diff] [blame^] | 22 | volatile static uint32_t data_arrived = 0; |
| 23 | |
| 24 | static void tx_cb_UART_debug(const struct usart_async_descriptor *const io_descr) |
| 25 | { |
| 26 | /* Transfer completed */ |
| 27 | gpio_toggle_pin_level(LED_system); |
| 28 | } |
| 29 | |
| 30 | static void rx_cb_UART_debug(const struct usart_async_descriptor *const io_descr) |
| 31 | { |
| 32 | /* Receive completed */ |
| 33 | gpio_toggle_pin_level(LED_system); |
| 34 | data_arrived = 1; |
| 35 | } |
| 36 | |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 37 | int main(void) |
| 38 | { |
| 39 | atmel_start_init(); |
Kévin Redon | 78d2f44 | 2019-01-24 18:45:59 +0100 | [diff] [blame^] | 40 | |
| 41 | usart_async_register_callback(&UART_debug, USART_ASYNC_TXC_CB, tx_cb_UART_debug); |
| 42 | usart_async_register_callback(&UART_debug, USART_ASYNC_RXC_CB, rx_cb_UART_debug); |
| 43 | usart_async_enable(&UART_debug); |
| 44 | |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 45 | cdcd_acm_example(); |
| 46 | } |