Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Josua Arndt, Steffen Robertz, RWTH Aachen
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include "periph_cpu_common.h"
20#include "atmega_regs_common.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
29#define PM_NUM_MODES (5)
30#define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
31#define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
32#define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
33#define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
35
40enum {
41 PORT_B = 1,
42 PORT_D = 3,
43 PORT_E = 4,
44 PORT_F = 5,
45 PORT_G = 6,
46};
48
54#define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
55 GPIO_PIN(PORT_D, 1), \
56 GPIO_PIN(PORT_D, 2), \
57 GPIO_PIN(PORT_D, 3), \
58 GPIO_PIN(PORT_E, 4), \
59 GPIO_PIN(PORT_E, 5), \
60 GPIO_PIN(PORT_E, 6), \
61 GPIO_PIN(PORT_E, 7) }
62
66static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
67{
68 (void)port_num;
69 return pin_num;
70}
71
75static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
76{
77 if (pin_num < 4) {
78 return port_num == PORT_D;
79 }
80
81 return port_num == PORT_E;
82}
83
88#define I2C_PORT_REG PORTD
89#define I2C_PIN_MASK (1 << PORTD1) | (1 << PORTD0)
91
96#define EEPROM_SIZE (4096U) /* 4kB */
98
99#ifdef __cplusplus
100}
101#endif
102
103#include "periph_conf.h"
104#include "default_timer_config.h"
105
static bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
Check if the given pin can be used as external interrupt.
Definition periph_cpu.h:78
static uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
Get the interrupt vector number of the given GPIO pin.
Definition periph_cpu.h:69
@ PORT_B
port B
Definition periph_cpu.h:44
@ PORT_G
port G
Definition periph_cpu.h:49
@ PORT_F
port F
Definition periph_cpu.h:48
@ PORT_E
port E
Definition periph_cpu.h:47
@ PORT_D
port D
Definition periph_cpu.h:46
Default timer configuration.
CMSIS style register definitions for the atmega family.