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
47#ifndef STDIO_UART_BAUDRATE
48#define STDIO_UART_BAUDRATE (115200U)
49#endif
56#define LED_PORT PORTR
57
58#define LED0_PIN GPIO_PIN(PORT_R, 0)
59#define LED0_MODE GPIO_OUT
60#define LED0_MASK (PIN0_bm)
61#define LED0_ON (LED_PORT.OUTCLR = LED0_MASK)
62#define LED0_OFF (LED_PORT.OUTSET = LED0_MASK)
63#define LED0_TOGGLE (LED_PORT.OUTTGL = LED0_MASK)
64
65#define LED1_PIN GPIO_PIN(PORT_R, 1)
66#define LED1_MODE GPIO_OUT
67#define LED1_MASK (PIN1_bm)
68#define LED1_ON (LED_PORT.OUTCLR = LED1_MASK)
69#define LED1_OFF (LED_PORT.OUTSET = LED1_MASK)
70#define LED1_TOGGLE (LED_PORT.OUTTGL = LED1_MASK)
71
72#define LED_PORT_MASK (LED0_MASK | LED1_MASK)
79#define BTN0_PIN GPIO_PIN(PORT_E, 5)
80#define BTN0_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
81#define BTN0_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
82
83#define BTN1_PIN GPIO_PIN(PORT_F, 1)
84#define BTN1_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
85#define BTN1_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
86
87#define BTN2_PIN GPIO_PIN(PORT_F, 2)
88#define BTN2_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
89#define BTN2_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
106#define XTIMER_DEV TIMER_DEV(0)
107#define XTIMER_CHAN (0)
108#define XTIMER_WIDTH (16)
109#define XTIMER_HZ KHZ(500)
110#define XTIMER_BACKOFF (150)
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* BOARD_H */
Unit helper macros.