board.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2021 Gerson Fernando Budke
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #include "cpu.h"
19 #include "macros/units.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
28 #define CLOCK_CORECLOCK MHZ(32)
29 
43 #ifndef STDIO_UART_BAUDRATE
44 #define STDIO_UART_BAUDRATE (115200U)
45 #endif
52 #define LED_PORT PORTR
53 
54 #define LED0_PIN GPIO_PIN(PORT_R, 0)
55 #define LED0_MODE GPIO_OUT
56 #define LED0_MASK (PIN0_bm)
57 #define LED0_ON (LED_PORT.OUTCLR = LED0_MASK)
58 #define LED0_OFF (LED_PORT.OUTSET = LED0_MASK)
59 #define LED0_TOGGLE (LED_PORT.OUTTGL = LED0_MASK)
60 
61 #define LED1_PIN GPIO_PIN(PORT_R, 1)
62 #define LED1_MODE GPIO_OUT
63 #define LED1_MASK (PIN1_bm)
64 #define LED1_ON (LED_PORT.OUTCLR = LED1_MASK)
65 #define LED1_OFF (LED_PORT.OUTSET = LED1_MASK)
66 #define LED1_TOGGLE (LED_PORT.OUTTGL = LED1_MASK)
67 
68 #define LED_PORT_MASK (LED0_MASK | LED1_MASK)
75 #define BTN0_PIN GPIO_PIN(PORT_E, 5)
76 #define BTN0_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
77 #define BTN0_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
78 
79 #define BTN1_PIN GPIO_PIN(PORT_F, 1)
80 #define BTN1_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
81 #define BTN1_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
82 
83 #define BTN2_PIN GPIO_PIN(PORT_F, 2)
84 #define BTN2_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
85 #define BTN2_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
102 #define XTIMER_DEV TIMER_DEV(0)
103 #define XTIMER_CHAN (0)
104 #define XTIMER_WIDTH (16)
105 #define XTIMER_HZ KHZ(500)
106 #define XTIMER_BACKOFF (150)
109 #ifdef __cplusplus
110 }
111 #endif
112 
Unit helper macros.