board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Gerson Fernando Budke
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
21 #include "cpu.h"
22 #include "macros/units.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 #define CLOCK_CORECLOCK MHZ(32)
32 
46 #ifndef STDIO_UART_BAUDRATE
47 #define STDIO_UART_BAUDRATE (115200U)
48 #endif
55 #define LED_PORT PORTR
56 
57 #define LED0_PIN GPIO_PIN(PORT_R, 0)
58 #define LED0_MODE GPIO_OUT
59 #define LED0_MASK (PIN0_bm)
60 #define LED0_ON (LED_PORT.OUTCLR = LED0_MASK)
61 #define LED0_OFF (LED_PORT.OUTSET = LED0_MASK)
62 #define LED0_TOGGLE (LED_PORT.OUTTGL = LED0_MASK)
63 
64 #define LED1_PIN GPIO_PIN(PORT_R, 1)
65 #define LED1_MODE GPIO_OUT
66 #define LED1_MASK (PIN1_bm)
67 #define LED1_ON (LED_PORT.OUTCLR = LED1_MASK)
68 #define LED1_OFF (LED_PORT.OUTSET = LED1_MASK)
69 #define LED1_TOGGLE (LED_PORT.OUTTGL = LED1_MASK)
70 
71 #define LED_PORT_MASK (LED0_MASK | LED1_MASK)
78 #define BTN0_PIN GPIO_PIN(PORT_E, 5)
79 #define BTN0_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
80 #define BTN0_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
81 
82 #define BTN1_PIN GPIO_PIN(PORT_F, 1)
83 #define BTN1_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
84 #define BTN1_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
85 
86 #define BTN2_PIN GPIO_PIN(PORT_F, 2)
87 #define BTN2_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
88 #define BTN2_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
105 #define XTIMER_DEV TIMER_DEV(0)
106 #define XTIMER_CHAN (0)
107 #define XTIMER_WIDTH (16)
108 #define XTIMER_HZ KHZ(500)
109 #define XTIMER_BACKOFF (150)
112 #ifdef __cplusplus
113 }
114 #endif
115 
Unit helper macros.