Loading...
Searching...
No Matches
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
19#ifndef BOARD_H
20#define BOARD_H
21
22#include "cpu.h"
23#include "macros/units.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32#define CLOCK_CORECLOCK MHZ(32)
33
37#define STDIO_UART_DEV UART_DEV(2)
38
52#ifndef STDIO_UART_BAUDRATE
53#define STDIO_UART_BAUDRATE (115200U)
54#endif
61#define LED_PORT PORTE
62
63#define LED0_PIN GPIO_PIN(PORT_E, 0)
64#define LED0_MODE GPIO_OUT
65#define LED0_MASK (PIN0_bm)
66#define LED0_ON (LED_PORT.OUTCLR = LED0_MASK)
67#define LED0_OFF (LED_PORT.OUTSET = LED0_MASK)
68#define LED0_TOGGLE (LED_PORT.OUTTGL = LED0_MASK)
69
70#define LED1_PIN GPIO_PIN(PORT_E, 1)
71#define LED1_MODE GPIO_OUT
72#define LED1_MASK (PIN1_bm)
73#define LED1_ON (LED_PORT.OUTCLR = LED1_MASK)
74#define LED1_OFF (LED_PORT.OUTSET = LED1_MASK)
75#define LED1_TOGGLE (LED_PORT.OUTTGL = LED1_MASK)
76
77#define LED2_PIN GPIO_PIN(PORT_E, 2)
78#define LED2_MODE GPIO_OUT
79#define LED2_MASK (PIN2_bm)
80#define LED2_ON (LED_PORT.OUTCLR = LED2_MASK)
81#define LED2_OFF (LED_PORT.OUTSET = LED2_MASK)
82#define LED2_TOGGLE (LED_PORT.OUTTGL = LED2_MASK)
83
84#define LED3_PIN GPIO_PIN(PORT_E, 3)
85#define LED3_MODE GPIO_OUT
86#define LED3_MASK (PIN3_bm)
87#define LED3_ON (LED_PORT.OUTCLR = LED3_MASK)
88#define LED3_OFF (LED_PORT.OUTSET = LED3_MASK)
89#define LED3_TOGGLE (LED_PORT.OUTTGL = LED3_MASK)
90
91#define LED4_PIN GPIO_PIN(PORT_E, 4)
92#define LED4_MODE GPIO_OUT
93#define LED4_MASK (PIN4_bm)
94#define LED4_ON (LED_PORT.OUTCLR = LED4_MASK)
95#define LED4_OFF (LED_PORT.OUTSET = LED4_MASK)
96#define LED4_TOGGLE (LED_PORT.OUTTGL = LED4_MASK)
97
98#define LED5_PIN GPIO_PIN(PORT_E, 5)
99#define LED5_MODE GPIO_OUT
100#define LED5_MASK (PIN5_bm)
101#define LED5_ON (LED_PORT.OUTCLR = LED5_MASK)
102#define LED5_OFF (LED_PORT.OUTSET = LED5_MASK)
103#define LED5_TOGGLE (LED_PORT.OUTTGL = LED5_MASK)
104
105#define LED6_PIN GPIO_PIN(PORT_E, 6)
106#define LED6_MODE GPIO_OUT
107#define LED6_MASK (PIN6_bm)
108#define LED6_ON (LED_PORT.OUTCLR = LED6_MASK)
109#define LED6_OFF (LED_PORT.OUTSET = LED6_MASK)
110#define LED6_TOGGLE (LED_PORT.OUTTGL = LED6_MASK)
111
112#define LED7_PIN GPIO_PIN(PORT_E, 7)
113#define LED7_MODE GPIO_OUT
114#define LED7_MASK (PIN7_bm)
115#define LED7_ON (LED_PORT.OUTCLR = LED7_MASK)
116#define LED7_OFF (LED_PORT.OUTSET = LED7_MASK)
117#define LED7_TOGGLE (LED_PORT.OUTTGL = LED7_MASK)
118
119#define LED_PORT_MASK (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK | \
120 LED4_MASK | LED5_MASK | LED6_MASK | LED7_MASK)
127#define BTN0_PIN GPIO_PIN(PORT_D, 0)
128#define BTN0_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
129#define BTN0_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
130
131#define BTN1_PIN GPIO_PIN(PORT_D, 1)
132#define BTN1_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
133#define BTN1_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
134
135#define BTN2_PIN GPIO_PIN(PORT_D, 2)
136#define BTN2_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
137#define BTN2_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
138
139#define BTN3_PIN GPIO_PIN(PORT_D, 3)
140#define BTN3_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
141#define BTN3_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
142
143#define BTN4_PIN GPIO_PIN(PORT_D, 4)
144#define BTN4_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
145#define BTN4_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
146
147#define BTN5_PIN GPIO_PIN(PORT_D, 5)
148#define BTN5_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
149#define BTN5_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
150
151#define BTN6_PIN GPIO_PIN(PORT_R, 0)
152#define BTN6_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
153#define BTN6_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
154
155#define BTN7_PIN GPIO_PIN(PORT_R, 1)
156#define BTN7_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
157#define BTN7_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
174#define XTIMER_DEV TIMER_DEV(0)
175#define XTIMER_CHAN (0)
176#define XTIMER_WIDTH (16)
177#define XTIMER_HZ KHZ(500)
178#define XTIMER_BACKOFF (150)
181#ifdef __cplusplus
182}
183#endif
184
185#endif /* BOARD_H */
Unit helper macros.