Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * Copyright (C) Josua Arndt, Steffen Robertz 2017 RWTH Aachen
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef PERIPH_CPU_H
21#define PERIPH_CPU_H
22
23#include "periph_cpu_common.h"
24#include "atmega_regs_common.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
33#define PM_NUM_MODES (5)
34#define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
35#define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
36#define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
37#define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
44enum {
45 PORT_B = 1,
46 PORT_D = 3,
47 PORT_E = 4,
48 PORT_F = 5,
49 PORT_G = 6,
50};
58#define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
59 GPIO_PIN(PORT_D, 1), \
60 GPIO_PIN(PORT_D, 2), \
61 GPIO_PIN(PORT_D, 3), \
62 GPIO_PIN(PORT_E, 4), \
63 GPIO_PIN(PORT_E, 5), \
64 GPIO_PIN(PORT_E, 6), \
65 GPIO_PIN(PORT_E, 7) }
66
70static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
71{
72 (void)port_num;
73 return pin_num;
74}
75
79static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
80{
81 if (pin_num < 4) {
82 return port_num == PORT_D;
83 }
84
85 return port_num == PORT_E;
86}
87
92#define I2C_PORT_REG PORTD
93#define I2C_PIN_MASK (1 << PORTD1) | (1 << PORTD0)
100#define EEPROM_SIZE (4096U) /* 4kB */
103#ifdef __cplusplus
104}
105#endif
106
107#include "periph_conf.h"
108#include "default_timer_config.h"
109
110#endif /* PERIPH_CPU_H */
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:82
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:73
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_G
port G
Definition periph_cpu.h:53
@ PORT_F
port F
Definition periph_cpu.h:52
@ PORT_E
port E
Definition periph_cpu.h:51
@ PORT_D
port D
Definition periph_cpu.h:50
Default timer configuration.
CMSIS style register definitions for the atmega family.