Loading...
Searching...
No Matches
periph_conf.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
17#include "mutex.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <stdint.h>
24#include <avr/io.h>
25
26#include "periph_cpu.h"
27
32static const timer_conf_t timer_config[] = {
33 {
34 .dev = (void *)&TCC1,
35 .pwr = PWR_RED_REG(PWR_PORT_C, PR_TC1_bm),
36 .type = TC_TYPE_1,
37 .int_lvl = { CPU_INT_LVL_LOW,
41 },
42 {
43 .dev = (void *)&TCC0,
44 .pwr = PWR_RED_REG(PWR_PORT_C, PR_TC0_bm),
45 .type = TC_TYPE_0,
46 .int_lvl = { CPU_INT_LVL_LOW,
50 }
51};
52
53#define TIMER_0_ISRA TCC1_CCA_vect
54
55#define TIMER_1_ISRA TCC0_CCA_vect
56#define TIMER_1_ISRB TCC0_CCB_vect
57#define TIMER_1_ISRC TCC0_CCC_vect
58#define TIMER_1_ISRD TCC0_CCD_vect
59
60#define TIMER_NUMOF ARRAY_SIZE(timer_config)
62
67static const uart_conf_t uart_config[] = {
68 { /* CDC-ACM */
69 .dev = &USARTE0,
70 .pwr = PWR_RED_REG(PWR_PORT_E, PR_USART0_bm),
71 .rx_pin = GPIO_PIN(PORT_E, 2),
72 .tx_pin = GPIO_PIN(PORT_E, 3),
73#ifdef MODULE_PERIPH_UART_HW_FC
74 .rts_pin = GPIO_UNDEF,
75 .cts_pin = GPIO_UNDEF,
76#endif
77 .rx_int_lvl = CPU_INT_LVL_LOW,
78 .tx_int_lvl = CPU_INT_LVL_LOW,
79 .dre_int_lvl = CPU_INT_LVL_OFF,
80 },
81};
82
83/* interrupt function name mapping */
84#define UART_0_RXC_ISR USARTE0_RXC_vect /* Reception Complete Interrupt */
85#define UART_0_DRE_ISR USARTE0_DRE_vect /* Data Register Empty Interrupt */
86#define UART_0_TXC_ISR USARTE0_TXC_vect /* Transmission Complete Interrupt */
87
88#define UART_NUMOF ARRAY_SIZE(uart_config)
90
95static const i2c_conf_t i2c_config[] = {
96 {
97 .dev = &TWIC,
98 .pwr = PWR_RED_REG(PWR_PORT_C, PR_TWI_bm),
99 .sda_pin = GPIO_PIN(PORT_C, 0),
100 .scl_pin = GPIO_PIN(PORT_C, 1),
101 .speed = I2C_SPEED_NORMAL,
102 .int_lvl = CPU_INT_LVL_LOW,
103 },
104};
105
106#define I2C_0_ISR TWIC_TWIM_vect
107
108#define I2C_NUMOF ARRAY_SIZE(i2c_config)
110
115static const spi_conf_t spi_config[] = {
116 {
117 .dev = &SPIC,
118 .pwr = PWR_RED_REG(PWR_PORT_C, PR_SPI_bm),
119 .sck_pin = GPIO_PIN(PORT_C, 7),
120 .miso_pin = GPIO_PIN(PORT_C, 6),
121 .mosi_pin = GPIO_PIN(PORT_C, 5),
122 .ss_pin = GPIO_PIN(PORT_C, 4),
123 },
124};
125
126#define SPI_NUMOF ARRAY_SIZE(spi_config)
128
136static const ebi_conf_t ebi_config = {
137 .addr_bits = 18, /* A0-A17 */
138 .flags = (EBI_PORT_LPC | EBI_PORT_CS2),
139 .sram_ale = 0,
140 .lpc_ale = 2,
141 .sdram = { 0 },
142 .cs = { /* Reserved A16 */
143 { EBI_CS_MODE_DISABLED_gc,
144 0,
145 EBI_CS_SRWS_0CLK_gc,
146 0x0UL,
147 }, /* Reserved A17 */
148 { EBI_CS_MODE_DISABLED_gc,
149 0,
150 EBI_CS_SRWS_0CLK_gc,
151 0x0UL,
152 }, /* CS2 - 256K SRAM */
153 { EBI_CS_MODE_LPC_gc,
154 EBI_CS_ASIZE_256KB_gc,
155 EBI_CS_SRWS_1CLK_gc,
156 0x0UL,
157 }, /* Reserved LCD */
158 { EBI_CS_MODE_DISABLED_gc,
159 0,
160 EBI_CS_SRWS_0CLK_gc,
161 0x0UL,
162 },
163 },
164};
166
167#ifdef __cplusplus
168}
169#endif
170
171#include "periph_conf_common.h"
172
@ PORT_C
port C
Definition periph_cpu.h:45
@ PORT_E
port E
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
#define PWR_RED_REG(reg, dev)
Define a CPU specific Power Reduction index macro.
Definition periph_cpu.h:75
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
@ CPU_INT_LVL_OFF
Interrupt Disabled.
Definition periph_cpu.h:36
@ CPU_INT_LVL_LOW
Interrupt Low Level.
Definition periph_cpu.h:37
Mutex for thread synchronization.
I2C configuration structure.
Definition periph_cpu.h:295
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214