Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Thomas Perrot <thomas.perrot@tupi.fr>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include "periph_cpu_common.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
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
39enum {
40 PORT_B = 1,
41 PORT_C = 2,
42 PORT_D = 3,
43 PORT_E = 4,
44 PORT_F = 5
45};
46
52#define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
53 GPIO_PIN(PORT_D, 1), \
54 GPIO_PIN(PORT_D, 2), \
55 GPIO_PIN(PORT_D, 3) }
56
60static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
61{
62 (void)port_num;
63 return pin_num;
64}
65
69static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
70{
71 return ((pin_num < 4) && (port_num == PORT_D));
72}
73
78#define I2C_PORT_REG PORTD
79#define I2C_PIN_MASK (1 << PORTD0) | (1 << PORTD1)
81
86#define EEPROM_SIZE (1024U) /* 1kB */
88
89#ifdef __cplusplus
90}
91#endif
92
93#include "periph_conf.h"
95
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_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 ATmega32U4 Timer Config.