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-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
19
20#include "periph_cpu_common.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
30#define PM_NUM_MODES (5)
31#define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
32#define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
33#define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
34#define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
36
40#define GPIO_PIN(x, y) ((x << 4) | y)
41
45enum {
46 PORT_B = 1,
47 PORT_C = 2,
48 PORT_D = 3
49};
50
56#define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 2), \
57 GPIO_PIN(PORT_D, 3) }
58
62static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
63{
64 (void)port_num;
65 return pin_num - 2;
66}
67
71static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
72{
73 if (port_num == PORT_D) {
74 return ((pin_num == 2) || (pin_num == 3));
75 }
76
77 return false;
78}
79
84#define I2C_PORT_REG PORTC
85#define I2C_PIN_MASK (1 << PORTC4) | (1 << PORTC5)
87
92#define EEPROM_SIZE (1024U) /* 1kB */
94
95#ifdef __cplusplus
96}
97#endif
98
99#include "periph_conf.h"
100#include "default_timer_config.h"
101
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_C
port C
Definition periph_cpu.h:45
@ PORT_D
port D
Definition periph_cpu.h:46
Default timer configuration.