Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 HAW Hamburg
3 * SPDX-FileCopyrightText: 2016 Freie Universität Berlin
4 * SPDX-FileCopyrightText: 2016 INRIA
5 * SPDX-License-Identifier: LGPL-2.1-only
6 */
7
8#pragma once
9
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include "periph_cpu_common.h"
27
32#define PM_NUM_MODES (5)
33#define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
34#define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
35#define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
36#define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
38
42enum {
43 PORT_A = 0,
44 PORT_B = 1,
45 PORT_C = 2,
46 PORT_D = 3,
47 PORT_E = 4,
48 PORT_F = 5,
49 PORT_G = 6,
50};
51
57#define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
58 GPIO_PIN(PORT_D, 1), \
59 GPIO_PIN(PORT_D, 2), \
60 GPIO_PIN(PORT_D, 3), \
61 GPIO_PIN(PORT_E, 4), \
62 GPIO_PIN(PORT_E, 5), \
63 GPIO_PIN(PORT_E, 6), \
64 GPIO_PIN(PORT_E, 7) }
65
69static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
70{
71 (void)port_num;
72 return pin_num;
73}
74
78static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
79{
80 if (pin_num < 4) {
81 return port_num == PORT_D;
82 }
83
84 return port_num == PORT_E;
85}
86
91#define I2C_PORT_REG PORTD
92#define I2C_PIN_MASK (1 << PORTD0) | (1 << PORTD1)
94
99#define EEPROM_SIZE (4096U) /* 4kB */
101
102#ifdef __cplusplus
103}
104#endif
105
106#include "periph_conf.h"
107#include "default_timer_config.h"
108
Default timer configuration.
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_C
port C
Definition periph_cpu.h:45
@ PORT_F
port F
Definition periph_cpu.h:48
@ PORT_E
port E
Definition periph_cpu.h:47
@ PORT_A
port A
Definition periph_cpu.h:43
@ PORT_D
port D
Definition periph_cpu.h:46