Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
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
36
#define STDIO_UART_DEV UART_DEV(2)
37
51
#ifndef STDIO_UART_BAUDRATE
52
#define STDIO_UART_BAUDRATE (115200U)
53
#endif
60
#define LED_PORT PORTE
61
62
#define LED0_PIN GPIO_PIN(PORT_E, 0)
63
#define LED0_MODE GPIO_OUT
64
#define LED0_MASK (PIN0_bm)
65
#define LED0_ON (LED_PORT.OUTCLR = LED0_MASK)
66
#define LED0_OFF (LED_PORT.OUTSET = LED0_MASK)
67
#define LED0_TOGGLE (LED_PORT.OUTTGL = LED0_MASK)
68
69
#define LED1_PIN GPIO_PIN(PORT_E, 1)
70
#define LED1_MODE GPIO_OUT
71
#define LED1_MASK (PIN1_bm)
72
#define LED1_ON (LED_PORT.OUTCLR = LED1_MASK)
73
#define LED1_OFF (LED_PORT.OUTSET = LED1_MASK)
74
#define LED1_TOGGLE (LED_PORT.OUTTGL = LED1_MASK)
75
76
#define LED2_PIN GPIO_PIN(PORT_E, 2)
77
#define LED2_MODE GPIO_OUT
78
#define LED2_MASK (PIN2_bm)
79
#define LED2_ON (LED_PORT.OUTCLR = LED2_MASK)
80
#define LED2_OFF (LED_PORT.OUTSET = LED2_MASK)
81
#define LED2_TOGGLE (LED_PORT.OUTTGL = LED2_MASK)
82
83
#define LED3_PIN GPIO_PIN(PORT_E, 3)
84
#define LED3_MODE GPIO_OUT
85
#define LED3_MASK (PIN3_bm)
86
#define LED3_ON (LED_PORT.OUTCLR = LED3_MASK)
87
#define LED3_OFF (LED_PORT.OUTSET = LED3_MASK)
88
#define LED3_TOGGLE (LED_PORT.OUTTGL = LED3_MASK)
89
90
#define LED4_PIN GPIO_PIN(PORT_E, 4)
91
#define LED4_MODE GPIO_OUT
92
#define LED4_MASK (PIN4_bm)
93
#define LED4_ON (LED_PORT.OUTCLR = LED4_MASK)
94
#define LED4_OFF (LED_PORT.OUTSET = LED4_MASK)
95
#define LED4_TOGGLE (LED_PORT.OUTTGL = LED4_MASK)
96
97
#define LED5_PIN GPIO_PIN(PORT_E, 5)
98
#define LED5_MODE GPIO_OUT
99
#define LED5_MASK (PIN5_bm)
100
#define LED5_ON (LED_PORT.OUTCLR = LED5_MASK)
101
#define LED5_OFF (LED_PORT.OUTSET = LED5_MASK)
102
#define LED5_TOGGLE (LED_PORT.OUTTGL = LED5_MASK)
103
104
#define LED6_PIN GPIO_PIN(PORT_E, 6)
105
#define LED6_MODE GPIO_OUT
106
#define LED6_MASK (PIN6_bm)
107
#define LED6_ON (LED_PORT.OUTCLR = LED6_MASK)
108
#define LED6_OFF (LED_PORT.OUTSET = LED6_MASK)
109
#define LED6_TOGGLE (LED_PORT.OUTTGL = LED6_MASK)
110
111
#define LED7_PIN GPIO_PIN(PORT_E, 7)
112
#define LED7_MODE GPIO_OUT
113
#define LED7_MASK (PIN7_bm)
114
#define LED7_ON (LED_PORT.OUTCLR = LED7_MASK)
115
#define LED7_OFF (LED_PORT.OUTSET = LED7_MASK)
116
#define LED7_TOGGLE (LED_PORT.OUTTGL = LED7_MASK)
117
118
#define LED_PORT_MASK (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK | \
119
LED4_MASK | LED5_MASK | LED6_MASK | LED7_MASK)
126
#define BTN0_PIN GPIO_PIN(PORT_D, 0)
127
#define BTN0_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
128
#define BTN0_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
129
130
#define BTN1_PIN GPIO_PIN(PORT_D, 1)
131
#define BTN1_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
132
#define BTN1_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
133
134
#define BTN2_PIN GPIO_PIN(PORT_D, 2)
135
#define BTN2_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
136
#define BTN2_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
137
138
#define BTN3_PIN GPIO_PIN(PORT_D, 3)
139
#define BTN3_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
140
#define BTN3_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
141
142
#define BTN4_PIN GPIO_PIN(PORT_D, 4)
143
#define BTN4_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
144
#define BTN4_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
145
146
#define BTN5_PIN GPIO_PIN(PORT_D, 5)
147
#define BTN5_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
148
#define BTN5_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
149
150
#define BTN6_PIN GPIO_PIN(PORT_R, 0)
151
#define BTN6_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
152
#define BTN6_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
153
154
#define BTN7_PIN GPIO_PIN(PORT_R, 1)
155
#define BTN7_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE)
156
#define BTN7_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW)
173
#define XTIMER_DEV TIMER_DEV(0)
174
#define XTIMER_CHAN (0)
175
#define XTIMER_WIDTH (16)
176
#define XTIMER_HZ KHZ(500)
177
#define XTIMER_BACKOFF (150)
180
#ifdef __cplusplus
181
}
182
#endif
183
units.h
Unit helper macros.
Generated on Mon Jun 30 2025 14:58:00 by
1.9.1