periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 HAW Hamburg
3  * 2016 Freie Universität Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
21 #ifndef PERIPH_CPU_H
22 #define PERIPH_CPU_H
23 
24 #include "periph_cpu_common.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 #define PM_NUM_MODES (5)
35 #define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
36 #define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
37 #define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
38 #define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
44 enum {
45  PORT_A = 0,
46  PORT_B = 1,
47  PORT_C = 2,
48  PORT_D = 3,
49  PORT_E = 4,
50  PORT_F = 5,
51  PORT_G = 6,
52  PORT_H = 7,
53  PORT_J = 8,
54  PORT_K = 9,
55  PORT_L = 10
56 };
57 
63 #define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
64  GPIO_PIN(PORT_D, 1), \
65  GPIO_PIN(PORT_D, 2), \
66  GPIO_PIN(PORT_D, 3), \
67  GPIO_PIN(PORT_E, 4), \
68  GPIO_PIN(PORT_E, 5), \
69  GPIO_PIN(PORT_E, 6), \
70  GPIO_PIN(PORT_E, 7) }
71 
75 static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
76 {
77  (void)port_num;
78  return pin_num;
79 }
80 
84 static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
85 {
86  if (pin_num < 4) {
87  return port_num == PORT_D;
88  }
89 
90  return port_num == PORT_E;
91 }
92 
97 #define I2C_PORT_REG PORTD
98 #define I2C_PIN_MASK (1 << PORTD0) | (1 << PORTD1)
105 #define EEPROM_SIZE (4096U) /* 4kB */
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #include "periph_conf.h"
113 #include "default_timer_config.h"
114 
115 #endif /* PERIPH_CPU_H */
@ PORT_B
port B
Definition: periph_cpu.h:48
@ PORT_G
port G
Definition: periph_cpu.h:53
@ PORT_C
port C
Definition: periph_cpu.h:49
@ PORT_F
port F
Definition: periph_cpu.h:52
@ PORT_E
port E
Definition: periph_cpu.h:51
@ PORT_A
port A
Definition: periph_cpu.h:47
@ PORT_D
port D
Definition: periph_cpu.h:50
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:84
@ PORT_K
port K
Definition: periph_cpu.h:54
@ PORT_H
port H
Definition: periph_cpu.h:52
@ PORT_J
port J
Definition: periph_cpu.h:53
@ PORT_L
port L
Definition: periph_cpu.h:55
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:75
Default timer configuration.